I am trying to do a transaction from the user but when I am trying to get the channel then I am getting this error:
Microservice Logs:
error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"mychannel" >
createTransaction Error: Cannot do transaction in blockchain: DiscoveryService: mychannel error: failed constructing descriptor for chaincodes:<name:"mychannel" >
at FabricRepository.<anonymous> (/app/microservice/dist/services/blockchain-client.js:235:23)
at Generator.throw (<anonymous>)
at rejected (/app/microservice/dist/services/blockchain-client.js:6:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
POST /fabric-service/createTransaction 997.103
Peer Logs:
2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d98 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata: satisfies principal principal:"\n\013Org2MSP\020\003"
2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d99 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata: doesn't satisfy principal principal:"\n\007Org2MSP\020\003" : the identity is a member of a different MSP (expected Org1MSP, got Org2MSP)
2020-10-20 20:23:54.218 UTC [discovery] chaincodeQuery -> ERRO d9a Failed constructing descriptor for chaincode chaincodes:<name:"mychannel" > ,: no peer combination can satisfy the endorsement policy
Configtx:
mychannel:
Consortium: MyConsortium
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
Capabilities:
<<: *ApplicationCapabilities
Overall if I am doing the same transaction from org1 Peer I am getting similar error at the peer both are failing. If I remove an organization from the consortium it is working from that org but not when both are there
Any idea how to resolve this??
Generally, this error occurs if the chaincode name used in the transaction doesn't match the name used when the chaincode is deployed into the network.
Sometimes this happens if the Chaincode isn't instantiated or isn't defined in the channel. It is better to inspect Docker containers to know about the reason behind this error and make sure that the chaincode names are the same(be aware of upper/lower cases)
If you are running FB test network you can use
./monitordocker.sh fabric_test
So the problem was with the script to create anchor peer for the organization the error was leaking through bash. After adding anchor peers for both organizations things resolved, and I am able to do transactions.
The problem may be come from configtx.yaml, you have to place all the "MSPDir" properly and when you will give command, you have to set environment variable according to that "MSPDir".
Related
After adding an organization to the channel I am unable to get block 0 it says:
2021-01-05 10:30:48.412 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2021-01-05 10:30:48.500 UTC [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND} Error: can't read the block: &{NOT_FOUND}
Any idea how to resolve this?
I am using v2.3 for the orderer and peers, and I am able to fetch the block with the other organization's peer.
You could try this:
Ran startup.sh, so that recreated the channel allarewelcome (and deleted all the existing peer containers)
For both the peer definitions in docker-compose.yml file, i changed image: hyperledger/fabric-peer to image: hyperledger/fabric-peer:1.4.4
After starting the peer containers, i was able to fetch the genesis block for allarewelcome channel, as also able to join it.
I have an initial Hyperledger Fabric network as the following:
org1.example.com has 2 RAFT nodes. The system channel name is system-channel (there is only 1 consortium defined). The application channel name is channel1 in which the peer from org1.example.com runs chaincode1. Note that there is no separate orderer organization.
The system channel profile is:
OrdererGenesis:
<<: *ChannelDefaults
Orderer:
<<: *OrdererDefaults
Organizations:
- *Org1
Consortiums:
SampleConsortium:
Organizations:
- *Org1
I want to add another organization, org2.example.com so that the final network will be:
Steps that I took for system-channel (I followed https://hyperledger-fabric.readthedocs.io/en/release-1.4/raft_configuration.html#reconfiguration):
Add Org2MSP definition to Orderer Channel Group in system-channel
Add Org2MSP definition to Consortium Channel Group in system-channel
Add Org2's orderer information (tls certs, etc) to the consenters list i.e. channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters in system-channel
Start Org2's orderer i.e. orderer0.org2.example.com
Add orderer0.org2.example.com to the list of orderer addresses in system-channel i.e. .channel_group.values.OrdererAddresses.value.addresses
All the above steps work well and orderer0.org2.example.com serves system-channel
Moving on, the steps that I took for channel1:
Add Org2MSP definition to Orderer Channel Group in channel1
Add Org2MSP definition to Application Channel Group in channel1
Add orderer0.org2.example.com to the list of orderer addresses in channel1 i.e. .channel_group.values.OrdererAddresses.value.addresses
Add orderer0.org2.example.com's information (tls certs, etc) to the consenters list i.e. channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters in channel1
Up to step number 3, everything is OK. Once I completed step 4, I begin to see channel1 does not exist errors the following in the newly added orderer orderer0.org2.example.com:
2019-05-09 09:38:03.360 UTC [comm.grpc.server] 1 -> INFO 05a streaming call completed grpc.service=orderer.Cluster grpc.method=Step grpc.peer_address=192.168.224.6:43116 grpc.peer_subject="CN=orderer0.org1.example.com,OU=peer+OU=org1,O=org1.example.com,L=Singapore,ST=Singapore,C=SG" error="channel channel1 doesn't exist" grpc.code=Unknown grpc.call_duration=711.5µs
In the current RAFT leader, there are error messages as well (3 refers to orderer0.org2.example.com:
2019-05-09 09:38:02.859 UTC [orderer.consensus.etcdraft] logSendFailure -> ERRO 0c5 Failed to send StepRequest to 3, because: aborted channel=channel1 node=1
It seems that orderer0.org2.example.com is not aware that it is supposed to serve channel1. I also cannot see channel1 folder in /var/hyperledger/production/orderer/chains in orderer0.org2.example.com
As part of my troubleshooting, I tried to persist all the orderers' /var/hyperledger/production/orderer folder which contains the chain. shut down orderer0.org1.example.com and orderer0.org2.example.com and copy the channel1 folder from orderer0.org1.example.com to orderer0.org2.example.com and finally start both orderers.
Now orderer0.org2.example.com knows that it needs to serve channel1 as evidenced in the logs
2019-05-10 02:36:04.161 UTC [orderer.consensus.etcdraft] apply -> INFO 044 Applied config change to add node 1, current nodes in channel: [1] channel=channel1 node=3
2019-05-10 02:36:04.161 UTC [orderer.consensus.etcdraft] apply -> INFO 045 Applied config change to add node 2, current nodes in channel: [1 2] channel=channel1 node=3
2019-05-10 02:36:04.161 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 046 Got block [6], expect block [7], this node was forced to catch up channel=channel1 node=3
2019-05-10 02:36:04.161 UTC [orderer.consensus.etcdraft] apply -> INFO 047 Applied config change to add node 3, current nodes in channel: [1 2 3] channel=channel1 node=3
Based on above, it is obvious orderer0.org2.example,com has no way to receive channel1's block to start serving the channel. For peers, peer can receive the block and issue peer channel join block_name.block but orderers can't do that. I am wondering what step am I missing.
To simulate the environment and reproduce the issue, refer to: https://github.com/aldredb/bring-your-own-orderer
This is resolved. The issue is that I didn't use the latest config block as the bootstrap block in the new orderer, orderer0.org2.example.com. Once I did the aforementioned, orderer0.org2.example.com is able to detect channel1:
2019-05-10 14:06:04.778 UTC [orderer.common.server] replicateDisabledChains -> INFO 072 Successfully replicated 0 chains: []
2019-05-10 14:06:44.680 UTC [orderer.common.server] replicateDisabledChains -> INFO 073 Found 1 inactive chains: [channel1]
2019-05-10 14:06:44.689 UTC [orderer.common.cluster] ReplicateChains -> INFO 074 Will now replicate chains [channel1]
When I try to install a channel it gives me the following error:
Error: got unexpected status: BAD_REQUEST -- Unknown consortium name: SampleConsortium
On the orderer I get the following WARN:
Rejecting broadcast of config message from 172.18.0.3:57490 because of error:Unknown consortium name: SampleConsortium
I am not referencing sample consortium In any way, I cant find it In any of the generated channel artifacts and on the logs of, peer, orderer, and cli does not appear any other feedback.
I am using version 1.4
I will be happy to share more info.
EDIT1:
I see something weird when using the command create on the cli I get the following feedback:
[common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /etc/hyperledger/fabric/configtx.yaml
And when seeing that config Is a default template of the configtx file. Why is it doing this?
The consortium is defined in the file called configtx.yaml (specifically in the Profile section) , this is the file is used to create orderer genesis block and is embedded in docker-compose yaml file in orderer config section.
When you do docker-compose up this block is hardcoded into the orderer along with a system channel called testchainid. To verify the same, look up the docker logs by docker logs -f <orderer.example.com or whatever the url is>.
Looks like you have misconfigured configtx file, refer this file for better reference.
Specifically, You probably wrote something like
Profiles:
mychannel:
Consortium: SampleConsortium
Application:
...
And missed defining the SampleConsortium in the genesis profile like
Profile:
TwoOrgGenesis:
Consortiums:
SampleConsortium:
Organizations:
- <<: *org1
Policies:
....
After making required modifications in the configtx file, recreate the artifacts including genesis.block, channel.tx, anchors.tx before restarting the network.
I am getting an error when following the tutorial for adding an new organization in the channel .
The command I typed is
./eyfn.sh up
The output below is the error I got.
+ res=1
+ set +x
+ peer channel join -b mychannel.block
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org3MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/Admin#org3.example.com/msp
CORE_PEER_ID=Org3cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org3.example.com:7051
2018-06-19 22:08:40.019 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: proposal failed (err: rpc error: code = Unknown desc = chaincode error (status: 500, message: Cannot create ledger from genesis block, due to LedgerID already exists))
Usage:
peer channel join [flags]
Flags:
-b, --blockpath string Path to file containing genesis block
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
peer0.org3 failed to join the channel, Retry after 3 seconds
Specifically the error in the outputs seems to be this,
Error: proposal failed (err: rpc error: code = Unknown desc = chaincode error (status: 500, message: Cannot create ledger from genesis block, due to LedgerID already exists))
I am following instructions from the http://hyperledger-fabric.readthedocs.io/en/release-1.1/channel_update_tutorial.html.
Any guidance seem to be helpful.
Run this command
./byfn.sh -m down
And then run
./eyfn.sh up
Hope this help!
My fabric version is 1.1.0-preview, the peer, orderer, configtxgen is newly generated.
when I execute the configtxgen tool:
configtxgen -profile SoloOrdererGenesis -outputBlock genesis.block
configtxgen -profile mych -outputCreateChannelTx channel-artifacts/mych.tx -channelID mych
It generate the genesis.block and mych.tx with channelName is mych.
Then orderer start with genesis.block, I execute following:
peer channel create -f mych.tx -o orderer.example.com:7050 -c mych
it throw the error,
Error: got unexpected status: FORBIDDEN -- Failed to reach implicit threshold of 1 sub-policies, required 1 remaining: permission denied
which step is wrong?
my configtx.yaml file is:
---
Profiles:
SoloOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortium4:
Organizations:
- *Org1
- *Org2
- *Org3
- *Org4
SampleConsortium3:
Organizations:
- *Org1
- *Org2
- *Org3
SampleConsortium2:
Organizations:
- *Org1
- *Org2
SampleConsortium1:
Organizations:
- *Org1
mych4:
Consortium: SampleConsortium4
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
- *Org3
- *Org4
mych3:
Consortium: SampleConsortium3
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
- *Org3
mych2:
Consortium: SampleConsortium2
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
mych1:
Consortium: SampleConsortium1
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: orderer/msp
- &Org1
Name: Org1MSP
ID: Org1MSP
MSPDir: org1/peer/msp
AnchorPeers:
- Host: peer.org1.example.com
Port: 17051
- &Org2
Name: Org2MSP
ID: Org2MSP
MSPDir: org2/peer/msp
AnchorPeers:
- Host: peer.org2.example.com
Port: 27051
Orderer: &OrdererDefaults
OrdererType: solo
Addresses:
- orderer.example.com:7050
BatchTimeout: 2s
BatchSize:
MaxMessageCount: 10
AbsoluteMaxBytes: 99 MB
PreferredMaxBytes: 512 KB
Organizations:
Application: &ApplicationDefaults
Organizations:
When I got this problem my solutions was pretty simple .. I had already started my network using
/byfn.sh -m up
forgot about it and was trying to start it first by generating the crypto and then using the same command.
The problem was resolved as soon as I first downed the old network using
/byfn.sh -m down
and started again with the same up command.
It could very well be a simple matter of the wrong path for a file. When you generated the mych.tx file, you wrote it to channel-artifacts/mych.tx but when try to create the channel, you left out the channel-artifacts directory. You could try peer channel create -f channel-artifacts/mych.tx -o orderer.example.com:7050 -c mych
That said, I just had a similar problem with the same error. I was testing a newly created genesis block and crypto. In my case, it was the result of the previous crypto and channel being stored in a Docker volume from one of my previous tests. That may not be the case with you, since you said you are creating a new peer and orderer.
You can check on that by connecting to one of the peers (or cli container if you have one) with docker exec -it <container name> bash and then running peer channel list. If you get something like this back, then that's your problem:
root#4cf873123669:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel list
2018-04-05 14:09:40.734 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-04-05 14:09:40.734 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-04-05 14:09:40.739 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-04-05 14:09:40.740 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0AAE070A5C08031A0C08A4DC98D60510...631A0D0A0B4765744368616E6E656C73
2018-04-05 14:09:40.740 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 93EFB49DD86ABB5568DE1E2C8FC53FA99AB52929AFA24D7B317C270DE8CDC80B
Channels peers has joined:
mych
2018-04-05 14:09:40.743 UTC [main] main -> INFO 006 Exiting.....
If you don't see the mych listed under "Channels peers has joined:", then my answer is not pertinent to you. (But may be to someone else!)
Here is how you would restore your local Hyperledger Docker instance to a clean state:
docker-compose -f docker-compose.yaml down --volumes
The --volumes tells Docker to remove any volumes associated with the containers in the configuration file.
For good measure, I just wiped everything (all Docker containers and volumes - this was a test system) down to a blank slate and started the process all over:
docker-compose -f docker-compose.yaml down --volumes
docker rm $(docker ps -aq)
docker volume prune
rm genesis.block channel-artifacts/mych.tx
Once I removed those, and started the Fabric back up, I was able to create the channel without getting that error.
If it doesn't work last resort will be sudo service docker restart which will restart all the docker services like docker system, network and volumes.
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-
artifacts/genesis.block -channelID $CHANNEL_NAME
while creating the genesis block you need pass the syschannelname.
while creating channel use the different channel name.
Eg:
1.sysmych
2.mych
It would be clearer if you share the debug log of orderer. To enable debug add
- ORDERER_GENERAL_LOGLEVEL=debug
in your docker compose file under orderer service, and start your network again. you can then print out the log using command
docker logs CONTAINER_NAME --details
I suggest to print the log before and after running the create channel command.
I had the same Error got resolved as below
you may need to add
Go path also
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
echo $GOPATH
followed by /byfn.sh -m down if it is Up Earlier.
reference:
https://hyperledger-fabric.readthedocs.io/en/release-1.1/prereqs.html
If any of the solutions on this page didn't work out for anyone then try removing your network from docker networks. View your docker networks by running docker network ls and remove your network by running docker network rm <network-name>.
Removing docker network worked out for me but I did this on a dev server.
In my case the problem was with the permission as well as network already being up( partially).
I had started with "./byfn.sh up" without using sudo , so i got error for first time.
Next, i did "sudo su" then ran "./byfn up", again i got error.
Referring to one of the answers here being a superuser i did "./byfn down" and then "./byfn up" now, this worked for me.
I encounter this issue many times, always use docker volume prune to solve it.