Tools, FAQ, Tutorials:
Inspect Transaction Blocks of Channel Blockchain
How to Inspect Transaction Blocks of Channel Blockchain?
✍: FYIcenter.com
You can follow this tutorial to Inspect Transaction Blocks of Channel Blockchain.
1. Connect to the CLI container of the Hyperledger Fabric network:
$ docker exec -it cli bash bash-4.4#
2. Download (fetch) the newest block from "mychannel" channel:
bash-4.4# peer channel fetch newest newest.block -c mychannel [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized [cli.common] readBlock -> INFO 002 Received block: 5 bash-4.4# ls -l -rw-r--r-- 1 root root 4921 Apr 1 18:00 newest.block
3. Parse the transaction block into JSON format:
bash-4.4# configtxgen -inspectBlock newest.block > newest.json ... bash-4.4# ls -l -rw-r--r-- 1 root root 4921 Apr 13 18:00 newest.block -rw-r--r-- 1 root root 10335 Apr 13 18:12 newest.json
4. Copy the block file to the hosting system:
bash-4.4# exit
$ docker cp cli:/root/newest.json ./
$ more newest.json
{
"header": {
"data_hash": "CAQ4AibIu3ZjBx8reigN7LlLAh9f/qutxcmAyb/VH+w=",
"number": "5",
"previous_hash": "KDjkXFvRJAcYTp2ralLNhMAD3eZc0LxfQyHr9DZgl0M="
},
"metadata": {
"metadata": [
"CgQKAggCEvgGCq0GCpAGCgpPcmRlcmVyTVNQEoEGLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0t...",
"CgIIAg==",
"AA==",
""
]
},
"data": {
"data": [
{
"payload": {
"data": {
"actions": [
{
"header": {
"creator": {
"id_bytes": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNLekNDQWRHZ...",
"mspid": "Org1MSP"
},
"nonce": "rFGfK1lB88EcQWB0hESLUSB7Zj6TWN46"
},
"payload": {
"action": {
"endorsements": [
{
"endorser": "CgdPcmcxTVNQEqoGLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0...",
"signature": "MEUCIQCCIuRNJeN0K9EDbJDBUYvp7Np6563cF7xUJAEqT40k6g..."
},
{
"endorser": "CgdPcmcyTVNQEqoGLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0...",
"signature": "MEUCIQD43zSLDZKiTPDs62s5bJLJKn3UpTYX95EnW/0gkJg5Lg..."
}
],
"proposal_response_payload": {
"extension": {
"chaincode_id": {
"name": "mycc",
"path": "",
"version": "2.0"
},
"events": null,
"response": {
"message": "",
"payload": null,
"status": 200
},
"results": {
"data_model": "KV",
"ns_rwset": [
{
"collection_hashed_rwset": [],
"namespace": "_lifecycle",
"rwset": {
"metadata_writes": [],
"range_queries_info": [],
"reads": [
{
"key": "namespaces/fields/mycc/Sequence",
"version": null
}
]
}
},
{
"collection_hashed_rwset": [],
"namespace": "lscc",
"rwset": {
"metadata_writes": [],
"range_queries_info": [],
"reads": [
{
"key": "mycc",
"version": {
"block_num": "4",
"tx_num": "0"
}
}
]
}
},
{
"collection_hashed_rwset": [],
"namespace": "mycc",
"rwset": {
"metadata_writes": [],
"range_queries_info": [],
"reads": [
{
"key": "a",
"version": {
"block_num": "4",
"tx_num": "0"
}
},
{
"key": "b",
"version": {
"block_num": "4",
"tx_num": "0"
}
}
],
"writes": [
{
"is_delete": false,
"key": "a",
"value": "OTA="
},
{
"is_delete": false,
"key": "b",
"value": "MjEw"
}
]
}
}
]
}
},
"proposal_hash": "BgCskXWBzaoywJXSkAMOLyO8jLNeTKepYNBz9Db+XN4="
}
},
"chaincode_proposal_payload": {
"input": {
"chaincode_spec": {
"chaincode_id": {
"name": "mycc",
"path": "",
"version": ""
},
"input": {
"args": [
"aW52b2tl",
"YQ==",
"Yg==",
"MTA="
],
"is_init": false
},
"timeout": 0,
"type": "GOLANG"
}
}
}
}
}
]
},
"header": {
"channel_header": {
"channel_id": "mychannel",
"epoch": "0",
"extension": "EgYSBG15Y2M=",
"timestamp": "2019-04-01T14:44:32.649599656Z",
"tls_cert_hash": null,
"tx_id": "e6f391c8ec768f93746c5594981acffc9ce85d33d3c60856138527ccf91ce20a",
"type": 3,
"version": 0
},
"signature_header": {
"creator": {
"id_bytes": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNLekNDQWRHZ0F...",
"mspid": "Org1MSP"
},
"nonce": "rFGfK1lB88EcQWB0hESLUSB7Zj6TWN46"
}
}
},
"signature": "MEQCIBzWy9jPYAaDv0cgIOSEWwH1EGwFJOjMOBJUb+W/kjmjAiAsOIn+Uw..."
}
]
}
}
⇒ Hyperledger Fabric Docker Containers
⇐ View Channel Blockchain and Download Blocks
2020-08-13, ∼1633🔥, 0💬
Popular Posts:
How to add request query string Parameters to my Azure API operation to make it more user friendly? ...
How to how to use matched string and groups in replacements with re.sub()? When calling the re.sub()...
What's Wrong with "while ($c=fgetc($f)) {}" in PHP? If you are using "while ($c=fgetc($f)) {}" to lo...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
How to use the "find-and-replace" Policy Statement for an Azure API service operation? The "find-and...