ICX Maker Bot (BTC) #998
izzycsy
announced in
Experimental
Replies: 1 comment
-
On point 3 can you explain how maker accepts an offer. What command to use? It seems nothing happening with command. icx_listhtlcs {"offerTx":"txid"} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For users who would like to test ICX (InterChain Exchange) maker bot independently on their local repository, here’s a guide. For the purpose of this test exercise, Taker (the user), will be interacting with Maker (bot) to perform the transaction.
Before starting the test, ensure that you have:
spv=1
in defi.conf fileAfter testing, since you’re using BTC Maker bot, you should receive BTC token for dBTC. Whereas if you’re using BTC Maker bot, you should receive BTC for dBTC token. Essentially, BTC Maker is selling BTC.
Prerequisite Parameters
Tips:
' '
or" "
, not“ ”
Open
defi.conf
in a Code Editor and retrieve the following parameters:Mac — Go to Folder:
/Users/<username>/.defi/defi.conf
Windows:
C:\Users\<username>\.defi\defi.conf
Check in
defi.conf
that spv is enabled:spv=1
From your DeFi Wallet, retrieve the following parameters:
spv_getnewaddress
in DeFi CLIspv_getaddresspubkey <space> spvAddress
in DeFi CLIRun DeFi Wallet in the background
Prepare the script
bin/defi-cli
orbin/defi-cli.exe
Check that it’s running smoothly by using the prerequisites parameters followed by the command
getblockchaininfo
Example script:
Example output:
To run BTC maker bot
User role: Taker
Type: EXTERNAL
Example script:
1. Get orders
Example output
2. Taker makes an offer from
type: EXTERNAL
outputParameters:
orderTx:
0e77...
from output 1’s"type": EXTERNAL
outputownerAddress: <taker’s DFI address>
amount: less than "amountFROM"
expiry:
240
refers to 240 minutes; 2 hoursExample output
3. After a few minutes, check if maker accepted taker’s offer
Parameters:
txid: from output 2
Example output
4. With the above output, create HTLC (Hashed Timelock Contract) on SPV
Parameters (separate with a space):
Param 1 (the one who receives the BTC): Taker’s
receivePubKey
(spv_getaddresspubkey) from Prerequisite ParametersParam 2: Maker’s
receivePubKey
from output 3Param 3: from output 3, timeout should be less than the order timeout number and larger than 24
Param 4: output 3’s
hash
Example output
5. Check if the balance on BTC HTLC address is the same in Taker’s offer
Parameters (separate with a space):
Param 1:
1
refers to checking one resultParam 2:
htlcScriptAddress
from output 4Example output
6. Submit HTLC to DeFiChain
Parameters:
offerTx: from output 3
amount: from output 2
hash: from output 3
Example output
7. Taker checks constantly if Maker claims the DeFiChain HTLC
Parameters:
offerTx: from output 3
Example output
8. Taker to use seed to claim SPV HTLC (BTC)
Parameters (separate with ):
Param 1:
htlcScriptAddress
from output 4Param 2: Taker’s spvAddress
Param 3:
seed
from output 7Example output
You may check your transaction on Bitcoin Testnet Explorer: https://www.blockchain.com/explorer?view=btc-testnet
Footnote
Beta Was this translation helpful? Give feedback.
All reactions