Comments (2)
Hi @sedacrivity
In our ChaincodeBase it has no arguments but you could overwrite the function in your implementation and get access to the 'stub' (https://fabric-shim.github.io/ChaincodeStub.html). From the stub you can get to the arguments.
class Chaincode extends ChaincodeBase {
async Init(stub) {
const args = stub.getArgs();
// ...
}
}
See https://fabric-shim.github.io/ChaincodeInterface.html.
The Init is only called when instantiating / upgrading chaincode. So it would not run when you invoke or query chaincode. For that you would need to use the 'Invoke' function.
The error you shared seems to come from your chaincode code itself. Would you be able to share your chaincode so I can get some more understanding on what your are trying to do?
from hyperledger-fabric-chaincode-dev-setup.
Hi @janb87,
Thanks for your reply and suggestion to overwrite the Init in an own implementation ... that would work fine indeed :-)
The error was indeed coming from the Init implementation within my own chaincode example ( which throws an error when there are no arguments ) - I did not inherit from your implementation ...
I understand that the Init is only executed upon instantiation ... in the Fabric examples it is used to define some attributes already ... but I reckon that is mostly for the sake of the example ... and not necessarely what one would do in a productive implementation ... hence my question on practise ... and it seems you guys didn't find a need either to have arguments in the Init method :-)
Thanks for your reply :-)
from hyperledger-fabric-chaincode-dev-setup.
Related Issues (20)
- Use inquirer instead of prompt
- Go language support
- Add api to start from existing setup
- Document how the package.json is used of the chaincode to do certain configuration
- Live adding of new chaincodes
- Watch support for package.json
- Only copy changed files inside watch task
- Update to fabric v1.1.0 HOT 1
- Setup Travis CI + add build / npm badge in readme.md
- Start docker regex to check for completion is broken for v1.1.0
- Readme still mentions 1.1.0-preview version
- Do we need the fabric-couchdb docker image?
- Copying of chaincode files crashes on a Linux vm on a windows host HOT 1
- Test template is broken
- NPM repo does not exist HOT 1
- Add option to easily invoke chaincode on a selected peer ...
- unable install hyperledger fabric
- Support for hyperledger fabric v1.4
- Error: Config not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperledger-fabric-chaincode-dev-setup.