-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from CounterpartyXCP/regtestnode
Add documentation for regtest node scripts
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 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. | ||
|
||
|
||
# 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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters