First Use
Run a healthcheck:
sparkswap 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 │
└───────────────────┴───────────────────┘
Setting up wallets
Once the broker is operational we can now create wallets for your desired currencies and store this information securely.
- From the cli for the broker, 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. If the command was successful, a list of words will be shown to the screen. This list of words is your recovery seed and can be used to recover your wallet funds in the case of computer or software error.
Follow the steps below to ensure that you are properly storing the recovery seed and password securely:
- Write down each item of information and provide enough identification to know which currency it belongs to
- Store the password and recovery passphrase separately
- Password can be stored online in a password manager or other secure location
- Recovery passphrase should be stored offline separate from password in a secure location
Additionally, if you are using the broker on behalf of business needs, check with your organization on policies and procedures for storing sensitive information.
The seed phrase provides access to all the on-chain currency in your nodes, it is critical that you keep it secure.
Unlocking a Wallet
In general, there will be instances where the broker will need to be restarted, or instances where the broker has gone down but no data loss has occurred. When these instances occur, the broker will need to have its wallets unlocked, in order for the broker function. This unlocking involves using the password that was determined during the creation of a wallet on the broker.
You will know you are in this state if you run a healthcheck and observe the following:
sparkswap healthcheck
Sparkswap Healthcheck
┌───────────────────┬───────────────────┐
│ Component │ Status │
├───────────────────┼───────────────────┤
│ BTC Engine │ LOCKED │
├───────────────────┼───────────────────┤
│ LTC Engine │ LOCKED │
├───────────────────┼───────────────────┤
│ Relayer │ OK │
├───────────────────┼───────────────────┤
│ BTC/LTC Orderbook │ OK │
├───────────────────┼───────────────────┤
│ Daemon │ OK │
└───────────────────┴───────────────────┘
In order to unlock the broker, you will need the passwords for all currencies (currently BTC and LTC).
For each currency you will need to run the following command:
sparkswap wallet unlock <currency-symbol>
This command will prompt you to enter in the wallet's password and will display a confirmation if the action was successful. You can then use sparkswap info <currency-symbol>
to check the status of each engine.
You can run a healthcheck to see that the engines are now unlocked:
sparkswap healthcheck
You should expect to see the following response:
Sparkswap Healthcheck
┌───────────────────┬───────────────────┐
│ Component │ Status │
├───────────────────┼───────────────────┤
│ BTC Engine │ OK │
├───────────────────┼───────────────────┤
│ LTC Engine │ OK │
├───────────────────┼───────────────────┤
│ Relayer │ OK │
├───────────────────┼───────────────────┤
│ BTC/LTC Orderbook │ OK │
├───────────────────┼───────────────────┤
│ Daemon │ OK │
└───────────────────┴───────────────────┘
Depositing funds into your wallet
To fund a wallet you need to get a deposit address and send BTC or LTC to that address.
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
TestNet
For depositing funds on TestNet:
- For adding bitcoin, go to https://testnet.manu.backend.hamburg/faucet, add the BTC wallet address and the amount of coins you would like to add to your wallet. (max of 2 BTC)
- For adding litecoin, go to http://testnet.litecointools.com/, add the LTC wallet address and the amount of coins you would like to add to your wallet. (max of 10 per unique IP)
MainNet
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
Registering with Sparkswap
In order to place and fill orders, you will need to register with Sparkswap. To do this, run:
sparkswap register
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.
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 the balance
Run:
sparkswap wallet balance
to see the balance of your wallet in the supported currencies.
The “committed” balance is what you have available to trade.
Streaming the orderbook
Run:
sparkswap orderbook --market BTC/LTC
to get a live view of the orderbook.
I usually keep this running in a separate window while I do other commands.
Placing your first order
Placing a Limit Order
Run:
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
Run:
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.