Monday 2 January 2017

Hyperledger - Corda Overview

The blockchain technology provides a possibility of the savings accruing from higher-quality data, fewer discrepancies, inconsistency and quicker agreement of details between firms.

Distributed ledgers(decentralised databases)
Systems that enable parties who don't fully trust each other to form and maintain consensus about the existence, status and evolution of a set of shared facts.

Corda is a distributed ledger platform. 

Once all parties to an agreement have assented, facts recorded on the ledger are final and immutable; errors and unwinds must be processed through a subsequent transaction. The only parties who should have access to the details of a financial transaction are those parties themselves. Records are accessible only to those actors with a legitimate interest.

Corda's smart contract is an agreement whose execution is both automatable by computer code working with human input and control, and whose rights and obligations, as expressed in legal prose, are legally enforceable. The smart contract links business logic and business data to associated legal prose.

There is no blocks of transactions linked together. Transaction races are deconflicted using pluggable notaries. Corda links ‘States’ which contain references to contract code written in computer code, a Sha256 hash of a legal document backing the state written in legalese, and a snapshot of various data which is operated on by transactions which are verified and signed by the aforementioned contract code.

Key Features:

  • New transaction types can be defined using JVM bytecode.
  • Transactions my execute in parallel on different nodes, without either node being aware of the other's transactions.
  • There is no block chain. A single network may contain multiple notaries.
  • Data is shared on a need-to-know basis. No global broadcast of all transactions.
  • Bytecode-to-bytecode transpilation is used to allow complex, multi-step transaction building protocol called flows to be modelled as blocking code.
  • Arbitrary object graphs are allowed to be stored in the ledger.
  • Nodes are backed by a relational database and data placed in the ledger can be queried using SQL as well as joined with private tables.
  • Recording explicit links between human-language legal prose documents(governing the agreement) and smart contract code.
Data Sharing:
  • Data is only shared with those parties which are required to see it. Any given actor sees only a subset of the overall data managed by the system as a whole. 
  • A piece of data is "on-ledger" if at least two actors on the system are in consensus as to its existence and details. 
  • Data held by only one actor is "off-ledger", e.g. internal reference data.

The uniqueness services are not required to see the full contents of any transactions, significantly improving privacy and scalability of the system.
Corda does not contain a general gossip protocol which broadcasts all transactions to the network. Transactions that occur on the ledger are not broadcast to a public depository or written into blocks.

Smart Contract Code:

Smart contracts in Corda are defined using JVM bytecode. A contract is simply a class that implements the Contract interface, which exposes a function call verify. The verify function is passed a transaction and verify its validity.

Business logic is defined through smart contract code, which is constructed as a pure function, which can be composed from simpler functions. The functions interpret transactions as taking states as inputs and producing output states through the smart contract. Contracts do not have storage or the ability to interact with anything. 


Corda Data Model:

Corda uses the UTXO model. Transactions have inputs, outputs and signature. Corda database rows can contain arbitrary data by using States. Each state points to a notary, which is a service to sign a transaction only if all the input states are un-consumed.

State objects: represent an agreement between parties, governed by Smart Contract Code, which is intended to implement portions of human-readable legal prose. It contains Contract Code Reference and Legal Prose Reference. States are the atomic unit of data. Data is shared on a need-to-know basis. Corda requires some form of legal document to be tied to a state.

States are the atomic unit of information in Corda. They are never altered: they are either current(unspent) or consumed(spent) no longer valid.

State object is a digital document which records the existence, content and current state of an agreement between parties. The ledger is defined as a set of immutable state objects. 

Updates are applied using transactions, which consume existing state objects and produce new state objects. Parties can agree on transaction validity by independently running the same contract code and validation logic. Transactions consume zero or more states and create zero or more new states. Because states cannot exist outside of the transactions that created the, any state whether consumed or not can be identified by the identifier of the creating transaction and the index of the state in the outputs list.

Input Reference: There are (hash, output index) pairs that point to the states a transaction is consuming.

Output States: Each state specifies the notary for the new state. The contract finally defines the data.

Attachments: Transactions specify an ordered list of zip file hashes. Each zip file may contain code, data, certificates or supporting document for the transaction.

Commands: A command is essentially a parameter to the contract that specifies more information than is obtainable from examination of the states by themselves. Each command has an associated list of public keys. Like states, commands are object graphs.

Signatures: The set of required signatures is equal to the union of the commands' public keys. Signatures are appended to the end of a transaction and transactions are identified by the hash used for signing. The transaction will not be valid unless every key listed in every command has a matching signature.




Flow Framework:

Unlike traditional block chain systems in which the primary form of communication is global broadcast, in Corda all communication takes the form of small multi-party sub-protocols called flows.
APIs are provided to send and receive object graphs to and from other identities on the network, embed sub-flows, and report progress to observers. The first time a flow's call method is invoked a bytecode-to-bytecode transformation occurs that rewrites the classes into a form that implements a resumable state machine.

Transactions: transition state objects through a lifecycle

Transaction Protocols: enables parties to coordinate actions without a central controller.

CorDapp(Corda Distributed App): The combination of state objects(data), Contract Code(allowable operation), Transaction Protocols(business logic choreography).


Reference:
https://www.linkedin.com/pulse/r3-corda-isnt-blockchain-what-does-mean-you-tai-kersten?trk=hp-feed-article-title-like



No comments:

Post a Comment