<blockquote>
<p>I'm trying to <strike>inscribe a Transfer of BRC-20</strike> <em>send an amount of Bitcoin</em> from and to a single address. Would this possible?</p>
</blockquote>
<p>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.</p>
<p>This is not what is implied by the error message. It is not the source of your problem creating a valid Schnorr signature.</p>
<hr />
<pre class="lang-javascript prettyprint-override"><code>    const script = [
        pubkey.toString(&quot;hex&quot;),
        &quot;OP_CHECKSIG&quot;,
        &quot;OP_0&quot;,
        &quot;OP_IF&quot;,
        toHexString(ec.encode(&quot;ord&quot;)),
        &quot;01&quot;,
        toHexString(mimetype),
        &quot;OP_0&quot;,
        toHexString(content),
        &quot;OP_ENDIF&quot;,
    ].join(&quot; &quot;);
    const leafScript = bitcoin.script.fromASM(script);
</code></pre>
<p>I'm unfamiliar with this Javascript <code>.fromASM</code> function. Presumably it adds the appropriate opcodes for the implicit data pushes? For example the <code>pubkey.toString(&quot;hex&quot;),</code> has to eventually be prefixed with opcode <code>0x20</code> as the opcode for pushing 32-bytes. I'd check what <code>.fromASM</code> produces.</p>
<p>I'm also puzzled by <code>ec.encode(&quot;ord&quot;)</code> - 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.</p>
<hr />
<p>My understanding of the network encoding of the relevant script is at <a href="https://bitcoin.stackexchange.com/q/118988/13866">How to differentiate between BTC transactions and BRC20 transactions on a blockchain?</a></p>

CC BY-SA 4.0
2023-12-17T13:17:00.543Z
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.
LikKee 沥祺 Richie
CC BY-SA 4.0
2023-12-15T15:34:35.213Z
2023-12-15T15:56:32.563Z
2023-12-15T15:56:32.563Z
RedGrittyBrick
<p><a href="https://i.sstatic.net/XOne8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XOne8.png" alt="enter image description here" /></a></p>
<p>I try to put this into a Psbt:</p>
<ol>
<li>Alice make payment to purchase an amount of BRC-20 from Bob</li>
<li>Bob request to inscribe a transfer of BRC-20 by using Burner account</li>
<li>Burner inscribe the transfer of BRC-20 and transfer to Bob</li>
<li>Bob transfer the BRC-20 to Alice</li>
</ol>
<p>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.</p>
<p>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?</p>

<taproot><javascript><bip174-psbt>
non-mandatory-script-verify-flag (Invalid Schnorr signature)
LikKee 沥祺 Richie
# non-mandatory-script-verify-flag (Invalid Schnorr signature)

(Asked by: username_0 on 2023-12-14)

[![enter image description here](https://i.sstatic.net/XOne8.png)](https://i.sstatic.net/XOne8.png)

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?

**Tags:** taproot, javascript, bip174-psbt


---

## 1 answers

### Answer by username_1 on 2023-12-15. Score: 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.

---

```javascript
    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?](https://bitcoin.stackexchange.com/q/118988/13866)

> **Comments:**
> **username_0**: 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.  

---

