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

/transaction-info: missing outputs for UtxoType: Unknown #297

Open
alecov opened this issue Feb 17, 2022 · 1 comment
Open

/transaction-info: missing outputs for UtxoType: Unknown #297

alecov opened this issue Feb 17, 2022 · 1 comment

Comments

@alecov
Copy link

alecov commented Feb 17, 2022

Hello there,

The /transaction-info endpoint doesn't seem to return all available transaction data on certain transaction kinds (notably CREATOR_COIN, perhaps others).

For example, consider one UTXO as given by /balance for Nader's pubkey (BC1YLhyuDGeWVgHmh3UQEoKstda525T1LnonYWURBdpgWbFBfRuntP5) :

{
    "TransactionIDBase58Check": "3JuETTXwzS794FmWKxGVBgsfZ7oWTUhBVLynsVrzWW8JovXfQMqgUB",
    "Index": 1,
    "AmountNanos": 8457601,
    "PublicKeyBase58Check": "BC1YLhyuDGeWVgHmh3UQEoKstda525T1LnonYWURBdpgWbFBfRuntP5",
    "Confirmations": 20,
    "UtxoType": "UtxoTypeUnknown",
    "BlockHeight": 104460
},

(Note UtxoType=Unknown.)

Now consider the above transaction's data as given by /transaction-info:

{
    "TransactionIDBase58Check": "3JuETTXwzS794FmWKxGVBgsfZ7oWTUhBVLynsVrzWW8JovXfQMqgUB",
    "RawTransactionHex": "018437fe92f4a8032f0c6a78e1546adacd2e8149f78c745133e4a2327b353261e70001033d6b39419e5ba43da78015bd0229b175374d723cc91d74094497c76893fe05c78eb4e2260b2d21033054df257f9d7905cfe85d0a805691e5d1379ca926389896dac88ddc9d2c1bc2009ed0aa280000008d8a7421033d6b39419e5ba43da78015bd0229b175374d723cc91d74094497c76893fe05c7004630440220614180fb520f208123db7889ce8ff4a3a2e50546e90bde27b26f4fda3744d2ec02206ee62693090ab5d733686c228949775ca309518423e658b832e81cc95663101f",
    "Inputs": [
        {
            "TransactionIDBase58Check": "3JuETk151gcVAS6NnnxRqpUJYHTsSJ8jQNsFivygKPMF62Q2Dzwiuk",
            "Index": 0
        }
    ],
    "Outputs": [
        {
            "PublicKeyBase58Check": "BC1YLi5fWYZ6TvyUNojfb1pY6P9JBpSAezpYPi3bttdFgcySnpn7K4v",
            "AmountNanos": 81304078
        }
    ],
    "SignatureHex": "30440220614180fb520f208123db7889ce8ff4a3a2e50546e90bde27b26f4fda3744d2ec02206ee62693090ab5d733686c228949775ca309518423e658b832e81cc95663101f",
    "TransactionType": "CREATOR_COIN",
    "BlockHashHex": "0000000000004a73b1d3523ca4c063be1000e395466e761329ff7bbe2940fc76",
    "TransactionMetadata": {
        "BlockHashHex": "0000000000004a73b1d3523ca4c063be1000e395466e761329ff7bbe2940fc76",
        "TxnIndexInBlock": 66,
        "TxnType": "CREATOR_COIN",
        "TransactorPublicKeyBase58Check": "BC1YLi5fWYZ6TvyUNojfb1pY6P9JBpSAezpYPi3bttdFgcySnpn7K4v",
        "AffectedPublicKeys": [
            {
                "PublicKeyBase58Check": "BC1YLi5fWYZ6TvyUNojfb1pY6P9JBpSAezpYPi3bttdFgcySnpn7K4v",
                "Metadata": "BasicTransferOutput"
            },
            {
                "PublicKeyBase58Check": "BC1YLhyuDGeWVgHmh3UQEoKstda525T1LnonYWURBdpgWbFBfRuntP5",
                "Metadata": "CreatorPublicKey"
            }
        ],
        "TxnOutputs": [
            {
                "PublicKey": "Az1rOUGeW6Q9p4AVvQIpsXU3TXI8yR10CUSXx2iT/gXH",
                "AmountNanos": 81304078
            }
        ],
        "BasicTransferTxindexMetadata": {
            "TotalInputNanos": 165888789,
            "TotalOutputNanos": 165888556,
            "FeeNanos": 233,
            "UtxoOpsDump": "",
            "UtxoOps": null,
            "DiamondLevel": 0,
            "PostHashHex": ""
        },
        "CreatorCoinTxindexMetadata": {
            "OperationType": "buy",
            "DeSoToSellNanos": 84584478,
            "CreatorCoinToSellNanos": 0,
            "DeSoToAddNanos": 0,
            "DESOLockedNanosDiff": 76118418
        }
    }
},

This is a CREATOR_COIN transaction, which (as far as my understanding goes) means someone has bought Nader's CC. Due to the FR%, Nader receives a DeSo credit which produces an UTXO bound to this transaction at Index=1, but such output is not even listed as a TXO in the transaction info dump.

In this particular case I have verified that manually calculating a pubkey's balance (UTXOs - STXOs) differs exactly by the amount of nanos from UtxoType=Unknowns missing in the transaction-info output. Adding all such UTXOs allow us to calculate the correct balance.

This seems to be a core bug or missing feature in the /transaction-info backend or perhaps in the core lib.

@lazynina
Copy link
Member

deso-protocol/core#229 will address the Unknown UTXO type issue.

we no longer include the UtxoOps in the BasicTransferTxindexMetadata. I'd be open to a PR to optionally include these in a response. Would require modifying APITransactionToResponse in exchange.go. Would need to make sure the UtxoOps are JSON encodable - I believe there is an issue with the PrevCoinRoyaltyCoinEntries attribute of the UtxoOperation struct. Would need someway to encode that properly or exclude it.

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