0
votes

I am beginner to blockchain. We are using AWS Managed Blockchain hyperledger for one of our projects. How to write and read data to peer nodes (Blockchain)?

Is there any way to do this directly via API or SDKs OR Should I need create chaincode to achieve?

Any reference documents or samples will help me a lot.

2

2 Answers

2
votes

After a couple of weeks of study on Amazon managed blockchain, I have realized that we need chaincode to read and write data to hyperledger fabric blockchain.

Chaincode is a program developed in Node, Java or Go languages that will run on peer node in a Docker container. So chaincode implements the business logic of how applications interact with the ledger.

Currently, Amazon managed blockchain supports Hyperledger fabric framework and Ethereum is coming soon.

But if you want to use the Ethereum based blockchain service, Azure there for you. Azure Blockchain Service supports Ethereum. Hyperledger is yet to come.

Note: The term “chaincode” is equivalent to a “smart contract” for Ethereum.

The good news with azure blockchain service is that you can use Azure Blockchain Development Kit for Ethereum VS Code extension to attach to a consortium, create, connect, build, and deploy smart contracts on Ethereum blockchain ledgers.

Coming to Amazon managed blockchain, follow below steps to Create a Hyperledger Fabric Blockchain Network, Install, Instantiate, Invoke, Query the chaincode, etc.

https://docs.aws.amazon.com/managed-blockchain/latest/managementguide/managed-blockchain-get-started-tutorial.html

Once you are done with the above steps, you can develop a REST API using Hyperleder fabric client SDK for Node.js to access your chaincode methods.

Below is the complete solution for amazon managed blockchain available in Github.

https://github.com/aws-samples/non-profit-blockchain

1
votes

Chaincode defines the logic for reading writing data from bloclchain. Chaincode is installed on peers from each participating org. One or more peer from each org executes the chaincode transaction to ensure its valid(in form of endorsement) before committing it to ledger. Your client application interacts with chaincode installed on a peer.

To understand this in detail use this as your starting point: https://www.educative.io/courses/hands-on-blockchain-hyperledger-fabric