Skip to content

Instantly share code, notes, and snippets.

@ryancdotorg
Last active April 26, 2021 09:48
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ryancdotorg/a0c0e62e2938168c93e51270fe7d07f5 to your computer and use it in GitHub Desktop.
Save ryancdotorg/a0c0e62e2938168c93e51270fe7d07f5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# pybitcointools https://github.com/vbuterin/pybitcointools
from bitcoin import *
# output of `bitcoin-cli getrawtransaction 828ef3b079f9c23829c56fe86e85b4a69d9e06e5b54ea597eef5fb3ffef509fe`
tx = '0100000001ba91c1d5e55a9e2fab4e41f55b862a73b24719aad13a527d169c1fad3b63b5120100000049483045022100c12a7d54972f26d14cb311339b5122f8c187417dde1e8efb6841f55c34220ae0022066632c5cd4161efa3a2837764eee9eb84975dd54c2de2865e9752585c53e7cce01ffffffff0200ca9a3b00000000434104bed827d37474beffb37efe533701ac1f7c600957a4487be8b371346f016826ee6f57ba30d88a472a0e4ecd2f07599a795f1f01de78d791b382e65ee1c58b4508ac00d2496b0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000'
# from `bitcoin-cli getrawtransaction 12b5633bad1f9c167d523ad1aa1947b2732a865bf5414eab2f9e5ae5d5c191ba 1`
spk = '410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac'
# create signature verification 'modified transaction'
modtx = signature_form(tx, 0, spk, 1)
print dbl_sha256(from_string_to_bytes(changebase(modtx, 16, 256)) + encode(1, 256, 4)[::-1])
# Outputs the hex value of Craig Wright's "sn7-message.txt" file.
print sha256(from_string_to_bytes(changebase(modtx, 16, 256)) + encode(1, 256, 4)[::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment