SDK를 사용하여 설치된 체인 코드에서 함수를 호출하려고했지만 계속 문제가 있습니다. 해결할. 내가 만든 javascript 프로그램은 test/integration/client.js 파일과 fabcar/invoke.js를 혼합 한 것입니다. 그래도 난 스크립트를 실행하면 트랜잭션 제안 실행할 때, 나는 다음과 같은 오류가 점점 오전 : 나는 내 문제는 올바른 인증서를 사용하지 않는 때문입니다 알고Creater ID를 deserialize하지 못했습니다. 제공 한 ID가 Hyperledger에서 유효한 오류가 아닙니다.
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority
을하지만, 내가 사용하지 어딘지 모르겠어요 그 올바른 인증서. 내 네트워크의 구성을 여기
let data = fs.readFileSync(network[org].peers['peer1']['tls_cacerts']); var peer = client.newPeer( network[org].peers['peer1'].requests, { pem: Buffer.from(data).toString(), 'ssl-target-name-override': network[org].peers['peer1']['server-hostname'] }); console.log("- Peer set up, setting up channel"); channel = client.newChannel(utils.getConfigSetting('channelName')); channel.addPeer(peer); data = fs.readFileSync(network.orderer['tls_cacerts']); channel.addOrderer(client.newOrderer(network.orderer['url']), { pem: Buffer.from(data).toString(), 'ssl-target-name-override': network.orderer['server-hostname'] }); target.push(peer);
된다 : 여기
../src/github.com/hyperledger/fabric/build//bin/cryptogen generate --config=./crypto-config.yaml ../src/github.com/hyperledger/fabric/build//bin/configtxgen --profile OrdererGenesis -outputBlock ./channel-artifacts/genesis.block ../src/github.com/hyperledger/fabric/build//bin/configtxgen --profile Channel --outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME ../src/github.com/hyperledger/fabric/build//bin/configtxgen --profile Channel -outputAnchorPeersUpdate ./channel-artifacts/CorpMSPanchors.tx -channelID $CHANNEL_NAME -asOrg CorpMSP ../src/github.com/hyperledger/fabric/build//bin/configtxgen --profile Channel -outputAnchorPeersUpdate ./channel-artifacts/EngMSPanchors.tx -channelID $CHANNEL_NAME -asOrg EngMSP나는 내 동료 내 채널을 추가하는 코드입니다 : 나는 다음과 같은 스크립트를 사용하여 암호화-config 디렉토리를 생성
OrdererOrgs: - Name: Orderer Domain: example.com Specs: - Hostname: orderer PeerOrgs: - Name: Corp Domain: corp.example.com Specs: - Hostname: peer0 - Hostname: peer1 - Hostname: peer2 Users: Count: 10 : 요청으로
{ "tmpdir": "/tmp/hfc_test_kvs", "channelName" : "mychannel", "chaincodeId" : "blockparty", "network-config": { "orderer": { "url": "grpcs://orderer.example.com:7050", "server-hostname": "orderer.example.com", "tls_cacerts": "./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" }, "org1": { "name": "Corp", "mspid": "CorpMSP", "username": "Admin", "peers": { "peer1": { "requests": "grpcs://peer0.corp.example.com:7051", "events": "grpcs://peer0.corp.example.com:7053", "server-hostname": "peer0.corp.example.com", "tls_cacerts": "./crypto-config/peerOrganizations/corp.example.com/peers/peer0.corp.example.com/tls/server.crt" }, "admin": { "key": "./crypto-config/peerOrganizations/corp.example.com/users/[email protected]/msp/keystore", "cert": "./crypto-config/peerOrganizations/corp.example.com/users/[email protected]/msp/signcerts" } },
, 여기 내 암호-config.yaml의 일부 조각입니다
내 configtx.yaml : 나는 거래 후 제대로 거래 제안서를 제출하는 데 사용할 생각하고하고있는 인증서
Profiles: OrdererGenesis: Orderer: <<: *OrdererDefaults Organizations: - *OrdererOrg Consortiums: SampleConsortium: Organizations: - *Corp - *Eng Channel: Consortium: SampleConsortium Application: <<: *ApplicationDefaults Organizations: - *Corp - *Eng ################################################################################ # # Section: Organizations # # - This section defines the different organizational identities which will # be referenced later in the configuration. # ################################################################################ Organizations: # SampleOrg defines an MSP using the sampleconfig. It should never be used # in production but may be used as a template for other definitions - &OrdererOrg # DefaultOrg defines the organization which is used in the sampleconfig # of the fabric.git development environment Name: OrdererOrg # ID to load the MSP definition as ID: OrdererMSP # MSPDir is the filesystem path which contains the MSP configuration MSPDir: crypto-config/ordererOrganizations/example.com/msp - &Corp # DefaultOrg defines the organization which is used in the sampleconfig # of the fabric.git development environment Name: CorpMSP # ID to load the MSP definition as ID: CorpMSP MSPDir: crypto-config/peerOrganizations/corp.example.com/msp AnchorPeers: # AnchorPeers defines the location of peers which can be used # for cross org gossip communication. Note, this value is only # encoded in the genesis block in the Application section context - Host: peer0.corp.example.com Port: 7051
어떤 생각? 나는 ca-server를 사용하지 않고 있으며, 도커 컨테이너를 사용하지 않고있다. 내가 peer chaincode invoke
명령을 사용하여 chaincode를 호출 할 수 있기 때문에 환경이 작동하므로 작동하는지는 알지만 어떤 인증서인지는 client.newPeer
과 client.newChannel
함수에서 사용해야합니다.
감사합니다. 책을 읽어 주셔서 감사합니다. Bertrand.
crypto-config.yaml 및 configtx.yaml의 스 니펫을 게시 할 수 있습니까? –
완료. 요청 된 코드 스 니펫을 추가했습니다. :) – dbblackdiamond
'Eng'조직의 정의를 의도적으로 생략 했습니까? –