2

To spend a UTXO, we need to sign it (have the scriptSig). Then we can spend that UTXO to any address we want, which it wasn't included in the signature we produced for unlocking the UTXO. So we should provide another signature to express our intention that we want to spend to this specific output[s]. Is this right? When I try to observe a transaction using bitcoin-cli I don't see any signature for the whole transaction.

# bitcoin-cli -regtest  gettransaction 58abd7cda78c3140383bbf950420171b6e630f784d33392b968d9db7ea7d6c25
{
  "amount": 0.00000000,
  "fee": -0.00002820,
  "confirmations": 0,
  "trusted": true,
  "txid": "58abd7cda78c3140383bbf950420171b6e630f784d33392b968d9db7ea7d6c25",
  "wtxid": "40ef85dd2f2f54254f13c179b8fa18a247d493fd3f583ce4c0932754dfad89ed",
  "walletconflicts": [
  ],
  "time": 1683793800,
  "timereceived": 1683793800,
  "bip125-replaceable": "yes",
  "details": [
    {
      "address": "bcrt1qt3lltc5dx4gwmlcd0uqxkl85xrv7msfkmjyjts",
      "category": "send",
      "amount": -12.34500000,
      "label": "",
      "vout": 1,
      "fee": -0.00002820,
      "abandoned": false
    },
    {
      "address": "bcrt1qt3lltc5dx4gwmlcd0uqxkl85xrv7msfkmjyjts",
      "parent_descs": [
        "wpkh(tpubD6NzVbkrYhZ4YcCHtvXU4pzZAcAH2eet5KJvzXoxvjGGdBzAepGK3keAQS8pv1pQYyM4VdudgnmaDr4YXXemgdtKh4Yh5cbG3uCHV8q7Aub/84'/1'/0'/0/*)#h8mhq3zh"
      ],
      "category": "receive",
      "amount": 12.34500000,
      "label": "",
      "vout": 1
    }
  ],
  "hex": "020000000001016c34e216d1f6821d91bc42e377290a7d30968da52c88678ecc2b47757ee8333d0000000000fdffffff025ced70e000000000160014bde66028298d70a6ec1bbb8e9c0a87f40db4c8d9a0f99449000000001600145c7ff5e28d3550edff0d7f006b7cf430d9edc136024730440220045193a2e68e19f815741f1b6338fc8c52d6808b5b63e387f1ef411e509bf78002207ab592b6d5bd9b47a6c0b4cdad119b05a43cb8274ecb5bffd16de881ecaa005d0121024bad563526f76fdbb915e7af18aed4ff8c48cf853440c2fda07076078d1c1346cb000000"
}
# bitcoin-cli -regtest getblock 757783d237294945126b5966a46ddaf44e3ce04b0cd5bba726dc441dbadbb5be 2
{
  "hash": "757783d237294945126b5966a46ddaf44e3ce04b0cd5bba726dc441dbadbb5be",
  "confirmations": 1,
  "height": 204,
  "version": 805306368,
  "versionHex": "30000000",
  "merkleroot": "b2de6af12b36d32bad5f358cabab6d5dee5d976568a5039f5fd7273ee0905afa",
  "time": 1683795140,
  "mediantime": 1683793734,
  "nonce": 0,
  "bits": "207fffff",
  "difficulty": 4.656542373906925e-10,
  "chainwork": "000000000000000000000000000000000000000000000000000000000000019a",
  "nTx": 2,
  "previousblockhash": "2b6ce151ace43623880979d4b137e14865e07d59195b242fa273b13dd6b59c13",
  "strippedsize": 327,
  "size": 472,
  "weight": 1453,
  "tx": [
    {
      "txid": "860c1c07d52b2709e717780f1c91845ca338199da9eead89069ff458dc59e509",
      "hash": "957b22a4ce7df3e0b05bdf216f9ca14bd8f1bcae3ebc68870ef92035af941fe4",
      "version": 2,
      "size": 169,
      "vsize": 142,
      "weight": 568,
      "locktime": 0,
      "vin": [
        {
          "coinbase": "02cc0000",
          "txinwitness": [
            "0000000000000000000000000000000000000000000000000000000000000000"
          ],
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 25.00002820,
          "n": 0,
          "scriptPubKey": {
            "asm": "0 798fcf4772e285431c55ce67f2e0333f11d03f8b",
            "desc": "addr(bcrt1q0x8u73mju2z5x8z4eenl9cpn8ugaq0utj7n0jd)#nxvln3g4",
            "hex": "0014798fcf4772e285431c55ce67f2e0333f11d03f8b",
            "address": "bcrt1q0x8u73mju2z5x8z4eenl9cpn8ugaq0utj7n0jd",
            "type": "witness_v0_keyhash"
          }
        },
        {
          "value": 0.00000000,
          "n": 1,


      "weight": 561,
      "locktime": 203,
      "vin": [
        {
          "txid": "3d33e87e75472bcc8e67882ca58d96307d0a2977e342bc911d82f6d116e2346c",
          "vout": 0,
          "scriptSig": {
            "asm": "",
            "hex": ""
          },
          "txinwitness": [
            "30440220045193a2e68e19f815741f1b6338fc8c52d6808b5b63e387f1ef411e509bf78002207ab592b6d5bd9b47a6c0b4cdad119b05a43cb8274ecb5bffd16de881ecaa005d01",
            "024bad563526f76fdbb915e7af18aed4ff8c48cf853440c2fda07076078d1c1346"
          ],
          "sequence": 4294967293
        }
      ],
      "vout": [
        {
          "value": 37.65497180,
          "n": 0,
          "scriptPubKey": {
            "asm": "0 bde66028298d70a6ec1bbb8e9c0a87f40db4c8d9",
            "desc": "addr(bcrt1qhhnxq2pf34c2dmqmhw8fcz587sxmfjxef2k5ag)#x0qwx2ck",
            "hex": "0014bde66028298d70a6ec1bbb8e9c0a87f40db4c8d9",
            "address": "bcrt1qhhnxq2pf34c2dmqmhw8fcz587sxmfjxef2k5ag",
            "type": "witness_v0_keyhash"
          }
        },
        {
          "value": 12.34500000,
          "n": 1,
          "scriptPubKey": {
            "asm": "0 5c7ff5e28d3550edff0d7f006b7cf430d9edc136",
            "desc": "addr(bcrt1qt3lltc5dx4gwmlcd0uqxkl85xrv7msfkmjyjts)#f706enkn",
            "hex": "00145c7ff5e28d3550edff0d7f006b7cf430d9edc136",
            "address": "bcrt1qt3lltc5dx4gwmlcd0uqxkl85xrv7msfkmjyjts",
            "type": "witness_v0_keyhash"
          }
        }
      ],
      "fee": 0.00002820,
      "hex": "020000000001016c34e216d1f6821d91bc42e377290a7d30968da52c88678ecc2b47757ee8333d0000000000fdffffff025ced70e000000000160014bde66028298d70a6ec1bbb8e9c0a87f40db4c8d9a0f99449000000001600145c7ff5e28d3550edff0d7f006b7cf430d9edc136024730440220045193a2e68e19f815741f1b6338fc8c52d6808b5b63e387f1ef411e509bf78002207ab592b6d5bd9b47a6c0b4cdad119b05a43cb8274ecb5bffd16de881ecaa005d0121024bad563526f76fdbb915e7af18aed4ff8c48cf853440c2fda07076078d1c1346cb000000"
    }
  ]
}
Vojtěch Strnad
  • 5,623
  • 1
  • 8
  • 31
Amir reza Riahi
  • 1,133
  • 7
  • 22

1 Answers1

3

Modern transaction, since SegWit, include signatures in a new field: the witness. The witness replaces the scriptSig. You can see in your example how txinwitness contains a public key and a signature for the single input of your transaction.

Related: "What is the Witness and what data does it contain?".

Antoine Poinsot
  • 5,881
  • 2
  • 11
  • 28