I use the "bitcoincashjs" or "bch-lib" and want to add a new opcode "OP_CHECKDATASIG" to output.How to do?

const utxo = {
    'txId' : 'b76e4563bfe2e9e40355e3791e060b774ceb9ba04bef70df151763f82acb69a0',
    'outputIndex' : 0,
    'address' : '1bbLNcTwoffAjuWTyBuu4vSwNUBNMgYgHL',
    'script' : '76a9147f27b2a0a88bc84d3db72f22ea82d52c99a6a0e088ac',
    'satoshis' : 2000

    const transaction = new bch.Transaction()
    .to('1bbLNcTwoffAjuWTyBuu4vSwNUBNMgYgHL', 1500)

They added it to their examples.md recently.

var privateKey = new bch.PrivateKey('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
var utxo = {
  "txId" : "115e8f72f39fad874cfab0deed11a80f24f967a84079fb56ddf53ea02e308986",
  "outputIndex" : 0,
  "address" : "17XBj6iFEsf8kzDMGQk5ghZipxX49VXuaV",
  "script" : "76a91447862fe165e6121af80d5dde1ecb478ed170565b88ac",
  "satoshis" : 50000

var transaction = new bch.Transaction()
    .addData('bch rocks') // Add OP_RETURN data

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.