Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: FabioCarpi on December 23, 2016, 03:58:29 PM



Title: Doubt in tx
Post by: FabioCarpi on December 23, 2016, 03:58:29 PM
Playing in the regtest mode....
Where is the pubkey?

Code:
{
  "txid": "1e6d1fe8b3cbda4a2824e322cddea7e76529f0e9817a631af8f0290e433b51f9",
  "hash": "1e6d1fe8b3cbda4a2824e322cddea7e76529f0e9817a631af8f0290e433b51f9",
  "size": 158,
  "vsize": 158,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "66a4042702dd726b86b265fd6c7438c082b2ebcbbf3a765ce9af304e46499264",
      "vout": 0,
      "scriptSig": {
        "asm": "3045022100b8e09b4c9fadede9c1fbecb0031227d477736e8c8f897f08adf8abb50d8d2e770220247e312a95bc9bc4941ad029bdeb83f7e2ef22edda54bfb76c50d7ea8e4bfc6b[ALL]",
        "hex": "483045022100b8e09b4c9fadede9c1fbecb0031227d477736e8c8f897f08adf8abb50d8d2e770220247e312a95bc9bc4941ad029bdeb83f7e2ef22edda54bfb76c50d7ea8e4bfc6b01"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 49.99900000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 a65fc62dfa044a906421459fd5d8592b47d62e64 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914a65fc62dfa044a906421459fd5d8592b47d62e6488ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mvgfCQFcgvzEQuoxBVoSHBE51TZ8kMjs22"
        ]
      }
    }
  ]
}


Title: Re: Doubt in tx
Post by: achow101 on December 23, 2016, 04:00:39 PM
Check the output that you are spending from. It is likely to be a pay-to-pubkey output, so the pubkey is in that output and thus not in the spending transaction.

The p2pk outputs are created by default by the internal miner in Bitcoin Core as that behavior has not been changed since the switch to p2pkh.


Title: Re: Doubt in tx
Post by: FabioCarpi on December 23, 2016, 04:30:31 PM
Strange....
Normally the pubkey come after the der sign...


Title: Re: Doubt in tx
Post by: achow101 on December 23, 2016, 04:37:44 PM
Strange....
Normally the pubkey come after the der sign...
No, not strange at all. The pubkey did that for pay-to-pubkey-hash outputs. The output you are spending from is pay-to-pubkey so it already has the pubkey in the output.


Title: Re: Doubt in tx
Post by: FabioCarpi on December 23, 2016, 04:59:42 PM
I got it
The coinbase sent to a pubkey....
The script part of Bitcoin intrigued me yet...
Ty