Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build VPC for Geth in Block chain

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to build a private network in Geth in the blockchain, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.

[Windows] step 1:

Create a directory tmpPrivate

Create a genesis.json file and write the following

{"config": {"chainId": 15, "homesteadBlock": 0, "eip155Block": 0, "eip158Block": 0}, "coinbase": "0x0000000000000000000000000000000000000000", "difficulty": "0x40000", "extraData": "", "gasLimit": "0xffffffff", "nonce": "0x0000000000000042", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000" "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": "0x00", "alloc": {} step 2:

CMD enters tmpPrivate, executes commands, and creates Genesis Block.

Geth-- datadir ". /" init genesis.json

At this point, you can notice that two new folders geth and keystore will be added under the current directory.

What is saved in geth is the data related to the block chain.

What is saved in keystore is the user information in the chain.

Step 3:

Create your own private chain

Geth-datadir ". /"-nodiscover console 2 > > geth.log

Console2 > > geth.log means to output part of the console to the file geth.log

Step 4:

Create users on your own private chain

Eth.accounts

The return value is [] because the private chain of Ethernet Fong is created, but there is no account.

Create a new user

Personal.newAccount ("123456")

"123456" is the user's password

You can create several

Step 5:

Start / stop (start digging)

Miner.start () miner.stop ()

Check the account

Eth.accountspersonal.listAccounts

View individual account balance

Eth.getBalance (eth.accounts [0])

Or:

Acc0=eth.accounts [0] eth.getBalance (acc0) after reading the above, do you have any further understanding of how to build a VPC in Geth in the blockchain? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report