Where is the transactions stored in IBM Blockchain Marble's Demo? - node.js

I am running blockchain demo which is provided by IBM mentioned in below link :
https://github.com/IBM-Blockchain/marbles
I have run Hyper ledger Fabric network on one linux system and 3 more clients on another 3 virtual instance on which my marbles client is running. It is working proper.
If we do any transactions then it will affect all the 3 client,
So, now if I want to see the all the transactions details, from where I can see it?
Is there any database or any files on client side?
Please provide me answer or reference link if any.
Thanks in advance.

When using the Marbles tutorial, there is a “Story Mode” option that will display more details about the transaction process. See point 10 under the “Use Marbles” heading.
Transactions are stored on a ledger which is associated with each peer. Refer to the Hyperledger Fabric documentation on the ledger. The linked Transaction Flow section might also be helpful. The ledger itself is not propagated to a client-side application. However, queries initiated from client applications can be run against the ledger to return information.
The Hyperledger Fabric Writing Your First Application documentation topic could also help to explain how querying the ledger works.

The marbles demo starts and uses a CouchDB docker container. You might be able to query it, but I don't know how the image was built. See line 187 in docker-compose-marblesv3.yaml.
It's easy to install CouchDB. You tell the peers about their CouchDB in the core.yaml file. But I don't see anything in the docker-compose-marblesv3.yaml so it is probable set in the image.

Related

Hyperledger Fabric blockchain network from scratch

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

Hyperledger Composer How to check hash code that is generated for transaction

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)

How to execute the given "js files" on the Fabric network?

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 :)

How to access the underlying Fabric code in hyperledger composer?

I am developing a business network with hyperledger composer. I have followed the tutorial on composer web site at composer playground and have made the tutorial-network as well. Now I am facing one issue. after finishing defining your business network, how is it possible to get the underlying Fabric code that is generated? I can't think of a reason why it should be necessary to have it directly, but lets say if for any reason, like having to give Fabric code to your customer for whom you have developed a poc, you need to have that. Is Fabric code being saved somewhere? I have looked into the business network folder; there are only subfolders for models, test, the business network itself, and after you generate the archive file there is only one file with .bna extension. Nothing related to Fabric there!
I appreciate your help.
As part of the deployment of your business network, an associated Composer runtime is included that can parse model files, query file and acl files, it is also capable of executing your transaction processor functions. In 0.16.x this was achieved by including a JavaScript VM implementation using Go Chaincode to execute the Composer runtime (written in JavaScript) and the transaction processor functions. In Fabric 1.1, chaincode can be written natively as it now supports Node.js chaincode so with Composer beyond 0.16.x (currently 0.19.x at the time of writing) Composer utilizes this and all Go chaincode it used to contain was removed, along with the Javascript VM. It's the composer runtime that parses the model, query and acl files, and the transaction processor functions run natively inside the node.js fabric chaincode container. Nothing is ever compiled to Go.
The smart contract will be saved in different manner in fabric, as composer is just an abstraction over it. You need to search for the location where the chaincode is present inside the peer. There are some chaincode related commands which can help you in finding out where the chain code is installed. And to the client you can give the .bna file if you are using composer for the development because I am not sure whether the code will be easily readable at fabric level if you are using composer.

Creating orderer node in Hyperledger Fabric

I am new to Hyperledger Fabric and am starting a new project which is to transfer asset from one person to another. Here are the steps which I think I need to follow to achieve the completion of the project, do tell me if I am wrong or I missed something:
Create an orderer node.
Create a channel.
Create peers and endorser nodes.
Connect each peer and endorser node to channel.
Write chaincode and endorsing policies.
Create transaction to update ledger state.
If I am right, can someone help me with creation of orderer node, or provide me a link which helps. Also wanted to ask that orderer node creation is possible using node SDK.
In Hyperledger Fabric there are 3 types of nodes. Each node is a process running on some machine (perhaps in a container) and communicates with other nodes in the network.
The nodes are:
- Orderer node
- Peer node
- Client node that embeds a client SDK in some language/framework (node.js, golang, java).
You can't create a node on its own. Each node, is correlated with some organization and has its own certificates and private key.
You can take a look at https://github.com/hyperledger/fabric-samples/ (read the https://hyperledger-fabric.readthedocs.io/en/latest/getting_started.html to understand how) and this would allow you to grasp better the core concepts.
After that when you'll be more certain and more knowledgeable, you could also try to deploy your own setup of Fabric on multiple machines.
You can take a look at https://github.com/yacovm/fabricDeployment to how to do so.
There are two aspects to deploying Hyperledger Fabric... the operational aspects (deploying the containers that run the orderer, peer, ca, etc runtime components) and the transactional aspects (creating channels and issuing transaction proposals etc).
Suggest that you look into the tutorials provided. Specifically, I would start with "building your first network". This example gets into the details of how to deploy the network, create a channel and issue transactions.

Resources