Tools, FAQ, Tutorials:
Read Block Data in Blockchain
How to Read Block Data from a Blockchain?
✍: FYIcenter.com
The block data from a blockchain uses a binary format.
You need to use the "configtxgen -inspectBlock" command
parse it to JSON format.
1. Get the newest block from the blockchain:
$ docker exec -it cli bash
root@262918fdcbc0:/opt/gopath/src/github.com/hyperledger/fabric/peer# cd
root@262918fdcbc0:~# peer channel fetch newest ./newest.block -c mychannel
root@262918fdcbc0:~# configtxgen -inspectBlock newest.block > newest.json
root@262918fdcbc0:~# more newest.json
{
"data": {
"data": [
{
"payload": {
"data": {
"actions": [
{
"header": {
"creator": {
"id_bytes": "LS0tLS1CRUdJTiBDRVJ...
Now you need to read the Hyperledger Fabric reference guide to figure out how transactions are stored in the block.
⇒ blockfile_000000 - Blockfiles of Blockchain
⇐ Verify Blockchain on the Channel
2020-02-20, ∼2318🔥, 0💬
Popular Posts:
FYIcenter.com Online Tools: FYIcenter JSON Validator and Formatter FYIcenter JSON to XML Converter F...
How to use the "find-and-replace" Policy Statement for an Azure API service operation? The "find-and...
How to decode the id_token value received from Google OpenID Connect authentication response? Accord...
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to lo...
How to use the "set-variable" Policy Statement to create custom variables for an Azure API service o...