Atomic Swaps CLI User Guide
The command line guide for Atomic Swaps, i.e., exchanging two different cryptocurrencies from separate blockchains in a trust-less and decentralized manner.
Atomic Swaps are a peer-to-peer marketplace built directly into your Beam wallet that allows users to swap Beam for another cryptocurrency. Trade your Beam for Bitcoin, Ehtereum, LiteCoin, DOGE, and more!
Atomic Swaps is in beta.
DO NOT USE THIS HIGHLY ADVANCED FEATURE FOR LARGE SUMS OF MONEY
For Electrum we support only Legacy type seeds and SSL connection
For Bitcoin use versionBitcoin_core_v0.17.1.
For Litecoin use versionLitecoin_v0.17.1.

Perform an Atomic Swap with LiteCoin

Using Alice and Bob as an example, we will go over how to perform an Atomic Swap of Alice's Beam for Bob's LiteCoin (LTC).

Run a full LTC node

Bob and Alice must configure their LTC node to allow RPC access either through the command line or edit theirconfigfile according to the LTC documentation (for this example, we will use standard node and RPC ports).
Alice and Bob can run a full LTC node by entering the following command:
1
./litecoind -server -datadir="path_to_litecoin_wallet_data" -rpcuser= -rpcpassword= -printtoconsole
Copied!

Alice's LTC node

1
./litecoind -server -datadir="Alice/path_to_litecoin_wallet_data" -rpcuser=Alice -rpcpassword=123 -printtoconsole
Copied!

Bob's LTC node

1
./litecoind -server -datadir="Bob/path_to_litecoin_wallet_data" -rpcuser=Bob -rpcpassword=123 -printtoconsole
Copied!

The nodes must be synced to the current blockchain height before an Atomic Swap can occur.

Run a full Beam node

Please refer to this guide for setting up a full Beam node.
Users can check their LTC balance by entering the following command:
1
./litecoin-cli -rpcuser= -rpcpassword= getbalance
Copied!

Alice's LTC balance

1
./litecoin-cli -rpcuser=Alice -rpcpassword=123 getbalance
Copied!

Bob's LTC balance

1
./litecoin-cli -rpcuser=Bob -rpcpassword=123 getbalance
Copied!

Initialize Atomic Swap settings

To configure the Atomic Swap settings, enter the following command:
1
./beam-wallet set_swap_settings --swap_coin=ltc --swap_wallet_addr= --swap_wallet_user= --swap_wallet_pass= --swap_feerate=<Litecoin fee rate(Photons/Kb)> --active_connection=core
Copied!
Each cryptocurrency has its own transaction fees.
Avoid transaction jamming or failure by double-checking the--swap_feeratefor each currency before initiating an Atomic Swap.
LTC, for example, has a--swap_feerateper 1KB of transaction size. LiteCoin's--swap_amountis denominated in "photons." 1 LTC = 1000000 photons, which is denominated in Beams while also offering fixed fee rates, regardless of transaction size.

Configuring swap settings for Alice

1
./beam-wallet set_swap_settings --swap_coin=ltc --swap_wallet_addr=127.0.0.1:13300 --swap_wallet_user=Alice --swap_wallet_pass=123 --swap_feerate=90000 --active_connection=core
Copied!

Configuring swap settings for Bob

1
./beam-wallet set_swap_settings --swap_coin=ltc --swap_wallet_addr=127.0.0.1:13400 --swap_wallet_user=Bob --swap_wallet_pass=123 --swap_feerate=90000 --active_connection=core
Copied!

Swapping LTC for Beam

Both parties can initiate the Atomic Swap by entering the following command:
1
./beam-wallet swap_init -n --amount= --swap_coin=ltc --swap_amount= --swap_beam_side
Copied!
The parameter--swap_beam_side is used when the other party (Alice) swaps Beam for a different cryptocurrency.
Bob enters the following command:
1
-./beam-wallet swap_init -n "eu-node01.mainnet.beam.mw:8100" --amount=10 --swap_coin=ltc --swap_amount=2000000000
Copied!
Bob must copy the swap token and forward it to Alice. After, Bob can enter the--wallet_listencommand:
1
./beam-wallet listen -n "eu-node01.mainnet.beam.mw:8100"
Copied!
Alice can accept the swap by entering the following command:
1
./beam-wallet swap_accept -n "eu-node01.mainnet.beam.mw:8100" --swap_token=316sveQtJrhxzuBy2zJHTp8aHfPgdz2FycrR8n9fs5CbXqoq1Be4Z9qEPnz5HjxuBZgmQpxWd8Dy9icQYKVn1e23cP7x5FHcteyEXk11QQ6CQLQJ3ERk653xgzXnBNfiiX8Pw8acyuNqCHPsF699oiDkxgEAXtV5mrKmYWh1zW
Copied!

Accepting swap offer

If Alice accepts the swap, it will create a swap transaction, and the LTC and Beam will lock on Bob's blockchain.
Each blockchain has its own block generation time. Average block generation times (roughly):
    LiteCoin: two and a half (2.5) minutes.
    Beam: one minute.
    Bitcoin: ten minutes.
After six blocks, Bob will redeem Alice's Beam coins, revealing a secret transaction code and completing Bob's portion of the Atomic Swap. β€Œ
Alice will redeem Bob's LTCs using the secret transaction code revealed to her, completing the Atomic Swap.
Bob and Alice can return to their respective Beam and LTC wallets to confirm the details of the Atomic Swap.

Perform an Atomic Swap with Bitcoin

Using Alice and Bob as an example, we will go over how to perform an Atomic Swap of Alice's Beam coins for Bob's Bitcoin (BTC).

Run a full BTC node

Bob and Alice must configure their BTC node to allow RPC access either through the command line or edit their config files according to the BTC documentation (for this example, we will use standard node and RPC ports).
Alice and Bob can run a full BTC node by entering the following command:

Alice's BTC node

1
./bitcoind -server -datadir="Alice/path_to_litecoin_wallet_data" -rpcuser=Alice -rpcpassword=123 -printtoconsole
Copied!

Bob's BTC node

1
./bitcoind -server -datadir="Bob/path_to_litecoin_wallet_data" -rpcuser=Bob -rpcpassword=123 -printtoconsole
Copied!

The nodes must be synced to the current blockchain height before an Atomic Swap can occur.

Run a full Beam node

Please refer to this guide for setting up a full Beam node.
Alice and Bob can check their BTC balance by entering the following command

Alice's BTC balance

1
./bitcoin-cli -rpcuser=Alice -rpcpassword=123 getbalance
Copied!

Bob's BTC balance

1
./bitcoin-cli -rpcuser=Bob -rpcpassword=123 getbalance
Copied!

Initialize Atomic Swap settings

To configure the Atomic Swap settings, enter the following command:
1
./beam-wallet set_swap_settings --swap_coin=btc --swap_wallet_addr= --swap_wallet_user= --swap_wallet_pass= --swap_feerate=<Bitcoin fee rate(Satoshs/Kb)> --active_connection=core
Copied!
Each cryptocurrency has its own transaction fees.
Avoid transaction jamming or failure by double-checking the--swap_feeratefor each currency before initiating an Atomic Swap.
BTC, for example, has a--swap_feerateper 1KB of transaction size. Bitcoin's--swap_amountis denominated in "satoshis." 1 BTC = 1000000 satoshis, compared to Beam, which is denominated in Beams while also offering fixed fee rates, regardless of transaction size.

Configuring swap settings for Alice

1
./beam-wallet set_swap_settings --swap_coin=btc --swap_wallet_addr=127.0.0.1:13300 --swap_wallet_user=Alice --swap_wallet_pass=123 --swap_feerate=90000 --active_connection=core
Copied!

Configuring swap settings for Bob

1
./beam-wallet set_swap_settings --swap_coin=ltc --swap_wallet_addr=127.0.0.1:13400 --swap_wallet_user=Bob --swap_wallet_pass=123 --swap_feerate=90000 --active_connection=core
Copied!

Swapping BTC for Beam

Both parties can initiate the Atomic Swap by entering the following command:
1
./beam-wallet swap_init -n --amount= --swap_coin=btc --swap_amount= --swap_beam_side
Copied!
The parameter--swap_beam_sideis used when the other party (Alice) swaps Beam for a different cryptocurrency.
Bob enters the following command:
1
./beam-wallet swap_init -n "eu-node01.mainnet.beam.mw:8100" --amount=10 --swap_coin=btc --swap_amount=100000000
Copied!
Bob must copy the swap token and forward it to Alice. After, Bob can enter the--wallet_listencommand:
1
./beam-wallet listen -n "eu-node01.mainnet.beam.mw:8100"
Copied!
Alice can accept the swap by entering the following command:
1
./beam-wallet swap_accept -n "eu-node01.mainnet.beam.mw:8100" --swap_token=316w4oB5hCz2qeVNrtteAEZXhxxx2HBX8v1Ped1FhveJor5JbChz2xXGfi2LkKqVLu8kU4vEoZCV3UbmwoBZX2ABJzmbxLPxpCTVZr1oefwsJDzYU2BUXXDTf4VjtBJfsP3yrozPT4bz1ZTdDTzRS2yU3VYvnamuSRSfEPatha
Copied!

Accepting swap offer

If Alice accepts the swap, it will create a swap transaction, and the BTC and Beam will lock on Bob's blockchain.
Each blockchain has its own block generation time. Average block generation times (roughly):
    LiteCoin: two and a half (2.5) minutes.
    Beam: one minute.
    Bitcoin: ten minutes.
After six blocks, Bob will redeem Alice's Beam coins, revealing a secret transaction code and completing Bob's portion of the Atomic Swap. β€Œ
Alice will redeem Bob's BTCs using the secret transaction code revealed to her, completing the Atomic Swap.
Bob and Alice can return to their respective Beam and BTC wallets to confirm the details of the Atomic Swap.
Last modified 1mo ago