Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error starting fabcar chaincode: failed to parse client key pair when inititate chaincode #1

Open
csquan opened this issue Nov 26, 2020 · 30 comments

Comments

@csquan
Copy link

csquan commented Nov 26, 2020

Has anyone test it successful?
Error starting fabcar chaincode: failed to parse client key pair when deploy cc.

@VoneChain-CS
Copy link
Owner

VoneChain-CS commented Nov 26, 2020 via email

@csquan
Copy link
Author

csquan commented Nov 27, 2020

what you mean is fabric-chaincode-go must use https://github.com/VoneChain-CS/fabric-chaincode-go-gm,is right?
I had done above,but error still exist,maybe something other wrong..

@csquan
Copy link
Author

csquan commented Nov 27, 2020

My test step:
1.make and make docker with https://github.com/VoneChain-CS/fabric-gm.
2.clone hyperledger/fabric-samples and chekcout v2.1.1.
3.cd fabric-samples/test-network,run ./network.sh up -i 2.2.0 to start network.
4.run ./network.sh createChannel and it is ok.
5. ./network.sh deployCC ,error happened. "Error starting fabcar chaincode: failed to parse client key pair when deploy cc."
As above answer,I had modify fabric-samples/chaincode/fabcar/go/fabcar.go where import github.com/VoneChain-CS/
fabric-chaincode-go-gm/go/fabric-contract-api-go/contractapi
6.run ./network.sh deployCC again ,and logs show "
Vendoring Go dependencies ...
/home/work/fabric-samples/chaincode/fabcar/go /home/work/fabric-samples/test-network"
no response,what happened?

@csquan
Copy link
Author

csquan commented Nov 27, 2020

I just want to test gm-2.2.0,is there anyway to do it?

@VoneChain-CS
Copy link
Owner

VoneChain-CS commented Nov 27, 2020 via email

@VoneChain-CS
Copy link
Owner

VoneChain-CS commented Nov 27, 2020 via email

@csquan
Copy link
Author

csquan commented Nov 27, 2020

where should I find chaincode as you said?

@csquan
Copy link
Author

csquan commented Nov 27, 2020

I have checkout https://github.com/VoneChain-CS/fabric-chaincode-go-gm/blob/master/go/abstore.go and chaincode is same as normal,
so I wonder how to test in fabric-samples?Or you can tell me how does you test?

@VoneChain-CS
Copy link
Owner

VoneChain-CS commented Nov 27, 2020 via email

@csquan
Copy link
Author

csquan commented Nov 27, 2020

sorry,there were no attachment of the email 45 minutes ago.

@fffmonkeyking
Copy link

hi csquan ,
i fllow your test step:
1.make and make docker with https://github.com/VoneChain-CS/fabric-gm.
2.clone hyperledger/fabric-samples and chekcout v2.1.1.
3.cd fabric-samples/test-network,run ./network.sh up -i 2.2.0 to start network.
:
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'

ERROR! Peer binary and configuration files not found..

Follow the instructions in the Fabric docs to install the Fabric Binaries:
https://hyperledger-fabric.readthedocs.io/en/latest/install.html

@fffmonkeyking
Copy link

hi csquan,
where are your peer & cryptogen from?
i run make under fabric-gm/, but:
The following files contain gofmt errors
bccsp/opts.go
The gofmt command 'gofmt -l -s -w' must be run for these files
Makefile:171: recipe for target 'linter' failed
make: *** [linter] Error 1

then i see fabric bin under /fabric-gm/build/bin/:
configtxgen configtxlator cryptogen discover idemixgen orderer peer

and i export /fabric-gm/build/bin/ to PATH

@csquan
Copy link
Author

csquan commented Nov 27, 2020

sorry,I forget serveral points:
1.edit path at line 15 in network.sh,in my file "export PATH=${PWD}/../bin:$PATH:/home/work/fabric-gm/build/bin"
2.mv fabric-gm/sampleconfig to fabric-samples dir and rename config.
3. steps:
./network.sh up -i 2.2.0 is ok.
./network.sh createChannel is ok.
./network.sh deployCC error happened

@csquan
Copy link
Author

csquan commented Nov 27, 2020

And I have another question:does anyone who done upgrade fabric-gm before?
now,I face a problem,I have run 1.4.2-gm and it work well,
after some days,I want upgrade it to 2.2.0.
so I wonder that the data can compatible?
in other words,does old data still can use ?

@fffmonkeyking
Copy link

1, run ./network.sh deployCC first:
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 7a71fae0da9ba97a209c0d451d8f1c2ea46bbaa173ce69087b7c8a9354d7737a: could not launch chaincode fabcar_1:762e0fe3dbeee0f7b08fb6200adeb4a3a20f649a00f168c0b3c2257e53b6e506: chaincode registration failed: container exited with 0"
!!!!!!!!!!!!!!! Invoke execution on peer0.org1 peer0.org2 failed !!!!!!!!!!!!!!!!

ERROR !!! Deploying chaincode failed

2, run ./network.sh deployCC again:
Error: query failed with status: 500 - failed to invoke backing implementation of 'CheckCommitReadiness': requested sequence is 1, but new definition must be sequence 2
!!!!!!!!!!!!!!! After 5 attempts, Check commit readiness result on peer0.org1 is INVALID !!!!!!!!!!!!!!!!

@csquan
Copy link
Author

csquan commented Nov 27, 2020

you can type docker ps -a,find cc container and checkout it log.
then checkout my first question and official answer.

@fffmonkeyking
Copy link

还有就是 我怎么知道 chaincode 跑在国密算法环境里,而不是原始的 ecdsa?
fabric-gm 的 peer 和 orderer 默认是在 国密算法环境里?

@fffmonkeyking
Copy link

@csquan
Copy link
Author

csquan commented Nov 27, 2020

peer and order is defined by code.
and you can use openssl to checkout cert is gm.

@fffmonkeyking
Copy link

hi csquan,
sorry,占用了你的空间 提 额外的问题。

@csquan
Copy link
Author

csquan commented Nov 27, 2020

https://github.com/VoneChain-CS/fabric-chaincode-go-gm, it is done.
Official answer is mean cc should use this to my first question.
I have try today,but it always error.

@fffmonkeyking
Copy link

hi csquan,
tks

@fffmonkeyking
Copy link

yes, the same error:

/gm/fabric-samples/test-network# docker logs -f 851859461c1a
Error starting fabcar chaincode: failed to parse client key pair

/gm/fabric-samples/test-network# docker logs b8db1ce37e21
Error starting fabcar chaincode: failed to parse client key pair

@csquan
Copy link
Author

csquan commented Nov 27, 2020

the chaincode which samples use is at dir fabric-samples/chaincode/fabcar/go,and I edit fabcar.go,
replace line 12 to "github.com/VoneChain-CS/fabric-chaincode-go-gm/go/fabric-contract-api-go/contractapi" which is gm-cc,
but when deployCC errors happened,you can deep in and discuss it.

@fffmonkeyking
Copy link

all are ok:
... ...
Querying chaincode on peer0.org1...
Using organization 1
===================== Querying on peer0.org1 on channel 'mychannel'... =====================
Attempting to Query peer0.org1, Retry after 3 seconds.
++ peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'
++ res=0
++ set +x

2020-11-28 10:53:18.375 CST [msp] SetupBCCSPKeystoreConfig -> INFO 001 bccspConfig.ProviderName---,GM
2020-11-28 10:53:18.376 CST [msp] newBccspMsp -> INFO 002 Creating BCCSP-based MSP instance
[{"Key":"CAR0","Record":{"make":"Toyota","model":"Prius","colour":"blue","owner":"Tomoko"}},{"Key":"CAR1","Record":{"make":"Ford","model":"Mustang","colour":"red","owner":"Brad"}},{"Key":"CAR2","Record":{"make":"Hyundai","model":"Tucson","colour":"green","owner":"Jin Soo"}},{"Key":"CAR3","Record":{"make":"Volkswagen","model":"Passat","colour":"yellow","owner":"Max"}},{"Key":"CAR4","Record":{"make":"Tesla","model":"S","colour":"black","owner":"Adriana"}},{"Key":"CAR5","Record":{"make":"Peugeot","model":"205","colour":"purple","owner":"Michel"}},{"Key":"CAR6","Record":{"make":"Chery","model":"S22L","colour":"white","owner":"Aarav"}},{"Key":"CAR7","Record":{"make":"Fiat","model":"Punto","colour":"violet","owner":"Pari"}},{"Key":"CAR8","Record":{"make":"Tata","model":"Nano","colour":"indigo","owner":"Valeria"}},{"Key":"CAR9","Record":{"make":"Holden","model":"Barina","colour":"brown","owner":"Shotaro"}}]
===================== Query successful on peer0.org1 on channel 'mychannel' =====================

@fffmonkeyking
Copy link

1, don't modify fabcar.go file;
2, modify fabric-samples/chaincode/fabcar/go/go.mod to fabric-chaincode-go-gm/go/go.mod (and maybe need to edit path . to your absolute path)
3, cp -r fabric-chaincode-go-gm/go/ 's fabric-chaincode-go fabric-contract-api-go go.mod go.sum tjfoc vendor to fabric-samples/chaincode/fabcar/go/
4, run go mod vendor under fabric-samples/chaincode/fabcar/go/
5, run ./network.sh deployCC -> ok

@fffmonkeyking
Copy link

/fabric-samples/chaincode/fabcar/go# ls -al
total 52
drwxr-xr-x 6 root root 4096 Nov 28 10:51 .
drwxr-xr-x 7 root root 4096 Nov 27 17:56 ..
-rw-r--r-- 1 root root 4092 Nov 28 10:51 fabcar.go
drwxr-xr-x 6 root root 4096 Nov 28 10:22 fabric-chaincode-go
drwxr-xr-x 6 root root 4096 Nov 28 10:22 fabric-contract-api-go
-rw-r--r-- 1 root root 661 Nov 28 10:26 go.mod
-rw-r--r-- 1 root root 18824 Nov 28 10:22 go.sum
drwxr-xr-x 4 root root 4096 Nov 28 10:22 tjfoc
drwxr-xr-x 6 root root 4096 Nov 28 10:51 vendor

@csquan
Copy link
Author

csquan commented Nov 28, 2020

thanys a lot,i will try.
And most important question:
And I have another question:does anyone who done upgrade fabric-gm before?
now,I face a problem,I have run 1.4.2-gm and it work well,
after some days,I want upgrade it to 2.2.0.
so I wonder that the data can compatible?
in other words,does old data still can use ?
if does not use old data,fabric version upgrade meaning nothing,

@MoonShinesSeas
Copy link

Check the content of the certificate and find whether the public key algorithm uses ecdsa.

Certificate:
Data:
Version: 3 (0x2)
Serial Number:
49:63:17:60:ff:1c:40:b3:d4:9b:d7:9e:52:50:54:8b
Signature Algorithm: SM2-with-SM3
Issuer: C = US, ST = California, L = San Francisco, O = example.com, CN = tlsca.example.com
Validity
Not Before: Apr 24 07:25:28 2024 GMT
Not After : Apr 22 07:25:28 2034 GMT
Subject: C = US, ST = California, L = San Francisco, O = example.com, CN = tlsca.example.com
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
pub:
04:28:0a:7c:cd:22:70:53:6e:29:91:c1:d1:ea:45:
b5:10:9a:bc:d5:b5:c5:61:3f:9b:07:00:cc:53:ad:
0c:13:79:46:34:0a:77:d4:a5:e6:cc:89:f0:9c:a6:
1b:10:38:0c:db:52:7b:7e:5c:0e:56:1c:6c:9d:85:
44:05:81:87:50
ASN1 OID: SM2
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature, Key Encipherment, Certificate Sign, CRL Sign
X509v3 Extended Key Usage:
TLS Web Client Authentication, TLS Web Server Authentication
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Subject Key Identifier:
6B:FC:D6:7C:67:A6:D8:63:4D:8F:7D:4C:AD:ED:46:76:71:AC:90:38:98:A8:CD:37:14:E9:A5:99:0C:82:BC:A1
Signature Algorithm: SM2-with-SM3
Signature Value:
30:45:02:20:04:ff:3f:a9:ac:0e:bb:52:35:38:87:02:4d:a3:
a6:a9:dc:6d:6e:4e:de:36:0f:08:43:99:a8:05:53:16:e8:d8:
02:21:00:ad:83:83:98:ce:2b:a5:96:40:7d:7d:80:ae:3c:a0:
0d:72:d9:4b:a3:fe:d4:d2:ec:d3:33:70:a5:cd:20:19:a1

@vsiryxm
Copy link
Collaborator

vsiryxm commented Apr 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants