adapters

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package adapters - Bitcoin adapter with Taproot support

Package adapters - Cardano adapter for Ed25519 threshold signatures

Package adapters - Ethereum/EVM chain adapter implementation

Package adapters provides chain-specific implementations for threshold signatures

Package adapters - Ringtail post-quantum threshold signature implementation

Package adapters - Solana 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

This section is empty.

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 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 SerializeTxBlob

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

SerializeTxBlob serializes an XRPL transaction to binary format

Types

type AccessListEntry

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

type AccountStatus

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

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 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 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 Certificate

type Certificate interface {
	Type() CertificateType
}

type CertificateType

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

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 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 FullSig

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

FullSig represents a complete threshold signature

type Input

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

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 NativeScript

type NativeScript interface {
	Type() NativeScriptType
}

type NativeScriptType

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

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 PolicyID

type PolicyID [28]byte

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 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 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 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 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
)

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 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 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 TransactionInput

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

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 TransactionWitnessSet

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

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

	// 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