hirosystems / ordinals-api

Bitcoin Ordinals API
Apache License 2.0
199 stars 61 forks source link

re-inscriptions on a new location should transfer all other inscriptions on the same sat #344

Closed rafaelcr closed 4 months ago

rafaelcr commented 5 months ago

https://ordinals.hiro.so/inscription/cb8a9061b3ff2b6b1353c40e3b66dbc519519afca0f7f14201b382d3dae48888i807 does not have the latest transfer. I think it's missing this tx - https://mempool.space/tx/c457c77b2088f27fca0eaced0628a2a4f04cf202fb1c7ea74876ab5a3dec1113

ordhook does have the data


sqlite> select * from locations where ordinal_number = "1553351063105917" order by block_height;
+------------------+--------------+----------+----------------------------------------------------------------------+--------+
|  ordinal_number  | block_height | tx_index |                          outpoint_to_watch                           | offset |
+------------------+--------------+----------+----------------------------------------------------------------------+--------+
| 1553351063105917 | 835834       | 563      | cb8a9061b3ff2b6b1353c40e3b66dbc519519afca0f7f14201b382d3dae48888:808 | 0      |
| 1553351063105917 | 839539       | 1484     | 41da20ccaa02df6f6522c7e32ec2478365fa98292cb89e49cfebb41e066e057e:0   | 0      |
| 1553351063105917 | 839542       | 1271     | 68eb09d73c004fc286c7715178af0f0c5b20ee6f1c9cb6e6867bcf0e98353799:0   | 0      |
| 1553351063105917 | 839595       | 1236     | acfcf89efbe788fde6eb72dc4b1b987779a822796af6c0bde56ebb3a07d5c688:0   | 24570  |
| 1553351063105917 | 839595       | 1237     | c457c77b2088f27fca0eaced0628a2a4f04cf202fb1c7ea74876ab5a3dec1113:45  | 0      |
+------------------+--------------+----------+----------------------------------------------------------------------+--------+
rafaelcr commented 5 months ago

I believe this is an ordhook issue. When the payload for block 839595 gets sent to the API, we get the first transfer correctly:

{
  "inscription_transferred": {
    "destination": {
      "type": "transferred",
      "value": "bc1px4s3lm75l20354l53tsasnqefyvqgxgtelkzen8kj2cjrh85u9zqsafrla"
    },
    "ordinal_number": 1553351063105917,
    "post_transfer_output_value": 1855258,
    "satpoint_post_transfer": "acfcf89efbe788fde6eb72dc4b1b987779a822796af6c0bde56ebb3a07d5c688:0:24570",
    "satpoint_pre_transfer": "68eb09d73c004fc286c7715178af0f0c5b20ee6f1c9cb6e6867bcf0e98353799:0:0",
    "tx_index": 1236
  }
},

but the second transfer is sent only as a new reveal, potentially only a re-inscription of the same sat creating a new inscription_id

{
  "inscription_revealed": {
    "content_bytes": "0x4d455247453a4c4d6d6f306570476b4352654667507839766e5066644d423354636947615a494c4c32436a5764706839442f42704f46314f7875627557486e656a61596a4e61654c735856395a514a46647252636a44346a663448764d4e4833615450695858754b4a677138464755636c5a305345596e447a583654763954497a492f53476f",
    "content_length": 134,
    "content_type": "text/plain;charset=utf-8",
    "curse_type": "Generic",
    "delegate": "",
    "inscriber_address": "bc1pxxkjtk5g8l9dj7t7k5sfrsknzytr50xeg3gg5runusv6uwgzarxq8kv6md",
    "inscription_fee": 1527658,
    "inscription_id": "c457c77b2088f27fca0eaced0628a2a4f04cf202fb1c7ea74876ab5a3dec1113i45",
    "inscription_input_index": 0,
    "inscription_number": {
      "classic": -4385741,
      "jubilee": 69697581
    },
    "inscription_output_value": 546,
    "inscription_pointer": 24570,
    "metadata": null,
    "metaprotocol": "",
    "ordinal_block_height": 411340,
    "ordinal_number": 1553351063105917,
    "ordinal_offset": 1063105917,
    "parent": "",
    "satpoint_post_inscription": "c457c77b2088f27fca0eaced0628a2a4f04cf202fb1c7ea74876ab5a3dec1113:45:0",
    "transfers_pre_inscription": 0,
    "tx_index": 1237
  }
},
rafaelcr commented 5 months ago

We've decided we should handle this case on the API, because a re-inscribed sat on a new location should be enough information to transfer all previous inscriptions along with it

rafaelcr commented 4 months ago

Additional note: when querying block transfers, we should display transfers for all inscriptions contained in the sat which was transferred. We currently only show one.

blockstack-devops commented 4 months ago

:tada: This issue has been resolved in version 4.0.0-beta.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

blockstack-devops commented 3 months ago

:tada: This issue has been resolved in version 4.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: