상세 컨텐츠

본문 제목

Ubuntu 20.04에 bitcoin-cli 설치후 계정 생성 및 월렛 생성 테스트하기 (테스트용)

Blockchain/Bitcoin

by Yongari 2023. 2. 4. 22:25

본문

 

 

 

1. Ubuntu 20.04에 bitcoin-cli를 설치하는 쉘 스크립트입니다. 

#!/bin/bash

sudo apt install git build-essential libtool autotools-dev autoconf automake pkg-config bsdmainutils python3 libssl-dev libssl-dev

# Install required dependencies
sudo apt install libevent-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev

# Install the BerkeleyDB from Ubuntu repositories:
sudo apt install libdb-dev libdb++-dev libsqlite3-dev

# Optional: upnpc
sudo apt install libminiupnpc-dev

# Optional ZMQ:
sudo apt install libzmq3-dev

# For GUI:
sudo apt install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

# For QR Code support
sudo apt install libqrencode-dev

# Install Bitcoin
# -----------------------------------------------------------------------------------------------------------
git clone https://github.com/bitcoin/bitcoin.git

# Move into project directory
cd bitcoin

# Config
# -----------------------------------------------------------------------------------------------------------
# Generate config script
./autogen.sh

# If debugging symbols not required, amend compile flags:
./configure --with-incompatible-bdb CXXFLAGS="-O2"

# ...lot's of checking...

# Make
# -----------------------------------------------------------------------------------------------------------
make

# Install - sudo is required to install binaries in /usr/local/bin
sudo make install

 

2. bitcoind regtest 모드로 데몬 띄우기

 

설치가 완료되면 다음 쉘 스크립트로 bitcoind -regtest 모드로 데몬을 띄워볼 수 있습니다.

start_bitcoin.sh 
#!/bin/bash

./bitcoind -regtest -daemon

 

 

3. bitcoin-cli regtest에서 address 만들기

cat create_address.sh
#!/bin/bash


bitcoin-cli -regtest -rpcwallet=yongari getnewaddress

 

4. bitcoin-cli regtest에서 wallet 만들기

cat create_wallet.sh 
bitcoin-cli -regtest createwallet "yongari"

 

5. bitcoin-cli를 이용해 50개의 비트코인을 보상으로 받기

101개를 만드는데 왜 50개인지는 다음 링크를 참고하시면됩니다. 링크

 

GitHub - BlockchainCommons/Learning-Bitcoin-from-the-Command-Line: A complete course for learning Bitcoin programming and usage

A complete course for learning Bitcoin programming and usage from the command - GitHub - BlockchainCommons/Learning-Bitcoin-from-the-Command-Line: A complete course for learning Bitcoin programming...

github.com

 

bitcoin-cli -regtest generatetoaddress 101 bcrt1qdy959zy9cy6u3xdjhc4wc0u2lpevq5vlm9f2kp
bitcoin-cli -regtest generatetoaddress 101 "위에서 생성한 계정의 address"

 

 

 

참고 : https://www.willianantunes.com/blog/2022/04/bitcoin-node-with-regtest-mode-using-docker/ 

 

Bitcoin Node with RegTest mode using Docker | An honest place where you can learn things about programming

Are you curious about Bitcoin but haven't started any study? Containerization makes it a lot easier. So let's see how we can create a private blockchain!

www.willianantunes.com

 

관련글 더보기