Closed utxo-detective closed 2 years ago
Here is a minimal way of reproducing.
On 1.2.3 i get expected results
On 1.3.0 i get unexpected results
import { Transaction, Script, TxOut } from 'bsv-wasm'
const ASM = '0 OP_RETURN 31394878696756345179427633744870515663554551797131707a5a56646f417574 676d 746578742f706c61696e 74657874 7477657463685f7477746578745f313634373533323430393832322e747874 7c 3150755161374b36324d694b43747373534c4b79316b683536575755374d74555235 534554 7477646174615f6a736f6e 6e756c6c 75726c 676d 636f6d6d656e74 6e756c6c 6d625f75736572 6e756c6c 7265706c79 6e756c6c 74797065 706f7374 74696d657374616d70 6e756c6c 617070 747765746368 696e766f696365 64373935653432622d323462342d343938372d386562382d353665343733316637636237 7c 313550636948473232534e4c514a584d6f5355615756693757537163376843667661 424954434f494e5f4543445341 314a4d6f6456736e376d7248643273646447645742566d324d4d7039517338565146 4834384e5336544d7977496c6a527662615849743041546b4246514b2b5431444b2f504f562b496f59326d53616c6576526b3562644232424876654d5a736a64422f4b3333577071484d5037717a79493958626d332b773d'
const rawtx = '0200000000010000000000000000fdbf01006a2231394878696756345179427633744870515663554551797131707a5a56646f41757402676d0a746578742f706c61696e04746578741f7477657463685f7477746578745f313634373533323430393832322e747874017c223150755161374b36324d694b43747373534c4b79316b683536575755374d74555235035345540b7477646174615f6a736f6e046e756c6c0375726c02676d07636f6d6d656e74046e756c6c076d625f75736572046e756c6c057265706c79046e756c6c047479706504706f73740974696d657374616d70046e756c6c036170700674776574636807696e766f6963652464373935653432622d323462342d343938372d386562382d353665343733316637636237017c22313550636948473232534e4c514a584d6f53556157566937575371633768436676610d424954434f494e5f454344534122314a4d6f6456736e376d7248643273646447645742566d324d4d70395173385651464c584834384e5336544d7977496c6a527662615849743041546b4246514b2b5431444b2f504f562b496f59326d53616c6576526b3562644232424876654d5a736a64422f4b3333577071484d5037717a79493958626d332b773d00000000'
;(async () => {
const tx = new Transaction(2, null)
const script = Script.fromASMString(ASM);
const output = new TxOut(BigInt(0), script)
tx.addOutput(output)
console.log(tx.toHex())
const newTx = Transaction.fromHex(tx.toHex())
console.log('rawtx matches expected', rawtx === tx.toHex())
console.log('asm matches expected', newTx.getOutput(0).getScriptPubKey().toASMString() === ASM)
})()
Fixed in 1.3.0-beta7
im unable to upgrade bsv-wasm to latest version, but would like to use the new testnet address support. Im currently using
1.2.3
in prod with no issues. When i upgrade to1.3.0-beta.6
, bsv-wasm butchers my op_return script when calling.toHex()
on a transaction.ASM string i want to publish, its a twetch post
ASM I get from decoding on WOC the rawtx from
transaction.toHex()
rawtx i get from
1.3.0-beta.6
with improper formatting of my op_return scriptrawtx from
1.2.3
with proper formatting of my op_return scriptAs you can see, bsv-wasm is adding op codes in the middle of my data, no tegridy