pub trait TapTweak {
    type TweakedAux;
    type TweakedKey;

    // Required methods
    fn tap_tweak<C: Verification>(
        self,
        secp: &Secp256k1<C>,
        merkle_root: Option<TapBranchHash>
    ) -> Self::TweakedAux;
    fn dangerous_assume_tweaked(self) -> Self::TweakedKey;
}
Expand description

A trait for tweaking BIP340 key types (x-only public keys and key pairs).

Required Associated Types§

source

type TweakedAux

Tweaked key type with optional auxiliary information

source

type TweakedKey

Tweaked key type

Required Methods§

source

fn tap_tweak<C: Verification>( self, secp: &Secp256k1<C>, merkle_root: Option<TapBranchHash> ) -> Self::TweakedAux

Tweaks an untweaked key with corresponding public key value and optional script tree merkle root. For the KeyPair type this also tweaks the private key in the pair.

This is done by using the equation Q = P + H(P|c)G, where

  • Q is the tweaked public key
  • P is the internal public key
  • H is the hash function
  • c is the commitment data
  • G is the generator point
Returns

The tweaked key and its parity.

source

fn dangerous_assume_tweaked(self) -> Self::TweakedKey

Directly converts an UntweakedPublicKey to a TweakedPublicKey

This method is dangerous and can lead to loss of funds if used incorrectly. Specifically, in multi-party protocols a peer can provide a value that allows them to steal.

Object Safety§

This trait is not object safe.

Implementors§