In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to build Quorum nodes". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Quorum is a licensed implementation of the Ethernet Square Alliance blockchain, which includes a branch version of GETH developed by financial giant JP Morgan, which enables private and fast transactions between nodes. Quorum has specially designed the private transactions between nodes to ensure privacy. It uses Raft and Istanbul algorithms to achieve consensus, and uses Tessara and Constellation to encrypt and share node data. In Quorum network, there is no need to pay for the transaction, and the verification of the transaction is completed by the voting consensus algorithm. Generally speaking, Quorum is similar to Ethernet Square, except that it pays more attention to the transaction privacy and controllability in the enterprise environment, so each node needs the key pair generated by Quorum network management.
The best way to learn about the Quorum blockchain is to run the official 7-node example. Although there are many ways to build seven nodes, I recommend using docker, because this should be the easiest way. Next I use Ubuntu 8.04 of Google Cloud. If you have ubuntu on your local machine or AWS, the same is true. Please make sure that docker and docker-compose are installed first.
1. Build nodes
Run the following command to build all seven nodes:
Git clone https://github.com/jpmorganchase/quorum-examples.gitcd quorum-examplesQUORUM_CONSENSUS=raft docker-compose up-d
By default, the Tessera transaction manager and Istanbul BTF consensus are used to build the Quorum network. Therefore, in order to modify the Raft consensus algorithm, we set the environment variable QUORUM_CONSENSUS=raft, and then start the background operation of 7 nodes.
You can run docker ps to see the running status of each container and its ID. It will take a while for the container to start up.
2. Deploy smart contracts
If you want to quickly grasp the development of block chain in Taifang, Huizhi.com 's online interactive course is recommended:
Java ethernet development detail | python ethernet development detail | php ethernet development detail | C# ethernet development detail
Introduction to etherfang intelligent contract and DApp development | etherfang e-commerce DApp actual combat | ERC721 etherfang pass actual combat
To deploy a smart contract on a node, we need to run the following command to enter the geth console of that node:
Docker exec-it quorum-examples_node1_1 geth attach / qdata/dd/geth.ipc
The quorum-examples_node1_1 in the command is the container ID for Node 1. The above command enters the geth console of Node 1, and we can now operate in the console.
Next we will run the javascript script for the deployment contract. If you look at the sample code directory, you can see that there are private-contract.js and simplestorage.sol files in the quorum-examples/examples/7nodes directory. Run on the geth console:
> loadScript ('/ examples/private-contract.js')
It will take a while for the command to be executed. Once the deployment is successful, the above command will be returned to the contract address, remember to copy it down or copy it on paper. The above script deploys a simple storage contract with a status value of 42 on node 1, and the transaction is private between node 1 and node 7, which means that other nodes will not see this status value.
To verify this, we can open the geth terminal on node 2 and create a contract instance using ABI and the contract address:
> var abi=; > var address= "; > var contract=eth.contract (abi) .at (address); > contract.get () / / calling get () method0
Sure enough.
Now enter the geth terminal of node 7, also create a contract instance using ABI and the contract address, and then try to read the status value:
> contract.get () 42
As expected.
3. Send private transactions
Now let's try to create a new private transaction between node 7 and other optional nodes, calling the contract's set () method to modify the state value. This requires the use of the node's public key, which can be found in the quorum-examples/examples/7nodes/keys/ directory for all seven nodes.
Contract.set (4, {from:eth.coinbase,privateFor: ["]})
The above script sets the contract status value to 4 and remains visible only to the specified node. You can open the geth terminal of these specified nodes to view the contract status value, and what you should see is 4.
This is the end of "how to build Quorum nodes". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.