Quorum : Ethereum-based distributed ledger protocol

In Simple words Quorum is an Ethereum-based distributed ledger protocol that supports transaction and contract privacy.

The primary features of Quorum.

  • Transaction and contract privacy
  • Voting-based consensus mechanism
  • Network/Peer permissions management
  • Higher performance

Apart from these feature Quorum includes one of the powerful feature that is support of  Private and Public Transactions.

  • Private Transaction :- are those Transactions whose payload is only visible to the network participants whose public keys are specified in the privateFor parameter of the Transaction . privatefor can take multiple addresses in a comma separated list.
  • Public Transaction :- These are those Transactions whose payload is visible to all participants of the same Quorum network. These are created as standard Ethereum Transactions in the usual way.

The treatment of both type of transaction is different for Public Transaction it is sent to an Account that holds Contract code, each participant will execute the same code and their underlying StateDBs will be updated accordingly. But For Private Transaction  it replaces the original Transaction Payload with a hash of the encrypted Payload that it receives from Constellation. Participants that are party to the Transaction will be able to replace the hash with the actual payload via their Constellation instance, whilst those Participants that are not party will only see the hash.

Now let see how Quorum works Internally.

quorumtransactionprocessing

The process of a Transaction in Quorum is describe in the image.including Private Transaction Happening between A and B and there are 3 member in the network [A, B and C]  :-

  1. In First step the  request of Transaction is send to corresponding Quorum Node  i.e. A -> Quorum Node A. [Including Transaction A to B]
  2. A’s Quorum Node passes the Transaction on to its paired Transaction Manager, [Transaction Manager A] requesting for it to store the Transaction payload.
  3. A’s Transaction Manager makes a call to its associated Enclave to validate the sender and encrypt the payload.
  4. A’s Enclave checks the private key for Party A and, once validated, performs the Transaction conversion.
  5. Party A’s Transaction manager then stores the encrypted payload  and encrypted symmetric key and then securely transfers (via HTTPS) the hash, encrypted payload, and encrypted symmetric key that has been encrypted with Party B’s public key to Party B’s Transaction Manager. Party B’s Transaction Manager responds with an Ack/Nack response.
  6. A’s Transaction Manager returns the hash to the Quorum Node which then replaces the Transaction’s original payload with that hash.
  7. In Seventh Step Transaction is propagated to the rest of the network using the standard Ethereum P2P Protocol.
  8. A block containing Transaction AB is created and distributed to each Party on the network.
  9. In this step all Parties will attempt to process the Transaction.
  10. In this step A and B make a call to its Enclave, passing in the Encrypted Payload, Encrypted symmetric key and Signature. But C will receive NotARecipient message.
  11. The Enclave validates the signature and then decrypts the symmetric key using the Party’s private key that is held in The Enclave, decrypts the Transaction Payload using the now-revealed symmetric key and returns the decrypted payload to the Transaction Manager
  12. The Transaction Managers for Parties A and B then send the decrypted payload to the EVM for contract code execution. This execution will update the state in the Quorum Node’s Private StateDB only.

REFERENCES :-  Quorum Github Wiki

Advertisements
Quorum : Ethereum-based distributed ledger protocol

BlockChain Internals: Data Storage

A BlockChain is a public ledger that create a digital ledger of transactions and share it among a distributed network of computers. BlockChain uses cryptography to allow each participant on the network to manipulate the ledger in a secure way without the need for a central authority.

BlockChain is just an data structure i.e. how logically data can be put together and stored. BlockChain in context of data structure is similar to Book. Lets take a look how BlockChain stores data :-

  • BlockChain uses Merkle Tree to Store the data in distributed manner.
  • You can think a Block as a page in the Book. just like a page contains header and content similarly Block also contains Header and Content.
  • Header contains the data about the block (we will read later).
  • Content contains the transaction data and data related to mining rewards.

Header of the Block :-    Header of the Block stores the following informations :-

  • Technical Data :- it contains Version , size of the block  and Magic ID.
  • Previous Block Hash :-  it contains hash of previous block header generated by 2 times applying SHA256 algorithm.
  • Merkle Root :-  it contains the single hash of the Block.
  • Time Stamp :-  it contains the time stamp when the block is created.
  • Difficulty Target :-  this data is related to mining how hard it is to mine the block.
  • Nonce :- A random number.

After the Header There is another part of the block that stores the Transaction count i.e. the total number of transaction this block stores.

Content of the Block :-  Content of the block contains the following informations:-

  • Coinbase Transactions:-    this contains the data related to mining reward, processing fees. its special type of transaction where there  is no input and from address.
  • BitCoin Transaction :-   this contains all to information related to all the transactions.

Transaction :-   Each transaction is the bitcoin payment. Each transaction contains the following informations :-

  • Technical Data :-  it contains Version number, Transaction lock time, Input count and Output Count.
  • Inputs :-   it contains the information about which coin are being spent. it includes Sequence number, script data, input script length, Previous transaction hash and index.
  • Output :-  it contains the information about who is getting the coin. in includes Output script length, Amount and output script.

These are information that are stored inside the Block of the BlockChain. Block contains lot of Hashes of different values thats makes it kind of immutable.

Each Block contains the reference of the previous block so, each block is connected with other block in chain like form which is more similar to pages link to each other in book.

BlockChain Internals: Data Storage

Introduction to MultiChain : BlockChains

MultiChain  is a platform that enable us to create and deploy private BlockChain that can be used either within a Organization or between Organizations.  MultiChain provides a simple API and command-line interface thats make it easy to maintain and deploy.

The main aim of MultiChain is :-

  • to ensure that visibility of BlockChain‘s activity must be kept within the chosen participants.
  • to control over which transaction are permitted.
  • to enable more secure mining with proof of work and its associated cost.
  • the BlockChain system only store transaction related to participants.

Hand-shaking process in MultiChain :-      Hand-shaking process in MultiChain take place when two BlockChain nodes Connect

  • Each node present its identity as a public address on the permitted list.
  • Each node verify that other’s address is on its own permitted list.
  • Each node sends a challenge message to other party.
  • Each node sends back a signature of the challenge message providing there ownership of the private key corresponding to the public address they presented.

If any of the node is not satisfying with the results then  it aborts the peer-to-peer connection.

Mining in MultiChain :-      MultiChain restricts miner to a set of identifiable entities. MultiChain introduce a parameter called “mining diversity” which is constrains by

0  <=  mining diversity <= 1. The Validity of block is verified by :

  • Apply the permissions changes defined by transactions n the block in order.
  • Count the total permitted miners who are defined after these changes in the block.
  • Multiply no of miners by mining diversity and round up to get left spacing.

this enforce the round-robin schedule in which miner create blocks in rotation in order to generate a valid BlockChain. The mining diversity parameter defines the strictness of the schema. The 1 value defines every permitted  miner is included in rotation and 0 defines no restrictions at all.

In MultiChain the transaction fees and the Block reward is Zero by default but you can set these value in params.dat file. the params.dat file contains the whole configuration like :-

  • The Chain’s Protocol
  • Target Time for Block
  • Active Permission Type
  • Mining Diversity
  • Mining Reward
  • Permitted Transaction Type
  • Maximum Block size
  • Maximum meta data per Transaction.

you can find and read about all these parameters Here.

References :-    MultiChain White Paper

Introduction to MultiChain : BlockChains