adapters

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package adapters - Bitcoin adapter with Taproot support

Package adapters - Cardano adapter for Ed25519 threshold signatures

Package adapters - Celo blockchain adapter (Ethereum-compatible with modifications)

Package adapters - Dilithium/ML-DSA post-quantum signature adapter

Package adapters - Ethereum/EVM chain adapter implementation

Package adapters - Generic EVM blockchain adapter Supports: Ethereum, BSC, Polygon, Lux, Arbitrum, Optimism, Base, etc.

Package adapters provides chain-specific implementations for threshold signatures

Package adapters - ML-DSA/Dilithium threshold signature with Shamir LSS

Package adapters - NEAR blockchain adapter for Ed25519 threshold signatures

Package adapters - Ringtail post-quantum threshold signature implementation

Package adapters - Solana adapter for Ed25519 threshold signatures

Package adapters - Sui blockchain adapter for Ed25519 threshold signatures

Package adapters - TON blockchain adapter for Ed25519 threshold signatures

Package adapters provides chain-specific implementations for threshold signatures

Index

Constants

View Source
const (
	LegacyTxType     = 0x00
	AccessListTxType = 0x01
	DynamicFeeTxType = 0x02
	BlobTxType       = 0x03
)

Transaction types

Variables

View Source
var (
	// STX is the single-signing prefix (0x53545800)
	STX = XRPLHashPrefix{0x53, 0x54, 0x58, 0x00}

	// SMT is the multi-signing prefix (0x534D5400)
	SMT = XRPLHashPrefix{0x53, 0x4D, 0x54, 0x00}

	// Ed25519Prefix is the XRPL Ed25519 public key prefix
	Ed25519Prefix = byte(0xED)
)

Functions

func GetChainRequirements

func GetChainRequirements(chain string) map[string]interface{}

GetChainRequirements returns specific requirements for a chain

func GetDefaultCardanoConfig

func GetDefaultCardanoConfig(networkID byte, era CardanoEra) map[string]interface{}

GetCardanoConfig returns default Cardano configuration

func GetDefaultCeloConfig

func GetDefaultCeloConfig(chainID *big.Int) map[string]interface{}

GetCeloConfig returns default Celo configuration

func GetDefaultNEARConfig

func GetDefaultNEARConfig(networkID string) map[string]interface{}

GetNEARConfig returns default NEAR configuration

func GetDefaultSuiConfig

func GetDefaultSuiConfig() map[string]interface{}

GetSuiConfig returns default Sui configuration

func GetDefaultTONConfig

func GetDefaultTONConfig(workchain int32) map[string]interface{}

GetTONConfig returns default TON configuration

func GetSupportedChains

func GetSupportedChains() []string

GetSupportedChains returns list of supported blockchain networks

func LagrangeAtZero

func LagrangeAtZero(th *ThresholdConfig) (map[party.ID]F, error)

LagrangeAtZero computes Lagrange coefficients for reconstruction at x=0

func SerializeTxBlob

func SerializeTxBlob(tx *XRPLTransaction) ([]byte, error)

SerializeTxBlob serializes an XRPL transaction to binary format

func TestMLDSAThreshold

func TestMLDSAThreshold() error

TestMLDSAThreshold provides test vectors and conformance checks

func TranscriptBinding

func TranscriptBinding(
	chainID string,
	keyID string,
	epochID uint64,
	participants []party.ID,
	alphaPoints map[party.ID]F,
	precompNonce []byte,
	wH []Poly,
	mu []byte,
) []byte

TranscriptBinding creates a domain-separated binding for threshold ML-DSA

func ValidateThresholdConfig

func ValidateThresholdConfig(config *ThresholdConfig) error

ValidateThresholdConfig ensures threshold configuration is valid

Types

type AccessKey

type AccessKey struct {
	Nonce      uint64
	Permission Permission
}

type AccessListEntry

type AccessListEntry struct {
	Address     [20]byte
	StorageKeys [][32]byte
}

type AccountStatus

type AccountStatus byte
const (
	AccountUninit AccountStatus = iota
	AccountActive
	AccountFrozen
)

type ActionType

type ActionType byte
const (
	CreateAccount ActionType = iota
	DeployContract
	FunctionCall
	Transfer
	Stake
	AddKey
	DeleteKey
	DeleteAccount
)

type AdapterFactory

type AdapterFactory struct{}

AdapterFactory creates appropriate adapter for a chain

func (*AdapterFactory) NewAdapter

func (f *AdapterFactory) NewAdapter(chain string, sigType SignatureType) SignerAdapter

NewAdapter creates a chain-specific adapter

type AddKeyAction

type AddKeyAction struct {
	PublicKey PublicKey
	AccessKey AccessKey
}

func (*AddKeyAction) Type

func (a *AddKeyAction) Type() ActionType

type AddressType

type AddressType byte
const (
	BaseAddress AddressType = iota
	ScriptAddress
	EnterpriseAddress
	PointerAddress
	RewardAddress
)

type AssetName

type AssetName string

type BitcoinAdapter

type BitcoinAdapter struct {
	// contains filtered or unexported fields
}

BitcoinAdapter implements SignerAdapter for Bitcoin with Taproot/Schnorr support

func NewBitcoinAdapter

func NewBitcoinAdapter(sigType SignatureType) *BitcoinAdapter

NewBitcoinAdapter creates a new Bitcoin adapter

func (*BitcoinAdapter) AggregateEC

func (b *BitcoinAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines partial signatures

func (*BitcoinAdapter) CreateMultisigScript

func (b *BitcoinAdapter) CreateMultisigScript(pubkeys []curve.Point, threshold int) ([]byte, error)

CreateMultisigScript creates a Bitcoin multisig script

func (*BitcoinAdapter) CreateP2TRAddress

func (b *BitcoinAdapter) CreateP2TRAddress(internalKey curve.Point, scriptTree []byte) (string, error)

CreateP2TRAddress creates a Pay-to-Taproot address

func (*BitcoinAdapter) Digest

func (b *BitcoinAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes Bitcoin transaction digest based on type

func (*BitcoinAdapter) Encode

func (b *BitcoinAdapter) Encode(full FullSig) ([]byte, error)

Encode formats signature for Bitcoin wire format

func (*BitcoinAdapter) SetNetwork

func (b *BitcoinAdapter) SetNetwork(network BitcoinNetwork)

SetNetwork sets the Bitcoin network

func (*BitcoinAdapter) SetTaprootTweak

func (b *BitcoinAdapter) SetTaprootTweak(tweak []byte)

SetTaprootTweak sets the Taproot tweak for key/script path spending

func (*BitcoinAdapter) SignEC

func (b *BitcoinAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC performs threshold signing for Bitcoin

func (*BitcoinAdapter) ValidateConfig

func (b *BitcoinAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates Bitcoin-specific configuration

type BitcoinNetwork

type BitcoinNetwork int

BitcoinNetwork represents Bitcoin network parameters

const (
	BitcoinMainnet BitcoinNetwork = iota
	BitcoinTestnet
	BitcoinRegtest
)

type CallArg

type CallArg interface {
	Type() CallArgType
}

type CallArgType

type CallArgType byte
const (
	PureArg CallArgType = iota
	ObjectArg
	MoveVecArg
)

type CardanoAdapter

type CardanoAdapter struct {
	// contains filtered or unexported fields
}

CardanoAdapter implements SignerAdapter for Cardano blockchain Cardano natively uses Ed25519 but also supports ECDSA/Schnorr for interoperability

func NewCardanoAdapter

func NewCardanoAdapter(sigType SignatureType, networkID byte, era CardanoEra) *CardanoAdapter

NewCardanoAdapter creates a new Cardano adapter

func (*CardanoAdapter) AggregateEC

func (c *CardanoAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines partial signatures

func (*CardanoAdapter) Digest

func (c *CardanoAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes Cardano transaction digest

func (*CardanoAdapter) Encode

func (c *CardanoAdapter) Encode(full FullSig) ([]byte, error)

Encode formats signature for Cardano

func (*CardanoAdapter) EstimateFee

func (c *CardanoAdapter) EstimateFee(tx *CardanoTransaction) uint64

EstimateFee estimates transaction fee in Lovelace

func (*CardanoAdapter) GenerateCardanoAddress

func (c *CardanoAdapter) GenerateCardanoAddress(paymentPubKey, stakePubKey [32]byte) CardanoAddress

GenerateCardanoAddress generates a Cardano address from public key

func (*CardanoAdapter) SignEC

func (c *CardanoAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates partial signature for Cardano

func (*CardanoAdapter) ValidateConfig

func (c *CardanoAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates Cardano-specific configuration

type CardanoAddress

type CardanoAddress struct {
	Type    AddressType
	Network byte
	Payment [28]byte // Payment credential hash
	Stake   [28]byte // Stake credential hash (optional)
}

type CardanoEra

type CardanoEra int

CardanoEra represents different Cardano protocol eras

const (
	EraShelley CardanoEra = iota
	EraAllegra
	EraMary
	EraAlonzo
	EraBabbage // Current era with Plutus V2
	EraConway  // Upcoming with governance
)

type CardanoMetadata

type CardanoMetadata struct {
	Labels map[uint64]interface{}
}

type CardanoTransaction

type CardanoTransaction struct {
	Body      *TransactionBody
	Witnesses *TransactionWitnessSet
	IsValid   bool
	AuxData   *CardanoMetadata // Optional metadata
}

type CeloAccessListEntry

type CeloAccessListEntry struct {
	Address     [20]byte
	StorageKeys [][32]byte
}

CeloAccessListEntry for Celo-specific access lists

type CeloAdapter

type CeloAdapter struct {
	// contains filtered or unexported fields
}

CeloAdapter implements SignerAdapter for Celo blockchain Celo is Ethereum-compatible but with different transaction formats and phone number mapping

func NewCeloAdapter

func NewCeloAdapter() *CeloAdapter

NewCeloAdapter creates a new Celo adapter

func (*CeloAdapter) AggregateEC

func (c *CeloAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines ECDSA partial signatures

func (*CeloAdapter) Digest

func (c *CeloAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes Celo transaction digest

func (*CeloAdapter) Encode

func (c *CeloAdapter) Encode(full FullSig) ([]byte, error)

Encode formats ECDSA signature for Celo (same as Ethereum)

func (*CeloAdapter) EstimateFee

func (c *CeloAdapter) EstimateFee(tx *CeloTransaction) uint64

EstimateFee estimates transaction fee in Celo

func (*CeloAdapter) GenerateCeloAddress

func (c *CeloAdapter) GenerateCeloAddress(publicKey curve.Point) [20]byte

GenerateCeloAddress generates a Celo address from public key

func (*CeloAdapter) MapPhoneNumberToAddress

func (c *CeloAdapter) MapPhoneNumberToAddress(phoneHash [32]byte) [20]byte

MapPhoneNumberToAddress maps phone number to Celo address (simplified)

func (*CeloAdapter) SetChainID

func (c *CeloAdapter) SetChainID(chainID *big.Int)

SetChainID sets the Celo chain ID (42220 mainnet, 44787 alfajores testnet)

func (*CeloAdapter) SignEC

func (c *CeloAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates ECDSA partial signature for Celo

func (*CeloAdapter) ValidateConfig

func (c *CeloAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates Celo-specific configuration

type CeloLegacyTransaction

type CeloLegacyTransaction struct {
	Nonce               uint64
	GasPrice            *big.Int
	GasLimit            uint64
	FeeCurrency         *[20]byte // Celo-specific
	GatewayFeeRecipient *[20]byte // Celo-specific
	GatewayFee          *big.Int  // Celo-specific
	To                  *[20]byte
	Value               *big.Int
	Data                []byte
}

type CeloTransaction

type CeloTransaction struct {
	ChainID              *big.Int
	Nonce                uint64
	MaxPriorityFeePerGas *big.Int
	MaxFeePerGas         *big.Int
	GatewayFeeRecipient  *[20]byte // Celo-specific
	GatewayFee           *big.Int  // Celo-specific
	FeeCurrency          *[20]byte // Celo-specific: address of token to pay fees in
	GasLimit             uint64
	To                   *[20]byte
	Value                *big.Int
	Data                 []byte
	AccessList           []CeloAccessListEntry
}

type Certificate

type Certificate interface {
	Type() CertificateType
}

type CertificateType

type CertificateType byte
const (
	StakeRegistration CertificateType = iota
	StakeDeregistration
	StakeDelegation
	PoolRegistration
	PoolRetirement
	GenesisKeyDelegation
	MoveInstantaneousRewards
)

type ChainConfig

type ChainConfig struct {
	ChainID         *big.Int
	Name            string
	Symbol          string
	ExplorerURL     string
	RPCURL          string
	IsL2            bool
	SupportsEIP1559 bool
	SupportsBlobTx  bool
}

ChainConfig contains chain-specific configuration

func GetChainConfig

func GetChainConfig(chain EVMChain) *ChainConfig

GetChainConfig returns configuration for known chains

type Command

type Command interface {
	Type() CommandType
}

type CommandType

type CommandType byte
const (
	MoveCallCommand CommandType = iota
	TransferObjectsCommand
	SplitCoinsCommand
	MergeCoinsCommand
	PublishCommand
	MakeMoveVecCommand
	UpgradeCommand
)

type DeployContractAction

type DeployContractAction struct {
	Code []byte
}

func (*DeployContractAction) Type

func (d *DeployContractAction) Type() ActionType

type DilithiumAdapter

type DilithiumAdapter struct {
	// contains filtered or unexported fields
}

DilithiumAdapter implements post-quantum threshold signatures using Dilithium/ML-DSA ML-DSA (Module-Lattice-Based Digital Signature Algorithm) is NIST's standardized version

func NewDilithiumAdapter

func NewDilithiumAdapter(securityLevel int) *DilithiumAdapter

NewDilithiumAdapter creates a new Dilithium adapter with specified parameters

func (*DilithiumAdapter) AggregateEC

func (d *DilithiumAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines Dilithium partial signatures

func (*DilithiumAdapter) Benchmark

func (d *DilithiumAdapter) Benchmark(parties int, threshold int) *DilithiumBenchmark

Benchmark runs performance tests for Dilithium

func (*DilithiumAdapter) Digest

func (d *DilithiumAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes message digest for Dilithium

func (*DilithiumAdapter) DilithiumDKG

func (d *DilithiumAdapter) DilithiumDKG(parties []party.ID, threshold int) (*DilithiumPublicKey, map[party.ID]*DilithiumSecretShare, error)

DilithiumDKG performs distributed key generation for Dilithium

func (*DilithiumAdapter) Encode

func (d *DilithiumAdapter) Encode(full FullSig) ([]byte, error)

Encode converts Dilithium signature to wire format

func (*DilithiumAdapter) SignEC

func (d *DilithiumAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC performs threshold signing using Dilithium

func (*DilithiumAdapter) ValidateConfig

func (d *DilithiumAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates configuration for Dilithium

type DilithiumBenchmark

type DilithiumBenchmark struct {
	DKGTime          int64 // microseconds
	SigningTime      int64 // microseconds
	VerificationTime int64 // microseconds
	SignatureSize    int   // bytes
	PublicKeySize    int   // bytes
}

DilithiumBenchmark provides performance metrics

type DilithiumExtensions

type DilithiumExtensions struct {
	// NIST security level (2, 3, or 5)
	SecurityLevel int // Maps to ML-DSA-44, ML-DSA-65, ML-DSA-87

	// Lattice parameters (auto-configured based on security level)
	K int // Vector dimension
	L int // Matrix dimension

	// Public seed for deterministic key generation
	PublicSeed []byte
}

DilithiumExtensions holds Dilithium/ML-DSA specific configuration

type DilithiumFullSig

type DilithiumFullSig struct {
	Z    [][]int32 // Response vector
	H    []byte    // Hint
	C    []int32   // Challenge
	Size int       // Total size in bytes
}

DilithiumFullSig represents a full Dilithium signature

func (*DilithiumFullSig) Serialize

func (d *DilithiumFullSig) Serialize() []byte

Serialize returns the serialized full signature

func (*DilithiumFullSig) Verify

func (d *DilithiumFullSig) Verify(pubKey curve.Point, message []byte) bool

Verify verifies the signature against a public key and message

type DilithiumParams

type DilithiumParams struct {
	SecurityLevel int    // NIST security level (2, 3, or 5)
	Name          string // ML-DSA-44, ML-DSA-65, ML-DSA-87

	// Lattice parameters
	N      int   // Polynomial degree (256)
	Q      int64 // Modulus (8380417)
	D      int   // Dropped bits from t
	K      int   // Number of polynomials in vector
	L      int   // Number of polynomials in matrix
	Eta    int   // Secret key range
	Beta   int   // Tau bound
	Gamma1 int   // y coefficient range
	Gamma2 int   // Low-order rounding range
	Omega  int   // Number of ±1 in c
	Tau    int   // Number of ±1 in c (threshold)

	// Signature parameters
	SignatureSize int // Signature size in bytes
	PublicKeySize int // Public key size in bytes
	SecretKeySize int // Secret key size in bytes
}

DilithiumParams defines lattice parameters for different security levels

func GetDilithiumParams

func GetDilithiumParams(level int) *DilithiumParams

GetDilithiumParams returns recommended parameters for a security level

type DilithiumPartialSig

type DilithiumPartialSig struct {
	PartyID   party.ID
	Z         [][]int32 // Masked response
	H         []byte    // Hint for signature reconstruction
	Challenge []int32   // Challenge polynomial c
}

DilithiumPartialSig represents a partial Dilithium signature

func (*DilithiumPartialSig) GetPartyID

func (d *DilithiumPartialSig) GetPartyID() party.ID

GetPartyID returns the party ID

func (*DilithiumPartialSig) Serialize

func (d *DilithiumPartialSig) Serialize() []byte

Serialize returns the serialized partial signature

type DilithiumPublicKey

type DilithiumPublicKey struct {
	Seed   []byte    // Public seed ρ
	T1     [][]int32 // High-order bits of t = As + e
	Params *DilithiumParams
}

DilithiumPublicKey represents a Dilithium public key

type DilithiumSecretShare

type DilithiumSecretShare struct {
	PartyID party.ID
	S       [][]int32 // Secret polynomials
	E       [][]int32 // Error polynomials
	T       [][]int32 // Target polynomials
	Index   int
}

DilithiumSecretShare represents a party's share of the secret key

type DilithiumState

type DilithiumState struct {
	Generation uint64
	Threshold  int
	Parties    []party.ID
	PublicKey  *DilithiumPublicKey
	Shares     map[party.ID]*DilithiumSecretShare
}

DilithiumState maintains the current state

type ECDSAExtensions

type ECDSAExtensions struct {
	PaillierKey    interface{} // Paillier secret key
	PedersenParams interface{} // Pedersen parameters
	ChainCode      []byte      // HD wallet chain code
}

ECDSAExtensions holds ECDSA-specific configuration

type ECDSAFullSig

type ECDSAFullSig struct {
	R curve.Scalar
	S curve.Scalar
}

func (*ECDSAFullSig) Serialize

func (e *ECDSAFullSig) Serialize() []byte

func (*ECDSAFullSig) Verify

func (e *ECDSAFullSig) Verify(pubKey curve.Point, message []byte) bool

type ECDSAPartialSig

type ECDSAPartialSig struct {
	PartyID party.ID
	R       curve.Scalar
	S       curve.Scalar
}

ECDSA signature components

func (*ECDSAPartialSig) GetPartyID

func (e *ECDSAPartialSig) GetPartyID() party.ID

func (*ECDSAPartialSig) Serialize

func (e *ECDSAPartialSig) Serialize() []byte

type EIP1559Transaction

type EIP1559Transaction struct {
	ChainID              *big.Int
	Nonce                uint64
	MaxPriorityFeePerGas *big.Int
	MaxFeePerGas         *big.Int
	GasLimit             uint64
	To                   [20]byte
	Value                *big.Int
	Data                 []byte
	AccessList           []AccessListEntry
}

type EIP4844Transaction

type EIP4844Transaction struct {
	ChainID              *big.Int
	Nonce                uint64
	MaxPriorityFeePerGas *big.Int
	MaxFeePerGas         *big.Int
	GasLimit             uint64
	To                   [20]byte
	Value                *big.Int
	Data                 []byte
	AccessList           []AccessListEntry
	MaxFeePerBlobGas     *big.Int
	BlobVersionedHashes  [][32]byte
}

type EVMAdapter

type EVMAdapter struct {
	// contains filtered or unexported fields
}

EVMAdapter implements SignerAdapter for all EVM-compatible chains

func NewEVMAdapter

func NewEVMAdapter(chain EVMChain) *EVMAdapter

NewEVMAdapter creates a new adapter for any EVM chain

func (*EVMAdapter) AggregateEC

func (e *EVMAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines ECDSA partial signatures

func (*EVMAdapter) Digest

func (e *EVMAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes transaction digest for EVM chains

func (*EVMAdapter) Encode

func (e *EVMAdapter) Encode(full FullSig) ([]byte, error)

Encode formats ECDSA signature for EVM

func (*EVMAdapter) EstimateGas

func (e *EVMAdapter) EstimateGas(tx *EVMTransaction) uint64

EstimateGas estimates gas for transaction

func (*EVMAdapter) GenerateEVMAddress

func (e *EVMAdapter) GenerateEVMAddress(publicKey curve.Point) [20]byte

GenerateEVMAddress generates an EVM address from public key

func (*EVMAdapter) SetCustomChainID

func (e *EVMAdapter) SetCustomChainID(chainID *big.Int)

SetCustomChainID allows setting custom chain ID for private/test networks

func (*EVMAdapter) SignEC

func (e *EVMAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates ECDSA partial signature

func (*EVMAdapter) ValidateConfig

func (e *EVMAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates EVM configuration

type EVMChain

type EVMChain string

EVMChain represents different EVM-compatible chains

const (
	Ethereum EVMChain = "ethereum"
	BSC      EVMChain = "bsc"
	Polygon  EVMChain = "polygon"
	Lux      EVMChain = "lux"
	Arbitrum EVMChain = "arbitrum"
	Optimism EVMChain = "optimism"
	Base     EVMChain = "base"
	Fantom   EVMChain = "fantom"
	Cronos   EVMChain = "cronos"
	Harmony  EVMChain = "harmony"
	Moonbeam EVMChain = "moonbeam"
	Aurora   EVMChain = "aurora"
	Gnosis   EVMChain = "gnosis"
	Scroll   EVMChain = "scroll"

	Linea  EVMChain = "linea"
	Mantle EVMChain = "mantle"
	Celo   EVMChain = "celo"
	Kava   EVMChain = "kava"
	Metis  EVMChain = "metis"
)

type EVMTransaction

type EVMTransaction struct {
	Type                 byte
	ChainID              *big.Int
	Nonce                uint64
	GasPrice             *big.Int // Legacy
	MaxPriorityFeePerGas *big.Int // EIP-1559
	MaxFeePerGas         *big.Int // EIP-1559
	GasLimit             uint64
	To                   *[20]byte
	Value                *big.Int
	Data                 []byte
	AccessList           []AccessListEntry
	BlobVersionedHashes  [][32]byte // EIP-4844
	MaxFeePerBlobGas     *big.Int   // EIP-4844
}

EVMTransaction represents a generic EVM transaction

type EdDSAExtensions

type EdDSAExtensions struct {
	AuxRand []byte // Auxiliary randomness for deterministic nonces
}

EdDSAExtensions holds EdDSA-specific configuration

type EdDSAFullSig

type EdDSAFullSig struct {
	R curve.Point
	Z curve.Scalar
}

func (*EdDSAFullSig) Serialize

func (e *EdDSAFullSig) Serialize() []byte

func (*EdDSAFullSig) Verify

func (e *EdDSAFullSig) Verify(pubKey curve.Point, message []byte) bool

type EdDSAPartialSig

type EdDSAPartialSig struct {
	PartyID party.ID
	R       curve.Point
	Z       curve.Scalar
}

EdDSA signature components

func (*EdDSAPartialSig) GetPartyID

func (e *EdDSAPartialSig) GetPartyID() party.ID

func (*EdDSAPartialSig) Serialize

func (e *EdDSAPartialSig) Serialize() []byte

type EthereumAdapter

type EthereumAdapter struct {
	// contains filtered or unexported fields
}

EthereumAdapter implements SignerAdapter for Ethereum and EVM-compatible chains

func NewEthereumAdapter

func NewEthereumAdapter() *EthereumAdapter

NewEthereumAdapter creates a new Ethereum adapter

func (*EthereumAdapter) AggregateEC

func (e *EthereumAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines partial signatures with low-S enforcement

func (*EthereumAdapter) CreateMultisigWallet

func (e *EthereumAdapter) CreateMultisigWallet(owners []string, threshold int) ([]byte, error)

CreateMultisigWallet creates a threshold wallet contract deployment transaction

func (*EthereumAdapter) Digest

func (e *EthereumAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes Ethereum transaction digest

func (*EthereumAdapter) Encode

func (e *EthereumAdapter) Encode(full FullSig) ([]byte, error)

Encode formats signature with recovery ID for Ethereum

func (*EthereumAdapter) EstimateGas

func (e *EthereumAdapter) EstimateGas(tx interface{}) (uint64, error)

EstimateGas estimates gas for a threshold signature transaction

func (*EthereumAdapter) GetContractCallData

func (e *EthereumAdapter) GetContractCallData(method string, params ...interface{}) ([]byte, error)

GetContractCallData generates calldata for threshold signature verification

func (*EthereumAdapter) SetChainID

func (e *EthereumAdapter) SetChainID(chainID *big.Int)

SetChainID sets the chain ID for EIP-155 replay protection

func (*EthereumAdapter) SignEC

func (e *EthereumAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates ECDSA partial signature for Ethereum

func (*EthereumAdapter) ValidateConfig

func (e *EthereumAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates Ethereum-specific configuration

type ExecutionUnits

type ExecutionUnits struct {
	Memory uint64
	Steps  uint64
}

type F

type F int64

Field element in GF(Q)

func (F) Add

func (f F) Add(g F) F

func (F) InvMod

func (f F) InvMod(q F) (F, bool)

func (F) MulMod

func (f F) MulMod(g, q F) F

func (F) Sub

func (f F) Sub(g F) F

func (F) SubMod

func (f F) SubMod(g, q F) F

type FullAccessPermission

type FullAccessPermission struct{}

FullAccessPermission represents full access

func (*FullAccessPermission) Type

type FullSig

type FullSig interface {
	Verify(pubKey curve.Point, message []byte) bool
	Serialize() []byte
}

FullSig represents a complete threshold signature

type FunctionCallAction

type FunctionCallAction struct {
	MethodName string
	Args       []byte
	Gas        uint64
	Deposit    NEARAmount
}

func (*FunctionCallAction) Type

func (f *FunctionCallAction) Type() ActionType

type FunctionCallPermissionData

type FunctionCallPermissionData struct {
	Allowance   *NEARAmount
	ReceiverID  string
	MethodNames []string
}

FunctionCallPermissionData represents function call permission

func (*FunctionCallPermissionData) Type

type GasPayment

type GasPayment struct {
	Objects []ObjectRef
	Owner   SuiAddress
	Price   uint64
	Budget  uint64
}

type Hints

type Hints struct {
	Idx [][]int // Per-row positions where HighBits differ
}

Hints represent hint positions for signature compression

func BuildHintsPublic

func BuildHintsPublic(
	A [][]Poly,
	Z []Poly,
	c Poly,
	t, t0 []Poly,
	params *MLDSAParams,
	omega int,
	mul func(a, b Poly) Poly,
) (Hints, error)

BuildHintsPublic computes ML-DSA hints from public data (post-reconstruction)

type Input

type Input struct {
	PrevTxID  [32]byte
	PrevIndex uint32
	ScriptSig []byte
	Sequence  uint32
	Witness   [][]byte
}

type KeyType

type KeyType byte
const (
	ED25519KeyType   KeyType = 0
	SECP256K1KeyType KeyType = 1
)

type LegacyBitcoinTx

type LegacyBitcoinTx struct {
	Version  uint32
	Inputs   []Input
	Outputs  []Output
	LockTime uint32
	SigHash  SigHashType
}

type LegacyTransaction

type LegacyTransaction struct {
	Nonce    uint64
	GasPrice *big.Int
	GasLimit uint64
	To       [20]byte
	Value    *big.Int
	Data     []byte
}

type MLDSAParams

type MLDSAParams struct {
	Name          string // ML-DSA-44, ML-DSA-65, ML-DSA-87
	SecurityLevel int    // NIST level: 2, 3, or 5

	// Core parameters
	Q        int64 // 8380417 (prime modulus)
	N        int   // 256 (polynomial degree)
	K        int   // Vector dimension
	L        int   // Matrix dimension
	D        int   // Dropped bits
	Tau      int   // Challenge weight
	Eta      int   // Secret key range
	Beta     int   // Rejection bound
	Gamma1   int   // y coefficient range
	Gamma2   int   // Low-order rounding range
	Alpha2G2 int   // 2*Gamma2 for HighBits
	Omega    int   // Max hints per row

	// Sizes
	SignatureSize int
	PublicKeySize int
	SecretKeySize int
}

MLDSAParams matches FIPS 204 parameter sets

func GetMLDSAParams

func GetMLDSAParams(level int) *MLDSAParams

GetMLDSAParams returns parameters for a given security level

type MLDSAThresholdAdapter

type MLDSAThresholdAdapter struct {
	// contains filtered or unexported fields
}

MLDSAThresholdAdapter implements true t-of-n threshold ML-DSA using Shamir LSS

func NewMLDSAThresholdAdapter

func NewMLDSAThresholdAdapter(securityLevel int, threshold *ThresholdConfig, mpc MPCEngine, pub PubOps) *MLDSAThresholdAdapter

NewMLDSAThresholdAdapter creates a new threshold ML-DSA adapter

func (*MLDSAThresholdAdapter) OnlineSignT

func (m *MLDSAThresholdAdapter) OnlineSignT(
	A [][]Poly,
	mu []byte,
	pre Precomp,
	s1, s2 []SecretPoly,
	t, t0 []Poly,
	sp SignParams,
) (Sig, bool, error)

OnlineSignT performs threshold signing for ML-DSA using Shamir LSS

func (*MLDSAThresholdAdapter) PrecomputeT

func (m *MLDSAThresholdAdapter) PrecomputeT(A [][]Poly) (Precomp, error)

PrecomputeT generates precomputation for threshold signing

func (*MLDSAThresholdAdapter) RejectionCheck

func (m *MLDSAThresholdAdapter) RejectionCheck(zs, rL []SecretPoly, params *MLDSAParams) (bool, error)

RejectionCheck performs ML-DSA rejection sampling in MPC

type MPCEngine

type MPCEngine interface {
	Add(a, b []F) []F
	Sub(a, b []F) []F
	MulConst(a []F, c F) []F
	HighBitsVec(v []SecretPoly, alpha int) ([]SecretPoly, error)
	Open(s []SecretPoly) ([]Poly, error)
	OpenAtZero(s []SecretPoly, subset []party.ID, lambda map[party.ID]F) ([]Poly, error)
	EqZero(a []F) (bool, error)
	LongOverflow(v []SecretPoly, bound int) (bool, error)
}

MPCEngine defines the MPC operations interface

type NEARAction

type NEARAction interface {
	Type() ActionType
}

type NEARAdapter

type NEARAdapter struct {
	// contains filtered or unexported fields
}

NEARAdapter implements SignerAdapter for NEAR Protocol NEAR uses Ed25519 for signatures and Borsh serialization

func NewNEARAdapter

func NewNEARAdapter(networkID string) *NEARAdapter

NewNEARAdapter creates a new NEAR adapter

func (*NEARAdapter) AggregateEC

func (n *NEARAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines Ed25519 partial signatures

func (*NEARAdapter) Digest

func (n *NEARAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes NEAR transaction digest

func (*NEARAdapter) Encode

func (n *NEARAdapter) Encode(full FullSig) ([]byte, error)

Encode formats Ed25519 signature for NEAR

func (*NEARAdapter) EstimateGas

func (n *NEARAdapter) EstimateGas(tx *NEARTransaction) uint64

EstimateGas estimates gas for NEAR transaction

func (*NEARAdapter) GenerateNEARAddress

func (n *NEARAdapter) GenerateNEARAddress(publicKey [32]byte, accountID string) string

GenerateNEARAddress generates a NEAR account ID from public key

func (*NEARAdapter) SignEC

func (n *NEARAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates Ed25519 partial signature for NEAR

func (*NEARAdapter) ValidateConfig

func (n *NEARAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates NEAR-specific configuration

type NEARAmount

type NEARAmount struct {
	Amount [16]byte // 128-bit integer
}

type NEARTransaction

type NEARTransaction struct {
	SignerID   string
	PublicKey  PublicKey
	Nonce      uint64
	ReceiverID string
	BlockHash  [32]byte
	Actions    []NEARAction
}

type NativeScript

type NativeScript interface {
	Type() NativeScriptType
}

type NativeScriptType

type NativeScriptType byte
const (
	ScriptPubkey NativeScriptType = iota
	ScriptAll
	ScriptAny
	ScriptNofK
	InvalidBefore
	InvalidAfter
)

type ObjectDigest

type ObjectDigest [32]byte

type ObjectID

type ObjectID [32]byte

type ObjectRef

type ObjectRef struct {
	ObjectID ObjectID
	Version  uint64
	Digest   ObjectDigest
}

type OfflineRound1

type OfflineRound1 struct {
	Commitments [][]byte // Commitments to shares
	Nonces      []int64  // Random nonces
	Timestamp   int64
}

OfflineRound1 contains first round offline preprocessing data

type OfflineRound2

type OfflineRound2 struct {
	MaskedShares []int64  // Masked secret shares
	Proofs       [][]byte // Zero-knowledge proofs
}

OfflineRound2 contains second round offline preprocessing data

type Output

type Output struct {
	Value        uint64
	ScriptPubKey []byte
}

type PartialSig

type PartialSig interface {
	GetPartyID() party.ID
	Serialize() []byte
}

PartialSig represents a partial signature from one party

type Permission

type Permission interface {
	Type() PermissionType
}

type PermissionType

type PermissionType byte
const (
	FullAccess PermissionType = iota
	FunctionCallPermission
)

type PolicyID

type PolicyID [28]byte

type Poly

type Poly [256]F

Poly is a degree-255 polynomial over GF(Q)

func HighBitsPublic

func HighBitsPublic(v Poly, alpha int, Q int) Poly

HighBitsPublic computes HighBits on public polynomial

func (Poly) Add

func (p Poly) Add(q Poly) Poly

func (Poly) Sub

func (p Poly) Sub(q Poly) Poly

type Precomp

type Precomp struct {
	Y  []SecretPoly // Secret-shared masking polynomials
	W  []SecretPoly // Secret W = A*Y
	WH []Poly       // Public HighBits(W)
}

Precomp holds precomputed values for online signing

type ProtocolParameters

type ProtocolParameters struct {
	MinFeeA                uint32
	MinFeeB                uint32
	MaxBlockBodySize       uint32
	MaxTxSize              uint32
	MaxBlockHeaderSize     uint32
	KeyDeposit             uint64
	PoolDeposit            uint64
	MinPoolCost            uint64
	PriceMemory            Rational
	PriceSteps             Rational
	MaxTxExecutionUnits    ExecutionUnits
	MaxBlockExecutionUnits ExecutionUnits
	MaxValueSize           uint32
	CollateralPercentage   uint32
	MaxCollateralInputs    uint32
}

type ProtocolUpdate

type ProtocolUpdate struct {
	Epoch          uint32
	ProtocolParams *ProtocolParameters
}

type PubOps

type PubOps interface {
	VecMulByPublicPoly(v []SecretPoly, p Poly) []SecretPoly
	LiftPublicPoly(p Poly) SecretPoly
	MatrixVectorMul(A [][]Poly, v []SecretPoly) []SecretPoly
}

PubOps defines public operations on polynomials

type PublicKey

type PublicKey struct {
	KeyType KeyType
	Data    [32]byte
}

type Rational

type Rational struct {
	Numerator   uint64
	Denominator uint64
}

type Redeemer

type Redeemer struct {
	Tag     RedeemerTag
	Index   uint32
	Data    []byte
	ExUnits ExecutionUnits
}

type RedeemerTag

type RedeemerTag byte
const (
	SpendRedeemer RedeemerTag = iota
	MintRedeemer
	CertRedeemer
	RewardRedeemer
)

type RingtailAdapter

type RingtailAdapter struct {
	// contains filtered or unexported fields
}

RingtailAdapter implements post-quantum threshold signatures using lattice-based cryptography Based on the Ringtail protocol: 2-round threshold signatures from LWE

func NewRingtailAdapter

func NewRingtailAdapter(securityLevel int, maxParties int) *RingtailAdapter

NewRingtailAdapter creates a new Ringtail adapter with specified parameters

func (*RingtailAdapter) AggregateEC

func (r *RingtailAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines Ringtail partial signatures

func (*RingtailAdapter) Benchmark

func (r *RingtailAdapter) Benchmark(parties int, threshold int) *RingtailBenchmark

Benchmark runs performance tests for Ringtail

func (*RingtailAdapter) Digest

func (r *RingtailAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes message digest for Ringtail (identity function for PQ)

func (*RingtailAdapter) Encode

func (r *RingtailAdapter) Encode(full FullSig) ([]byte, error)

Encode converts Ringtail signature to wire format

func (*RingtailAdapter) PreprocessOffline

func (r *RingtailAdapter) PreprocessOffline(numSessions int) error

PreprocessOffline generates offline preprocessing data for faster online signing

func (*RingtailAdapter) RingtailDKG

func (r *RingtailAdapter) RingtailDKG(parties []party.ID, threshold int) (*RingtailPublicKey, map[party.ID]*RingtailSecretShare, error)

RingtailDKG performs distributed key generation for Ringtail

func (*RingtailAdapter) SignEC

func (r *RingtailAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC performs threshold signing using Ringtail protocol

func (*RingtailAdapter) ValidateConfig

func (r *RingtailAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates configuration for Ringtail

type RingtailBenchmark

type RingtailBenchmark struct {
	DKGTime           int64 // microseconds
	PreprocessingTime int64 // microseconds per session
	SigningTime       int64 // microseconds (online only)
	VerificationTime  int64 // microseconds
	SignatureSize     int   // bytes
	CommunicationSize int   // total bytes exchanged
}

RingtailBenchmark provides performance metrics

type RingtailExtensions

type RingtailExtensions struct {
	// Lattice parameters
	N             int     // Lattice dimension
	Q             int     // Modulus
	Sigma         float64 // Gaussian parameter
	SecurityLevel int     // 128, 192, or 256 bits

	// Offline preprocessing store
	PreprocessingShares []RingtailPreprocessing

	// Public parameters
	PublicMatrix interface{} // A matrix for LWE
}

RingtailExtensions holds Ringtail PQ-specific configuration

type RingtailFullSig

type RingtailFullSig struct {
	Signature interface{} // Complete lattice signature
	Size      int         // Signature size in bytes
}

func (*RingtailFullSig) Serialize

func (r *RingtailFullSig) Serialize() []byte

func (*RingtailFullSig) Verify

func (r *RingtailFullSig) Verify(pubKey curve.Point, message []byte) bool

type RingtailOfflineData

type RingtailOfflineData struct {
	ID         string
	Round1Data *OfflineRound1
	Round2Data *OfflineRound2
	Consumed   bool
}

RingtailOfflineData stores precomputed data for the offline phase

type RingtailParams

type RingtailParams struct {
	N             int     // Lattice dimension
	Q             int64   // Modulus
	D             int     // Module rank
	M             int     // Number of samples
	Sigma         float64 // Gaussian parameter
	SecurityLevel int     // 128, 192, or 256 bits
	MaxParties    int     // Maximum number of parties (up to 1024)
	SignatureSize int     // Expected signature size in bytes
}

RingtailParams defines lattice parameters for different security levels

func GetRecommendedParams

func GetRecommendedParams(securityLevel int, maxParties int) *RingtailParams

GetRecommendedParams returns recommended parameters for a security level

type RingtailPartialSig

type RingtailPartialSig struct {
	PartyID party.ID
	Share   interface{} // Lattice element
}

Ringtail PQ signature components

func (*RingtailPartialSig) GetPartyID

func (r *RingtailPartialSig) GetPartyID() party.ID

func (*RingtailPartialSig) Serialize

func (r *RingtailPartialSig) Serialize() []byte

type RingtailPreprocessing

type RingtailPreprocessing struct {
	ID       string
	Round1   interface{} // Offline round 1 data
	Round2   interface{} // Offline round 2 data
	Consumed bool
}

RingtailPreprocessing represents offline preprocessing for Ringtail

type RingtailPublicKey

type RingtailPublicKey struct {
	A      [][]int64 // Public matrix A ∈ Z_q^{n×m}
	B      []int64   // Public vector B = As + e
	Params *RingtailParams
}

RingtailPublicKey represents a lattice-based public key

type RingtailSecretShare

type RingtailSecretShare struct {
	PartyID party.ID
	S       []int64 // Secret share vector
	E       []int64 // Error share vector
	Index   int
}

RingtailSecretShare represents a party's share of the secret key

type RingtailState

type RingtailState struct {
	Generation         uint64
	Threshold          int
	Parties            []party.ID
	PublicKey          *RingtailPublicKey
	PreprocessingStore map[string]*RingtailOfflineData
	ConsumedPreproc    map[string]bool
}

RingtailState maintains the current state of the Ringtail instance

type SchnorrFullSig

type SchnorrFullSig struct {
	R curve.Point
	S curve.Scalar
}

func (*SchnorrFullSig) Serialize

func (s *SchnorrFullSig) Serialize() []byte

func (*SchnorrFullSig) Verify

func (s *SchnorrFullSig) Verify(pubKey curve.Point, message []byte) bool

type SchnorrPartialSig

type SchnorrPartialSig struct {
	PartyID party.ID
	R       curve.Point
	S       curve.Scalar
}

Schnorr signature components

func (*SchnorrPartialSig) GetPartyID

func (s *SchnorrPartialSig) GetPartyID() party.ID

func (*SchnorrPartialSig) Serialize

func (s *SchnorrPartialSig) Serialize() []byte

type Script

type Script interface {
	Hash() [28]byte
}

type SecretPoly

type SecretPoly struct {
	Coeffs []F // Secret-shared coefficients
}

SecretPoly is a Shamir-shared polynomial

type SegwitTx

type SegwitTx struct {
	Version    uint32
	InputTxID  [32]byte
	InputIndex uint32
	ScriptCode []byte
	Amount     uint64
	Sequence   uint32
	Outputs    []Output
	LockTime   uint32
	SigHash    SigHashType
}

type Share

type Share struct {
	ID    party.ID
	Value curve.Scalar
	Index int
}

Share represents a party's secret share

type Sig

type Sig struct {
	C Poly   // Challenge polynomial
	Z []Poly // Response vector
	H Hints  // Hint positions
}

Sig is an ML-DSA signature

type SigHashType

type SigHashType uint32

SigHashType represents Bitcoin signature hash types

const (
	SigHashDefault      SigHashType = 0x00
	SigHashAll          SigHashType = 0x01
	SigHashNone         SigHashType = 0x02
	SigHashSingle       SigHashType = 0x03
	SigHashAnyOneCanPay SigHashType = 0x80
)

type SignParams

type SignParams struct {
	Params  MLDSAParams
	Omega   int
	DeriveC func(mu []byte, wH []Poly) (Poly, error)
	PubMul  func(a, b Poly) Poly
}

SignParams holds signing parameters

type Signature

type Signature [64]byte

type SignatureType

type SignatureType int

SignatureType defines the signature algorithm

const (
	SignatureECDSA SignatureType = iota
	SignatureEdDSA
	SignatureSchnorr
	SignatureBLS
	SignatureRingtail  // Post-quantum lattice-based
	SignatureDilithium // Post-quantum ML-DSA (NIST standard)
)

type SignerAdapter

type SignerAdapter interface {
	// Digest computes chain-specific message digest
	Digest(tx interface{}) ([]byte, error)

	// SignEC creates a partial signature with a party's share
	SignEC(digest []byte, share Share) (PartialSig, error)

	// AggregateEC combines partial signatures into a full signature
	AggregateEC(parts []PartialSig) (FullSig, error)

	// Encode converts signature to chain-specific wire format
	Encode(full FullSig) ([]byte, error)

	// ValidateConfig checks if configuration is valid for this chain
	ValidateConfig(config *UnifiedConfig) error
}

SignerAdapter is the common interface for all chain-specific adapters

type SolanaAdapter

type SolanaAdapter struct {
	// contains filtered or unexported fields
}

SolanaAdapter implements SignerAdapter for Solana

func NewSolanaAdapter

func NewSolanaAdapter() *SolanaAdapter

NewSolanaAdapter creates a new Solana adapter

func (*SolanaAdapter) AggregateEC

func (s *SolanaAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines Ed25519 partial signatures

func (*SolanaAdapter) ComputeProgramDerivedAddress

func (s *SolanaAdapter) ComputeProgramDerivedAddress(programID [32]byte, seeds [][]byte) ([32]byte, byte, error)

ComputeProgramDerivedAddress computes a PDA for threshold wallets

func (*SolanaAdapter) CreateMultisigAccount

func (s *SolanaAdapter) CreateMultisigAccount(signers [][32]byte, threshold byte) ([]byte, error)

CreateMultisigAccount creates a Solana multisig account

func (*SolanaAdapter) CreateTokenTransferInstruction

func (s *SolanaAdapter) CreateTokenTransferInstruction(amount uint64, decimals byte) *SolanaInstruction

CreateTokenTransferInstruction creates SPL token transfer instruction

func (*SolanaAdapter) CreateTransferInstruction

func (s *SolanaAdapter) CreateTransferInstruction(from, to [32]byte, lamports uint64) *SolanaInstruction

CreateTransferInstruction creates a SOL transfer instruction

func (*SolanaAdapter) Digest

func (s *SolanaAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes Solana transaction digest

func (*SolanaAdapter) Encode

func (s *SolanaAdapter) Encode(full FullSig) ([]byte, error)

Encode formats Ed25519 signature for Solana

func (*SolanaAdapter) EstimateComputeUnits

func (s *SolanaAdapter) EstimateComputeUnits(numSignatures int) uint32

EstimateComputeUnits estimates compute units for threshold operations

func (*SolanaAdapter) GetRentExemptBalance

func (s *SolanaAdapter) GetRentExemptBalance(dataSize int) uint64

GetRentExemptBalance calculates rent-exempt balance for account

func (*SolanaAdapter) SignEC

func (s *SolanaAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates Ed25519 partial signature for Solana

func (*SolanaAdapter) ValidateConfig

func (s *SolanaAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates Solana-specific configuration

func (*SolanaAdapter) VerifyEd25519Signature

func (s *SolanaAdapter) VerifyEd25519Signature(pubkey [32]byte, message []byte, signature [64]byte) bool

VerifyEd25519Signature verifies an Ed25519 signature on-chain

type SolanaConfig

type SolanaConfig struct {
	Cluster         string // mainnet-beta, testnet, devnet
	CommitmentLevel string // processed, confirmed, finalized
	SkipPreflight   bool
	PreflightCommit string
	MaxRetries      int
	MinContextSlot  uint64
}

SolanaConfig represents Solana-specific configuration

func GetDefaultSolanaConfig

func GetDefaultSolanaConfig(cluster string) *SolanaConfig

GetDefaultConfig returns default Solana configuration

type SolanaInstruction

type SolanaInstruction struct {
	ProgramIDIndex byte
	AccountIndices []byte
	Data           []byte
}

type SolanaMessage

type SolanaMessage struct {
	NumRequiredSignatures       byte
	NumReadonlySignedAccounts   byte
	NumReadonlyUnsignedAccounts byte
	AccountKeys                 [][32]byte
	RecentBlockhash             [32]byte
	Instructions                []*SolanaInstruction
}

type SolanaTransaction

type SolanaTransaction struct {
	Signatures []Signature
	Message    *SolanaMessage
}

type StakeAction

type StakeAction struct {
	Stake     NEARAmount
	PublicKey PublicKey
}

func (*StakeAction) Type

func (s *StakeAction) Type() ActionType

type SuiAdapter

type SuiAdapter struct {
	// contains filtered or unexported fields
}

SuiAdapter implements SignerAdapter for Sui blockchain Sui uses Ed25519 for signatures and BCS (Binary Canonical Serialization)

func NewSuiAdapter

func NewSuiAdapter() *SuiAdapter

NewSuiAdapter creates a new Sui adapter

func (*SuiAdapter) AggregateEC

func (s *SuiAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines Ed25519 partial signatures

func (*SuiAdapter) CreateTransferTransaction

func (s *SuiAdapter) CreateTransferTransaction(from, to SuiAddress, amount uint64) *SuiTransaction

CreateTransferTransaction creates a simple transfer transaction

func (*SuiAdapter) Digest

func (s *SuiAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes Sui transaction digest using Blake2b

func (*SuiAdapter) Encode

func (s *SuiAdapter) Encode(full FullSig) ([]byte, error)

Encode formats Ed25519 signature for Sui with flag byte

func (*SuiAdapter) EstimateGas

func (s *SuiAdapter) EstimateGas(tx *SuiTransaction) uint64

EstimateGas estimates gas for Sui transaction

func (*SuiAdapter) GenerateSuiAddress

func (s *SuiAdapter) GenerateSuiAddress(publicKey [32]byte) SuiAddress

GenerateSuiAddress generates a Sui address from public key

func (*SuiAdapter) SignEC

func (s *SuiAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates Ed25519 partial signature for Sui

func (*SuiAdapter) ValidateConfig

func (s *SuiAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates Sui-specific configuration

type SuiAddress

type SuiAddress [32]byte

type SuiProgrammableTransaction

type SuiProgrammableTransaction struct {
	Inputs   []CallArg
	Commands []Command
}

type SuiTransaction

type SuiTransaction struct {
	Kind       TransactionKind
	Sender     SuiAddress
	GasPayment *GasPayment
	GasPrice   uint64
	GasBudget  uint64
	Expiration *TransactionExpiration
}

type TONAdapter

type TONAdapter struct {
	// contains filtered or unexported fields
}

TONAdapter implements SignerAdapter for TON blockchain TON uses Ed25519 for signatures and supports Curve25519 conversion

func NewTONAdapter

func NewTONAdapter(workchain int32) *TONAdapter

NewTONAdapter creates a new TON adapter

func (*TONAdapter) AggregateEC

func (t *TONAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines Ed25519 partial signatures

func (*TONAdapter) CreateWalletStateInit

func (t *TONAdapter) CreateWalletStateInit(publicKey [32]byte, walletID uint32) *TONStateInit

CreateWalletStateInit creates initial state for TON wallet

func (*TONAdapter) Digest

func (t *TONAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes TON message digest using BOC (Bag of Cells) hash

func (*TONAdapter) Encode

func (t *TONAdapter) Encode(full FullSig) ([]byte, error)

Encode formats Ed25519 signature for TON

func (*TONAdapter) EstimateGas

func (t *TONAdapter) EstimateGas(msg *TONMessage) uint64

EstimateGas estimates gas for TON transaction

func (*TONAdapter) GenerateTONAddress

func (t *TONAdapter) GenerateTONAddress(publicKey [32]byte) TONAddress

GenerateTONAddress generates a TON address from public key

func (*TONAdapter) SignEC

func (t *TONAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC creates Ed25519 partial signature for TON

func (*TONAdapter) ValidateConfig

func (t *TONAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig validates TON-specific configuration

type TONAddress

type TONAddress struct {
	Workchain int32
	Hash      [32]byte
}

type TONCurrencyCollection

type TONCurrencyCollection struct {
	Grams           uint64
	ExtraCurrencies map[uint32]uint64
}

type TONMessage

type TONMessage struct {
	Info TONMessageInfo
	Init *TONStateInit // Optional
	Body []byte
}

type TONMessageInfo

type TONMessageInfo struct {
	IHRDisabled bool
	Bounce      bool
	Bounced     bool
	Source      TONAddress
	Destination TONAddress
	Value       TONCurrencyCollection
	IHRFee      uint64
	FwdFee      uint64
	CreatedLt   uint64
	CreatedAt   uint32
}

type TONStateInit

type TONStateInit struct {
	Code    []byte
	Data    []byte
	Library []byte
}

type TONTransaction

type TONTransaction struct {
	Account       TONAddress
	Lt            uint64
	PrevTransHash [32]byte
	PrevTransLt   uint64
	Now           uint32
	OutMsgCount   uint16
	OrigStatus    AccountStatus
	EndStatus     AccountStatus
	InMsg         *TONMessage
	OutMsgs       []*TONMessage
}

type TaprootTx

type TaprootTx struct {
	SegwitTx
	ScriptPath   bool
	TapScript    []byte
	ControlBlock []byte
	Annex        []byte
}

type ThresholdConfig

type ThresholdConfig struct {
	Subset []party.ID     // Active signers (m >= t)
	Alpha  map[party.ID]F // Shamir x-coordinates (non-zero)
	T      int            // Threshold
	N      int            // Total parties
	Q      F              // Field modulus
}

ThresholdConfig describes the active subset and Shamir parameters

type TransactionBody

type TransactionBody struct {
	Inputs           []TransactionInput
	Outputs          []TransactionOutput
	Fee              uint64
	TTL              uint32 // Time to live (slot)
	Certificates     []Certificate
	Withdrawals      map[string]uint64 // Stake address -> amount
	Update           *ProtocolUpdate
	AuxDataHash      [32]byte
	ValidityInterval *ValidityInterval
	Mint             map[PolicyID]map[AssetName]int64
	ScriptDataHash   [32]byte
	Collateral       []TransactionInput
	RequiredSigners  [][28]byte // Key hashes
	NetworkID        byte
	CollateralReturn *TransactionOutput
	TotalCollateral  uint64
	ReferenceInputs  []TransactionInput
}

type TransactionExpiration

type TransactionExpiration struct {
	Epoch uint64
}

type TransactionInput

type TransactionInput struct {
	TxID  [32]byte
	Index uint32
}

type TransactionKind

type TransactionKind interface {
	Type() TransactionType
}

type TransactionOutput

type TransactionOutput struct {
	Address   CardanoAddress
	Value     Value
	DatumHash *[32]byte // Optional for smart contracts
	Data      []byte    // Inline datum (Babbage era)
	Script    []byte    // Reference script (Babbage era)
}

type TransactionType

type TransactionType byte
const (
	TransferObject TransactionType = iota
	Publish
	MoveCall
	TransferSui
	ChangeEpoch
	Pay
	PaySui
	PayAllSui
	ProgrammableTransaction
)

type TransactionWitnessSet

type TransactionWitnessSet struct {
	VKeyWitnesses []VKeyWitness
	Scripts       []Script
	PlutusData    [][]byte
	Redeemers     []Redeemer
	NativeScripts []NativeScript
}

type TransferAction

type TransferAction struct {
	Deposit NEARAmount
}

func (*TransferAction) Type

func (t *TransferAction) Type() ActionType

type UnifiedConfig

type UnifiedConfig struct {
	// Common fields
	ID         party.ID
	Threshold  int
	Generation uint64
	PartyIDs   []party.ID

	// Signature type
	SignatureScheme SignatureType

	// Curve-specific
	Group curve.Curve

	// Shared secrets (works for both EC and PQ)
	SecretShare interface{} // curve.Scalar for EC, lattice element for PQ
	PublicKey   interface{} // curve.Point for EC, lattice public key for PQ

	// Additional scheme-specific data
	ECDSAConfig     *ECDSAExtensions
	EdDSAConfig     *EdDSAExtensions
	RingtailConfig  *RingtailExtensions
	DilithiumConfig *DilithiumExtensions

	// Verification shares for all parties
	VerificationShares map[party.ID]interface{}
}

UnifiedConfig represents configuration for unified LSS

type VKeyWitness

type VKeyWitness struct {
	VKey      [32]byte // Public key
	Signature [64]byte // Ed25519 signature
}

type ValidityInterval

type ValidityInterval struct {
	InvalidBefore uint32 // Slot
	InvalidAfter  uint32 // Slot
}

type Value

type Value struct {
	Coin       uint64
	MultiAsset map[PolicyID]map[AssetName]uint64
}

type XRPLAdapter

type XRPLAdapter struct {
	// contains filtered or unexported fields
}

XRPLAdapter implements SignerAdapter for XRPL

func NewXRPLAdapter

func NewXRPLAdapter(sigType SignatureType, multiSign bool) *XRPLAdapter

NewXRPLAdapter creates a new XRPL adapter

func (*XRPLAdapter) AggregateEC

func (x *XRPLAdapter) AggregateEC(parts []PartialSig) (FullSig, error)

AggregateEC combines partial signatures

func (*XRPLAdapter) Digest

func (x *XRPLAdapter) Digest(tx interface{}) ([]byte, error)

Digest computes XRPL transaction digest with appropriate prefix

func (*XRPLAdapter) Encode

func (x *XRPLAdapter) Encode(full FullSig) ([]byte, error)

Encode formats signature for XRPL wire format

func (*XRPLAdapter) FormatPublicKey

func (x *XRPLAdapter) FormatPublicKey(pubKey curve.Point) string

FormatPublicKey formats public key for XRPL with appropriate prefix

func (*XRPLAdapter) GetSignerListEntry

func (x *XRPLAdapter) GetSignerListEntry(config *UnifiedConfig, weight uint16) map[string]interface{}

GetSignerListEntry creates XRPL SignerListSet entry for this configuration

func (*XRPLAdapter) SignEC

func (x *XRPLAdapter) SignEC(digest []byte, share Share) (PartialSig, error)

SignEC performs threshold signing for XRPL

func (*XRPLAdapter) ValidateConfig

func (x *XRPLAdapter) ValidateConfig(config *UnifiedConfig) error

ValidateConfig checks if the configuration is valid for XRPL

type XRPLHashPrefix

type XRPLHashPrefix [4]byte

XRPLHashPrefix defines XRPL transaction hash prefixes

type XRPLTransaction

type XRPLTransaction struct {
	Account         string
	TransactionType string
	Destination     string
	Amount          string
	Fee             string
	Sequence        uint32
	SigningPubKey   string
	TxnSignature    string
}

XRPLTransaction represents a simplified XRPL transaction

func ParseSignedTransaction

func ParseSignedTransaction(blob []byte, signature []byte) (*XRPLTransaction, error)

ParseSignedTransaction parses a signed XRPL transaction

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL