Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Linked data indexing of distributed ledgers

1,377 views

Published on

Describes how we have used Linked Data to index Ethereum blockchains

Published in: Internet
  • Be the first to comment

Linked data indexing of distributed ledgers

  1. 1. Linked Data Indexing of Distributed Ledgers Allan Third and John Domingue (@johndmk) Knowledge Media Institute The Open University, UK http://blockchain.open.ac.uk/
  2. 2. Agenda • Motivation • Ethereum Model • Ontologies • Architecture • RDF examples • Smart Contracts • Challenges, Future Work and Summary
  3. 3. Motivation
  4. 4. Blockchain is a Linked List A blockchain actually contains two different hash structures. The first is a hash chain of blocks that links the different blocks to one another. The second is internal to each block and is a Merkle Tree of transactions within the blocks. This allows for efficiently verifiable proofs that a transaction was included in a block.
  5. 5. Contracts in Ethereum Maintain a data store representing something which is useful to either other contracts or to the outside world Serve as a sort of externally owned account with a more complicated access policy Manage an ongoing contract or relationship between multiple users Provide functions to other contracts; essentially serving as a software library. Contracts in Ethereum generally serve 4 purposes: source: Richard Gendal Brown “A Simple Model for Smart Contracts” http://gendal.me/2015/02/10/a-simple-model-for-smart-contracts/
  6. 6. Ethereum Model
  7. 7. Reputation Contract Functions: Storage: sendReputation getPersonBalance() getReputationAttribute attribs[address = > Attrib] Attrib { uint balanceOf; mapping(string => uint); string[] attribStrings } Reputation Attribute token Balances Reputation Smart Contract Tokens left to assign My Reputation Peer Reputation Page Kevin’s Reputation View Communication: 14 Collaboration: 06 Organisation: 12 Ethics: 05 Problem Solving: 10 Engagement: 04 your Ethereum address password to private key Signing this transaction will transfer stated Reputation Tokens + ETH gas payment from your account. Estimated gas cost is 0.02 ETH. Maximum gas cost is set to 0.05 ETH Transfer Reputation Tokens Left: 57 number of tokens to transfer Assign Reputation My Reputation Peer Reputation Page Michelle’s Reputation View Communication: 06 Collaboration: 02 Organisation: 10 Ethics: 12 Problem Solving: 08 Engagement: 16 your Ethereum address password to private key Signing this transaction will transfer stated Reputation Tokens + ETH gas payment from your account. Estimated gas cost is 0.02 ETH. Maximum gas cost is set to 0.05 ETH Transfer Reputation Tokens Left: 68 number of tokens to transfer Assign Reputation Signed TX Reputation Attribute token Balances Tokens left to assign Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  8. 8. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  9. 9. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  10. 10. Block no: 45566778 Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  11. 11. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  12. 12. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  13. 13. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  14. 14. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  15. 15. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  16. 16. Michelle transfers 4 Reputation tokens for ‘Organisation’ to Kevin
  17. 17. How do we… • …find Michelle’s transfers to everyone? • ...summarise reputation transferred by groups of users? • ...link data to semantically related external sources?
  18. 18. Linked Data indexing • Problems – Related data spread across blocks – No high-level semantics for contracts • Need – An index onto blockchain – To connect blockchain data to Linked Data – To allow richer contract semantics • LD index for blockchain
  19. 19. Ontologies for Blockchains
  20. 20. Flex Ledger 1.0 • A flexible format and protocol for decentralized ledgers on the Web • FL Web API to wrap blockchains – Vocab. extractable from JSON-LD model • No explicit semantics https://w3c.github.io/flex-ledger/
  21. 21. EthOn - An Ethereum Ontology http://ethon.consensys.net/EthOn_spec.html
  22. 22. BLONDiE Contract Ethereum Transaction Bitcoin Transaction Output Bitcoin Transaction Input Bitcoin Transaction hasBitcoin Transaction Output hasBitcoin Transaction Input Message Call Ethereum Transaction Contract Creation Ethereum Transaction Ethereum Transaction has Ethereum Transaction has Ethereum Payload hasOmmer Ethereum Ommer has Ethereum Blockheader hasPayload Ethereum Blockheader Normal Ethereum Transaction has Bitcoin Blockheader has Bitcoin Payload hasTransaction has Blockheader Bitcoin Blockheader https://github.com/hedugaro/Blondie
  23. 23. Minimal Service Model https://iserve.kmi.open.ac.uk/
  24. 24. Architecture
  25. 25. RDF Store Blockchain index Ethereum Listener Compiled Contract LOD Cloud Architecture Smart Contract Developer Linking Open Data cloud diagram 2017, by Andrejs Abele, John P. McCrae, Paul Buitelaar, Anja Jentzsch and Richard Cyganiak. http://lod-cloud.net/ Ethereum Node New Block Transaction & Block Metadata as RDF Deployment Contract Metadata as RDF
  26. 26. RDF Examples
  27. 27. Transaction RDF Example
  28. 28. Transaction RDF Example
  29. 29. Block RDF Example
  30. 30. Block RDF Example
  31. 31. SPARQL Example • Total value transferred to a specific contract address • Results
  32. 32. Smart Contracts
  33. 33. Indexing smart contracts • Contract deployment (Ethereum) – Blockchain address – Application Binary Interface (ABI) JSON • Exposed methods & parameters • Contract inaccessible without ABI – “Private” deployed contracts can’t be indexed
  34. 34. Smart Contract ABI JSON
  35. 35. Challenges, Future Work and Summary
  36. 36. Challenges & Future Work • Addressing – Linked Data needs URIs; how to get the “U”? • Ethereum Name Service: – “DNS for Ethereum” hosts .eth top-level domain – But specific to Ethereum • Currently use node URI – not distributed
  37. 37. Challenges & Future Work • Distributed index – Index on one node: centralised • But good for app-specific customisation • Could we have – Data (e.g., RDF) stored on IPFS/Swarm? – Queries executed within a smart contract? – i.e., both data & querying distributed • Performance & cost? • Use cases?
  38. 38. Our private Ethereum network • 6 nodes – 5 mining – 1 observation (running listener & RDF store) • Chain created 28th of April 2016 • 1 465 104 blocks (3.5 Gb) – As of 31/03/2017 • 22 million triples
  39. 39. Summary • Blockchains – Are a linked list based on hashes – No inbuilt indexing mechanism – Contain ‘smart contracts’ • Basic semantic indexing based on BLONDiE • Challenges – Universal naming system – Distributed vs centralised index

×