Preface
Blockchain development is really fast this year. From the first unfamiliar concept, to now has started in various industries, a spark of great prairie fire. I wish I could have my own blockchain practice practiced hand O (∩_∩) o~. But a person, a computer, how to set up the blockchain environment ... It's not easy to say you love a block chain of fire.
Don ' t worry! Small series have been addicted to blockchain and smart contracts can not extricate themselves. Now take your hands from scratch, 5 minutes to play your own blockchain.
The Supervessel platform developed by IBM China Research Institute provides blockchain enthusiasts, developers, and development test environment. The platform allows users to create multi-node blockchain based on Hyperledger fabric for free, ultra-fast, and fancy-play smart contracts on their own chains. preparatory work
Just need your local browser. Register an account
Access the public address of the hyper-cloud (Supervessel) Blockchain service HTTP://CRL.PTOPENLAB.COM:8800/BC
Click on the Log In button in the top right corner and click Register in the Pop-up window to submit the email and password. It is recommended to go to the mailbox to view the activation email, and activate their own account (small tip: Lazy activation is OK, only some advanced services must be activated to use OH).
quickly create your own blockchain
Once the registration is complete, go back to the homepage and click on the huge give me a BLOCKCHAIN (give me a blockchain.) button In the pop-up box, select the consensus Plugin (consensus plugin) and size (number of blockchain network nodes) you want.
Note: There are currently two common consensus plugins available from Hyperledger Fabric: Noops and pbft**.
After clicking Submit, a few seconds later you will be able to get your own blockchain and automatically enter the monitoring panel. Yes, it's so easy to get a blockchain that belongs to you.
After entering the monitor panel, we can see that the left side is the Intelligent Contract Management panel, including the management and deployment of the intelligent contract, the right side is the network panel, showing the application to the blockchain network situation, topology, the delay between nodes, etc. at a glance, click the telescope icon in the upper right corner, you can monitor the log information of each node At the bottom is the blockchain panel, which shows the overall situation of the current blockchain, with only one block in the initial state. deploy and use smart contracts
Next, a small compilation teaches you how to deploy and use smart contracts on your own blockchain.
2 Smart contracts are listed under smart Contracts (smart Contracts) tab of the Intelligent Contract Management panel as examples of maps and CHAINCODE_EXAMPLE02, respectively. Where the map contract can be used to store key value pairs (key-value), the CHAINCODE_EXAMPLE02 contract can simulate the transfer and query of two people.
Note: The code for these 2 example contracts can be found in the Hyperledger fabric source (https://github.com/hyperledger/fabric/tree/master/examples/ CHAINCODE/GO).
To deploy and use the CHAINCODE_EXAMPLE02 contract as an example: deploy a contract
Click the Deploy button for the CHAINCODE_EXAMPLE02 contract and fill in the initial value of the contract, including the contract name, initial function, and initial parameters. The initial function of the contract is INIT, the initial parameters are to be filled out in format, such as ["a", "three", "B", "200"] means to register two persons A and b, respectively, to their 100 units and 200 units.
Click the Deploy button and the contract will be deployed in your blockchain, which takes approximately 20-40 seconds. When a new chunk appears in the blockchain panel, it usually indicates that the contract has been deployed.
Call Contract
After the deployment is complete, view the deployed contract instances under the My Deployment (my Deployment) tab of the Smart Contract Management panel.
Click the Invoke button under action to invoke the smart contract, and fill in the method name and corresponding parameters of the call (the method name and parameter of the different contracts have different meanings, which are related to the contract content). For the contract, call the Invoke method name, fill in the parameters ["a", "B", "50"], and indicate a to B to 50 units.
After clicking Submit to complete the call, you can view the blockchain situation, and a new chunk will be generated.
Search Contract
After the call is complete, you can then query the result of the contract execution. Still under the My Deployment tab, click the Query button under action to inquire about the smart contract and fill in the query's method name and corresponding parameters. If you select the Query method name, fill in the parameter ["a"] to indicate the current unit of query A.
When you click Submit, you can see that the current unit of a is 50. You can try it again by checking B.
OK, next you can continue to work on the contract, observe the blockchain, or deploy a new smart contract on the blockchain, such as map. For ease of use, the method name and parameter format of the deployment, invocation, and query contracts are all filled in by default, and you just need to select a method name and tiger change the parameters. See how long you can play the chain- upload and test your own private intelligence contract
In addition to the two public smart contracts currently available, you can upload and test your own private contracts. Private contracts can only be seen by themselves.
Under the Smart Contracts tab, click Import Private Smart Contract.
Fill in the contract name and description, and upload the contract code file, click Import, complete the upload.
After that I uploaded the contract in the smart contracts list and can deploy, invoke, and query as before.
Interested developers may wish to learn about the contract examples in Hyperledger fabric source (https://github.com/hyperledger/fabric/tree/master/examples/ Chaincode/go), write and test your first smart contract on the platform. Http://www.aibbt.com/a/14934.html