current position:Home>Bitcoin series - using docker to build BTC private chain
Bitcoin series - using docker to build BTC private chain
2022-02-03 05:27:43 【Brick moving leader】
Reference resources : https://www.2cto.com/kf/201707/659271.html
adopt docker function BTC Private chain
start-up Docker.
$ service docker start
or
$ systemctl start docker
Download bitcoin test network (bitcoin-testnet) Of Docker Mirror image .
docker pull freewil/bitcoin-testnet-box
function Docker Mirror image .
$ docker run -t -i -p 19001:19001 -p 19011:19011 freewil/bitcoin-testnet-box
Get into Docker After operating environment , Enter the following command to start the bitcoin test network :
$ make start
View the status information of test network nodes ( Be careful : If you install a newer version bitcoind, Get into docker After environment , We need to arrive first. Makefile Internal modification getinfo command , Change to -getinfo)
$ make getinfo
Simulate the new generation 200 Block records ( At least you need to generate 100 Block , The account balance of the first wallet node will increase )
$ make generate BLOCKS=200
################# Transfer money to the test wallet address as an example 10 individual BTC##############
For the first time 2 A wallet generates an address
$ make address2
Echoed address 2N8nax4iYqNivqVosJE5pMZUHJus3N896YJ
Transfer accounts
$ make sendfrom1 ADDRESS=[ Generated address ] AMOUNT=10
[ for example ] make sendfrom1 ADDRESS=2N8nax4iYqNivqVosJE5pMZUHJus3N896YJ AMOUNT=10
The echo
bitcoin-cli -datadir=1 sendtoaddress 2N8nax4iYqNivqVosJE5pMZUHJus3N896YJ 10
9a768b7e1377444c8d32fb44d9583ac9cad7646dc5d5a2d83edcf48af8df4136
Simulate the new generation 10 Block records , So that the above transfer transaction can be effectively confirmed
$ make generate BLOCKS=10
##################################################
Stop bitcoin test network
$ make stop
close Docker
$ service docker stop
Run your own modified docker( Adaptation new edition bitcoind The order of )
$ systemctl start docker
$ docker run -t -i -p 19001:19001 -p 19011:19011 my/bitcoin-testnet-box
$ make start
$ make getinfo
$ make generate BLOCKS=10
$ make address1
$ make stop
rpc Your account and password are bitcoin.conf File configuration
Remember to save the modified image content before exiting
Seems to have to stop first bitcoin (docker Internal execution )
make stop
Then save the image , Get the container through the command id(docker External execution )
docker container ls
Save again
docker commit Containers ID New image name (docker External execution )
[ for example ] docker commit 5814f80288ac my/bitcoin-testnet-box
List all addresses of the whole wallet
bitcoin-cli -datadir=1 getaddressesbyaccount ""
List all addresses and balances of the whole wallet
bitcoin-cli -datadir=1 listaddressgroupings
Displays the total balance of all addresses currently managed by the wallet
bitcoin-cli -datadir=1 getbalance
List all transaction information
bitcoin-cli -datadir=1 listtransactions
View single transaction information
bitcoin-cli -datadir=1 gettransaction 980be3d6694e905679b45d568829cfd1b73387b920b3d6e302a6b78c699bbb07
View single raw data
bitcoin-cli -datadir=1 getrawtransaction 935fc327ed8d36d971ba3147c0b7aaba695a8ba312f471c9a96706d1bb3aaa2a
Decode the original data of the transaction
bitcoin-cli -datadir=1 decoderawtransaction The original data found in the previous article
** Query the private key of the address **
bitcoin-cli -datadir=1 dumpprivkey 2MvSvdJBGSZVfdMGYXFpnDofv3ADQBeXPq4
(4) adopt docker function Reference resources :https://www.2cto.com/kf/201707/659271.html
start-up Docker.
$ service docker start
or
$ systemctl start docker
Download bitcoin test network (bitcoin-testnet) Of Docker Mirror image .
docker pull freewil/bitcoin-testnet-box
function Docker Mirror image .
$ docker run -t -i -p 19001:19001 -p 19011:19011 freewil/bitcoin-testnet-box
Get into Docker After operating environment , Enter the following command to start the bitcoin test network :
$ make start
View the status information of test network nodes ( Be careful : If you install a newer version bitcoind, Get into docker After environment , We need to arrive first. Makefile Internal modification getinfo command , Change to -getinfo)
$ make getinfo
Simulate the new generation 200 Block records ( At least you need to generate 100 Block , The account balance of the first wallet node will increase )
$ make generate BLOCKS=200
################# Transfer money to the test wallet address as an example 10 individual BTC##############
For the first time 2 A wallet generates an address
$ make address2
Echoed address 2N8nax4iYqNivqVosJE5pMZUHJus3N896YJ
Transfer accounts
$ make sendfrom1 ADDRESS=[ Generated address ] AMOUNT=10
[ for example ] make sendfrom1 ADDRESS=2N8nax4iYqNivqVosJE5pMZUHJus3N896YJ AMOUNT=10
The echo
bitcoin-cli -datadir=1 sendtoaddress 2N8nax4iYqNivqVosJE5pMZUHJus3N896YJ 10
9a768b7e1377444c8d32fb44d9583ac9cad7646dc5d5a2d83edcf48af8df4136
Simulate the new generation 10 Block records , So that the above transfer transaction can be effectively confirmed
$ make generate BLOCKS=10
##################################################
Stop bitcoin test network
$ make stop
close Docker
$ service docker stop
copyright notice
author[Brick moving leader],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202030527407874.html
The sidebar is recommended
- A blockchain instance analysis based on POS consensus algorithm (upgraded version)
- three. JS imitates the blockchain to realize the interconnection of multiple small balls
- Look at what blockchain is. Don't be cheated again
- Basic meaning of blockchain
- A brief introduction to the basic concepts, principles, characteristics and application scenarios of blockchain
- Blockchain note 1: what is the significance of bitcoin?
- Entering the meta universe, where is the so-called opportunity?
- Blockchain game development and deployment
- Blockchain farm game development source code
- Intensive reading of MESARI cryptocurrency annual report (Part I)
guess what you like
-
Accessing blockchain data from scrypt smart contract (2)
-
A malicious kmspico installer can steal your cryptocurrency wallet
-
How should blockchain be applied in the logistics industry?
-
What does blockchain change mean
-
Cattle herding blockchain, blockchain technology changes production relations
-
5g private network + blockchain: building the "cornerstone of security and trust" of smart government
-
[blockchain Apocalypse: Nakamoto collection] II: working principle of bitcoin (Part 2)
-
[blockchain Apocalypse: Nakamoto collection] I: preface | working principle of bitcoin (Part I)
-
Circle and endaoment will create a usdc based disaster relief fund for communities affected by deadly tornadoes
-
HSBC Group and IBM successfully created multi ledger CBDC demonstration
Random recommended
- Bloomberg 2022 encryption Outlook: the United States may accept cryptocurrency next year
- Curtis sword (CSC), the first 3D chain game of the concept of meta universe, will be launched soon
- Defi Criticism: in addition to more speculation, it is also an amplifier of greed and fear
- 5g private network + blockchain: building the "cornerstone of security and trust" of smart government
- US media: another huge theft of cryptocurrency was exposed, and hackers stole nearly $200 million
- The chief economist of the International Monetary Fund stressed the "global policy demand" of crypto regulation
- Is NFT music an untapped opportunity?
- The 2nd edition of 1 inch price limit order agreement was officially released
- Decentralized Oracle adameral blockchain data interaction Middleware
- Coinbase releases the vision of metauniverse, or will become Facebook of the early Internet
- Aofex exchange was investigated by the police, and the cryptocurrency exchange retreated into the countdown
- Blockchain talent shortage, world chain job effectively improves the matching rate of people and posts
- DAPP Industry Report in 2021: daily living addresses exceeded 2.7 million, and NFT trading volume exceeded US $23 billion
- Happy bitcoin bear market day: three years have passed since BTC bottomed at $3100
- Teach you how to use Nansen to play NFT
- Win10 uses geth client to build Ethereum private chain
- "Balcony, blockchain and robot" modern automobile thinks about the future with art
- Mars weekly | NBA star Durant became the spokesperson of coinbase brand; Solana launched $150 million chain game fund
- First class position: in depth interpretation of decentralized trading platform Bancor
- The current situation of Dao: investigating Dao ecology from community construction, governance and world integration under the chain
- Technology weekly · why is Web3 related to blockchain
- Blockchain mainstream consensus mechanism
- Technical magic of blockchain
- Decentralized Oracle adameral blockchain data interaction Middleware
- Is it difficult to settle claims in hospital? Blockchain technology realizes "report upon hospitalization and compensation upon discharge"
- Implement the national standardization development outline and put the blockchain on a standardized path
- Understand pledge as service: opportunities and risks, current situation and future
- Talk about Web3 Decentralized work: will the Internet create human prosperity?
- Vitalik: how to improve the transaction anti censorship of the block proposer's scheme
- [Hackathon] BSV programming marathon champion plan to build a dynamic bitcoin network
- Research Report on Solana: practical applications, advantages and challenges
- A hundred flowers bloom in application, presenting the five pole pattern of North Zhejiang, Jiangsu, Shanghai and Guangdong - industrial application of China's blockchain industry development report in 2021
- Popular science article | can Ethereum and Boca use the same address? Moonbeam "unified account" helps you achieve
- Bloomberg 2022 encryption Outlook: the "fate" of bitcoin, Ethereum and encrypted dollar
- Sailian blockchain education provides block chain technology training for Weichai Power
- Sailian blockchain Education: does the school district blockchain have a future?
- Is the development of school district block chain promising?
- Sailian blockchain education was invited to give a training lecture on blockchain technology in Shandong science and engineering district
- School district block chain technology, what do you learn? Blockchain training institutions or self-study?
- What exactly does blockchain learning learn? Do you need to go to blockchain training institutions?