Skip to content

Eunos testnet test logs

Ahmed Hilali edited this page May 25, 2021 · 29 revisions

Logs for Eunos testnet testings.

Test status

  • ICX & Atomic swap
  • New emission rate and foundation destruction
  • Oracle
  • Burn tracking
  • Lazy block reward calc and faster block sync, esp. on DEX rewards
  • Merkle root change
  • Chainsplit bug fix
  • Difficulty adjustment
  • Mainnet sync

ICX and atomic swap

@Mixa84

Maker node:
    BTC
    - address: tb1qjylylhy863jwpymkd0hxh7y7gc0y42j8w7v3kf
    - pubkey: 03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843

    DFC
    - address: 75zwRPznMN6De5tDyKgetBETet2KmDZBKN

Taker node:
    BTC
    - address: tb1q8md8lmk838yuade7ac4zuvzxd05nsgzc8w0ccm
    - pubkey: 0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5

    DFC
    - address: 7EwwohgHcKtzxR818A1D3aqh8sVnjvmguH


Maker Node balance:
    DFI: 110.00000141
    BTC: 0.01101700

Taker Node balance:
    DFI: 0.99999434
    BTC: 0.00096980

Scenario 1 - DFI/BTC:
    - Maker node create order: ./defi-cli -testnet icx_createorder '{"ownerAddress":"75zwRPznMN6De5tDyKgetBETet2KmDZBKN","tokenFrom":"DFI","chainTo":"BTC","amountFrom":"9","orderPrice":"0.0001","receivePubkey":"03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843"}'
        327de66afa00a5b9f75beb058daa7f594f550d9a973b2cb20e2584092d3564dc
        Balance - 10 = 101.00000141
    - Taker node make offer: ./defi-cli -testnet icx_makeoffer '{"orderTx":"327de66afa00a5b9f75beb058daa7f594f550d9a973b2cb20e2584092d3564dc","amount":0.0009,"ownerAddress":"7EwwohgHcKtzxR818A1D3aqh8sVnjvmguH","expiry":200}'
        cbda7b214fc46b87a4c60fdf96ff32149fd9c6ef354e91ef0c42454cd469afa0
        Balance - 0.00000518 = 0.99998916
    - Maker node generate seed and hash:
        f75a61ad8f7a6e0ab701d5be1f5d4523a9b534571e4e92e0c4610c6a6784ccef
        957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220
    - Maker node submit DFC HTLC: ./defi-cli -testnet icx_submitdfchtlc '{"offerTx":"cbda7b214fc46b87a4c60fdf96ff32149fd9c6ef354e91ef0c42454cd469afa0","hash":"957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220","amount":9,"timeout":500}'
        37d35b1760c17c3775aedd66ad6f16fd57082d8a8a28cb299e267b1b9e2af191
        Balance - 9 - 0.00000518 (makerDeposit) = 100.99999623
    - Taker node verify DFC HTLC:  ./defi-cli -testnet icx_listhtlcs '{"offerTx":"cbda7b214fc46b87a4c60fdf96ff32149fd9c6ef354e91ef0c42454cd469afa0"}'
    - Taker node create BTC HTLC: ./defi-cli -testnet spv_createhtlc 03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843 0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5 15 957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220
        {
        "address": "2N79hz6UZ1rH2J3eMpQomRbkMw71ZtvTD1n",
        "redeemScript": "63a820957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220882103d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843675fb275210348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a568ac"
        }
    - Taker node fund BTC HTLC: ./defi-cli -testnet spv_sendtoaddress "2N79hz6UZ1rH2J3eMpQomRbkMw71ZtvTD1n" 0.0009
        1adc8b32e16899425ba9ce98b50fa430af8afaf1de16ab1a8d072af0cdb56920 (BTC tx)
    - Taker node submit EXT HTLC: ./defi-cli -testnet icx_submitexthtlc '{"offerTx":"cbda7b214fc46b87a4c60fdf96ff32149fd9c6ef354e91ef0c42454cd469afa0","hash":"957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220","amount":"0.0009","htlcScriptAddress":"2N79hz6UZ1rH2J3eMpQomRbkMw71ZtvTD1n","ownerPubkey":"0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5","timeout":15}'
        b9b8a629d3c733e2ee21af4e448c95619b4f67e2863b56353a38aa33d59afb37
    - Maker node recreates BTC HTLC: ./defi-cli -testnet spv_createhtlc  03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843 0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5 15 957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220
        {
        "address": "2N79hz6UZ1rH2J3eMpQomRbkMw71ZtvTD1n",
        "redeemScript": "63a820957fc0fd643f605b2938e0631a61529fd70bd35b2162a21d978c41e5241a5220882103d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843675fb275210348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a568ac"
        }
    - Maker node claim BTC HTLC: ./defi-cli -testnet spv_claimhtlc "2N79hz6UZ1rH2J3eMpQomRbkMw71ZtvTD1n" "tb1qjylylhy863jwpymkd0hxh7y7gc0y42j8w7v3kf" "f75a61ad8f7a6e0ab701d5be1f5d4523a9b534571e4e92e0c4610c6a6784ccef"
        6d1fad6ff38f77bb2fa2bc41882cdb9be6b299318ad0896cd911f26353533aff (BTC txid)
        BTC Balance + 0.00086990 = 0.01188690
        DFI Balance + 0.00000518 + 0.00000518 * 0.25 = 101.00000270
    - Taker node get seed from claim BTC HTLC: ./defi-cli -testnet spv_gethtlcseed "2N79hz6UZ1rH2J3eMpQomRbkMw71ZtvTD1n"
        f75a61ad8f7a6e0ab701d5be1f5d4523a9b534571e4e92e0c4610c6a6784ccef
    - Taker node claims DFC HTLC: ./defi-cli -testnet icx_claimdfchtlc '{"dfchtlcTx":"37d35b1760c17c3775aedd66ad6f16fd57082d8a8a28cb299e267b1b9e2af191","seed":"f75a61ad8f7a6e0ab701d5be1f5d4523a9b534571e4e92e0c4610c6a6784ccef"}'
        e4da71e5dc326068c97c6f623db9895368b1295d788e28ad9bfda85f91b3719a
        Balance + 9 = 9.99998916


Maker Node balance:
    DFI: 100
    BTC: 0.01202931

Taker Node balance:
    DFI: 11
    BTC: 0.0

Scenario 2 - BTC/DFI:

    - MN node create order: ./defi-cli -testnet icx_createorder '{"ownerAddress":"75zwRPznMN6De5tDyKgetBETet2KmDZBKN","chainFrom":"BTC","tokenTo":"DFI","amountFrom":"0.001","orderPrice":"10000"}'
        6a57f2ef99431964bcaaec8c957c14cb161e3a44f9840dbb9c490b23a82e44ff
    - Local node make offer: ./defi-cli -testnet icx_makeoffer '{"orderTx":"6a57f2ef99431964bcaaec8c957c14cb161e3a44f9840dbb9c490b23a82e44ff","amount":10,"ownerAddress":"7EwwohgHcKtzxR818A1D3aqh8sVnjvmguH","receivePubkey":"0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5","expiry":200}'
        0107a8d8868486d4aa2c2c1ba20d4bea0c5fc8521ea8cf65224e111ce8890ff6
        Balance - 0.00000566 (takerFee) = 10.99999434
    - MN node BTC create htlc: ./defi-cli -testnet spv_createhtlc 0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5 03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843 40
        {
        "address": "2NFB3d4bhs6ZruMCDzmZ3ucN9hoxRp4QckQ",
        "redeemScript": "63a820f963d8e271fbfbf849fbb63736697de5112849f1edb6c09a87e865548cd8444888210348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5670128b2752103d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc84368ac",
        "seed": "39ff9fafe5c2f27fd438a7e665de677221a7e515c8b3a3140b80ce53e4b45ee2",
        "seedhash": "f963d8e271fbfbf849fbb63736697de5112849f1edb6c09a87e865548cd84448"
        }
    - MN node fund BTC HTLC: ./defi-cli -testnet spv_sendtoaddress "2NFB3d4bhs6ZruMCDzmZ3ucN9hoxRp4QckQ" 0.001
        da299d7f25c2a450cc9b3759d1903572fd9331e38ea0b566d32bc7adb7d1e205 (BTC txid)
    - MN node submit EXT HTLC: /defi-cli -testnet icx_submitexthtlc '{"offerTx":"0107a8d8868486d4aa2c2c1ba20d4bea0c5fc8521ea8cf65224e111ce8890ff6","hash":"f963d8e271fbfbf849fbb63736697de5112849f1edb6c09a87e865548cd84448","amount":0.001,"htlcScriptAddress":"2NFB3d4bhs6ZruMCDzmZ3ucN9hoxRp4QckQ","ownerPubkey":"03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843","timeout":40}'
        3299b1cb44d66548e53bc974c16b18b070559001f0fa2cca7673e3e3f23f9a7c
        Balance - 10 - 0.00000566 (makerDeposit) = 0.99999434
    - Local node verify EXT HTLC:  ./defi-cli -testnet icx_listhtlcs '{"offerTx":"0107a8d8868486d4aa2c2c1ba20d4bea0c5fc8521ea8cf65224e111ce8890ff6"}'
    - Local node submit DFC HTLC: ./defi-cli -testnet icx_submitdfchtlc '{"offerTx":"0107a8d8868486d4aa2c2c1ba20d4bea0c5fc8521ea8cf65224e111ce8890ff6","amount":10,"hash":"f963d8e271fbfbf849fbb63736697de5112849f1edb6c09a87e865548cd84448"}'
        1f1cceabedd221041735bad877af6eea118ad8800a1ff4212367aa9f1e964bb1
        Balance - 10 = 0.99999434
    - MN node verify DFC HTLC:  ./defi-cli -testnet icx_listhtlcs '{"offerTx":"0107a8d8868486d4aa2c2c1ba20d4bea0c5fc8521ea8cf65224e111ce8890ff6"}'
    - MN node claim DFC HTLC: /defi-cli -testnet icx_claimdfchtlc '{"dfchtlcTx":"1f1cceabedd221041735bad877af6eea118ad8800a1ff4212367aa9f1e964bb1", "seed":"39ff9fafe5c2f27fd438a7e665de677221a7e515c8b3a3140b80ce53e4b45ee2"}'
        4aaafac5edac8f903fdab9c3386c6859cba93dc030064e52ec976d1c41243b04
        Balance +10 + 0.00000566 * 0.25 (makerIncentive = takerFee * 0.25) = 110.00000141
    - Local node recreates BTC HTLC: ./defi-cli -testnet spv_createhtlc 0348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5 03d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc843 40 f963d8e271fbfbf849fbb63736697de5112849f1edb6c09a87e865548cd84448
        {
        "address": "2NFB3d4bhs6ZruMCDzmZ3ucN9hoxRp4QckQ",
        "redeemScript": "63a820f963d8e271fbfbf849fbb63736697de5112849f1edb6c09a87e865548cd8444888210348790cb93b203a8ea5ce07279cb209d807b535b2ca8b0988a6f7a6578e41f7a5670128b2752103d1c45cac0ff3d82d36dea71f96c0bf5db9de8a323f36f57f86fb118ec2cdc84368ac",
    - Local node get seed from claim DFC HTLC: ./defi-cli -testnet icx_listhtlcs '{"offerTx":"0107a8d8868486d4aa2c2c1ba20d4bea0c5fc8521ea8cf65224e111ce8890ff6"}'
        39ff9fafe5c2f27fd438a7e665de677221a7e515c8b3a3140b80ce53e4b45ee2
    - Local node claim BTC htlc: ./defi-cli -testnet spv_claimhtlc "2NFB3d4bhs6ZruMCDzmZ3ucN9hoxRp4QckQ" "tb1q8md8lmk838yuade7ac4zuvzxd05nsgzc8w0ccm" "39ff9fafe5c2f27fd438a7e665de677221a7e515c8b3a3140b80ce53e4b45ee2"
        {
        "txid": "da084b0ac5a1e527bdf570557037bbb757383d72edcf5818ae6afdd474fe91ee",
        "sendmessage": "Success"
        }
        BTC Balance +0.00096980

@monstrobishi

Seed/Hash generated: 829a2c735ce34675e79b930ab6169e199ec05e440f52165b879413b787803a15/b2fa8cca3f26ff7fa13910f451aba904dd545fb45c07fa55b9ad4673d63a8851
√ Completed: utxostoaccount, 'utxostoaccount', [{ [ownerAddress]: '100@0' }]
"c317ef924073cde0baf4d11b8f0feccf5792db1edf32e39c09a9b85765946db7"
√ Tx id: c317ef924073cde0baf4d11b8f0feccf5792db1edf32e39c09a9b85765946db7 confirmed
√ Completed: spv_getnewaddress
New SPV address generated: tb1qu3lshmncuyasyvre2u9zljw5yvl834kl6q0nhp
√ Completed: spv_getaddresspubkey
√ Completed: icx_createorder, 'icx_createorder',  [{"tokenFrom": 0, "chainTo":"BTC","ownerAddress": ownerAddress,"amountFrom":30,"orderPrice":0.1,"expiry":1000, "receivePubkey": spvReceiverPubKey}]
"8d76991d61eb4c5c165291733b494c32156c9434909108732c8b304ce99f21d9"
√ Tx id: 8d76991d61eb4c5c165291733b494c32156c9434909108732c8b304ce99f21d9 confirmed
√ Completed: getnewaddress
New address generated: tpFdjDkwLRgSFXuZ91oWaHkV2eHoHR2byW
√ Completed: utxostoaccount, 'utxostoaccount', [{ [newAddress]: '100@0' }]
"52c14801c5469e3e1a5ae25d6343fb35c01a64700d1259b99739b2bf7edb66c9"
√ Tx id: 52c14801c5469e3e1a5ae25d6343fb35c01a64700d1259b99739b2bf7edb66c9 confirmed
√ Completed: getaddressinfo
√ Completed: icx_makeoffer, 'icx_makeoffer',  [{"orderTx": orderTxId,"amount": 1,
        "receiveAddress": newAddress, "ownerAddress": newAddress}]
"f22fbc3130e7abf9c2cfdf77363b54f02d1458cc834eb21ec268e08bc90864ae"
√ Tx id: f22fbc3130e7abf9c2cfdf77363b54f02d1458cc834eb21ec268e08bc90864ae confirmed
√ Completed: icx_submitdfchtlc, 'icx_submitdfchtlc',  [{"offerTx": offerTxId, "amount": 10, 
        "hash": hash, "receiveAddress": newAddress, "receivePubkey": newAddressPubKey, "timeout": dfcHtlcTimeout}]
"b2ea442ce5efeb552b19d5fc8ed201a423ad045774c71aaeb41577dbb6bccdfa"
√ Tx id: b2ea442ce5efeb552b19d5fc8ed201a423ad045774c71aaeb41577dbb6bccdfa confirmed
√ Completed: spv_getaddresspubkey
spvReceiverPubKey: 033bd0838f29138a36e4ba489af0cbca9b77c4afb410e504bde3ccf67112b44679
spvSenderPubKey: 03d02411b064afaf5b908b17f72da679473b26438683316cbf2c94f969b192228c
√ Completed: spv_syncstatus
√ Completed: spv_createhtlc, 'spv_createhtlc', [spvReceiverPubKey, spvSenderPubKey, `${extHtlcTimeout}`, hash]
√ SPV tx submitted
SPV HTLC info: {"address":"2N1y4qknNeWGd8A5qSARj8aTSxkfapLmQjE","redeemScript":"63a820b2fa8cca3f26ff7fa13910f451aba904dd545fb45c07fa55b9ad4673d63a88518821033bd0838f29138a36e4ba489af0cbca9b77c4afb410e504bde3ccf67112b44679675fb2752103d02411b064afaf5b908b17f72da679473b26438683316cbf2c94f969b192228c68ac"}
√ Completed: spv_syncstatus
√ SPV tx submitted
√ Completed: spv_listhtlcoutputs
SPV HTLC outputs: {
  "result": [
    {
      "txid": "9ddcaa2d0be4dfec7e0ec91c2ae6e6308d0600cc7be8c7a674d472e6bd84d09b",
      "vout": 0,
      "amount": 0.00002,
      "address": "2N1y4qknNeWGd8A5qSARj8aTSxkfapLmQjE",
      "confirms": 0
    }
  ],
  "error": null,
  "id": "rpctest"
}
√ Completed: icx_submitexthtlc, 'icx_submitexthtlc', [{"offerTx": offerTxId, "amount": 1, 
        "htlcScriptAddress": spvHtlcInfo.address, "hash": hash, "ownerPubkey": spvReceiverPubKey, 
        "timeout": extHtlcTimeout}]
"8b17516e0df8c4e1046df74150e531df45f5d8c0c55983f84ec7934c882fe509"
√ Tx id: 8b17516e0df8c4e1046df74150e531df45f5d8c0c55983f84ec7934c882fe509 confirmed
√ Completed: icx_listhtlcs
HTLC list: {
  "WARNING": "ICX and Atomic Swap are experimental features. You might end up losing your funds. USE IT AT YOUR OWN RISK.",
  "b2ea442ce5efeb552b19d5fc8ed201a423ad045774c71aaeb41577dbb6bccdfa": {
    "type": "DFC",
    "status": "OPEN",
    "offerTx": "f22fbc3130e7abf9c2cfdf77363b54f02d1458cc834eb21ec268e08bc90864ae",
    "amount": 10,
    "amountInEXTAsset": 1,
    "hash": "b2fa8cca3f26ff7fa13910f451aba904dd545fb45c07fa55b9ad4673d63a8851",
    "timeout": 500,
    "height": 429662,
    "refundHeight": 430162
  },
  "8b17516e0df8c4e1046df74150e531df45f5d8c0c55983f84ec7934c882fe509": {
    "type": "EXTERNAL",
    "status": "OPEN",
    "offerTx": "f22fbc3130e7abf9c2cfdf77363b54f02d1458cc834eb21ec268e08bc90864ae",
    "amount": 1,
    "amountInDFCAsset": 10,
    "hash": "b2fa8cca3f26ff7fa13910f451aba904dd545fb45c07fa55b9ad4673d63a8851",
    "htlcScriptAddress": "2N1y4qknNeWGd8A5qSARj8aTSxkfapLmQjE",
    "ownerPubkey": "033bd0838f29138a36e4ba489af0cbca9b77c4afb410e504bde3ccf67112b44679",
    "timeout": 15,
    "height": 429664
  }
}
√ Completed: spv_syncstatus
√ Completed: spv_syncstatus
√ SPV tx submitted
√ Completed: spv_syncstatus
√ Completed: spv_claimhtlc, 'spv_claimhtlc',  [spvHtlcInfo.address, newAddressSpv, seed, 2000]
√ SPV tx submitted
√ Completed: spv_gethtlcseed
Seed retrieved: "829a2c735ce34675e79b930ab6169e199ec05e440f52165b879413b787803a15"
√ Completed: icx_claimdfchtlc, 'icx_claimdfchtlc',  
        [{"dfchtlcTx": htlcTxId, "amount": 0.1, "seed": retrievedSeed}]
"8a05b1b4d544b47e7d4ac3c4129f1eac6123711997fff28f96f4db17da79eecf"
√ Tx id: 8a05b1b4d544b47e7d4ac3c4129f1eac6123711997fff28f96f4db17da79eecf confirmed

https://github.com/DeFiCh/ain/wiki/Interchain-Exchange-Tutorial

New emission rate and foundation destruction

Masternode expected: 134.99983200 Actual: 134.99983200
Community expected: Actual: 19.88746400 Anchor: 0.81008000 Actual: 0.08100800 Incentive: 103.08268000 Actual: 103.08268000 Burnt: 146.98901600 Actual: 146.98901600

Foundation destruction test can be found here: https://github.com/DeFiCh/ain/pull/354/commits/4fa84b22cb94b202df11b49b1ccfedbafb80e101#diff-7027dfec6ecc4a372c487a7f19dac0785f134e08566e0e1d786d223d4d3257e2R27

Oracle

@monstrobishi

√ Completed: appointoracle, 'appointoracle',  [ownerAddress, oracleSetupData, 1]
√ Tx id: fbe2466b51bf1128f839ee662ea6aae3547bde9c8d2dda103946e8c91f65da2f confirmed
√ Completed: setoracledata, [oracleTxId, (new Date().getTime() / 1000), [{"currency":"USD", "tokenAmount":'0.5@TESLA'}]
√ Tx id: fa771c7bdfe8b728b7e5c4f7c3ee2fe577f187f75d690909cbfb314a1de2f193 confirmed
√ Completed: getoracledata
Oracle data: {"weightage":1,"oracleid":"fbe2466b51bf1128f839ee662ea6aae3547bde9c8d2dda103946e8c91f65da2f","address":"76a914ad1eaafdd6edcf2260f28cb31e24117c240681ca88ac","priceFeeds":[{"token":"TESLA","currency":"EUR"},{"token":"TESLA","currency":"USD"}],"tokenPrices":[{"token":"TESLA","currency":"USD","amount":0.5,"timestamp":1621520613682}]}
TESLA Price (Should see 0.5): 0.5
√ Completed: setoracledata, 'setoracledata',  [oracleTxId, ~~(new Date().getTime()), [{"currency":"USD", "tokenAmount":'1.0@TESLA'}]]
√ Tx id: 3832e155938ca1afd3330d1640911f47161c6b0551320a41b2fd3911424089e9 confirmed
√ Completed: getoracledata
Oracle data: {"weightage":1,"oracleid":"fbe2466b51bf1128f839ee662ea6aae3547bde9c8d2dda103946e8c91f65da2f","address":"76a914ad1eaafdd6edcf2260f28cb31e24117c240681ca88ac","priceFeeds":[{"token":"TESLA","currency":"EUR"},{"token":"TESLA","currency":"USD"}],"tokenPrices":[{"token":"TESLA","currency":"USD","amount":1,"timestamp":1621520715217}]}
TESLA Price (Should see 1.0): 1
# No price feeds
defi-cli listprices
[
  {
    "token": "TESLA",
    "currency": "EUR",
    "ok": "no live oracles for specified request"
  },
  {
    "token": "TESLA",
    "currency": "USD",
    "ok": "no live oracles for specified request"
  }
]

√ Completed: appointoracle (weight 1)
√ Tx id: d1248472d78681257637f6cafb6eab9b89f4a64eb8c425208b52258994351d06 confirmed
√ Completed: appointoracle (weight 2)
√ Tx id: 96e02d6b4c3fbd7e5e98a56406689ae90e1eaf747031d6331126527ce9da91dc confirmed
√ Completed: setoracledata ({"currency":"USD", "tokenAmount":"1@TESLA"})
√ Tx id: f43960948fbb3b3e20d8f2b8356d4977a85f85d269f96b2e947ced71503eef87 confirmed
√ Completed: setoracledata ({"currency":"USD", "tokenAmount":"5@TESLA"})
√ Tx id: d8d1a75e0b1dc2e1c3cdb0dcdd43d7f5eb1e9882f65e6bb7577193a785ed7a1a confirmed
√ Completed: listlatestrawprices
{"result":[{"priceFeeds":{"token":"TESLA","currency":"USD"},"oracleid":"d1248472d78681257637f6cafb6eab9b89f4a64eb8c425208b52258994351d06","weightage":1,"timestamp":1621567932,"rawprice":1,"state":"live"},{"priceFeeds":{"token":"TESLA","currency":"USD"},"oracleid":"fbe2466b51bf1128f839ee662ea6aae3547bde9c8d2dda103946e8c91f65da2f","weightage":1,"timestamp":1621520715217,"rawprice":1,"state":"expired"},{"priceFeeds":{"token":"TESLA","currency":"USD"},"oracleid":"f36a9f109f61df195a62ada0366a61051bd5c2f3a843e1e30332a0931bef2891","weightage":2,"timestamp":1621566101157,"rawprice":5,"state":"expired"},{"priceFeeds":{"token":"TESLA","currency":"USD"},"oracleid":"8b2b86fb40f1501bdb88d025ede6fea8a715d90af7ed0ee41fe76ec217409fb4","weightage":1,"timestamp":1621565987540,"rawprice":1,"state":"expired"},{"priceFeeds":{"token":"TESLA","currency":"USD"},"oracleid":"307ad68bcc4a02a8151917d2a57026fe75856474f77e1008896ca31bdfc352d9","weightage":1,"timestamp":1621516112916,"rawprice":1,"state":"expired"},{"priceFeeds":{"token":"TESLA","currency":"USD"},"oracleid":"96e02d6b4c3fbd7e5e98a56406689ae90e1eaf747031d6331126527ce9da91dc","weightage":2,"timestamp":1621568026,"rawprice":5,"state":"live"}],"error":null,"id":"rpctest"}

√ Completed: getprice
{"result":3.66666666,"error":null,"id":"rpctest"}

Price should be: ((1*1(weight))+(5*2(weight)))/3 = 3.66666666

√ Completed: listprices
{"result":[{"token":"TESLA","currency":"EUR","ok":"no live oracles for specified request"},{"token":"TESLA","currency":"USD","price":3.66666666,"ok":true}],"error":null,"id":"rpctest"}
√ Completed: updateoracle

oracleId: 'd1248472d78681257637f6cafb6eab9b89f4a64eb8c425208b52258994351d06',
  weightage: 5,
  pricefeeds: [
    {
      token: 'TESLA',
      currency: 'EUR'
    },
    {
      token: 'TESLA',
      currency: 'JPY'
    },
    {
      token: 'TESLA',
      currency: 'USD'
    }
  ]

√ Tx id: fc3f29d75b9e19e01f550e419651632193e5a90fc94c732c731ea7ec316255be confirmed
√ Completed: removeoracle

oracleId: 'd1248472d78681257637f6cafb6eab9b89f4a64eb8c425208b52258994351d06'

√ Tx id: d2836ce3b40375f7135c9514368421d5c58009439d150e6322e1ed504ef62236 confirmed
'setoracledata',  [oracleTxId, (new Date().getTime() / 1000 - 2), [{"currency":"USD", "tokenAmount":`${3.0}@TESLA`}]]
'setoracledata',  [oracleTxId, (new Date().getTime() / 1000 - 1), [{"currency":"USD", "tokenAmount":`${6.0}@TESLA`}]]
'setoracledata',  [oracleTxId, (new Date().getTime() / 1000), [{"currency":"USD", "tokenAmount":`${9.0}@TESLA`}]]

√ Completed: listlatestrawprices
List raw prices: [
    {
        "priceFeeds": {
            "token": "TESLA",
            "currency": "USD"
        },
        "oracleid": "cc39e5c6132fa73b3e025a74f10918c04894d9770c229508bfaa4b1d9065ea35",
        "weightage": 1,
        "timestamp": 1621943594,
        "rawprice": 9,
        "state": "live"
    }
]
√ Completed: listprices
List prices: [
    {
        "token": "BTC",
        "currency": "EUR",
        "ok": "no live oracles for specified request"
    },
    {
        "token": "BTC",
        "currency": "USD",
        "ok": "no live oracles for specified request"
    },
    {
        "token": "ETH",
        "currency": "EUR",
        "ok": "no live oracles for specified request"
    },
    {
        "token": "ETH",
        "currency": "USD",
        "ok": "no live oracles for specified request"
    },
    {
        "token": "TESLA",
        "currency": "EUR",
        "ok": "no live oracles for specified request"
    },
    {
        "token": "TESLA",
        "currency": "USD",
        "price": 9,
        "ok": true
    }
]
√ Completed: getoracledata
Oracle data: {
    "weightage": 1,
    "oracleid": "cc39e5c6132fa73b3e025a74f10918c04894d9770c229508bfaa4b1d9065ea35",
    "address": "76a914c52fcb3c6dd28e530e5d162fee41f235bf7709cd88ac",
    "priceFeeds": [
        {
            "token": "TESLA",
            "currency": "EUR"
        },
        {
            "token": "TESLA",
            "currency": "USD"
        }
    ],
    "tokenPrices": [
        {
            "token": "TESLA",
            "currency": "USD",
            "amount": 9,
            "timestamp": 1621943594
        }
    ]
}

Burn tracking

./src/defi-cli getburninfo { "address": "7DefichainBurnAddressXXXXXXXdMUE5n", "amount": 10.00000000, "tokens": [ "100.00000000@DDD#179" ], "feeburn": 8050.00000000 }

./src/defi-cli listcommunitybalances { "AnchorReward": 8392.60537600, "IncentiveFunding": 3433505.56262100, "Burnt": 429501.90475200 }

Lazy block reward calc and faster block sync

Lazy block reward calc

./src/defi-cli -testnet -rpcuser="test" -rpcpassword="test" getblockchaininfo
{
  "chain": "test",
  "blocks": 431237,
  "headers": 431237,
  "bestblockhash": "349641c3615800761d5512b381a4c5ae232d4fe5e3be68277b8d700c29766825",
  "difficulty": 4578500.520773039,
  "mediantime": 1621564641,
  "verificationprogress": 0.9999981758780364,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000000001677048b0a05cf257a8",
  "size_on_disk": 220004641,
  "pruned": false,
  "softforks": {
    "bip34": {
      "type": "buried",
      "active": true,
      "height": 0
    },
    "bip66": {
      "type": "buried",
      "active": true,
      "height": 0
    },
    "bip65": {
      "type": "buried",
      "active": true,
      "height": 0
    },
    "csv": {
      "type": "buried",
      "active": true,
      "height": 1
    },
    "segwit": {
      "type": "buried",
      "active": true,
      "height": 0
    },
    "amk": {
      "type": "buried",
      "active": true,
      "height": 150
    },
    "bayfront": {
      "type": "buried",
      "active": true,
      "height": 3000
    },
    "clarkequay": {
      "type": "buried",
      "active": true,
      "height": 155000
    },
    "dakota": {
      "type": "buried",
      "active": true,
      "height": 220680
    },
    "dakotacrescent": {
      "type": "buried",
      "active": true,
      "height": 287700
    },
    "eunos": {
      "type": "buried",
      "active": true,
      "height": 426800
    }
  },
  "warnings": ""
}

./src/defi-cli -testnet -rpcuser="test" -rpcpassword="test" getpoolpair 3
{
  "3": {
    "symbol": "DFI-BTC",
    "name": "Default Defi token-",
    "status": true,
    "idTokenA": "0",
    "idTokenB": "1",
    "reserveA": 1197135.33103208,
    "reserveB": 623379.23787251,
    "commission": 0.00200000,
    "totalLiquidity": 105771.79012346,
    "reserveA/reserveB": 1.92039653,
    "reserveB/reserveA": 0.52072578,
    "tradeEnabled": true,
    "ownerAddress": "7Q2nZCcKnxiRiHSNQtLB27RA5efxm2cE7w",
    "blockCommissionA": 0.00000000,
    "blockCommissionB": 0.00000000,
    "rewardPct": 0.85000000,
    "customRewards": [
      "10.00000000@1"
    ],
    "creationTx": "b2bb09ffe9f9b292f13d23bafa1225ef26d0b9906da7af194c5738b63839b235",
    "creationHeight": 18145
  }
}


./src/defi-cli -testnet -rpcuser="test" -rpcpassword="test" listpoolshares {} true true
{
  "3@7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS": {
    "poolID": "3",
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "%": 0,
    "amount": 833.90356556,
    "totalLiquidity": 105771.79012346
  },
  "9@7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS": {
    "poolID": "9",
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "%": 24,
    "amount": 10.21070861,
    "totalLiquidity": 41.68515776
  }
}


/src/defi-cli -testnet -rpcuser="test" -rpcpassword="test" listaccounthistory 7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS
[
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431248,
    "blockHash": "e5cb3d2b5a5845f85a2ae7a0baaf248a058967d7c0d643f7bbba49799d015bb8",
    "blockTime": 1621565178,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431248,
    "blockHash": "e5cb3d2b5a5845f85a2ae7a0baaf248a058967d7c0d643f7bbba49799d015bb8",
    "blockTime": 1621565178,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431247,
    "blockHash": "a9f6510e7291c60a962b04a9531250b8a5513342dab87e11a5e1fdea7cf5ae33",
    "blockTime": 1621565162,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431247,
    "blockHash": "a9f6510e7291c60a962b04a9531250b8a5513342dab87e11a5e1fdea7cf5ae33",
    "blockTime": 1621565162,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431246,
    "blockHash": "7942673c62f1d1e57af408f7ab318d4afc2c1e130dd8640ccb317de0389df049",
    "blockTime": 1621565146,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431246,
    "blockHash": "7942673c62f1d1e57af408f7ab318d4afc2c1e130dd8640ccb317de0389df049",
    "blockTime": 1621565146,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431245,
    "blockHash": "a729a3d0817e71db8468fe3c1aeb582ba6f64d07e4e6fa3ffc10afbc0215bbc8",
    "blockTime": 1621565093,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431245,
    "blockHash": "a729a3d0817e71db8468fe3c1aeb582ba6f64d07e4e6fa3ffc10afbc0215bbc8",
    "blockTime": 1621565093,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431244,
    "blockHash": "9a9aa84bbe59a8a47fb203df2e7d07a0face93b9bd79090e6418721403b45d46",
    "blockTime": 1621565004,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431244,
    "blockHash": "9a9aa84bbe59a8a47fb203df2e7d07a0face93b9bd79090e6418721403b45d46",
    "blockTime": 1621565004,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431243,
    "blockHash": "448992c75661e8b4e226930c6ebaf28c1734c8a05569b540751767510e8d3e91",
    "blockTime": 1621564975,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431243,
    "blockHash": "448992c75661e8b4e226930c6ebaf28c1734c8a05569b540751767510e8d3e91",
    "blockTime": 1621564975,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431242,
    "blockHash": "f529c3f5934813561328fcf32fce047057896fb890e4e36d72361dfa23364b2b",
    "blockTime": 1621564973,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431242,
    "blockHash": "f529c3f5934813561328fcf32fce047057896fb890e4e36d72361dfa23364b2b",
    "blockTime": 1621564973,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431241,
    "blockHash": "61aaf68dad030f15099cea3ee1c1a619cfa65a5a323e57cb027b6df430178cf1",
    "blockTime": 1621564946,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431241,
    "blockHash": "61aaf68dad030f15099cea3ee1c1a619cfa65a5a323e57cb027b6df430178cf1",
    "blockTime": 1621564946,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431240,
    "blockHash": "8bcf931e52748e3b579af4b3e81f2ca59b6ab6ae76e56d2615ed170748561525",
    "blockTime": 1621564873,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431240,
    "blockHash": "8bcf931e52748e3b579af4b3e81f2ca59b6ab6ae76e56d2615ed170748561525",
    "blockTime": 1621564873,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431239,
    "blockHash": "7a6c3061f3dc09f9fad97a5bed492b22eaf2cdab4f36bba64677ab3f882c757c",
    "blockTime": 1621564825,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431239,
    "blockHash": "7a6c3061f3dc09f9fad97a5bed492b22eaf2cdab4f36bba64677ab3f882c757c",
    "blockTime": 1621564825,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431238,
    "blockHash": "727b6993709933515e29ba1440658ff61be449082a1f95de9559cc0af5e55eed",
    "blockTime": 1621564745,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431238,
    "blockHash": "727b6993709933515e29ba1440658ff61be449082a1f95de9559cc0af5e55eed",
    "blockTime": 1621564745,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.07883988@BTC"
  },
  {
    "owner": "7Jw72Q9yGJ1UWCXdQcUwkwSX48mkvdV2sS",
    "blockHeight": 431237,
    "blockHash": "349641c3615800761d5512b381a4c5ae232d4fe5e3be68277b8d700c29766825",
    "blockTime": 1621564721,
    "type": "Rewards",
    "poolID": "3",
    "amounts": "0.00023986@DFI"
  }
]


./src/defi-cli -testnet -rpcuser="test" -rpcpassword="test" getgov LP_SPLITS
{
  "LP_SPLITS": {
    "3": 0.85000000,
    "4": 0.10000000,
    "6": 0.05000000
  }
}

./src/defi-cli -testnet -rpcuser="test" -rpcpassword="test" getgov LP_DAILY_DFI_REWARD
{
  "LP_DAILY_DFI_REWARD": 103.08268000
}

CustomReward = 10 @ 1
MyPoolShare = my_liquidity / total_liquidity = 0.0078839883922419
My Custom reward every block = MyPoolShare * CustomReward = 0.0078839883922419 * 10 @ 1 = 0.07883988 @ 1  // It is correct.

Daily reward = LP_DAILY_DFI_REWARD * rewardPct / blocks_per_day * my_liquidity / total_liquidity

blocksPerDay = 60 * 60 * 24 / pos.nTargetSpacing = 60 * 60 * 24 / 30 = 2880

BlockReward = 103.08268000 * 0.85 / blocksPerDay * 0.0078839883922419 = 0.00023986  // It is correct

Conclusion: Custom reward and block reward result are correct.

Merkle root change

Chainsplit bug fix

Chain split was fixed pre-fork, the issue is demonstrated to be fixed in the test here. The error was due to incorrect coin-age being calculated for a competing blocks from the same MN but with a different hash, the first block spotted would wipe the coin-age, the fix is not to get the last block time for the current block, but the last one before that.

https://github.com/DeFiCh/ain/pull/380/files#diff-683eb0ee6bb2a60de22eca637cb23c69f6b0efccd5d835e25d9a4a30f8bbf07d

Difficulty adjustment

426799 diff 1a2ad380 426800 diff 1a0ab4e0 - Hard fork 427807 diff 1a0ab4e0 - End of first range 427808 diff 1a0a1245 - Change after 1,008 blocks 428815 diff 1a0a1245 - End of second range 428816 diff 1a040a34 - Change after 1,008 blocks

Time difference between block 426,800 and 431,517 (4,717 blocks) is 25.12 seconds per block.

Merkle root fix

Masternode record key: 587236B5D3A80AF92BCA4F5C1EDEBA7E06180AD58929EFFB84A0C4D7838C9D2F31FFF97113, value: 0000000000000000

Regularnode record key: 587236B5D3A80AF92BCA4F5C1EDEBA7E06180AD58929EFFB84A0C4D7838C9D2F31FFF97113, value: 077BA66000000000

Calculating merkle root by masternode was missing block time, since in testnet time is mocked we does not encounter the issue.

Mainnet sync

Passes. Synced to the latest block. Datadir size is 40GB on an empty wallet. Post-hardfork should be more storage efficient.