Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Apr 6, 2018

Looks like some of the commands are missing -regtest

@schancel

This comment has been minimized.

Copy link

commented Apr 6, 2018

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

@matiu

This comment has been minimized.

Copy link
Owner Author

commented Apr 11, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.