其使用的java链码是基于gradle7.0的。相比于其他环境下的java代码,多了一些限制:
(1)逗号后面必须有空格,花括号前面必须有空格,运算符前后必须有空格
(2)类里面的set方法参数不能和类里面的成员变量名字一样
(3)import不能有*
如果是部署链码如下,结果正常:
./network.sh up createChannel -c mychannel -ca
./network.sh deployCC -ccn private -ccp ../asset-transfer-private-data/chaincode-java -ccl java -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cccg '../asset-transfer-private-data/chaincode-java/collections_config.json' -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
部署couchDB有报错:
./network.sh up createChannel -ca -s couchdb
./network.sh deployCC -ccn private -ccp ../asset-transfer-private-data/chaincode-java -ccl java -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cccg '../asset-transfer-private-data/chaincode-java/collections_config.json' -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
创建资产:
export ASSET_PROPERTIES=$(echo -n "{\"backupNetwork\":{\"netID\":\"46011010000\",\"ipEndPoint\":{\"port\":7786,\"ipv4Addr\":\"172.28.158.99\"},\"netType\":\"Center\"},\"imsi\":\"460110100010001\",\"homeNetwork\":{\"ipEndPoint\":{\"port\":7786,\"ipv4Addr\":\"172.28.158.98\"},\"cert\":\"x.509\", \"netID\":\"46011010001\",\"netType\":\"Edge\"},\"operator\":\"China Telecom\",\"ambr\":{\"uplink\":\"1073741824 bps\",\"downlink\":\"1073741824 bps\"},\"security\":{\"sqn\":\"0000000000a1\",\"opc\":\"e8ed289deba952e4283b54e88e6183ca\",\"k\":\"465b5ce8b199b49faa5f0a2ee238a6bc\",\"amf\":\"8000\"},\"slice\":{\"sst\":1,\"session\":{\"ambr\":{\"uplink\":\"1073741824 bps\",\"downlink\":\"1073741824 bps\"},\"qos\":{\"index\":9,\"arp\":{\"priority_level\":8,\"pre_emption_capability\":1,\"pre_emption_vulnerability\":1}},\"pcc_rule\":\"\",\"name\":\"internet\",\"type\":3},\"default_indicator\":true}}" | base64 | tr -d \\n)
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n private -c '{"function":"CreateAsset","Args":[]}' --transient "{\"asset_properties\":\"$ASSET_PROPERTIES\"}"
查询: