From 1a2b7db9827568a920a514faf4345e19e248fa31 Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Mon, 16 Sep 2024 14:47:18 +0200 Subject: [PATCH 1/2] Add documentation for regtest node scripts --- docs/advanced/how-to/regtest-node.md | 65 ++++++++++++++++++++++++++++ sidebars.js | 1 + 2 files changed, 66 insertions(+) create mode 100644 docs/advanced/how-to/regtest-node.md diff --git a/docs/advanced/how-to/regtest-node.md b/docs/advanced/how-to/regtest-node.md new file mode 100644 index 0000000..002b89d --- /dev/null +++ b/docs/advanced/how-to/regtest-node.md @@ -0,0 +1,65 @@ +# Test Counterparty Server on Regtest network + +# Prerequisites + +You must have the following three applications installed and available in the $PATH: + +* Bitcoin Core +* Addrindexrs +* Counteparty Server + +You can follow the instructions here [https://docs.counterparty.io/docs/basics/manual-installation/](https://docs.counterparty.io/docs/basics/manual-installation/) to install them. + + +# Start the regtest node + +## Method 1 + +Use the `regtestnode.py` script: + +``` +$ python3 counterpartcore/test/regtest/regtestnode.py +``` + +This script does the following: + +* Starts Bitcoin Core and Addrindexrs +* Generates 10 addresses containing BTC +* Starts Counterparty Server +* Uses the generated addresses to burn BTC and obtain XCP. + +Once finished you have a node ready to use. You can check with: + +``` +$ curl [http://localhost:24000/v2/](http://localhost:24000/v2/) +$ bitcoin-cli -regtest -rpcuser rpc -rpcpassword rpc -getinfo +``` + + +## Method 2 + +If you need a server containing sample data you can use: + +``` +$ python3 counterpartcore/test/regtest/testscenarios.py serve +``` + +This script performs the same operations as `regtestnode.py` but also executes all scenario transactions found in `counterpartcore/test/regtest/scenarios`. + +# Interact with the regtest node + +You can use `curl` and `bitcoin-cli` or the `tools/xcpcli.py` tool. +This tool is very easy to use and the help contains complete documentation for each command. It allows: + +* To query the API +* to compose, sign and send a transaction across the network in a single command. + +Examples: + +``` +$ python3 tools/xcpcli.py -h +$ python3 tools/xcpcli.py get_asset_balances -h +$ python3 tools/xcpcli.py get_asset_balances --asset XCP +$ python3 tools/xcpcli.py send_send -h +$ python3 tools/xcpcli.py send_send --address bcrt1qusq9znaxgfn8klvw77np3tchv2g0djzf6v3zfn --asset XCP --destination mjts5dr3JwF7U5MMNWkG8dYffEAXEhayFn --quantity 10 +``` diff --git a/sidebars.js b/sidebars.js index f9af1e8..0ab2b1a 100644 --- a/sidebars.js +++ b/sidebars.js @@ -58,6 +58,7 @@ 'advanced/how-to/docker-kickstart', 'advanced/how-to/sentry-integration', 'advanced/how-to/atomic-swap', + 'advanced/how-to/regtest-node', ], }, { From 80dd4395fe7598b3050aaf4600e58567e972c613 Mon Sep 17 00:00:00 2001 From: Ouziel Slama Date: Mon, 16 Sep 2024 19:30:47 +0200 Subject: [PATCH 2/2] tweak --- docs/advanced/how-to/regtest-node.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/advanced/how-to/regtest-node.md b/docs/advanced/how-to/regtest-node.md index 002b89d..581e110 100644 --- a/docs/advanced/how-to/regtest-node.md +++ b/docs/advanced/how-to/regtest-node.md @@ -6,7 +6,7 @@ You must have the following three applications installed and available in the $P * Bitcoin Core * Addrindexrs -* Counteparty Server +* Counteparty Core You can follow the instructions here [https://docs.counterparty.io/docs/basics/manual-installation/](https://docs.counterparty.io/docs/basics/manual-installation/) to install them. @@ -25,7 +25,7 @@ This script does the following: * Starts Bitcoin Core and Addrindexrs * Generates 10 addresses containing BTC -* Starts Counterparty Server +* Starts `counterparty-server` * Uses the generated addresses to burn BTC and obtain XCP. Once finished you have a node ready to use. You can check with: