a bigchaindb use case: weaving the ilp fabric into bigchaindb

Post on 15-Apr-2017

200 Views

Category:

Software

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Weaving the ILP fabric into BigchainDB

Dimitri De Jonghe

BigchainDB 101

Assets & Crypto-Conditions

BigchainDB Ledger Plugin

Throughput>1,000,000 writes/s

~100,000 transactions/s

Latency<100 ms

CapacityPetabytes with each node adding 48TB

QueryDatabase is fully

queryable

ScalabilityPerformance increases as

nodes are added

DecentralizationFederated

non-anonymous participation

Blockchain-ify big data

Retain big-data performanceOrdering of events by PAXOS-like solverNatural ordered log of transactions

Add blockchain characteristicsDecentralizationFederated voting on transactions Group into blocks for speed

ImmutabilityHash on prev. blocksAppend only!

AssetsDigital signatures and other trapdoor functions

RethinkDBCluster

Architecture

BigchainDB Federation

Alice

Bob

Blockchain consensusByzantine actors -> quorum_________________

Big data consensusRAFT -> strong consistency_________________

Decentralization of the Cloud

Proc’ing

FS Dec. DB/Ledger

Partly Dec. Apps

Proc’ing

FS DB

Apps

Dec. Proc’ing

Dec. FS Dec. DB/Ledger

Dec. Apps

CentralizedPartly

DecentralizedFully

Decentralized

BigchainDB 101

Assets & Crypto-Conditions

BigchainDB Ledger Plugin

Transaction chain

Append only

Assets

____Currency

____(In-)tangible assets

____Digital content/licenses

____Supply chain

Assets with crypto-conditions

Turing completeness

priva

te-p

ublic

key

mul

ti-sig

natu

res

crypto-conditions

smar

t-con

tract

s

{

"id":"933cd83a419d2735822a2154c84176a2f419cbd449a74b94e592ab807af23861",

"transaction":{

"conditions":[{

"cid":0,

"condition":{

"details":{

"bitmask":32,

"public_key":"BwuhqQX8FPsmqYiRV2CSZYWWsSWgSSQQFHjqxKEuqkPs",

"signature":None,

"type":"fulfillment",

"type_id":4

},

"uri":"cc:4:20:oqXTWvR3afHHX8OaOO84kZxS6nH4GEBXD4Vw8Mc5iBo:96"

},

"new_owners":["BwuhqQX8FPsmqYiRV2CSZYWWsSWgSSQQFHjqxKEuqkPs"]

}],

"data":{

"hash":"872fa6e6f46246cd44afdb2ee9cfae0e72885fb0910e2bcf9a5a2a4eadb417b8",

"payload":{"msg":"Hello BigchainDB!"}

},

"fulfillments":[{

"current_owners":["3LQ5dTiddXymDhNzETB1rEkp4mA7fEV1Qeiu5ghHiJm9"],

"fid":0,

"fulfillment":"cf:4:Iq-BcczwraM2UpF-TDPdwK8fQ6IXkD_6uJaxBZd984yx…",

"input":None

}],

"operation":"CREATE",

"timestamp":"1460981667.449279"

},

"version":1

}

Assets with crypto-conditions

condition = cc.Ed25519Fulfillment()condition.public_key = “BwuhqQ...” # optionally provide condition structurecondition.to_dict()

condition.condition_uri

fulfillment = \ input.conditions[0].from_dict()fulfillment.sign(message, private_key)

fulfillment.serialize_uri()

{

"id":"933cd83a419d2735822a2154c84176a2f419cbd449a74b94e592ab807af23861",

"transaction":{

"conditions":[{

"cid":0,

"condition":{

"details":{

"bitmask":32,

"public_key":"BwuhqQX8FPsmqYiRV2CSZYWWsSWgSSQQFHjqxKEuqkPs",

"signature":None,

"type":"fulfillment",

"type_id":4

},

"uri":"cc:4:20:oqXTWvR3afHHX8OaOO84kZxS6nH4GEBXD4Vw8Mc5iBo:96"

},

"new_owners":["BwuhqQX8FPsmqYiRV2CSZYWWsSWgSSQQFHjqxKEuqkPs"]

}],

"data":{

"hash":"872fa6e6f46246cd44afdb2ee9cfae0e72885fb0910e2bcf9a5a2a4eadb417b8",

"payload":{"msg":"Hello BigchainDB!"}

},

"fulfillments":[{

"current_owners":["3LQ5dTiddXymDhNzETB1rEkp4mA7fEV1Qeiu5ghHiJm9"],

"fid":0,

"fulfillment":"cf:4:Iq-BcczwraM2UpF-TDPdwK8fQ6IXkD_6uJaxBZd984yx…",

"input":None

}],

"operation":"CREATE",

"timestamp":"1460981667.449279"

},

"version":1

}

Transaction malleability

fulfillment = \ input.conditions[0].from_dict()fulfillment.sign(message, private_key)

fulfillment.serialize_uri()

Tracking the story of 3 assets

Other crypto-conditions

BigchainDB supports crypto-conditions natively:

● Hashlocks: Preimage-SHA-256● Signatures: Ed25519● Threshold: complex branches possible

Python version for crypto-conditions @

https://github.com/bigchaindb/cryptoconditions

>pip install cryptoconditions

“Experimental” crypto-conditions

BigchainDB append only, how to provide escrow?

if timeout_condition.validate(utcnow()):

execute_fulfillment.validate(msg) == True

abort_fulfillment.validate(msg) == False

else:

execute_fulfillment.validate(msg) == False

abort_fulfillment.validate(msg) == True

“Experimental” crypto-conditions

Timeout-condition

now() < expiry_time

Inverterif fact == True: output = False

Utils for crypto-conditions

JSON/dict serialization: to_dict(), from_dict()

Queryability of complex branches:get/update/insert/remove subconditions

get_subcondition_path_for_type(type_id):

…return subcondition, indices

fulfillment.subconditions[indices[0]]['body'] \

.subconditions[indices[1]]['body'] \

.subconditions[indices[2]]['body']

BigchainDB 101

Assets & Crypto-Conditions

BigchainDB Ledger Plugin

BigchainDB web stack

API websocket

ilp-plugin-bigchaindb / <your_app>

BigchainDB Ledger Pluginconnect()/disconnect()

Connect to a BigchainDB API + websocket

getBalance()

Retrieve the number of assets for an account

send(transfer)

Local ledger escrow

fulfillCondition(transfer, conditionFulfillment)

Fulfill the execute branch of the escrow

getConnectors(): <example-specific>Get accounts with multi-ledger connections

Demo!

Hackaton Proposals

• Challenge: Payment system + Fungible Assets

• Idea: Pay as you stream platform– 1 StreamCoin = Y dollars– 1 StreamCoin = X time units of streaming

When Alice wants to listen to music...

Alice $0.5

Escrow 0

StreamCoin 0

StreamCoin 1

Escrow 0

PAYS 0

© Interledger Community

top related