1

enter image description here

I try to put this into a Psbt:

  1. Alice make payment to purchase an amount of BRC-20 from Bob
  2. Bob request to inscribe a transfer of BRC-20 by using Burner account
  3. Burner inscribe the transfer of BRC-20 and transfer to Bob
  4. Bob transfer the BRC-20 to Alice

Bob create the Psbt and Burner account, and signed. Then send to Alice to make payment and sign. Alice topup on price to cover all following transaction's network fee.

Issues facing now is how to get the required input utxo params from previous output? Is this possible btw with bitcoinjs-lib or any recommend library?

1 Answer 1

0

I'm trying to inscribe a Transfer of BRC-20 send an amount of Bitcoin from and to a single address. Would this possible?

Yes you can pay from an address back to the same address, though obviously you need to make an allowance for a fee, so the returned amount is less or you need an extra input to cover the fee.

This is not what is implied by the error message. It is not the source of your problem creating a valid Schnorr signature.


    const script = [
        pubkey.toString("hex"),
        "OP_CHECKSIG",
        "OP_0",
        "OP_IF",
        toHexString(ec.encode("ord")),
        "01",
        toHexString(mimetype),
        "OP_0",
        toHexString(content),
        "OP_ENDIF",
    ].join(" ");
    const leafScript = bitcoin.script.fromASM(script);

I'm unfamiliar with this Javascript .fromASM function. Presumably it adds the appropriate opcodes for the implicit data pushes? For example the pubkey.toString("hex"), has to eventually be prefixed with opcode 0x20 as the opcode for pushing 32-bytes. I'd check what .fromASM produces.

I'm also puzzled by ec.encode("ord") - it seems to be converting a UTF-8 string to UTF-8 unless your source is actually in some encoding that is not a superset of 7-bit ASCII.


My understanding of the network encoding of the relevant script is at How to differentiate between BTC transactions and BRC20 transactions on a blockchain?

1
  • Thanks, I get this code from some github repo but can't find back the source. But it's alright, now just curious how Psbt work? Modify previous question as above. Dec 17, 2023 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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