I want to invoke chaincode to write data for 10 records automatically with using bash script and arguments for chaincode can be able to take from txt file.But, chaincode does not write to ledger from file, it writes only value "line1" and "line2".
#!/bin/bash while read -r line1 <&3 && read -r line2 <&4; do
peer chaincode invoke -c '{"Args":["createDocRecord", "$line1" , "$line2"]}' -o orderer.example.com:7050 -C bloom-filter-channel -n bloom-filter --peerAddresses peer0.org2.example.com:9051 done 3<scripts/10.txt 4<scripts/data10.txt`
Why it does not take string values from txt file?
Try to set a timeout. You are probably running the invoke while the first transaction is not validated and committed yet, I don't know how you configured your network.
So do someting like:
peer chaincode invoke -c '{"Args":["createDocRecord", "$line1" , "$line2"]}' -o orderer.example.com:7050 -C bloom-filter-channel -n bloom-filter --peerAddresses peer0.org2.example.com:9051 done 3<scripts/10.txt 4<scripts/data10.txt`
timeout 5
repeat
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.