Update for bticoind v23 + IDE format

This commit is contained in:
ghubstan 2023-02-13 19:09:01 -03:00
parent b4822761a8
commit f69fb3a959
No known key found for this signature in database
GPG Key ID: 46F220FBD5637C5D

View File

@ -17,9 +17,9 @@ option adjustments to compensate.
**Shell**: Bash
**Java SDK**: Version 11 - 15 (src and class generation version 11)
**Java SDK**: Version 11 - 16 (src and class generation version 11)
**Bitcoin-Core**: Version 0.19 - 22
**Bitcoin-Core**: Version 0.19 - 23
**Git Client**
@ -29,12 +29,14 @@ Beta testing can be done with no knowledge of how git works, but you need a git
Clone the Bisq master branch into a project folder of your choice. In this document, the root project folder is
called `api-beta-test`.
```
$ git clone https://github.com/bisq-network/bisq.git api-beta-test
```
Change your current working directory to `api-beta-test`, build the source, and download / install Bisqs
pre-configured DAO / dev / regtest setup files.
```
$ cd api-beta-test
$ ./gradlew clean build :apitest:installDaoSetup -x test # if you want to skip Bisq tests
@ -53,6 +55,7 @@ sure your GUI is shut down, and vice-versa. Please back up your mainnet wallet
If your bitcoin-core binaries are in your system `PATH`, start bitcoind in regtest-mode, Bisq seednode and arbitration
node daemons, plus Bob & Alice daemons in a bash terminal with the following bash command:
```
$ ./bisq-apitest --apiPassword=xyz \
--supportingApps=bitcoind,seednode,arbdaemon,alicedaemon,bobdaemon \
@ -61,6 +64,7 @@ $ ./bisq-apitest --apiPassword=xyz \
If your bitcoin-core binaries are not in your system `PATH`, you can specify the bitcoin-core bin directory with the
`-bitcoinPath=<path>` option:
```
$ ./bisq-apitest --apiPassword=xyz \
--supportingApps=bitcoind,seednode,arbdaemon,alicedaemon,bobdaemon \
@ -70,6 +74,7 @@ $ ./bisq-apitest --apiPassword=xyz \
If your bitcoin-core binaries are not statically linked to your BerkleyDB library, you can specify the path to it
with the `-berkeleyDbLibPath=<path>` option:
```
$ ./bisq-apitest --apiPassword=xyz \
--supportingApps=bitcoind,seednode,arbdaemon,alicedaemon,bobdaemon \
@ -82,6 +87,7 @@ Alternatively, you can specify any or all of these bisq-apitest options in a pro
`apitest/src/main/resources/apitest.properties`.
In this example, a beta tester uses the `apitest.properties` below, instead of `bisq-cli` options.
```
supportingApps=bitcoind,seednode,arbdaemon,alicedaemon,bobdaemon
apiPassword=xyz
@ -90,12 +96,14 @@ bitcoinPath=/home/beta-tester/path-to-my-bitcoin-core/bin
```
Start up the test harness with without command options:
```
$ ./bisq-apitest
```
If you edit `apitest.properties`, do not forget to re-build the source. You do not need to do a full clean and
build, or run tests. The following build command should finish quickly.
```
$ ./gradlew build :apitest:installDaoSetup -x test
```
@ -125,6 +133,7 @@ accounts for Bob and Alice, create an offer, take the offer, and complete a trad
follow in real time, so let the script complete before studying the output from start to finish.
The script takes four options:
```
-d=<direction> The trade direciton, BUY or SELL.
-c=<country> The two letter country code, US, FR, AT, RU, etc.
@ -140,12 +149,14 @@ This simulation creates US / USD face-to-face payment accounts for Bob and Alice
creates a SELL / USD offer for the amount of 0.1 BTC, at a price 2% below the current market price.
Bob (always the taker), will use his face-to-face account to take the offer, then the two sides will complete
the trade, checking their trade status along the way, and their BSQ / BTC balances when the trade is closed.
```
$ apitest/scripts/trade-simulation.sh -d sell -c us -m 2.00 -a 0.1
```
In the next example, Bob and Alice create Austrian face-to-face payment accounts. Alice creates a BUY/ EUR
offer to buy 0.125 BTC at a fixed price of 30,800 EUR.
```
$ apitest/scripts/trade-simulation.sh -d buy -c at -f 30800 -a 0.125
```
@ -165,16 +176,19 @@ used in the CLI commands, so you know which server (Bobs or Alices) the CL
Useful information can be found using the CLIs `--help` option.
For list of supported CLI commands:
```
$ ./bisq-cli --help (the password option is not needed because there is no server request)
```
For help with a specific CLI command:
```
$ ./bisq-cli --password=xyz --help getbalance
OR
$ ./bisq-cli --password=xyz getbalance --help
```
The position of `--help` option does not matter. If a supported positional command option is present,
method help will be returned from the server. Also note an api password is required to get help from the server.
@ -186,23 +200,28 @@ real BTC. This section explains how to encrypt your Bisq wallet with the CLI, a
related operations such as creating and taking offers, checking balances, and sending BSQ and BTC to external wallets.
Encrypt your wallet with a password:
```
$ ./bisq-cli --password=xyz setwalletpassword --wallet-password=<wallet-password>
```
Set a new password on your already encrypted wallet:
```
$ ./bisq-cli --password=xyz setwalletpassword --wallet-password=<wallet-password> \
--new-wallet-password=<new-wallet-password>
```
Unlock your password encrypted wallet for N seconds before performing sensitive wallet operations:
```
$ ./bisq-cli --password=xyz unlockwallet --wallet-password=<wallet-password> --timeout=<seconds>
```
You can override a `timeout` before it expires by calling `unlockwallet` again.
Lock your wallet before the `unlockwallet` timeout expires:
```
$ ./bisq-cli --password=xyz lockwallet
```
@ -210,17 +229,21 @@ $ ./bisq-cli --password=xyz lockwallet
### Checking Balances
Show full BSQ and BTC wallet balance information:
```
$ ./bisq-cli --password=xyz --port=9998 getbalance
```
Show full BSQ wallet balance information:
```
$ ./bisq-cli --password=xyz --port=9999 getbalance --currency-code=bsq
```
_Note: The example above is asking for Bobs balance (using port `9999`), not Alices balance._
Show Bobs full BTC wallet balance information:
```
$ ./bisq-cli --password=xyz --port=9999 getbalance --currency-code=btc
```
@ -230,16 +253,21 @@ $ ./bisq-cli --password=xyz --port=9999 getbalance --currency-code=btc
#### Receiving BTC
To receive BTC from an external wallet, find an unused BTC address (with a zero balance) to receive the BTC.
```
$ ./bisq-cli --password=xyz --port=9998 getfundingaddresses
```
You can check a block explorer for the status of a transaction, or you can check your Bisq BTC wallet address directly:
```
$ ./bisq-cli --password=xyz --port=9998 getaddressbalance --address=<btc-address>
```
#### Receiving BSQ
To receive BSQ from an external wallet, find an unused BSQ address:
```
$ ./bisq-cli --password=xyz --port=9998 getunusedbsqaddress
```
@ -247,6 +275,7 @@ $ ./bisq-cli --password=xyz --port=9998 getunusedbsqaddress
Give the public address to the sender. After the BSQ is sent, you can check block explorers for the status of
the transaction. There is no support (yet) to check the balance of an individual BSQ address in your wallet,
but you can check your BSQ wallets balance to determine if the new funds have arrived:
```
$ ./bisq-cli --password=xyz --port=9999 getbalance --currency-code=bsq
```
@ -256,21 +285,27 @@ $ ./bisq-cli --password=xyz --port=9999 getbalance --currency-code=bsq
Below are commands for sending BSQ and BTC to external wallets.
Send BSQ:
```
$ ./bisq-cli --password=xyz --port=9998 sendbsq --address=<bsq-address> --amount=<bsq-amount>
```
_Note: Sending BSQ to non-Bisq wallets is not supported and highly discouraged._
Send BSQ with a withdrawal transaction fee of 10 sats/byte:
```
$ ./bisq-cli --password=xyz --port=9998 sendbsq --address=<bsq-address> --amount=<bsq-amount> --tx-fee-rate=10
```
Send BTC:
```
$ ./bisq-cli --password=xyz --port=9998 sendbtc --address=<btc-address> --amount=<btc-amount>
```
Send BTC with a withdrawal transaction fee of 20 sats/byte:
```
$ ./bisq-cli --password=xyz --port=9998 sendbtc --address=<btc-address> --amount=<btc-amount> --tx-fee-rate=20
```
@ -288,17 +323,23 @@ setting for the execution of those commands.
If you have not set your custom withdrawal transaction fee setting, the default network transaction fee will be used
when withdrawing funds. In either case, you can check the current (default or custom) withdrawal transaction fee rate:
```
$ ./bisq-cli --password=xyz gettxfeerate
```
#### Setting Custom Transaction Fee Preference
To set a custom withdrawal transaction fee rate preference of 50 sats/byte:
```
$ ./bisq-cli --password=xyz settxfeerate --tx-fee-rate=50
```
#### Removing Users Custom Transaction Fee Preference
To remove a custom withdrawal transaction fee rate preference, and revert to the network fee rate:
```
$ ./bisq-cli --password=xyz unsettxfeerate
```
@ -346,13 +387,16 @@ Unlike more complex fiat payment account setups, the `createcryptopaymentacct` c
A default BSQ Swap Altcoin payment account was created for you when the BSQ Swap protocol was introduced, and you do
not need to create BSQ Altcoin payment accounts to execute BSQ Swaps. But if you do want to trade BSQ using the
version 1 trade protocol, you will need to create a BSQ Altcoin payment accounts as show below.
```
$ ./bisq-cli --password=xyz --port=9998 createcryptopaymentacct --account-name="My BSQ Account" \
--currency-code=BSQ \
--address=Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne \
--trade-instant=false
```
To create a BSQ Altcoin _Instant_ payment account, use the `--trade-instant=true` parameter:
```
$ ./bisq-cli --password=xyz --port=9998 createcryptopaymentacct --account-name="My Instant BSQ Account" \
--currency-code=BSQ \
@ -367,17 +411,18 @@ example above._
To create an XMR Altcoin payment account associated with example XMR address
`44G4jWmSvTEfifSUZzTDnJVLPvYATmq9XhhtDqUof1BGCLceG82EQsVYG9Q9GN4bJcjbAJEc1JD1m5G7iK4UPZqACubV4Mq`:
```
$ ./bisq-cli --password=xyz --port=9999 createcryptopaymentacct --account-name=XMR-Account \
--currency-code=XMR
--address=44G4jWmSvTEfifSUZzTDnJVLPvYATmq9XhhtDqUof1BGCLceG82EQsVYG9Q9GN4bJcjbAJEc1JD1m5G7iK4UPZqACubV4Mq
```
### Creating Offers
The createoffer command is the API's most complex command (so far), but CLI posix-style options are self-explanatory,
and CLI `createoffer` command help gives you specific information about each option.
```
$ ./bisq-cli --password=xyz --port=9998 createoffer --help
```
@ -388,6 +433,7 @@ The `trade-simulation.sh` script described above is an easy way to figure out ho
In a previous example, Alice created a BUY/ EUR offer to buy 0.125 BTC at a fixed price of 30,800 EUR,
and pay the Bisq maker fee in BSQ. Alice had already created an EUR face-to-face payment account with id
`f3c1ec8b-9761-458d-b13d-9039c6892413`, and used this `createoffer` command:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
@ -401,6 +447,7 @@ $ ./bisq-cli --password=xyz --port=9998 createoffer \
If Alice was in Japan, and wanted to create an offer to sell 0.125 BTC at 0.5% above the current market JPY price,
putting up a 15% security deposit, the `createoffer` command to do that would be:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
@ -413,12 +460,14 @@ $ ./bisq-cli --password=xyz --port=9998 createoffer \
```
The `trade-simulation.sh` script options that would generate the previous `createoffer` example is:
```
$ apitest/scripts/trade-simulation.sh -d sell -c jp -m 0.5 -a 0.125
```
The `createoffer` command can also be used to create BSQ swap offers, where trade execution is performed immediately
after a BSQ swap offer is taken. To swap 0.5 BTC for BSQ at a price of 0.00005 BTC for 1 BSQ:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--swap=true \
@ -429,6 +478,7 @@ $ ./bisq-cli --password=xyz --port=9998 createoffer \
```
The `bsqswap-simulation.sh` script options that would generate the previous `createoffer` example is:
```
$ apitest/scripts/bsqswap-simulation.sh -d buy -a 0.5 -f 0.00005
```
@ -438,11 +488,13 @@ $ apitest/scripts/bsqswap-simulation.sh -d buy -a 0.5 -f 0.00005
There are different commands to browse available offers you can take, and offers you created.
To see all offers you created with a specific direction (BUY|SELL) and currency (CAD|EUR|USD|...):
```
$ ./bisq-cli --password=xyz --port=9998 getmyoffers --direction=<BUY|SELL> --currency-code=<currency-code>
```
To look at a specific offer you created:
```
$ ./bisq-cli --password=xyz --port=9998 getoffer --offer-id=<offer-id>
```
@ -450,11 +502,13 @@ $ ./bisq-cli --password=xyz --port=9998 getoffer --offer-id=<offer-id>
### Browsing Available Offers
To see all available offers you can take, with a specific direction (BUY|SELL) and currency (CAD|EUR|USD|...):
```
$ ./bisq-cli --password=xyz --port=9998 getoffers --direction=<BUY|SELL> --currency-code=<currency-code>
```
To look at a specific, available offer you could take:
```
$ ./bisq-cli --password=xyz --port=9998 getoffer --offer-id=<offer-id>
```
@ -462,9 +516,11 @@ $ ./bisq-cli --password=xyz --port=9998 getoffer --offer-id=<offer-id>
### Removing An Offer
To cancel one of your offers:
```
$ ./bisq-cli --password=xyz --port=9998 canceloffer --offer-id=<offer-id>
```
The offer will be removed from other Bisq users' offer views, and paid transaction fees will be forfeited.
### Editing an Existing Offer
@ -490,6 +546,7 @@ The subsections below contain examples related to specific use cases.
Existing offers you create can be disabled (removed from offer book) and re-enabled (re-published to offer book).
To disable an offer:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
@ -497,6 +554,7 @@ To disable an offer:
```
To enable an offer:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
@ -504,11 +562,14 @@ To enable an offer:
```
#### Change Offer Pricing Model
The `editoffer` command can be used to change an existing market price margin based offer to a fixed price offer,
and vice-versa.
##### Change Market Price Margin Based to Fixed Price Offer
Suppose you used `createoffer` to create a market price margin based offer as follows:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
@ -519,7 +580,9 @@ $ ./bisq-cli --password=xyz --port=9998 createoffer \
--security-deposit=15.0 \
--fee-currency=BSQ
```
To change the market price margin based offer to a fixed price offer:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
@ -527,7 +590,9 @@ To change the market price margin based offer to a fixed price offer:
```
##### Change Fixed Price Offer to Market Price Margin Based Offer
Suppose you used `createoffer` to create a fixed price offer as follows:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
@ -538,12 +603,15 @@ $ ./bisq-cli --password=xyz --port=9998 createoffer \
--security-deposit=15.0 \
--fee-currency=BSQ
```
To change the fixed price offer to a market price margin based offer:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
--market-price-margin=0.5
```
Alternatively, you can also set a trigger price on the re-published, market price margin based offer.
A trigger price on a SELL offer causes the offer to be automatically disabled when the market price
falls below the trigger price. In the `editoffer` example below, the SELL offer will be disabled when
@ -555,6 +623,7 @@ the JPY market price falls below 3960000.0000.
--market-price-margin=0.5 \
--trigger-price=3960000.0000
```
On a BUY offer, a trigger price causes the BUY offer to be automatically disabled when the market price
rises above the trigger price.
@ -562,7 +631,9 @@ _Note: Disabled offers never automatically re-enable; they can only be manually
`editoffer --offer-id=<id> --enable=true`._
#### Remove Trigger Price
To remove a trigger price on a market price margin based offer, set the trigger price to 0:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
@ -570,10 +641,12 @@ To remove a trigger price on a market price margin based offer, set the trigger
```
#### Change Disabled Offer's Pricing Model and Enable It
You can use `editoffer` to simultaneously change an offer's price details and disable or re-enable it.
Suppose you have a disabled, fixed price offer, and want to change it to a market price margin based offer, set
a trigger price, and re-enable it:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
@ -587,12 +660,14 @@ a trigger price, and re-enable it:
Taking an available offer involves two CLI commands: `getoffers` and `takeoffer`.
A CLI user browses available offers with the getoffers command. For example, the user browses SELL / EUR offers:
```
$ ./bisq-cli --password=xyz --port=9998 getoffers --direction=SELL --currency-code=EUR
```
Then takes one of the available offers with an EUR payment account ( id `fe20cdbd-22be-4b8a-a4b6-d2608ff09d6e`)
with the `takeoffer` command:
```
$ ./bisq-cli --password=xyz --port=9998 takeoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
@ -600,6 +675,7 @@ $ ./bisq-cli --password=xyz --port=9998 takeoffer \
--amount=0.125
--fee-currency=btc
```
Depending on the offer type, the taken offer will be used to (1) create a trade contract, or (2) execute a BSQ swap.
The value passed with the optional `--amount` parameter must be between the offer's min-amount and amount values.
@ -612,22 +688,25 @@ section explains how to use the `takeoffer` command to complete a BSQ swap.
The first step in the Bisq trade protocol is completed when a `takeoffer` command successfully creates a new trade from
the taken offer. After the Bisq nodes prepare the trade, its status can be viewed with the `gettrade` command:
```
$ ./bisq-cli --password=xyz --port=9998 gettrade --trade-id=<trade-id>
```
The `trade-id` is the same as the taken `offer-id`, but when viewing and interacting with trades, it is referred to as
the `trade-id`. Note that the `trade-id` argument is a full `offer-id`, not a truncated `short-id` as displayed in the
Bisq UI.
You can also view the entire trade contract in `json` format by using the `gettrade` command's `--show-contract=true`
option:
```
$ ./bisq-cli --password=xyz --port=9998 gettrade --trade-id=<trade-id> --show-contract=true
```
The `gettrade` commands output shows the state of the trade from initial preparation through completion and closure.
Output columns include:
```
Deposit Published YES if the taker fee tx deposit has been broadcast to the network.
Deposit Confirmed YES if the taker fee tx deposit has been confirmed by the network.
@ -636,6 +715,7 @@ Fiat Received YES if the seller has sent a “payment received”
Payout Published YES if the sellers BTC payout tx has been broadcast to the network.
Withdrawn YES if the buyers BTC proceeds have been sent to an external wallet.
```
Trade status information informs both sides of a trade which steps have been completed, and which step to perform next.
It should be frequently checked by both sides before proceeding to the next step of the protocol.
@ -646,6 +726,7 @@ complete._
Once the taker fee transaction has been confirmed, payment can be sent, payment receipt confirmed, and the trade
protocol completed. There are three CLI commands that must be performed in coordinated order by each side of the trade:
```
confirmpaymentstarted Buyer sends seller a message confirming payment has been sent.
confirmpaymentreceived Seller sends buyer a message confirming payment has been received.
@ -653,11 +734,13 @@ closetrade Set trade state to CLOSED, and keep trade proceeds i
OR
withdrawfunds Set trade state to CLOSED, and send trade proceeds to an external wallet.
```
The last two mutually exclusive commands (`closetrade` or `withdrawfunds`) may seem unnecessary, but they are critical
because they tell the Bisq node to set a completed trades state `CLOSED`. Please close out your trades with one
or the other command.
Each of the CLI commands above takes one argument: `--trade-id=<trade-id>`:
```
$ ./bisq-cli --password=xyz --port=9998 confirmpaymentstarted --trade-id=<trade-id>
$ ./bisq-cli --password=xyz --port=9999 confirmpaymentreceived --trade-id=<trade-id>
@ -669,6 +752,7 @@ $ ./bisq-cli --password=xyz --port=9999 withdrawfunds --trade-id=<trade-id> --ad
The `takeoffer` command will immediately perform the BSQ swap, assuming both sides' wallets have sufficient BTC and
BSQ to cover the trade amount, and maker or taker fee. It takes one argument: `--offer-id=<offer-id>`:
```
$ ./bisq-cli --password=xyz --port=9998 takeoffer --offer-id=Xge8b2e2-51b6-3TOOB-z748-3ebd29c2kj99
```