ICX Maker Bot (dBTC) #996
izzycsy
announced in
Experimental
Replies: 0 comments
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 dBTC Maker bot, you should receive dBTC token for BTC. Whereas if you’re using BTC Maker bot, you should receive BTC for dBTC token. Essentially, dBTC Maker is selling dBTC.
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 dBTC maker bot
User role: Taker
Type: INTERNAL
Example script:
1. Get orders
Example output
2. Taker makes an offer from
type: INTERNAL
outputParameters:
orderTx:
fe87…
from output 1’s"type": INTERNAL
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): Maker’s
receivePubKey
from output 1Param 2: Taker’s
receivePubKey
(spv_getaddresspubkey) from Prerequisite ParametersParam 3: timeout should be less than the order timeout number and larger than 24
Param 4: output 3’s
hash
Example output
5. Fund SPV HTLC address from output 4
Parameters (separate with a space):
Param 1:
htlcScriptAddress
from output 4Param 2:
amount
from output 2Example output
6. Submit external HTLC to DeFiChain
Parameters:
offerTx: from output 3
hash: from output 3
amount: from output 2
htlcScriptAddress: from output 4
ownerPubKey: Taker’s
receivePubKey
(spv_getaddresspubkey) from Prerequisite Parameterstimeout: same as output 4
Example output
7. Taker checks constantly if Maker claims the SPV HTLC
Parameters (separate with a space):
Param 1:
htlcScriptAddress
from output 4Example output
8. Taker to use seed to claim DeFiChain HTLC
Parameters:
dfchtlcTx:
2afa...
from output 3; the string of numbers before"type": "DFC"
seed: from output 7
Example output
You may check your transaction on DeFiChain Testnet Explorer: https://testnet.defichain.io/#/DFI/testnet/home
Footnote
Beta Was this translation helpful? Give feedback.
All reactions