xmr-btc-swap/docs/pages/becoming_a_maker/overview.mdx
Mohan 2e6d324ab8
feat(monero-sys): Monero bindings (#303)
* feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464

* refactor: remove unused monero-wallet crate

Removed the monero-wallet crate which was not being used anywhere in the codebase,
simplifying the project structure.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* change order of members in Cargo.toml

* fix monero submodule problem

* progress

* continue

* fix tests

* fix tests again

* introduce error handling

* update error message

* implement Wallet::sync

* add swap progress

* fix import path

* add check_tx_key, transfer, switch to anyhow

* add more functionality

* fix test -- todo: why is manager.connected() failing?

* update Cargo.lock

* cleanup api and tests, add wait_until_synced

* show lib tracing in test

* add wallet_dir to wallet manager, fix tests, start integration into swap

* add main/default wallet to WalletManager

* continue integration, add wait_for_confirmations

* feat(ci): Install Monero build dependencies

* feat(ci): extract monero build instructions into compose file, run monero-sys integration tests in ci.yml

* fix compile errors and monero-sys/tests

* satisfy clippy

* update git CI to checkout git submodules

* fix again: init submodules

* fix?

* fix(ci): increase max size of ccache to 10G

* fix(ci): Include manual build step for Monero before running cargo

* add armhf sources for apt

* add armhf before running apt update

* fix(monero-sys): MACOSX_DEPLOYMENT_TARGET=11.0

* remove armhf apt dpkg arch

* fix BlockHeight serialization breakage

* ci: make only binaries not tests

* fix: let tauri ignore changes to monero-sys/monero

* fix: don't implement Sync for monero-sys types, change close_wallet

* move mutex into Wallet

* close wallet on drop (test still failing)

* pipe monero logs to tracing

* do not emit c++ perf logs, add comments

* get test wallet_closing to pass

* fix(ci): increase swap file to allow fix issue where runners would run out of memory

* fix(ci): use make -j4 release everywhere

* fix: run ci on self hosted runner (more ram)

* start changing to dedicated wallet threads

* complete move to dedicated wallet threads

also improve various minor things.
tests not passing

* satisfy clippy

* add traces

* refactor monero-harness to use monero-sys

tests still fail because there is a connection is-
sue between the wallet and monerod.

* fix: wallet doesn't connect to monerod in harness

test still failing because the miner wallet doesn't
recognize its balance

* make minimal progress

* no progress

* fix(monero-sys): Build on x_api_add_new_functions_release, which has been rebased on release and includes criticial fixes

* feat(gui): Add a Introduction for new users (#287)

* feat(gui): add IntroductionModal component

* feat(gui): add interactivity to IntroductionModal

* feat(gui): create SlideTemplate component for IntroductionModal Slides

* feat(gui): add generic slides to IntroductionModal with images and content

* feat(gui): add Slide with SwapStatusAlert to IntroductionModal

* feat(gui): show the introduction only on the first app start

* feat(gui): make external links functional

* fix(gui): update github link to link to active repo

* feat(gui): replace old images with new mockups and update Slide05 content

* feat(gui): add CardSelectionGroup and CardSelectionOption components for improved card selection UI

* feat(gui): add FiatPricePreference slide to IntroductionModal

* feat(gui): save user preference regarding fiat prices

I set the initial store configuration for fetching fiat prices to false to avoid any calls to coingecko without user consent

* refactor(gui): remove old Slide05 component for improved codebase maintenance

* fix(gui): add UnstoppableSwap logo to FiatPricePreference slide

* refactor(gui): update image imports and improve slide content for introduction modal

* fix(gui): introduce ExternalLink component and update Slide05 to use it for external navigation

* fix(gui): replace webp images for introduction with svg mockups for improved quality

* fix(gui): change order of introduction slides, to asking for fiat price preference at the end

* refactor(gui): implement CardSelectionContext for managing card selection state

* refactor: texts in intro modakl

* fix(gui): update currency fetching SVG for improved design and clarity

* feat(gui): added changelog entry for introduction

---------

Co-authored-by: Binarybaron <binarybaron@protonmail.com>

* feat(swap): Upgrade monero-wallet-rpc to v0.18.4.0 (#314)

* Prepare release 1.0.0-rc.20 (#315)

Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net>

* feat(ci): Limit ci.yml to one concurrent running job per git branch (#316)

* fix(ci): Set yarn network-timeout to 10 minutes to avoid spurious network failures (#317)

* feat(docs): Add darkness.su rendezvous point to docs

* fix(gui): Fetch alerts only once

* Prepare release 1.0.0-rc.21 (#318)

Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net>

* upgrade(swap): Concurrent syncing, bdk upgrade, refactors (#180)

* upgrade sqlx to 0.8, add bdk_wallet and bdk_electrum

The new dependencies are part of the bdk upgrade and
include the improved wallet code.
They, too, depend on sqlite3.
However, they use a newer version than we currently use via sqlx.
This necessitated the sqlx upgrade.
This entailed trivial changes (use Pool directly instead of pool.acquire()).
We might have to fix the CI as well, I kept getting compile
errors from the macro until I ran swap/sqlx_dev_setup.sh.

* move old wallet code to extra module

* fix fee estimation for old client

* bump bitcoin crate, add new wallet constructor

* remove unused old Client, move code around for better readibility

* make Wallet generic over Persister (database) and move more code around for readibility

* add script history, start reimplementing client methods

* update some imports

* cargo fmt

* Add comments, fix fee estimation, address generation and status_of_script

* redo state update and wallet sync

* fix bitcoin address validation and more imports, use Amount everywhere

* fix tx cancel, lock, punish, redeem, refund

* fix bitcoin::Address de-/serialisation

* fix more address validation

* fix more address parsing and validation, also some more imports

* cargo fmt

* fix wallet initialization, start wallet migration

* fail test instead of ignoring it

* perform full scan on creation, load from db if it exists

* add more wallet info, fix wallet initialization

* fix: default to null in config

* migrate from old wallet if needed

* change something

* fix some tests

* temporarily patch bdk_wallet and bdk_electrum

* fix more tests

* fix missing rustls

* asb: only start tor client if register_hidden_service=true in the config

* fix: use p2wsh_signature_hash instead of p2wpkh_signature_hash

* fix some bitcoin address parsing and fee rate parsing

* dprint fmt

* add bitcoin-harness to this project and update to the new bitcoin version

* fix max_givible again

* create electrum client separately from wallet, clean up some code

* add comment

* ignore .env.development

* log config file path on ./asb config

* feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464

* Revert "feat(monero-sys): Initial commit. Regtest integration test. Wrapper around basic Wallet functions, depends on monero#9464"

This reverts commit 14a5b4c348a109d2524657ffeba306422458ea44.

* upgrade to rust toolchain 1.81

* Use new bdk update for code from master

* fix

* remove

* fix: add empty .gitmodules file to fix Docker build

* fix: clean up submodule references

* fix: properly declare monero submodule with ignore flag

* fix(wallet, bdk): only reveal new address if absolutely necessary

* fix: private keys not loaded into bdk wallet

* refactor: sync wallet progress log

* dprint fmt

* refactor: move bitcoin-harness to outside repo

* refactor: remove redundant log message

* Display sync progress

* Remove redundant arg to  swap/tests/harness/mod.rs function

* fix: call rustls::crypto:💍:default_provider()

* dprint fmt

* refactor: remove debug code

* refactor: move old bdk wallet export to own function, clear log messages

* remove old migr for testnets (checksum mismatch), remove balance and stringified last revealed addresses from migration export

* use revalidate_network function, remove redundant drop

* Display progress of background tasks, TauriBackgroundProgressHandle struct

* fix: almost satisfy clippy

* fix: gen-bindings error

* feat: add BackgroundRefund background type

* feat: use builder pattern for constructing Bitcoin wallet

* dprint ftm

* sync electrum in seperate thread

* do not allow user to start sync while sync is in progress

* remove redundant log message

* display random buffer in AlertWithLinearProgress progress

* fix: use TauriContextStatusEvent.Available), dont show syncing wallet spinner if not syncing

* differentiate between TestWalletBuilder and WalletBuilder

* satisfy clippy

* remove custom BackgroundRefund event, move into background process architecture

* refactor

* dprint fmt

* progress: get unit tests compiling

* fix: bitcoin unit tests specify const values like sync_interval

* fix: get unit tests passing

* make clippy happy

* feat: display full sync progress, fix unit test import issues

* dprint fmt

* make clippy happy, use u32 for target_block and not usize

* always spawn tor for asb

* refactor: remove gen_background_progress_id and just use Uuid::new_v4()

* refactor(hooks.ts): clarify comment on useConservativeBitcoinSyncProgress

* fix typo

* refactor: do not let WalletBuilder take entire env struct

* dprint fmt

* refactor: remove default feature from workspace patch of bdk

* first try for concurrent syncing

* refactor: concurrent syncing

* fix(wallet.rs): Safely convert FeeRate from btc / kb to sats / kwu

* feat(wallet.rs): persist published Bitcoin transactions without requiring re-scan

This allows us to compute an updated Bitcoin balance without requiring a re-scan

* refactor(wallet.rs): use just 5 concurrent sync requests

* refactor: display snackbar error when Wallet refresh fails

* fix: add missing space

* dprint fmt

* refactor: fancy traits for the CumulativeProgress struct, allow limiting amount of callback calls

* make clippy happy

* dprint fmt

* refactor: clearly differntiate between SyncMutex and TokioMutex, use traits for converting to Arc<Mutex<_>>, move sync_ext into own moid

* fix: skip syncing if no spks in wallet

* fix: update bdk.sh to test migration from old wallet (pre 1.0.0 bdk) to new bdk

* fix: increase bitcoin_lock_confirmed_timeout in RegTest env to 5 minutes

* refactor: avoid usize where possible, create persistence only after full scan, transmit assumed_total for full scan to tauri, add some icons to progress displays

* make clippy happy

* fix(ci): change rust toolchain 1.81

* fix(cross compilation arm): use ring instead of aws-lc-rs

* fmt

* ignore failing rendezvous tests

* fix printing_status_change_doesnt_spam_on_same_status

* fix: given_bitcoin_address_network_mismatch_then_error test

* ignore list_sellers_should_report_all_registered_asbs_with_a_quote test

* feat: add tor icon

* refactor(wallet.rs): reorder struct by abstraction level

* refactor(bitcoin wallet): chunk size for syncing

* fix(integration tests): decrease sync interval to 3s

* fix(integration tests): parse_rpc_err method to take new bdk error, not old one

* add changelog entry

---------

Co-authored-by: Binarybaron <binarybaron@protonmail.com>
Co-authored-by: Mohan <86064887+binarybaron@users.noreply.github.com>

* amend: CHANGELOG.md

* Prepare release 1.1.0-rc.1 (#325)

Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net>

* fix(ci): Extract gen-bindings-verbose from gen-bindings

* Prepare release 1.1.0-rc.2 (#326)

* amend: add comma after new package.json entry

* revert: delete rc.1, rc.2 releases

* Prepare release 1.1.0-rc.3 (#327)

Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net>

* fix: Issues with 1.1.0-rc (#328)

* bump(rust): Toolchain to 1.82

* bump(tauri): Bump some Tauri peer-dependencies

* fix(gui): Prefer maker with known version, bump MIN_ASB_VERSION to 1.1.0-rc.3

* amend: CHANGELOG.md

* Prepare release 1.1.0 (#329)

* feat: log enviroment info (#332)

* Add justfile (#335)

* fix(swap): Add retry logic for Bitcoin wallet sync (#333)

* docs: add repo overview (#337)

* Prepare release 1.1.1 (#338)

Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net>

* rebase

* add monero-sys to swap/Cargo.toml

* progress rebase

* rebase

* Fix integration test

* Fix tests then break them again

* fix monero integration test harness

Integration tests were failing because the wallet/
node couldn't keep up with the amount of blocks we
generated and took some time before it even reali-
zed it was out of sync.
That lead to unrecognized balances.

Fix: we wait 0.25 seconds between each new block.
This gives the wallet/node enough time to realize
it's out of sync.

* Fix errors - happy_path goes to btc is redeemed

* fix: couldn't create walllet from keys

By not using an empty password

* fix happy_path: refresh wallet before sweeping

* Handle missing Monero node (#348)

* Allow automatic Monero node selection

* amend

* remove unused bridge.h file

* fix(ci): Use ubuntu-latest instead of self hosted runner

* fix(Dockerfile): Use rust 1.82, install apt packages required for Monero compilation

* add docs

* use scan_transactions instead of syncing monero wallet

When redeeming the Monero we, instead of doing a full scan,
simpyl import the Monero lock transaction by it's id.
This avoids a full scan before redeeming and should speed up the process
siginficantly.

* uniform naming of monero lock_transfer_proof and migration

* breaking: re-send lock transfer proof in cooperative redeem response

* add retry logic to blockchain height fetching, adjust tracing output

* fix merge

* remove unused variables

* satisfy clippy

* fmt

* changes

* add seed export to ffi bindings

* remove ccache from ci, don't manually build Monero codebase

Since monero-sys is tightly integrated into the Cargo build system, the
build output of the Monero codebase is stored in the same target dire-
ctory as all other Rust build output and is thus cached by our existing
cache solution.

* really stop building Monero manually in CI

* print monero-cpp logs in test

* use default cargo caching action instead of rust-cache

This commit introduces the default github cache action because
rust-cache doesn't cache our own code, only our dependencies.

* don't install ccache in ci

* debug missing openssl

* update changelog

* ci: run on self hosted runnr

* fix forward_cpp_log panic

* write logs to stderr instead of stdout

This enables us to `println` something and users
can just `asb export-monero-wallet > wallet.txt`
after which `wallet.txt` will contain just the wallet
seed.

* Revert "ci: run on self hosted runnr"

This reverts commit 157dfa7dc5bac025a9fc0eefe996880230274928.

* feat: ci run on large (expensive!!!) github runners, only run on non-draft PRs and only do this until we find a way around this

* run on large windows runenrs

* add asb-testnet command

* add --trace to ExportMoneroWallet

* ci: agressive caching (delegate to cargo instead of doing by hand)

* fix: pin dtolnay/rust-toolchain to @v1

* switch to actions-rust-lang/setup-rust-toolchain@v1

* fix: dont manually call cache for cargo dirs, let this be done by actions-rust-lang/setup-rust-toolchain instead

* disbale -D warnings in CI

* don't refresh wallet before getting balance

* ci: agressive caching to s3

* Change creation height to restore height in export-monero-wallet output

* update changelog

* concrete example in changelog

* add docker ignore

* limit monero build to just one core

* dont .dockerignore the .git folder because we need it for sub directories

* copy .git

* dont copy .git

* Dockerfile: run git submodule sync before updating

* only include -mmacosx-version-min=11.0 on mac os

* add retry convenience function

* improve error messages in monero-sys

* remove transfer proof from state6, retry redeem_xmr and refund_xmr

* install libabsl-dev on ubuntu ci

* fix(monero-sys): Disable BUILD_TESTS, TREZOR_DEBUG, USE_DEVICE_TREZOR, HIDAPI_FOUND, GTEST_HAS_ABSL CMake flags

* alice: store transfer proof in more states, only use latest state for coop redeem

* BUILD_SHARED_LIBS OFF

* install libasl in docker

* dont link against absl google

* print multiaddr when confirming new address

* dont build device_trezor, dont link hidapi and usb-1.0

* use MONERO_WALLET_CRYPTO_LIBRARY to cn

* fix trezor shit

* link against stub trezor impl

* still include trezor in build (stub implementation)

* remove DEVICE_TREZOR_READY

* fmt

* dont include ledger and trezor support

* ci: dont fail fast

* feat(monero-sys): Link boost statically

* feat(monero-sys): Link OpenSSL (ssl and crypto libraries) statically

* breaking: remove monero.wallet_rpc_url in asb config, take monero.daemon_url instead

* fix MoneroDaemon::is_available

* add test case for special paths

* fix simple test (was failing because tx fee wasn't considered

* add ffi sanitization test commands to justfile. todo: run these in CI

* add dep on futures crate for testing

* improve comments

* just fmt

* remove ThreadSanatizer as it doesn't work well with c++ bindings

* update mem test command to use nightly cargo

* fix(bob): Only warn if .expired_timelock(..) check fails in BtcLocked state

* Resolve merge conflicts and add missing imports - Merged workflow configuration changes, CHANGELOG.md, tracing_util.rs, tauri_bindings.rs, network swap_setup alice.rs - Added missing imports for monero::Amount, url::Url, Duration, wallet types - Some API changes in monero wallet still need to be addressed

* fix merge conflicts

* dprint fmt, remove unused progress bars

* link unbound statically (works on mac)

* link protobuf dynamically (works on mac)

* install libnghttp2-dev in linux for building, add justfile command for installing brew deps

* install libevent-dev and libexpat1-dev on linux

* Dockerfile: install libnghttp2-dev, libevent-dev, libexpat1-dev and build in debug mode

* set CMAKE_DISABLE_FIND_PACKAGE_HIDAPI

* if ci: -j1, else -j4 for monero-sys

* println!("cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu");

* print full libp2p network errors

* add migrate steps for wallet files to changelog

* fix dockerfiel to use ubuntu24

* fix build ubuntu

* fix(monero-sys): opt-level = 2

* opt-level = 0

* version: bump to 2.1.0-beta

* include monero_cpp in tracing

* bump version to 2.1.0-beta.2

* fmt

* fix  merge conflict in vscode.settings

* use uint64_t instead o fu_int64_t

* dynamically detect mac os brew prefix folder

* fmt

* add todo

* remove unused coce

* update docs for monero-wallet-rpc removal

* Revert "dynamically detect mac os brew prefix folder"

This reverts commit b55cbe3e115a3f98935815b7d37cb975c8f1a012.

* update comment/test

* try fix monero harness test

* catch exceptions in c++ ffi calls, for some methods calls .expect() on the rust side now

* force debug monero-sys mode

* Reapply "dynamically detect mac os brew prefix folder"

This reverts commit 0b340417525c085d213e6b6c1310410cd29dcc91.

* fix tests

* update synchronized() method

* don't force refresh before sweep

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: einliterflasche <einliterflasche@pm.me>
Co-authored-by: b-enedict <92430555+b-enedict@users.noreply.github.com>
Co-authored-by: unstoppableswap-botty <binarybaron_bot@proton.me>
Co-authored-by: UnstoppableSwap Botty <help@unstoppableswap.net>
Co-authored-by: Raphael <81313171+Einliterflasche@users.noreply.github.com>
Co-authored-by: root <root@vmd145754.contaboserver.net>
2025-06-17 10:55:50 +02:00

280 lines
11 KiB
Text

import { Callout } from 'nextra/components'
## An Overview of Becoming a Maker
Makers run an automated swap backend (`asb`), which users can connect to and swap with.
The `asb` accepts Bitcoin and sells Monero, for a fee.
The `asb` needs to communicate with the Bitcoin and Monero blockchains.
For this, it uses direct FFI wallet access via `monero-sys` for Monero and `electrs` for Bitcoin.
It's also strongly recommended to run your own Monero and Bitcoin nodes.
## Docker Compose setup
We maintain a Docker Compose configuration ([link](https://github.com/UnstoppableSwap/asb-docker-compose)) that automatically starts and manages these services:
- `asb` (the maker service, with built-in wallet functionality connecting directly to `monerod` and `electrs`)
- `electrs` (a Bitcoin blockchain indexer, connecting to `bitcoind`)
- `monerod` (a Monero node, connecting to the Monero blockchain)
- `bitcoind` (a Bitcoin node, connecting to the Bitcoin blockchain)
To run this setup you'll need Docker and Docker Compose installed.
### Getting started
Now you can clone the configuration repo and `cd` into it.
We're going to setup an asb on mainnet.
If you want to setup for testnet, go into the `testnet` directory instead.
All other steps remain the same.
```bash
git clone https://github.com/UnstoppableSwap/asb-docker-compose.git
cd asb-docker-compose/mainnet
```
The directory contains three files: the docker compose file, the enviroment variables file and the asb configuration file.
The directory structure looks like this:
```bash
asb-docker-compose/mainnet/
├─ config_mainnet.toml # asb configuration
├─ docker-compose.yml # docker compose configuration
├─ .env # port configuration for docker compose
```
The `docker-compose.yml` and `.env` files are part of the docker compose setup.
We will prioritize the asb configuration file in this guide, because you probably don't want to change the docker compose setup.
### Usage and commands
_This list is also available in the [repository](https://github.com/UnstoppableSwap/asb-docker-compose/), including variations for testnet._
First, make sure you're in the directory with the `docker-compose.yml` file:
```bash copy
cd asb-docker-compose/mainnet
```
If you aren't familiar with docker compose, here are the most important commands:
| Command | Description |
| --- | --- |
| `docker compose up -d` | Start all services. |
| `docker compose down` | Stop all services. |
| `docker compose ps` | List all currently running services. |
| `docker compose pull` | Pull the latest images for all services. You need to run `docker compose up -d` after this to actually update the services. |
| `docker compose logs -f` | Access the logs of all services. To only get the logs of a specific service, use `docker compose logs -f <service_name>`. To only see the last e.g. 100 lines, use `docker compose logs -f --tail 100`. |
You can also execute `asb` commands, to get the history of swaps for example:
```bash copy
docker compose exec mainnet_asb asb --config=/asb-data/config_mainnet.toml history
```
Below is a list of asb commands you can use.
Some of them require access to some resources, in which case you'll need to stop the asb first and then resume afterwards:
```bash copy
docker compose down
docker compose exec mainnet_asb asb --config=/asb-data/config_mainnet.toml <command>
docker compose up -d
```
| Command | Description |
| --- | --- |
| `help` | Prints a list of available options and commands (under _subcommands_). |
| `history` | Prints a list of all previous and current swaps. |
| `start` | Starts the asb. This is automatically done when you run `docker compose up -d`. |
| `config` | Prints the current configuration. |
| `export-bitcoin-wallet` | Prints the internal bitcoin wallet descriptor which can be used to access the asb's bitcoin wallet. |
| `withdraw-btc --address <YOUR_ADDRESS>` | Withdraws Bitcoin from the internal wallet into a specified address. |
### Asb Configuration
Let's have a look at the asb configuration file.
It is used to configure the behaviour of the asb.
It uses the TOML language ([docs](https://toml.io/)).
The file has different sections, each with different configuration options:
- `maker`: specifies the core behaviour of the asb
- `bitcoin`: specifies the Bitcoin configuration
- `monero`: specifies the Monero configuration
- `tor`: specifies the Tor configuration
- `data`: specifies the data directory
- `network`: specifies the networking configuration
#### Maker Section
The most important section is the `[maker]` section, which specifies the core behaviour of the asb.
This is what a standard maker section looks like:
```toml filename="config_mainnet.toml"
[maker]
min_buy_btc = 0.001
max_buy_btc = 0.1
ask_spread = 0.02
price_ticker_ws_url = "wss://ws.kraken.com/"
external_bitcoin_address = "bc1..."
# ...
```
Below an explanation of what each option does:
| Option | Description |
| --- | --- |
| `min_buy_btc` | The minimum amount of Bitcoin the asb will buy from takers, in BTC. |
| `max_buy_btc` | The maximum amount of Bitcoin the asb will buy from takers, in BTC. |
| `ask_spread` | The markup the asb will charge compared to the market price, as a factor. The market price is fetched via the `price_ticker_ws_url`. A value of `0.02` means the asb will charge 2% more than the market price. |
| `price_ticker_ws_url` | The URL of a websocket that provides the market price. The default is the Kraken API, but you can build your own websocket server which mimics the Kraken API. |
| `external_bitcoin_address` | Bitcoin address used by the asb when redeeming or punishing swaps. If omitted, a new internal address is generated for each swap. |
### Bitcoin Section
The `bitcoin` section specifies a few details about the asb's interaction with the Bitcoin blockchain.
We do not recommend changing these settings, however we document them for completeness sake.
```toml filename="config_mainnet.toml"
# ...
[bitcoin]
target_block = 1
electrum_rpc_urls = ["tcp://mainnet_electrs:50001"]
use_mempool_space_fee_estimation = true
network = "Mainnet"
# ...
```
| Option | Description |
| --- | --- |
| `target_block` | This determines the block height that the asb will try to get it's Bitcoin transactions confirmed at. The default value of `1` means the asb will try to get it's transactions confirmed in the next block. |
| `electrum_rpc_urls` | A list of Electrum servers used to interact with the Bitcoin blockchain. If multiple servers are specified they are tried in order. The default contains the docker-hosted _electrs_ server. |
| `use_mempool_space_fee_estimation` | Whether the asb should fall back to the mempool.space API when fee estimation from Electrum fails. Defaults to `true`. |
| `network` | The Bitcoin network the asb will connect to. |
### Monero Section
The `monero` section specifies a few details about the asb's interaction with the Monero blockchain.
The asb uses direct FFI wallet access via `monero-sys`, eliminating the need for `monero-wallet-rpc`.
We do not recommend changing these settings, however we document them for completeness sake.
```toml filename="config_mainnet.toml"
# ...
[monero]
daemon_url = "http://your.monero-daemon.org:18081"
network = "Mainnet"
# ...
```
| Option | Description |
| --- | --- |
| `daemon_url` | The URL of the Monero daemon (monerod) that the asb will connect to directly. The asb manages wallets internally using FFI bindings. Optional: if not specified, the asb will connect to a known public Monero node at random. |
| `network` | The Monero network the asb will connect to. Either "Mainnet" or "Stagenet". |
### Tor Section
The `tor` section specifies the asb's onion service (hidden service) configuration.
An onion service can be used to make the asb publicly accessible without exposing the server's IP address or requiring an opened port ([further reading](https://community.torproject.org/onion-services/overview/)).
```toml filename="config_mainnet.toml"
# ...
[tor]
register_hidden_service = true
hidden_service_num_intro_points = 5
# ...
```
| Option | Description |
| --- | --- |
| `register_hidden_service` | Whether the asb should register an onion service. |
| `hidden_service_num_intro_points` | If the asb registers an onion service, this specifies the number of introduction points the asb will use. |
### Network Section
The `network` section specifies the asb's networking configuration.
This includes:
- which rendezvous points the asb will connect to,
- on which port, and
- external addresses the asb will advertise to the rendezvous points.
<Callout type="info">
These addresses are specified using the multiaddr format ([link](https://multiformats.io/multiaddr)).
A multiaddr combines all necessary information into a single string.
For example, the first rendezvous point's multiaddr specifies the rendezvous point at the DNS address `discover.unstoppableswap.net`, on port `8888` with the peer ID `12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE`.
</Callout>
```toml filename="config_mainnet.toml"
# ...
[network]
# the ip and port the asb will listen on
listen = ["/ip4/0.0.0.0/tcp/9939"]
# the rendezvous points the asb will connect to (address, port and peer id)
rendezvous_point = [
"/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE"
]
# the external addresses the asb will advertise to the rendezvous points (only address)
external_addresses = [
# e.g. "/dns4/your.domain.com/tcp/9939/p2p/your1peer2id"
]
```
| Option | Description | Format |
| --- | --- | --- |
| `listen` | The ip and port the asb will listen on. The IP address `0.0.0.0` means the asb will listen on all IP addresses. Remember that the asb service is running in a docker container. Make sure the port is the same as in the `.env` file. | This multiaddr should only include an IP address and a port number. |
| `rendezvous_point` | A list of rendezvous points the asb will connect to. | These multiaddrs should include an address (e.g. IPv4, IPv6, DNS), a port number and a peer ID. |
| `external_addresses` | A list of external addresses the asb will advertise to the rendezvous points. If you registered a domain, you can add it here. If you enabled the onion service, it will be included automatically, so you don't need to specify the onion address. | These multiaddrs should only include an address (e.g. IPv4, IPv6, DNS). |
Et, voilà!
You've successfully configured your asb.
### Default Configuration
This is what the default configuration might look like.
```toml filename="config_mainnet.toml" copy
[maker]
min_buy_btc = 0.001
max_buy_btc = 0.1
ask_spread = 0.02
price_ticker_ws_url = "wss://ws.kraken.com/"
external_bitcoin_address = "bc1..."
[bitcoin]
electrum_rpc_urls = ["tcp://mainnet_electrs:50001"]
target_block = 1
use_mempool_space_fee_estimation = true
network = "Mainnet"
[monero]
daemon_url = "http://mainnet_monerod:18081"
network = "Mainnet"
[tor]
register_hidden_service = true
hidden_service_num_intro_points = 5
[data]
dir = "/asb-data/"
[network]
listen = ["/ip4/0.0.0.0/tcp/9939"]
rendezvous_point = [
"/dns4/discover.unstoppableswap.net/tcp/8888/p2p/12D3KooWA6cnqJpVnreBVnoro8midDL9Lpzmg8oJPoAGi7YYaamE",
"/dns4/eratosthen.es/tcp/7798/p2p/12D3KooWAh7EXXa2ZyegzLGdjvj1W4G3EXrTGrf6trraoT1MEobs"
]
external_addresses = []
```