Slide 1

Slide 1 text

INTRODUCTION TO STELLAR-CORE Nicolas Barry – Stellar Development Foundation

Slide 2

Slide 2 text

BEFORE WE START ! Stellard = code that runs the old network ! I am not talking about this today. ! New stack is built with different priorities and design principles ! Complete rewrite ! This presentation.

Slide 3

Slide 3 text

AGENDA ! High level goals ! Design principles ! High level architecture ! New features ! Q&A

Slide 4

Slide 4 text

HIGH LEVEL GOALS ! ! The only limiting factor to the ecosystem of apps written on Stellar should be entrepreneurs’ creativity ! Simple APIs ! Easy to write secure and correct code ! Rich developer community around the Stellar stack ! Low bar of entry ! Leverage skills of all developers ! Running the network should be cheap and easy ! Design for billions of accounts and thousands of transactions per second running on commodity hardware

Slide 5

Slide 5 text

DESIGN PRINCIPLES ! Split the notion of “Core protocol” and middleware goodness ! “Core protocol implementation” == stellar-core ! Unlock innovation where people have expertise ! The “Core protocol” is standard ! Simple to understand and validate ! Documented, aiming for RFC ! Bar for writing correct and secure applications on top of stellar-core should be low ! Clear split between Stellar-core components (historical vs real time) ! Runtime is predictable: quality, performance

Slide 6

Slide 6 text

ARCHITECTURE:
 BASIC RESPONSIBILITIES ! Manages the ledger chain ! Ledger = state of all entries (Accounts, Order Book, etc.) + link to previous ledger ! Picks the set of transactions to include in the next ledger ! Enforces invariants ! Transaction validity ! Signatures ! No double spend ! Consistent ledger state (minimum balance, etc.) ! P2P, Designed for decentralized runtime

Slide 7

Slide 7 text

LEDGER BASICS: APPLYING TRANSACTIONS Ledger #1000 {A=100, B = 1000, C = 5000} • A: send 10 to B • A: send 20 to C Ledger #1001 {A=70, B = 1010, C = 5020} • A: send 10 to B • B: send 20 to C Ledger #1002 {A=60, B= 1000, C = 5040}

Slide 8

Slide 8 text

LEDGER BASICS: DATA ! Stellar-core is optimized to make changes to the “latest ledger”. ! While doing so, it also generates data kept in a historical data store. ! For new nodes to catch up ! Confirm transactions and their results ! Auditing

Slide 9

Slide 9 text

LEDGER BASICS: LEDGER CHAIN Ledger 1000 • State = {A=100, B = 1000, C = 5000} • Transaction Set 1000 Ledger 999 • State = {A=70, B = 1010, C = 5020} • Transactio n Set 999 Ledger … Ledger 1 (genesis) • State = {} • (no transactio ns)

Slide 10

Slide 10 text

KEY CHANGES : THE STACK Clients/Gateways APIs • Ledger API • Historical APIs Core engine • Consensus • P2P • Storage Working set store (SQL) • stellar- core engine • Ledger API Transaction Meta Data (SQL) • Raw historical store (S3) • History APIs Processed historical store (*SQL) • Processor • Extende d APIs Then Now Dev Expertise: C++ Full Stack Storage stellard Consensus P2P

Slide 11

Slide 11 text

KEY CHANGES: THE STACK ! Ledger API ! Query the current state of the ledger (latest) ! Submit transactions to the network ! History API ! Transactions results ! Transaction history for an account ! State of an account at arbitrary point in time ! Extended APIs ! Path finding ! Complex auditing !

Slide 12

Slide 12 text

PROGRESS ! Enable a rich ecosystem ! Horizon (go/ruby) ! ! Easy to write secure and correct code ! Protocol definition in XDR for both input and output (strict & less bugs) ! Ease of access for core contributors ! Nimble code base: 45k lines of code (from 200k without much tests) ! C++ 11 ! Low bar of entry for running nodes ! Low memory and CPU footprint ! Rich built in metrics for monitoring all parts of the system

Slide 13

Slide 13 text

NEW FEATURES ! Low level ! New consensus algorithm (SCP) ! Rich support for protocol upgrade ! Multi-sig ! Batching ! Simple contracts ! New asset classes ! Federation (KYC)

Slide 14

Slide 14 text

MULTI-SIG: INTRO ! An account has the following optional properties: ! List of (signer, weight) – signer is just a public key, weight a number ! thresholds for various operations ! ! A transaction originating from an account is validated by computing the sum of the weights of all signatures attached to the transaction

Slide 15

Slide 15 text

MULTI-SIG: EXAMPLE ! An account (A,10) has (S1, 3) and (S2, 3) and a threshold of 3 for medium operations, and 6 for high operations. ! Such an account can: ! Send a payment using any one of A, S1 or S2. ! Change the policy either by signing a “change policy” operation with A or by signing with both S1 and S2. ! Changing the threshold to 10 for high operations would cause only A to have the right to change the policy. ! The key trivially associated with A is called the “master key”.

Slide 16

Slide 16 text

BATCHING ! Transactions are now conceptually decoupled from what we call operations. ! An operation is something like “Payment” or “Create an offer”. ! A transaction is an ordered list of operations that get applied in order atomically. ! If all operations succeed, the transaction is considered “successful” ! If one of the operations fails, the transaction is marked as “failed” and none of the operations are applied

Slide 17

Slide 17 text

MULTI-SIG+BATCHING Batching gets particularly powerful when combined with multi-sig as operations can operate on different accounts within the same transaction.

Slide 18

Slide 18 text

MULTI-SIG+BATCHING: EXAMPLE ! Private exchange without third party/escrow ! ! A wants to send B some credits X (Operation 1) in exchange for credits Y (Operation 2). ! ! The transaction looks like: ! Operation 1 = A: send X -> B ! Operation 2 = B: send Y -> A ! ! The transaction needs to be signed with signatures that control accounts A and B. ! In this case the transaction needs to be signed by A, S1 or S2 ; and by B

Slide 19

Slide 19 text

WHAT NEXT? ! Launch of production network ! (fix bugs) ! Iterate from feedback ! Compliance & Privacy

Slide 20

Slide 20 text

THIS IS JUST THE BEGINNING ! The Stack built on top of stellar-core is really a family of stacks ! Horizon is the first pass at what can be built on Stellar ! ! I envision many other stacks or mini stacks built on top of the low level primitives ! Some may push more logic client side, removing the need for trusting single services (ssl-proxy like access to the network as a whole). ! ! Some will probably come to light with alternate implementations of stellar-core that expose new ways to communicate what the network is doing to other layers

Slide 21

Slide 21 text

THANK YOU ! Resources ! stellar-core GitHub https://github.com/stellar/stellar-core/ ! IRC/Slack #stellar-dev ! Documentation https://www.stellar.org/developers/ ! Ask me questions @MonsieurNicolas