Weaving the ILP Fabric into Bigchain DB

24
Weaving the ILP fabric into BigchainDB Dimitri De Jonghe

Transcript of Weaving the ILP Fabric into Bigchain DB

Page 1: Weaving the ILP Fabric into Bigchain DB

Weaving the ILP fabric into BigchainDB

Dimitri De Jonghe

Page 2: Weaving the ILP Fabric into Bigchain DB

BigchainDB 101

Assets & Crypto-Conditions

BigchainDB Ledger Plugin

Page 3: Weaving the ILP Fabric into Bigchain DB

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

Page 4: Weaving the ILP Fabric into Bigchain DB

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

Page 5: Weaving the ILP Fabric into Bigchain DB

RethinkDBCluster

Architecture

BigchainDB Federation

Alice

Bob

Blockchain consensusByzantine actors -> quorum_________________

Big data consensusRAFT -> strong consistency_________________

Page 6: Weaving the ILP Fabric into Bigchain DB

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

Page 7: Weaving the ILP Fabric into Bigchain DB

BigchainDB 101

Assets & Crypto-Conditions

BigchainDB Ledger Plugin

Page 8: Weaving the ILP Fabric into Bigchain DB

Transaction chain

Append only

Page 9: Weaving the ILP Fabric into Bigchain DB

Assets

____Currency

____(In-)tangible assets

____Digital content/licenses

____Supply chain

Page 10: Weaving the ILP Fabric into Bigchain DB

Assets with crypto-conditions

Turing completeness

priva

te-p

ublic

key

mul

ti-sig

natu

res

crypto-conditions

smar

t-con

tract

s

Page 11: Weaving the ILP Fabric into Bigchain DB

{

"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()

Page 12: Weaving the ILP Fabric into Bigchain DB

{

"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()

Page 13: Weaving the ILP Fabric into Bigchain DB

Tracking the story of 3 assets

Page 14: Weaving the ILP Fabric into Bigchain DB

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

Page 15: Weaving the ILP Fabric into Bigchain DB

“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

Page 16: Weaving the ILP Fabric into Bigchain DB

“Experimental” crypto-conditions

Timeout-condition

now() < expiry_time

Inverterif fact == True: output = False

Page 17: Weaving the ILP Fabric into Bigchain DB

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']

Page 18: Weaving the ILP Fabric into Bigchain DB

BigchainDB 101

Assets & Crypto-Conditions

BigchainDB Ledger Plugin

Page 19: Weaving the ILP Fabric into Bigchain DB

BigchainDB web stack

API websocket

ilp-plugin-bigchaindb / <your_app>

Page 20: Weaving the ILP Fabric into Bigchain DB

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

Page 21: Weaving the ILP Fabric into Bigchain DB

Demo!

Page 22: Weaving the ILP Fabric into Bigchain DB

Hackaton Proposals

• Challenge: Payment system + Fungible Assets

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

Page 23: Weaving the ILP Fabric into Bigchain DB

When Alice wants to listen to music...

Alice $0.5

Escrow 0

StreamCoin 0

StreamCoin 1

Escrow 0

PAYS 0

© Interledger Community

Page 24: Weaving the ILP Fabric into Bigchain DB