KomodoPlatform / coins

coin parameters and all files needed for GUI support
17 stars 123 forks source link

Add AIPG #988

Closed 1NF1N18Y closed 6 months ago

1NF1N18Y commented 6 months ago

Hi team,

I'm new to Komodo and eager to contribute. This PR adds AIPG functionality. Can we discuss details on Discord for a smoother integration?

482101557383528448 discord user ID or jaydie. (don't forget the dot).

cipig commented 6 months ago

i get ERROR "electrumx1.aipowergrid.io:50002" error Custom { kind: InvalidData, error: InvalidCertificateData("invalid peer certificate: UnsupportedCertVersion") } when trying to enable AIPG with this electrum servers is it a self signed certificate? those only work if created i a special way and when param "disable_cert_verification": true is set and only in Desktop/Mobile, WSS for Web version does not work at all with self signed certs i recommend to get some real certs from eg letsencrypt, they are for free

1NF1N18Y commented 6 months ago

i get ERROR "electrumx1.aipowergrid.io:50002" error Custom { kind: InvalidData, error: InvalidCertificateData("invalid peer certificate: UnsupportedCertVersion") } when trying to enable AIPG with this electrum servers is it a self signed certificate? those only work if created i a special way and when param "disable_cert_verification": true is set and only in Desktop/Mobile, WSS for Web version does not work at all with self signed certs i recommend to get some real certs from eg letsencrypt, they are for free

Thanks for the reply! We have updated the electrum servers with working certs. Please let me know if it works now!

smk762 commented 6 months ago

Thanks for the PR! Unfortunately I encountered the following error attempting WSS connection:

[
  {
    "error": "rpc:211] dispatcher_legacy:141] lp_commands_legacy:144] lp_coins:3036] utxo_standard:66] utxo_coin_builder:516] 
    Failed to connect to at least 1 of [
         ElectrumRpcRequest { url: \"electrumx2.aipowergrid.io:50004\", protocol: WSS, disable_cert_verification: false }, 
         ElectrumRpcRequest { url: \"electrumx1.aipowergrid.io:50004\", protocol: WSS, disable_cert_verification: false }
    ] in 5 seconds."
  }
]

you can test this at https://methods-selector.react-atomicdex-wasm.pages.dev/ with the following command:

[
  {
    "userpass": "testpsw",
    "method": "electrum",
    "mm2": 1,
    "coin": "RICK",
    "tx_history": true,
    "servers": [
      {
        "url": "electrumx2.aipowergrid.io:50004",
        "protocol": "WSS"
      },
      {
        "url": "electrumx1.aipowergrid.io:50004",
        "protocol": "WSS"
      }
    ]
  }
]

Note I'm using RICK as the coin value - this is purely to bypass the field is missing in coins file error (currently returned for AIPG until this PR is merged) to test connectivity.

Testing SSL connectivity passed successfully, and explorer link is functional with standard paths so no additional commit required for https://github.com/KomodoPlatform/coins/blob/master/explorers/explorer_paths.json

cipig commented 6 months ago

i also get a timeout on port 50004... simply try to open https://electrumx2.aipowergrid.io:50004/ in browser... i guess it's the firewall the SSL certs are fine and port 50002 is also open

cipig commented 6 months ago

tried to enable AIPG, but i get {"error":"rpc:215] dispatcher_legacy:141] lp_commands_legacy:145] lp_coins:3595] utxo_standard:69] utxo_coin_builder:151] utxo_conf_builder:294] Error deserializing 'derivation_path': InvalidDerivationPathLength { expected: 2, found: 4 }"} the derivation_path is wrong... looked at https://github.com/satoshilabs/slips/blob/master/slip-0044.md and couldn't find AIPG there

cipig commented 6 months ago

i removed derivation_path, enabled AIPG on 2 VPS and did a swap:

[taker fee (KMD)](https://kmdexplorer.io/tx/90a8dc21b94b4abad4a36e3270e31811e34e515264447d7e90e8a8ff0caa718f)  
[maker payment (AIPG)](https://explorer.aipowergrid.io/tx/a4f2b4213e56def7991264d36293c61e0ac2bfe71991bafb1dbb363945e6e02b)  
[taker payment (KMD)](https://kmdexplorer.io/tx/5157002e62a908576cc99dbf904d4e123471de7b6e095dd8333bcea47c7ba42f)  
[taker payment spent (KMD)](https://kmdexplorer.io/tx/8a8426d4869ae6a2e807ed171a7958181ac47d9813c13887b2f5597b2f4a2e55)  
[maker payment spent (AIPG)](https://explorer.aipowergrid.io/tx/b997373030dc2941dbd6876b16c1b80ac691e750f43171f2eeac015220efd40e)  

so it works.

can you please also add the ids from coingecko, coinpaprika and livecoinwatch to the files in api_ids so that AIPG will show a price in the GUIs?

gonner22 commented 6 months ago

Thanks for the PR! Unfortunately I encountered the following error attempting WSS connection:

[
  {
    "error": "rpc:211] dispatcher_legacy:141] lp_commands_legacy:144] lp_coins:3036] utxo_standard:66] utxo_coin_builder:516] 
    Failed to connect to at least 1 of [
         ElectrumRpcRequest { url: \"electrumx2.aipowergrid.io:50004\", protocol: WSS, disable_cert_verification: false }, 
         ElectrumRpcRequest { url: \"electrumx1.aipowergrid.io:50004\", protocol: WSS, disable_cert_verification: false }
    ] in 5 seconds."
  }
]

you can test this at https://methods-selector.react-atomicdex-wasm.pages.dev/ with the following command:

[
  {
    "userpass": "testpsw",
    "method": "electrum",
    "mm2": 1,
    "coin": "RICK",
    "tx_history": true,
    "servers": [
      {
        "url": "electrumx2.aipowergrid.io:50004",
        "protocol": "WSS"
      },
      {
        "url": "electrumx1.aipowergrid.io:50004",
        "protocol": "WSS"
      }
    ]
  }
]

Note I'm using RICK as the coin value - this is purely to bypass the field is missing in coins file error (currently returned for AIPG until this PR is merged) to test connectivity.

Testing SSL connectivity passed successfully, and explorer link is functional with standard paths so no additional commit required for https://github.com/KomodoPlatform/coins/blob/master/explorers/explorer_paths.json

Hello, I've been checking on our end with the servers, and the port 50004 has been opened. I've been using the suggested page, and indeed, I'm getting the same error. Our ElectrumX configuration is as follows: SERVICES = ssl://:50002, wss://:50004, the service is listening on the port. I also verified with wscat -c wss://electrumx1.aipowergrid.io:50004 on both servers, and it connects.... I'm puzzled that with the test from the page, I'm not receiving any request that I can see in the logs... Is there anything else we should try?

cipig commented 6 months ago

WSS is fine now on both electrums, port is reachable and certificate is fine

gonner22 commented 6 months ago

WSS is fine now on both electrums, port is reachable and certificate is fine

Thanks!

cipig commented 6 months ago

can you please fix the derivation_path and add the api_ids for gecko, paprika, lcw? then PR is ready to merge

1NF1N18Y commented 6 months ago

can you please fix the derivation_path and add the api_ids for gecko, paprika, lcw? then PR is ready to merge

Hey! The derivation_path is changed and I added the api_ids. Let me know if you encounter any other issues.