chaincode | HyperLedger Fabric chaincode samples | Runtime Evironment library
kandi X-RAY | chaincode Summary
kandi X-RAY | chaincode Summary
HyperLedger Fabric chaincode samples
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of chaincode
chaincode Key Features
chaincode Examples and Code Snippets
Community Discussions
Trending Discussions on chaincode
QUESTION
I just reinstalled Fabric Samples v2.2.0 from Hyperledger Fabric repository according to the documentation.
But when I try to run asset-transfer-basic
application located in fabric-samples/asset-transfer-basic/application-javascript
directory by running node app.js
the wallet is created and an admin and user is registered. But then it tries to invoke the function as given in app.js
and shows this error
ANSWER
Answered 2021-Jan-29 at 04:04In my opinion, the CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE
setting seems to be wrong.
you can check docker-compose.yaml
or core.yaml
- I will explain fabric-samples/test-network as targeting according to your current situation.
- You can check in
CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE
in docker-compose.yaml - Perhaps in your case(fabric-samples/test-network), the value of
${COMPOSE_PROJECT_NAME}
was not set properly, so it was set to_test
. - Make sure the value is set correctly and change it to your network name.
QUESTION
I am using Hyperledger Fabric v2.3.1.I am trying to approve my chaincode definition with argument --signature-policy "OR('Org1MSP.peer','Org2MSP.peer')" instead of the default endorsement for the test-network. The whole command is below
...ANSWER
Answered 2021-Jun-09 at 07:31add flag --signature-policy
when you commit your chaincode,like these
QUESTION
I am currently running hyperledger fabric v2.2. I have developed the chaincode using the contractapi and developing the application using fabric-sdk-go/pkg/gateway
How can i get the transaction status and the transaction payload? I am aware of the GetHistoryByKey() which is available in the contractapi but that doesn't works out for my application.
I know there is hyperledger-explorer which can be used to search transactions by TxID but my use-case is my application will be querying by TxID and then it will verify the status of that particular transaction (TxID).
Also, i have tried to achieve this using the fabsdk but i am getting an error when i try to create instantiate the fabsdk using the fabsdk.New()
. There seems to be some compatibility issue with the connection-profile.json which i am using the fabric-sample project.
The error which i am getting is:
failed to create identity manager provider: failed to initialize identity manager for organization: MyOrgName: Either a cryptopath or an embedded list of users is required
The same connection-profile has been used in getting the network up and running, and everything seems to be working all good. I am able to submit and evaluate transactions.
SOLUTION
The system chaincodes are embedded in the peer itself. so we need to set the target otherwise it would just give the discovery error since the contract QSCC is not explicitly deployed on the channel.
Make sure to check the core.yaml file channel.system - the system chaincode should be enabled channel.system.qscc: enable
...ANSWER
Answered 2021-Jun-08 at 11:42Your client application can use the client SDK appropriate to your pogramming language to evaluate the GetTransactionByID
transaction function on the qscc
system chaincode, which is available on all peers. This transaction function takes a transaction ID as its only argument and returns a peer.ProcessedTransaction
protobuf, which contains the transaction envelope and a validation code.
QUESTION
I am trying to set up a Hyperledger Fabric Network with Hyperledger Explorer. I spin up a VM on the digital ocean cloud with ubuntu OS. From there, I spin up 3 orderers node, and 2 peers node. Which result in total of 5 nodes. (I am using RAFT setup).
However, I encounter the error as below when trying to start the hyperledger fabric explorer docker-container images.
Error: ...ANSWER
Answered 2021-Feb-20 at 23:54All configurations seems good, however you have to upgrade explorer version to be compatible with hyperledger fabric version.
So please use v1.1.4 instead of v1.1.1
Also make sure that you have mounted crypto config correctly, try to access this path inside the container /tmp/crypto/peerOrganizations/acme.com/tlsca/tlsca.acme.com-cert.pem
Try to change tlsCACerts
path to use peer tls ca.crt
/tmp/crypto/peerOrganizations/acme.com/peers/peer1.acme.com/tls/ca.crt
You have mentioned that the same configurations works with hyperledger fabric v2, if you have tried it locally not on the same server so I please disable the firewall on the server and give it a try
To check if you can reach domain and port please try this
cat > /dev/tcp/peer1.acme.com/7051
Check this https://support.bluemedora.com/s/article/Using-Bash-to-test-if-a-TCP-port-on-a-remote-system-is-open
QUESTION
When a Hyperledger Fabric smart contract calls getHistoryForKey it receive the updates for a particular key. I'm wondering where does this information come from? It's not stored in the world-view (levelDB, CouchDB) so it must be retrieved from the blockchain. Does the smart contract has access to blockchain? What am I missing?
...ANSWER
Answered 2021-Jun-01 at 16:24There is a setting which enables the history database for peers. It is enabled by default and is a a physically separate database from world state.
Each channel has it's own history database. The history database uses LevelDB (an embedded database) for storage.
The history database stores key/txid/blocknum for each update. When you call GetHistoryForKey, it iterates through the history db and then retrieves the values from block storage.
QUESTION
I'm using the Vault's Kubernetes Helm Chart.
Before proceeding, I'd like to mention that my issue is extremely similar to this one, but it didn't help.
So, inside Vault, I need to load a custom plugin, which has two dependencies: libpbc and libgmp.
While trying to install the plugin, I get this error:
* fork/exec /vault/plugins/plugin_name: no such file or directory
which is not normal, for the simple reason that everything seems okay (the plugin_directory
(a Vault dependency) exists, the plugin is indeed under /vault/plugins etc).
So, by investigating, I found out that there is a big issue.
Executing ldd /vault/plugins/*plugin_name*
, I get:
ANSWER
Answered 2021-May-21 at 11:31Issue solved.
I created a custom Vault image and in the Dockerfile I made it to include all the dependencies
QUESTION
I am trying to collect this kind of logs from a docker container:
...ANSWER
Answered 2021-May-12 at 09:34I have an update.
I am using output.console to debug the filebeats logs:
QUESTION
I followed the IBM Blockchain Tutorial "A4: Invoking a smart contract from VS Code". I created a demo-contract project with the IBM Blockchain extension as describes in the tutorial with the contract language "TypeScript". But on step A4.4 I can't expand the channels tree in the Fabric Gateways view to show the available transactions.
I am using a Mac with the latest VS Code and IBM Blockchain Extension, as well as the latest Docker Desktop version 3.3.3.
I notices that there is a problem during the deployment of the contract to the "1 Org Local Fabric" environment (for the complete log please see below):
...ANSWER
Answered 2021-May-16 at 13:20I'm guessing you selected typescript as the language for your chaincode/contract, and it looks like it didn't transpile the typescript code to javascript. I would suspect there is a build option in the package.json, so try running npm run build
in a vscode terminal in the directory your smart contract is stored (there should be a package.json file in that directory). If that fails because it can't find tsc
then you need to run npm install
first to install all the pre-reqs, then you should be able to run npm run build
.
Once your smart contract has transpiled successfully (there should be in index.js file in the dist directory which is what the error message you posted is complaining about) you should be able to package the chaincode/contract again and install it (you may need to change the version number of your new package before you try to install it again and that's the version
field in your package.json file.
QUESTION
I am trying to execute a smart contract on the Hyperledger fabric test-network (Fabcar javascript smart contract) and I get the follwing error when I try to invoke the chaincode using the invoke.js file present in the fabcar javascript example:
error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer0.example.com:7050, url:grpcs://localhost:7050, connected:false, connectAttempted:true 2021-05-05T23:44:02.951Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer0.example.com:7050 url:grpcs://localhost:7050 timeout:3000 2021-05-05T23:44:02.952Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer0.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer0.example.com:7050, url:grpcs://localhost:7050, connected:false, connectAttempted:true 2021-05-05T23:44:05.957Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org01.example.com:7051, url:grpcs://localhost:7051, connected:false, connectAttempted:true 2021-05-05T23:44:05.957Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org01.example.com:7051 url:grpcs://localhost:7051 timeout:3000 2021-05-05T23:44:05.958Z - error: [DiscoveryService]: _buildPeer[mychannel] - Unable to connect to the discovered peer peer0.org01.example.com:7051 due to Error: Failed to connect before the deadline on Endorser- name: peer0.org01.example.com:7051, url:grpcs://localhost:7051, connected:false, connectAttempted:true
One thing to note is that I have changed port forwardings and peer/org names in the default test-network. My connection profile is as follows (removed certificates for clarity):
...ANSWER
Answered 2021-May-14 at 10:01I think the key piece of information is this part of the error message:
Unable to connect to the discovered orderer orderer0.example.com:7050
This is a node that has been located by the client using service discovery, not defined in your connection profile.
What I suspect has happened is that, even though you have changed the port mappings between your local machine and the Docker network, the orderer is still listening on port 7050 within your Docker network.
The discovery.asLocalhost
connection option is there to support the scenario where the blockchain network is running within a Docker network on the client's local machine, so it causes any discovered hostnames to be treated as localhost
, but it leaves the discovered port numbers unchanged. So, when using the discovery.asLocalhost
option, the port numbers that nodes are listening on within the Docker network must be mapped to the same port numbers on the local machine.
If you want to change the port numbers then you need to change them on the actual nodes themselves, not just in your Docker network mappings.
QUESTION
I am trying to do backup and restore of a hyperledger fabric network v2.2.0. To test this, I used test-network of fabric release - https://github.com/hyperledger/fabric-samples/archive/refs/tags/v2.2.0.tar.gz. First I brought up the network, created the channel, deployed CC and performed invoke, query. Then I took backup by following the article - https://www.devprovider.com/how-to-take-backup-from-hyperledger-fabric. Once done with the backup, I have deleted the network. Then I tried to restore from the backup data (crypto-materials of orderer, peers, channel-artifacts, peer data and the orderer data). I confirmed that the restoration was successful by comparing the channel height from the network I have deleted and the restored network. It was 8 at the time when I took backup. So to check if everything is working from Chaincode perspective, I have tried query which resulted in error,
Error: endorsement failure during query. response: status:500 message:"error in simulation: failed to execute transaction 392e33eaadd537650590479036a1018946dcbbebaf3d55cbddb288e243485e80: could not launch chaincode basic_1.0:4ec191e793b27e953ff2ede5a8bcc63152cecb1e4c3f301a26e22692c61967ad: error starting container: error starting container: API error (404): network _test not found"
Same error for invoke. Can anyone please guide me on how to overcome the failure of CC invoke and query? Thanks in Advance!
...ANSWER
Answered 2021-May-08 at 02:37you have not set the value of COMPOSE_PROJECT_NAME
,set it arbitrary value before you start your fabric network
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install chaincode
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page