Hyperledger Fabric Question Answers

Some of the conceptual Question/Answer around Hyperledger Fabric, collected from various sources.


What is Ledger

You’re probably used to looking at your bank account every month. What’s most important to you is the available balance – it’s what you’re able to spend at the current moment in time. If you want to see how your balance was derived, then you can look through the transaction credits and debits that determined it. This is a real life example of a ledger – a state (your bank balance), and a set of ordered transactions (credits and debits) that determine it. Hyperledger Fabric is motivated by these same two concerns – to present the current value of a set of ledger states, and to capture the history of the transactions that determined these states.


Researching like how and where this ledger is stored?



I assume you have some peer containers running. You can run “docker ps -a” to look for the list of containers. Let’s say you have one named peer1.org1.example.com, you can run “docker exec -it peer1.org1.example.com bash” to go into the container.


There are two place which “store” data in Hyperledger Fabric (the underlying blockchain infrastructure used by Composer which is a runtime abstraction layer above it):

  • the ledger
  • the state database (‘World state’)

The ledger is the actual “blockchain”. It is a file-based ledger which stores serialized blocks. Each block has one or more transactions. Each transaction contains a ‘read-write set’ which modifies one or more key/value pairs. The ledger is the definitive source of data and is immutable.

The state database (or ‘World State’) holds the last known committed value for any given key – an indexed view into the chain’s transaction log. It is populated when each peer validates and commits a transaction. The state database can always be rebuilt from re-processing the ledger (ie replaying the transactions that led to that state). There are currently two options for the state database: an embedded LevelDB or an external CouchDB.

As an aside, if you are familiar with Hyperledger Fabric ‘channels’, there is a separate ledger for each channel.

The chain is a transaction log, structured as hash-linked blocks, where each block contains a sequence of N transactions. The block header includes a hash of the block’s transactions, as well as a hash of the prior block’s header. In this way, all transactions on the ledger are sequenced and cryptographically linked together.

The state database is simply an indexed view into the chain’s transaction log, it can therefore be regenerated from the chain at any time.

Source: http://hyperledger-fabric.readthedocs.io/en/release/ledger.html

Suffice to say, Hyperledger Composer uses Fabric (as the blockchain infrastructure) to endorse/order/commit transactions to blocks on the ledger

if you still want to see the physical location of these data you can go to /var/hyperledger/production in each peer container in your fabric network

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s