[開発] Fabric開発環境でCLIを叩く

tag:
Fabric Hyperledger Ordering Service Endorser Committer Solo Kafka PBFT peer CC Chaincode

●概要
ローカル環境*でpeerを起動する。
StarterKitとの違いはDockerを一切使用しないこと。
Dockerを介さないことで開発中のCCの挙動確認がより容易になる。
実行するコマンドは主にCLI
また、全操作をsudoで実施している

* Local Development Environmentと呼ばれている環境。

●Overview
環境構築
peer/core.ymlの確認
ordererを起動 @Terminal①
peerを起動 @Terminal②
CCを登録 @Terminal③
CCをデプロイ @Terminal④
CCをクエリ @Terminal④ ←苦戦中なう

* CC = Chaincode

※ ちなみに① Orderer
公式手順(*1)には何故かordererに関する記載ない。
ざっくりPeerのサービス制御部分で、Solo, Kafka, PBFTの3モードがある。
関連定義は以下にある。
fabric/orderer/orderer.yaml

ref.
Hyperledger Ordering Service
https://github.com/hyperledger/fabric/blob/6f9b4272f4e3a6d843866402fa4325f39124e044/orderer/README.md
DockerHub>Hyperledger>fabric-orderer
https://hub.docker.com/r/hyperledger/fabric-orderer/

※ ちなみにのちなみに Peerの正体
PeerはEndorser(譲渡人)とCommitterの2つの顔がある。
Endorser - the peer will simulate the transaction and ensure that the outcome is both deterministic and stable
Committer - the peer will validate the integrity of a transaction and then append to the ledger.
ref.
Hyperledger-Fabric: What is the committer and orderer in core.yaml?
http://stackoverflow.com/questions/40339898/hyperledger-fabric-what-is-the-committer-and-orderer-in-core-yaml

※ ちなみに② membersrvc
公式手順(*1)では、make membersrvc && membersrvcと記載されているが
membersrvcはMakefileのtargetからなくなっているので端折る。

※ ちなみにのちなみに CLIは変身中
認証局周辺を主として変化が予想される。
v0.6.1-preview にはあったpeer networkが、
v0.7.0-snapshot からは消えており、新たにpeer loggingが追加されている。
加え、GitHub資材のfabric配下のMakefileのtargetも変貌を遂げており
v0.7.0-snapshotでは「make membersrvc」が出来なくなっている。

*1 公式手順
Writing, Building, and Running Chaincode in a Development Environment
https://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/
※ 同サイトに記載されているOption 1と 2・3では大きく違う
  1は開発環境が構築されるのに対し、2・3はDockerを大前提としている

■ 環境構築

Microsoft Azureに立てたUbuntu上に構築する。(Vagrant/VirtualBoxは使用しない)
ShellでのVagrant担当分の環境構築の実施 ― 鯨, Go, 環境変数, RocksDB, PIP, behave, 蛸
※ Rootユーザでの実施が無難。
※ 単体テストの実施も推奨されているが1hr以上かかる。適宜割愛するのが良い。実行するtargetはMakefile参照。2016/11/25時点ではpeerとordererで必要条件は満たせる。
sudo su
sudo apt-get update
# install Go
sudo apt install golang-go
Do you want to continue? [Y/n] y
sudo su
export GOPATH=$HOME/gows
export PATH=$PATH:$GOPATH/bin
mkdir -p $GOPATH/src/github.com/hyperledger

cd $GOPATH/src/github.com/hyperledger
## 方法① - the latest (recommended)
git clone https://github.com/hyperledger/fabric.git
## 方法② - specific version (v0.6)
# git clone https://github.com/hyperledger/fabric.git
# cd fabric
# git checkout -b v0.6
# git branch
# cd ../
## 方法③ - Gerrit (1 of official ways)
## in Building on Power Platform, it says get material from Gerrit.
# git clone http://gerrit.hyperledger.org/r/fabric
## 方法④ - specific version (v0.5) --> no shell for Ubuntu
## if you want to checkout using following line, you have to clone the material from hyperledger-archives/fabric.git
# git clone https://github.com/hyperledger-archives/fabric.git
# cd fabric
# git checkout -b origin/v0.5-developer-preview
# git branch
# cd ../

## the shell below will take around half hour; which not included in v0.5
./fabric/devenv/setupUbuntuOnPPC64le.sh
# (need about 30min to finish the shell. be patient!)
# add login-user into the Docker group
sudo usermod -aG docker root
exit x2

re-login
sudo su
export GOPATH=$HOME/gows
export PATH=$PATH:$GOPATH/bin
cd $GOPATH/src/github.com/hyperledger/fabric
## make peer and orderer instead of all-target; building all excepting testing which includes docker-target; setup a testing env.
## all images are v0.7.0-snapshot which are updated just few min ago and are remaned as latest. (the version is not available in DockerHub; https://hub.docker.com/r/hyperledger/fabric-peer/tags/)
## On the other hand, if you pull the image:latest, its latest update is 5 weeks ago, the one tagged as x86_64-0.6.1-preview.
## ref. https://github.com/hyperledger/fabric/blob/master/Makefile
## after making the peer, you'll see several docker images; hyperledger/fabric-javaenv, hyperledger/fabric-ccenv, openjdk and hyperledger/fabric-baseimage.
# make dist-clean all
make peer
make orderer
export PATH=$PATH:/root/gows/src/github.com/hyperledger/fabric/build/bin


■ peer/core.ymlの確認
peerコマンドはcore.ymlの定義に則って作成される。
peerの挙動を把握する為にymlを確認(&必要に応じて修正)する。
在り処:$GOPATH/src/github.com/hyperledger/fabric/peer/core.yml
※ peerコマンドを叩く前までにやればOK

すること①ファイルに定義されているCLI定義の確認
cli:
# The address that the cli process will use for callbacks from chaincodes
address: 0.0.0.0:7052
→CLIで実行する時のipとportを確認

すること②ファイルに定義されているREST定義の確認
rest:
# Enable/disable setting for the REST service. It is recommended to disable
# REST service on validators in production deployment and use non-validating
# nodes to host REST service
enabled: true
# The address that the REST service will listen on for incoming requests.
address: 0.0.0.0:7050
→RESTでの実行を可(true)にする ※ defaultはfalse
→RESTで実行する時のipとportを確認

(格闘中)すること③ordererのリスナポートの修正
# ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!----
# THIS HAS TO BE DONE IN THE CONTEXT OF BOOTSTRAP. TILL THAT
# IS DESIGNED AND FINALIZED, THE FOLLOWING COMMITTER/ORDERER
# DEFINITIONS HAVE TO SERVE AS THE MEANS TO DRIVE A SIMPLE
# SKELETON.
#
# All "chaincode" commands from CLI (except "query") will
# send response from the endorser to the Committer defined below.
committer:
enabled: true
ledger:
# orderer to talk to
orderer: 0.0.0.0:5151
→ordererのデフォルトポートの5151にする ※ 修正前は7050
⇒例外なり。。
 2016/11/29 06:17:52 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:5151: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:5151" }
 06:17:52.905 [committer] NewDeliverService -> ERRO 063 Cannot dial to 0.0.0.0:5151, because of grpc: timed out when dialing
 2016/11/29 06:17:52 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:5151: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:5151" }

すること④peerコマンドのビルド ★TBC-せんでも反映されるぽい
cd /root/gows/src/github.com/hyperledger/fabric
make peer
→core.ymlに加えた変更を反映させる為にpeerコマンドを作り直す
→ref>http://stackoverflow.com/questions/40211903/hyperledger-peer-node-start-error


■ Terminal #1 - orderer

cd $GOPATH/src/github.com/hyperledger/fabric/ && ./orderer
or
export GOPATH=$HOME/gows
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:/root/gows/src/github.com/hyperledger/fabric/build/bin
orderer

// Terminal #1 Result (rest:enabled:trueの場合) -----
root@VM01:~/gows/src/github.com/hyperledger/fabric/peer# orderer
[02:36:59.434] config_util.go:34: [DEBUG] Found map[interface{}]interface{} value for fileledger
[02:36:59.434] config_util.go:48: [DEBUG] Found real value for fileledger.Location setting to
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for fileledger.Prefix setting to string hyperledger-fabric-rawledger
[02:36:59.435] config_util.go:34: [DEBUG] Found map[interface{}]interface{} value for kafka
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for kafka.Brokers setting to []interface {} [127.0.0.1:9092]
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for kafka.Topic setting to string test
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for kafka.PartitionID setting to int 0
[02:36:59.435] config_util.go:45: [DEBUG] Found map[string]interface{} value for kafka.Retry
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for kafka.Retry.Period setting to string 3s
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for kafka.Retry.Stop setting to string 60s
[02:36:59.435] config_util.go:34: [DEBUG] Found map[interface{}]interface{} value for general
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.OrdererType setting to string solo
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.BatchTimeout setting to string 10s
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.MaxWindowSize setting to int 1000
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.BatchSize setting to int 10
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.ListenAddress setting to string 127.0.0.1
[02:36:59.435] config_util.go:45: [DEBUG] Found map[string]interface{} value for general.Profile
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.Profile.Enabled setting to bool false
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.Profile.Address setting to string 0.0.0.0:6060
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.GenesisMethod setting to string static
[02:36:59.435] config_util.go:48: [DEBUG] Found real value for general.ListenPort setting to int 7050
[02:36:59.436] config_util.go:48: [DEBUG] Found real value for general.QueueSize setting to int 10
[02:36:59.436] config_util.go:48: [DEBUG] Found real value for general.LedgerType setting to string ram
[02:36:59.436] config_util.go:34: [DEBUG] Found map[interface{}]interface{} value for ramledger
[02:36:59.436] config_util.go:48: [DEBUG] Found real value for ramledger.HistorySize setting to int 1000
[02:36:59.436] config_util.go:93: [INFO ] map[ramledger:map[HistorySize:1000] fileledger:map[Location: Prefix:hyperledger-fabric-rawledger] kafka:map[Brokers:[127.0.0.1:9092] Topic:test PartitionID:0 Retry:map[Period:3s Stop:60s]] general:map[Profile:map[Address:0.0.0.0:6060 Enabled:false] ListenPort:7050 QueueSize:10 OrdererType:solo BatchTimeout:10s MaxWindowSize:1000 BatchSize:10 ListenAddress:127.0.0.1 GenesisMethod:static LedgerType:ram]]
[02:36:59.436] config.go:186: [INFO ] Validated configuration to: &{General:{OrdererType:solo LedgerType:ram BatchTimeout:10s BatchSize:10 QueueSize:10 MaxWindowSize:1000 ListenAddress:127.0.0.1 ListenPort:7050 GenesisMethod:static Profile:{Enabled:false Address:0.0.0.0:6060}} RAMLedger:{HistorySize:1000} FileLedger:{Location: Prefix:hyperledger-fabric-rawledger} Kafka:{Brokers:[127.0.0.1:9092] Topic:test PartitionID:0 Retry:{Period:3s Stop:1m0s} Version:{version:[0 9 0 1]}}}
[02:36:59.437] ramledger.go:235: [DEBUG] Sending signal that block 18446744073709551615 has a successor
[02:36:59.437] server.go:35: [INFO ] Starting orderer with consenter=*solo.consenter, and ledger=*ramledger.ramLedger
----- Terminal #1 Result (rest:enabled:trueの場合) //

// 参考:Terminal #1 Result (rest:enabled:falseの場合) -----
root@VM01:~# orderer
[04:43:54.533] config_util.go:34: [DEBUG] Found map[interface{}]interface{} value for kafka
[04:43:54.540] ramledger.go:235: [DEBUG] Sending signal that block 18446744073709551615 has a successor
[04:43:54.540] server.go:35: [INFO ] Starting orderer with consenter=*solo.consenter, and ledger=*ramledger.ramLedger
----- 参考:Terminal #1 Result (rest:enabled:falseの場合) //


■ Terminal #2 - start peer

export GOPATH=$HOME/gows
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:/root/gows/src/github.com/hyperledger/fabric/build/bin

どれでも(取り敢えず)OK
peer node start --peer-chaincodedev
CORE_PEER_ADDRESS=localhost:7051 peer node start --peer-chaincodedev
CORE_PEER_ADDRESS=0.0.0.0:7051 peer node start --peer-chaincodedev
CORE_PEER_ADDRESS=172.17.0.3:7051 peer node start --peer-chaincodedev

|●脱線>Committerの初期化が失敗する
|[error]
|# CORE_PEER_ADDRESS=172.17.0.3:7051 peer node start --peer-chaincodedev
|04:05:52.380 [committer] readUntilClose -> ERRO 067 Invalid transaction, error Invalid creator specified in the header
|→放置中★TODO

|●脱線>ポート7051が使用中な例外でpeer起動できない
|[error]
|# CORE_PEER_ADDRESS=172.17.0.3:7051 peer node start --peer-chaincodedev
|2016/11/29 03:11:50 Failed to listen: listen tcp 0.0.0.0:7051: bind: address already in use

|[check]
|ポートの確認
|# netstat -untap
|結果割愛
|# netstat -untap | grep peer | grep tcp
|tcp 1 0 127.0.0.1:54670 127.0.0.1:7050 CLOSE_WAIT 6391/peer
|tcp6 0 0 :::7051 :::* LISTEN 6391/peer
|tcp6 0 0 :::7053 :::* LISTEN 6391/peer
|プロセスの確認
|# ps
| PID TTY TIME CMD
| 5183 pts/3 00:00:00 sudo
| 5186 pts/3 00:00:00 su
| 5187 pts/3 00:00:00 bash
| 6391 pts/3 00:00:00 peer
| 8004 pts/3 00:00:00 ps

|[action]
|問題のポートを占有しているプロセスを射殺
|# kill -9 6391
|[1]+ Killed CORE_PEER_ADDRESS=localhost:7051 peer node start --peer-chaincodedev
|# ps
| PID TTY TIME CMD
| 5183 pts/3 00:00:00 sudo
| 5186 pts/3 00:00:00 su
| 5187 pts/3 00:00:00 bash
| 8014 pts/3 00:00:00 ps

|[reason]
|多分、StarterKitでdocker compose経由に起動させたpeerプロセスがゾンビ化したと思われる。



// Terminal #2 Result -----
04:53:39.918 [sysccapi] RegisterSysCC -> INFO 061 system chaincode vscc(github.com/hyperledger/fabric/core/system_chaincode/vscc) registered
04:53:39.918 [committer] NewDeliverService -> INFO 062 Creating committer for single noops endorser
04:53:39.919 [nodeCmd] serve -> INFO 063 Starting peer with ID=name:"jdoe" , network ID=dev, address=0.0.0.0:7051, rootnodes=, validator=true
04:53:39.920 [protoutils] ValidateTransaction -> INFO 064 ValidateTransactionEnvelope starts for envelope 0xc8201fcf60
04:53:39.920 [protoutils] ValidateTransaction -> INFO 065 Header is chainHeader: chainID:"**TEST_CHAINID**" > signatureHeader:
04:53:39.920 [protoutils] validateChainHeader -> INFO 066 validateChainHeader info: header type 1
04:53:39.920 [committer] readUntilClose -> ERRO 067 Invalid transaction, error Invalid creator specified in the header
Commit success, created a block!
----- Terminal #2 Result //
★TBC StartOpenchainRESTServer に関するログが出力されていない=RESTでアクセスできない。Committerの例外が起因しているのか否か

// Terminal #1 Result -----
[04:53:39.919] server.go:52: [DEBUG] Starting new Deliver handler
[04:53:39.919] deliver.go:50: [DEBUG] Starting new Deliver loop
[04:53:39.920] deliver.go:144: [DEBUG] Received message Seek:
[04:53:39.920] deliver.go:149: [DEBUG] Sent update
[04:53:39.920] deliver.go:87: [DEBUG] Receiving message Seek:
[04:53:39.920] deliver.go:186: [DEBUG] Updating properties for client
[04:53:39.920] deliver.go:133: [DEBUG] Room for more blocks, activating channel
[04:53:39.920] deliver.go:133: [DEBUG] Room for more blocks, activating channel
----- Terminal #1 Result //


■ Terminal #3 - register cc
Hyperledger Fabric Starter KitでいうところのStarterコンテナに当たるところ
cd /root/gows/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

どれでもOK
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=localhost:7051 ./chaincode_example02
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=127.0.0.1:7051 ./chaincode_example02
cf.
localhost(127.0.0.1)がactiveであることはTerminal #1のordererの標準出力からも確認できる

cf.
NG: CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=172.17.0.3:7051 ./chaincode_example02
  due to: 04:19:37.824 [shim] ERRO : Error trying to connect to local peer: grpc: timed out when dialing
  (CORE_PEER_ADDRESS=172.17.0.3:7051 peer node start --peer-chaincodedevでpeerを起動していてもNG)
NG: CORE_CHAINCODE_ID_NAME=mycc ./chaincode_example02
  due to: 04:21:15.776 [shim] CRIT : peer.address not configured, can't connect to peer

// Terminal #3 Result -----
root@VM01:~/gows/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02# CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7051 ./chaincode_example02
05:15:50.037 [shim] INFO : Chaincode log level not provided; defaulting to: DEBUG
05:15:50.037 [shim] DEBU : Peer address: 0.0.0.0:7051
05:15:50.046 [shim] DEBU : os.Args returns: [./chaincode_example02]
05:15:50.047 [shim] DEBU : Registering.. sending REGISTER
05:15:50.048 [shim] DEBU : []Received message REGISTERED from shim
05:15:50.048 [shim] DEBU : []Handling ChaincodeMessage of type: REGISTERED(state:created)
05:15:50.048 [shim] DEBU : Received REGISTERED, ready for invocations
----- Terminal #3 Result //

// Terminal #2 Result -----
05:15:50.046 [chaincode] HandleChaincodeStream -> DEBU 068 Current context deadline = 0001-01-01 00:00:00 +0000 UTC, ok = false
05:15:50.047 [chaincode] processStream -> DEBU 069 []Received message REGISTER from shim
05:15:50.047 [chaincode] HandleMessage -> DEBU 06a []Handling ChaincodeMessage of type: REGISTER in state created
05:15:50.047 [chaincode] beforeRegisterEvent -> DEBU 06b Received REGISTER in state created
05:15:50.047 [chaincode] registerHandler -> DEBU 06c registered handler complete for chaincode mycc
05:15:50.047 [chaincode] beforeRegisterEvent -> DEBU 06d Got REGISTER for chaincodeID = name:"mycc" , sending back REGISTERED
05:15:50.047 [chaincode] notifyDuringStartup -> DEBU 06e nothing to notify (dev mode ?)
----- Terminal #2 Result //

peerが起動できると以下のファイルが生成されていることが確認できる。
root@VM01:/var/hyperledger/production# ls -l
total 12
drwxr-xr-x 2 root root 4096 Nov 28 06:55 db
drwxr-xr-x 3 root root 4096 Nov 28 06:55 ledger
-rw-r--r-- 1 root root 5 Nov 28 06:55 peer.pid

■ Terminal #4 - deploy cc && query cc
□ CCデプロイ
export GOPATH=$HOME/gows
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:/root/gows/src/github.com/hyperledger/fabric/build/bin
どちらでもOK
peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -n mycc2 -c '{"Args": ["init", "a","100", "b", "200"]}'
CORE_PEER_ADDRESS=0.0.0.0:7051 peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -n mycc -c '{"Args": ["init", "a","100", "b", "200"]}'
★TBC ローカルのCCのパスの指定方法

cf.
NG: CORE_PEER_ADDRESS=172.17.0.3:7051 peer chaincode deploy -c '{"Args": ["init", "a","100", "b", "200"]}'
NG: CORE_PEER_ADDRESS=172.17.0.3:7051 peer chaincode deploy -n mycc -c '{"Args": ["init", "a","100", "b", "200"]}'
NG: CORE_PEER_ADDRESS=172.17.0.3:7051 peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -n mycc -c '{"Args": ["init", "a","100", "b", "200"]}'
  due to:
  2016/11/29 05:48:32 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 172.17.0.3:7051: getsockopt: no route to host"; Reconnecting to {"172.17.0.3:7051" }
  Error: Error getting endorser client chaincode: Error trying to connect to local peer: grpc: timed out when dialing

// Terminal #4 Result -----
root@VM01:/home/user1# peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -n mycc2 -c '{"Args": ["init", "a","100", "b", "200"]}'
05:48:22.033 [msp] func1 -> INFO 001 Creating the msp manager
05:48:22.033 [msp] GetManager -> INFO 002 Returning MSP manager %!p(msp.peerMspManagerImpl={map[] false})
05:48:22.033 [msp] Setup -> INFO 003 Setting up the MSP manager from config file /root/gows/src/github.com/hyperledger/fabric/msp/peer-config.json
05:48:22.033 [msp] newBccspMsp -> INFO 004 Creating BCCSP-based MSP instance
05:48:22.033 [SW_BCCSP] createKeyStoreIfNotExists -> INFO 005 KeyStore path [/tmp] missing [false]: []
05:48:22.033 [msp] Setup -> INFO 006 Setting up MSP DEFAULT
05:48:22.033 [msp] Setup -> INFO 007 Setting up MSP instance from file /root/gows/src/github.com/hyperledger/fabric/msp/peer-config.json
05:48:22.093 [msp] newIdentity -> INFO 008 Creating identity instance for ID &{{DEFAULT} ROOTCA}
05:48:22.093 [msp] newSigningIdentity -> INFO 009 Creating signing identity instance for ID &{{DEFAULT} PEER}
05:48:22.093 [msp] Setup -> INFO 00a MSP manager setup complete (config file /root/gows/src/github.com/hyperledger/fabric/msp/peer-config.json)
----- Terminal #4 Result //

// Terminal #3 Result -----
05:48:37.890 [shim] DEBU : [lccc]Received message INIT from shim
05:48:37.890 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: INIT(state:established)
05:48:37.890 [shim] DEBU : Entered state init
05:48:37.890 [shim] DEBU : [lccc]Received INIT, initializing chaincode
Aval = 100, Bval = 200
05:48:37.890 [shim] DEBU : [lccc]Inside putstate, isTransaction = true
05:48:37.890 [shim] DEBU : [lccc]Sending PUT_STATE
05:48:37.891 [shim] DEBU : [lccc]Received message RESPONSE from shim
05:48:37.891 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: RESPONSE(state:init)
05:48:37.891 [shim] DEBU : [lccc]before send
05:48:37.891 [shim] DEBU : [lccc]after send
05:48:37.891 [shim] DEBU : [lccc]Received RESPONSE, communicated (state:init)
05:48:37.891 [shim] DEBU : [lccc]Received RESPONSE. Successfully updated state
05:48:37.891 [shim] DEBU : [lccc]Inside putstate, isTransaction = true
05:48:37.891 [shim] DEBU : [lccc]Sending PUT_STATE
05:48:37.900 [shim] DEBU : [lccc]Received message RESPONSE from shim
05:48:37.900 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: RESPONSE(state:init)
05:48:37.900 [shim] DEBU : [lccc]before send
05:48:37.900 [shim] DEBU : [lccc]after send
05:48:37.900 [shim] DEBU : [lccc]Received RESPONSE, communicated (state:init)
05:48:37.900 [shim] DEBU : [lccc]Received RESPONSE. Successfully updated state
05:48:37.900 [shim] DEBU : [lccc]Init succeeded. Sending COMPLETED
05:48:37.900 [shim] DEBU : [lccc]Move state message COMPLETED
05:48:37.900 [shim] DEBU : [lccc]Handling ChaincodeMessage of type: COMPLETED(state:init)
05:48:37.900 [shim] DEBU : [lccc]send state message COMPLETED
----- Terminal #3 Result //

// Terminal #2 Result -----
05:48:50.503 [protoutils] validateEndorserTransaction -> INFO 16d validateEndorserTransaction info: there are 1 actions
05:48:50.503 [protoutils] validateEndorserTransaction -> INFO 16e validateEndorserTransaction info: signature header is valid
05:48:50.526 [protoutils] ValidateTransaction -> INFO 16f ValidateTransactionEnvelope returns 0xc820126530, err %!s()
Commit success, created a block!
----- Terminal #2 Result //

// Terminal #1 Result -----
[05:48:39.483] server.go:46: [DEBUG] Starting new Broadcast handler
[05:48:39.737] blockcutter.go:74: [DEBUG] Enqueuing message into batch
[05:48:49.737] consensus.go:101: [DEBUG] Batch timer expired, creating block
[05:48:49.959] ramledger.go:235: [DEBUG] Sending signal that block 0 has a successor
[05:48:50.204] deliver.go:133: [DEBUG] Room for more blocks, activating channel
----- Terminal #1 Result //


|●脱線>同じCC名でデプロイをやり直せない
|[error]
|05:38:12.690 [msp] Setup -> INFO 00a MSP manager setup complete (config file /root/gows/src/github.com/hyperledger/fabric/msp/peer-config.json)
|Error: Error endorsing chaincode: rpc error: code = 2 desc = Error deploying chaincode: Transaction or query returned with failure: Chaincode exists mycc
|05:38:28.525 [shim] func1 -> ERRO 09f [82cd940a]Transaction execution failed. Sending ERROR
|05:38:28.525 [chaincode] processStream -> DEBU 0a0 [82cd940a]Received message ERROR from shim
|05:38:28.525 [chaincode] processStream -> ERRO 0a1 Got error: Chaincode exists mycc

|[action]
|Terminal #2 (peer startしたやつ) と3 (CC登録したやつ)をCTRL+Cで強制終了し
|/var/hyperledger/production配下を全削除してpeerを再起動する。
|cd /var/hyperledger
|rm -rf production


□ CCクエリ → 苦戦中
peer起動時のcommitterの例外が起因している気がする★TODO
NG: peer chaincode query -n mycc -c '{"Args": ["query", "b"]}'
  due to: Error: Error endorsing chaincode: rpc error: code = 2 desc = Error deploying chaincode: Failed to launch chaincode spec(Failed to init chaincode(handler not found for chaincode mycc))
NG: peer chaincode query -l golang -n mycc -c '{"Function":"query", "Args":["b"] }'
NG: CORE_PEER_ADDRESS=0.0.0.0:7051 peer chaincode query -n mycc -c '{"Args": ["query", "b"]}'
NG: CORE_PEER_ADDRESS=172.17.0.3:30303 peer chaincode query -n mycc -c '{"Args": ["query", "b"]}'
NG: CORE_PEER_ADDRESS=172.17.0.3:7051 peer chaincode query -n mycc -c '{"Args": ["query", "b"]}'
NG: peer chaincode query -n vscc -c '{"Args": ["query", "b"]}'
NG: peer chaincode query -n **TEST_CHAINID** -c '{"Args": ["query", "b"]}'

ref.
Hyperledger Fabric: Error while performing chaincode deploy on peer
http://stackoverflow.com/questions/40371024/hyperledger-fabric-error-while-performing-chaincode-deploy-on-peer

tag : Fabric Hyperledger Ordering Service Endorser Committer Solo Kafka PBFT peer

2016-11-28 19:11 : 開発 : コメント : 0 : トラックバック : 0 :
コメントの投稿
非公開コメント

« next  ホーム  prev »

search

ad



counter


tag cloud

category cloud