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

Get BTC UTXO returns utxos with runes on them in testnet #83

Open
Vanniix opened this issue Nov 7, 2024 · 2 comments
Open

Get BTC UTXO returns utxos with runes on them in testnet #83

Vanniix opened this issue Nov 7, 2024 · 2 comments

Comments

@Vanniix
Copy link

Vanniix commented Nov 7, 2024

The Get BTC UTXO api endpoint (/v1/indexer/address/{address}/utxo-data) is returning utxos with runes on them in testnet.

The docs for this endpoint simply state "Get non inscription UTXO list by address", so it doesn't specifically mention runes, however, based on its behaviour on mainnet, I am led to believe that this endpoint also does not give rune UTXO's. If this is the case, it is not behaving as expected on testnet.

This is quite concerning to me. If it is not working on testnet, it makes me question if this could also happen on mainnet. I assume this endpoint is being used by dapps to determine which UTXO's are safe to spend, so if this endpoint is returning incorrect data, it could lead to people losing runes.

In addition to the issue with testnet, it is also an issue that the docs are not specific about this endpoint. Since they do not mention runes, it unclear if it should be returning these UTXO's. Please add details indicating if this endpoint does or does not return UTXO's with runes in them. My assumption is that this endpoint returns UTXO's that are 'safe to spend', but this is not clear from the description. It should be made clear that the UTXO's returned from this endpoint are safe to spend, so there is no confusion for future developers.

Here is an example showing rune UTXO's being returned on testnet:
Make a request to this endpoint:
https://open-api-testnet.unisat.io/v1/indexer/runes/utxo/815762e3fcad0ce3d7492df0ddd47437c39e4da73f5d7cf127ee176767197c40/0/balance
It returns this response, indicating this UTXO has runes on it:

{
    "code": 0,
    "data": [
        {
            "rune": "VANNIXRUNETHREE",
            "runeid": "2588355:1773",
            "spacedRune": "VANNIX•RUNE•THREE",
            "amount": "346502700",
            "symbol": "$",
            "divisibility": 2
        }
    ]
}

Now, make a request to this endpoint:
https://open-api-testnet.unisat.io/v1/indexer/address/tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44/utxo-data
It returns this response:

{
    "code": 0,
    "msg": "ok",
    "data": {
        "cursor": 0,
        "total": 9,
        "totalConfirmed": 9,
        "totalUnconfirmed": 0,
        "totalUnconfirmedSpend": 0,
        "totalRunes": 0,
        "utxo": [
            {
                "txid": "62b848acac3e32b273ab8b81bc889947fd9356e2c6fc1ff1af0da92d8662aac1",
                "vout": 2,
                "satoshi": 82007,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2866230,
                "idx": 486,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "62b848acac3e32b273ab8b81bc889947fd9356e2c6fc1ff1af0da92d8662aac1",
                "vout": 0,
                "satoshi": 546,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2866230,
                "idx": 486,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "66a9c41eb1e32dab140feb2e845d91c8a7e98cc9c99002131dc8adf95366fdbc",
                "vout": 0,
                "satoshi": 546,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865693,
                "idx": 1263,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "ca6fed1452662cb79ed76de796f0ec8011c3d89495a116524533532af70226aa",
                "vout": 3,
                "satoshi": 33317,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865517,
                "idx": 1046,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "ca6fed1452662cb79ed76de796f0ec8011c3d89495a116524533532af70226aa",
                "vout": 0,
                "satoshi": 546,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865517,
                "idx": 1046,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "bd6677770280a0febe1db5babe379a0a7af23293cec3fabb547b2e10f1a0d64f",
                "vout": 0,
                "satoshi": 546,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865517,
                "idx": 1045,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "283d3f05144d1d8205637a1f089b275b17e833bd9ea03e8ee831c76946eab43f",
                "vout": 0,
                "satoshi": 546,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865515,
                "idx": 599,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "9887dd6b22684bdb3a79f5240680b9805625ca45df0e540a7b4a4c810b09d506",
                "vout": 0,
                "satoshi": 45815,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865282,
                "idx": 545,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            },
            {
                "txid": "815762e3fcad0ce3d7492df0ddd47437c39e4da73f5d7cf127ee176767197c40",
                "vout": 0,
                "satoshi": 150000,
                "scriptType": "5120",
                "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
                "codeType": 9,
                "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
                "height": 2865270,
                "idx": 103,
                "isOpInRBF": false,
                "isSpent": false,
                "inscriptions": []
            }
        ]
    }
}

The final UTXO is 815762e3fcad0ce3d7492df0ddd47437c39e4da73f5d7cf127ee176767197c40:0. i.e. the same UTXO is the first request that has runes on it.

@cloud6605
Copy link
Collaborator

you need to add a parameter:&confirmed=true
Then the returned utxos won't include runes utxos. @Vanniix

@Vanniix
Copy link
Author

Vanniix commented Dec 3, 2024

Hi @cloud6605, thanks for the response.

I have tried adding the confirmed=true query param, however this does not change the response. I am not surprised either. The implication is that the confirmed parameter should filter out UTXO's that have not been confirmed (i.e. mined). However, all UTXO's in the response I shared are confirmed, so this parameter should not have any effect. I would not expect the confirmed query param to have any impact on runes UTXO's, and if it did that would be very counter intuitive. I understand that the API is not aware of runes/inscriptions on unconfirmed UTXO's, but that is not the issue here, as all UTXO's are confirmed.

I encourage you to try it. Make a request to:

https://open-api-testnet.unisat.io/v1/indexer/address/tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44/utxo-data?confirmed=true

You will find this UTXO in the response which has runes on it:

{
    "txid": "815762e3fcad0ce3d7492df0ddd47437c39e4da73f5d7cf127ee176767197c40",
    "vout": 0,
    "satoshi": 150000,
    "scriptType": "5120",
    "scriptPk": "5120028aa20c1af06c28408a9acb730bfe6e20bf15d27f2c3508b5c3d4c5267d8846",
    "codeType": 9,
    "address": "tb1pq292yrq67pkzssy2nt9hxzl7dcst79wj0ukr2z94c02v2fna3prqpylg44",
    "height": 2865270,
    "idx": 103,
    "isOpInRBF": false,
    "isSpent": false,
    "inscriptions": []
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants