Hello
I was looking for an example of adding a memo to a Bitcoin transaction with Rosetta. Would it be simply be adding an additional Operation with the following values in the Metadata field?
import * as BitcoinJS from 'bitcoinjs-lib'
const senderAddress = 'xyz';
const memo = 'Hello World';
const ops = [... other operations to send transaction]
const memoOperation = {
operation_identifier: {
index: ops.length - 1,
},
type: 'OUTPUT',
account: {
address: senderAddress,
},
amount: {
value: '0',
currency: {
symbol: 'tBTC',
decimals: 8,
},
},
metadata: {
scriptPubKey: {
asm: `OP_RETURN ${BitcoinJS.script.toASM(Buffer.from(memo))}`,
hex: Buffer.from(memo).toString('hex'),
type: 'nulldata',
},
},
}
When I test out the above code, I get the error “Unable to parse intent” when passing to the payloads endpoint.
Thanks!