hyperledger/fabric-samplesのbalance-transferをUbuntu16.04で動かしてみた
Premise
こちらの環境ができていることが必要です。
Overview
今回はHyperledger Fabricで使用できるSamplesを利用していきます。Fabric-client&fabric-ca-clientの Node.js SDK APIのデモをできるbalance-transferを動かしてみましょう。
Install
・ubuntu以下にclone
cd /home/ubuntu
git clone https://github.com/hyperledger/fabric-samples.git
・今回は安定しているfablic-sample1.0を利用していきます。
git checkout release-1.0
・release-1.0に切り替わっているか確認
git branch
Test
dockerコンテナを起動してみましょう。
・balance-transferに移動
cd /home/ubuntu/fabric-samples/balance-transfer
・dockerコンテナを起動
./runApp.sh
Stopping peer0.org2.example.com ... done
Stopping peer1.org1.example.com ... done
Stopping peer0.org1.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping orderer.example.com ... done
Stopping ca_peerOrg1 ... done
Stopping ca_peerOrg2 ... done
Removing peer0.org2.example.com ... done
Removing peer1.org1.example.com ... done
Removing peer0.org1.example.com ... done
Removing peer1.org2.example.com ... done
Removing orderer.example.com ... done
Removing ca_peerOrg1 ... done
Removing ca_peerOrg2 ... done
Removing network artifacts_default
5fdebe000332
c81d7de17ea4
Untagged: dev-peer0.org1.example.com-mycc-v0:latest
Deleted: sha256:263eded73f20bf6a61a465ec78892736057aee9e324a12bb03048c03bff24aea
Deleted: sha256:1aafcced47e3975f5720a6d727376713fed700a4dc4c24cbc666b67dd413e0b8
Deleted: sha256:dc33bef3d7b7953294d322a0a46dd823a82737e7000858115ccbfa7403a5869b
Deleted: sha256:6f690e23338df33759e289750d11c899c87c1b73bd430c5052c81d8e7fc292b3
Deleted: sha256:60cbb1ba70185f11e3304bd038fcb5ef5eee021d77d460e1c95fb0f63213d1ba
Untagged: dev-peer1.org1.example.com-mycc-v0:latest
Deleted: sha256:be0d3fbea4d4c5b0bc4774940cf33a19d756b35b46d5304284ad76283e91d2c2
Deleted: sha256:61cbf1e7af38d46e58e7b04d1040e147b49f157eba59d919ea2aeca60b6428a8
Deleted: sha256:695cec95a57609d496f0f33618dd6ed424cb2855289696fda207537a5979907b
Deleted: sha256:a509e47fece5f10a5649b0c2c5783e4cba118d3cec1f4da30083351bb4b30bd5
Deleted: sha256:76e0362584126e401e0f75a40e44c077c791c45c1b83013bfd116b502020455f
Deleted: sha256:331306418302dd16d7bfd9c64b4b0469f5a40f695b2c56393b3df664bdc0486d
Deleted: sha256:465bd365fc600c0c74acabf00903ab0c64f788277d2dfa03e8efa040e39978f9
Creating network "artifacts_default" with the default driver
Creating ca_peerOrg2
Creating ca_peerOrg1
Creating orderer.example.com
Creating peer1.org1.example.com
Creating peer1.org2.example.com
Creating peer0.org2.example.com
Creating peer0.org1.example.com
/home/ubuntu/fabric-samples_good/balance-transfer
============== node modules installed already =============
[2018-04-25 08:38:27.499] [DEBUG] Helper - [crypto_ecdsa_aes]: constructor, keySize: 256
[2018-04-25 08:38:27.510] [DEBUG] Helper - [crypto_ecdsa_aes]: Hash algorithm: SHA2, hash output size: 256
[2018-04-25 08:38:27.599] [DEBUG] Helper - [utils.CryptoKeyStore]: CryptoKeyStore, constructor - start
[2018-04-25 08:38:27.601] [DEBUG] Helper - [utils.CryptoKeyStore]: constructor, no super class specified, using config:
[2018-04-25 08:38:27.610] [DEBUG] Helper - [crypto_ecdsa_aes]: constructor, keySize: 256
[2018-04-25 08:38:27.610] [DEBUG] Helper - [crypto_ecdsa_aes]: Hash algorithm: SHA2, hash output size: 256
[2018-04-25 08:38:27.611] [DEBUG] Helper - [utils.CryptoKeyStore]: CryptoKeyStore, constructor - start
[2018-04-25 08:38:27.611] [DEBUG] Helper - [utils.CryptoKeyStore]: constructor, no super class specified, using config:
[2018-04-25 08:38:27.629] [INFO] SampleWebApp - ****************** SERVER STARTED ************************
[2018-04-25 08:38:27.630] [INFO] SampleWebApp - ************** http://localhost:4000 ******************
k
これで必要なコンテナが立ち上がり、Nodeの起動もされたようですね。
peerが4台、orderが1台、caが2台起動しているか確認します。
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3cb42658a129 hyperledger/fabric-peer "peer node start" 35 seconds ago Up 33 seconds 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.org2.example.com
9ea3e72865b0 hyperledger/fabric-peer "peer node start" 35 seconds ago Up 33 seconds 0.0.0.0:8056->7051/tcp, 0.0.0.0:8058->7053/tcp peer1.org2.example.com
0be86fa272b4 hyperledger/fabric-peer "peer node start" 35 seconds ago Up 32 seconds 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
6dc8d06e8857 hyperledger/fabric-peer "peer node start" 35 seconds ago Up 33 seconds 0.0.0.0:7056->7051/tcp, 0.0.0.0:7058->7053/tcp peer1.org1.example.com
da020b22301b hyperledger/fabric-orderer "orderer" 35 seconds ago Up 34 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
9960c169bf7d hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 35 seconds ago Up 32 seconds 0.0.0.0:8054->7054/tcp ca_peerOrg2
9d02cc8923c5 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 35 seconds ago Up 34 seconds 0.0.0.0:7054->7054/tcp ca_peerOrg1
では実際に新しいユーザーを登録していきましょう。
curl -s -X POST http://localhost:4000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=Jim&orgName=Org1'
これでtokenが生成ができました。このtokenはchannelの作成やchaincodeのインストール等に利用するのでコピーしておく必要があります。
{
"success": true,
"secret": "RaxhMgevgJcm",
"message": "Jim enrolled Successfully",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjQ2NDk1NjEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE1MjQ2MTM1NjF9.q0oSwEkFdx8KkWk4XR-oYkXxTdqPpjtUorTfvrDu1ME"
}
この後、以下のことをしていきます。
・channelの作成、参加
・chaincodeのインストール、インスタンス化
一々コマンドを流すのはめんどくさいですよね。
すべてで実行してくれるシェルが入っているのでそちらを実行していきましょう。
・シェルを実行
./testApis.sh
{"success":true,"secret":"","message":"Jim enrolled Successfully","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjQ2NTA0NzIsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE1MjQ2MTQ0NzJ9._ZEYFpASwnnrd0NLcbvz5-b78bThwDXKcVgXjbS6000"}
ORG1 token is eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjQ2NTA0NzIsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE1MjQ2MTQ0NzJ9._ZEYFpASwnnrd0NLcbvz5-b78bThwDXKcVgXjbS6000
POST request Enroll on Org2 ...
{"success":true,"secret":"","message":"Barry enrolled Successfully","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjQ2NTA0NzIsInVzZXJuYW1lIjoiQmFycnkiLCJvcmdOYW1lIjoib3JnMiIsImlhdCI6MTUyNDYxNDQ3Mn0.3W04WOjFalYV_XSEYq4hrGjgtv7-O8mMdW0BEqty4Rk"}
ORG2 token is eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjQ2NTA0NzIsInVzZXJuYW1lIjoiQmFycnkiLCJvcmdOYW1lIjoib3JnMiIsImlhdCI6MTUyNDYxNDQ3Mn0.3W04WOjFalYV_XSEYq4hrGjgtv7-O8mMdW0BEqty4Rk
POST request Create channel ...
{"success":true,"message":"Channel 'mychannel' created Successfully"}
POST request Join channel on Org1
{"success":true,"message":"Successfully joined peers in organization org1 to the channel 'mychannel'"}
POST request Join channel on Org2
{"success":true,"message":"Successfully joined peers in organization org2 to the channel 'mychannel'"}
POST Install chaincode on Org1
Successfully Installed chaincode on organization org1
POST Install chaincode on Org2
Successfully Installed chaincode on organization org2
POST instantiate chaincode on peer1 of Org1
Chaincode Instantiation is SUCCESS
POST invoke chaincode on peers of Org1 and Org2
Transacton ID is d27299046a71d869ac8efb8d73f44641eac875143680f0b629ceb13129f3d8c6
GET query chaincode on peer1 of Org1
a now has 90 after the move
GET query Block by blockNumber
{"header":{"number":"1","previous_hash":"7b744eebad139fa09926b3bc1a763781032e7b0715cca0f72d72b90d23efb526","data_hash":"c7113a89dfede1acd448faabe2f3b6790683bae324204ff125fff073c3053ed9"},"data":{"data":[{"signature":{"type":"Buffer","data":[48,68,2,32,92,25,53,52,13,171,228,143,163,93,253,150,25,43,151,250,102,86,215,39,144,62,81,160,242,158,122,225,79,107,189,254,2,32,9,242,40,6,154,239,128,183,30,189,148,164,171,77,74,27,153,227,93,69,91,126,58,188,248,139,125,213,222,154,238,251]},"payload":{"header":{"channel_header":{"type":3,"version":1,"timestamp":"Wed Apr 25 2018 09:01:18 GMT+0900 (JST)","channel_id":"mychannel","tx_id":"df5bf27f2220216fcf63ff90e959627470d3932f0bb83f0c8d371d37b42ce732","epoch":"0","extension":{"type":"Buffer","data":[18,6,18,4,108,115,99,99]},"typeString":"ENDORSER_TRANSACTION"},"signature_header":{"creator":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN CERTIFICATE-----\nMIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT\n8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE\nyKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/\nyfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy\nCKqf8052NVUs2CvPzA==\n-----END CERTIFICATE-----\n"},"nonce":{"type":"Buffer","data":[178,144,3,8,231,109,247,29,176,57,113,246,75,194,144,77,145,49,159,164,28,89,133,47]}}},"data":{"actions":[{"header":{"creator":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN CERTIFICATE-----\nMIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT\n8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE\nyKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/\nyfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy\nCKqf8052NVUs2CvPzA==\n-----END CERTIFICATE-----\n"},"nonce":{"type":"Buffer","data":[178,144,3,8,231,109,247,29,176,57,113,246,75,194,144,77,145,49,159,164,28,89,133,47]}},"payload":{"chaincode_proposal_payload":{"input":{"type":"Buffer","data":[10,73,8,1,18,6,18,4,108,115,99,99,26,61,10,6,100,101,112,108,111,121,10,9,109,121,99,104,97,110,110,101,108,10,40,10,38,8,1,18,10,18,4,109,121,99,99,26,2,118,48,26,22,10,4,105,110,105,116,10,1,97,10,3,49,48,48,10,1,98,10,3,50,48,48]}},"action":{"proposal_response_payload":{"proposal_hash":"577e55a8519603d050e0a5f315fd86bbbd685eb7094f79d5a464f1df9397a084","extension":{"results":{"data_model":0,"ns_rwset":[{"namespace":"lscc","rwset":{"reads":[{"key":"mycc","version":null}],"range_queries_info":[],"writes":[{"key":"mycc","is_delete":false,"value":"\n\u0004mycc\u0012\u0002v0\u001a\u0004escc\"\u0004vscc*(\u0012\f\u0012\n\b\u0001\u0012\u0002\b\u0000\u0012\u0002\b\u0001\u001a\u000b\u0012\t\n\u0007Org1MSP\u001a\u000b\u0012\t\n\u0007Org2MSP2D\n �����ϧ�i?v��OCjˢ��\"���Hq\u001e���Gb\u0012 *PI�w�\u000fjL5x6^�E=�)ˡF��\t\u0019\u0015��C5\u00115: ���ԣV��k����ر���\u000b>z!F�P\"�+I�B,\u0012\f\u0012\n\b\u0001\u0012\u0002\b\u0000\u0012\u0002\b\u0001\u001a\r\u0012\u000b\n\u0007Org1MSP\u0010\u0001\u001a\r\u0012\u000b\n\u0007Org2MSP\u0010\u0001"}]}},{"namespace":"mycc","rwset":{"reads":[],"range_queries_info":[],"writes":[{"key":"a","is_delete":false,"value":"100"},{"key":"b","is_delete":false,"value":"200"}]}}]},"events":{"chaincode_id":"","tx_id":"","event_name":"","payload":{"type":"Buffer","data":[]}},"response":{"status":200,"message":"","payload":"\n\u0004mycc\u0012\u0002v0\u001a\u0004escc\"\u0004vscc*(\u0012\f\u0012\n\b\u0001\u0012\u0002\b\u0000\u0012\u0002\b\u0001\u001a\u000b\u0012\t\n\u0007Org1MSP\u001a\u000b\u0012\t\n\u0007Org2MSP2D\n �����ϧ�i?v��OCjˢ��\"���Hq\u001e���Gb\u0012 *PI�w�\u000fjL5x6^�E=�)ˡF��\t\u0019\u0015��C5\u00115: ���ԣV��k����ر���\u000b>z!F�P\"�+I�B,\u0012\f\u0012\n\b\u0001\u0012\u0002\b\u0000\u0012\u0002\b\u0001\u001a\r\u0012\u000b\n\u0007Org1MSP\u0010\u0001\u001a\r\u0012\u000b\n\u0007Org2MSP\u0010\u0001"},"chaincode_id":{"path":"","name":"lscc","version":"1.0.0"}}},"endorsements":[{"endorser":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN -----\nMIICGDCCAb+gAwIBAgIQPcMFFEB/vq6mEL6vXV7aUTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzS9k2gCKHcat8Wj4T2nB1uyC8R2zg3um\nxdTL7nmgFWp0uyCCbQQxD/VS+8R/3DNvEFkvzhcjc9NU/nRqMirpLqNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE\nyKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgHBdxbHUG\nrFUzKPX9UmmN3SwigWcRUREUy/GTb3hDIAsCIEF1BxTqv8ilQYE8ql0wJL4mTber\nHE6DFYvvBCUnicUh\n-----END -----\n"},"signature":{"type":"Buffer","data":[48,68,2,32,123,154,123,87,135,4,167,189,236,212,41,140,88,189,80,98,147,84,60,40,27,171,139,235,209,240,39,116,79,35,55,181,2,32,12,85,158,218,210,72,44,203,224,45,155,106,136,208,204,98,131,118,51,59,95,59,97,5,92,63,232,58,199,83,182,169]}},{"endorser":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN -----\nMIICGjCCAcCgAwIBAgIRAI+BBtEBvpOqhfRZZH7eV/YwCgYIKoZIzj0EAwIwczEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh\nLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5\nWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN\nU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjEub3JnMS5leGFtcGxlLmNvbTBZ\nMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCnT04ltvjsgiZVuCGLsRYzEiCTJZlZw\nh3HT/273B3NkWA7wrlyK7FfAanIyexuR1UI9m4+YKNqFG6cgYnf8MsejTTBLMA4G\nA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA5ykiTos/MX\nhMipPFuO9vTByR2ebld8RcMxY2Cf5AARMAoGCCqGSM49BAMCA0gAMEUCIQCSRdWm\ni4IgVUajvzWVxyE/wi7n617pVqS4+nJ7gbTRjQIgefzBwS+bkNhPc3/rktySFLRC\nWMnq87KyqMLc6iRaJx0=\n-----END -----\n"},"signature":{"type":"Buffer","data":[48,69,2,33,0,162,137,158,64,154,135,89,182,89,175,56,213,166,245,238,163,228,242,144,150,25,140,193,44,85,250,235,182,85,64,177,125,2,32,57,150,156,159,171,56,199,5,37,31,142,234,176,200,200,185,113,98,208,43,171,71,217,146,148,37,255,166,93,169,240,113]}}]}}}]}}}]},"metadata":{"metadata":[{"value":"","signatures":[{"signature_header":{"creator":{"Mspid":"OrdererMSP","IdBytes":"-----BEGIN -----\nMIICDTCCAbOgAwIBAgIRALFafJiTFN/47AvAGfvj1ZEwCgYIKoZIzj0EAwIwaTEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt\ncGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFgxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp\nc2NvMRwwGgYDVQQDExNvcmRlcmVyLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYI\nKoZIzj0DAQcDQgAEYtguLKFBLLc0VSwyPHHHNe76HH71oOXK6wun8Y/5vtMawPZ/\nWTm/vBVUWdfNlzc9eA28aXx6zBAB8iRm16EeU6NNMEswDgYDVR0PAQH/BAQDAgeA\nMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDUbM8OlDbBvDtuK/gM2yAsSUNgT5\nXHLuD/g50+wwBxkwCgYIKoZIzj0EAwIDSAAwRQIhANJuEGHBftrtlWgie9zgc60J\n/XVytPN/D0rPlkMV17n7AiBBbStggGBfFYcQ2LhDhcKut8nScJ2OFrt+dJSdJbod\n7A==\n-----END -----\n"},"nonce":{"type":"Buffer","data":[216,97,10,42,18,179,106,213,248,161,253,194,92,40,22,217,23,146,61,8,75,178,191,156]}},"signature":{"type":"Buffer","data":[48,68,2,32,102,218,33,52,166,223,175,144,25,190,233,137,105,149,73,168,36,31,111,204,185,129,120,134,104,175,182,27,177,148,189,246,2,32,103,50,19,197,78,246,215,117,105,40,192,52,62,3,252,23,43,201,146,168,79,134,218,194,160,211,235,127,9,97,63,158]}}]},{"value":{"index":"0"},"signatures":[{"signature_header":{"creator":{"Mspid":"OrdererMSP","IdBytes":"-----BEGIN -----\nMIICDTCCAbOgAwIBAgIRALFafJiTFN/47AvAGfvj1ZEwCgYIKoZIzj0EAwIwaTEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt\ncGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFgxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp\nc2NvMRwwGgYDVQQDExNvcmRlcmVyLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYI\nKoZIzj0DAQcDQgAEYtguLKFBLLc0VSwyPHHHNe76HH71oOXK6wun8Y/5vtMawPZ/\nWTm/vBVUWdfNlzc9eA28aXx6zBAB8iRm16EeU6NNMEswDgYDVR0PAQH/BAQDAgeA\nMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDUbM8OlDbBvDtuK/gM2yAsSUNgT5\nXHLuD/g50+wwBxkwCgYIKoZIzj0EAwIDSAAwRQIhANJuEGHBftrtlWgie9zgc60J\n/XVytPN/D0rPlkMV17n7AiBBbStggGBfFYcQ2LhDhcKut8nScJ2OFrt+dJSdJbod\n7A==\n-----END -----\n"},"nonce":{"type":"Buffer","data":[137,205,80,120,76,212,136,194,173,155,87,123,24,203,253,54,21,77,100,203,58,169,80,170]}},"signature":{"type":"Buffer","data":[48,69,2,33,0,239,227,211,32,104,122,234,123,91,12,42,215,223,151,171,83,238,3,14,54,153,236,254,245,168,193,188,41,122,61,2,41,2,32,2,145,29,218,153,80,71,151,249,186,239,220,139,90,113,39,250,252,53,209,215,211,218,24,101,26,181,106,70,196,25,242]}}]},[0]]}}
GET query Transaction by TransactionID
{"validationCode":0,"transactionEnvelope":{"signature":{"type":"Buffer","data":[48,68,2,32,16,244,215,69,66,179,56,126,75,36,32,114,211,44,240,205,31,53,106,158,85,234,94,99,76,80,40,93,126,129,132,104,2,32,42,211,56,71,199,148,77,192,64,250,152,35,143,133,121,155,243,250,99,239,114,95,134,19,185,252,53,5,205,128,51,197]},"payload":{"header":{"channel_header":{"type":3,"version":1,"timestamp":"Wed Apr 25 2018 09:01:40 GMT+0900 (JST)","channel_id":"mychannel","tx_id":"d27299046a71d869ac8efb8d73f44641eac875143680f0b629ceb13129f3d8c6","epoch":"0","extension":{"type":"Buffer","data":[18,6,18,4,109,121,99,99]},"typeString":"ENDORSER_TRANSACTION"},"signature_header":{"creator":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN CERTIFICATE-----\nMIIB8TCCAZegAwIBAgIURX22GoxAq4yabd3x61g9PAtYx+swCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwNDI0MjM1NjAwWhcNMTkwNDI0MjM1\nNjAwWjAQMQ4wDAYDVQQDEwVhZG1pbjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\nBD/QKu5Uh3UASrZJ/s6mMYiqGmClgI6nMe6tvu7rtIF56D7loF2WkRYsSM7o3p5C\nORzbxzTrv9hEEsuLr/z5dzijbDBqMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8E\nAjAAMB0GA1UdDgQWBBS/atNdWQjPpqgZ6CHMOpSJkZI4GDArBgNVHSMEJDAigCAO\ncpIk6LPzF4TIqTxbjvb0wckdnm5XfEXDMWNgn+QAETAKBggqhkjOPQQDAgNIADBF\nAiEAh/LQAQbYViYZOZLdJKUHhwyC1FYqJuSmfXsGsmLugGoCIE3H2Wz0d9WYPVD6\nydVBUilhUXw6wVW3DbUWm/6eoff/\n-----END CERTIFICATE-----\n"},"nonce":{"type":"Buffer","data":[131,244,19,229,229,224,80,212,90,4,81,158,201,40,86,214,218,171,94,151,196,227,248,229]}}},"data":{"actions":[{"header":{"creator":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN CERTIFICATE-----\nMIIB8TCCAZegAwIBAgIURX22GoxAq4yabd3x61g9PAtYx+swCgYIKoZIzj0EAwIw\nczELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNh\nbiBGcmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMT\nE2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTgwNDI0MjM1NjAwWhcNMTkwNDI0MjM1\nNjAwWjAQMQ4wDAYDVQQDEwVhZG1pbjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\nBD/QKu5Uh3UASrZJ/s6mMYiqGmClgI6nMe6tvu7rtIF56D7loF2WkRYsSM7o3p5C\nORzbxzTrv9hEEsuLr/z5dzijbDBqMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8E\nAjAAMB0GA1UdDgQWBBS/atNdWQjPpqgZ6CHMOpSJkZI4GDArBgNVHSMEJDAigCAO\ncpIk6LPzF4TIqTxbjvb0wckdnm5XfEXDMWNgn+QAETAKBggqhkjOPQQDAgNIADBF\nAiEAh/LQAQbYViYZOZLdJKUHhwyC1FYqJuSmfXsGsmLugGoCIE3H2Wz0d9WYPVD6\nydVBUilhUXw6wVW3DbUWm/6eoff/\n-----END CERTIFICATE-----\n"},"nonce":{"type":"Buffer","data":[131,244,19,229,229,224,80,212,90,4,81,158,201,40,86,214,218,171,94,151,196,227,248,229]}},"payload":{"chaincode_proposal_payload":{"input":{"type":"Buffer","data":[10,28,8,1,18,6,18,4,109,121,99,99,26,16,10,4,109,111,118,101,10,1,97,10,1,98,10,2,49,48]}},"action":{"proposal_response_payload":{"proposal_hash":"8ff8eb89a1c60f194f46bd3bab45a2ea31f7d354bd6c6740ddc570d39356723f","extension":{"results":{"data_model":0,"ns_rwset":[{"namespace":"lscc","rwset":{"reads":[{"key":"mycc","version":{"block_num":"1","tx_num":"0"}}],"range_queries_info":[],"writes":[]}},{"namespace":"mycc","rwset":{"reads":[{"key":"a","version":{"block_num":"1","tx_num":"0"}},{"key":"b","version":{"block_num":"1","tx_num":"0"}}],"range_queries_info":[],"writes":[{"key":"a","is_delete":false,"value":"90"},{"key":"b","is_delete":false,"value":"210"}]}}]},"events":{"chaincode_id":"","tx_id":"","event_name":"","payload":{"type":"Buffer","data":[]}},"response":{"status":200,"message":"","payload":""},"chaincode_id":{"path":"","name":"mycc","version":"v0"}}},"endorsements":[{"endorser":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN -----\nMIICGDCCAb+gAwIBAgIQPcMFFEB/vq6mEL6vXV7aUTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzS9k2gCKHcat8Wj4T2nB1uyC8R2zg3um\nxdTL7nmgFWp0uyCCbQQxD/VS+8R/3DNvEFkvzhcjc9NU/nRqMirpLqNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE\nyKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgHBdxbHUG\nrFUzKPX9UmmN3SwigWcRUREUy/GTb3hDIAsCIEF1BxTqv8ilQYE8ql0wJL4mTber\nHE6DFYvvBCUnicUh\n-----END -----\n"},"signature":{"type":"Buffer","data":[48,69,2,33,0,204,83,89,251,89,79,198,17,243,172,100,9,164,211,109,124,228,197,148,68,162,106,148,72,184,162,96,43,253,222,66,217,2,32,92,193,158,150,114,133,205,200,85,42,226,78,230,49,131,27,204,189,47,235,173,82,235,218,31,99,88,96,95,31,103,129]}},{"endorser":{"Mspid":"Org1MSP","IdBytes":"-----BEGIN -----\nMIICGjCCAcCgAwIBAgIRAI+BBtEBvpOqhfRZZH7eV/YwCgYIKoZIzj0EAwIwczEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh\nLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5\nWjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN\nU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjEub3JnMS5leGFtcGxlLmNvbTBZ\nMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCnT04ltvjsgiZVuCGLsRYzEiCTJZlZw\nh3HT/273B3NkWA7wrlyK7FfAanIyexuR1UI9m4+YKNqFG6cgYnf8MsejTTBLMA4G\nA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA5ykiTos/MX\nhMipPFuO9vTByR2ebld8RcMxY2Cf5AARMAoGCCqGSM49BAMCA0gAMEUCIQCSRdWm\ni4IgVUajvzWVxyE/wi7n617pVqS4+nJ7gbTRjQIgefzBwS+bkNhPc3/rktySFLRC\nWMnq87KyqMLc6iRaJx0=\n-----END -----\n"},"signature":{"type":"Buffer","data":[48,69,2,33,0,214,28,54,82,255,48,61,110,152,255,164,149,184,63,174,121,219,162,201,54,60,12,215,94,173,15,81,166,218,220,246,98,2,32,46,34,241,60,93,170,196,11,133,156,246,173,204,152,175,214,118,5,61,130,100,244,233,124,222,53,217,57,199,108,168,42]}}]}}}]}}}}
GET query ChainInfo
{"height":{"low":3,"high":0,"unsigned":true},"currentBlockHash":{"buffer":{"type":"Buffer","data":[8,3,18,32,75,52,253,120,114,147,4,60,165,254,254,72,150,129,40,95,244,254,107,129,127,78,64,92,121,167,73,111,19,232,247,133,26,32,148,145,113,191,181,190,96,142,0,127,143,19,45,115,68,174,69,16,65,200,220,27,151,188,14,197,204,24,46,240,222,246]},"offset":4,"markedOffset":-1,"limit":36,"littleEndian":true,"noAssert":false},"previousBlockHash":{"buffer":{"type":"Buffer","data":[8,3,18,32,75,52,253,120,114,147,4,60,165,254,254,72,150,129,40,95,244,254,107,129,127,78,64,92,121,167,73,111,19,232,247,133,26,32,148,145,113,191,181,190,96,142,0,127,143,19,45,115,68,174,69,16,65,200,220,27,151,188,14,197,204,24,46,240,222,246]},"offset":38,"markedOffset":-1,"limit":70,"littleEndian":true,"noAssert":false}}
GET query Installed chaincodes
["name: mycc, version: v0, path: github.com/example_cc"]
GET query Instantiated chaincodes
["name: mycc, version: v0, path: github.com/example_cc"]
GET query Channels
{"channels":[{"channel_id":"mychannel"}]}
Total execution time : 31 secs ..
Trouble shooting
うまく動作しない場合は以下のコマンドを実行してみてください。
docker、Nodeの内容をすべてリセットできます。
sudo systemctl restart docker
docker rm $(docker ps -aq)
docker network prune
lsof -i
kill 00000(lsof -iで表示されたポートを消す)
この記事が気に入ったらサポートをしてみませんか?