<p>I would like to generate a bitcoin taproot address (bc1p) for burning assets. Which means not one would have the private key. But in the mean time I would also want a vanity address (an address start with a certain prefix).</p>
<p>I did some search but can't find a tool that meets the above 2 requirements. So I wrote one by my own but it looks very inefficient. Is there any better way to do this? Thanks a lot!</p>
<p>Here's my script:</p>
<pre><code>const { validate, getAddressInfo } = require('bitcoin-address-validation');

var chars = '0123456789abcdefghijklmnopqrstuvwxyz'

prefix = 'bc1pXXXXXX' //THE_PREFIX_I_WANT
subLen = 62 - prefix.length
subDigits = Array(subLen).fill(0)
digit = 0
limit = 36
while (true) {
    subString = ''
    for (i in subDigits) {
        subString = chars[subDigits[i]] + subString
    }
    while (true) {
        subDigits[digit] += 1
        if (subDigits[digit] &gt;= limit) {
            subDigits[digit] = 0
            digit++
        } else {
            break
        }
    }
    digit = 0
    addr = prefix + subString
    if (validate(addr)) {
        console.log(addr, 'IS VALID!!')
        break
    }
}
</code></pre>

CC BY-SA 4.0
2023-05-12T18:02:15.363Z
Why not use an OP_RETURN output?
Vojtěch Strnad
CC BY-SA 4.0
2023-05-12T18:07:27.167Z
It's not only about burning bitcoins. I'm considering send inscriptions to an inaccessable address, so it can be seen by anyone but no one can touch it.
daniaoren
CC BY-SA 4.0
2023-05-12T18:09:27.330Z
An OP_RETURN script could be used just the same. It could potentially also be slightly cheaper than a taproot address.
Vojtěch Strnad
CC BY-SA 4.0
2023-05-12T18:10:49.477Z
Thanks, I'll look into that
daniaoren
<blockchain><address><taproot><javascript>
Generate a Bitcoin taproot address with specific prefix for burning assets
daniaoren
# Generate a Bitcoin taproot address with specific prefix for burning assets

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

I would like to generate a bitcoin taproot address (bc1p) for burning assets. Which means not one would have the private key. But in the mean time I would also want a vanity address (an address start with a certain prefix).

I did some search but can't find a tool that meets the above 2 requirements. So I wrote one by my own but it looks very inefficient. Is there any better way to do this? Thanks a lot!

Here's my script:

```
const { validate, getAddressInfo } = require('bitcoin-address-validation');

var chars = '0123456789abcdefghijklmnopqrstuvwxyz'

prefix = 'bc1pXXXXXX' //THE_PREFIX_I_WANT
subLen = 62 - prefix.length
subDigits = Array(subLen).fill(0)
digit = 0
limit = 36
while (true) {
    subString = ''
    for (i in subDigits) {
        subString = chars[subDigits[i]] + subString
    }
    while (true) {
        subDigits[digit] += 1
        if (subDigits[digit] >= limit) {
            subDigits[digit] = 0
            digit++
        } else {
            break
        }
    }
    digit = 0
    addr = prefix + subString
    if (validate(addr)) {
        console.log(addr, 'IS VALID!!')
        break
    }
}

```

**Tags:** blockchain, address, taproot, javascript

> **Comments:**
> **username_1**: Why not use an OP_RETURN output?  
> **username_0**: It's not only about burning bitcoins. I'm considering send inscriptions to an inaccessable address, so it can be seen by anyone but no one can touch it.  
> **username_1**: An OP_RETURN script could be used just the same. It could potentially also be slightly cheaper than a taproot address.  
> **username_0**: Thanks, I'll look into that  

---

## 0 answers

