Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARRR integration #1188

Closed
artemii235 opened this issue Aug 12, 2021 · 11 comments · Fixed by #1775
Closed

ARRR integration #1188

artemii235 opened this issue Aug 12, 2021 · 11 comments · Fixed by #1775
Assignees
Labels
Coin Addition custom coins P1 Major issue needs to be fixed

Comments

@artemii235
Copy link
Member

artemii235 commented Aug 12, 2021

It works in native mode only now.

  1. Coins config: https://github.com/KomodoPlatform/coins/pull/303/files
  2. MM2 build: latest from http://195.201.0.6/mm2.1-slp-swap/
  3. It also requires http://195.201.0.6/ARRR_CACHE.db to be placed in the MM2 working directory.
  4. Enable command: curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"enable\",\"coin\":\"ARRR\"}"
  5. No tx history is available now.
  6. Block explorer link https://pirate.explorer.dexstats.info/
  7. PIRATE daemon is required to run and be fully synced before coin activation in the GUI.

Please consider this as very early alpha/PoC. It requires the checklist from KomodoPlatform/komodo-defi-framework#927 to be implemented to avoid linking different swaps between each other, etc.

Activation time is about 20 seconds. Withdraw can take minutes depending on the transaction size.

@artemii235
Copy link
Member Author

artemii235 commented May 10, 2022

Updates on the integration status:

Activation and withdraw are implemented using 2.0 RPC protocol https://developers.atomicdex.io/basic-docs/atomicdex-api-20-dev/#atomicdex-api-rpc-protocol-v2-0-dev. It might be required to integrate it's generic structure first.

  1. Branch https://github.com/KomodoPlatform/atomicDEX-API/tree/arrr-light-mode-swap is usable to activate ZOMBIE and PIRATE in light mode.
  2. Please note that even light mode requires Sapling params files have to be downloaded even for light mode (./zcutil/fetch_params.sh/bat from either Zcash or Komodo).
  3. ZOMBIE conf:
{
  "coin":"ZOMBIE",
  "asset":"ZOMBIE",
  "txversion":4,
  "overwintered":1,
  "mm2":1,
  "protocol":{
    "type":"ZHTLC",
    "protocol_data":{
      "consensus_params":{
        "overwinter_activation_height":0,
        "sapling_activation_height":1,
        "blossom_activation_height":null,
        "heartwood_activation_height":null,
        "canopy_activation_height":null,
        "coin_type":133,
        "hrp_sapling_extended_spending_key":"secret-extended-key-main",
        "hrp_sapling_extended_full_viewing_key":"zxviews",
        "hrp_sapling_payment_address":"zs",
        "b58_pubkey_address_prefix":[
          28,
          184
        ],
        "b58_script_address_prefix":[
          28,
          189
        ]
      }
    }
  },
  "required_confirmations":1
}

For PIRATE, it should be the same, except overwinter_activation_height and sapling_activation_height fields. Please also use "requires_notarization":true.

  1. enable/electrum won't work for ZHTLC protocol. GUI has to use init_z_coin call https://github.com/KomodoPlatform/atomicDEX-API/blob/28749e38e22137c64a025d348bae22db4e33d3c3/mm2src/common/for_tests.rs#L1308 that will return task_id, which then should be used in init_z_coin_status: https://github.com/KomodoPlatform/atomicDEX-API/blob/28749e38e22137c64a025d348bae22db4e33d3c3/mm2src/common/for_tests.rs#L1333
  2. From init_z_coin_status GUI will get following responses:
{
  "mmrpc":"2.0",
  "result":{
    "status":"InProgress",
    "details":"ActivatingCoin"
  },
  "id":null
}
{
  "mmrpc":"2.0",
  "result":{
    "status":"InProgress",
    "details":"Scanning"
  },
  "id":null
}
{
  "mmrpc":"2.0",
  "result":{
    "status":"Ready",
    "details":{
      "result":{
        "current_block":90728,
        "wallet_balance":{
          "wallet_type":"Iguana",
          "address":"zs1g6z7dcfp5wg085fuzqlauf8d85ct4hke7xmwxe0djnq48909yfsj66hzj0fjgfgzynddud8n04g",
          "balance":{
            "spendable":"1",
            "unspendable":"0"
          }
        }
      }
    }
  },
  "id":null
}

@artemii235
Copy link
Member Author

ZOMBIE electrum_servers:

[{"url":"zombie.sirseven.me:10033"}]

ZOMBIE light_wallet_d_servers

["http://zombie.sirseven.me:443"]

PIRATE electrum_servers:

[{"url":"pirate.sirseven.me:10032"}]

PIRATE light_wallet_d_servers

["http://pirate.sirseven.me:443"]

cc @smk762 @tonymorony @SylEze

@artemii235
Copy link
Member Author

Error example:

{
  "mmrpc":"2.0",
  "result":{
    "status":"Ready",
    "details":{
      "error":"Error on platform coin ZOMBIE creation: ZCashParamsNotFound",
      "error_path":"lib.z_coin_activation.z_coin",
      "error_trace":"lib:93] z_coin_activation:171] z_coin:685]",
      "error_type":"CoinCreationError",
      "error_data":{
        "ticker":"ZOMBIE",
        "error":"ZCashParamsNotFound"
      }
    }
  },
  "id":null
}

This enum contains all possible error variants: https://github.com/KomodoPlatform/atomicDEX-API/blob/28749e38e22137c64a025d348bae22db4e33d3c3/mm2src/coins_activation/src/standalone_coin/init_standalone_coin_error.rs#L16

@artemii235
Copy link
Member Author

UPD MM2 binaries are available for ZOMBIE/ARRR light mode here: http://195.201.0.6/arrr-light-mode-swap/. Please note that native doesn't work there anymore, as it requires some refactoring 🙂

I have also created a new branch for this with a more reasonable name: https://github.com/KomodoPlatform/atomicDEX-API/tree/arrr-light-mode-swap (updated in the initial message).

cc @tonymorony @SylEze @smk762

@tonymorony tonymorony added the P1 Major issue needs to be fixed label May 13, 2022
@smk762 smk762 mentioned this issue May 17, 2022
23 tasks
@smk762 smk762 self-assigned this May 17, 2022
@smk762
Copy link
Collaborator

smk762 commented May 18, 2022

@artemii235 can we please include the coin in init_z_coin_status response? Existing code in desktop gui looks for that in response when enabling coins.

e.g.

{
   "mmrpc":"2.0",
    "result": {
        "status": "Ready", 
        "details": {
            "result":{
                 "coin": "COIN_TICKER",
                 "current_block": 102320,
                 "wallet_balance": {
                     "wallet_type": "Iguana",
                     "address": "ADDRESS",
                     "balance": {
                         "spendable": "BALANCE",
                          "unspendable":"0"
                      }
                }
            }
       }
   },
   "id":null
}

@artemii235
Copy link
Member Author

@smk762 I've refactored init_z_coin_status response, added more info about sync status, the responses are as follows:

{"mmrpc":"2.0","result":{"status":"InProgress","details":"ActivatingCoin"},"id":null}

...

{"mmrpc":"2.0","result":{"status":"InProgress","details":{"UpdatingBlocksCache":{"current_scanned_block":2911,"latest_block":123147}}},"id":null}

...

{"mmrpc":"2.0","result":{"status":"InProgress","details":{"UpdatingBlocksCache":{"current_scanned_block":38935,"latest_block":123147}}},"id":null}

...

{"mmrpc":"2.0","result":{"status":"InProgress","details":"BuildingWalletDb"},"id":null}

...

{"mmrpc":"2.0","result":{"status":"Ready","details":{"result":{"ticker":"ZOMBIE","current_block":123147,"wallet_balance":{"wallet_type":"Iguana","address":"zs1g6z7dcfp5wg085fuzqlauf8d85ct4hke7xmwxe0djnq48909yfsj66hzj0fjgfgzynddud8n04g","balance":{"spendable":"1","unspendable":"0"}}}}},"id":null}

Please note that BuildingWalletDb stage can take several minutes depending on the number of transactions on the address. Due to current librustzcash design, it's not possible to provide a more detailed status of this operation. It's worth showing May take some time/several minutes message to the user when you get this status.

@artemii235
Copy link
Member Author

@smk762 KomodoPlatform/komodo-defi-framework#1302 is merged, you can use dev branch :) The binaries will be uploaded by CI soon.

@smk762 smk762 added next iteration to not forget to include it and removed 0.5.6 labels Jun 20, 2022
@artemii235
Copy link
Member Author

@artemii235 artemii235 changed the title ARRR integration PoC ARRR integration Jul 12, 2022
@artemii235
Copy link
Member Author

@smk762 Tx history PR is merged to dev.
cc @tonymorony

@tonymorony tonymorony added 0.5.7 and removed next iteration to not forget to include it labels Jul 25, 2022
@artemii235
Copy link
Member Author

I think this will be useful during testing: https://zcash.readthedocs.io/en/latest/rtd_pages/ux_wallet_checklist.html. Official Zcash recommendations on wallet UX 🙂 cc @tonymorony @smk762

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Coin Addition custom coins P1 Major issue needs to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants