blockchainhyperledgerhyperledger-fabricblockchain.info-api

Should the field "stateHash" of previous block be equal to the field "previousBlockHash" of current block in a blockchain?


I have a sample blockchain application on which I have created a several blocks with the help of "invoke" transactions.

1) The blockchain theory suggests that each block will have a field called "previousBlockHash" containing the hash value of previous block in blockchain. Now when I am comparing the fields "stateHash" of previous block(Block #2) Vs "previousBlockHash" of current block(Block #3), they both appear to be very different. Should they be equal?

2) Can one blockchain block contain multiple "invoke" transactions?**


Solution

    1. There is a difference between StateHash and BlockHash, where state hash is simply a hash of the data inside given block and the block hash computed as following:

    A block hash is calculated by hashing over the concatenated ASN.1 encoded bytes of: the block number, previous block hash, and current block data hash. It's the chain of the block hashs that guarantees the immutability of the ledger

    1. Block usually will be comprised of several ordered invoke transactions. So to your question - yes it can contain more than one transaction inside.