Before you go any further, you should run a healthcheck to check on the status of your Sparkswap Broker Daemon. You can run this healthcheck and all other CLI commands by first going into the Sparkswap broker directory and going into the container:
docker-compose exec sparkswapd bash
Then you can run the healthcheck:
You should expect to see the following response:
Sparkswap Healthcheck ┌───────────────────┬───────────────────┐ │ Component │ Status │ ├───────────────────┼───────────────────┤ │ BTC Engine │ NEEDS_WALLET │ ├───────────────────┼───────────────────┤ │ LTC Engine │ NEEDS_WALLET │ ├───────────────────┼───────────────────┤ │ Relayer │ OK │ ├───────────────────┼───────────────────┤ │ BTC/LTC Orderbook │ OK │ ├───────────────────┼───────────────────┤ │ Daemon │ OK │ └───────────────────┴───────────────────┘
Checking the Orderbook
Since your connection to the Relayer and the BTC/LTC Orderbook is healthy, you can go ahead and check on the activity in the market:
sparkswap orderbook --market btc/ltc
This will show you a live updating view of the current Orderbook for BTC/LTC, which should look something like this:
You'll see updates when new orders are placed, cancelled, or filled. While trading, it's usually advisable to keep the Orderbook open in one window while you issue commands in another.
Setting up wallets
Now that the broker is operational you can now create wallets for your desired currencies and store this information securely. It is important to follow these steps carefully, as Sparkswap nor anyone else can recover your funds stored in your local wallets.
sparkswap CLI, run the following command to create a wallet for a currency:
sparkswap wallet create <currency-symbol>
You will be prompted to type in a password and confirm it.
You will need this password to later unlock your wallet
You should store this password somewhere secure, but close at hand, such as in a password manager. Be sure to include information about what currency it is for and the physical or virtual location of the machine on which the Broker is installed.
If the command was successful, a list of words will be shown on the screen. This list of words is your recovery seed phrase and can be used to recover your wallet funds in the case of computer or software error.
Write down the recovery seed phrase and store it in a secure location, offline, and separate from the password that you provided. Be sure to include information about what currency it is for and the physical or virtual location of the machine on which the Broker is installed.
If you are using the Broker on behalf of a business or other organization, check with your organization for policies and procedures for storing sensitive information.
The recovery seed phrase provides access to all the on-chain currency in your nodes, it is critical that you keep it secure.
Start Engine Syncing
Once you've set up wallets it will kick off the Engines to start syncing with their respective blockchains. If you run:
You should see a status similar to the below:
Sparkswap Healthcheck ┌───────────────────┬───────────────────┐ │ Component │ Status │ ├───────────────────┼───────────────────┤ │ BTC Engine │ NOT_SYNCED │ ├───────────────────┼───────────────────┤ │ LTC Engine │ NOT_SYNCED │ ├───────────────────┼───────────────────┤ │ Relayer │ OK │ ├───────────────────┼───────────────────┤ │ BTC/LTC Orderbook │ OK │ ├───────────────────┼───────────────────┤ │ Daemon │ OK │ └───────────────────┴───────────────────┘
Your engines will remain in this status until they are finished syncing, which will take anywhere from a few hours to a few days depending on your connection, RAM, and processor.
Registering with Sparkswap
While you're waiting for your Engines to sync with their respective blockchains, you should register with Sparkswap. To do this, run:
You will get the following response:
┌─────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ Successfully registered public key with the Ϟ Sparkswap Relayer! │ │ │ │ Go to https://sparkswap.com/register/<yourUniqueIdHere123456> to complete registration. │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────┘
Click on the link provided and follow the steps on the registration web interface to complete your registration. In order to prevent abuse, in some cases registration approval may be delayed, but we will work diligently to try to give you access to Sparkswap as soon as possible.
Since Sparkswap is a non-custodial service, you can deposit funds into your wallet prior to registration completing, but you will not be able to commit funds or submit trades to the Sparkswap Relayer.
Depositing funds into your wallet
Once your Engines are sync'ed, you should fund a wallet by sending funds to a deposit address generated by your Sparkswap daemon. Since Sparkswap is non-custodial, the only access to these funds is through the software that you've installed, or through the recovery seed you created when creating wallets.
To get a BTC deposit address, run:
sparkswap wallet new-deposit-address BTC
To get an LTC deposit address, run:
sparkswap wallet new-deposit-address LTC
For depositing funds on MainNet:
- For adding bitcoin, send the coins to the BTC address generated in the previous step
- For adding litecoin, send the coins to the LTC address generated in the previous step
Committing the balance
Before deposited funds are available for trading they must be committed to the Sparkswap Relayer. They are still in your control, but until you release them, they can be used only for trading on Sparkswap. This is conceptually similar to moving funds into your "exchange account" on a custodial exchange. Run:
sparkswap wallet commit ltc --market BTC/LTC
to commit the funds to a market.
You can also specify an amount:
sparkswap wallet commit ltc 10 --market BTC/LTC
Checking your status
After you've committed your balance to the Sparkswap Relayer, you should check your status in the market you are trading in to see if you have the funds necessary to complete trades.
sparkswap wallet network-status --market BTC/LTC
to see a detailed status of your wallet in the current market.
Market: BTC/LTC ┌──────────────┬────────────────────────┬────────────────────────┐ │ │ BTC Capacity │ LTC Capacity │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Available │ │ │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Buy BTC │ 0.0000380000000000 │ 0.0000000000000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Sell BTC │ 0.1436436500000000 │ 10.0599490000000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Outstanding │ │ │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Buy BTC │ 0.0027057000000000 │ 0.1674101500000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Sell BTC │ 0.1676816500000000 │ 10.0659670000000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Pending │ │ │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Buy BTC │ 0.0000000000000000 │ 0.0000000000000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Sell BTC │ 0.0000000000000000 │ 0.0000000000000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Inactive │ │ │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Buy BTC │ 0.0000000000000000 │ 0.0000000000000000 │ ├──────────────┼────────────────────────┼────────────────────────┤ │ Sell BTC │ 0.0000000000000000 │ 0.0000000000000000 │ └──────────────┴────────────────────────┴────────────────────────┘
BTC Capacity and
LTC Capacity signify our inbound and outbound capacity in BTC and LTC, respectively.
The "Available" capacities show the amount of funds that you have available to trade.
Looking at the row "Sell BTC" in the table above, if you are selling BTC for LTC, the "BTC Capacity" column is the maximum amount of BTC you can sell, and the "LTC Capacity" column is the maximum amount of LTC you can receive in exchange. As an example, the current table tells you that you can sell 0.14 BTC at a maximum limit of 10.05 LTC.
Additionally, looking at the
Buy BTC row tells you that you could buy 0.00038 BTC, however your LTC capacity is at zero. Having no LTC capacity means you are not able to Buy BTC since you have no LTC to pay for it.
Since all trade amounts are in base currency, to determine your maximum trade size based on counter currency capacity you can use the formula:
Base Capacity * Price where
Base Capacity * Price < Counter Capacity. In other words, if you want to trade the entirety of your BTC capacity of 0.14, based on the LTC capacity available of 10.065, you can sell at a price as high as 71.892, since
Price < Counter Capacity / Base Capacity.
The "Outstanding" capacities show the amount of funds that are currently placed in orders on the Sparkswap Relayer.
The "Pending" capacities show the amount of funds that are in the process of being committed. These funds are not available for trades for approximately an hour after commitment, while commitments are confirmed on the blockchain.
The "Inactive" capacities show the amount of funds that are not available for trading because the committed funds are inactive. This is usually an error state. Reach out to firstname.lastname@example.org if you encounter funds in this category.
Placing your first order
Placing a Limit Order
sparkswap buy 0.01 100 --market BTC/LTC
to place a limit order to buy 0.01 BTC at a price of 100 LTC per BTC.
There is a corresponding
sell command as well.
Placing a Market Order
sparkswap buy 0.01 --market BTC/LTC
to place a market order to buy 0.01 BTC.
Note that your order will not complete if there is not enough depth in the market to complete the order right away.