Possibility of Double Spending in a Block

Dear all,

When I used the BlockFrost API, I noticed two transactions in the same block spending the same output.

Block Height: 9566006

TX Hash 1: 97e20490d2075fa068a2724c19c206e6c365c4d054756767e60a94bc08b7f922
TX Hash 2: 4418cb5a07531ac0484bfa4f05973e916c221f8212260e57e8d44f922d0592b3

This output is spent by both of them:

TX_Hash: Namespace(address='addr1zxgx3far7qygq0k6epa0zcvcvrevmn0ypsnfsue94nsn3tvpw288a4x0xf8pxgcntelxmyclq83s0ykeehchz2wtspks905plm', amount=[Namespace(unit='lovelace', quantity='40000000')], tx_hash='9a32459bd4ef6bbafdeb8cf3b909d0e3e2ec806e4cc6268529280b0fc1d06f5b', output_index=0, data_hash=None, inline_datum=None, reference_script_hash='9068a7a3f008803edac87af1619860f2cdcde40c26987325ace138ad', collateral=False, reference=True)

Isn’t this a case of double-spending?

It probably is an UTxO that is just referenced twice, without spending it? That’s possible with Plututs V2.

2 Likes

As @brouwerQ wrote, the “9a32459bd4ef6bbafdeb8cf3b909d0e3e2ec806e4cc6268529280b0fc1d06f5b#0” input is not spent, it is referenced in those transactions.
If you take a look at the following link:

you will see that this is actually the JG Store smart contract, stored on chain, and it is probably referenced by thousands of transactions. You can read more about the reference scripts here: https://github.com/cardano-foundation/CIPs/tree/master/CIP-0033

It is not possible to spend an UTxO 2 times, not even in the same block. When a transaction spending an UTxO is in a node’s mempool, trying to add another transaction spending the same UTxO into the same node’s mempool will cause an error.
Different nodes can have different transactions in the mempool. If one transactions spends an UTxO (confirmed in a block), all the other transactions trying to spend the same UTxO will fail (even if they are already in a node’s mempool).

3 Likes

Thanks for the explanation. So the reference field in the TX data specifies this. If it’s True it means this input will only be used as a reference for other inputs.

Yes, that’s probably what Blockfrost mean with that field, that’s it’s being used as a reference input.

2 Likes