Taproot
Taproot 関連 BIP
Segwit v1 として Taproot を定義している
Taproot とは
bech32m は bech32 の脆弱性を直したもの
a new witness version is added (version 1), whose programs consist of 32-byte encodings of points Q. Q is computed as P + hash(P||m)G for a public key P, and the root m of a Merkle tree whose leaves consist of a version number and a script. These outputs can be spent directly by providing a signature for Q, or indirectly by revealing P, the script and leaf version, inputs that satisfy the script, and a Merkle path that proves Q committed to that leaf.
witness program が Q である
Q に対応する秘密鍵をもっていれば unlock できる
Q = P + hash(P||m)G
P is pulick key
P = k*G
hash(P||m)*G は hash(P||m) を秘密鍵とする公開鍵と言える
schnorr の場合秘密鍵を足した鍵は、公開鍵を足したものに対応する秘密鍵になっている
if you know k
k + hash(P||m) を計算できる
m を知る必要はない
Q, P, G を知っているので hash(P||m) もわかる
これは Q に対する秘密鍵 になっている
したがって unlock できる
m を示せる場合
script と script path から m を導ける知識がある場合
P, m, マークルパス を使って Q になることを示して、script を使って unlock する
SIGHASH_DEFAULT が導入される
なにが違うのかわかっていない、、
TapScript
従来の Bitcoin Script language から変更点が複数ある
OP_SUCCESSx が追加されている
新しい op code を softfolk を導入するため
OP_SUCCESS が script にあった場合、その時点でその script は有効になる
新しい意味が追加されたときに、それを知らない古いパーサーが無効にしないようにだと思う
scriptPubkey(witness program) はどのような形式になるか
version number 1, and a 32-byte witness program
したがって OP_1||OP_PUSHBYTE_32||<data>
0x51||0x20||<data>
data は tweaked pubkey Q
scriptSig(witness) は?
keyPath と scriptPath で異なる
If there is exactly one element left in the witness stack, key path spending is used:
If there are at least two witness elements left, script path spending is used:
BDK テスト古いのでは?
Resources