OnlyBits

Advanced · 06 The output type under every OnlyBits address

Taproot explained.

Taproot is the kind of Bitcoin output that locks a coin to a single public key, which can also carry a hidden list of other ways to spend it. Its Schnorr signatures add together, so two people can build one key and one signature between them, and a shared payment looks on the chain like anyone else's.

01 The payment

A payment from a shared wallet looks the same on the chain as a payment from one person

A shared wallet held by Alice and Bob needs both of them to spend. Take two payments: the shared wallet pays Carol 60,000 sats from a 200,000 sat coin, and a single-key savings wallet pays 20,000 sats.

An onlooker opens both transactions on a public block explorer such as mempool.space. Each has one coin going in, signed by one 64-byte signature, and coins coming out to addresses that start with bc1p. Nothing in either says how many people agreed to it. The rest of this page is how that works: a signature scheme whose keys add up, and an output type that commits to one key.

SHARED WALLET, TWO SIGNERS INPUT bc1p... 200,000 witness: one 64-byte signature OUTPUTS bc1p... 60,000 + bc1p... change SAVINGS, ONE SIGNER INPUT bc1p... 90,000 witness: one 64-byte signature OUTPUTS bc1p... 20,000 + bc1p... change
The signature is where the difference used to show. Section 11 comes back to what an onlooker can still tell apart, which is not nothing.
In OnlyBits

What you see: a shared wallet card reading "2 people. 2 approvals.", and on Bob's phone "Needs your approval" with an "Approve" button.

What it hides: everything this page describes. Neither the word Taproot nor the word Schnorr appears anywhere in the app.

Look underneath

Taproot activated at block 709,632 in November 2021, as a soft fork defined by three documents:

  • BIP340: Schnorr signatures and 32-byte public keys for secp256k1.
  • BIP341: the Taproot output (witness version 1) and its two spending paths.
  • BIP342: Tapscript, the script rules inside the hidden tree.

BIP350 (bech32m addresses), BIP86 (single-key derivation) and BIP327 (MuSig2) sit beside them. Every coin OnlyBits creates on chain is a witness version 1 output: savings, the shared wallet, and locks.

The amounts are illustrative.

02 The old way

Before Taproot, a shared wallet published every key and every signature when it spent

The usual way to share a wallet before Taproot was a multisig script: a small program on the coin that says "two signatures, from these two keys".

The script stays secret, as a hash, until the coin is spent. Spending it means publishing the script itself, both public keys and both signatures. Anyone reading the chain then knows the coin belonged to two people who both signed, and every later payment from the same wallet looks the same. It also costs more: two signatures and a script take more block space than one signature, and block space is what the fee pays for.

OLDER 2-OF-2 MULTISIG (P2WSH), WHAT A SPEND REVEALS sig A sig B 2 <key A> <key B> 2 CHECKMULTISIG ~100 vB TAPROOT KEY PATH, WHAT A SPEND REVEALS sig and nothing else 57.5 vB
The old spend is honest about its owners because it has to be: the chain checks the script it is shown. Taproot's trick is to give the chain less to check.
In OnlyBits

What you see: a shared wallet that pays like any other account, once everyone has approved.

What it decides: no older script types at all. Savings, the shared wallet and locks are all Taproot, so the app never builds a multisig script.

Look underneath

A P2WSH 2-of-2 input

witness:
  <empty>                     # the CHECKMULTISIG off-by-one
  <sig_a>  ~72 bytes, DER
  <sig_b>  ~72 bytes, DER
  OP_2 <33-byte key_a> <33-byte key_b> OP_2 OP_CHECKMULTISIG

About 41 non-witness bytes plus roughly 220 witness units, so about 96 to 105 virtual bytes depending on signature lengths.

A Taproot key-path input

witness:
  <sig>    64 bytes             # 65 with a non-default sighash flag

41 non-witness bytes plus 66 witness units: 57.5 virtual bytes, the same whether one person signed or three.

03 Schnorr

Taproot uses Schnorr signatures, which are shorter than the ECDSA signatures Bitcoin used before

A signature proves that the holder of a private key approved one exact transaction, without revealing the key. Bitcoin's first signature scheme was ECDSA. Taproot uses Schnorr signatures, defined in BIP340.

Both work on the same curve with the same private keys, so a recovery phrase does not care which one is used. The differences are in the shape. A Schnorr signature is always 64 bytes and its public key is 32, where ECDSA's are around 72 and 33. Schnorr signing is a single equation with no division in it, and the security proof for it is simpler. The property that matters most for this page is that the equation is linear: keys and signatures can be added together, which the next section uses.

ECDSA signature ~72 bytes public key 33 Schnorr signature 64 bytes public key 32 always 64
The bytes saved per input are small. The reason Taproot switched is the arithmetic in the next section, not the size.
In OnlyBits

What you see: nothing. The phone lock asks for a fingerprint before money leaves, and the signature is made after that.

What it hides: the keys that sign. Savings keys come from m/86'/coin'/0' of the recovery phrase, the shared wallet's from m/86'/coin'/1', locks from m/86'/coin'/2'.

Look underneath

With private key x, public key P = x·G, a fresh secret nonce k and R = k·G:

e = H_BIP0340/challenge( R.x || P.x || msg )
s = k + e·x            # mod n
signature = ( R.x , s )   # 32 + 32 bytes

verify:  s·G == R + e·P

BIP340 keys are x-only: only the x coordinate is published, and the y coordinate is taken to be the even one. That is how the key drops from 33 bytes to 32.

ECDSA computes s = k⁻¹·(z + r·x). The inverse of k is what makes ECDSA signatures from two people impossible to add directly; schemes for joint ECDSA exist but need far more rounds of interaction.

04 Keys that add

Schnorr keys and signatures add up, so two people can make one key and one signature together

Because the Schnorr equation is linear, Alice's public key plus Bob's public key is itself a valid public key. Nobody knows its private key, but Alice and Bob each know half of it.

To spend from that joint key, each of them makes a partial signature with their own private key, over the same transaction. Added together, the two partial signatures form one ordinary 64-byte signature that checks out against the joint key. Neither can produce it alone, because each is missing the other's half. The network only ever sees the joint key and the final signature, which is why the payment to Carol looks like a single-key savings payment.

Step 1

Alice and Bob each have an ordinary key pair. They swap public keys and keep their private keys.

Step 2

Each phone adds the two public keys. The sum P is a valid public key, and the coin is locked to it. No one holds its private key.

Step 3

To pay, each signs the same transaction with their own private key. That gives two partial signatures. Neither one is valid alone.

Step 4

The partial signatures add up the same way the keys did. The sum is one 64-byte signature that checks against P.

Step 5

The chain receives P and the signature, nothing else. It cannot tell whether one person signed or two.

Alice: key A Bob: key B joint key P = A + B partial sig s_a partial sig s_b + s = s_a + s_b ON THE CHAIN
Keys are points on a curve and signatures are numbers. Both add, which is the whole trick.
In OnlyBits

What you see: Alice proposes the payment; Bob gets "Needs your approval" and taps "Approve" whenever he likes.

What it hides: the two rounds of messages between the phones that produce the signature. They run only after everyone has approved, directly between the phones, with each phone's secret numbers kept in memory and used once.

Look underneath

The naive version, which the next section breaks:

P   = P_a + P_b
R   = R_a + R_b               # each signer's nonce point
e   = H( R || P || msg )
s_a = k_a + e·x_a
s_b = k_b + e·x_b
s   = s_a + s_b               # s·G = R + e·P

Every signer needs R before computing e, so nonces have to be exchanged before partial signatures. That exchange is the first round of MuSig2; the partial signatures are the second. OnlyBits runs both rounds over iroh, with a 60 second timeout per round, using the musig2 Rust crate.

05 Rogue key

Adding keys naively lets one person cancel the other's key, and MuSig2 stops it by weighting each key

Suppose Bob wants the shared wallet to himself. When the two phones swap public keys to set it up, he waits for Alice's key first.

Then, instead of his real key, he announces his real key minus Alice's key. Added to Alice's key, that gives exactly Bob's real key, whose private key he knows. The "joint" key is now his alone, and he can spend the shared coins without Alice. This is the rogue-key attack. MuSig2 (BIP327) stops it by multiplying every key by a weight before adding, and each weight is a hash of the whole list of keys. Bob cannot pick a key that cancels Alice's, because changing his key changes every weight, including the one on Alice's key.

Step 1

Alice sends her public key A first.

Step 2

Bob has seen A, so instead of his real key B he announces B' = B minus A.

Step 3

Adding the announced keys gives A + B - A, which is B. Bob knows the private key for B, so the shared coin is his alone.

Step 4

MuSig2 multiplies each key by a weight before adding. The weights come from a hash of the whole key list.

Step 5

Bob's announced key is an input to Alice's weight. Any key he picks to cancel hers changes the weight it was meant to cancel, so the sum needs both private keys.

NAIVE: ADD THE KEYS A + B' = B - A = B Bob signs alone MUSIG2: WEIGHT EACH KEY, THEN ADD a1 · A + a2 · B' = needs both a1 = H(L, A), L = H(A, B') B' FEEDS INTO a1: PICK B' AND a1 MOVES
The attack needs nothing but going second in the key exchange. That is why "just add the keys" is never how a real wallet does it.
In OnlyBits

What you see: a short code to compare aloud when you add a contact, and a shared wallet set up from contacts you already trust.

What it decides: MuSig2 key aggregation, always. Keys are sorted before aggregating, so both phones compute the same address whoever started. Shared wallets explained follows the whole setup and signing.

Look underneath

BIP327 KeyAgg

L    = H_KeyAgg_list( X_1 || X_2 || ... || X_n )
a_i  = H_KeyAgg_coefficient( L || X_i )
       # except the second distinct key, whose a_i = 1
P    = sum( a_i · X_i )

Each signer's partial signature becomes s_i = k_i + e·a_i·x_i. MuSig2 also has each signer send two nonce points and combines them with another hash, which closes a separate attack on the nonce round that older two-round schemes were open to.

In the app

src/taproot.rs requires the signer list to be sorted by account xpub, derives one key per signer at 86'/coin'/1'/0/0, and builds KeyAggContext::new(keys). 2 or 3 signers, all of whom must sign.

06 The output

A Taproot output is one public key that can also commit to a hidden tree of spending rules

The joint key needs somewhere to live on the chain. BIP341 defines the Taproot output: a coin locked to exactly one 32-byte public key, called the output key.

The output key is built from two parts. The first is an internal key, such as Alice and Bob's joint key. The second is optional: a tree of scripts, each one a different rule for spending the coin, like "Alice alone after a date". The tree is reduced to a single hash, and the internal key is nudged by an amount derived from that hash. This nudge is called the tweak. The output key commits to both parts, but from the outside it is just a key, and nobody can tell whether there is a tree behind it.

Step 1

Start with an internal key P. For the shared wallet it is the joint key from section 04.

Step 2

Optionally, write some spending rules as scripts. They are hashed in pairs up to one root hash, like a family tree read upwards.

Step 3

Hash P together with the root. The result is the tweak, t. With no tree, the tweak is a hash of P alone.

Step 4

Nudge P by the tweak: Q = P + t·G. Q is the output key, and it commits to both P and the tree.

Step 5

Only Q goes on the chain, as 32 bytes. Nothing in it says whether a tree exists.

internal key P root script 1 script 2 OPTIONAL TREE tweak t t = H(P, root) output key Q Q = P + t·G ON THE CHAIN: ONLY Q, 32 BYTES
The tree does not have to exist for the output to be valid, and nothing on the chain says whether it does. That ambiguity is the privacy.
In OnlyBits

What you see: an address. That address is the output key Q, written in the encoding of section 10.

What it decides: which of three shapes each account uses. The next three sections take them in turn.

Look underneath
leaf hash   = H_TapLeaf( leaf_version || compact_size(script) || script )
branch hash = H_TapBranch( sorted(left, right) )
merkle_root = the top branch, or the only leaf
t = H_TapTweak( P.x || merkle_root )       # merkle_root omitted when there is no tree
Q = P + t·G
scriptPubKey = OP_1 <Q.x>                  # 34 bytes

H_tag(x) is BIP340's tagged hash, SHA256(SHA256(tag) || SHA256(tag) || x), so a hash made for one purpose cannot be passed off as another.

Because Q is a plain public key, whoever holds the private key of P can also sign for Q: they add t to their private key. For a MuSig2 joint key, the tweak is applied to the aggregate, and the signers account for it when they combine partial signatures.

07 Two paths

A Taproot coin is spent either with a signature for the key or by revealing one rule from the tree

The two parts of the output key give two ways to spend the coin.

The key path is a single signature for the output key, made by whoever controls the internal key. It reveals nothing about any tree. The script path shows one script from the tree, the inputs that satisfy it, and a short proof that the script was part of the tree the output key committed to. Only that one script is revealed. The others stay hidden forever. The intended pattern is that everyone agrees and uses the key path, and the scripts sit unused as fallbacks.

Step 1

A coin sits on the chain locked to output key Q.

Step 2

Key path: whoever controls P signs for Q. The spend shows one 64-byte signature and nothing about any tree.

Step 3

Script path: instead, pick one script from the tree, here script 1.

Step 4

The spend shows that script, the inputs that satisfy it, and a proof: P plus the hashes needed to rebuild the root. The chain recomputes Q from them.

Step 5

Script 2 is never shown. Only its hash appears in the proof, which reveals nothing about what it says.

output key Q KEY PATH signature THAT IS ALL SCRIPT PATH root script 1 script 2 hash only THE SPEND SHOWS inputs script 1 proof: P, H(script 2)
A script-path spend tells the onlooker this coin had rules. A key-path spend does not even tell them whether it had any.
In OnlyBits

What you see: no choice of path. Savings and shared payments always use the key path, and unlocking a lock always uses the script path.

What it hides: the witness, the control block and the leaf version, all built by BDK and the app's own signing code.

Look underneath

Key path witness

<64-byte signature>

Script path witness

<inputs to the script ...>
<script>
<control block>   # 1 byte: leaf version | parity of Q.y
                  # 32 bytes: internal key P
                  # 32 bytes per tree level: sibling hashes

The verifier rebuilds the merkle root from the script and the sibling hashes, recomputes Q = P + H_TapTweak(P || root)·G, and checks it matches the coin. The script then runs under BIP342 Tapscript rules, where OP_CHECKMULTISIG is gone and OP_CHECKSIGADD replaces it.

08 No script path

Savings and the shared wallet commit to no tree at all, so the key is the only way to spend them

BIP86 is the standard for single-key Taproot wallets. It says: build the output key with the tweak, but with no tree in it.

The tweak still matters. It proves to anyone who later learns the internal key that no script was hidden, because a tree would have produced a different output key. Savings uses this shape with the wallet's own key as the internal key. The shared wallet uses the same shape with Alice and Bob's joint key. In both, the only way to spend is a key-path signature, and for the shared wallet that means both of them signing.

SAVINGS wallet key tweak, no tree output key SHARED WALLET Alice Bob MuSig2, then tweak output key
Same shape, same size, same signature. The only difference is how many people had to cooperate to make the internal key, and that never reaches the chain.
In OnlyBits

What you see: "Every person approves each payment from their own phone, so all of you must agree to spend."

What it decides: no backup rule in the tree. There is no "Alice alone after a year" path for the shared wallet. If one of them loses their keys for good, the coins cannot move.

Look underneath
# savings descriptor
tr([fp/86'/coin'/0']xpub/0/*)

# BIP86 tweak, no merkle root
t = H_TapTweak( P.x )
Q = P + t·G

The shared wallet, in src/taproot.rs:

untweaked    = KeyAggContext::new(keys)
internal_key = untweaked.aggregated_pubkey()
context      = untweaked.with_unspendable_taproot_tweak()
address      = p2tr_tweaked(context.aggregated_pubkey())

"Unspendable" in the crate's method name refers to the script path: the tweak commits to no tree, so no script can ever satisfy it. The key path is spendable as normal.

09 The lock

A lock uses an internal key that nobody holds, so its single script is the only way in

OnlyBits can lock savings away until a date, so that nobody, the owner included, can spend them early. That needs the opposite shape: a tree with no usable key.

The internal key is a special point, written into BIP341, that is built so that no one can know its private key. It is called a NUMS point, for "nothing up my sleeve", because anyone can check how it was made. With the key path closed, the coin can only be spent through the tree, and the tree has one script: "a signature from the wallet's lock key, and the date has passed". The chain refuses any spend before the date, whoever signs it. Locks explained covers the dates and the clock.

NUMS point no private key exists key path closed THE ONLY SCRIPT the lock key signs AND the date has passed after the date script path spend
Savings closes the script path and keeps the key path; the lock does the reverse. Same output type, opposite choices.
In OnlyBits

What you see: "Nobody, you included, can move these coins before their date."

What it hides: the lock key, which is derived from the recovery phrase and the unlock minute, so the words and the date are enough to find a lock again.

Look underneath
# src/timelock.rs
tr(50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0,
   and_v(v:pk([fp/86'/coin'/2']xpub/0/{minute}), after({time})))

# the leaf script
<lock_key> OP_CHECKSIGVERIFY <time> OP_CHECKLOCKTIMEVERIFY

The x coordinate is BIP341's suggested NUMS point H, the hash of the uncompressed encoding of the generator G lifted to the curve. The app uses H directly rather than H + r·G with a random r, which means a spend reveals a well-known key in its control block.

time is a Unix timestamp (above 500,000,000, so CLTV reads it as a time, not a height), compared against the median time of the last 11 blocks.

10 Addresses

Taproot addresses start with bc1p and use a corrected checksum called bech32m

An address is the output key written out for people to copy, with a checksum that catches typing mistakes.

Taproot addresses use bech32m, defined in BIP350. The bc says mainnet, the 1 separates it from the data, and the p is the version number 1 in this alphabet. After that come the 32 bytes of the output key and a six-character checksum. The older bech32 format, used by bc1q addresses, had a flaw: some mistakes near the end of an address went undetected. Bech32m changes one constant in the checksum to fix it, and the two formats are not interchangeable, so a wallet that only knows bech32 rejects a bc1p address rather than paying it wrongly.

bc 1 p 5cyxnuxmeuwuvkwfem96lqzszd02n6xdcjrs... checksum network version 1 the 32-byte output key Q, 52 characters 6 characters 62 characters in all on mainnet; tb1p on Testnet4 and Signet, bcrt1p on Regtest
The address is the key, not a pointer to it. Anyone who sees an address sees exactly what the chain will see in the output.
In OnlyBits

What you see: savings and shared addresses beginning bc1p, as text and as a QR code.

What it decides: all-uppercase addresses from QR codes are lowercased before checking, and every address is checked against the wallet's network, so a test address cannot be paid from mainnet.

Look underneath
bech32 constant   (v0, BIP173): 1
bech32m constant  (v1+, BIP350): 0x2bc830a3

The data part is the witness version (one 5-bit character) followed by the program converted from 8-bit to 5-bit groups: 32 bytes become 52 characters. With bc1 and a 6-character checksum, that is 62 characters.

The flaw in bech32: inserting or deleting q characters just before a final p could leave the checksum valid. For v0 programs the fixed lengths of 20 and 32 bytes caught that in practice; witness version 1 and later needed a real fix.

The address drawn above is truncated and illustrative.

11 The onlooker

An onlooker sees the output type every time, and the rules only when a script path is used

Each kind of OnlyBits spend gives away something different to anyone reading the chain.

A savings payment shows one Taproot input with one signature. The shared payment to Carol shows the same. A lock being opened shows a script with a date in it and the well-known NUMS key, so it reads plainly as a coin that was locked until that date. In all three, the onlooker learns that the coins are Taproot, the amounts, and the addresses. What the key path hides is the number of people and any rules that were never used.

SPEND THE ONLOOKER SEES HOW MANY SIGNED? savings one 64-byte signature cannot tell Alice Bob one 64-byte signature cannot tell a lock script + date + NUMS key reads as a time lock one, after a date
Taproot hides what did not happen. A script that runs is published in full, so the lock is the one OnlyBits spend that announces itself.
What the shared wallet still gives away

The shared wallet has one fixed address, and its change goes back to that same address. An onlooker who sees a payment whose change returns to the address it came from learns that this wallet reuses its address, which savings never does, and can link every payment the shared wallet ever made. Taproot hides that two people signed. It does not hide that the payments belong together.

In OnlyBits

What you see: one address for the shared wallet, the same every time it is shown.

What it decides: a fixed address, because every signer has to agree on every address, and a single one needs no further coordination between phones. Savings, by contrast, shows the next unused address each time.

Look underneath

Per spend, what is on the chain

  • Savings: input from a BIP86 key at 86'/coin'/0'/0/* or /1/*; witness one signature; change to a fresh /1/* address.
  • Shared: input from the fixed MuSig2 address; witness one signature; at most one payment output and at most one change output, back to the same address.
  • Lock: witness signature, the 40-odd byte leaf script, and a 33-byte control block that begins with the NUMS x coordinate; the transaction's nLockTime is at or past the unlock time.

What is never on the chain

The MuSig2 nonces and partial signatures, the proposal and approvals sent between phones over iroh, the contact names, and the fact that the participants use the same app.

Common heuristics still apply to all three: inputs spent together are assumed to share an owner, and round amounts suggest which output is the payment.

12 The bill

Taproot hides who signed but not that Taproot was used, and a key-path-only wallet has no fallback

Most outputs on the chain are still older types. A bc1p output stands out among them, so using Taproot is itself a small signal about which wallets might have made it.

The privacy grows as more wallets adopt it, and OnlyBits cannot change that alone. The cost is also in the design. A shared wallet with only a key path needs every signer, every time, forever: there is no hidden "after a year, two of us are enough" rule to fall back on, because OnlyBits does not put one in the tree. Bob losing his phone and his recovery words means the shared coins cannot move. A Taproot output is also 12 bytes larger than an older single-key output, which the person paying into it covers, though the smaller signature makes spending it cheaper.

THE TYPE IS VISIBLE bc1p NO FALLBACK shared output Alice Bob key path: both, always script path: none Bob's key lost = coins stuck
Both costs are choices. Adoption is the world's, and the missing fallback is the app's, made to keep the shared wallet simple and its spends indistinguishable.
In OnlyBits

What you see, on a lost phone: "Any other signer can send the wallet back. Their app must be open." That restores the wallet's details to a phone that still has the keys from the recovery words or the Google backup.

What it does not do: recover a shared wallet when a signer's keys are gone for good. There is no recovery or time-lock path for shared wallets.

Look underneath

Sizes

output   P2WPKH (bc1q)  31 bytes     P2TR (bc1p)  43 bytes
input    P2WPKH         68 vB        P2TR key path  57.5 vB

A coin created and later spent costs about the same either way; the person paying in pays slightly more and the person spending pays less.

What did not get traded away

A key-path spend gives the chain a key and a signature and nothing else, and the chain enforces everything that matters with just those. Two people holding money together, with neither able to spend it alone, now costs the same block space and shows the same footprint as one person spending alone. Before Taproot, that arrangement was announced on every spend.

What a fallback would cost

Adding a script leaf such as "Alice alone after a year" keeps key-path spends identical, but the leaf would be revealed if it were ever used, and the timer would restart only when the coins moved. OnlyBits does not do this today.

One shared payment, read from the outside

One key, one signature, and rules that stay hidden until used

The signature
Schnorr (BIP340): 64 bytes, 32-byte keys, and an equation where keys and signatures add.
The joint key
MuSig2 (BIP327) weights each key by a hash of the key list before adding, so no one can cancel another's key.
The output
One output key that commits to an internal key and, optionally, a hidden tree of scripts (BIP341).
The two paths
A key-path spend shows one signature; a script-path spend shows one script and a proof it was in the tree.
The three shapes
Savings and shared wallets have no tree; locks have a NUMS key and one date-locked script.
The address
bc1p plus the output key, with a bech32m checksum (BIP350).
The bill
The type is visible, the shared address is reused, and a key-path-only wallet has no way around a lost key.

Alice and Bob are the shared wallet's signers and Carol is the payee; the onlooker is anyone with a block explorer. The 200,000, 60,000 and 20,000 sat amounts and the address in section 10 are illustrative. Signature, key and input sizes come from BIP340 and BIP341 and are exact for default sighash flags; the P2WSH figure is a range because DER signatures vary in length. The shared wallet's MuSig2 aggregation, sorted keys, BIP86 tweak and fixed address, and the lock's NUMS internal key and single CLTV leaf, were read from the app's source (src/taproot.rs, src/timelock.rs). The claim that Taproot outputs are still a minority was not measured for this page, and it is the detail most likely to age first. This matches the app as of October 2026. Fees explained covers what virtual bytes cost; Shared wallets explained follows the MuSig2 rounds between phones in full, and Locks explained does the same for the date-locked script.