brianddk / pyexch

REST based Python Exchange API
Apache License 2.0
0 stars 2 forks source link

[api-v2-bug] Create Address endpoint creates broken Lightning addresses #18

Open brianddk opened 4 months ago

brianddk commented 4 months ago

The Create Address endpoint attempts to support the new BTC-LN addresses, but mixes them with Legacy addresses.

By modifying the parameters to Create Address, an attempt can be made to make a LN-Invoice. The attempt does not generate any error, but neither does it generate a LN-Invoice.

new-ln-address.json

{
  "name": "New LN Address",
  "network": "lightning",
}

Attempt to create an LN-Invoice

btc_acct_id=23456789-abcd-ef01-2345-6789abcdef01
pyexch --param new-ln-addr.json5 --method post --url /v2/accounts/${btc_acct_id}/addresses

The attempt produces no errors, but the (redacted) response JSON is completely incorrect (note deposit_uri)

{
  "id": "89abcdef-0123-4567-89ab-cdef01234567",
  "address": "15T4EFoMRM8nYWSsCupfCHcHUzrHNQBSyt",
  "address_info": {
    "address": "15T4EFoMRM8nYWSsCupfCHcHUzrHNQBSyt"
  },
  "name": "New LN Address",
  "created_at": "2024-05-03T12:11:19Z",
  "updated_at": "2024-05-03T12:11:19Z",
  "network": "lightning",
  "uri_scheme": "lightning",
  "resource": "address",
  "resource_path": "/v2/accounts/23456789-abcd-ef01-2345-6789abcdef01/addresses/89abcdef-0123-4567-89ab-cdef01234567",
  "warnings": [
    {
      "type": "correct_address_warning",
      "title": "Only send Bitcoin (BTC) to this address",
      "details": "Sending any other asset, including Bitcoin Cash (BCH), will result in permanent loss.",
      "image_url": "https://www.coinbase.com/assets/addresses/global-receive-warning-9abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345678.png",
      "options": [
        {
          "text": "I understand",
          "style": "primary",
          "id": "dismiss"
        }
      ]
    }
  ],
  "qr_code_image_url": "https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/btc-lightning.png",
  "address_label": "BTC address (Lightning)",
  "default_receive": true,
  "deposit_uri": "lightning:15T4EFoMRM8nYWSsCupfCHcHUzrHNQBSyt",
  "callback_url": null,
  "share_address_copy": {
    "line1": "15T4EFoMRM8nYWSsCupfCHcHUzrHNQBSyt",
    "line2": "This is a bitcoin network address. Do not send BTC over any other network to this address or your funds may be lost. Do not send Bitcoin Cash (BCH) to this address."
  },
  "receive_subtitle": "BTC",
  "inline_warning": {
    "text": "Only send Bitcoin (BTC) to this address",
    "tooltip": {
      "title": "Bitcoin (BTC)",
      "subtitle": "This is a bitcoin network address. Do not send BTC over any other network to this address or your funds may be lost. Do not send Bitcoin Cash (BCH) to this address."
    }
  }
}

Lightning addresses can be created on the coinbase.com webpage without error. And they can be listed using the List Address endpoint with the following (redacted) data:

{
  "id": "abcdef01-2345-6789-abcd-ef0123456789",
  "address": "lnbc161810n1pnr2taqpp5dcddkl48u4v96gap6e8zkkdx8g5hmuy8rxlsn7l6p30hh7cgr9jssp5968y0gut5cu2uun6rv0yw6n6das8wuspuqk59xtrqpwxlh7xwxkqxqy8ayqnp4qf0ru8dxm7pht536amqu6re6jzsf4akdc8y7x9ze3npkcd2fh8he2rzjq25carzepgd4vqsyn44jrk85ezrpju92xyrk9apw4cdjh6yrwt5jgqqqqzudjq473cqqqqqqqqqqqqqq9qrzjqwghf7zxvfkxq5a6sr65g0gdkv768p83mhsnt0msszapamzx2qvuxqqqqzudjq473cqqqqqqqqqqqqqq9qcqzpgdqq9qyyssqeavfvqcc3yesz7804cutyyncw96f5xwkld7r76fr5ll6m38nz6v54rry5trf62g0uvyhk8wxw8mzsunxsw9tf9svvcuw6cx9lql6aksp5h0hvd",
  "address_info": {
    "address": "lnbc161810n1pnr2taqpp5dcddkl48u4v96gap6e8zkkdx8g5hmuy8rxlsn7l6p30hh7cgr9jssp5968y0gut5cu2uun6rv0yw6n6das8wuspuqk59xtrqpwxlh7xwxkqxqy8ayqnp4qf0ru8dxm7pht536amqu6re6jzsf4akdc8y7x9ze3npkcd2fh8he2rzjq25carzepgd4vqsyn44jrk85ezrpju92xyrk9apw4cdjh6yrwt5jgqqqqzudjq473cqqqqqqqqqqqqqq9qrzjqwghf7zxvfkxq5a6sr65g0gdkv768p83mhsnt0msszapamzx2qvuxqqqqzudjq473cqqqqqqqqqqqqqq9qcqzpgdqq9qyyssqeavfvqcc3yesz7804cutyyncw96f5xwkld7r76fr5ll6m38nz6v54rry5trf62g0uvyhk8wxw8mzsunxsw9tf9svvcuw6cx9lql6aksp5h0hvd"
  },
  "name": null,
  "created_at": "2024-05-03T12:30:33Z",
  "updated_at": "2024-05-03T12:30:33Z",
  "network": "lightning",
  "uri_scheme": "lightning",
  "resource": "address",
  "resource_path": "/v2/accounts/23456789-abcd-ef01-2345-6789abcdef01/addresses/abcdef01-2345-6789-abcd-ef0123456789",
  "warnings": [
    {
      "type": "correct_address_warning",
      "title": "Only send Bitcoin (BTC) to this address",
      "details": "Sending any other asset, including Bitcoin Cash (BCH), will result in permanent loss.",
      "image_url": "https://www.coinbase.com/assets/addresses/global-receive-warning-789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456.png",
      "options": [
        {
          "text": "I understand",
          "style": "primary",
          "id": "dismiss"
        }
      ]
    }
  ],
  "qr_code_image_url": "https://static-assets.coinbase.com/p2p/l2/asset_network_combinations/v5/btc-lightning.png",
  "address_label": "BTC address (Lightning)",
  "default_receive": false,
  "deposit_uri": "lightning:lnbc161810n1pnr2taqpp5dcddkl48u4v96gap6e8zkkdx8g5hmuy8rxlsn7l6p30hh7cgr9jssp5968y0gut5cu2uun6rv0yw6n6das8wuspuqk59xtrqpwxlh7xwxkqxqy8ayqnp4qf0ru8dxm7pht536amqu6re6jzsf4akdc8y7x9ze3npkcd2fh8he2rzjq25carzepgd4vqsyn44jrk85ezrpju92xyrk9apw4cdjh6yrwt5jgqqqqzudjq473cqqqqqqqqqqqqqq9qrzjqwghf7zxvfkxq5a6sr65g0gdkv768p83mhsnt0msszapamzx2qvuxqqqqzudjq473cqqqqqqqqqqqqqq9qcqzpgdqq9qyyssqeavfvqcc3yesz7804cutyyncw96f5xwkld7r76fr5ll6m38nz6v54rry5trf62g0uvyhk8wxw8mzsunxsw9tf9svvcuw6cx9lql6aksp5h0hvd",
  "callback_url": null,
  "share_address_copy": {
    "line1": "lnbc161810n1pnr2taqpp5dcddkl48u4v96gap6e8zkkdx8g5hmuy8rxlsn7l6p30hh7cgr9jssp5968y0gut5cu2uun6rv0yw6n6das8wuspuqk59xtrqpwxlh7xwxkqxqy8ayqnp4qf0ru8dxm7pht536amqu6re6jzsf4akdc8y7x9ze3npkcd2fh8he2rzjq25carzepgd4vqsyn44jrk85ezrpju92xyrk9apw4cdjh6yrwt5jgqqqqzudjq473cqqqqqqqqqqqqqq9qrzjqwghf7zxvfkxq5a6sr65g0gdkv768p83mhsnt0msszapamzx2qvuxqqqqzudjq473cqqqqqqqqqqqqqq9qcqzpgdqq9qyyssqeavfvqcc3yesz7804cutyyncw96f5xwkld7r76fr5ll6m38nz6v54rry5trf62g0uvyhk8wxw8mzsunxsw9tf9svvcuw6cx9lql6aksp5h0hvd",
    "line2": "This is a bitcoin network address. Do not send BTC over any other network to this address or your funds may be lost. Do not send Bitcoin Cash (BCH) to this address."
  },
  "receive_subtitle": "BTC",
  "inline_warning": {
    "text": "Only send Bitcoin (BTC) to this address",
    "tooltip": {
      "title": "Bitcoin (BTC)",
      "subtitle": "This is a bitcoin network address. Do not send BTC over any other network to this address or your funds may be lost. Do not send Bitcoin Cash (BCH) to this address."
    }
  }
}
brianddk commented 4 months ago
brianddk commented 4 months ago

Submitted bug #19237115

This ticket will likely close since I find their requirement to have my Python and JSON sample code encoded into JPEG to be patently ridiculous.

Last correspondence...


I hope this message finds you well. As part of our ongoing efforts to ensure the security and integrity of transactions on Coinbase, we are conducting a routine review of your recent activity.

To assist us in this process, we kindly request that you provide a screenshot related to your issue. Please ensure that the screenshot includes the following information:

Full screen view

The issue that you are getting

Please note that we cannot accept phone screenshots as they often cut off too much data. Also, please avoid using the search function in your screenshot as this can hide actions that the bank may have taken.

Once you have taken the screenshot, you can attach it to your reply to this email. Your cooperation in this matter is greatly appreciated and will help us ensure the security and integrity of our platform.

I politely refuse to encode the JSON provided earlier into a JPEG on the grounds that the request is flat out ridiculous.

brianddk commented 4 months ago

Last reply seem insistent, and given the oddities of the request, I have to contend with the very real fact that the support mailbox may be triaged by an AI. If so, this issue won't be passed off to a dev until "Collect Data" task is complete. I've rendered the text to PDF (*sigh*) and feed the AI it's meal.

Attached

brianddk_pyexch_issue18 discord_thread