New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bech32m support #1038
Bech32m support #1038
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1038 +/- ##
==========================================
+ Coverage 65.40% 65.51% +0.10%
==========================================
Files 156 156
Lines 26075 26100 +25
==========================================
+ Hits 17055 17099 +44
+ Misses 9020 9001 -19
Continue to review full report at Codecov.
|
d569ec3
to
de1d7a8
Compare
ef6ff57
to
618ef49
Compare
In addition to the The indexer was added in #758 and claimed to close issue #738 which is described as follows:
The indexer module is exceptional work and solved a lot of problems including this one, however it effectively recreated the exact same problem for future witness versions. In this article the author notes that several taproot-formatted addresses exist on chain already (they are anyone-can-spend until taproot activates). One of those addresses was actually sent by me:
This is technically a version 1 witness address (although it is bech32 and not bech32m, that doesn't matter once the utxo is on-chain). The data (hash) for this address is a joke of sorts:
If you are currently running bcoin with
So these two different addresses will be indexed as the same in the current code, meaning "get TX by address" results could extraneously include transactions including the colliding address. This is an edge case for sure, since neither of these addresses are spendable. An accidental collision with usable addresses would be really insane (a version 0 script hash and a version 1 taproot program). However we have no idea how realistic a collision like this will be with future witness versions and program updates. The fix for this bug is in cca5243 and the answer is to include witness version in the address indexer. For some reason, we were not already doing this. What we were doing was using phony "address prefixes" that made witness addresses work backwards-compatibly with legacy addresses (which have actual prefixes like Since there are a handful of witness version 1 programs already on chain, anyone running bcoin with address indexer technically has corrupted data. The longer users wait to upgrade, the more corrupt data will be stored in the address indexer. This will start to get especially bad after taproot activates. This makes it pretty important to merge this bug fix before taproot activation and minimize the impact. Since users may not actually upgrade their node before activation, we will need a data migration script to fix version 1 programs inadvertently stored as version 0 in the indexer. |
618ef49
to
ded6e5e
Compare
ded6e5e
to
ab8cf1a
Compare
Co-authored-by: Nodari Chkuaselidze <nodar.chkuaselidze@gmail.com>
f74e507
to
d6a13b0
Compare
Well played, sir. Haven't done code review, but would love to see merges from Handshake + Taproot support make it into a 3.0. Feel free to share a Bounty URL for faster activation... |
ACK d6a13b0 Show Signature
pinheadmz's public key is on keybase |
Merging work from #1034 and #1035
Closes #989
Reviewers can ignore the first two commits, the backend bech32m stuff is easier to review here:
bcoin-org/libtorsion#1
bcoin-org/bcrypto#61
The most important new function here is the ability to send BTC to new Taproot addresses, which use a new format called bech32m. I tested this branch by networking bcoin and Bitcoin Core together in regtest and sending BTC from bcoin to a Taproot wallet in Bitcoin Core:
This gist explains how to start Bitcoin Core in regtest and create a taproot wallet.
Start bcoin in regtest and connect:
export BCOIN_NETWORK=regtest bcoin --daemon bcoin-cli rpc addnode 127.0.0.1:18444 add
bcoin-cli rpc generatetoaddress 10 `bwallet-cli rpc getnewaddress`