Super ledger fabric Blockchain with pinball game marbles deployment

Source: Internet
Author: User
Tags json git clone hyperledger fabric
Marbles Demo Marbles GitHub Address about MarblesThe underlying network for this application is Hyperledger Fabric, which is a Linux foundation project. You may want to check out the following instructions to learn a little bit about Hyperledger Fabric. This presentation is designed to help developers understand the fundamentals of chained code and how to develop applications using the Fabric network.

This is a very simple asset transfer demo. Multiple users can create and transfer marbles to each other.

Marbles-Branch v4.0 (Latest)(you will see this branch.) Compatible with Hyperledger Fabric v1.0.1, v1.0.0, and V1.0.0-RC1 compatible IBM Blockchain Bluemix Services- IBM Blockchain platform-enterprise Plan
Application Background

Please focus, this application will demonstrate how to use Hyperledger Fabric to transfer marbles between many marbles owners.
We will use some Golang code in node. JS to complete this task.
The back end of the application will be the Golang code that runs in our blockchain network.
From now on, these Golang codes will be called ' chain codes ' or ' CC '.
The chain code itself creates a marble that stores it in the chain code state.
The chain code itself can store the data as a string in a key/value pair setting.
Therefore, we will string the JSON object in order to store more complex structures.

The properties of the Marbles include: ID (unique string, which will be used as the key) color (string, CSS color name) size (int, in millimeters) owner (string)

We will create a WEB-based user interface that can set these values and store them in a blockchain.
The marbles are created in the form of a key-value pair in a blockchain store (also known as a ledger).
The key is the pinball ID, and the value is a JSON string containing the pinball properties (listed above).
The interaction with CC is accomplished by using the GRPC protocol on a node in the network.
The details of the GRPC protocol are handled by an SDK called the Hyperledger Fabric Client SDK.
See the following figure for topology details. Application Communication Flow

The administrator will interact with our node. js application marbles in their browser. This client JS code will open a Websocket connection to the back-end node. JS application. When an administrator interacts with the site, client JS sends the message to the backend. Reading or writing a ledger is called a proposal. The proposal was built by marbles (via the SDK) and then sent to a blockchain node. The node communicates with its marbles chain code container. The chain code will run/simulate the transaction. If there is no problem, it will endorse the transaction and send it back to our marbles program. Marbles (via the SDK) then sends the endorsed proposal to the subscription service. The Subscriber packs many proposals from the entire network into one block. It then broadcasts the new chunks to the nodes in the network. Finally, the node validates the chunk and writes it to its own ledger. The transaction is now in effect and all subsequent reads will reflect this change.

1. Chain Code section-This is the Golang code that runs on the Blockchain network/contains nodes. Also known as CC. All the marbles/blockchain interactions will eventually be done here. These files are located in/chaincode.
1. Client JS section-this is the JavaScript code that runs in the user's browser. The user interface interaction is performed here. These files are located in/public/js.
1. Server-side JS section-This is the JavaScript code that runs the backend of the application, that is, the node. JS code for the Marbles core. Sometimes the code is also called our node or server code. It acts as a connector between the Marbles administrator and our blockchain. These files are located in/utils and/routes. Marbles Setup (prerequisite npm Install execution no problem v*p*n) 0. Setting up the local environment

Installing the fabric environment requires configuration 1. Download Marbles

    git clone https://github.com/IBM-Blockchain/marbles.git 
    cd marbles
    git Checkout v4.0
2. Start the Fabric network

Version: Hyperledger Fabric v1.0.0
Fabric-samples

CD Fabric-samples/fabcar
./startfabric.sh
node invoke.js
node Query.js

3. Install and instantiate the Marbles chain code

NPM Install
cd/scripts
/build_marbles_image.sh
node install_chaincode.js
node Instantiate_ Chaincode.js

You may experience the following issues when you instantiate a chain code

Error:cannot Find module ' fabric-client/lib/peer.js '

Export node_path=/root/node_modules
git clone https://github.com/hyperledger/fabric-sdk-node.git
cp-r ~/ fabric-sdk-node/fabric-client/root/node_modules/
4. Start Marbles
NPM Install gulp-g
npm install
Gulp marbles_local

using marbles

Access http://ip:3001 after startup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.