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

elements-23.2.2 "bad-txns-in-ne-out, value in != value out" error #1354

Open
Impa10r opened this issue Aug 2, 2024 · 3 comments
Open

elements-23.2.2 "bad-txns-in-ne-out, value in != value out" error #1354

Impa10r opened this issue Aug 2, 2024 · 3 comments
Labels
needs reproduction Needs a way to reproduce the bug

Comments

@Impa10r
Copy link

Impa10r commented Aug 2, 2024

I could not send an unblinded 2-into-2 raw tx, on v23.2.2+liquidtestnet4. @levantah had a similar issue with blinded outputs. The inputs and outputs were definitely adding up in my case:

$ ecli decoderawtransaction 02000000010217219e704f26cb81dd665acbb0c93d85971e97feb7c8e868a7a2f6a8681d3caf0000000000ffffffff17219e704f26cb81dd665acbb0c93d85971e97feb7c8e868a7a2f6a8681d3caf0100000000ffffffff0301499a818545f6bae39fc03b637f2a4e1e64e590cac1bc3a6f6d71aa4443654c1401000000000004b56500160014a3927ec747ecdeb82a59b0807b0966f47cdaa90d01499a818545f6bae39fc03b637f2a4e1e64e590cac1bc3a6f6d71aa4443654c140100000000000186900016001425ec28526e73b1fe4bff896ad40485186c692a5601499a818545f6bae39fc03b637f2a4e1e64e590cac1bc3a6f6d71aa4443654c14010000000000000020000000000000000002473044022073c894cb45310064bd6393275a0f146b31a47e200c4fe2bb666ac480d16405f202207222375a20a5241be638858f6a23fb6e24276ae63efb45f4f2bb3ec931cb4917012103944e0fa9945634b18b584006f521abf75dfeacc56c09f0943a27f2a3e17b040200000002473044022059441e7d3c1f8952b793f4899f139b89c210d2287788dc0780c4f1795c01ce7e022037612aaac1f6d57a467e15a4dec69df753167c67e46e1b37ea5e45a96059e30d01210307ff8bd227fa67c64d22306852cd8c5737a2573c48cfeb154c19316b05b363ee00000000000000
{
  "txid": "8ceb9faba7ca457d3dee49c185d491486c4105f021279573af4b9f6ed831a4be",
  "hash": "8ddbdb495e679a6b3ed54f3ca3c5728c9392718fe40c4a549c9d3688fe7475e7",
  "wtxid": "8ddbdb495e679a6b3ed54f3ca3c5728c9392718fe40c4a549c9d3688fe7475e7",
  "withash": "394f85047cb30e375cf2a4f4876f82aba29cd8de58e5ec202e1328404a718599",
  "version": 2,
  "size": 495,
  "vsize": 326,
  "weight": 1302,
  "locktime": 0,
  "vin": [
    {
      "txid": "af3c1d68a8f6a2a768e8c8b7fe971e97853dc9b0cb5a66dd81cb264f709e2117",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "is_pegin": false,
      "sequence": 4294967295,
      "txinwitness": [
        "3044022073c894cb45310064bd6393275a0f146b31a47e200c4fe2bb666ac480d16405f202207222375a20a5241be638858f6a23fb6e24276ae63efb45f4f2bb3ec931cb491701",
        "03944e0fa9945634b18b584006f521abf75dfeacc56c09f0943a27f2a3e17b0402"
      ]
    },
    {
      "txid": "af3c1d68a8f6a2a768e8c8b7fe971e97853dc9b0cb5a66dd81cb264f709e2117",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "is_pegin": false,
      "sequence": 4294967295,
      "txinwitness": [
        "3044022059441e7d3c1f8952b793f4899f139b89c210d2287788dc0780c4f1795c01ce7e022037612aaac1f6d57a467e15a4dec69df753167c67e46e1b37ea5e45a96059e30d01",
        "0307ff8bd227fa67c64d22306852cd8c5737a2573c48cfeb154c19316b05b363ee"
      ]
    }
  ],
  "vout": [
    {
      "value": 0.00308581,
      "asset": "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
      "commitmentnonce": "",
      "commitmentnonce_fully_valid": false,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 a3927ec747ecdeb82a59b0807b0966f47cdaa90d",
        "desc": "addr(tex1q5wf8a368an0ts2jekzq8kztx737d42gdzcqjcv)#3fxx0typ",
        "hex": "0014a3927ec747ecdeb82a59b0807b0966f47cdaa90d",
        "address": "tex1q5wf8a368an0ts2jekzq8kztx737d42gdzcqjcv",
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.00099984,
      "asset": "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
      "commitmentnonce": "",
      "commitmentnonce_fully_valid": false,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 25ec28526e73b1fe4bff896ad40485186c692a56",
        "desc": "addr(tex1qyhkzs5nwwwclujll394dgpy9rpkxj2jkdwem5e)#hd073lrr",
        "hex": "001425ec28526e73b1fe4bff896ad40485186c692a56",
        "address": "tex1qyhkzs5nwwwclujll394dgpy9rpkxj2jkdwem5e",
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.00000032,
      "asset": "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
      "commitmentnonce": "",
      "commitmentnonce_fully_valid": false,
      "n": 2,
      "scriptPubKey": {
        "asm": "",
        "desc": "raw()#58lrscpx",
        "hex": "",
        "type": "fee"
      }
    }
  ],
  "fee": {
    "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49": 0.00000032
  }
}
$ ecli sendrawtransaction 02000000010217219e704f26cb81dd665acbb0c93d85971e97feb7c8e868a7a2f6a8681d3caf0000000000ffffffff17219e704f26cb81dd665acbb0c93d85971e97feb7c8e868a7a2f6a8681d3caf0100000000ffffffff0301499a818545f6bae39fc03b637f2a4e1e64e590cac1bc3a6f6d71aa4443654c1401000000000004b56500160014a3927ec747ecdeb82a59b0807b0966f47cdaa90d01499a818545f6bae39fc03b637f2a4e1e64e590cac1bc3a6f6d71aa4443654c140100000000000186900016001425ec28526e73b1fe4bff896ad40485186c692a5601499a818545f6bae39fc03b637f2a4e1e64e590cac1bc3a6f6d71aa4443654c14010000000000000020000000000000000002473044022073c894cb45310064bd6393275a0f146b31a47e200c4fe2bb666ac480d16405f202207222375a20a5241be638858f6a23fb6e24276ae63efb45f4f2bb3ec931cb4917012103944e0fa9945634b18b584006f521abf75dfeacc56c09f0943a27f2a3e17b040200000002473044022059441e7d3c1f8952b793f4899f139b89c210d2287788dc0780c4f1795c01ce7e022037612aaac1f6d57a467e15a4dec69df753167c67e46e1b37ea5e45a96059e30d01210307ff8bd227fa67c64d22306852cd8c5737a2573c48cfeb154c19316b05b363ee00000000000000
error code: -26
error message:
bad-txns-in-ne-out, value in != value out

$ ecli listunspent
[
  {
    "txid": "af3c1d68a8f6a2a768e8c8b7fe971e97853dc9b0cb5a66dd81cb264f709e2117",
    "vout": 0,
    "address": "tex1q65qzzavpe46x27u5kkqfk0pt4dhfkwhghvqvj8",
    "scriptPubKey": "0014d500217581cd74657b94b5809b3c2bab6e9b3ae8",
    "amount": 0.00308597,
    "assetcommitment": "0a26e4e76e55c868f67d9c0cc91894b09b5db045754f997e11706b5b3ccbc15357",
    "asset": "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
    "amountcommitment": "09aa7ba9c408cc700f7b580a3e02e7a92d4a751f136de44a9a6ff2d9607a0b2d00",
    "amountblinder": "ca0f569ab4a8279d7411f60bc87be031025c0280eb584fa04038a385cf5388e0",
    "assetblinder": "13016d5bda33daf7a507f2fa2a26fa8282ea2e77665c58780a283ac480057009",
    "confirmations": 129,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([80045c9d/0'/1'/155']03944e0fa9945634b18b584006f521abf75dfeacc56c09f0943a27f2a3e17b0402)#629fls9d",
    "safe": true
  }
]

$ ecli2 listunspent
[
  {
    "txid": "af3c1d68a8f6a2a768e8c8b7fe971e97853dc9b0cb5a66dd81cb264f709e2117",
    "vout": 1,
    "address": "tex1q72paxn44pcm4967fhm0w5l6etnfdpthzv90nl2",
    "label": "",
    "scriptPubKey": "0014f283d34eb50e3752ebc9bedeea7f595cd2d0aee2",
    "amount": 0.00100000,
    "assetcommitment": "0b28a300d4175dc777d95ae385c1fe304e0eb4801576b1c1a5f96219dba6f8c4b7",
    "asset": "144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49",
    "amountcommitment": "089d06d3f1afe6e55d30870eab985a74f662664509d45d5a021d3ef4daac4995a9",
    "amountblinder": "abcc5ada6448675a3fdcc5eafa79d2fb041d9fe4959ef09f374a38166f59438e",
    "assetblinder": "61cd681f4b5721205bf4b9cd1fffb3245e9454a7f5fc90870f216c69e74f2c49",
    "confirmations": 129,
    "spendable": true,
    "solvable": true,
    "desc": "wpkh([15eb238a/0'/0'/33']0307ff8bd227fa67c64d22306852cd8c5737a2573c48cfeb154c19316b05b363ee)#f5r5ggnm",
    "safe": true
  }
]

@levantah
Copy link

levantah commented Aug 2, 2024

Just for record, this is a draft intended to be send to Liquid Dev, but since I am uncovering things on the go, it may be slightly invalid already:

So our findings are that one can not finalize and send Liquid (tested also on the original liquidtestnet) a transaction which is formed from a PSET that spends two previous blinded outputs without sending to two new blinded outputs (or one unblinded) - see example of two blinded sending to two blinded (each of the inputs was comming from a different wallet which does both a sequential and a parallel (later combined before finalizing) walletprocesspsbt) please have a look and let me know if it is intended to work like this (the error messages do not hint that way)

@levantah
Copy link

levantah commented Aug 2, 2024

When combining PSBTs I noticed following:

error code: -4
error message:
Transaction has blind inputs belonging to this blinder but does not have outputs to blind

@Impa10r
Copy link
Author

Impa10r commented Aug 2, 2024

Your's is a separate issue. My tx was finalized, but failed to send.

@delta1 delta1 added the needs reproduction Needs a way to reproduce the bug label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction Needs a way to reproduce the bug
Projects
None yet
Development

No branches or pull requests

3 participants