Skip to content

elliothllm/zkc

Repository files navigation

ZKC

ZKC is a JSONRPC client built for interacting with the CDK-Erigon node.

Currently a WIP...


Installation

To integrate ZKC into your project, use Go modules. Simply run:

go get github.com/elliothllm/zkc

Then, import the package in your project:

import "github.com/elliothllm/zkc"

Usage

Initialise the cdk-erigon client: Currently only supports CDK Erigon

client := zkc.CDKErigonClient("localhost:8545")

You can configure the client with various options:

client := zkc.CDKErigonClient("localhost:8545", zkc.WithTimeout(20*time.Second), zkc.WithMaxRetries(3, 5*time.Second))

Call an endpoint:

batch, err := client.GetBatchByNumber(10, false)
if err != nil {
    return err
}

Current Endpoints

  • zkevm_BatchNumber
  • zkevm_batchNumberByBlockNumber
  • zkevm_consolidatedBlockNumber
  • zkevm_estimateCounters
  • zkevm_getBatchByNumber
  • zkevm_getBatchCountersByNumber
  • zkevm_getBatchWitness
  • zkevm_getBlockRangeWitness
  • zkevm_getExitRootTable
  • zkevm_getExitRootsByGER
  • zkevm_getForkById
  • zkevm_getForkId
  • zkevm_getForkIdByBatchNumber
  • zkevm_getForks
  • zkevm_getFullBlockByHash
  • zkevm_getFullBlockByNumber
  • zkevm_getL2BlockInfoTree
  • zkevm_getLatestDataStreamBlock
  • zkevm_getLatestGlobalExitRoot
  • zkevm_getProverInput
  • zkevm_getRollupAddress
  • zkevm_getRollupManagerAddress
  • zkevm_getVersionHistory
  • zkevm_getWitness
  • zkevm_isBlockConsolidated
  • zkevm_isBlockVirtualized
  • zkevm_verifiedBatchNumber
  • zkevm_virtualBatchNumber

Example Usage

package main

import (
    "github.com/elliothllm/zkc"
    "time"
)

func main() {
	erigonClient := zkc.CDKErigonClient("", zkc.WithTimeout(20*time.Second), zkc.WithMaxRetries(3, 5*time.Second))

	res, err := erigonClient.GetBatchByNumber(10, true)
	if err != nil {
		return err
	}
}

License

ZKC is released under the MIT License. See the LICENSE file for more details.


This project is a work in progress. I appreciate your patience as ZKC gets developed.

About

Lightweight ZK Json RPC Client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages