chainadapter

package
v1.22.88 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package chainadapter provides adapters for verifying data from external blockchains. This enables the RelayVM and OracleVM to verify cross-chain messages and oracle feeds from major blockchains including Bitcoin, Ethereum, Solana, Cosmos, and others.

Package chainadapter provides AppChain support for fheCRDT-based distributed applications. AppChains are user-centric distributed SQL databases with privacy-preserving CRDTs, similar to Firestore but for Web3 with end-to-end encryption and verifiable compute.

Package chainadapter provides fheCRDT support for privacy-preserving app chains. fheCRDT combines Fully Homomorphic Encryption with Conflict-free Replicated Data Types to enable Firestore-like distributed SQL with end-to-end encryption and verifiable compute.

Index

Constants

View Source
const (
	BitcoinMaxTarget          = "00000000FFFF0000000000000000000000000000000000000000000000000000"
	BitcoinTargetTimespan     = 14 * 24 * 60 * 60 // 2 weeks in seconds
	BitcoinTargetSpacing      = 10 * 60           // 10 minutes
	BitcoinDifficultyInterval = 2016              // Blocks per difficulty adjustment
	BitcoinMinConfirmations   = 6
)

Bitcoin consensus parameters

View Source
const (
	TendermintBlockTime      = 6 * time.Second
	TendermintTrustLevel     = 0.67              // 2/3 stake
	TendermintTrustingPeriod = 14 * 24 * 60 * 60 // 14 days in seconds
	TendermintMaxClockDrift  = 30                // 30 seconds
)

Tendermint consensus constants

View Source
const (
	SlotsPerEpoch         = 32
	EpochsPerSyncPeriod   = 256
	SlotsPerSyncPeriod    = SlotsPerEpoch * EpochsPerSyncPeriod // 8192 slots
	SyncCommitteeSize     = 512
	MinSyncCommitteeVotes = 342 // ~2/3 of 512
	FinalityDelay         = 2   // 2 epochs for finality
)

Ethereum consensus constants

View Source
const (
	SolanaSlotsPerEpoch    = 432000 // ~2 days
	SolanaSlotDuration     = 400 * time.Millisecond
	OptimisticConfirmation = 32 // Slots for optimistic confirmation
	FinalizedConfirmation  = 32 // After 2/3 stake votes
	SupermajorityStake     = 67 // 2/3 supermajority in percentage
)

Solana consensus constants

Variables

View Source
var (
	ErrChainNotSupported    = errors.New("chain not supported")
	ErrInvalidProof         = errors.New("invalid proof")
	ErrBlockNotFinalized    = errors.New("block not finalized")
	ErrInsufficientConf     = errors.New("insufficient confirmations")
	ErrHeaderNotFound       = errors.New("header not found")
	ErrInvalidSignature     = errors.New("invalid signature")
	ErrStaleData            = errors.New("data is stale")
	ErrQuorumNotMet         = errors.New("quorum not met")
	ErrInvalidMerkleProof   = errors.New("invalid merkle proof")
	ErrValidatorSetMismatch = errors.New("validator set mismatch")
)

Errors

View Source
var (
	ErrAppChainNotFound   = errors.New("app chain not found")
	ErrCollectionNotFound = errors.New("collection not found")
	ErrSQLiteNotAvailable = errors.New("SQLite not available")
	ErrSyncFailed         = errors.New("sync failed")
	ErrSnapshotFailed     = errors.New("snapshot failed")
	ErrReplicationFailed  = errors.New("replication failed")
)

AppChain errors

View Source
var (
	ErrBridgeNotInitialized   = errors.New("bridge adapter not initialized")
	ErrSourceChainUnsupported = errors.New("source chain not supported")
	ErrDestChainUnsupported   = errors.New("destination chain not supported")
	ErrInvalidBridgeProof     = errors.New("invalid bridge proof")
	ErrTransferAlreadyExists  = errors.New("transfer already exists")
	ErrTransferNotFound       = errors.New("transfer not found")
	ErrInsufficientLiquidity  = errors.New("insufficient bridge liquidity")
)

Bridge adapter errors

View Source
var (
	ErrDocumentNotFound      = errors.New("document not found")
	ErrInvalidSequence       = errors.New("invalid sequence number")
	ErrOperationConflict     = errors.New("operation conflict detected")
	ErrEncryptionFailed      = errors.New("encryption failed")
	ErrDecryptionFailed      = errors.New("decryption failed")
	ErrInvalidAttestation    = errors.New("invalid attestation")
	ErrDomainAccessDenied    = errors.New("domain access denied")
	ErrDAUnavailable         = errors.New("data availability layer unavailable")
	ErrMaterializationFailed = errors.New("state materialization failed")
)

fheCRDT errors

View Source
var (
	ErrTEENotAvailable      = errors.New("TEE not available")
	ErrAttestationFailed    = errors.New("attestation verification failed")
	ErrComputeTimeout       = errors.New("compute operation timed out")
	ErrInvalidQuote         = errors.New("invalid TEE quote")
	ErrCommitteeCertInvalid = errors.New("committee certificate invalid")
)

Confidential compute errors

View Source
var (
	ErrBlobNotFound         = errors.New("blob not found")
	ErrBlobExpired          = errors.New("blob expired")
	ErrBlobTooLarge         = errors.New("blob too large")
	ErrSamplingFailed       = errors.New("availability sampling failed")
	ErrReceiptInvalid       = errors.New("availability receipt invalid")
	ErrGeoReplicationFailed = errors.New("geo-replication failed")
)

DA layer errors

View Source
var (
	ErrInvalidKeySize     = errors.New("invalid key size")
	ErrInvalidNonce       = errors.New("invalid nonce")
	ErrCiphertextTooShort = errors.New("ciphertext too short")
	ErrAuthFailed         = errors.New("authentication failed")
	ErrFHENotSupported    = errors.New("FHE operation not supported")
	ErrThresholdNotMet    = errors.New("threshold not met for key derivation")
)

Encryption-related errors

View Source
var (
	ErrNoKeyForChain       = errors.New("no key available for chain")
	ErrUnsupportedCurve    = errors.New("unsupported curve for chain")
	ErrSigningFailed       = errors.New("signing failed")
	ErrInvalidAddress      = errors.New("invalid address format")
	ErrKeyDerivationFailed = errors.New("key derivation failed")
)

Errors for MPC wallet operations

Functions

func AllChainConfigs

func AllChainConfigs() map[ChainID]*ChainConfig

AllChainConfigs returns configurations for all 200+ supported chains with proper EVM chain IDs where applicable

func ChainName

func ChainName(id ChainID) string

ChainName returns the name for a chain ID

func DefaultChainConfigs

func DefaultChainConfigs() map[ChainID]*ChainConfig

DefaultChainConfigs returns default configurations for major chains

func GetAddressPrefix

func GetAddressPrefix(chainID ChainID, chainType ChainType) string

GetAddressPrefix returns the expected address prefix for a chain

func GetAllEnrichedConfigs

func GetAllEnrichedConfigs() map[ChainID]*ChainConfig

GetAllEnrichedConfigs returns all chain configs with ChainType and MPC fields populated

func GetChainsByCategory

func GetChainsByCategory() map[ChainType][]*ChainConfig

GetChainsByCategory returns chains grouped by their ChainType

func GetEVMChainID

func GetEVMChainID(chainID ChainID) (uint64, bool)

GetEVMChainID returns the EVM chain ID for a given internal chain ID

func GetMPCCurve

func GetMPCCurve(chainType ChainType) string

GetMPCCurve returns the MPC signing curve for a chain

func InitializeDefaultAdapters

func InitializeDefaultAdapters(registry *Registry) error

InitializeDefaultAdapters initializes adapters for all supported chains

func NewFHECRDTEngine

func NewFHECRDTEngine(config *AppChainConfig, encryptor Encryptor, daClient DAClient, materializer StateMaterializer) *fheCRDTEngine

NewFHECRDTEngine creates a new fheCRDT engine

Types

type AddressFormat

type AddressFormat uint8

AddressFormat describes how addresses are formatted on this chain

const (
	// AddressFormatHex is for hex addresses (0x... for EVM, no prefix for others)
	AddressFormatHex AddressFormat = iota
	// AddressFormatBase58 is for Base58 addresses (Bitcoin, Solana)
	AddressFormatBase58
	// AddressFormatBech32 is for Bech32 addresses (bc1..., cosmos1...)
	AddressFormatBech32
	// AddressFormatSS58 is for SS58 addresses (Polkadot)
	AddressFormatSS58
	// AddressFormatCustom is for chain-specific formats
	AddressFormatCustom
)

func InferAddressFormat

func InferAddressFormat(chainID ChainID, chainType ChainType) AddressFormat

InferAddressFormat determines the address format for a chain

type AlgorandAdapter

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

func NewAlgorandAdapter

func NewAlgorandAdapter() *AlgorandAdapter

func (*AlgorandAdapter) ChainID

func (a *AlgorandAdapter) ChainID() ChainID

func (*AlgorandAdapter) ChainName

func (a *AlgorandAdapter) ChainName() string

func (*AlgorandAdapter) Close

func (a *AlgorandAdapter) Close() error

func (*AlgorandAdapter) GetBlockTime

func (a *AlgorandAdapter) GetBlockTime() time.Duration

func (*AlgorandAdapter) GetLatestFinalizedBlock

func (a *AlgorandAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*AlgorandAdapter) GetRequiredConfirmations

func (a *AlgorandAdapter) GetRequiredConfirmations() uint64

func (*AlgorandAdapter) GetValidatorSet

func (a *AlgorandAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*AlgorandAdapter) Initialize

func (a *AlgorandAdapter) Initialize(config *ChainConfig) error

func (*AlgorandAdapter) IsFinalized

func (a *AlgorandAdapter) IsFinalized(ctx context.Context, round uint64) (bool, error)

func (*AlgorandAdapter) VerificationMode

func (a *AlgorandAdapter) VerificationMode() VerificationMode

func (*AlgorandAdapter) VerifyBlockHeader

func (a *AlgorandAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*AlgorandAdapter) VerifyEvent

func (a *AlgorandAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*AlgorandAdapter) VerifyMessage

func (a *AlgorandAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*AlgorandAdapter) VerifyTransaction

func (a *AlgorandAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type AlgorandBlock

type AlgorandBlock struct {
	Round       uint64   `json:"round"`
	Hash        [32]byte `json:"hash"`
	PrevHash    [32]byte `json:"prevHash"`
	Seed        [32]byte `json:"seed"` // VRF seed
	TxnRoot     [32]byte `json:"txnRoot"`
	Timestamp   uint64   `json:"timestamp"`
	Certificate []byte   `json:"certificate"` // Block certificate
}

type AppChain

type AppChain struct {

	// Identity
	ID        ids.ID    `json:"id"`
	Name      string    `json:"name"`
	Owner     []byte    `json:"owner"`
	CreatedAt time.Time `json:"createdAt"`

	// Configuration
	Config *AppChainConfig `json:"config"`

	// State
	State *AppChainState `json:"state"`
	// contains filtered or unexported fields
}

AppChain represents a user-centric distributed SQL database

func NewAppChain

func NewAppChain(config *AppChainConfig, dbPath string, daClient DAClient) (*AppChain, error)

NewAppChain creates a new AppChain

func (*AppChain) Close

func (a *AppChain) Close() error

Close closes the AppChain

func (*AppChain) ComputeStateRoot

func (a *AppChain) ComputeStateRoot() [32]byte

ComputeStateRoot computes and returns the current state root

func (*AppChain) CreateCollection

func (a *AppChain) CreateCollection(ctx context.Context, schema *CollectionSchema) error

CreateCollection creates a new collection with schema

func (*AppChain) CreateDocument

func (a *AppChain) CreateDocument(ctx context.Context, collection, docID string, domain EncryptionDomain, data []byte) (*Document, error)

CreateDocument creates a new document in the AppChain

func (*AppChain) GetDocument

func (a *AppChain) GetDocument(ctx context.Context, collection, docID string) (*Document, error)

GetDocument retrieves a document by ID

func (*AppChain) Query

func (a *AppChain) Query(ctx context.Context, sql string, params ...interface{}) ([]map[string]interface{}, error)

Query executes a SQL query against the AppChain

func (*AppChain) Sync

func (a *AppChain) Sync(ctx context.Context) error

Sync synchronizes local state with the network

type AppChainAdapter

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

AppChainAdapter implements ChainAdapter for AppChains

func NewAppChainAdapter

func NewAppChainAdapter(appChain *AppChain) *AppChainAdapter

NewAppChainAdapter creates a new AppChain adapter

func (*AppChainAdapter) ChainID

func (a *AppChainAdapter) ChainID() ChainID

ChainID returns the chain identifier

func (*AppChainAdapter) ChainName

func (a *AppChainAdapter) ChainName() string

ChainName returns the human-readable chain name

func (*AppChainAdapter) Close

func (a *AppChainAdapter) Close() error

Close closes the adapter

func (*AppChainAdapter) GetBlockTime

func (a *AppChainAdapter) GetBlockTime() time.Duration

GetBlockTime returns the anchor interval

func (*AppChainAdapter) GetLatestFinalizedBlock

func (a *AppChainAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

GetLatestFinalizedBlock returns the latest finalized state

func (*AppChainAdapter) GetRequiredConfirmations

func (a *AppChainAdapter) GetRequiredConfirmations() uint64

GetRequiredConfirmations returns required confirmations

func (*AppChainAdapter) GetValidatorSet

func (a *AppChainAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

GetValidatorSet returns nil (AppChains don't have validators)

func (*AppChainAdapter) Initialize

func (a *AppChainAdapter) Initialize(config *ChainConfig) error

Initialize initializes the adapter

func (*AppChainAdapter) IsFinalized

func (a *AppChainAdapter) IsFinalized(ctx context.Context, blockNumber uint64) (bool, error)

IsFinalized checks if a state is finalized

func (*AppChainAdapter) VerificationMode

func (a *AppChainAdapter) VerificationMode() VerificationMode

VerificationMode returns the verification mode

func (*AppChainAdapter) VerifyBlockHeader

func (a *AppChainAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

VerifyBlockHeader verifies a block header (state commitment)

func (*AppChainAdapter) VerifyEvent

func (a *AppChainAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

VerifyEvent verifies an event

func (*AppChainAdapter) VerifyMessage

func (a *AppChainAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

VerifyMessage verifies a cross-chain message

func (*AppChainAdapter) VerifyTransaction

func (a *AppChainAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

VerifyTransaction verifies an operation inclusion

type AppChainConfig

type AppChainConfig struct {
	AppChainID ids.ID `json:"appChainId"`
	Name       string `json:"name"`
	Owner      []byte `json:"owner"`

	// Encryption settings
	EncryptionScheme string `json:"encryptionScheme"` // "aes-gcm", "chacha20-poly1305", "fhe-bfv", "fhe-ckks"
	FHEEnabled       bool   `json:"fheEnabled"`
	FHEScheme        string `json:"fheScheme"` // "bfv", "ckks", "tfhe"

	// CRDT settings
	DefaultCRDTType    CRDTType `json:"defaultCrdtType"`
	ConflictResolution string   `json:"conflictResolution"` // "lww", "merge", "custom"

	// DA layer settings
	DALayerID         ids.ID        `json:"daLayerId"`
	ReplicationFactor uint8         `json:"replicationFactor"`
	RetentionPeriod   time.Duration `json:"retentionPeriod"`

	// Compute settings
	ConfidentialCompute bool `json:"confidentialCompute"`
	TEERequired         bool `json:"teeRequired"`

	// Replication policies
	GeoReplication []string `json:"geoReplication"` // Regions for data replication

	// Anchoring
	AnchorInterval   time.Duration `json:"anchorInterval"`
	MinConfirmations uint32        `json:"minConfirmations"`
}

AppChainConfig configures an fheCRDT app chain

type AppChainDALayer

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

AppChainDALayer wraps DA client with AppChain-specific functionality

func NewAppChainDALayer

func NewAppChainDALayer(appChainID ids.ID, config *DAConfig) *AppChainDALayer

NewAppChainDALayer creates a new AppChain DA layer

func (*AppChainDALayer) GetReceipt

func (l *AppChainDALayer) GetReceipt(ctx context.Context, pointer *DAPointer) (*DAReceipt, error)

GetReceipt gets availability receipt for a pointer

func (*AppChainDALayer) RetrieveOpBatch

func (l *AppChainDALayer) RetrieveOpBatch(ctx context.Context, pointer *DAPointer) (*OpBatch, error)

RetrieveOpBatch retrieves an operation batch

func (*AppChainDALayer) StoreOpBatch

func (l *AppChainDALayer) StoreOpBatch(ctx context.Context, batch *OpBatch) (*DAPointer, error)

StoreOpBatch stores an operation batch

func (*AppChainDALayer) StoreSnapshot

func (l *AppChainDALayer) StoreSnapshot(ctx context.Context, snapshot *StateSnapshot) (*DAPointer, error)

StoreSnapshot stores a state snapshot

type AppChainState

type AppChainState struct {
	AppChainID  ids.ID               `json:"appChainId"`
	Documents   map[string]*Document `json:"documents"`   // docHash -> Document
	Collections map[string][]string  `json:"collections"` // collection -> docIDs

	// State commitment
	StateRoot       [32]byte `json:"stateRoot"`
	LastBatchID     ids.ID   `json:"lastBatchId"`
	LastBlockHeight uint64   `json:"lastBlockHeight"`

	// Metrics
	TotalDocuments  uint64 `json:"totalDocuments"`
	TotalOperations uint64 `json:"totalOperations"`
	StorageUsed     uint64 `json:"storageUsed"`
}

AppChainState represents the current state of an app chain

type AptosAdapter

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

func NewAptosAdapter

func NewAptosAdapter() *AptosAdapter

func (*AptosAdapter) ChainID

func (a *AptosAdapter) ChainID() ChainID

func (*AptosAdapter) ChainName

func (a *AptosAdapter) ChainName() string

func (*AptosAdapter) Close

func (a *AptosAdapter) Close() error

func (*AptosAdapter) GetBlockTime

func (a *AptosAdapter) GetBlockTime() time.Duration

func (*AptosAdapter) GetLatestFinalizedBlock

func (a *AptosAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*AptosAdapter) GetRequiredConfirmations

func (a *AptosAdapter) GetRequiredConfirmations() uint64

func (*AptosAdapter) GetValidatorSet

func (a *AptosAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*AptosAdapter) Initialize

func (a *AptosAdapter) Initialize(config *ChainConfig) error

func (*AptosAdapter) IsFinalized

func (a *AptosAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*AptosAdapter) VerificationMode

func (a *AptosAdapter) VerificationMode() VerificationMode

func (*AptosAdapter) VerifyBlockHeader

func (a *AptosAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*AptosAdapter) VerifyEvent

func (a *AptosAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*AptosAdapter) VerifyMessage

func (a *AptosAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*AptosAdapter) VerifyTransaction

func (a *AptosAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type AptosBlock

type AptosBlock struct {
	Version         uint64   `json:"version"` // Transaction version (not block number)
	BlockHeight     uint64   `json:"blockHeight"`
	Epoch           uint64   `json:"epoch"`
	Round           uint64   `json:"round"`
	Timestamp       uint64   `json:"timestamp"`
	Hash            [32]byte `json:"hash"`
	StateRoot       [32]byte `json:"stateRoot"`
	EventRoot       [32]byte `json:"eventRoot"`
	AccumulatorRoot [32]byte `json:"accumulatorRoot"` // Transaction accumulator
	QuorumCert      []byte   `json:"quorumCert"`      // HotStuff QC
}

type AptosValidator

type AptosValidator struct {
	Address     [32]byte `json:"address"`
	PublicKey   [32]byte `json:"publicKey"` // Ed25519
	VotingPower uint64   `json:"votingPower"`
}

type AssetRegistry

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

AssetRegistry tracks bridgeable assets across chains

func NewAssetRegistry

func NewAssetRegistry() *AssetRegistry

NewAssetRegistry creates a new asset registry

func (*AssetRegistry) GetAsset

func (r *AssetRegistry) GetAsset(assetID ids.ID) (*CrossChainAsset, bool)

GetAsset returns an asset by ID

func (*AssetRegistry) GetAssetsByChain

func (r *AssetRegistry) GetAssetsByChain(chainID ChainID) []*CrossChainAsset

GetAssetsByChain returns all assets that have addresses on a chain

func (*AssetRegistry) GetWrappedAddress

func (r *AssetRegistry) GetWrappedAddress(assetID ids.ID, chainID ChainID) ([]byte, error)

GetWrappedAddress returns the wrapped address for an asset on a specific chain

func (*AssetRegistry) RegisterAsset

func (r *AssetRegistry) RegisterAsset(asset *CrossChainAsset)

RegisterAsset registers a cross-chain asset

type AvalancheAdapter

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

func NewAvalancheAdapter

func NewAvalancheAdapter() *AvalancheAdapter

func (*AvalancheAdapter) ChainID

func (a *AvalancheAdapter) ChainID() ChainID

func (*AvalancheAdapter) ChainName

func (a *AvalancheAdapter) ChainName() string

func (*AvalancheAdapter) Close

func (a *AvalancheAdapter) Close() error

func (*AvalancheAdapter) GetBlockTime

func (a *AvalancheAdapter) GetBlockTime() time.Duration

func (*AvalancheAdapter) GetLatestFinalizedBlock

func (a *AvalancheAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*AvalancheAdapter) GetRequiredConfirmations

func (a *AvalancheAdapter) GetRequiredConfirmations() uint64

func (*AvalancheAdapter) GetValidatorSet

func (a *AvalancheAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*AvalancheAdapter) Initialize

func (a *AvalancheAdapter) Initialize(config *ChainConfig) error

func (*AvalancheAdapter) IsFinalized

func (a *AvalancheAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*AvalancheAdapter) VerificationMode

func (a *AvalancheAdapter) VerificationMode() VerificationMode

func (*AvalancheAdapter) VerifyBlockHeader

func (a *AvalancheAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*AvalancheAdapter) VerifyEvent

func (a *AvalancheAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*AvalancheAdapter) VerifyMessage

func (a *AvalancheAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*AvalancheAdapter) VerifyTransaction

func (a *AvalancheAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type BSCAdapter

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

func NewBSCAdapter

func NewBSCAdapter() *BSCAdapter

func (*BSCAdapter) ChainID

func (a *BSCAdapter) ChainID() ChainID

func (*BSCAdapter) ChainName

func (a *BSCAdapter) ChainName() string

func (*BSCAdapter) Close

func (a *BSCAdapter) Close() error

func (*BSCAdapter) GetBlockTime

func (a *BSCAdapter) GetBlockTime() time.Duration

func (*BSCAdapter) GetLatestFinalizedBlock

func (a *BSCAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*BSCAdapter) GetRequiredConfirmations

func (a *BSCAdapter) GetRequiredConfirmations() uint64

func (*BSCAdapter) GetValidatorSet

func (a *BSCAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*BSCAdapter) Initialize

func (a *BSCAdapter) Initialize(config *ChainConfig) error

func (*BSCAdapter) IsFinalized

func (a *BSCAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*BSCAdapter) VerificationMode

func (a *BSCAdapter) VerificationMode() VerificationMode

func (*BSCAdapter) VerifyBlockHeader

func (a *BSCAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*BSCAdapter) VerifyEvent

func (a *BSCAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*BSCAdapter) VerifyMessage

func (a *BSCAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*BSCAdapter) VerifyTransaction

func (a *BSCAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type BitcoinAdapter

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

BitcoinAdapter implements SPV verification for Bitcoin

func NewBitcoinAdapter

func NewBitcoinAdapter() *BitcoinAdapter

NewBitcoinAdapter creates a new Bitcoin SPV adapter

func (*BitcoinAdapter) ChainID

func (a *BitcoinAdapter) ChainID() ChainID

ChainID returns the Bitcoin chain ID

func (*BitcoinAdapter) ChainName

func (a *BitcoinAdapter) ChainName() string

ChainName returns "Bitcoin"

func (*BitcoinAdapter) Close

func (a *BitcoinAdapter) Close() error

Close closes the adapter

func (*BitcoinAdapter) GetBlockTime

func (a *BitcoinAdapter) GetBlockTime() time.Duration

GetBlockTime returns average block time

func (*BitcoinAdapter) GetLatestFinalizedBlock

func (a *BitcoinAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

GetLatestFinalizedBlock returns the latest finalized block

func (*BitcoinAdapter) GetRequiredConfirmations

func (a *BitcoinAdapter) GetRequiredConfirmations() uint64

GetRequiredConfirmations returns required confirmations

func (*BitcoinAdapter) GetValidatorSet

func (a *BitcoinAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

GetValidatorSet returns nil for Bitcoin (PoW chain)

func (*BitcoinAdapter) Initialize

func (a *BitcoinAdapter) Initialize(config *ChainConfig) error

Initialize initializes the adapter

func (*BitcoinAdapter) IsFinalized

func (a *BitcoinAdapter) IsFinalized(ctx context.Context, blockNumber uint64) (bool, error)

IsFinalized checks if a block is finalized

func (*BitcoinAdapter) VerificationMode

func (a *BitcoinAdapter) VerificationMode() VerificationMode

VerificationMode returns ModeSPV

func (*BitcoinAdapter) VerifyBlockHeader

func (a *BitcoinAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

VerifyBlockHeader verifies a Bitcoin block header

func (*BitcoinAdapter) VerifyEvent

func (a *BitcoinAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

VerifyEvent verifies a Bitcoin event (not applicable for Bitcoin)

func (*BitcoinAdapter) VerifyMessage

func (a *BitcoinAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

VerifyMessage verifies a cross-chain message from Bitcoin

func (*BitcoinAdapter) VerifyTransaction

func (a *BitcoinAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

VerifyTransaction verifies a Bitcoin transaction inclusion proof

type BitcoinCheckpoint

type BitcoinCheckpoint struct {
	Height    uint64   `json:"height"`
	Hash      [32]byte `json:"hash"`
	Timestamp uint32   `json:"timestamp"`
}

BitcoinCheckpoint represents a known checkpoint

type BitcoinForkAdapter

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

func NewBitcoinForkAdapter

func NewBitcoinForkAdapter(chainID ChainID, name string, blockTime time.Duration, confs uint64) *BitcoinForkAdapter

func (*BitcoinForkAdapter) ChainID

func (a *BitcoinForkAdapter) ChainID() ChainID

func (*BitcoinForkAdapter) ChainName

func (a *BitcoinForkAdapter) ChainName() string

func (*BitcoinForkAdapter) Close

func (a *BitcoinForkAdapter) Close() error

func (*BitcoinForkAdapter) GetBlockTime

func (a *BitcoinForkAdapter) GetBlockTime() time.Duration

func (*BitcoinForkAdapter) GetLatestFinalizedBlock

func (a *BitcoinForkAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*BitcoinForkAdapter) GetRequiredConfirmations

func (a *BitcoinForkAdapter) GetRequiredConfirmations() uint64

func (*BitcoinForkAdapter) GetValidatorSet

func (a *BitcoinForkAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*BitcoinForkAdapter) Initialize

func (a *BitcoinForkAdapter) Initialize(config *ChainConfig) error

func (*BitcoinForkAdapter) IsFinalized

func (a *BitcoinForkAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*BitcoinForkAdapter) VerificationMode

func (a *BitcoinForkAdapter) VerificationMode() VerificationMode

func (*BitcoinForkAdapter) VerifyBlockHeader

func (a *BitcoinForkAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*BitcoinForkAdapter) VerifyEvent

func (a *BitcoinForkAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*BitcoinForkAdapter) VerifyMessage

func (a *BitcoinForkAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*BitcoinForkAdapter) VerifyTransaction

func (a *BitcoinForkAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type BitcoinHeader

type BitcoinHeader struct {
	Version    int32    `json:"version"`
	PrevBlock  [32]byte `json:"prevBlock"`
	MerkleRoot [32]byte `json:"merkleRoot"`
	Timestamp  uint32   `json:"timestamp"`
	Bits       uint32   `json:"bits"` // Difficulty target
	Nonce      uint32   `json:"nonce"`

	// Computed fields
	Hash      [32]byte `json:"hash"`
	Height    uint64   `json:"height"`
	ChainWork *big.Int `json:"chainWork"`
}

BitcoinHeader represents a Bitcoin block header (80 bytes)

type Blob

type Blob struct {
	ID         [32]byte  `json:"id"`
	Data       []byte    `json:"data"`
	Commitment [32]byte  `json:"commitment"`
	Size       uint64    `json:"size"`
	CreatedAt  time.Time `json:"createdAt"`
	ExpiresAt  time.Time `json:"expiresAt"`
	Encrypted  bool      `json:"encrypted"`

	// Chunking for large blobs
	ChunkCount  uint32     `json:"chunkCount"`
	ChunkSize   uint32     `json:"chunkSize"`
	ChunkHashes [][32]byte `json:"chunkHashes,omitempty"`

	// Erasure coding
	DataShards   int `json:"dataShards"`
	ParityShards int `json:"parityShards"`

	// Replication
	Regions      []string `json:"regions"`
	ReplicaCount int      `json:"replicaCount"`
}

Blob represents data stored in the DA layer

func (*Blob) ComputeCommitment

func (b *Blob) ComputeCommitment() [32]byte

ComputeCommitment computes a cryptographic commitment for the blob using SHA256

type BlockHeader

type BlockHeader struct {
	ChainID     ChainID  `json:"chainId"`
	BlockNumber uint64   `json:"blockNumber"`
	BlockHash   [32]byte `json:"blockHash"`
	ParentHash  [32]byte `json:"parentHash"`
	StateRoot   [32]byte `json:"stateRoot"`
	TxRoot      [32]byte `json:"txRoot"`
	ReceiptRoot [32]byte `json:"receiptRoot"`
	Timestamp   int64    `json:"timestamp"`

	// Chain-specific fields stored as raw bytes
	ExtraData []byte `json:"extraData"`

	// Proof of finality (varies by chain)
	FinalityProof []byte `json:"finalityProof"`
}

BlockHeader represents a block header from any chain

type BridgeAdapter

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

BridgeAdapter provides cross-chain bridge functionality using chain adapters

func NewBridgeAdapter

func NewBridgeAdapter(registry *ChainRegistry, wallet MPCWallet) *BridgeAdapter

NewBridgeAdapter creates a new bridge adapter

func (*BridgeAdapter) ConfirmDelivery

func (b *BridgeAdapter) ConfirmDelivery(ctx context.Context, reqID ids.ID, destTxHash [32]byte, destBlock uint64) error

ConfirmDelivery confirms that a bridge transfer was delivered on the destination chain

func (*BridgeAdapter) GetAdapter

func (b *BridgeAdapter) GetAdapter(chainID ChainID) (ChainAdapter, bool)

GetAdapter returns the adapter for a chain

func (*BridgeAdapter) GetBridgeRequest

func (b *BridgeAdapter) GetBridgeRequest(reqID ids.ID) (*BridgeRequest, error)

GetBridgeRequest returns a bridge request by ID

func (*BridgeAdapter) GetMetrics

func (b *BridgeAdapter) GetMetrics() *BridgeMetrics

GetMetrics returns bridge metrics

func (*BridgeAdapter) GetPendingTransfers

func (b *BridgeAdapter) GetPendingTransfers() []*BridgeRequest

GetPendingTransfers returns all pending transfers

func (*BridgeAdapter) GetSupportedRoutes

func (b *BridgeAdapter) GetSupportedRoutes() []*BridgeRoute

GetSupportedRoutes returns all supported bridge routes

func (*BridgeAdapter) GetTransfersForChain

func (b *BridgeAdapter) GetTransfersForChain(chainID ChainID, isSource bool) []*BridgeRequest

GetTransfersForChain returns pending transfers for a specific source or destination chain

func (*BridgeAdapter) InitiateBridge

func (b *BridgeAdapter) InitiateBridge(ctx context.Context, req *BridgeRequest) error

InitiateBridge initiates a new bridge transfer

func (*BridgeAdapter) RegisterAdapter

func (b *BridgeAdapter) RegisterAdapter(adapter ChainAdapter) error

RegisterAdapter registers a chain adapter for bridging

func (*BridgeAdapter) SignBridgeRequest

func (b *BridgeAdapter) SignBridgeRequest(ctx context.Context, reqID ids.ID) error

SignBridgeRequest creates MPC signature for a confirmed bridge request

func (*BridgeAdapter) VerifySourceTransaction

func (b *BridgeAdapter) VerifySourceTransaction(ctx context.Context, reqID ids.ID) error

VerifySourceTransaction verifies the source transaction and updates confirmations

type BridgeMetrics

type BridgeMetrics struct {
	TotalPending     int                      `json:"totalPending"`
	TotalCompleted   int                      `json:"totalCompleted"`
	PendingByChain   map[ChainID]int          `json:"pendingByChain"`
	CompletedByRoute map[string]int           `json:"completedByRoute"` // "source->dest" format
	AverageTime      map[string]time.Duration `json:"averageTime"`
}

BridgeMetrics contains metrics for the bridge adapter

type BridgeRequest

type BridgeRequest struct {
	// Request identification
	ID        ids.ID    `json:"id"`
	Nonce     uint64    `json:"nonce"`
	CreatedAt time.Time `json:"createdAt"`

	// Chain routing
	SourceChain ChainID `json:"sourceChain"`
	DestChain   ChainID `json:"destChain"`

	// Transfer details
	Sender    []byte `json:"sender"`
	Recipient []byte `json:"recipient"`
	Asset     ids.ID `json:"asset"`
	Amount    []byte `json:"amount"` // Big-endian encoded

	// Source chain proof
	SourceTxHash [32]byte          `json:"sourceTxHash"`
	SourceBlock  uint64            `json:"sourceBlock"`
	SourceProof  *TxInclusionProof `json:"sourceProof,omitempty"`

	// Status tracking
	Status        BridgeStatus `json:"status"`
	Confirmations uint32       `json:"confirmations"`

	// MPC signature
	Signature []byte    `json:"signature,omitempty"`
	SignedAt  time.Time `json:"signedAt,omitempty"`

	// Destination chain completion
	DestTxHash  [32]byte  `json:"destTxHash,omitempty"`
	DestBlock   uint64    `json:"destBlock,omitempty"`
	CompletedAt time.Time `json:"completedAt,omitempty"`
}

BridgeRequest represents a cross-chain bridge request

func (*BridgeRequest) Hash

func (r *BridgeRequest) Hash() [32]byte

Hash returns the hash of the bridge request for signing

type BridgeRoute

type BridgeRoute struct {
	SourceChain   ChainID       `json:"sourceChain"`
	DestChain     ChainID       `json:"destChain"`
	SourceConfig  *ChainConfig  `json:"sourceConfig"`
	DestConfig    *ChainConfig  `json:"destConfig"`
	MinAmount     []byte        `json:"minAmount"`
	MaxAmount     []byte        `json:"maxAmount"`
	EstimatedTime time.Duration `json:"estimatedTime"`
	BridgeFee     uint64        `json:"bridgeFee"` // In basis points (1/100 of 1%)
	Enabled       bool          `json:"enabled"`
}

BridgeRoute represents a supported bridge route between two chains

type BridgeStatus

type BridgeStatus uint8

BridgeStatus represents the status of a bridge transfer

const (
	BridgeStatusPending BridgeStatus = iota
	BridgeStatusConfirmed
	BridgeStatusSigned
	BridgeStatusRelayed
	BridgeStatusCompleted
	BridgeStatusFailed
)

func (BridgeStatus) String

func (s BridgeStatus) String() string

String returns the string representation of BridgeStatus

type BridgeTransfer

type BridgeTransfer struct {
	ID          ids.ID  `json:"id"`
	SourceChain ChainID `json:"sourceChain"`
	DestChain   ChainID `json:"destChain"`
	Sender      []byte  `json:"sender"`
	Recipient   []byte  `json:"recipient"`
	Asset       ids.ID  `json:"asset"`
	Amount      []byte  `json:"amount"` // Big-endian encoded
	Data        []byte  `json:"data"`
	RawTxBytes  []byte  `json:"rawTxBytes"`
}

BridgeTransfer represents a cross-chain bridge transfer

type BridgeWalletAdapter

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

BridgeWalletAdapter adapts MPCWallet for bridge operations

func NewBridgeWalletAdapter

func NewBridgeWalletAdapter(wallet MPCWallet, registry *ChainRegistry) *BridgeWalletAdapter

NewBridgeWalletAdapter creates a bridge wallet adapter

func (*BridgeWalletAdapter) GetBridgeAddress

func (b *BridgeWalletAdapter) GetBridgeAddress(chainID ChainID) (string, error)

GetBridgeAddress returns the bridge custody address for a chain

func (*BridgeWalletAdapter) SignBridgeTransfer

func (b *BridgeWalletAdapter) SignBridgeTransfer(ctx context.Context, transfer *BridgeTransfer) (*SignedBridgeTransfer, error)

SignBridgeTransfer signs a bridge transfer transaction

type CRDTOpType

type CRDTOpType uint8

CRDTOpType defines the operation type within a CRDT

const (
	OpSet       CRDTOpType = iota // Set value (register)
	OpIncrement                   // Increment counter
	OpDecrement                   // Decrement counter
	OpAdd                         // Add to set/list
	OpRemove                      // Remove from set/list
	OpMerge                       // Merge nested CRDT
	OpClear                       // Clear collection
)

type CRDTType

type CRDTType uint8

CRDTType defines the type of CRDT operation

const (
	// CRDTLWWRegister is a Last-Writer-Wins register
	CRDTLWWRegister CRDTType = iota
	// CRDTMVRegister is a Multi-Value register (keeps concurrent values)
	CRDTMVRegister
	// CRDTGCounter is a Grow-only counter
	CRDTGCounter
	// CRDTPNCounter is a Positive-Negative counter
	CRDTPNCounter
	// CRDTGSet is a Grow-only set
	CRDTGSet
	// CRDT2PSet is a Two-Phase set (add/remove)
	CRDT2PSet
	// CRDTORSet is an Observed-Remove set
	CRDTORSet
	// CRDTLWWMap is a Last-Writer-Wins map
	CRDTLWWMap
	// CRDTRGAList is a Replicated Growable Array (ordered list)
	CRDTRGAList
)

type CapabilityManager

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

CapabilityManager manages encryption capabilities

func NewCapabilityManager

func NewCapabilityManager() *CapabilityManager

NewCapabilityManager creates a new capability manager

func (*CapabilityManager) Check

func (m *CapabilityManager) Check(partyID []byte, domain EncryptionDomain) bool

Check checks if a party has access to a domain

func (*CapabilityManager) Delegate

func (m *CapabilityManager) Delegate(fromParty, toParty []byte, domains []EncryptionDomain) error

Delegate delegates capability from one party to another

func (*CapabilityManager) Grant

func (m *CapabilityManager) Grant(cap *EncryptionCapability)

Grant grants a capability to a party

func (*CapabilityManager) Revoke

func (m *CapabilityManager) Revoke(partyID []byte)

Revoke revokes a capability

type CardanoAdapter

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

func NewCardanoAdapter

func NewCardanoAdapter() *CardanoAdapter

func (*CardanoAdapter) ChainID

func (a *CardanoAdapter) ChainID() ChainID

func (*CardanoAdapter) ChainName

func (a *CardanoAdapter) ChainName() string

func (*CardanoAdapter) Close

func (a *CardanoAdapter) Close() error

func (*CardanoAdapter) GetBlockTime

func (a *CardanoAdapter) GetBlockTime() time.Duration

func (*CardanoAdapter) GetLatestFinalizedBlock

func (a *CardanoAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*CardanoAdapter) GetRequiredConfirmations

func (a *CardanoAdapter) GetRequiredConfirmations() uint64

func (*CardanoAdapter) GetValidatorSet

func (a *CardanoAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*CardanoAdapter) Initialize

func (a *CardanoAdapter) Initialize(config *ChainConfig) error

func (*CardanoAdapter) IsFinalized

func (a *CardanoAdapter) IsFinalized(ctx context.Context, slot uint64) (bool, error)

func (*CardanoAdapter) VerificationMode

func (a *CardanoAdapter) VerificationMode() VerificationMode

func (*CardanoAdapter) VerifyBlockHeader

func (a *CardanoAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*CardanoAdapter) VerifyEvent

func (a *CardanoAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*CardanoAdapter) VerifyMessage

func (a *CardanoAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*CardanoAdapter) VerifyTransaction

func (a *CardanoAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type CardanoBlock

type CardanoBlock struct {
	Slot        uint64   `json:"slot"`
	Epoch       uint64   `json:"epoch"`
	BlockHash   [32]byte `json:"blockHash"`
	PrevHash    [32]byte `json:"prevHash"`
	PoolID      [28]byte `json:"poolId"`   // Stake pool that minted
	VRFVKey     [32]byte `json:"vrfVKey"`  // VRF verification key
	BlockVRF    [64]byte `json:"blockVrf"` // VRF proof for slot leader
	OpCert      []byte   `json:"opCert"`   // Operational certificate
	ProtocolVer uint32   `json:"protocolVer"`
}

type CardanoPool

type CardanoPool struct {
	PoolID        [28]byte `json:"poolId"`
	VRFKeyHash    [32]byte `json:"vrfKeyHash"`
	Pledge        uint64   `json:"pledge"`
	Cost          uint64   `json:"cost"`
	Margin        float64  `json:"margin"`
	RelativeStake float64  `json:"relativeStake"` // Stake relative to total
}

type ChainAdapter

type ChainAdapter interface {
	// ChainID returns the chain identifier
	ChainID() ChainID

	// ChainName returns the human-readable chain name
	ChainName() string

	// VerificationMode returns the primary verification mode for this chain
	VerificationMode() VerificationMode

	// VerifyBlockHeader verifies a block header from this chain
	VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

	// VerifyTransaction verifies a transaction inclusion proof
	VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

	// VerifyMessage verifies a cross-chain message from this chain
	VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

	// VerifyEvent verifies an event/log from this chain
	VerifyEvent(ctx context.Context, event *ChainEvent) error

	// GetLatestFinalizedBlock returns the latest finalized block number
	GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

	// GetRequiredConfirmations returns required confirmations for finality
	GetRequiredConfirmations() uint64

	// GetBlockTime returns the average block time
	GetBlockTime() time.Duration

	// IsFinalized checks if a block is considered finalized
	IsFinalized(ctx context.Context, blockNumber uint64) (bool, error)

	// GetValidatorSet returns the current validator set (if applicable)
	GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

	// Initialize initializes the adapter with configuration
	Initialize(config *ChainConfig) error

	// Close cleans up adapter resources
	Close() error
}

ChainAdapter is the interface that all chain adapters must implement

func NewAdapter

func NewAdapter(chainID ChainID) (ChainAdapter, error)

NewAdapter creates a chain adapter for the given chain ID

func NewExtendedAdapter

func NewExtendedAdapter(chainID ChainID) (ChainAdapter, error)

NewExtendedAdapter creates an adapter for any supported chain

type ChainCategory

type ChainCategory string

ChainCategory groups chains by their use case

const (
	CategoryMajorL1     ChainCategory = "major_l1"
	CategoryEVML1       ChainCategory = "evm_l1"
	CategoryOptimistic  ChainCategory = "optimistic_rollup"
	CategoryZKRollup    ChainCategory = "zk_rollup"
	CategoryCosmos      ChainCategory = "cosmos_ecosystem"
	CategoryPolkadot    ChainCategory = "polkadot_ecosystem"
	CategoryBitcoinFork ChainCategory = "bitcoin_fork"
	CategoryDAG         ChainCategory = "dag_chain"
	CategoryGaming      ChainCategory = "gaming"
	CategoryDeFi        ChainCategory = "defi"
	CategoryPrivacy     ChainCategory = "privacy"
)

func GetChainCategory

func GetChainCategory(chainID ChainID) ChainCategory

GetChainCategory returns the category for a chain

type ChainConfig

type ChainConfig struct {
	ChainID        ChainID       `json:"chainId"`
	Name           string        `json:"name"`
	NetworkID      uint64        `json:"networkId"`      // Internal network identifier
	EVMChainID     uint64        `json:"evmChainId"`     // EVM chain ID (0 for non-EVM)
	NativeSymbol   string        `json:"nativeSymbol"`   // e.g., "ETH", "BTC", "SOL"
	NativeDecimals uint8         `json:"nativeDecimals"` // e.g., 18 for ETH, 8 for BTC
	IsEVM          bool          `json:"isEvm"`          // True for EVM-compatible chains
	ChainType      ChainType     `json:"chainType"`      // Fundamental architecture type
	AddressFormat  AddressFormat `json:"addressFormat"`  // Address encoding format
	AddressPrefix  string        `json:"addressPrefix"`  // Address prefix (0x, bc1, cosmos1, etc.)
	RPCEndpoints   []string      `json:"rpcEndpoints"`
	WSEndpoints    []string      `json:"wsEndpoints,omitempty"`
	ExplorerURL    string        `json:"explorerUrl,omitempty"`

	// Finality parameters
	RequiredConfirmations uint64        `json:"requiredConfirmations"`
	FinalityMode          string        `json:"finalityMode"` // "probabilistic", "instant", "epoch"
	BlockTime             time.Duration `json:"blockTime"`

	// Verification parameters
	TrustThreshold     float64       `json:"trustThreshold"` // e.g., 0.67 for 2/3
	MaxClockDrift      time.Duration `json:"maxClockDrift"`
	StalenessThreshold time.Duration `json:"stalenessThreshold"`

	// MPC/Bridge parameters
	SupportsMPC            bool   `json:"supportsMpc"`    // Supports MPC/TSS signing
	MPCCurve               string `json:"mpcCurve"`       // secp256k1, ed25519, sr25519, bls12381
	NativeMultisig         bool   `json:"nativeMultisig"` // Has native multisig support
	SupportsSmartContracts bool   `json:"supportsSmartContracts"`

	// Chain-specific config stored as raw bytes
	ExtraConfig []byte `json:"extraConfig,omitempty"`
}

ChainConfig contains configuration for a chain adapter

func EnrichChainConfig

func EnrichChainConfig(config *ChainConfig) *ChainConfig

EnrichChainConfig adds ChainType, AddressFormat, and MPC fields to a config

func GetEVMCompatibleChains

func GetEVMCompatibleChains() []*ChainConfig

GetEVMCompatibleChains returns all EVM-compatible chains (L1s, L2s, rollups)

func GetEnrichedChainConfig

func GetEnrichedChainConfig(chainID ChainID) *ChainConfig

GetEnrichedChainConfig returns an enriched chain config with all fields populated

func GetNativePrimaryNetworks

func GetNativePrimaryNetworks() []*ChainConfig

GetNativePrimaryNetworks returns non-EVM native L1 chains

type ChainEvent

type ChainEvent struct {
	ChainID     ChainID  `json:"chainId"`
	BlockNumber uint64   `json:"blockNumber"`
	TxHash      [32]byte `json:"txHash"`
	LogIndex    uint32   `json:"logIndex"`

	// Event identifier (e.g., topic0 for Ethereum)
	EventID [32]byte `json:"eventId"`

	// Event data
	Address []byte   `json:"address"`
	Topics  [][]byte `json:"topics"`
	Data    []byte   `json:"data"`

	// Proof of inclusion
	Proof []byte `json:"proof"`
}

ChainEvent represents an event/log from a chain

type ChainID

type ChainID uint32

ChainID represents a unique blockchain identifier

const (
	// Major L1s (1-20)
	ChainBitcoin   ChainID = 1
	ChainEthereum  ChainID = 2
	ChainSolana    ChainID = 3
	ChainCosmos    ChainID = 4
	ChainPolkadot  ChainID = 5
	ChainPolygon   ChainID = 6
	ChainBSC       ChainID = 7
	ChainRipple    ChainID = 8
	ChainAvalanche ChainID = 9
	ChainArbitrum  ChainID = 10
	ChainOptimism  ChainID = 11
	ChainBase      ChainID = 12
	ChainTron      ChainID = 13
	ChainCardano   ChainID = 14
	ChainNear      ChainID = 15
	ChainAptos     ChainID = 16
	ChainSui       ChainID = 17
	ChainTON       ChainID = 18
	ChainStellar   ChainID = 19
	ChainAlgorand  ChainID = 20

	// EVM L1s (21-40)
	ChainFantom    ChainID = 21
	ChainCronos    ChainID = 22
	ChainGnosis    ChainID = 23
	ChainCelo      ChainID = 24
	ChainMoonbeam  ChainID = 25
	ChainMoonriver ChainID = 26
	ChainAstar     ChainID = 27
	ChainMetis     ChainID = 28
	ChainBoba      ChainID = 29
	ChainAurora    ChainID = 30
	ChainKlaytn    ChainID = 31
	ChainFuse      ChainID = 32
	ChainEvmos     ChainID = 33
	ChainKava      ChainID = 34
	ChainOKX       ChainID = 35
	ChainPulse     ChainID = 36
	ChainCore      ChainID = 37
	ChainFlare     ChainID = 38
	ChainSongbird  ChainID = 39
	ChainRON       ChainID = 40 // Ronin

	// EVM L2s and Rollups (41-70)
	ChainZkSync     ChainID = 41
	ChainStarknet   ChainID = 42
	ChainScroll     ChainID = 43
	ChainLinea      ChainID = 44
	ChainMantle     ChainID = 45
	ChainZora       ChainID = 46
	ChainMode       ChainID = 47
	ChainBlast      ChainID = 48
	ChainManta      ChainID = 49
	ChainPolygonZk  ChainID = 50
	ChainLoopring   ChainID = 51
	ChainImmutableX ChainID = 52
	ChaindYdX       ChainID = 53
	ChainApechain   ChainID = 54
	ChainWorldchain ChainID = 55
	ChainTaiko      ChainID = 56
	ChainFrax       ChainID = 57
	ChainRedstone   ChainID = 58
	ChainLisk       ChainID = 59
	ChainBob        ChainID = 60
	ChainCyber      ChainID = 61
	ChainMint       ChainID = 62
	ChainKroma      ChainID = 63
	ChainOpBNB      ChainID = 64
	ChainXLayer     ChainID = 65
	ChainZircuit    ChainID = 66

	// Cosmos Ecosystem (71-100)
	ChainOsmosis     ChainID = 71
	ChainInjective   ChainID = 72
	ChainSei         ChainID = 73
	ChainCelestia    ChainID = 74
	ChainThorchain   ChainID = 75
	ChainAkash       ChainID = 76
	ChainJuno        ChainID = 77
	ChainStargaze    ChainID = 78
	ChainSecret      ChainID = 79
	ChainAxelar      ChainID = 80
	ChainStride      ChainID = 81
	ChainNeutron     ChainID = 82
	ChainNoble       ChainID = 83
	ChainMars        ChainID = 84
	ChainPersistence ChainID = 85
	ChainFetchAI     ChainID = 86
	ChainBand        ChainID = 87
	ChainRegen       ChainID = 88
	ChainSommelier   ChainID = 89
	ChainUmee        ChainID = 90
	ChainCanto       ChainID = 91
	ChainDymension   ChainID = 92
	ChainSaga        ChainID = 93

	// DAG-based and Unique Consensus (101-120)
	ChainHedera     ChainID = 101
	ChainIOTA       ChainID = 102
	ChainKaspa      ChainID = 103
	ChainFilecoin   ChainID = 104
	ChainICP        ChainID = 105 // Internet Computer
	ChainFlow       ChainID = 106
	ChainMina       ChainID = 107
	ChainMultiversX ChainID = 108 // Elrond
	ChainHarmony    ChainID = 109
	ChainZilliqa    ChainID = 110
	ChainVechain    ChainID = 111
	ChainTheta      ChainID = 112
	ChainEOS        ChainID = 113
	ChainWAX        ChainID = 114
	ChainTezos      ChainID = 115
	ChainNEO        ChainID = 116
	ChainQtum       ChainID = 117
	ChainWaves      ChainID = 118
	ChainOntology   ChainID = 119
	ChainRavencoin  ChainID = 120

	// Bitcoin Forks and PoW Chains (121-140)
	ChainLitecoin     ChainID = 121
	ChainBitcoinCash  ChainID = 122
	ChainDogecoin     ChainID = 123
	ChainZcash        ChainID = 124
	ChainMonero       ChainID = 125
	ChainDash         ChainID = 126
	ChainDecred       ChainID = 127
	ChainDigiByte     ChainID = 128
	ChainSiacoin      ChainID = 129
	ChainHorizen      ChainID = 130
	ChainErgo         ChainID = 131
	ChainFiro         ChainID = 132
	ChainKomodo       ChainID = 133
	ChainPivx         ChainID = 134
	ChainBSV          ChainID = 135 // Bitcoin SV
	ChainEtherClassic ChainID = 136
	ChainFlux         ChainID = 137
	ChainHandshake    ChainID = 138
	ChainNervos       ChainID = 139
	ChainConflux      ChainID = 140

	// Polkadot Parachains (141-160)
	ChainAcala      ChainID = 141
	ChainPhala      ChainID = 142
	ChainBifrost    ChainID = 143
	ChainParallel   ChainID = 144
	ChainClover     ChainID = 145
	ChainCentrifuge ChainID = 146
	ChainInterlay   ChainID = 147
	ChainHydra      ChainID = 148
	ChainNodle      ChainID = 149
	ChainEfinity    ChainID = 150
	ChainMangata    ChainID = 151
	ChainZeitgeist  ChainID = 152
	ChainKusama     ChainID = 153
	ChainPolimec    ChainID = 154

	// Gaming and NFT Chains (161-180)
	ChainWemix    ChainID = 161
	ChainOasys    ChainID = 162
	ChainBeam     ChainID = 163
	ChainXai      ChainID = 164
	ChainSaakuru  ChainID = 165
	ChainViction  ChainID = 166 // Tomo
	ChainPlaydapp ChainID = 167
	ChainTreasure ChainID = 168
	ChainSkale    ChainID = 169
	ChainLoom     ChainID = 170
	ChainEnjin    ChainID = 171

	// DeFi and Finance Chains (181-200)
	ChainUnichain    ChainID = 181
	ChainSwell       ChainID = 182
	ChainEtherfi     ChainID = 183
	ChainInk         ChainID = 184
	ChainMorph       ChainID = 185
	ChainRari        ChainID = 186
	ChainShape       ChainID = 187
	ChainAbstract    ChainID = 188
	ChainSoneium     ChainID = 189
	ChainAILayer     ChainID = 190
	ChainHyperliquid ChainID = 191
	ChainBerachain   ChainID = 192
	ChainMonad       ChainID = 193
	ChainMegaETH     ChainID = 194

	// Lux ecosystem
	ChainLux ChainID = 1000 // Self-reference
)

Chain identifiers for supported blockchains

func GetAllSupportedChains

func GetAllSupportedChains() []ChainID

GetAllSupportedChains returns all supported chain IDs

func GetChainByEVMID

func GetChainByEVMID(evmChainID uint64) (ChainID, bool)

GetChainByEVMID finds a chain by its EVM chain ID

type ChainKeySet

type ChainKeySet struct {
	ChainID    ChainID      `json:"chainId"`
	ChainType  ChainType    `json:"chainType"`
	Curve      SigningCurve `json:"curve"`
	PublicKey  []byte       `json:"publicKey"` // Derived public key for this chain
	Address    string       `json:"address"`   // Chain-specific address
	MPCShare   *MPCKeyShare `json:"mpcShare,omitempty"`
	DerivePath string       `json:"derivePath"` // BIP44/derivation path
}

ChainKeySet holds keys for a specific chain

type ChainMetrics

type ChainMetrics struct {
	ChainID                 ChainID
	LastVerifiedBlock       uint64
	TotalVerifications      uint64
	SuccessfulVerifications uint64
	FailedVerifications     uint64
	AverageLatency          time.Duration
	LastError               error
	LastErrorTime           time.Time
}

ChainMetrics contains metrics for a chain adapter

type ChainRegistry

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

ChainRegistry manages chain configurations

func NewChainRegistry

func NewChainRegistry() *ChainRegistry

NewChainRegistry creates a new chain registry

func (*ChainRegistry) GetAllConfigs

func (r *ChainRegistry) GetAllConfigs() []*ChainConfig

GetAllConfigs returns all registered chain configurations

func (*ChainRegistry) GetChainsByType

func (r *ChainRegistry) GetChainsByType(chainType ChainType) []*ChainConfig

GetChainsByType returns chains of a specific type

func (*ChainRegistry) GetConfig

func (r *ChainRegistry) GetConfig(chainID ChainID) *ChainConfig

GetConfig returns the configuration for a chain

func (*ChainRegistry) GetEVMChains

func (r *ChainRegistry) GetEVMChains() []*ChainConfig

GetEVMChains returns all EVM-compatible chains

func (*ChainRegistry) GetNativeChains

func (r *ChainRegistry) GetNativeChains() []*ChainConfig

GetNativeChains returns all non-EVM chains (native primary networks)

func (*ChainRegistry) Register

func (r *ChainRegistry) Register(config *ChainConfig)

Register registers a chain configuration

type ChainType

type ChainType uint8

ChainType categorizes chains by their fundamental architecture

const (
	// ChainTypeEVM is for EVM-compatible chains (Ethereum, Polygon, BSC, L2s)
	ChainTypeEVM ChainType = iota
	// ChainTypeUTXO is for UTXO-based chains (Bitcoin, Litecoin, Dogecoin)
	ChainTypeUTXO
	// ChainTypeAccount is for native account-model chains (Solana, NEAR, Aptos)
	ChainTypeAccount
	// ChainTypeCosmosSDK is for Cosmos SDK chains (Cosmos, Osmosis, Injective)
	ChainTypeCosmosSDK
	// ChainTypeSubstrate is for Polkadot parachains (Moonbeam, Acala, Phala)
	ChainTypeSubstrate
	// ChainTypeDAG is for DAG-based chains (IOTA, Kaspa, Hedera)
	ChainTypeDAG
	// ChainTypeMoveVM is for Move-based chains (Aptos, Sui)
	ChainTypeMoveVM
	// ChainTypeTVM is for TON Virtual Machine (TON)
	ChainTypeTVM
	// ChainTypeFVM is for Filecoin Virtual Machine
	ChainTypeFVM
	// ChainTypeStellar is for Stellar Consensus Protocol chains
	ChainTypeStellar
	// ChainTypeRipple is for XRP Ledger
	ChainTypeRipple
	// ChainTypeCardano is for Cardano (extended UTXO)
	ChainTypeCardano
	// ChainTypeAlgorand is for Algorand
	ChainTypeAlgorand
	// ChainTypeTezos is for Tezos
	ChainTypeTezos
	// ChainTypeICP is for Internet Computer
	ChainTypeICP
	// ChainTypePrivacy is for privacy chains (Monero, Zcash)
	ChainTypePrivacy
)

func InferChainType

func InferChainType(chainID ChainID) ChainType

InferChainType determines the ChainType based on chain characteristics

func (ChainType) String

func (ct ChainType) String() string

String returns the string representation of ChainType

type CollectionSchema

type CollectionSchema struct {
	Name       string           `json:"name"`
	Fields     []*FieldSchema   `json:"fields"`
	Indexes    []*IndexSchema   `json:"indexes"`
	PrimaryKey string           `json:"primaryKey"`
	CRDTType   CRDTType         `json:"crdtType"`
	Encrypted  bool             `json:"encrypted"`
	Domain     EncryptionDomain `json:"domain"`
}

CollectionSchema defines the schema for a collection

type CommitmentScheme

type CommitmentScheme uint8

CommitmentScheme defines the commitment scheme used

const (
	// CommitmentSHA256 uses SHA256 hash
	CommitmentSHA256 CommitmentScheme = iota
	// CommitmentKZG uses KZG polynomial commitment
	CommitmentKZG
	// CommitmentFRI uses FRI (Fast Reed-Solomon IOP)
	CommitmentFRI
)

type CommitteeCert

type CommitteeCert struct {
	CommitteeID  ids.ID `json:"committeeId"`
	Threshold    int    `json:"threshold"`
	TotalMembers int    `json:"totalMembers"`

	// Endorsements from committee members
	Endorsements []*Endorsement `json:"endorsements"`

	// Aggregate signature (if using BLS)
	AggregateSignature []byte `json:"aggregateSignature,omitempty"`

	// What is being certified
	RequestID        ids.ID    `json:"requestId"`
	OutputCommitment [32]byte  `json:"outputCommitment"`
	Timestamp        time.Time `json:"timestamp"`
}

CommitteeCert represents threshold endorsement from a compute committee

func (*CommitteeCert) Verify

func (c *CommitteeCert) Verify() error

Verify verifies the committee certificate

type ComputeAnchor

type ComputeAnchor struct {
	ResultID   ids.ID `json:"resultId"`
	RequestID  ids.ID `json:"requestId"`
	AppChainID ids.ID `json:"appChainId"`

	// Commitments
	InputCommitment  [32]byte `json:"inputCommitment"`
	OutputCommitment [32]byte `json:"outputCommitment"`
	ProgramHash      [32]byte `json:"programHash"`

	// Attestation summary
	TEEType          TEEType `json:"teeType,omitempty"`
	HasTEEAttest     bool    `json:"hasTeeAttest"`
	HasZKProof       bool    `json:"hasZkProof"`
	HasCommitteeCert bool    `json:"hasCommitteeCert"`

	// DA reference for full attestation
	AttestationDAPointer *DAPointer `json:"attestationDaPointer"`

	// Block anchoring
	BlockHeight uint64    `json:"blockHeight"`
	BlockHash   [32]byte  `json:"blockHash"`
	TxIndex     uint32    `json:"txIndex"`
	Timestamp   time.Time `json:"timestamp"`
}

ComputeAnchor anchors compute result to chain

func (*ComputeAnchor) Hash

func (a *ComputeAnchor) Hash() [32]byte

Hash returns the hash of the compute anchor

type ComputeCommittee

type ComputeCommittee struct {
	ID         ids.ID
	Members    [][]byte
	Threshold  int
	PublicKeys [][]byte
}

ComputeCommittee is a group that collectively attests to computation

type ComputeMode

type ComputeMode uint8

ComputeMode defines how confidential compute is performed

const (
	// ComputeModeTEE uses Trusted Execution Environment
	ComputeModeTEE ComputeMode = iota
	// ComputeModeFHE uses Fully Homomorphic Encryption
	ComputeModeFHE
	// ComputeModeZK uses Zero-Knowledge Proofs
	ComputeModeZK
	// ComputeModeHybrid combines TEE + FHE or TEE + ZK
	ComputeModeHybrid
)

type ComputeProof

type ComputeProof struct {
	ProofSystem  string   `json:"proofSystem"` // "groth16", "plonk", "stark"
	Proof        []byte   `json:"proof"`
	PublicInputs [][]byte `json:"publicInputs"`
	VerifyingKey []byte   `json:"verifyingKey"`

	// Commitments
	InputCommitment  [32]byte `json:"inputCommitment"`
	OutputCommitment [32]byte `json:"outputCommitment"`
	ProgramHash      [32]byte `json:"programHash"`
}

ComputeProof represents a ZK proof of correct computation

func (*ComputeProof) Verify

func (p *ComputeProof) Verify() error

Verify verifies the ZK proof

type ComputeRequest

type ComputeRequest struct {
	ID         ids.ID `json:"id"`
	AppChainID ids.ID `json:"appChainId"`
	Requester  []byte `json:"requester"`

	// Input specification
	InputRefs       []DataRef `json:"inputRefs"` // References to encrypted input data
	InputCommitment [32]byte  `json:"inputCommitment"`

	// Computation specification
	ComputeMode ComputeMode `json:"computeMode"`
	Program     []byte      `json:"program"` // WASM, bytecode, or program hash
	ProgramHash [32]byte    `json:"programHash"`
	Parameters  []byte      `json:"parameters"`

	// Output specification
	OutputDomain     EncryptionDomain `json:"outputDomain"`
	OutputRecipients [][]byte         `json:"outputRecipients"`

	// Attestation requirements
	RequireTEE   bool      `json:"requireTee"`
	AcceptedTEEs []TEEType `json:"acceptedTees"`
	RequireProof bool      `json:"requireProof"`

	// Timing
	Deadline time.Time `json:"deadline"`
	MaxGas   uint64    `json:"maxGas"`
}

ComputeRequest represents a request for confidential computation

type ComputeResult

type ComputeResult struct {
	RequestID ids.ID        `json:"requestId"`
	Status    ComputeStatus `json:"status"`

	// Output
	OutputData       []byte     `json:"outputData"` // Encrypted
	OutputCommitment [32]byte   `json:"outputCommitment"`
	OutputDAPointer  *DAPointer `json:"outputDaPointer,omitempty"`

	// Attestation
	Attestation   *TEEAttestation `json:"attestation,omitempty"`
	Proof         *ComputeProof   `json:"proof,omitempty"`
	CommitteeCert *CommitteeCert  `json:"committeeCert,omitempty"`

	// Timing
	ComputedAt time.Time `json:"computedAt"`
	GasUsed    uint64    `json:"gasUsed"`
}

ComputeResult represents the result of confidential computation

type ComputeSession

type ComputeSession struct {
	Request      *ComputeRequest
	Status       ComputeStatus
	StartedAt    time.Time
	Endorsements []*Endorsement
}

ComputeSession tracks an active computation

type ComputeStatus

type ComputeStatus uint8

ComputeStatus represents the status of a compute request

const (
	ComputeStatusPending ComputeStatus = iota
	ComputeStatusRunning
	ComputeStatusCompleted
	ComputeStatusFailed
	ComputeStatusTimeout
)

type ConfidentialComputeEngine

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

ConfidentialComputeEngine handles confidential computation

func NewConfidentialComputeEngine

func NewConfidentialComputeEngine(teeType TEEType) *ConfidentialComputeEngine

NewConfidentialComputeEngine creates a new compute engine

func (*ConfidentialComputeEngine) Execute

func (e *ConfidentialComputeEngine) Execute(ctx context.Context, reqID ids.ID) (*ComputeResult, error)

Execute executes a computation inside TEE

func (*ConfidentialComputeEngine) GetResult

func (e *ConfidentialComputeEngine) GetResult(reqID ids.ID) (*ComputeResult, bool)

GetResult retrieves a compute result

func (*ConfidentialComputeEngine) SubmitRequest

func (e *ConfidentialComputeEngine) SubmitRequest(ctx context.Context, req *ComputeRequest) error

SubmitRequest submits a compute request

func (*ConfidentialComputeEngine) VerifyResult

func (e *ConfidentialComputeEngine) VerifyResult(result *ComputeResult) error

VerifyResult verifies a compute result

type CosmosAdapter

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

CosmosAdapter implements IBC light client verification for Cosmos chains

func NewCosmosAdapter

func NewCosmosAdapter() *CosmosAdapter

NewCosmosAdapter creates a new Cosmos IBC adapter

func (*CosmosAdapter) ChainID

func (a *CosmosAdapter) ChainID() ChainID

ChainID returns the Cosmos chain ID

func (*CosmosAdapter) ChainName

func (a *CosmosAdapter) ChainName() string

ChainName returns "Cosmos Hub"

func (*CosmosAdapter) Close

func (a *CosmosAdapter) Close() error

Close closes the adapter

func (*CosmosAdapter) GetBlockTime

func (a *CosmosAdapter) GetBlockTime() time.Duration

GetBlockTime returns Tendermint block time

func (*CosmosAdapter) GetLatestFinalizedBlock

func (a *CosmosAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

GetLatestFinalizedBlock returns the latest finalized height

func (*CosmosAdapter) GetRequiredConfirmations

func (a *CosmosAdapter) GetRequiredConfirmations() uint64

GetRequiredConfirmations returns 1 for Cosmos (instant finality)

func (*CosmosAdapter) GetValidatorSet

func (a *CosmosAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

GetValidatorSet returns the current validator set

func (*CosmosAdapter) Initialize

func (a *CosmosAdapter) Initialize(config *ChainConfig) error

Initialize initializes the adapter

func (*CosmosAdapter) IsFinalized

func (a *CosmosAdapter) IsFinalized(ctx context.Context, height uint64) (bool, error)

IsFinalized checks if a block is finalized

func (*CosmosAdapter) UpdateClientState

func (a *CosmosAdapter) UpdateClientState(header *CosmosHeader, validatorSet *TendermintValidatorSet) error

UpdateClientState updates the IBC client state

func (*CosmosAdapter) VerificationMode

func (a *CosmosAdapter) VerificationMode() VerificationMode

VerificationMode returns ModeLightClient

func (*CosmosAdapter) VerifyBlockHeader

func (a *CosmosAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

VerifyBlockHeader verifies a Cosmos block header

func (*CosmosAdapter) VerifyEvent

func (a *CosmosAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

VerifyEvent verifies a Cosmos event

func (*CosmosAdapter) VerifyMessage

func (a *CosmosAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

VerifyMessage verifies a cross-chain message from Cosmos (IBC packet)

func (*CosmosAdapter) VerifyTransaction

func (a *CosmosAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

VerifyTransaction verifies a Cosmos transaction inclusion

type CosmosHeader

type CosmosHeader struct {
	Height             uint64   `json:"height"`
	Time               int64    `json:"time"`
	ChainID            string   `json:"chainId"`
	LastBlockHash      [32]byte `json:"lastBlockHash"`
	DataHash           [32]byte `json:"dataHash"`
	ValidatorsHash     [32]byte `json:"validatorsHash"`
	NextValidatorsHash [32]byte `json:"nextValidatorsHash"`
	ConsensusHash      [32]byte `json:"consensusHash"`
	AppHash            [32]byte `json:"appHash"`
	LastResultsHash    [32]byte `json:"lastResultsHash"`
	EvidenceHash       [32]byte `json:"evidenceHash"`
	ProposerAddress    [20]byte `json:"proposerAddress"`

	// Computed
	Hash      [32]byte `json:"hash"`
	Finalized bool     `json:"finalized"`
}

CosmosHeader represents a Cosmos/Tendermint block header

type CosmosSDKAdapter

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

func NewCosmosSDKAdapter

func NewCosmosSDKAdapter(chainID ChainID, name, prefix string, blockTime time.Duration) *CosmosSDKAdapter

func (*CosmosSDKAdapter) ChainID

func (a *CosmosSDKAdapter) ChainID() ChainID

func (*CosmosSDKAdapter) ChainName

func (a *CosmosSDKAdapter) ChainName() string

func (*CosmosSDKAdapter) Close

func (a *CosmosSDKAdapter) Close() error

func (*CosmosSDKAdapter) GetBlockTime

func (a *CosmosSDKAdapter) GetBlockTime() time.Duration

func (*CosmosSDKAdapter) GetLatestFinalizedBlock

func (a *CosmosSDKAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*CosmosSDKAdapter) GetRequiredConfirmations

func (a *CosmosSDKAdapter) GetRequiredConfirmations() uint64

func (*CosmosSDKAdapter) GetValidatorSet

func (a *CosmosSDKAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*CosmosSDKAdapter) Initialize

func (a *CosmosSDKAdapter) Initialize(config *ChainConfig) error

func (*CosmosSDKAdapter) IsFinalized

func (a *CosmosSDKAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*CosmosSDKAdapter) VerificationMode

func (a *CosmosSDKAdapter) VerificationMode() VerificationMode

func (*CosmosSDKAdapter) VerifyBlockHeader

func (a *CosmosSDKAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*CosmosSDKAdapter) VerifyEvent

func (a *CosmosSDKAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*CosmosSDKAdapter) VerifyMessage

func (a *CosmosSDKAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*CosmosSDKAdapter) VerifyTransaction

func (a *CosmosSDKAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type CosmosSDKBlock

type CosmosSDKBlock struct {
	Height         uint64   `json:"height"`
	Hash           [32]byte `json:"hash"`
	AppHash        [32]byte `json:"appHash"`
	ValidatorsHash [32]byte `json:"validatorsHash"`
	Timestamp      uint64   `json:"timestamp"`
	Signatures     [][]byte `json:"signatures"`
}

type CosmosSDKValidator

type CosmosSDKValidator struct {
	Address     [20]byte `json:"address"`
	PubKey      []byte   `json:"pubKey"`
	VotingPower int64    `json:"votingPower"`
}

type CrossChainAsset

type CrossChainAsset struct {
	AssetID          ids.ID             `json:"assetId"`
	Name             string             `json:"name"`
	Symbol           string             `json:"symbol"`
	Decimals         uint8              `json:"decimals"`
	NativeChain      ChainID            `json:"nativeChain"`      // Chain where asset is native
	WrappedAddresses map[ChainID][]byte `json:"wrappedAddresses"` // Wrapped addresses on other chains
}

CrossChainAsset represents an asset that can be bridged

type CrossChainMessage

type CrossChainMessage struct {
	ID          ids.ID  `json:"id"`
	SourceChain ChainID `json:"sourceChain"`
	DestChain   ChainID `json:"destChain"`
	Sender      []byte  `json:"sender"`
	Recipient   []byte  `json:"recipient"`
	Nonce       uint64  `json:"nonce"`
	Payload     []byte  `json:"payload"`

	// Source chain proof
	SourceBlock  uint64   `json:"sourceBlock"`
	SourceTxHash [32]byte `json:"sourceTxHash"`
	SourceProof  []byte   `json:"sourceProof"`

	// Timestamp and expiry
	Timestamp  int64 `json:"timestamp"`
	ExpiryTime int64 `json:"expiryTime"`
}

CrossChainMessage represents a message to be relayed between chains

type DAClient

type DAClient interface {
	// Store stores data in the DA layer and returns a pointer
	Store(ctx context.Context, data []byte, commitment [32]byte) (*DAPointer, error)

	// Retrieve retrieves data from the DA layer
	Retrieve(ctx context.Context, pointer *DAPointer) ([]byte, error)

	// GetAvailabilityReceipt gets proof of data availability
	GetAvailabilityReceipt(ctx context.Context, pointer *DAPointer) (*DAReceipt, error)

	// SetReplicationPolicy sets geographic replication policy
	SetReplicationPolicy(ctx context.Context, pointer *DAPointer, regions []string) error

	// Prune removes data that's past retention
	Prune(ctx context.Context, before time.Time) error
}

DAClient interfaces with the Data Availability layer

type DACommitment

type DACommitment struct {
	Scheme     CommitmentScheme `json:"scheme"`
	Data       []byte           `json:"data"`
	Proof      []byte           `json:"proof,omitempty"`
	Parameters []byte           `json:"parameters,omitempty"`
}

DACommitment represents a cryptographic commitment to DA data

func CreateDACommitment

func CreateDACommitment(scheme CommitmentScheme, data []byte) *DACommitment

CreateDACommitment creates a commitment for data

func (*DACommitment) Verify

func (c *DACommitment) Verify(data []byte) error

Verify verifies the commitment

type DAConfig

type DAConfig struct {
	LayerType         DALayerType   `json:"layerType"`
	Endpoints         []string      `json:"endpoints"`
	ReplicationFactor int           `json:"replicationFactor"`
	RetentionPeriod   time.Duration `json:"retentionPeriod"`
	MaxBlobSize       uint64        `json:"maxBlobSize"`
	SamplingEnabled   bool          `json:"samplingEnabled"`
	SamplingRate      int           `json:"samplingRate"` // Samples per blob
}

DAConfig configures the DA layer

type DAGAdapter

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

func NewDAGAdapter

func NewDAGAdapter(chainID ChainID, name, consensusType string, blockTime time.Duration) *DAGAdapter

func (*DAGAdapter) ChainID

func (a *DAGAdapter) ChainID() ChainID

func (*DAGAdapter) ChainName

func (a *DAGAdapter) ChainName() string

func (*DAGAdapter) Close

func (a *DAGAdapter) Close() error

func (*DAGAdapter) GetBlockTime

func (a *DAGAdapter) GetBlockTime() time.Duration

func (*DAGAdapter) GetLatestFinalizedBlock

func (a *DAGAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*DAGAdapter) GetRequiredConfirmations

func (a *DAGAdapter) GetRequiredConfirmations() uint64

func (*DAGAdapter) GetValidatorSet

func (a *DAGAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*DAGAdapter) Initialize

func (a *DAGAdapter) Initialize(config *ChainConfig) error

func (*DAGAdapter) IsFinalized

func (a *DAGAdapter) IsFinalized(ctx context.Context, vertex uint64) (bool, error)

func (*DAGAdapter) VerificationMode

func (a *DAGAdapter) VerificationMode() VerificationMode

func (*DAGAdapter) VerifyBlockHeader

func (a *DAGAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*DAGAdapter) VerifyEvent

func (a *DAGAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*DAGAdapter) VerifyMessage

func (a *DAGAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*DAGAdapter) VerifyTransaction

func (a *DAGAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type DAGVertex

type DAGVertex struct {
	Hash      [32]byte   `json:"hash"`
	Parents   [][32]byte `json:"parents"`
	Timestamp uint64     `json:"timestamp"`
	Round     uint64     `json:"round"`
	Confirmed bool       `json:"confirmed"`
}

type DALayerType

type DALayerType uint8

DALayerType defines the type of DA layer

const (
	// DALayerLux is the native Lux DA layer
	DALayerLux DALayerType = iota
	// DALayerCelestia uses Celestia for DA
	DALayerCelestia
	// DALayerEigenDA uses EigenDA
	DALayerEigenDA
	// DALayerAvail uses Avail
	DALayerAvail
	// DALayerNearDA uses NEAR DA
	DALayerNearDA
)

type DAMetrics

type DAMetrics struct {
	TotalBlobs      int64         `json:"totalBlobs"`
	TotalSize       uint64        `json:"totalSize"`
	CacheHitRate    float64       `json:"cacheHitRate"`
	AvgLatency      time.Duration `json:"avgLatency"`
	NodeCount       int           `json:"nodeCount"`
	HealthyNodes    int           `json:"healthyNodes"`
	ReplicationRate float64       `json:"replicationRate"`
}

DAMetrics contains metrics for the DA layer

type DANode

type DANode struct {
	ID           []byte    `json:"id"`
	Endpoint     string    `json:"endpoint"`
	Region       string    `json:"region"`
	Stake        uint64    `json:"stake"`
	Reputation   uint64    `json:"reputation"`
	LastSeen     time.Time `json:"lastSeen"`
	StorageUsed  uint64    `json:"storageUsed"`
	StorageLimit uint64    `json:"storageLimit"`
}

DANode represents a node in the DA network

type DAPointer

type DAPointer struct {
	BlobID        [32]byte  `json:"blobId"`
	ChunkIndex    uint32    `json:"chunkIndex"`
	Size          uint64    `json:"size"`
	AvailableFrom time.Time `json:"availableFrom"`
	ExpiresAt     time.Time `json:"expiresAt"`
	Commitment    [32]byte  `json:"commitment"`
}

DAPointer references data in the DA layer

type DAReceipt

type DAReceipt struct {
	Pointer      *DAPointer `json:"pointer"`
	Attestations [][]byte   `json:"attestations"` // From DA nodes
	Timestamp    time.Time  `json:"timestamp"`
	ValidUntil   time.Time  `json:"validUntil"`
	Signature    []byte     `json:"signature"`
}

DAReceipt proves data availability

type DataRef

type DataRef struct {
	DocumentID DocumentID       `json:"documentId"`
	DAPointer  *DAPointer       `json:"daPointer"`
	Commitment [32]byte         `json:"commitment"`
	Domain     EncryptionDomain `json:"domain"`
}

DataRef references encrypted data for compute

type DefaultDAClient

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

DefaultDAClient implements DAClient interface

func NewDefaultDAClient

func NewDefaultDAClient(config *DAConfig) *DefaultDAClient

NewDefaultDAClient creates a new DA client

func (*DefaultDAClient) GetAvailabilityReceipt

func (c *DefaultDAClient) GetAvailabilityReceipt(ctx context.Context, pointer *DAPointer) (*DAReceipt, error)

GetAvailabilityReceipt gets proof of data availability

func (*DefaultDAClient) GetMetrics

func (c *DefaultDAClient) GetMetrics() *DAMetrics

GetMetrics returns DA metrics

func (*DefaultDAClient) GetNodes

func (c *DefaultDAClient) GetNodes() []*DANode

GetNodes returns all registered nodes

func (*DefaultDAClient) Prune

func (c *DefaultDAClient) Prune(ctx context.Context, before time.Time) error

Prune removes data that's past retention

func (*DefaultDAClient) RegisterNode

func (c *DefaultDAClient) RegisterNode(node *DANode)

RegisterNode registers a DA node

func (*DefaultDAClient) Retrieve

func (c *DefaultDAClient) Retrieve(ctx context.Context, pointer *DAPointer) ([]byte, error)

Retrieve retrieves data from the DA layer

func (*DefaultDAClient) SetReplicationPolicy

func (c *DefaultDAClient) SetReplicationPolicy(ctx context.Context, pointer *DAPointer, regions []string) error

SetReplicationPolicy sets geographic replication policy

func (*DefaultDAClient) Store

func (c *DefaultDAClient) Store(ctx context.Context, data []byte, commitment [32]byte) (*DAPointer, error)

Store stores data in the DA layer

type DefaultEncryptor

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

DefaultEncryptor provides default encryption implementation

func NewDefaultEncryptor

func NewDefaultEncryptor(keyManager *DomainKeyManager, fheEnabled bool, scheme FHEScheme) *DefaultEncryptor

NewDefaultEncryptor creates a new default encryptor

func (*DefaultEncryptor) ComputeFHE

func (e *DefaultEncryptor) ComputeFHE(ctx context.Context, encrypted []byte, operation string, params []byte) ([]byte, error)

ComputeFHE performs computation on FHE-encrypted data

func (*DefaultEncryptor) Decrypt

func (e *DefaultEncryptor) Decrypt(ctx context.Context, ciphertext []byte, domain EncryptionDomain, privateKey []byte) ([]byte, error)

Decrypt decrypts data if the caller has access

func (*DefaultEncryptor) DecryptChaCha

func (e *DefaultEncryptor) DecryptChaCha(ctx context.Context, ciphertext []byte, key []byte) ([]byte, error)

DecryptChaCha decrypts ChaCha20-Poly1305 ciphertext

func (*DefaultEncryptor) DecryptFHE

func (e *DefaultEncryptor) DecryptFHE(ctx context.Context, encrypted []byte, privateKey []byte) ([]byte, error)

DecryptFHE decrypts FHE result

func (*DefaultEncryptor) DeriveSharedKey

func (e *DefaultEncryptor) DeriveSharedKey(parties [][]byte, threshold int) ([]byte, error)

DeriveSharedKey derives a shared key for multi-party access

func (*DefaultEncryptor) Encrypt

func (e *DefaultEncryptor) Encrypt(ctx context.Context, data []byte, domain EncryptionDomain, recipients [][]byte) ([]byte, error)

Encrypt encrypts data for a specific domain using AES-GCM or ChaCha20-Poly1305

func (*DefaultEncryptor) EncryptChaCha

func (e *DefaultEncryptor) EncryptChaCha(ctx context.Context, data []byte, key []byte) ([]byte, error)

EncryptChaCha encrypts using ChaCha20-Poly1305 (alternative to AES-GCM)

func (*DefaultEncryptor) EncryptFHE

func (e *DefaultEncryptor) EncryptFHE(ctx context.Context, data []byte, scheme string) ([]byte, error)

EncryptFHE performs FHE encryption for homomorphic operations

func (*DefaultEncryptor) GenerateDomainKey

func (e *DefaultEncryptor) GenerateDomainKey(domain EncryptionDomain) (publicKey, privateKey []byte, err error)

GenerateDomainKey generates a new key for an encryption domain

type Document

type Document struct {
	ID        DocumentID       `json:"id"`
	Domain    EncryptionDomain `json:"domain"`
	Seq       uint64           `json:"seq"`     // Monotonic sequence number
	Version   [32]byte         `json:"version"` // Hash of current state
	CreatedAt time.Time        `json:"createdAt"`
	UpdatedAt time.Time        `json:"updatedAt"`

	// Encrypted content (ciphertext)
	EncryptedData []byte `json:"encryptedData"`

	// Commitment to the plaintext (for verification without decryption)
	DataCommitment [32]byte `json:"dataCommitment"`

	// CRDT metadata
	CRDTType    CRDTType          `json:"crdtType"`
	VectorClock map[string]uint64 `json:"vectorClock"`

	// DA layer reference
	DAPointer *DAPointer `json:"daPointer,omitempty"`
}

Document represents a versioned document in fheCRDT

type DocumentID

type DocumentID struct {
	AppChainID ids.ID `json:"appChainId"`
	Collection string `json:"collection"`
	DocID      string `json:"docId"`
}

DocumentID uniquely identifies a document in an app chain

func (*DocumentID) Hash

func (d *DocumentID) Hash() [32]byte

Hash returns the hash of the document ID

type DomainKeyManager

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

DomainKeyManager manages encryption keys for different domains

func NewDomainKeyManager

func NewDomainKeyManager() *DomainKeyManager

NewDomainKeyManager creates a new domain key manager

func (*DomainKeyManager) GenerateKeys

func (m *DomainKeyManager) GenerateKeys(domain EncryptionDomain) (*DomainKeySet, error)

GenerateKeys generates keys for a domain

func (*DomainKeyManager) GetKeys

func (m *DomainKeyManager) GetKeys(domain EncryptionDomain) (*DomainKeySet, bool)

GetKeys retrieves keys for a domain

func (*DomainKeyManager) SetupThresholdKey

func (m *DomainKeyManager) SetupThresholdKey(id string, threshold, totalShares int) (*ThresholdKeySet, error)

SetupThresholdKey sets up a threshold key for multi-party access

type DomainKeySet

type DomainKeySet struct {
	Domain     EncryptionDomain `json:"domain"`
	Version    uint32           `json:"version"`
	PublicKey  []byte           `json:"publicKey"`
	PrivateKey []byte           `json:"privateKey,omitempty"` // Only if holder has access
	EncryptKey []byte           `json:"encryptKey"`           // Symmetric key for data encryption
	CreatedAt  int64            `json:"createdAt"`
	RotatedAt  int64            `json:"rotatedAt,omitempty"`
}

DomainKeySet holds keys for a specific encryption domain

type EVMHeader

type EVMHeader struct {
	BlockNumber uint64   `json:"blockNumber"`
	ParentHash  [32]byte `json:"parentHash"`
	StateRoot   [32]byte `json:"stateRoot"`
	TxRoot      [32]byte `json:"txRoot"`
	ReceiptRoot [32]byte `json:"receiptRoot"`
	Hash        [32]byte `json:"hash"`
	Timestamp   uint64   `json:"timestamp"`
}

type EVML2Adapter

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

func NewArbitrumAdapter

func NewArbitrumAdapter() *EVML2Adapter

func NewBaseAdapter

func NewBaseAdapter() *EVML2Adapter

func NewOptimismAdapter

func NewOptimismAdapter() *EVML2Adapter

func (*EVML2Adapter) ChainID

func (a *EVML2Adapter) ChainID() ChainID

func (*EVML2Adapter) ChainName

func (a *EVML2Adapter) ChainName() string

func (*EVML2Adapter) Close

func (a *EVML2Adapter) Close() error

func (*EVML2Adapter) GetBlockTime

func (a *EVML2Adapter) GetBlockTime() time.Duration

func (*EVML2Adapter) GetLatestFinalizedBlock

func (a *EVML2Adapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*EVML2Adapter) GetRequiredConfirmations

func (a *EVML2Adapter) GetRequiredConfirmations() uint64

func (*EVML2Adapter) GetValidatorSet

func (a *EVML2Adapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*EVML2Adapter) Initialize

func (a *EVML2Adapter) Initialize(config *ChainConfig) error

func (*EVML2Adapter) IsFinalized

func (a *EVML2Adapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*EVML2Adapter) VerificationMode

func (a *EVML2Adapter) VerificationMode() VerificationMode

func (*EVML2Adapter) VerifyBlockHeader

func (a *EVML2Adapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*EVML2Adapter) VerifyEvent

func (a *EVML2Adapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*EVML2Adapter) VerifyMessage

func (a *EVML2Adapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*EVML2Adapter) VerifyTransaction

func (a *EVML2Adapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type EncryptionCapability

type EncryptionCapability struct {
	PartyID     []byte             `json:"partyId"`
	Domains     []EncryptionDomain `json:"domains"`     // Domains party can access
	Operations  []FHEOperation     `json:"operations"`  // FHE operations allowed
	ReadOnly    bool               `json:"readOnly"`    // Can only decrypt, not encrypt
	ValidUntil  int64              `json:"validUntil"`  // Expiry timestamp
	Delegatable bool               `json:"delegatable"` // Can delegate to others
}

EncryptionCapability represents what a party can do with encrypted data

type EncryptionDomain

type EncryptionDomain uint8

EncryptionDomain defines the privacy boundary for data

const (
	// DomainUserPrivate is readable only by the owning user
	DomainUserPrivate EncryptionDomain = iota
	// DomainMerchantPrivate is readable only by the merchant/operator
	DomainMerchantPrivate
	// DomainShared is readable by both user and merchant (orders, transactions)
	DomainShared
	// DomainPublic is readable by anyone (on-chain state)
	DomainPublic
)

func (EncryptionDomain) String

func (d EncryptionDomain) String() string

String returns the string representation of EncryptionDomain

type Encryptor

type Encryptor interface {
	// Encrypt encrypts data for a specific domain
	Encrypt(ctx context.Context, data []byte, domain EncryptionDomain, recipients [][]byte) ([]byte, error)

	// Decrypt decrypts data if the caller has access
	Decrypt(ctx context.Context, ciphertext []byte, domain EncryptionDomain, privateKey []byte) ([]byte, error)

	// EncryptFHE performs FHE encryption for homomorphic operations
	EncryptFHE(ctx context.Context, data []byte, scheme string) ([]byte, error)

	// ComputeFHE performs computation on FHE-encrypted data
	ComputeFHE(ctx context.Context, encrypted []byte, operation string, params []byte) ([]byte, error)

	// DecryptFHE decrypts FHE result
	DecryptFHE(ctx context.Context, encrypted []byte, privateKey []byte) ([]byte, error)

	// GenerateDomainKey generates a new key for an encryption domain
	GenerateDomainKey(domain EncryptionDomain) (publicKey, privateKey []byte, err error)

	// DeriveSharedKey derives a shared key for multi-party access
	DeriveSharedKey(parties [][]byte, threshold int) ([]byte, error)
}

Encryptor handles encryption/decryption operations

type Endorsement

type Endorsement struct {
	MemberID       []byte          `json:"memberId"`
	MemberIndex    int             `json:"memberIndex"`
	Signature      []byte          `json:"signature"`
	TEEAttestation *TEEAttestation `json:"teeAttestation,omitempty"`
}

Endorsement is a single committee member's endorsement

type EthereumAdapter

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

EthereumAdapter implements light client verification for Ethereum Uses sync committee signatures for finality verification

func NewEthereumAdapter

func NewEthereumAdapter() *EthereumAdapter

NewEthereumAdapter creates a new Ethereum light client adapter

func (*EthereumAdapter) ChainID

func (a *EthereumAdapter) ChainID() ChainID

ChainID returns the Ethereum chain ID

func (*EthereumAdapter) ChainName

func (a *EthereumAdapter) ChainName() string

ChainName returns "Ethereum"

func (*EthereumAdapter) Close

func (a *EthereumAdapter) Close() error

Close closes the adapter

func (*EthereumAdapter) GetBlockTime

func (a *EthereumAdapter) GetBlockTime() time.Duration

GetBlockTime returns Ethereum block time (12 seconds)

func (*EthereumAdapter) GetLatestFinalizedBlock

func (a *EthereumAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

GetLatestFinalizedBlock returns the latest finalized slot

func (*EthereumAdapter) GetRequiredConfirmations

func (a *EthereumAdapter) GetRequiredConfirmations() uint64

GetRequiredConfirmations returns 1 for Ethereum (sync committee finality)

func (*EthereumAdapter) GetValidatorSet

func (a *EthereumAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

GetValidatorSet returns the current sync committee as validator set

func (*EthereumAdapter) Initialize

func (a *EthereumAdapter) Initialize(config *ChainConfig) error

Initialize initializes the adapter

func (*EthereumAdapter) IsFinalized

func (a *EthereumAdapter) IsFinalized(ctx context.Context, slot uint64) (bool, error)

IsFinalized checks if a slot is finalized

func (*EthereumAdapter) ProcessLightClientUpdate

func (a *EthereumAdapter) ProcessLightClientUpdate(update *LightClientUpdate) error

ProcessLightClientUpdate processes a light client update

func (*EthereumAdapter) VerificationMode

func (a *EthereumAdapter) VerificationMode() VerificationMode

VerificationMode returns ModeLightClient

func (*EthereumAdapter) VerifyBlockHeader

func (a *EthereumAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

VerifyBlockHeader verifies an Ethereum block header

func (*EthereumAdapter) VerifyEvent

func (a *EthereumAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

VerifyEvent verifies an Ethereum event/log

func (*EthereumAdapter) VerifyMessage

func (a *EthereumAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

VerifyMessage verifies a cross-chain message from Ethereum

func (*EthereumAdapter) VerifyTransaction

func (a *EthereumAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

VerifyTransaction verifies an Ethereum transaction inclusion

type EthereumHeader

type EthereumHeader struct {
	Slot          uint64   `json:"slot"`
	ProposerIndex uint64   `json:"proposerIndex"`
	ParentRoot    [32]byte `json:"parentRoot"`
	StateRoot     [32]byte `json:"stateRoot"`
	BodyRoot      [32]byte `json:"bodyRoot"`

	// Computed
	Root      [32]byte `json:"root"` // Block root
	Finalized bool     `json:"finalized"`
}

EthereumHeader represents an Ethereum beacon chain header

type FHEOperation

type FHEOperation string

FHEOperation defines supported FHE operations

const (
	FHEOpAdd      FHEOperation = "add"
	FHEOpMultiply FHEOperation = "multiply"
	FHEOpSum      FHEOperation = "sum"
	FHEOpCount    FHEOperation = "count"
	FHEOpAverage  FHEOperation = "average"
	FHEOpCompare  FHEOperation = "compare"
	FHEOpRotate   FHEOperation = "rotate"
)

type FHEScheme

type FHEScheme string

FHEScheme defines the FHE scheme in use

const (
	// FHESchemeBFV is the BFV scheme (integer arithmetic)
	FHESchemeBFV FHEScheme = "bfv"
	// FHESchemeCKKS is the CKKS scheme (approximate arithmetic)
	FHESchemeCKKS FHEScheme = "ckks"
	// FHESchemeTFHE is the TFHE scheme (boolean circuits)
	FHESchemeTFHE FHEScheme = "tfhe"
)

type FieldSchema

type FieldSchema struct {
	Name      string `json:"name"`
	Type      string `json:"type"` // "string", "number", "boolean", "json", "blob"
	Nullable  bool   `json:"nullable"`
	Default   any    `json:"default,omitempty"`
	Encrypted bool   `json:"encrypted"` // Field-level encryption
}

FieldSchema defines a field in a collection

type GRANDPAJustification

type GRANDPAJustification struct {
	Round      uint64             `json:"round"`
	Commit     [32]byte           `json:"commit"`
	Precommits []GRANDPAPrecommit `json:"precommits"`
}

type GRANDPAPrecommit

type GRANDPAPrecommit struct {
	TargetHash   [32]byte `json:"targetHash"`
	TargetNumber uint64   `json:"targetNumber"`
	Signature    [64]byte `json:"signature"`
	AuthorityID  uint32   `json:"authorityId"`
}

type GenericEVMAdapter

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

func NewGenericEVMAdapter

func NewGenericEVMAdapter(chainID ChainID, name string, evmID uint64, blockTime time.Duration, confs uint64, mode VerificationMode) *GenericEVMAdapter

func (*GenericEVMAdapter) ChainID

func (a *GenericEVMAdapter) ChainID() ChainID

func (*GenericEVMAdapter) ChainName

func (a *GenericEVMAdapter) ChainName() string

func (*GenericEVMAdapter) Close

func (a *GenericEVMAdapter) Close() error

func (*GenericEVMAdapter) EVMChainID

func (a *GenericEVMAdapter) EVMChainID() uint64

func (*GenericEVMAdapter) GetBlockTime

func (a *GenericEVMAdapter) GetBlockTime() time.Duration

func (*GenericEVMAdapter) GetLatestFinalizedBlock

func (a *GenericEVMAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*GenericEVMAdapter) GetRequiredConfirmations

func (a *GenericEVMAdapter) GetRequiredConfirmations() uint64

func (*GenericEVMAdapter) GetValidatorSet

func (a *GenericEVMAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*GenericEVMAdapter) Initialize

func (a *GenericEVMAdapter) Initialize(config *ChainConfig) error

func (*GenericEVMAdapter) IsFinalized

func (a *GenericEVMAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*GenericEVMAdapter) VerificationMode

func (a *GenericEVMAdapter) VerificationMode() VerificationMode

func (*GenericEVMAdapter) VerifyBlockHeader

func (a *GenericEVMAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*GenericEVMAdapter) VerifyEvent

func (a *GenericEVMAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*GenericEVMAdapter) VerifyMessage

func (a *GenericEVMAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*GenericEVMAdapter) VerifyTransaction

func (a *GenericEVMAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type HeimdallCheckpoint

type HeimdallCheckpoint struct {
	StartBlock uint64   `json:"startBlock"`
	EndBlock   uint64   `json:"endBlock"`
	RootHash   [32]byte `json:"rootHash"`
	Proposer   [20]byte `json:"proposer"`
	Timestamp  uint64   `json:"timestamp"`
	Signatures [][]byte `json:"signatures"`
}

type IBCClientState

type IBCClientState struct {
	ChainID         string  `json:"chainId"`
	TrustLevel      float64 `json:"trustLevel"`      // e.g., 0.67 for 2/3
	TrustingPeriod  int64   `json:"trustingPeriod"`  // In seconds
	UnbondingPeriod int64   `json:"unbondingPeriod"` // In seconds
	MaxClockDrift   int64   `json:"maxClockDrift"`   // In seconds
	LatestHeight    uint64  `json:"latestHeight"`
	FrozenHeight    uint64  `json:"frozenHeight"` // 0 if not frozen
}

IBCClientState represents IBC light client state

type IBCConsensusState

type IBCConsensusState struct {
	Timestamp          int64    `json:"timestamp"`
	Root               [32]byte `json:"root"` // App hash / Merkle root
	NextValidatorsHash [32]byte `json:"nextValidatorsHash"`
}

IBCConsensusState represents IBC consensus state

type ICPAdapter

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

func NewICPAdapter

func NewICPAdapter() *ICPAdapter

func (*ICPAdapter) ChainID

func (a *ICPAdapter) ChainID() ChainID

func (*ICPAdapter) ChainName

func (a *ICPAdapter) ChainName() string

func (*ICPAdapter) Close

func (a *ICPAdapter) Close() error

func (*ICPAdapter) GetBlockTime

func (a *ICPAdapter) GetBlockTime() time.Duration

func (*ICPAdapter) GetLatestFinalizedBlock

func (a *ICPAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*ICPAdapter) GetRequiredConfirmations

func (a *ICPAdapter) GetRequiredConfirmations() uint64

func (*ICPAdapter) GetValidatorSet

func (a *ICPAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*ICPAdapter) Initialize

func (a *ICPAdapter) Initialize(config *ChainConfig) error

func (*ICPAdapter) IsFinalized

func (a *ICPAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*ICPAdapter) VerificationMode

func (a *ICPAdapter) VerificationMode() VerificationMode

func (*ICPAdapter) VerifyBlockHeader

func (a *ICPAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*ICPAdapter) VerifyEvent

func (a *ICPAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*ICPAdapter) VerifyMessage

func (a *ICPAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*ICPAdapter) VerifyTransaction

func (a *ICPAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type ICPBlock

type ICPBlock struct {
	Height     uint64   `json:"height"`
	Hash       [32]byte `json:"hash"`
	ParentHash [32]byte `json:"parentHash"`
	StateRoot  [32]byte `json:"stateRoot"`
	Timestamp  uint64   `json:"timestamp"`
	SubnetID   [32]byte `json:"subnetId"`
}

type ICPSubnet

type ICPSubnet struct {
	SubnetID  [32]byte   `json:"subnetId"`
	PublicKey []byte     `json:"publicKey"` // Threshold BLS
	Nodes     [][32]byte `json:"nodes"`
}

type IndexSchema

type IndexSchema struct {
	Name   string   `json:"name"`
	Fields []string `json:"fields"`
	Unique bool     `json:"unique"`
}

IndexSchema defines an index on a collection

type LightClientUpdate

type LightClientUpdate struct {
	AttestedHeader          *EthereumHeader `json:"attestedHeader"`
	NextSyncCommittee       *SyncCommittee  `json:"nextSyncCommittee,omitempty"`
	NextSyncCommitteeBranch [][32]byte      `json:"nextSyncCommitteeBranch,omitempty"`
	FinalizedHeader         *EthereumHeader `json:"finalizedHeader,omitempty"`
	FinalityBranch          [][32]byte      `json:"finalityBranch,omitempty"`
	SyncAggregate           *SyncAggregate  `json:"syncAggregate"`
	SignatureSlot           uint64          `json:"signatureSlot"`
}

LightClientUpdate represents a light client update

type MPCKeyShare

type MPCKeyShare struct {
	Index       int          `json:"index"`
	Threshold   int          `json:"threshold"`
	TotalShares int          `json:"totalShares"`
	Curve       SigningCurve `json:"curve"`
	ShareBytes  []byte       `json:"shareBytes"`
	PublicKey   []byte       `json:"publicKey"` // Corresponding public key share
	GroupKey    []byte       `json:"groupKey"`  // Group/combined public key
}

MPCKeyShare represents a threshold key share for MPC signing

type MPCSigner

type MPCSigner interface {
	// SignShare creates a signature share for the given message
	SignShare(ctx context.Context, message []byte, curve SigningCurve) ([]byte, error)

	// AggregateShares combines signature shares into a final signature
	AggregateShares(ctx context.Context, message []byte, shares [][]byte, curve SigningCurve) ([]byte, error)

	// GetPublicShare returns this signer's public share
	GetPublicShare(curve SigningCurve) []byte

	// GetGroupPublicKey returns the combined group public key
	GetGroupPublicKey(curve SigningCurve) []byte

	// DeriveChildKey derives a child key for a specific path
	DeriveChildKey(path string, curve SigningCurve) ([]byte, error)
}

MPCSigner is the interface for MPC signing operations

type MPCWallet

type MPCWallet interface {
	// GetAddress returns the wallet address for a specific chain
	GetAddress(chainID ChainID) (string, error)

	// GetPublicKey returns the public key for a specific chain
	GetPublicKey(chainID ChainID) ([]byte, error)

	// SignMessage signs a message for a specific chain using MPC
	SignMessage(ctx context.Context, chainID ChainID, message []byte) ([]byte, error)

	// SignTransaction signs a transaction for a specific chain using MPC
	SignTransaction(ctx context.Context, chainID ChainID, tx *UnsignedTransaction) (*SignedTransaction, error)

	// GetSupportedChains returns all chains this wallet can sign for
	GetSupportedChains() []ChainID

	// HasKeyForChain checks if the wallet has a key for the given chain
	HasKeyForChain(chainID ChainID) bool

	// GetChainKeySet returns the key set for a specific chain
	GetChainKeySet(chainID ChainID) (*ChainKeySet, error)
}

MPCWallet represents a multi-chain MPC wallet that can sign for any supported chain

type MoneroAdapter

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

func NewMoneroAdapter

func NewMoneroAdapter() *MoneroAdapter

func (*MoneroAdapter) ChainID

func (a *MoneroAdapter) ChainID() ChainID

func (*MoneroAdapter) ChainName

func (a *MoneroAdapter) ChainName() string

func (*MoneroAdapter) Close

func (a *MoneroAdapter) Close() error

func (*MoneroAdapter) GetBlockTime

func (a *MoneroAdapter) GetBlockTime() time.Duration

func (*MoneroAdapter) GetLatestFinalizedBlock

func (a *MoneroAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*MoneroAdapter) GetRequiredConfirmations

func (a *MoneroAdapter) GetRequiredConfirmations() uint64

func (*MoneroAdapter) GetValidatorSet

func (a *MoneroAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*MoneroAdapter) Initialize

func (a *MoneroAdapter) Initialize(config *ChainConfig) error

func (*MoneroAdapter) IsFinalized

func (a *MoneroAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*MoneroAdapter) VerificationMode

func (a *MoneroAdapter) VerificationMode() VerificationMode

func (*MoneroAdapter) VerifyBlockHeader

func (a *MoneroAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*MoneroAdapter) VerifyEvent

func (a *MoneroAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*MoneroAdapter) VerifyMessage

func (a *MoneroAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*MoneroAdapter) VerifyTransaction

func (a *MoneroAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type MoneroBlock

type MoneroBlock struct {
	Height      uint64   `json:"height"`
	Hash        [32]byte `json:"hash"`
	PrevHash    [32]byte `json:"prevHash"`
	MinerTxHash [32]byte `json:"minerTxHash"`
	Timestamp   uint64   `json:"timestamp"`
	Difficulty  uint64   `json:"difficulty"`
	Nonce       uint32   `json:"nonce"`
}

type MultiChainMPCWallet

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

MultiChainMPCWallet implements MPCWallet for multi-chain operations

func NewMultiChainMPCWallet

func NewMultiChainMPCWallet(signer MPCSigner, threshold, totalShares int) *MultiChainMPCWallet

NewMultiChainMPCWallet creates a new multi-chain MPC wallet

func (*MultiChainMPCWallet) GetAddress

func (w *MultiChainMPCWallet) GetAddress(chainID ChainID) (string, error)

GetAddress returns the wallet address for a specific chain

func (*MultiChainMPCWallet) GetChainKeySet

func (w *MultiChainMPCWallet) GetChainKeySet(chainID ChainID) (*ChainKeySet, error)

GetChainKeySet returns the key set for a specific chain

func (*MultiChainMPCWallet) GetPublicKey

func (w *MultiChainMPCWallet) GetPublicKey(chainID ChainID) ([]byte, error)

GetPublicKey returns the public key for a specific chain

func (*MultiChainMPCWallet) GetSupportedChains

func (w *MultiChainMPCWallet) GetSupportedChains() []ChainID

GetSupportedChains returns all chains this wallet can sign for

func (*MultiChainMPCWallet) HasKeyForChain

func (w *MultiChainMPCWallet) HasKeyForChain(chainID ChainID) bool

HasKeyForChain checks if the wallet has a key for the given chain

func (*MultiChainMPCWallet) InitializeChain

func (w *MultiChainMPCWallet) InitializeChain(config *ChainConfig) error

InitializeChain initializes keys for a specific chain

func (*MultiChainMPCWallet) SignMessage

func (w *MultiChainMPCWallet) SignMessage(ctx context.Context, chainID ChainID, message []byte) ([]byte, error)

SignMessage signs a message for a specific chain using MPC

func (*MultiChainMPCWallet) SignTransaction

func (w *MultiChainMPCWallet) SignTransaction(ctx context.Context, chainID ChainID, tx *UnsignedTransaction) (*SignedTransaction, error)

SignTransaction signs a transaction for a specific chain using MPC

type NEARAdapter

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

func NewNEARAdapter

func NewNEARAdapter() *NEARAdapter

func (*NEARAdapter) ChainID

func (a *NEARAdapter) ChainID() ChainID

func (*NEARAdapter) ChainName

func (a *NEARAdapter) ChainName() string

func (*NEARAdapter) Close

func (a *NEARAdapter) Close() error

func (*NEARAdapter) GetBlockTime

func (a *NEARAdapter) GetBlockTime() time.Duration

func (*NEARAdapter) GetLatestFinalizedBlock

func (a *NEARAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*NEARAdapter) GetRequiredConfirmations

func (a *NEARAdapter) GetRequiredConfirmations() uint64

func (*NEARAdapter) GetValidatorSet

func (a *NEARAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*NEARAdapter) Initialize

func (a *NEARAdapter) Initialize(config *ChainConfig) error

func (*NEARAdapter) IsFinalized

func (a *NEARAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*NEARAdapter) VerificationMode

func (a *NEARAdapter) VerificationMode() VerificationMode

func (*NEARAdapter) VerifyBlockHeader

func (a *NEARAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*NEARAdapter) VerifyEvent

func (a *NEARAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*NEARAdapter) VerifyMessage

func (a *NEARAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*NEARAdapter) VerifyTransaction

func (a *NEARAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type NEARBlock

type NEARBlock struct {
	Height      uint64   `json:"height"`
	Hash        [32]byte `json:"hash"`
	PrevHash    [32]byte `json:"prevHash"`
	EpochID     [32]byte `json:"epochId"`
	ChunksRoot  [32]byte `json:"chunksRoot"`  // Root of chunk headers
	OutcomeRoot [32]byte `json:"outcomeRoot"` // Execution outcomes
	Approvals   [][]byte `json:"approvals"`   // Doomslug endorsements
	Finalized   bool     `json:"finalized"`
}

type NEARChunkHeader

type NEARChunkHeader struct {
	ShardID       uint64   `json:"shardId"`
	ChunkHash     [32]byte `json:"chunkHash"`
	PrevBlockHash [32]byte `json:"prevBlockHash"`
	OutcomeRoot   [32]byte `json:"outcomeRoot"`
}

type NEARValidator

type NEARValidator struct {
	AccountID string   `json:"accountId"`
	PublicKey [32]byte `json:"publicKey"` // Ed25519
	Stake     uint64   `json:"stake"`
}

type OpBatch

type OpBatch struct {
	BatchID    ids.ID       `json:"batchId"`
	AppChainID ids.ID       `json:"appChainId"`
	Operations []*Operation `json:"operations"`

	// Merkle root of operations
	OpBatchRoot [32]byte `json:"opBatchRoot"`

	// State after applying batch
	StateCommitment [32]byte `json:"stateCommitment"`

	// DA reference for the batch
	DAPointer *DAPointer `json:"daPointer"`

	// Block anchoring
	BlockHeight uint64    `json:"blockHeight"`
	BlockHash   [32]byte  `json:"blockHash"`
	Timestamp   time.Time `json:"timestamp"`
}

OpBatch represents a batch of operations committed together

func (*OpBatch) Hash

func (b *OpBatch) Hash() [32]byte

Hash returns the hash of the operation batch

type OpLog

type OpLog struct {
	DocumentID     DocumentID
	Operations     []*Operation
	CurrentSeq     uint64
	CurrentVersion [32]byte
	// contains filtered or unexported fields
}

OpLog maintains the operation log for a document

func NewOpLog

func NewOpLog(docID DocumentID) *OpLog

NewOpLog creates a new operation log

func (*OpLog) Append

func (l *OpLog) Append(op *Operation) error

Append adds an operation to the log

func (*OpLog) GetBySeq

func (l *OpLog) GetBySeq(seq uint64) (*Operation, bool)

GetBySeq retrieves an operation by sequence number

func (*OpLog) GetRange

func (l *OpLog) GetRange(fromSeq, toSeq uint64) []*Operation

GetRange retrieves operations in a sequence range

type Operation

type Operation struct {
	ID           ids.ID     `json:"id"`
	DocumentID   DocumentID `json:"documentId"`
	Seq          uint64     `json:"seq"`
	PriorSeq     uint64     `json:"priorSeq"`     // For anti-replay
	PriorVersion [32]byte   `json:"priorVersion"` // Reference to prior state

	// Operation details
	OpType    CRDTOpType `json:"opType"`
	CRDTType  CRDTType   `json:"crdtType"`
	Timestamp time.Time  `json:"timestamp"`

	// Encrypted operation payload
	EncryptedOp  []byte   `json:"encryptedOp"`
	OpCommitment [32]byte `json:"opCommitment"`

	// Author info
	AuthorID  []byte `json:"authorId"`
	AuthorSig []byte `json:"authorSig"`

	// Finality
	BlockHeight uint64   `json:"blockHeight"`
	BlockHash   [32]byte `json:"blockHash"`
	TxIndex     uint32   `json:"txIndex"`
}

Operation represents a CRDT operation in the op-log

type OracleDataPoint

type OracleDataPoint struct {
	SourceChain ChainID  `json:"sourceChain"`
	FeedID      [32]byte `json:"feedId"`
	Value       []byte   `json:"value"` // Big-endian encoded value
	Decimals    uint8    `json:"decimals"`
	Timestamp   int64    `json:"timestamp"`
	BlockNumber uint64   `json:"blockNumber"`

	// Source proof
	SourceProof []byte `json:"sourceProof"`

	// Aggregation metadata
	SourceCount uint32 `json:"sourceCount"`
	Confidence  uint32 `json:"confidence"` // 0-10000 (basis points)
}

OracleDataPoint represents a price/data point from an oracle source

type ParachainAdapter

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

func NewParachainAdapter

func NewParachainAdapter(chainID ChainID, name string, paraID uint32, blockTime time.Duration) *ParachainAdapter

func (*ParachainAdapter) ChainID

func (a *ParachainAdapter) ChainID() ChainID

func (*ParachainAdapter) ChainName

func (a *ParachainAdapter) ChainName() string

func (*ParachainAdapter) Close

func (a *ParachainAdapter) Close() error

func (*ParachainAdapter) GetBlockTime

func (a *ParachainAdapter) GetBlockTime() time.Duration

func (*ParachainAdapter) GetLatestFinalizedBlock

func (a *ParachainAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*ParachainAdapter) GetRequiredConfirmations

func (a *ParachainAdapter) GetRequiredConfirmations() uint64

func (*ParachainAdapter) GetValidatorSet

func (a *ParachainAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*ParachainAdapter) Initialize

func (a *ParachainAdapter) Initialize(config *ChainConfig) error

func (*ParachainAdapter) IsFinalized

func (a *ParachainAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*ParachainAdapter) VerificationMode

func (a *ParachainAdapter) VerificationMode() VerificationMode

func (*ParachainAdapter) VerifyBlockHeader

func (a *ParachainAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*ParachainAdapter) VerifyEvent

func (a *ParachainAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*ParachainAdapter) VerifyMessage

func (a *ParachainAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*ParachainAdapter) VerifyTransaction

func (a *ParachainAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type PolkadotAdapter

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

PolkadotAdapter implements GRANDPA/BEEFY verification for Polkadot

func NewPolkadotAdapter

func NewPolkadotAdapter() *PolkadotAdapter

func (*PolkadotAdapter) ChainID

func (a *PolkadotAdapter) ChainID() ChainID

func (*PolkadotAdapter) ChainName

func (a *PolkadotAdapter) ChainName() string

func (*PolkadotAdapter) Close

func (a *PolkadotAdapter) Close() error

func (*PolkadotAdapter) GetBlockTime

func (a *PolkadotAdapter) GetBlockTime() time.Duration

func (*PolkadotAdapter) GetLatestFinalizedBlock

func (a *PolkadotAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*PolkadotAdapter) GetRequiredConfirmations

func (a *PolkadotAdapter) GetRequiredConfirmations() uint64

func (*PolkadotAdapter) GetValidatorSet

func (a *PolkadotAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*PolkadotAdapter) Initialize

func (a *PolkadotAdapter) Initialize(config *ChainConfig) error

func (*PolkadotAdapter) IsFinalized

func (a *PolkadotAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*PolkadotAdapter) VerificationMode

func (a *PolkadotAdapter) VerificationMode() VerificationMode

func (*PolkadotAdapter) VerifyBlockHeader

func (a *PolkadotAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*PolkadotAdapter) VerifyEvent

func (a *PolkadotAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*PolkadotAdapter) VerifyMessage

func (a *PolkadotAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*PolkadotAdapter) VerifyTransaction

func (a *PolkadotAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type PolkadotAuthority

type PolkadotAuthority struct {
	PublicKey [32]byte `json:"publicKey"` // Ed25519
	Weight    uint64   `json:"weight"`
}

type PolkadotHeader

type PolkadotHeader struct {
	BlockNumber    uint64   `json:"blockNumber"`
	ParentHash     [32]byte `json:"parentHash"`
	StateRoot      [32]byte `json:"stateRoot"`
	ExtrinsicsRoot [32]byte `json:"extrinsicsRoot"`
	Hash           [32]byte `json:"hash"`
	Finalized      bool     `json:"finalized"`
}

type PolygonAdapter

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

func NewPolygonAdapter

func NewPolygonAdapter() *PolygonAdapter

func (*PolygonAdapter) ChainID

func (a *PolygonAdapter) ChainID() ChainID

func (*PolygonAdapter) ChainName

func (a *PolygonAdapter) ChainName() string

func (*PolygonAdapter) Close

func (a *PolygonAdapter) Close() error

func (*PolygonAdapter) GetBlockTime

func (a *PolygonAdapter) GetBlockTime() time.Duration

func (*PolygonAdapter) GetLatestFinalizedBlock

func (a *PolygonAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*PolygonAdapter) GetRequiredConfirmations

func (a *PolygonAdapter) GetRequiredConfirmations() uint64

func (*PolygonAdapter) GetValidatorSet

func (a *PolygonAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*PolygonAdapter) Initialize

func (a *PolygonAdapter) Initialize(config *ChainConfig) error

func (*PolygonAdapter) IsFinalized

func (a *PolygonAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*PolygonAdapter) VerificationMode

func (a *PolygonAdapter) VerificationMode() VerificationMode

func (*PolygonAdapter) VerifyBlockHeader

func (a *PolygonAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*PolygonAdapter) VerifyEvent

func (a *PolygonAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*PolygonAdapter) VerifyMessage

func (a *PolygonAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*PolygonAdapter) VerifyTransaction

func (a *PolygonAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type Registry

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

Registry manages chain adapters

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new chain adapter registry

func (*Registry) Close

func (r *Registry) Close() error

Close closes all adapters

func (*Registry) Get

func (r *Registry) Get(chainID ChainID) (ChainAdapter, error)

Get returns an adapter for the given chain

func (*Registry) GetConfig

func (r *Registry) GetConfig(chainID ChainID) (*ChainConfig, error)

GetConfig returns the config for a chain

func (*Registry) GetMetrics

func (r *Registry) GetMetrics(chainID ChainID) (*ChainMetrics, error)

GetMetrics returns metrics for a chain

func (*Registry) List

func (r *Registry) List() []ChainID

List returns all registered chain IDs

func (*Registry) Register

func (r *Registry) Register(adapter ChainAdapter, config *ChainConfig) error

Register registers a chain adapter

func (*Registry) Unregister

func (r *Registry) Unregister(chainID ChainID) error

Unregister removes a chain adapter

func (*Registry) VerifyMessage

func (r *Registry) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

VerifyMessage verifies a cross-chain message

type RippleAdapter

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

func NewRippleAdapter

func NewRippleAdapter() *RippleAdapter

func (*RippleAdapter) ChainID

func (a *RippleAdapter) ChainID() ChainID

func (*RippleAdapter) ChainName

func (a *RippleAdapter) ChainName() string

func (*RippleAdapter) Close

func (a *RippleAdapter) Close() error

func (*RippleAdapter) GetBlockTime

func (a *RippleAdapter) GetBlockTime() time.Duration

func (*RippleAdapter) GetLatestFinalizedBlock

func (a *RippleAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*RippleAdapter) GetRequiredConfirmations

func (a *RippleAdapter) GetRequiredConfirmations() uint64

func (*RippleAdapter) GetValidatorSet

func (a *RippleAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*RippleAdapter) Initialize

func (a *RippleAdapter) Initialize(config *ChainConfig) error

func (*RippleAdapter) IsFinalized

func (a *RippleAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*RippleAdapter) VerificationMode

func (a *RippleAdapter) VerificationMode() VerificationMode

func (*RippleAdapter) VerifyBlockHeader

func (a *RippleAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*RippleAdapter) VerifyEvent

func (a *RippleAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*RippleAdapter) VerifyMessage

func (a *RippleAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*RippleAdapter) VerifyTransaction

func (a *RippleAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type SQLiteMaterializer

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

SQLiteMaterializer materializes CRDT state to SQLite

func NewSQLiteMaterializer

func NewSQLiteMaterializer(dbPath string, appChainID ids.ID, encryptor Encryptor) (*SQLiteMaterializer, error)

NewSQLiteMaterializer creates a new SQLite materializer

func (*SQLiteMaterializer) Close

func (m *SQLiteMaterializer) Close() error

Close closes the materializer

func (*SQLiteMaterializer) CreateCollection

func (m *SQLiteMaterializer) CreateCollection(ctx context.Context, schema *CollectionSchema) error

CreateCollection creates a new collection with schema

func (*SQLiteMaterializer) GetDocument

func (m *SQLiteMaterializer) GetDocument(ctx context.Context, docID DocumentID) (*Document, error)

GetDocument retrieves a document from local state

func (*SQLiteMaterializer) Materialize

func (m *SQLiteMaterializer) Materialize(ctx context.Context, ops []*Operation) error

Materialize applies operations to local SQLite state

func (*SQLiteMaterializer) Query

func (m *SQLiteMaterializer) Query(ctx context.Context, sqlQuery string, params []interface{}) ([]map[string]interface{}, error)

Query executes a SQL query against materialized state

func (*SQLiteMaterializer) Restore

func (m *SQLiteMaterializer) Restore(ctx context.Context, snapshot *StateSnapshot) error

Restore restores from a snapshot

func (*SQLiteMaterializer) Snapshot

func (m *SQLiteMaterializer) Snapshot(ctx context.Context) (*StateSnapshot, error)

Snapshot creates a snapshot of current state

type SamplingProof

type SamplingProof struct {
	BlobID        [32]byte   `json:"blobId"`
	SampleIndices []uint32   `json:"sampleIndices"`
	Samples       [][]byte   `json:"samples"`
	Proofs        [][][]byte `json:"proofs"` // Merkle proofs for each sample
	Timestamp     time.Time  `json:"timestamp"`
	Validator     []byte     `json:"validator"`
	Signature     []byte     `json:"signature"`
}

SamplingProof proves data availability through random sampling

func (*SamplingProof) Verify

func (p *SamplingProof) Verify(blobCommitment [32]byte) error

Verify verifies the sampling proof

type SignedBridgeTransfer

type SignedBridgeTransfer struct {
	Transfer      *BridgeTransfer    `json:"transfer"`
	SignedTx      *SignedTransaction `json:"signedTx"`
	BridgeAddress string             `json:"bridgeAddress"`
}

SignedBridgeTransfer represents a signed bridge transfer

type SignedTransaction

type SignedTransaction struct {
	ChainID       ChainID  `json:"chainId"`
	TxHash        [32]byte `json:"txHash"`
	Signature     []byte   `json:"signature"`
	SignedTxBytes []byte   `json:"signedTxBytes"` // Complete signed transaction
	SignerAddress string   `json:"signerAddress"`
}

SignedTransaction represents a signed transaction

type SigningCurve

type SigningCurve string

SigningCurve represents the elliptic curve used for signing

const (
	// CurveSecp256k1 is used by Bitcoin, Ethereum, and most EVM chains
	CurveSecp256k1 SigningCurve = "secp256k1"
	// CurveEd25519 is used by Solana, NEAR, Cardano, Polkadot, etc.
	CurveEd25519 SigningCurve = "ed25519"
	// CurveSr25519 is used by Polkadot/Substrate (Schnorr)
	CurveSr25519 SigningCurve = "sr25519"
	// CurveBLS12381 is used for BLS signatures (Ethereum 2.0, aggregation)
	CurveBLS12381 SigningCurve = "bls12381"
	// CurveRistretto is used by some privacy chains
	CurveRistretto SigningCurve = "ristretto255"
)

func GetSigningCurve

func GetSigningCurve(chainType ChainType) SigningCurve

GetSigningCurve returns the signing curve for a chain type

type SolanaAdapter

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

SolanaAdapter implements vote attestation verification for Solana

func NewSolanaAdapter

func NewSolanaAdapter() *SolanaAdapter

NewSolanaAdapter creates a new Solana vote attestation adapter

func (*SolanaAdapter) ChainID

func (a *SolanaAdapter) ChainID() ChainID

ChainID returns the Solana chain ID

func (*SolanaAdapter) ChainName

func (a *SolanaAdapter) ChainName() string

ChainName returns "Solana"

func (*SolanaAdapter) Close

func (a *SolanaAdapter) Close() error

Close closes the adapter

func (*SolanaAdapter) GetBlockTime

func (a *SolanaAdapter) GetBlockTime() time.Duration

GetBlockTime returns Solana slot duration

func (*SolanaAdapter) GetLatestFinalizedBlock

func (a *SolanaAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

GetLatestFinalizedBlock returns the latest finalized slot

func (*SolanaAdapter) GetRequiredConfirmations

func (a *SolanaAdapter) GetRequiredConfirmations() uint64

GetRequiredConfirmations returns required confirmations

func (*SolanaAdapter) GetValidatorSet

func (a *SolanaAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

GetValidatorSet returns the current validator set

func (*SolanaAdapter) Initialize

func (a *SolanaAdapter) Initialize(config *ChainConfig) error

Initialize initializes the adapter

func (*SolanaAdapter) IsFinalized

func (a *SolanaAdapter) IsFinalized(ctx context.Context, slot uint64) (bool, error)

IsFinalized checks if a slot is finalized

func (*SolanaAdapter) ProcessVoteAttestation

func (a *SolanaAdapter) ProcessVoteAttestation(attestation *SolanaVoteAttestation) error

ProcessVoteAttestation processes a vote attestation for a slot

func (*SolanaAdapter) UpdateValidatorSet

func (a *SolanaAdapter) UpdateValidatorSet(validators []*SolanaValidator, epoch uint64) error

UpdateValidatorSet updates the validator set for an epoch

func (*SolanaAdapter) VerificationMode

func (a *SolanaAdapter) VerificationMode() VerificationMode

VerificationMode returns ModeVoteAttestation

func (*SolanaAdapter) VerifyBlockHeader

func (a *SolanaAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

VerifyBlockHeader verifies a Solana slot header

func (*SolanaAdapter) VerifyEvent

func (a *SolanaAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

VerifyEvent verifies a Solana program log

func (*SolanaAdapter) VerifyMessage

func (a *SolanaAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

VerifyMessage verifies a cross-chain message from Solana

func (*SolanaAdapter) VerifyTransaction

func (a *SolanaAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

VerifyTransaction verifies a Solana transaction inclusion

type SolanaSlot

type SolanaSlot struct {
	Slot            uint64   `json:"slot"`
	ParentSlot      uint64   `json:"parentSlot"`
	Blockhash       [32]byte `json:"blockhash"`
	PreviousHash    [32]byte `json:"previousHash"`
	TransactionRoot [32]byte `json:"transactionRoot"`
	Epoch           uint64   `json:"epoch"`
	LeaderPubkey    [32]byte `json:"leaderPubkey"`

	// Vote state
	VoteCount  int    `json:"voteCount"`
	TotalStake uint64 `json:"totalStake"`
	VotedStake uint64 `json:"votedStake"`
	Finalized  bool   `json:"finalized"`
}

SolanaSlot represents a Solana slot (block)

type SolanaValidator

type SolanaValidator struct {
	Pubkey      [32]byte `json:"pubkey"`
	VoteAccount [32]byte `json:"voteAccount"`
	Stake       uint64   `json:"stake"`
	Commission  uint8    `json:"commission"`
	Activated   bool     `json:"activated"`
	LastVote    uint64   `json:"lastVote"`
}

SolanaValidator represents a Solana validator

type SolanaVote

type SolanaVote struct {
	Slot            uint64   `json:"slot"`
	Hash            [32]byte `json:"hash"`
	ValidatorPubkey [32]byte `json:"validatorPubkey"`
	Signature       [64]byte `json:"signature"`
	Timestamp       int64    `json:"timestamp"`
}

SolanaVote represents a validator vote

type SolanaVoteAttestation

type SolanaVoteAttestation struct {
	Slot       uint64        `json:"slot"`
	Blockhash  [32]byte      `json:"blockhash"`
	Votes      []*SolanaVote `json:"votes"`
	VotedStake uint64        `json:"votedStake"`
	TotalStake uint64        `json:"totalStake"`
	Finalized  bool          `json:"finalized"`
}

SolanaVoteAttestation contains aggregated votes for a slot

type StateMaterializer

type StateMaterializer interface {
	// Materialize applies operations to local state
	Materialize(ctx context.Context, ops []*Operation) error

	// Query executes a query against materialized state
	Query(ctx context.Context, sql string, params []interface{}) ([]map[string]interface{}, error)

	// GetDocument retrieves a document from local state
	GetDocument(ctx context.Context, docID DocumentID) (*Document, error)

	// Snapshot creates a snapshot of current state
	Snapshot(ctx context.Context) (*StateSnapshot, error)

	// Restore restores from a snapshot
	Restore(ctx context.Context, snapshot *StateSnapshot) error
}

StateMaterializer materializes CRDT state to local storage

type StateSnapshot

type StateSnapshot struct {
	AppChainID  ids.ID    `json:"appChainId"`
	SnapshotID  ids.ID    `json:"snapshotId"`
	StateRoot   [32]byte  `json:"stateRoot"`
	BlockHeight uint64    `json:"blockHeight"`
	Timestamp   time.Time `json:"timestamp"`

	// Snapshot data (encrypted)
	Data           []byte   `json:"data"`
	DataCommitment [32]byte `json:"dataCommitment"`

	// DA pointer for large snapshots
	DAPointer *DAPointer `json:"daPointer,omitempty"`
}

StateSnapshot represents a point-in-time snapshot

type StellarAdapter

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

func NewStellarAdapter

func NewStellarAdapter() *StellarAdapter

func (*StellarAdapter) ChainID

func (a *StellarAdapter) ChainID() ChainID

func (*StellarAdapter) ChainName

func (a *StellarAdapter) ChainName() string

func (*StellarAdapter) Close

func (a *StellarAdapter) Close() error

func (*StellarAdapter) GetBlockTime

func (a *StellarAdapter) GetBlockTime() time.Duration

func (*StellarAdapter) GetLatestFinalizedBlock

func (a *StellarAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*StellarAdapter) GetRequiredConfirmations

func (a *StellarAdapter) GetRequiredConfirmations() uint64

func (*StellarAdapter) GetValidatorSet

func (a *StellarAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*StellarAdapter) Initialize

func (a *StellarAdapter) Initialize(config *ChainConfig) error

func (*StellarAdapter) IsFinalized

func (a *StellarAdapter) IsFinalized(ctx context.Context, ledger uint64) (bool, error)

func (*StellarAdapter) VerificationMode

func (a *StellarAdapter) VerificationMode() VerificationMode

func (*StellarAdapter) VerifyBlockHeader

func (a *StellarAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*StellarAdapter) VerifyEvent

func (a *StellarAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*StellarAdapter) VerifyMessage

func (a *StellarAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*StellarAdapter) VerifyTransaction

func (a *StellarAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type StellarLedger

type StellarLedger struct {
	Sequence  uint64   `json:"sequence"`
	Hash      [32]byte `json:"hash"`
	PrevHash  [32]byte `json:"prevHash"`
	TxSetHash [32]byte `json:"txSetHash"`
	CloseTime uint64   `json:"closeTime"`
}

type StellarQuorumSet

type StellarQuorumSet struct {
	Threshold  uint32              `json:"threshold"`
	Validators [][32]byte          `json:"validators"`
	InnerSets  []*StellarQuorumSet `json:"innerSets,omitempty"`
}

type SuiAdapter

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

func NewSuiAdapter

func NewSuiAdapter() *SuiAdapter

func (*SuiAdapter) ChainID

func (a *SuiAdapter) ChainID() ChainID

func (*SuiAdapter) ChainName

func (a *SuiAdapter) ChainName() string

func (*SuiAdapter) Close

func (a *SuiAdapter) Close() error

func (*SuiAdapter) GetBlockTime

func (a *SuiAdapter) GetBlockTime() time.Duration

func (*SuiAdapter) GetLatestFinalizedBlock

func (a *SuiAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*SuiAdapter) GetRequiredConfirmations

func (a *SuiAdapter) GetRequiredConfirmations() uint64

func (*SuiAdapter) GetValidatorSet

func (a *SuiAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*SuiAdapter) Initialize

func (a *SuiAdapter) Initialize(config *ChainConfig) error

func (*SuiAdapter) IsFinalized

func (a *SuiAdapter) IsFinalized(ctx context.Context, checkpoint uint64) (bool, error)

func (*SuiAdapter) VerificationMode

func (a *SuiAdapter) VerificationMode() VerificationMode

func (*SuiAdapter) VerifyBlockHeader

func (a *SuiAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*SuiAdapter) VerifyEvent

func (a *SuiAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*SuiAdapter) VerifyMessage

func (a *SuiAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*SuiAdapter) VerifyTransaction

func (a *SuiAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type SuiCheckpoint

type SuiCheckpoint struct {
	SequenceNumber      uint64   `json:"sequenceNumber"`
	Epoch               uint64   `json:"epoch"`
	Digest              [32]byte `json:"digest"`
	PreviousDigest      [32]byte `json:"previousDigest"`
	ContentDigest       [32]byte `json:"contentDigest"`
	EpochRollingGasUsed uint64   `json:"epochRollingGasUsed"`
	TimestampMs         uint64   `json:"timestampMs"`
	ValidatorSignature  []byte   `json:"validatorSignature"` // Aggregated BLS
}

type SuiValidator

type SuiValidator struct {
	SuiAddress     [32]byte `json:"suiAddress"`
	ProtocolPubKey [96]byte `json:"protocolPubKey"` // BLS12-381
	NetworkPubKey  [32]byte `json:"networkPubKey"`
	VotingPower    uint64   `json:"votingPower"`
}

type SyncAggregate

type SyncAggregate struct {
	SyncCommitteeBits      [64]byte `json:"syncCommitteeBits"`      // 512 bits
	SyncCommitteeSignature [96]byte `json:"syncCommitteeSignature"` // BLS signature
}

SyncAggregate represents sync committee aggregate signature

type SyncCommittee

type SyncCommittee struct {
	Pubkeys         [][48]byte `json:"pubkeys"`         // 512 BLS public keys
	AggregatePubkey [48]byte   `json:"aggregatePubkey"` // Aggregate of all pubkeys
	Period          uint64     `json:"period"`          // Sync committee period
}

SyncCommittee represents an Ethereum sync committee

type TEEAttestation

type TEEAttestation struct {
	TEEType      TEEType `json:"teeType"`
	Quote        []byte  `json:"quote"` // Platform-specific quote
	QuoteVersion uint32  `json:"quoteVersion"`

	// Measurements
	MRENCLAVE       [32]byte `json:"mrenclave,omitempty"` // SGX enclave measurement
	MRSIGNER        [32]byte `json:"mrsigner,omitempty"`  // SGX signer measurement
	ProductID       uint16   `json:"productId,omitempty"`
	SecurityVersion uint16   `json:"securityVersion,omitempty"`

	// Report data (binds to computation)
	ReportData [64]byte `json:"reportData"`

	// Input/Output commitments in report
	InputCommitment  [32]byte `json:"inputCommitment"`
	OutputCommitment [32]byte `json:"outputCommitment"`
	ProgramHash      [32]byte `json:"programHash"`

	// Certification chain
	CertChain [][]byte `json:"certChain"`

	// Timestamp
	Timestamp time.Time `json:"timestamp"`
	Expiry    time.Time `json:"expiry"`
}

TEEAttestation contains attestation evidence from a TEE

func (*TEEAttestation) Verify

func (a *TEEAttestation) Verify() error

Verify verifies the TEE attestation

type TEEType

type TEEType uint8

TEEType defines the type of Trusted Execution Environment

const (
	// TEEIntelSGX is Intel SGX
	TEEIntelSGX TEEType = iota
	// TEEAMDSev is AMD SEV
	TEEAMDSev
	// TEENvidiaCC is NVIDIA Confidential Computing
	TEENvidiaCC
	// TEEArmTrustZone is ARM TrustZone
	TEEArmTrustZone
	// TEEAWSNitro is AWS Nitro Enclaves
	TEEAWSNitro
	// TEEAzureSGX is Azure Confidential Computing (SGX)
	TEEAzureSGX
)

func (TEEType) String

func (t TEEType) String() string

String returns the string representation of TEEType

type TONAdapter

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

func NewTONAdapter

func NewTONAdapter() *TONAdapter

func (*TONAdapter) ChainID

func (a *TONAdapter) ChainID() ChainID

func (*TONAdapter) ChainName

func (a *TONAdapter) ChainName() string

func (*TONAdapter) Close

func (a *TONAdapter) Close() error

func (*TONAdapter) GetBlockTime

func (a *TONAdapter) GetBlockTime() time.Duration

func (*TONAdapter) GetLatestFinalizedBlock

func (a *TONAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*TONAdapter) GetRequiredConfirmations

func (a *TONAdapter) GetRequiredConfirmations() uint64

func (*TONAdapter) GetValidatorSet

func (a *TONAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*TONAdapter) Initialize

func (a *TONAdapter) Initialize(config *ChainConfig) error

func (*TONAdapter) IsFinalized

func (a *TONAdapter) IsFinalized(ctx context.Context, seqno uint64) (bool, error)

func (*TONAdapter) VerificationMode

func (a *TONAdapter) VerificationMode() VerificationMode

func (*TONAdapter) VerifyBlockHeader

func (a *TONAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*TONAdapter) VerifyEvent

func (a *TONAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*TONAdapter) VerifyMessage

func (a *TONAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*TONAdapter) VerifyTransaction

func (a *TONAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type TONBlock

type TONBlock struct {
	Workchain     int32    `json:"workchain"`
	Shard         int64    `json:"shard"`
	Seqno         uint64   `json:"seqno"`
	RootHash      [32]byte `json:"rootHash"`
	FileHash      [32]byte `json:"fileHash"`
	GenUtime      uint32   `json:"genUtime"`
	StartLt       uint64   `json:"startLt"`
	EndLt         uint64   `json:"endLt"`
	ValidatorSet  uint32   `json:"validatorSet"` // CC seqno
	CatchainSeqno uint32   `json:"catchainSeqno"`
	Signatures    [][]byte `json:"signatures"`
}

type TONValidator

type TONValidator struct {
	PublicKey [32]byte `json:"publicKey"` // Ed25519
	Weight    uint64   `json:"weight"`
	ADNLAddr  [32]byte `json:"adnlAddr"`
}

type TRONAdapter

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

func NewTRONAdapter

func NewTRONAdapter() *TRONAdapter

func (*TRONAdapter) ChainID

func (a *TRONAdapter) ChainID() ChainID

func (*TRONAdapter) ChainName

func (a *TRONAdapter) ChainName() string

func (*TRONAdapter) Close

func (a *TRONAdapter) Close() error

func (*TRONAdapter) GetBlockTime

func (a *TRONAdapter) GetBlockTime() time.Duration

func (*TRONAdapter) GetLatestFinalizedBlock

func (a *TRONAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*TRONAdapter) GetRequiredConfirmations

func (a *TRONAdapter) GetRequiredConfirmations() uint64

func (*TRONAdapter) GetValidatorSet

func (a *TRONAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*TRONAdapter) Initialize

func (a *TRONAdapter) Initialize(config *ChainConfig) error

func (*TRONAdapter) IsFinalized

func (a *TRONAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*TRONAdapter) VerificationMode

func (a *TRONAdapter) VerificationMode() VerificationMode

func (*TRONAdapter) VerifyBlockHeader

func (a *TRONAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*TRONAdapter) VerifyEvent

func (a *TRONAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*TRONAdapter) VerifyMessage

func (a *TRONAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*TRONAdapter) VerifyTransaction

func (a *TRONAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type TRONBlock

type TRONBlock struct {
	Number         uint64   `json:"number"`
	Hash           [32]byte `json:"hash"`
	ParentHash     [32]byte `json:"parentHash"`
	TxTrieRoot     [32]byte `json:"txTrieRoot"`
	WitnessAddress [20]byte `json:"witnessAddress"` // SR that produced block
	Timestamp      uint64   `json:"timestamp"`
	Signature      []byte   `json:"signature"`
}

type TRONSuperRep

type TRONSuperRep struct {
	Address   [20]byte `json:"address"`
	PublicKey []byte   `json:"publicKey"`
	VoteCount uint64   `json:"voteCount"`
	URL       string   `json:"url"`
}

type TendermintCommit

type TendermintCommit struct {
	Height     uint64            `json:"height"`
	Round      int32             `json:"round"`
	BlockHash  [32]byte          `json:"blockHash"`
	Signatures []*TendermintVote `json:"signatures"`
}

TendermintCommit represents commit signatures

type TendermintValidator

type TendermintValidator struct {
	Address     [20]byte `json:"address"`
	PubKey      []byte   `json:"pubKey"`     // Ed25519 or Secp256k1
	PubKeyType  string   `json:"pubKeyType"` // "ed25519" or "secp256k1"
	VotingPower int64    `json:"votingPower"`
}

TendermintValidator represents a single validator

type TendermintValidatorSet

type TendermintValidatorSet struct {
	Validators []*TendermintValidator `json:"validators"`
	TotalPower int64                  `json:"totalPower"`
	Height     uint64                 `json:"height"`
}

TendermintValidatorSet represents Tendermint validator set

type TendermintVote

type TendermintVote struct {
	ValidatorAddress [20]byte `json:"validatorAddress"`
	Timestamp        int64    `json:"timestamp"`
	Signature        []byte   `json:"signature"` // 64 bytes for Ed25519
	Absent           bool     `json:"absent"`
}

TendermintVote represents a validator vote

type TezosAdapter

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

func NewTezosAdapter

func NewTezosAdapter() *TezosAdapter

func (*TezosAdapter) ChainID

func (a *TezosAdapter) ChainID() ChainID

func (*TezosAdapter) ChainName

func (a *TezosAdapter) ChainName() string

func (*TezosAdapter) Close

func (a *TezosAdapter) Close() error

func (*TezosAdapter) GetBlockTime

func (a *TezosAdapter) GetBlockTime() time.Duration

func (*TezosAdapter) GetLatestFinalizedBlock

func (a *TezosAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*TezosAdapter) GetRequiredConfirmations

func (a *TezosAdapter) GetRequiredConfirmations() uint64

func (*TezosAdapter) GetValidatorSet

func (a *TezosAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*TezosAdapter) Initialize

func (a *TezosAdapter) Initialize(config *ChainConfig) error

func (*TezosAdapter) IsFinalized

func (a *TezosAdapter) IsFinalized(ctx context.Context, level uint64) (bool, error)

func (*TezosAdapter) VerificationMode

func (a *TezosAdapter) VerificationMode() VerificationMode

func (*TezosAdapter) VerifyBlockHeader

func (a *TezosAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*TezosAdapter) VerifyEvent

func (a *TezosAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*TezosAdapter) VerifyMessage

func (a *TezosAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*TezosAdapter) VerifyTransaction

func (a *TezosAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

type TezosBaker

type TezosBaker struct {
	Address        string `json:"address"`
	Balance        uint64 `json:"balance"`
	StakingBalance uint64 `json:"stakingBalance"`
}

type TezosBlock

type TezosBlock struct {
	Level       uint64   `json:"level"`
	Hash        [32]byte `json:"hash"`
	Predecessor [32]byte `json:"predecessor"`
	Timestamp   uint64   `json:"timestamp"`
	Baker       string   `json:"baker"`
	Priority    int      `json:"priority"`
}

type ThresholdKeySet

type ThresholdKeySet struct {
	ID          string   `json:"id"`
	Threshold   int      `json:"threshold"`
	TotalShares int      `json:"totalShares"`
	PublicKey   []byte   `json:"publicKey"`
	Shares      [][]byte `json:"shares,omitempty"` // Only shares this party holds
}

ThresholdKeySet holds keys for threshold/MPC access

type TxInclusionProof

type TxInclusionProof struct {
	ChainID     ChainID  `json:"chainId"`
	BlockNumber uint64   `json:"blockNumber"`
	BlockHash   [32]byte `json:"blockHash"`
	TxHash      [32]byte `json:"txHash"`
	TxIndex     uint32   `json:"txIndex"`

	// Merkle proof path
	MerkleProof [][]byte `json:"merkleProof"`

	// Transaction data (may be nil if only proving inclusion)
	TxData []byte `json:"txData,omitempty"`
}

TxInclusionProof proves a transaction was included in a block

type UnsignedTransaction

type UnsignedTransaction struct {
	ChainID  ChainID `json:"chainId"`
	Nonce    uint64  `json:"nonce"`
	To       []byte  `json:"to"`
	Value    []byte  `json:"value"` // Big-endian encoded
	Data     []byte  `json:"data"`
	GasLimit uint64  `json:"gasLimit"`
	GasPrice []byte  `json:"gasPrice"` // Big-endian encoded

	// EVM-specific fields
	MaxFeePerGas         []byte `json:"maxFeePerGas,omitempty"`
	MaxPriorityFeePerGas []byte `json:"maxPriorityFeePerGas,omitempty"`
	AccessList           []byte `json:"accessList,omitempty"`

	// Chain-specific raw transaction bytes
	RawTxBytes []byte `json:"rawTxBytes,omitempty"`
}

UnsignedTransaction represents a transaction to be signed

type Validator

type Validator struct {
	Address     []byte `json:"address"`
	PublicKey   []byte `json:"publicKey"`
	Stake       uint64 `json:"stake"`
	VotingPower uint64 `json:"votingPower"`
}

Validator represents a single validator

type ValidatorSet

type ValidatorSet struct {
	ChainID    ChainID      `json:"chainId"`
	Epoch      uint64       `json:"epoch"`
	Validators []*Validator `json:"validators"`
	TotalStake uint64       `json:"totalStake"`
	Threshold  uint64       `json:"threshold"` // 2/3 stake required for finality
	ValidFrom  uint64       `json:"validFrom"` // Block number this set is valid from
	ValidUntil uint64       `json:"validUntil"`
}

ValidatorSet represents a validator set for PoS chains

type VerificationMode

type VerificationMode uint8

VerificationMode indicates how chain data is verified

const (
	// ModeSPV uses Simple Payment Verification (Bitcoin-style PoW)
	ModeSPV VerificationMode = iota
	// ModeLightClient uses light client proofs (Ethereum sync committee, IBC)
	ModeLightClient
	// ModeVoteAttestation uses validator vote attestations (Solana)
	ModeVoteAttestation
	// ModeZKProof uses ZK validity proofs (zkSync, Starknet, Scroll)
	ModeZKProof
	// ModeThresholdCert uses threshold certificate attestations (XRPL, Axelar)
	ModeThresholdCert
	// ModeBFT uses BFT consensus signatures (Tendermint, HotStuff, pBFT)
	ModeBFT
	// ModeDAG uses DAG-based consensus (IOTA, Kaspa, Hedera Hashgraph)
	ModeDAG
	// ModeDPoS uses Delegated Proof of Stake (EOS, TRON, Lisk)
	ModeDPoS
	// ModePoA uses Proof of Authority (Ronin, VeChain, private chains)
	ModePoA
	// ModeOptimistic uses optimistic rollup fraud proofs (Arbitrum, Optimism)
	ModeOptimistic
	// ModeSCP uses Stellar Consensus Protocol (Stellar)
	ModeSCP
	// ModePBA uses Pure Byzantine Agreement (Algorand)
	ModePBA
	// ModeChainKey uses Chain Key cryptography (Internet Computer)
	ModeChainKey
	// ModeRingCT uses Ring Confidential Transactions (Monero privacy proofs)
	ModeRingCT
	// ModeGRANDPA uses GRANDPA finality (Polkadot parachains)
	ModeGRANDPA
)

type XRPLedger

type XRPLedger struct {
	LedgerIndex uint64   `json:"ledgerIndex"`
	LedgerHash  [32]byte `json:"ledgerHash"`
	ParentHash  [32]byte `json:"parentHash"`
	AccountHash [32]byte `json:"accountHash"`
	TxHash      [32]byte `json:"txHash"`
	CloseTime   uint64   `json:"closeTime"`
	Validated   bool     `json:"validated"`
}

type XRPValidator

type XRPValidator struct {
	PublicKey [33]byte `json:"publicKey"` // Secp256k1
	Domain    string   `json:"domain"`
}

type ZKBatch

type ZKBatch struct {
	BatchNumber   uint64   `json:"batchNumber"`
	L1BlockNumber uint64   `json:"l1BlockNumber"`
	StateRoot     [32]byte `json:"stateRoot"`
	TxRoot        [32]byte `json:"txRoot"`
	ProofHash     [32]byte `json:"proofHash"`
	Verified      bool     `json:"verified"`
}

type ZKRollupAdapter

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

func NewZKRollupAdapter

func NewZKRollupAdapter(chainID ChainID, name string, evmID uint64, proofSystem string) *ZKRollupAdapter

func (*ZKRollupAdapter) ChainID

func (a *ZKRollupAdapter) ChainID() ChainID

func (*ZKRollupAdapter) ChainName

func (a *ZKRollupAdapter) ChainName() string

func (*ZKRollupAdapter) Close

func (a *ZKRollupAdapter) Close() error

func (*ZKRollupAdapter) EVMChainID

func (a *ZKRollupAdapter) EVMChainID() uint64

func (*ZKRollupAdapter) GetBlockTime

func (a *ZKRollupAdapter) GetBlockTime() time.Duration

func (*ZKRollupAdapter) GetLatestFinalizedBlock

func (a *ZKRollupAdapter) GetLatestFinalizedBlock(ctx context.Context) (uint64, error)

func (*ZKRollupAdapter) GetRequiredConfirmations

func (a *ZKRollupAdapter) GetRequiredConfirmations() uint64

func (*ZKRollupAdapter) GetValidatorSet

func (a *ZKRollupAdapter) GetValidatorSet(ctx context.Context) (*ValidatorSet, error)

func (*ZKRollupAdapter) Initialize

func (a *ZKRollupAdapter) Initialize(config *ChainConfig) error

func (*ZKRollupAdapter) IsFinalized

func (a *ZKRollupAdapter) IsFinalized(ctx context.Context, block uint64) (bool, error)

func (*ZKRollupAdapter) VerificationMode

func (a *ZKRollupAdapter) VerificationMode() VerificationMode

func (*ZKRollupAdapter) VerifyBlockHeader

func (a *ZKRollupAdapter) VerifyBlockHeader(ctx context.Context, header *BlockHeader) error

func (*ZKRollupAdapter) VerifyEvent

func (a *ZKRollupAdapter) VerifyEvent(ctx context.Context, event *ChainEvent) error

func (*ZKRollupAdapter) VerifyMessage

func (a *ZKRollupAdapter) VerifyMessage(ctx context.Context, msg *CrossChainMessage) error

func (*ZKRollupAdapter) VerifyTransaction

func (a *ZKRollupAdapter) VerifyTransaction(ctx context.Context, proof *TxInclusionProof) error

Directories

Path Synopsis
Package messaging provides FHE-CRDT extensions for private messaging.
Package messaging provides FHE-CRDT extensions for private messaging.

Jump to

Keyboard shortcuts

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