From 256dde7e4d6ca8f28b0426dbe1976e15af3fee15 Mon Sep 17 00:00:00 2001 From: Derrick Schwabe Date: Sat, 12 Mar 2022 16:12:50 -0700 Subject: Documentation: fix steps for funding Bitcoin regtest wallet w/ bitcoin-cli v22 and latest coinos config; link to funding tutorial doc, remove some outdated/untested documentation --- README.md | 9 +++++--- doc/fund-server-bitcoin-cli.md | 48 ++++++++---------------------------------- 2 files changed, 15 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 632ac28e..1b3c832d 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,13 @@ and start it back up again with the same command from before: docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d ``` -And finally, generate some BTC to play with! +and finally, create a Bitcoin wallet: -```bash -docker exec -it bitcoin bitcoin-cli -datadir=config/ generatetoaddress 10 $(docker exec -it bitcoin bitcoin-cli -datadir=config/ getnewaddress "" "legacy") ``` +docker exec -it bitcoin bitcoin-cli -regtest -rpcuser=admin1 -rpcpassword=123 createwallet coinos +``` + +then [generate some BTC] to fund the server. For reviewing output, you may run `docker-compose logs` or run the docker-compose up command above but without the `-d `flag @@ -264,3 +266,4 @@ To purchase a commercial license or to inquire about customized, managed instanc [pwd file]:./sampleconfig/lnd/pwd [licensed]:./LICENSE.md [contact@coinos.io]:mailto:contact@coinos.io +[generate some BTC]:./doc/fund-server-bitcoin-cli.md \ No newline at end of file diff --git a/doc/fund-server-bitcoin-cli.md b/doc/fund-server-bitcoin-cli.md index 5b096f0f..093c537c 100644 --- a/doc/fund-server-bitcoin-cli.md +++ b/doc/fund-server-bitcoin-cli.md @@ -2,7 +2,6 @@ Bitcoin Regtest Mode allows us to create our own Bitcoin sandbox blockchain for use in testing & development. -In this demo/tutorial we will setup a regtest network along with wallet and some initial bitcoin. From the coinos-server dir on your localfilesystem (ie- after following the 'Getting Started' section of our [root README]) @@ -11,57 +10,28 @@ From the coinos-server dir on your localfilesystem (ie- after following the 'Get docker exec -it bitcoin bash # get an address -bitcoin-cli -regtest -datadir=/config -rpcwallet=coinosdev getnewaddress +bitcoin-cli -regtest -rpcuser=admin1 -rpcpassword=123 getnewaddress +> bcrt1qzneawwyxe0fts5p8a6tsp4gu2mfnqzs92235hm # (example) # mine a block to the new address -bitcoin-cli -regtest -datadir=/config generatetoaddress 101 theaddressgeneratedabove +bitcoin-cli -regtest -datadir=/config generatetoaddress 101 theaddressgeneratedabove -# verify you got the reward: -bitcoin-cli -regtest -datadir=/config -conf=./bitcoin.conf -rpcwallet=coinosdev getbalance +# verify you got the reward by doing: +bitcoin-cli -regtest -rpcuser=admin1 -rpcpassword=123 getbalance > 50.00000000 -# send 10 bitcoin to your account on the server -# get the address to send to from ./receive, select 'Bitcoin' -bitcoin-cli -regtest -datadir=/config -rpcwallet=coinosdev sendtoaddress [account-address] 10 +# send 10 bitcoin to a coinos wallet account you created +# (get the address to send to from ./receive, select 'Bitcoin') +bitcoin-cli -regtest -rpcuser=admin1 -rpcpassword=123 sendtoaddress [account-address] 10 # confirm the transaction # (do the mining command again) -bitcoin-cli -regtest -datadir=/config generatetoaddress 101 theaddressgeneratedabove +bitcoin-cli -regtest -rpcuser=admin1 -rpcpassword=123 generatetoaddress 101 theoriginaladdressgeneratedabove ``` ![](./img/50-bitcoin-server-balance.gif) -#### Start from scratch - -To purge any existing transactions you made and to recreate all wallets including the coinos wallet (coinosdev) do (assuming coinos-server is running): - -```bash -docker-compose down -sudo rm -rf config/bitcoin -sudo rm -rf config/lightning -sudo rm -rf config/liquid -cp -rf sampleconfig/bitcoin config -cp -rf sampleconfig/lightning config -cp -rf sampleconfig/liquid config -docker-compose up -# app may crash during re-initalization of blockchains so -# restart it again after a few moments if necessary: -docker-compose restart app -``` - - -#### Creating new (Bitcoin native) wallets - -Note the wallet 'coinosdev' is created apart of the initial docker build for our Coinos Bitcoin server. -To create a new wallet (ie- as an alternate or one for yourself) do: - -```bash -bitcoin-cli -regtest -datadir=/config -conf=./bitcoin.conf createwallet me -> # new wallet created in /config/regtest/wallets -``` -and then specify `-rpcwallet=me` (or wallet name of your choice) - #### further reading -- cgit v1.2.3