curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustc --version
wget https://bitcoincore.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz
tar -xzf bitcoin-27.0-x86_64-linux-gnu.tar.gz
sudo mv bitcoin-27.0/bin/* /usr/local/bin/
bitcoind --version
- locate
bitcoin.confatBitcoinn/bitcoin-cli-rs/bitcoin-27.0/bitcoin.conf - replace the content of
bitcoin.congwith:Global options server=1 daemon=1 Options for mainnet [main] Options for testnet [test] Options for signet [signet] Options for regtest [regtest] rpcport=18443 rpcuser=<replace_with_user> rpcpassword=<replace_with_your_password>
- at
Bitcoinn/.env, populate it with the values below:
RPC_URL=http://127.0.0.1:18443
RPC_USER=<replace with preferred user>
RPC_PASSWORD=<replace_with_your password>
WALLET=wallet.dat
-
Create directory:
mkdir -p ~/.bitcoin -
run
cp /workspaces/codespaces-blank/Bitcoinn/bitcoin-cli-rs/bitcoin-27.0/bitcoin.conf \ ~/.bitcoin/bitcoin.confto make the copy (obtain the absolute path of your own bitcoin.conf) -
Verify the content matches the content of the first
bitcoin.confusing:cat ~/.bitcoin/bitcoin.conf
bitcoind -regtest -daemon
- Create a wallet using:
bitcoin-cli -regtest createwallet "wallet" - If it says wallet already exists, load it up using:
bitcoin-cli -regtest loadwallet "wallet"
-
Create your wallet address using:
bitcoin-cli -regtest getnewaddress -
Generate the number of blocks you want. In this case, we created 300:
bitcoin-cli -regtest generatetoaddress 300 < address_gotten_from_"bitcoin-cli -regtest getnewaddress">
cargo run -- balance
cargo run -- rpc getdifficulty
cargo run -- rpc getblockchaininfo
cargo run -- rpc getbestblockhash
cargo run -- rpc getblockcount
cargo run -- rpc getnetworkinfo
cargo run -- rpc getblockhash 200
cargo run -- rpc getblock <hash>
use cargo clean if the need be