BSV
$54.16
Vol 32.06m
-3.04%
BTC
$96782
Vol 45294.21m
-1.14%
BCH
$454.66
Vol 380.71m
-2.24%
LTC
$103.04
Vol 872.02m
0.07%
DOGE
$0.32
Vol 5513.82m
-3.93%
Getting your Trinity Audio player ready...

This post was first published on Medium.

We show how to implement Taproot using the original Bitcoin protocol without any changes, by combining contractless contract and Merklized Alternative Script Tree (MAST).

Bitcoin as a carrot under soil

Taproot in BTC

Taproot is the biggest “Bitcoin” Core upgrade since 2017, supposed to improve its functionality. In Taproot, we tweak a public key P to get a new public key Q as follows:

Public key formula

H() is a hash function and G is the generator point. This is the same formula in Equation 4 when we link data to a signature. In this case, the data committed in Q is simply m, the root of a MAST. P is the aggregated public key of all parties.

Pay to Taproot: script pubkey
Pay to Taproot

There are two ways to spend fund locked in Q:

1. Cooperative Case: a.k.a. Default Key Spending Path

When all parties agree on the output of a contract, represented by the MAST, they can all sign together to release the fund¹. Only a regular payment transaction is needed, hiding the actual contract/MAST.

2. Uncooperative Case: a.k.a. Alternative Script Spending Path

If any party does not sign, the fund can be unlocked using the MAST branch. The leaf script, its Merkle proof, and its unlocking script are needed as in a regular MAST contract.

Taproot in the Original Bitcoin

We can achieve what Taproot does using the original Bitcoin protocol, without any changes at all.

Taproot Using Contractless Contract
Taproot Using Contractless Contract

We simply use the contractless contract technique, where the contract is a MAST contract with Merkle root m. As in a general contractless contract:

  1. Cooperative Case: all parties sign and release the fund in a regular payment transaction tx2′.
  2. Uncooperative Case: if some party does not sign, we execute the MAST contract in tx2.

Comparison

Taproot upgrade has taken BTC almost four years from inception to activation. It required fundamental and enormous changes at protocol level, including BIP114 (Merkelized Abstract Syntax Tree)BIP 340 (Schnorr Signatures)BIP 341 (Taproot), and BIP 342 (Tapscript).

Taproot on the original Bitcoin needs zero protocol changes and only 20 lines of code. The whole thing can be coded up in 20 minutes.

***

NOTE:

[1] Intuitively, private key q = p + H(P||m). Private key p is “known” jointly by all parties. P and m are both public, thus all parties can jointly sign against q’s public key Q.

Watch: CoinGeek New York presentation, Smart Contracts & Computation on Bitcoin

Recommended for you

Google unveils ‘Willow’; Bernstein downplays quantum threat to Bitcoin
Google claims that Willow can eliminate common errors associated with quantum computing, while Bernstein analysts noted that Willow’s 105 qubits...
December 18, 2024
WhatsOnChain adds support for 1Sat Ordinals with new API set
WhatsOnChain now supports the 1Sat Ordinals with a set of APIs in beta testing; with this new development, developers can...
December 13, 2024
Advertisement
Advertisement
Advertisement