Documentation
¶
Index ¶
- Constants
- type Block
- func (b *Block) Accept() error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() string
- func (b *Block) Parent() ids.ID
- func (b *Block) Reject() error
- func (b *Block) Status() choices.Status
- func (b *Block) Time() uint64
- func (b *Block) Verify(ctx context.Context) error
- type Challenge
- type ChallengeStatus
- type ChallengeType
- type ChallengeUpdate
- type Factory
- type FraudProof
- type PrivacyAction
- type PrivacyActionType
- type ShieldedPool
- type VM
- func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) BuildBlock(ctx context.Context) (chain.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
- func (vm *VM) CreateHandlers(context.Context) (map[string]interface{}, error)
- func (vm *VM) CreateStaticHandlers(context.Context) (map[string]interface{}, error)
- func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *core.AppError) error
- func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (chain.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) HealthCheck(context.Context) (any, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx *core.Context, db interface{}, ...) error
- func (vm *VM) LastAccepted(context.Context) (ids.ID, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (chain.Block, error)
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state core.State) error
- func (vm *VM) Shutdown(context.Context) error
- func (vm *VM) StartChallenge(challenge *Challenge) error
- func (vm *VM) VerifyZKProof(proof *ZKProof) error
- func (vm *VM) Version(context.Context) (string, error)
- type VerifierKey
- type ZKProof
Constants ¶
const (
Name = "zkvm"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block represents a block in the ZK Chain
type Challenge ¶
type Challenge struct {
ID ids.ID `json:"id"`
Type ChallengeType `json:"type"`
TargetChain ids.ID `json:"targetChain"`
TargetBlock ids.ID `json:"targetBlock"`
TargetTx ids.ID `json:"targetTx,omitempty"`
Challenger ids.ShortID `json:"challenger"`
Defender ids.ShortID `json:"defender"`
Status ChallengeStatus `json:"status"`
CreatedAt int64 `json:"createdAt"`
ResolvedAt int64 `json:"resolvedAt,omitempty"`
Evidence []byte `json:"evidence"`
DefenderProof []byte `json:"defenderProof,omitempty"`
Resolution []byte `json:"resolution,omitempty"`
}
Challenge represents a fraud proof challenge
type ChallengeStatus ¶
type ChallengeStatus uint8
ChallengeStatus represents the status of a challenge
const ( ChallengePending ChallengeStatus = iota ChallengeActive ChallengeResolved ChallengeExpired )
type ChallengeType ¶
type ChallengeType uint8
ChallengeType represents the type of challenge
const ( ChallengeStateRoot ChallengeType = iota ChallengeTransaction ChallengeComputation )
type ChallengeUpdate ¶
type ChallengeUpdate struct {
ChallengeID ids.ID `json:"challengeId"`
NewStatus ChallengeStatus `json:"newStatus"`
DefenderProof []byte `json:"defenderProof,omitempty"`
Resolution []byte `json:"resolution,omitempty"`
}
ChallengeUpdate represents an update to a challenge
type FraudProof ¶
type FraudProof struct {
ID ids.ID `json:"id"`
StateRoot ids.ID `json:"stateRoot"`
DisputedTx ids.ID `json:"disputedTx"`
PreState []byte `json:"preState"`
PostState []byte `json:"postState"`
ExecutionTrace []byte `json:"executionTrace"`
WitnessData []byte `json:"witnessData"`
}
FraudProof represents a fraud proof for optimistic rollup
type PrivacyAction ¶
type PrivacyAction struct {
Type PrivacyActionType `json:"type"`
Commitment ethcommon.Hash `json:"commitment,omitempty"`
Nullifier ethcommon.Hash `json:"nullifier,omitempty"`
Amount uint64 `json:"amount,omitempty"`
Proof []byte `json:"proof"`
}
PrivacyAction represents a privacy-related action
type PrivacyActionType ¶
type PrivacyActionType uint8
PrivacyActionType represents the type of privacy action
const ( Shield PrivacyActionType = iota Unshield Transfer )
type ShieldedPool ¶
type ShieldedPool struct {
TotalSupply uint64 `json:"totalSupply"`
Notes map[ethcommon.Hash]bool `json:"notes"`
Commitments []ethcommon.Hash `json:"commitments"`
}
ShieldedPool represents the privacy pool
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the chain.ChainVM interface for the Zero-Knowledge Chain (Z-Chain) This chain provides ZK proof verification and fraud proof processing
func (*VM) AppRequest ¶
func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
AppRequest implements the core.AppHandler interface
func (*VM) AppRequestFailed ¶
func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *core.AppError) error
AppRequestFailed implements the core.AppHandler interface
func (*VM) AppResponse ¶
func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
AppResponse implements the core.AppHandler interface
func (*VM) BuildBlock ¶
BuildBlock implements the chain.ChainVM interface
func (*VM) Connected ¶
func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
Connected implements the validators.Connector interface
func (*VM) CreateHandlers ¶
CreateHandlers implements the core.VM interface
func (*VM) CreateStaticHandlers ¶
CreateStaticHandlers implements the core.VM interface
func (*VM) CrossChainAppRequest ¶
func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error
CrossChainAppRequest implements the core.VM interface
func (*VM) CrossChainAppRequestFailed ¶
func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *core.AppError) error
CrossChainAppRequestFailed implements the core.VM interface
func (*VM) CrossChainAppResponse ¶
func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error
CrossChainAppResponse implements the core.VM interface
func (*VM) Disconnected ¶
Disconnected implements the validators.Connector interface
func (*VM) GetBlockIDAtHeight ¶
GetBlockIDAtHeight implements the chain.ChainVM interface
func (*VM) HealthCheck ¶
HealthCheck implements the health.Checker interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx *core.Context, db interface{}, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngine chan<- core.Message, fxs []*core.Fx, appSender core.AppSender, ) error
Initialize implements the core.VM interface
func (*VM) LastAccepted ¶
LastAccepted implements the chain.ChainVM interface
func (*VM) ParseBlock ¶
ParseBlock implements the chain.ChainVM interface
func (*VM) SetPreference ¶
SetPreference implements the chain.ChainVM interface
func (*VM) StartChallenge ¶
StartChallenge starts a new fraud proof challenge
func (*VM) VerifyZKProof ¶
VerifyZKProof verifies a zero-knowledge proof
type VerifierKey ¶
type VerifierKey struct {
ID string `json:"id"`
CircuitType string `json:"circuitType"`
Key []byte `json:"key"`
Parameters []byte `json:"parameters"`
}
VerifierKey represents a ZK verifier key
type ZKProof ¶
type ZKProof struct {
ID ids.ID `json:"id"`
ProofType string `json:"proofType"`
PublicInputs []byte `json:"publicInputs"`
Proof []byte `json:"proof"`
VerifierKey string `json:"verifierKey"`
Verified bool `json:"verified"`
SubmittedAt int64 `json:"submittedAt"`
}
ZKProof represents a zero-knowledge proof