hyperledgerhandson / trade-contracts Goto Github PK
View Code? Open in Web Editor NEWHyperledger Hands-On second edition - Smart Contracts of the Trade Network
License: Apache License 2.0
Hyperledger Hands-On second edition - Smart Contracts of the Trade Network
License: Apache License 2.0
Hi, I'm at point 1 of "Invoking and debugging a contract" in chapter 5 of the second edition of the book. I'm using Ubuntu 20.04 desktop with:
Visual Studio Code
Version: 1.55.0
Commit: c185983a683d14c396952dd432459097bc7f757f
Date: 2021-03-30T16:02:21.560Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.8.0-48-generic snap
IBM Blockchain Platform v2.0.2
All works fine so far but when I try to submit a transaction using the requestTrade method I get this error:
ERROR] Error submitting transaction: No valid responses from any peers. Errors:
peer=org1peer-api.127-0-0-1.nip.io:8080, status=500, message=error in simulation: transaction returned with failure: Error: GET_STATE failed: transaction ID: 92e44da6063a8ca291740870303d14a516a5d6cc1f478041f9b19ec8d9bc3d6a: invalid key. Empty string is not supported as a key by couchdb
Any suggestions?
Regards
Andrea
I am working through the chapter 5 Designing Smart Contract Transactions and Ledger Data Structures|Deploying a contract in the testing environment. I got stuck on step 5 which should allow to see the functions to be invoked. For some reason when I connected to the Fabric Gateway in VS Code it did not bring in the drop down menu for '[email protected]' under the Fabric Gateway section.
I'mreceiving an error that says it could not get the metadata for smart contract trade contract
[8/30/2021 5:01:13 PM] [INFO] Starting IBM Blockchain Platform Extension
[8/30/2021 5:01:13 PM] [INFO] Clearing extension cache
[8/30/2021 5:01:13 PM] [INFO] Restoring command registry
[8/30/2021 5:01:14 PM] [INFO] Registering commands
[8/30/2021 5:01:14 PM] [INFO] Execute stored commands in the registry
[8/30/2021 5:01:14 PM] [INFO] IBM Blockchain Platform Extension activated
[8/30/2021 5:01:25 PM] [INFO] connect
[8/30/2021 5:01:26 PM] [SUCCESS] Connecting to 1 Org Local Fabric - Org1 Gateway
[8/30/2021 5:02:09 PM] [WARNING] Could not get metadata for smart contract trade. The smart contract may not have been developed with the programming model delivered in Hyperledger Fabric v1.4+ for Java, JavaScript and TypeScript. Error: Transaction function "org.hyperledger.fabric:GetMetadata" returned an error: Query failed. Errors: ["Peer org1peer-api.127-0-0-1.nip.io:8080: error in simulation: failed to execute transaction 35b78a99699a64c086d80d3dffbb2c2c3e6a53568e76dc705e4576ef2cda7a6a: could not launch chaincode trade_1.0.0:3616ac57012c1d8281829f856f37909a427c92ded1cd709747c7afd921b8b7c7: chaincode registration failed: container exited with 0"]
The smart contract may not have been developed with the programming model delivered in Hyperledger Fabric v1.4+ for Java, JavaScript and TypeScript. Error: Transaction function "org.hyperledger.fabric:GetMetadata" returned an error: Query failed. Errors: ["Peer org1peer-api.127-0-0-1.nip.io:8080: error in simulation:
I've repeated the steps and the error continues
Hi, I am a buyer of the book (2nd edition) and I'm doing the tutorial in the book. I am at "Deploying a contract in the testing environment" and I'm stuck at point 5.
Here's my environment:
OS: Ubuntu 20.04.2 LTS ("focal") - running in VirtualBox on a Mac OS X Big Sur
VS Code: 1.58.2
Node: 10.19.0
NPM: 6.14.4
TypeScript: 4.3.5
IBP Extension: 2.0.4 (also tried 2.0.2, 2.0.0 and 1.0.40)
Here's my steps before I get stuck:
a. I cloned this repository and I open in VS Code the v1/trade folder. The book does not specify v1 but after packaging the contract screenshots and text specify "[email protected]" while the v2/trade folder would generate a "[email protected]".
b. I "disable the access control mechanism" by commenting out the contents of the beforeTransaction function in trade-contract.ts as shown in the book.
c. Next I connect to "1 Org Local Fabric" environment which I created from a template early in the book.
d. Although not in the book I do an "npm install" in a terminal window in the v1/trade directory - else the next step fails - this might need to be added in the book
e. In IBP extension, in the Smart Contracts section/"window" I "choose" command Package Open Project. This succeeds. After some log entries I get a "[email protected]" item in this "window".
f. Now I reach section "Deploying a contract in a testing environment". I select "Deploy smart contract" in Fabric Environments under "mychannel". A wizard appears and I'm on step 1.
g. From the "Choose a smart contract to deploy" I select "[email protected]" and click next just as the book says.
h. In the second step I have Definition name prefilled to "trade" and Definition version prefilled to "1.0.0" and I leave "Endorsement policy" as the book says. I click next.
i. In step 3 I only review previous steps' values and click deploy. I get a lot of log output (you can inspect at https://blog.andrei.rinea.ro/hlf01.txt). The screen looks like this:
j. In "Fabric Gateways" I click on "Org1 Gateway" as the book implies.
k. Although the book specifies that I should be asked for an identity, the VS Code IBP extension assumes "Org1 Admin" and populates the tree this way:
I expand "mychannel":
Finally I expand "[email protected]" node, or so I thought, but nothing appears underneath it:
Here's the log generated precisely when I tried to expand the "[email protected]" node: https://blog.andrei.rinea.ro/hlf02.txt
At this point I'm stuck and cannot continue as I don't get to the functions to be able to invoke them. I retried this using several versions of the IBP extension (2.0.4, 2.0.2, 2.0.0 and 1.0.40) with the same results. I even tried the v2/trade folder with the same results. What can be done?
Thanks,
Andrei Rinea.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.