3. Use Cases
● Implement new consensus protocol and plug it easily into
a prototypical blockchain system to run a system against a
testbed
● In the same way, implement and spread a proof-of-concept
impl. for anew transactional language
5. The Problem
● Bitcoin(reference impl): > 80K lines of C++ code
● EthereumJ: > 55K of Java code
● Nxt: > 40K lines of Java code
● Every codebase is highly optimized for a concrete
production environment
6. The Problem
● It is hard to locate, inject, swap functionalities
● Hard to make experiments/prototypes
7. Scorex in General
● Find fast where to inject
● Modular stacked design
● Externalised cryptography(scrypto)
● One testnet application atm(Lagonaki)
8. Scorex in General, pt 2
● Everything is open-sourced immediately
● CC0 license
● Maintained by IOHK Research
12. Scorex is in Scala
● Functional language, strict static typing
● JVM
● Could be enhanced with any JVM language(Java, Clojure,
Kotlin, Groovy, Jython, Frege etc)
13. Development Philosophy
● Flexible design could be hard to understand
● Simple code could be not flexible or error-prone
● We need to find a balance!
● Give a maximum for free!
14. Design In General
● Compact core – always for free
● Consensus module - implement or take ready
● Transactional module - implement or take ready
● Network protocols – partly for free
● API – partly for free
● Application – lean!
● Wallet, configs – partly for free
15. A Module
● Writes and reads certain block parts
● Implements corresponding interface
16. Code Quality
● Compact code, strict types
● Good test coverage(70-80%)
● Continuous integration
17. Getting Started
● Docs on GitHub:
https://github.com/ScorexProject/Scorex/wiki/Getting-started
● Java 8 SDK
● sbt is recommended for Scala
20. Application - modules
class MyApplication(val settingsFilename: String) extends Application {
// Your application config
override val applicationName = "my cool application"
override val appVersion = ApplicationVersion(0, 1, 0)
override implicit lazy val settings = new Settings with
TransactionSettings {
override val filename: String = settingsFilename
}
// Define consensus and transaction modules of your application
override implicit lazy val consensusModule = new
NxtLikeConsensusModule()
override implicit lazy val transactionModule = new
SimpleTransactionModule()(settings, this)
21. Application - API
// Define API routes of your application
override lazy val apiRoutes = Seq(
BlocksApiRoute(this),
TransactionsApiRoute(this),
NxtConsensusApiRoute(this),
WalletApiRoute(this),
PaymentApiRoute(this),
UtilsApiRoute(this),
PeersApiRoute(this),
AddressApiRoute(this)
)
// API types are required for swagger support
override lazy val apiTypes = Seq(
typeOf[BlocksApiRoute],
typeOf[TransactionsApiRoute],
typeOf[NxtConsensusApiRoute],
typeOf[WalletApiRoute],
typeOf[PaymentApiRoute],
typeOf[UtilsApiRoute],
typeOf[PeersApiRoute],
typeOf[AddressApiRoute]
)
22. Application – network protocols
// Create your custom messages and add them to additionalMessageSpecs
override lazy val additionalMessageSpecs =
TransactionalMessagesRepo.specs
// Start additional actors
actorSystem.actorOf(Props(classOf[UnconfirmedPoolSynchronizer], this))
}
23. Launch The Application
object MyApplication extends App {
// Provide filename by command-line arguments
val filename = args.headOption.getOrElse("settings.json")
// Create application instance
val application = new MyApplication(filename)
// Run it
application.run()
// Generate account in your wallet
if (application.wallet.privateKeyAccounts().isEmpty)
application.wallet.generateNewAccounts(1)
}