Like any exchange/auction, before you can start trading, you'll need an account! Accounts in the Pool are actually special on-chain contracts. A user deposits a certain amount of funds into an account which has a set expiry. By having users commit funds to an account in order to place orders, we ensure that they're unable to spoof orders \(placing an order that they can't fulfill\). We also add a cost to attempting to sybil attack the venue as well.
This script resembles certain two-factor wallets with a time-lock escape clause. The second clause ensures that users are able to move their funds if the auctioneer is unavailable.
As an account is just a UTXO, anytime a batch is cleared in the auction \(market made, channels bought+sold\), your account is spent, and re-created in the same transaction. This applies to other actions like
Creating an account has two parameters: the size of the account, and the expiry of an account. As you'll see below, both values can be adjusted at any time.
It's also possible to specify a _relative_ account expiry based on the current best block with the `--expiry_blocks` argument. As an example, if I wanted my account to expiry in 2 weeks, I would pass: `--expiry_blocks=2016`.
Here I created an account with 0.5 BTC, that'll expire at height `1773394`. The response shows that it's now pending open \(unconfirmed\), my `trader_key` \(used to sign orders\), and the outpoint of my new account.
We can add more funds to an account using the `pool accounts deposit` command. Under the hood, we can actually batch _other_ transactions with account modifications \(make other payments, etc\), but for now we expose only the basic functionality over the CLI.
I specify my `trader_key` explicitly, as it's possible for `poold` to manage _multiple_ accounts. The response shows my modified account, alongside with the `txid` that'll be used to service the deposit. Once this transaction has confirmed, I'll be able to use my account again.
Note that these funds came from the backing `lnd` node that `poold` is connected to. At a future time we also plan to support a traditional _deposit_ address as well.
Incrementally _withdrawing_ from an account is also supported. The command is similar to the deposit command. If I wanted to extract that 1 million from that account \(let's say it's my profit for the past week\) and send elsewhere, I can do so with the following command:
Finally, if you wish to send _all_ your funds elsewhere, it's possible to close your account out before the main expiration period. We can close out the account we created above with the following command: