Skip to content

Instantly share code, notes, and snippets.

@matiu
Last active June 23, 2021 21:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matiu/f7b4afb3781c9f7c735435f19602db31 to your computer and use it in GitHub Desktop.
Save matiu/f7b4afb3781c9f7c735435f19602db31 to your computer and use it in GitHub Desktop.
Test new opcodes - bitcoin Cash
  1. run bitcoin-abc with: ./bitcoind -regtest -monolithactivationtime=0
  2. create some UTXOs: ./bitcoin-cli generate 100
  3. grab one UTXO: ./bitcoin-cli listunspent (grab the last TXIDs, vout; we will call them here: TXID: 64be40b2688e8767fc62f8556d3b9ee608aae28894b867f8228ac5aa74325aff vout: 0
  4. create a TX with the script you want to test, using P2SH: bitcoin-tx -regtest -json -create in=64be40b2688e8767fc62f8556d3b9ee608aae28894b867f8228ac5aa74325aff:0 outscript=49.999:"XOR 1 DUP":S (last :S is to use P2SH) => hex: 0200000001ff5a3274aac58a22f867b89488e2aa08e69e3b6d55f862fc67878e68b240be640000000000ffffffff01606b042a0100000017a9145944649bbd7f8d554b993e74f7b7884d2c78a2908700000000
  5. sign it: bitcoin-cli -regtest signrawtransaction 0200000001ff5a3274aac58a22f867b89488e2aa08e69e3b6d55f862fc67878e68b240be640000000000ffffffff01606b042a0100000017a9145944649bbd7f8d554b993e74f7b7884d2c78a2908700000000       => . hex: 0200000001ff5a3274aac58a22f867b89488e2aa08e69e3b6d55f862fc67878e68b240be6400000000494830450221009835b056be12a08dc48a27f2903ad2d96c6d7ea9834dffad26aac3fd2d7be6e9022016bb4f08fdc391e3ca42fc4dc1345cb90d90e50e288360f30b16b544c1a7da6a41ffffffff01606b042a0100000017a9145944649bbd7f8d554b993e74f7b7884d2c78a2908700000000
  6. send it: bitcoin-cli -regtest sendrawtransaction ./bitcoin-cli -regtest sendrawtransaction 0200000001ff5a3274aac58a22f867b89488e2aa08e69e3b6d55f862fc67878e68b240be6400000000494830450221009835b056be12a08dc48a27f2903ad2d96c6d7ea9834dffad26aac3fd2d7be6e9022016bb4f08fdc391e3ca42fc4dc1345cb90d90e50e288360f30b16b544c1a7da6a41ffffffff01606b042a0100000017a9145944649bbd7f8d554b993e74f7b7884d2c78a2908700000000 436b718f81336f01b586b298e65d412d913f9fe41d7a69b790b473e3fe0ede31 => 436b718f81336f01b586b298e65d412d913f9fe41d7a69b790b473e3fe0ede31

==

  1. check it: bitcoin-cli -regtest getrawtransaction 436b718f81336f01b586b298e65d412d913f9fe41d7a69b790b473e3fe0ede31 1

relevant portion (is it was created non-p2sh)

  "vout": [
    {
      "value": 49.99900000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_XOR 1 OP_DUP",
        "hex": "865176",
        "type": "nonstandard"
      }
    }

==

  1. spend it:
@schancel
Copy link

schancel commented Apr 6, 2018

Looks like some of the commands are missing -regtest

@schancel
Copy link

schancel commented Apr 6, 2018

You need to generate more than 100 blocks for listunspent to have any unspent txns due to coinbase maturation.

@matiu
Copy link
Author

matiu commented Apr 11, 2018

Related: https://github.com/matiu/opcode-tests
(automation to send multiple txs)

@dahuison
Copy link

나는�도데체모르겟다.도외�주는건지?�
�카카오뱅크�업로드시키다가�갑자기우리팅들이나티니는이유는�.ㅎ�
�반갑고강사.뭔진모르겟다�^^

@dahuison
Copy link

카카오뱅크입금�밎나?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment