Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fabric-Sample: Cannot create ledger from genesis block, due to LedgerID already exists

I am trying out the fabric-samples balance-transfer example, I tried to create a new channel with the below commands. The channel gets created but when I try to join the peer to the channel I get the below error. Can anyone suggest the step I am missing or going wrong

[client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Cannot create ledger from genesis block, due to LedgerID already exists)

Command I used to create a new channel Config

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel.tx -channelID channel1

REST Call I am using to create the channel

curl -s -X POST http://localhost:4000/channels -H "authorization: Bearer XXXXXX" -H "content-type: application/json" -d '{ "channelName":"channel1", "channelConfigPath":"../artifacts/channel/channel.tx" }'

REST Call I am using to join the channel

curl -s -X POST http://localhost:4000/channels/channel1/peers
-H "authorization: Bearer XXXXX" -H "content-type: application/json" -d '{ "peers": ["peer1","peer2"] }'

like image 863
Karthik Sukumaran Avatar asked Oct 29 '22 21:10

Karthik Sukumaran


1 Answers

In most instances, Cannot create ledger from genesis block, due to LedgerID already exists, indicates that the peers have already joined the channel.

A quick way to test this, if you have instantiated chaincode on the peers, is to do a query on the ledger using one of the peers.

like image 83
smeyers Avatar answered Jan 02 '23 21:01

smeyers