createrawtransaction allows for "ScriptPubKey" vs "scriptPubKey" #6483

issue ShawnKimble opened this issue on July 28, 2015
  1. ShawnKimble commented at 1:48 AM on July 28, 2015: none

    I have found in version 0.10.2 createrawtransaction allows for "ScriptPubKey" where signrawtransaction does not allow for "ScriptPubKey" but only "scriptPubKey". Lower case "s" vs uppercase "S". When building a transaction this can be confusing and generates error "Missing scriptPubKey (code -3)"

  2. laanwj added the label RPC on Jul 28, 2015
  3. laanwj commented at 7:23 AM on July 28, 2015: member

    Are you sure that it will actually use ScriptPubKey?

    It's not just a matter of wrong-cased fields of objects being ignored like other unused fields?

  4. ShawnKimble commented at 9:40 PM on July 28, 2015: none

    Yes, I can confirm that I was able to put in:

    createrawtransaction '[{"txid":"20155e5341155abdbc0b9f4965f206c2b5c61075bcb46d65645efe7c9ea932f9","vout":0, "ScriptPubKey":"a91407694cfd2bd43f4e0fe285a4d013456cb58d7eab87"}]' '{"12p49VwhYgyaacKkaYFzrDFNPygoXFBoA7":0.042,"1F4eZ6VktxpmLDTrBBqQQhr8tWfSuQxHoj":0.042,"112uke8odsNfcRxiWjFSjBCvT7TqyXDjHX":0.002}]'

    And get out

    0100000001f932a99e7cfe5e64656db4bc7510c6b5c206f265499f0bbcbd5a1541535e15200000000000ffffffff0340164000000000001976a91413de4d7611ea6134cfffcda444654ac388f2d4b488ac40164000000000001976a9149a425b58bbc45b36cdfb0547eecc34868dd737f288ac400d0300000000001976a914005c7393114b8a56bb563b2ed9df2d6c12fb58e588ac00000000

    Which then when I tried to sign by copy/pasting the "ScriptPubKey" portion from create rawtransaction fails due to the uppercase S with error

    Missing scriptPubKey (code -3)

  5. jonasschnelli commented at 8:33 AM on July 29, 2015: contributor

    scriptPubKey has like dummyText no affect in createrawtransaction inputs

    The code only parses txid and vout: https://github.com/bitcoin/bitcoin/blob/master/src/rpcrawtransaction.cpp#L358

    Example:

    jonasschnelli$ ./src/bitcoin-cli --regtest createrawtransaction '[{"txid":"20155e5341155abdbc0b9f4965f206c2b5c61075bcb46d65645efe7c9ea932f9","vout":0, "ScriptPubKey":"a91407694cfd2bd43f4e0fe285a4d013456cb58d7eab87", "alice":"is bob"}]' '{"miBMjNNiy5eR9UZV69GzMiapa7Hsiyib51" : 0.042}'
    0100000001f932a99e7cfe5e64656db4bc7510c6b5c206f265499f0bbcbd5a1541535e15200000000000ffffffff0140164000000000001976a9141d339f3499cdbeccbc8c7d30c122775923cb612288ac00000000
    
    jonasschnelli$ ./src/bitcoin-cli --regtest createrawtransaction '[{"txid":"20155e5341155abdbc0b9f4965f206c2b5c61075bcb46d65645efe7c9ea932f9","vout":0, "scriptPubKey":"a91407694cfd2bd43f4e0fe285a4d013456cb58d7eab87", "alice":"is bob"}]' '{"miBMjNNiy5eR9UZV69GzMiapa7Hsiyib51" : 0.042}'
    0100000001f932a99e7cfe5e64656db4bc7510c6b5c206f265499f0bbcbd5a1541535e15200000000000ffffffff0140164000000000001976a9141d339f3499cdbeccbc8c7d30c122775923cb612288ac00000000
    
  6. ShawnKimble commented at 12:21 PM on July 29, 2015: none

    Ah, thank you! So scriptPubKey is not a requirement of "createrawtransaction", but do you know if was true historically? If so, I think my error comes from seeing prior examples where scriptPubKey was used in the "createrawtransaction".

  7. ShawnKimble closed this on Jul 29, 2015

  8. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me