slidechain

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnastosProcessor

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

AnastosProcessor implements the core geometric transformation logic

func (*AnastosProcessor) ChainPolygon

func (ap *AnastosProcessor) ChainPolygon(prevPolygon []GeometricCoordinate, newAngles []float64, timeStep int) []GeometricCoordinate

ChainPolygon creates a new polygon anchored to the previous one

func (*AnastosProcessor) ComputeSpanoRoot

func (ap *AnastosProcessor) ComputeSpanoRoot(allCoordinates []GeometricCoordinate) ids.ID

ComputeSpanoRoot calculates the cumulative hash from all coordinates

func (*AnastosProcessor) ConstructPolygon

func (ap *AnastosProcessor) ConstructPolygon(angles []float64) []GeometricCoordinate

ConstructPolygon creates a 2D polygon from the calculated angles

func (*AnastosProcessor) ConvertHashesToAngles

func (ap *AnastosProcessor) ConvertHashesToAngles(hashValues [][]byte) []float64

ConvertHashesToAngles converts hash values to polygon angles

type BitcoinAnchor

type BitcoinAnchor struct {
	BitcoinRPCEndpoint string
	MultisigWallet     string
	QuorumThreshold    int
	AnchorInterval     int // Every N blocks
}

BitcoinAnchor handles the cross-chain anchoring to Bitcoin

func (*BitcoinAnchor) AnchorToBitcoin

func (ba *BitcoinAnchor) AnchorToBitcoin(blockHash ids.ID) (*BitcoinAnchorData, error)

AnchorToBitcoin records the current SlideChain state to Bitcoin

type BitcoinAnchorData

type BitcoinAnchorData struct {
	BlockHash     string    `json:"blockHash"`
	BlockHeight   uint64    `json:"blockHeight"`
	TransactionID string    `json:"transactionID"`
	AnchoredAt    time.Time `json:"anchoredAt"`
}

BitcoinAnchorData stores information about Bitcoin anchoring

type BitcoinAnchorManager

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

BitcoinAnchorManager coordinates anchoring operations

func NewBitcoinAnchorManager

func NewBitcoinAnchorManager(connector *BitcoinConnector) *BitcoinAnchorManager

NewBitcoinAnchorManager creates a new manager instance

func (*BitcoinAnchorManager) AnchorHash

func (bam *BitcoinAnchorManager) AnchorHash(hash ids.ID) (*BitcoinAnchorData, error)

AnchorHash anchors a hash to Bitcoin and records the anchor data

func (*BitcoinAnchorManager) VerifyAnchor

func (bam *BitcoinAnchorManager) VerifyAnchor(hash ids.ID) (*BitcoinAnchorData, error)

VerifyAnchor verifies an anchored hash

type BitcoinConnector

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

BitcoinConnector handles interactions with the Bitcoin blockchain

func NewBitcoinConnector

func NewBitcoinConnector(configBytes []byte) (*BitcoinConnector, error)

NewBitcoinConnector creates a new connector instance

func (*BitcoinConnector) AnchorToBitcoin

func (bc *BitcoinConnector) AnchorToBitcoin(hash ids.ID) (*BitcoinAnchorData, error)

AnchorToBitcoin records a hash on the Bitcoin blockchain

func (*BitcoinConnector) Initialize

func (bc *BitcoinConnector) Initialize() error

Initialize sets up the Bitcoin client and multisig address

func (*BitcoinConnector) VerifyAnchor

func (bc *BitcoinConnector) VerifyAnchor(anchorData *BitcoinAnchorData) error

VerifyAnchor verifies that a hash was properly anchored to Bitcoin

type BitcoinConnectorConfig

type BitcoinConnectorConfig struct {
	RPCHost     string `json:"rpcHost"`
	RPCPort     int    `json:"rpcPort"`
	RPCUser     string `json:"rpcUser"`
	RPCPassword string `json:"rpcPassword"`
	UseTestnet  bool   `json:"useTestnet"`
	// Multisig wallet configuration
	RequiredSignatures int      `json:"requiredSignatures"` // M of N
	PublicKeys         []string `json:"publicKeys"`         // N public keys in hex
}

BitcoinConnectorConfig contains configuration for the Bitcoin connector

type CoordinateCircuit

type CoordinateCircuit struct {
	// Private inputs
	Coordinates [][]frontend.Variable `frontend.private`

	// Public inputs
	SpanoRootHash frontend.Variable `frontend.public`
}

CoordinateCircuit defines the circuit for ZKP generation

func (*CoordinateCircuit) Define

func (circuit *CoordinateCircuit) Define(api frontend.API) error

Define constraints

type GeometricCoordinate

type GeometricCoordinate struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"` // Z-axis represents time
}

GeometricCoordinate represents a 3D point for the geometric encoding

type Polygon

type Polygon struct {
	Vertices []GeometricCoordinate `json:"vertices"`
	TimeStep int                   `json:"timeStep"` // Position on Z-axis
}

Polygon represents a single snapshot encoded as a polygon

type QuorumSignatureCollector

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

QuorumSignatureCollector manages the signing process for Bitcoin transactions

func NewQuorumSignatureCollector

func NewQuorumSignatureCollector(required, total int) *QuorumSignatureCollector

NewQuorumSignatureCollector creates a new collector

func (*QuorumSignatureCollector) AddSignature

func (qsc *QuorumSignatureCollector) AddSignature(signerID string, signature []byte)

AddSignature adds a signature from a validator

func (*QuorumSignatureCollector) GetSignatures

func (qsc *QuorumSignatureCollector) GetSignatures() map[string][]byte

GetSignatures returns all collected signatures

func (*QuorumSignatureCollector) HasQuorum

func (qsc *QuorumSignatureCollector) HasQuorum() bool

HasQuorum checks if we have enough signatures

type SlideBlock

type SlideBlock struct {
	snowman.Block
	SpanoRoot       SpanoRoot            `json:"spanoRoot"`
	BitcoinAnchor   *BitcoinAnchorData   `json:"bitcoinAnchor,omitempty"`
	SubchainGenesis *SubchainGenesisData `json:"subchainGenesis,omitempty"`
}

SlideBlock extends the Avalanche block with SlideChain-specific data

type SlideChainManager

type SlideChainManager struct {
	Processor  *AnastosProcessor
	BTCAnchor  *BitcoinAnchor
	ChainState map[ids.ID][]GeometricCoordinate // Maps subchain ID to coord history
	// contains filtered or unexported fields
}

SlideChainManager orchestrates the overall protocol

func NewSlideChainManager

func NewSlideChainManager() *SlideChainManager

NewSlideChainManager creates a new manager instance

func (*SlideChainManager) GetLatestSpanoRoot

func (scm *SlideChainManager) GetLatestSpanoRoot(subchainID ids.ID) (SpanoRoot, error)

GetLatestSpanoRoot returns the most recent SpanoRoot for a subchain

func (*SlideChainManager) RecordSnapshot

func (scm *SlideChainManager) RecordSnapshot(subchainID ids.ID, artifactHashes [][]byte) (*SlideBlock, error)

RecordSnapshot processes a new set of artifacts and extends the chain

func (*SlideChainManager) RegisterSubchain

func (scm *SlideChainManager) RegisterSubchain(genesisBlockHash ids.ID) (*SubchainGenesisData, error)

RegisterSubchain creates a new subchain anchored to SlideChain

type SpanoRoot

type SpanoRoot struct {
	Hash        ids.ID                `json:"hash"`
	Coordinates []GeometricCoordinate `json:"coordinates,omitempty"` // Only stored locally
}

SpanoRoot represents the cumulative hash of the coordinate path

type SubchainGenesisData

type SubchainGenesisData struct {
	SubchainID       ids.ID    `json:"subchainID"`
	ParentBlockHash  ids.ID    `json:"parentBlockHash"`  // Latest SlideChain blockhash
	GenesisBlockHash ids.ID    `json:"genesisBlockHash"` // New subchain genesis block
	CombinedHash     ids.ID    `json:"combinedHash"`     // Hash of parentBlockHash + genesisBlockHash
	CreatedAt        time.Time `json:"createdAt"`
}

SubchainGenesisData stores information about a newly created subchain

type ZKPVerifier

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

ZKPVerifier handles verification of zero-knowledge proofs

func NewZKPVerifier

func NewZKPVerifier() *ZKPVerifier

NewZKPVerifier creates a new verifier instance

func (*ZKPVerifier) Initialize

func (v *ZKPVerifier) Initialize() error

Initialize sets up the verifier with the circuit parameters

func (*ZKPVerifier) VerifyProof

func (v *ZKPVerifier) VerifyProof(spanoRootHash ids.ID, proof *ZKProof) error

VerifyProof verifies a zero-knowledge proof

type ZKProof

type ZKProof struct {
	Proof       []byte `json:"proof"`       // Serialized proof
	PublicInput []byte `json:"publicInput"` // Public inputs (SpanoRoot hash)
}

ZKProof contains the proof data for verification

func GenerateProof

func GenerateProof(coordinates [][]GeometricCoordinate) (*ZKProof, error)

GenerateProof creates a zero-knowledge proof for a coordinate path

type ZKProofCoordinator

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

Create a coordinator for proof generation

func NewZKProofCoordinator

func NewZKProofCoordinator(processor *AnastosProcessor) *ZKProofCoordinator

NewZKProofCoordinator creates a new coordinator instance

func (*ZKProofCoordinator) GenerateProofForCoordinates

func (c *ZKProofCoordinator) GenerateProofForCoordinates(
	coordinates []GeometricCoordinate,
) (*ZKProof, error)

GenerateProofForCoordinates creates a ZKP for a set of coordinates

func (*ZKProofCoordinator) VerifyCoordinateProof

func (c *ZKProofCoordinator) VerifyCoordinateProof(
	spanoRootHash ids.ID,
	proof *ZKProof,
) error

VerifyCoordinateProof verifies a proof against a SpanoRoot hash

Jump to

Keyboard shortcuts

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