Documentation
¶
Overview ¶
Package tchain provides T-Chain (Teleport) adapter for DAG indexing. T-Chain handles MPC threshold signatures for cross-chain teleportation.
Index ¶
- Constants
- func ComputeThreshold(totalShares uint32) uint32
- func DefaultConfig() dag.Config
- func ValidateSignature(_, _, _ string) (bool, error)
- type Adapter
- func (a *Adapter) GetActiveKeyShares(ctx context.Context, publicKey string) ([]KeyShare, error)
- func (a *Adapter) GetKeyGeneration(ctx context.Context, keyGenID string) (*KeyGeneration, error)
- func (a *Adapter) GetRecentVertices(ctx context.Context, limit int) ([]json.RawMessage, error)
- func (a *Adapter) GetSigningSession(ctx context.Context, sessionID string) (*SigningSession, error)
- func (a *Adapter) GetStats(ctx context.Context, store storage.Store) (map[string]interface{}, error)
- func (a *Adapter) GetVertexByID(ctx context.Context, id string) (json.RawMessage, error)
- func (a *Adapter) InitSchema(ctx context.Context, store storage.Store) error
- func (a *Adapter) ParseVertex(data json.RawMessage) (*dag.Vertex, error)
- func (a *Adapter) StoreKeyGeneration(ctx context.Context, store storage.Store, kg *KeyGeneration) error
- func (a *Adapter) StoreKeyShare(ctx context.Context, store storage.Store, k *KeyShare) error
- func (a *Adapter) StoreMessage(ctx context.Context, store storage.Store, m *TeleportMessage) error
- func (a *Adapter) StoreSession(ctx context.Context, store storage.Store, s *SigningSession) error
- type KeyGeneration
- type KeyShare
- type KeyShareStatus
- type SessionStatus
- type SigningSession
- type TeleportMessage
- type VertexData
Constants ¶
const ( // DefaultRPCEndpoint for T-Chain on port 4700 DefaultRPCEndpoint = "http://localhost:9650/ext/bc/T/rpc" // DefaultHTTPPort for T-Chain indexer API DefaultHTTPPort = 4700 )
Variables ¶
This section is empty.
Functions ¶
func ComputeThreshold ¶
ComputeThreshold computes required threshold for given parameters. Uses t-of-n threshold where t = (n * 2 / 3) + 1 for Byzantine fault tolerance.
func DefaultConfig ¶
DefaultConfig returns default configuration for T-Chain indexer
func ValidateSignature ¶
ValidateSignature validates a threshold signature. Threshold signature verification requires the T-Chain node; it cannot be done client-side.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements dag.Adapter for T-Chain MPC operations
func (*Adapter) GetActiveKeyShares ¶
GetActiveKeyShares fetches active key shares for a public key
func (*Adapter) GetKeyGeneration ¶
GetKeyGeneration fetches a key generation ceremony by ID
func (*Adapter) GetRecentVertices ¶
GetRecentVertices fetches recent vertices via RPC
func (*Adapter) GetSigningSession ¶
GetSigningSession fetches a signing session by ID
func (*Adapter) GetStats ¶
func (a *Adapter) GetStats(ctx context.Context, store storage.Store) (map[string]interface{}, error)
GetStats returns T-Chain specific statistics
func (*Adapter) GetVertexByID ¶
GetVertexByID fetches a specific vertex
func (*Adapter) InitSchema ¶
InitSchema creates T-Chain specific database tables
func (*Adapter) ParseVertex ¶
ParseVertex parses T-Chain vertex from RPC response
func (*Adapter) StoreKeyGeneration ¶
func (a *Adapter) StoreKeyGeneration(ctx context.Context, store storage.Store, kg *KeyGeneration) error
StoreKeyGeneration stores a key generation ceremony
func (*Adapter) StoreKeyShare ¶
StoreKeyShare stores a key share
func (*Adapter) StoreMessage ¶
StoreMessage stores a teleport message
func (*Adapter) StoreSession ¶
StoreSession stores a signing session
type KeyGeneration ¶
type KeyGeneration struct {
ID string `json:"id"`
Threshold uint32 `json:"threshold"`
PublicKey string `json:"publicKey"` // combined public key
Participants []string `json:"participants"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
}
KeyGeneration represents a distributed key generation ceremony
type KeyShareStatus ¶
type KeyShareStatus string
KeyShareStatus for distributed key shares
const ( )
type SessionStatus ¶
type SessionStatus string
SessionStatus for MPC signing sessions
const ( SessionPending SessionStatus = "pending" SessionActive SessionStatus = "active" SessionCompleted SessionStatus = "completed" SessionFailed SessionStatus = "failed" SessionExpired SessionStatus = "expired" )
type SigningSession ¶
type SigningSession struct {
ID string `json:"id"`
Threshold uint32 `json:"threshold"` // t of n threshold
MessageHash string `json:"messageHash"` // hash being signed
Participants []string `json:"participants"` // node IDs participating
Signatures []string `json:"signatures"` // partial signatures collected
FinalSig string `json:"finalSig,omitempty"` // combined signature
Status SessionStatus `json:"status"`
CreatedAt time.Time `json:"createdAt"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
ExpiresAt time.Time `json:"expiresAt"`
SourceChain string `json:"sourceChain,omitempty"`
DestChain string `json:"destChain,omitempty"`
}
SigningSession represents an MPC threshold signing session
type TeleportMessage ¶
type TeleportMessage struct {
ID string `json:"id"`
SourceChain string `json:"sourceChain"`
DestChain string `json:"destChain"`
Sender string `json:"sender"`
Receiver string `json:"receiver"`
Payload json.RawMessage `json:"payload"`
Nonce uint64 `json:"nonce"`
SessionID string `json:"sessionId,omitempty"`
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
SignedAt *time.Time `json:"signedAt,omitempty"`
DeliveredAt *time.Time `json:"deliveredAt,omitempty"`
}
TeleportMessage represents a cross-chain teleport message
type VertexData ¶
type VertexData struct {
Session *SigningSession `json:"session,omitempty"`
KeyGen *KeyGeneration `json:"keyGen,omitempty"`
Message *TeleportMessage `json:"message,omitempty"`
}
VertexData contains T-Chain specific vertex data