package musig
- Alphabetic
- Public
- Protected
Type Members
- sealed trait KeySet extends AnyRef
Represents an ordered set of MuSig signers and their tweaks.
Represents an ordered set of MuSig signers and their tweaks. This is the data required to (non-interactively) compute the aggPubKey.
- case class LexicographicKeySet(keys: Vector[ECPublicKey], tweaks: Vector[MuSigTweak] = Vector.empty) extends KeySet with Product with Serializable
The default way of ordering a KeySet is lexicographically
- case class MuSigNoncePriv(bytes: ByteVector) extends NetworkElement with MaskedToString with Product with Serializable
Wraps the ephemeral private keys making up a MuSig2 nonce
- case class MuSigNoncePub(bytes: ByteVector) extends NetworkElement with Product with Serializable
Wraps the ephemeral points making up a MuSig2 nonce
- case class MuSigSessionContext(aggNonce: MuSigNoncePub, keySet: KeySet, message: ByteVector) extends Product with Serializable
The data relevant to computing and verifying MuSig partial signatures
- case class MuSigSessionValues(tweakContext: MuSigTweakContext, b: FieldElement, R: SecpPointFinite, e: FieldElement) extends Product with Serializable
- case class MuSigTweak(tweak: FieldElement, isXOnlyT: Boolean) extends Product with Serializable
Used to tweak a MuSig aggregate public key, as defined here https://github.com/jonasnick/bips/blob/musig2/bip-musig2.mediawiki#tweaking-definition
- case class MuSigTweakContext(Q: SecpPointFinite, parityAcc: ParityMultiplier, tweakAcc: FieldElement) extends Product with Serializable
Represents the total tweak sum and net parity multiplier after applying all tweaks
- case class MuSigTweakData(context: MuSigTweakContext, aggPubKeyParity: KeyParity, e: FieldElement) extends Product with Serializable
The data required to apply the net tweak during MuSig signature aggregation
- sealed trait ParityMultiplier extends AnyRef
Represents either FieldElement.one or FieldElement.orderMinusOne.
Represents either FieldElement.one or FieldElement.orderMinusOne. Using this ADT rather than those actual FieldElements saves computation including some unnecessary point multiplications.
In general there is a correspondence between Pos <-> EvenParity and Neg <-> OddParity, this is because in general x-only keys are assumed to be even and need to be negated if they are meant to be used as odd keys.
- case class UnsortedKeySet(keys: Vector[ECPublicKey], tweaks: Vector[MuSigTweak] = Vector.empty) extends KeySet with Product with Serializable
This represents an arbitrary KeySet, for use in tests.
This represents an arbitrary KeySet, for use in tests. If you have a non-lexicographical order, extend KeySet.
Value Members
- object KeySet
- object MuSigNoncePriv extends Factory[MuSigNoncePriv] with Serializable
- object MuSigNoncePub extends Factory[MuSigNoncePub] with Serializable
- object MuSigSessionContext extends Serializable
- object MuSigTweakContext extends Serializable
- object MuSigUtil
Utilities for MuSig2 operations and BIP-0327-related behaviour.
Utilities for MuSig2 operations and BIP-0327-related behaviour.
This object implements nonce generation, nonce aggregation, partial signature generation and verification, and deterministic signing helpers used by the MuSig2 protocol. The implementation follows the BIP-0327 ("MuSig2") reference where applicable; see:
- BIP-0327: https://github.com/bitcoin/bips/blob/master/bip-0327.mediawiki
Important details and conventions implemented here:
- Nonces are represented as pairs (r1, r2) and are collapsed using a polynomial sum with a session scalar b as described in the BIP.
- The point-at-infinity serialization is encoded as 33 zero bytes in
MuSigNoncePub(seeMuSigNoncePub.infPtBytes). - Parity handling for public keys and the aggregated nonce R is handled
via
ParityMultiplierand conditional negation when required. This matches the reference implementation behavior where sign adjustments are applied during both signing and verification so that stored original public keys remain unmodified. - The functions here are low-level helpers; higher-level session
construction and key-aggregation logic is in
MuSigSessionContextandKeySet.
- case object Neg extends ParityMultiplier with Product with Serializable
Represents FieldElement.orderMinusOne
- object ParityMultiplier
- case object Pos extends ParityMultiplier with Product with Serializable
Represents FieldElement.one