The goal of these helper scripts is to set up a bisq DAO from scratch. The scripts run `bitcoind` in regtest mode for you and a `seed node`, `alice` and `bob` instances.
We assume the user is in the `autosetup-regtest-dao` directory. It is ok to move the directory, but please move it as a whole. Also `bitcoin-qt`, `bitcoin-cli`, `bitcoin-tx`, `jq` and `bc` has to be installed on the system. Do not change the shipped `bitcoin.conf` file as it will break things.
## Steps to spin up a fresh DAO (we assume the user is in the autosetup-regtest-dao directory):
1. Set up `bitcoin-qt` to run in the `autosetup-regtest-dao` directory, it detects when the `bitcoin-qt` instance comes up and once it is ready the script queries the number of blocks. If there are less then 101 blocks (fresh start) the script generates 101 blocks for you so you have an available input that will be later used for the genesis tx creation.
```
./start_bitcoind.sh
```
Example output (note the below errors are normal and can be ignored):
2. Open a new terminal (preferably a new tab), go to the `bisq` folder and start the `create_genesis.sh` script. The script tests for a running bitcoind node in regtest, so make sure step 1 was successful.
3. We need the BSQ address of `Alice`. Go to the `bisq` directory and start the `Alice` instance. Wait until the instance starts up then go to `DAO -> Receive` and copy the BSQ address. Note the address starts with a `B`. Open a new terminal and enter the commands below to start `Alice`. Then wait for the gui to start and paste the BSQ address to `create_genesis.sh` which is still running from step 2.
5. We need the BSQ address of `Bob`. Go to the `bisq` directory and start the `Bob` instance. Wait until the instance starts up then go to `DAO -> Receive` and copy the BSQ address. Note the address starts with a `B`. Open a new terminal and enter the commands below to start `Bob`. Then wait for the gui to start and paste the BSQ address to `create_genesis.sh` which is still running from step 2.
testing if bitcoind is running: bitcoind is running, all is ok!
Please provide Alice's BSQ Address
Bn2iUHwJQTreQaoajKwnT6h7pYF9nCWULJA
How much BTC to turn to BSQ for Alice? (sum must be 2.5BTC)
1
Alice will receive 1000000.00 BSQ to Bn2iUHwJQTreQaoajKwnT6h7pYF9nCWULJA
Please provide Bob's BSQ Address
BmoccyQEENPwxeZUdPAnDejEeTzykD9Kdbo
How much BTC to turn to BSQ for Bob? (sum must be 2.5BTC)
1.5
Bob will receive 1500000.00 BSQ to BmoccyQEENPwxeZUdPAnDejEeTzykD9Kdbo
got address 2MwNUS6czZZ8tFeFArujf1AghFZUfcJmgRx
sending 2.5001 BTC to 2MwNUS6czZZ8tFeFArujf1AghFZUfcJmgRx
txid is: d8c9d0caaaa69ad26e3dbe2176cd7fd48a4509b96cd902982fbc9811211cf20e
creating genesis tx for you
The raw genesis tx is: 020000000001010ef21c211198bc2f9802d96cb909458ad47fcd7621be3d6ed29aa6aacad0c9d80000000017160014d3316afa653bb7ca1f7bfd2395c373c979fd14ddffffffff0200e1f505000000001976a914e8884212730dd91d620b92d2e95245baf776d78b88ac80d1f008000000001976a91458d35f88e65ded63cb22a25ffda6f83a0209822b88ac0247304402204395a123c499f05bdc9b458459d97df1910feb9a43d66b7ca7e28a91c6cf19a702203ddb3fb891442bb76a2a8e267b4fec99c8a40064461556a03a799e787d08334f01210397ff7d1aa76f2fb241b0354332bb1e9be0520e744a8a2a7e5e088a92a7c09dd200000000
Press enter to broadcast transaction, ctrl+c otherwise
```
7. verify if the tx shown as json is ok (the sum of outputs must be 2.5 to be valid). Note the script does not check the sum of the outputs as one needs to create an invalid genesis tx as well to test things. Press `enter` if tx looks ok.
8. Once confirmed the script will broadcast the genesis tx to the regtest blockchain and setup the `config.sh` file in the `bisq` directory which is used by the `seed_node`, `alice` and `bob` scripts. It populates the genesis txid and genesis block height so the instances can be launched accordingly.
Example output:
```
... <outputommited-seestepabove>
Press enter to broadcast transaction, ctrl+c otherwise
10. Restart `Alice` and `Bob` you should see BSQ visible on the `DAO` page. Note the `seed node` is a full node and `alice`/`bob` are lite nodes in this setup.
1. Run `clean.sh`. It will clear the bitcoind files and bisq files from `~/.local/share/` directory. Make sure your `bitcoind/bitcoin-qt` is stopped before running.