I have been working with Hyperledger Fabric from sometime now. Usually, when the my chaincode instantiation fails (due to some error in the Go code) or when I just want to update it, I need to stop all the execution and then respawn CA, Orderer, CouchDB and peers. This is really problematic and time consuming.
I wish to know if there is any direct way of doing this? I am unable to find any solution online in language simple enough to understand.
Thank you in advance.
if by "error in go code" you mean error in chaincode, you can install+instantiate a corrected copy with different name, or even with same name but different version and then upgrade it. You don't need to stop peer or others to do either of these.
Related
I've been studying the Hyperledger Fabric framework reading the docs for quite a while now but I'm getting a little lost in the middle of all that info. My question is: Is there any guidelines/"Step by step" on how to design a blockchain network from scratch? If you are starting a new project, where do you start?
Because I think I would understand it way more quicker if I actually started coding a little instead of reading and reading and reading...
Thanks a lot!
Edit 1:
I've chosen #kekomal answer as the correct one but I'd like to thank #Isha Padalia for the awesome VS Code extension and tutorial.
If you are really interested in learning and diving into Hyperledger Fabric, avoid byfn script. It performs a lot of magic for building a very simple Hyperledger Fabric network. After that, you have a network that you don't know how has been created and you have absolutely no idea of how to start deploying your custom network. There are daily questions here from people who started that way and are absolutely lost.
I find interesting this tutorial: https://medium.com/beyondi/setup-the-hyperledger-fabric-network-from-scratch-b82913b47549. Take into account that it is a little bit outdated.
You can complement it with this newer tutorial: https://www.blockchainexpert.uk/blog/how-to-deploy-hyperledger-fabric-network-from-scratch. Don't only run the steps. Analyze the files in https://github.com/blockchain-expert/hyperledger-fabric-network-from-scratch. Try playing with configtx.yaml, crypto-config.yaml and docker-compose files to customize your network and understand what you are doing.
Customize your organizations, your consortiums, your ordering service, your peers... Create your channels, join them, update your anchor peers... And understand what you are doing.
After that, if your network had one orderer, deploy a new one with more than one (with Raft consensus). If your network was using cryptogen, deploy a new one using Fabric-CAs instead. Or you can follow by playing with chaincodes.
NOTE: Apart from Hyperledger Fabric itself, it is essential to have basic notions of docker and PKI.
You are a beginner in Hypelredger fabric development then you have first cleared the concept of the orderer, peer, CA, and organization concept. And then first you have to start IBM Blockchain Platform VS Code extension for fabric. It will provide a local fabric environment to create, test and deploy a fabric smart contract. Also generate 1 peer, 1 orderer, 1 CA service under VS code environment.
Here is a link to start development with VS code extension.
Hope it will help you:)
hi #d3v9 start from here https://hyperledger-fabric.readthedocs.io/en/release-1.4/build_network.html. also you can find some great article on medium
Which language among Node.js and Go is better suited for 'chaincode' development when it comes to maintainibility, scalability and better support?
It's a matter of personal preference, but I'd say Golang, because:
Node.js chaincode uses npm install at the time of container building, which is slow and might fail due to network problems, while Golang just compiles the source code without fetching anything.
Chaincode features are introduced to Golang chaincode first and then later on to other chaincode implementations.
I am a blockchain learner. I took Hyperledger composer as the implementation for blockchain.
Developed a sample application using composer.
Now my question is
how do I find the hashcode generated for the transaction? I can see only transaction ID's which are getting generated.
How do I get a previous transaction or block information using current transaction?
How to tell its a block chain based on the information stored?
I am not sure if this is the right question please correct.
I think you should install hyperledger-explorer along side. Check this link here
Edit the explorer port in appConfig.json as explorer and playground will be using the same port (8080)
is there a way to do a certain kind of Transaction on a daily basis (at a certain time) using the logic.js file? I know that there are timestamps that you can add to an asset, but I donĀ“t see how that could be used to haven an automatic transaction. Is there some other solution maybe? Or do i need an application wrapped around hyperledger fabric for that?
Thx in advance
You couldn't do it from the logic.js file, but you could use the Composer Node API to call the transaction every day, achieving what you want to do?
Example of a Transaction
You are right, that is an application wrapped around. But it's pretty lightweight, the only issues I had were getting my head around authentication. Here is a utility script to help with that.
I'm studying Hyperledger Fabric with the documentation(https://hyperledger-fabric.readthedocs.io/en/release-1.0/write_first_app.html)
I'm done with two samples, which is "Building Your First network" & "Writing Your First Application"
I'm also done adding 1 extra peer to each organization, by modifying certain files, as well as done trying all commands on "Writing Your Fist Application" session.
Now, I'd like to execute the same commands(e.g. Querying all cars, Adding new cars or whatever) on the first network where I have built up, not on the test Fabcar network.
The thing is that I really have no idea what to do and how to do, even though I know how to handle NodeJS program(by Writing Application webpage)
So I'd like to ask you some questions.
Should I modify some files in order to "move" all necessary things to my network? if so, which file should I modify?
By any chance, Could you please tell me the correct steps to make it? I feel like I need to install and instantiate the required smart contract on my peers. Am I right?
I really appreciate your help in advance.
To answer your question, you would need to read some documentation online that will help you understand the architecture and how you can build up the packages as hyperledger fabric provided freedom to users to create use case specific configurations.
To start with.
Make sure you have have understood the concept of peer, orderer, couchdb, ca authority. Those 4 things you need to play with most of the times.
Assuming you have installed nodejs and able to run node through terminal, Read through the following example
Tuna Fish example, it help you to understand the concept of injecting, updating, querying blockchin ledger. Also, It will help understand the usage of Nodejs backend and angularjs basic UI. or use the other examples as you have seen on the fabric-samples github repository. Fabric Samples. Balance Transfer will help you understand the channel and chaincode operations using Node JS. Build your first network will help you understand the configuration files(concentrate on docker-compose.yaml, scipt.js and byfn.js)
Then to answer your questions.
you just have to modify the mount drive config variables in docker-componse-cli.yaml. Then you can edit your startup script based on how you want to move chaincode to your peer.
you need to install chaincode on all the peers that are part of that channel. And you only need to instantiate chaincode once per channel.
Installation and instantiation combination is a powerful feature because it allows for a peer to interact with the same chaincode container across multiple channels. The only prerequisite is for the actual chaincode source files to be installed on the peer's file system. As such, if a piece of common chaincode is being used across dozens of channels, a peer would need only a single chaincode container to perform read/writes on all the channel ledgers.
To run the node js files on the fabric network.
welcome to blockchain world :)