Get the ChainStorage contract bound to the current chain DB.
ChainStorage instance, or undefined before a DB is opened.
The configured Groth16 prover.
The prover, or undefined when none was supplied.
Construct an engine. Pass chainDB to inject a pre-configured database
(for tests). When omitted, the engine creates
<dataDir>/chains/<id>/chain.db the first time storage is requested (dataDir
defaults to ./.railgun).
Required { chainId }, optional { chainDB?, dataDir?, prover? }.
EVM chain ID of the one chain this engine serves.
OptionalchainDB?: anyPre-built ChainDB; engine will not close it.
When provided, dataDir is ignored.
OptionaldataDir?: stringBase directory for chain DB files. Defaults to
./.railgun.
Optionalprover?: Groth16ProverGroth16 backend for proof-bearing operations. Omit when the consumer only shields.
Set Logger for Railgun Engine
Logger Function
Open local chain storage without fetching or scanning blocks.
Storage for this engine's deployment.
Drain the data source into chain.db, returning when the source
reaches its current tip. Resumes from the persisted sync cursor when one
exists, otherwise starts at startBlock or the network's deployment
block.
Live sources (RPCProvider) never reach a natural tip; bound the scan with
endBlock when using one.
Direct engine calls are not serialized. Await each scan before starting
another on the same storage or data source. RailgunClient.scan() provides
a per-client queue.
{ dataSource, startBlock?, endBlock?, onBatch? }.
Source of blocks. The caller owns it; the engine never destroys it.
Inclusive floor used only without a persisted cursor. Must be at or above the network deployment block.
Inclusive ceiling; the scan exits after writing a block at or above this height.
Fired after each batch is committed to chain.db with the resolved scan start and the highest block number in that batch. Synchronous; throwing aborts the run.
Whether to persist PPOI Railgun transaction rows while denormalizing blocks.
Last block number written to chain.db, or undefined when the
source had nothing to yield.
Get MerkleTree by treeNumber
Input treeNumber
Get all the note commitment tree in the engine
Release engine resources: close chain.db only when the engine owns it.
RailgunEngine
Core orchestrator for the Railgun protocol. Manages initialization and lifecycle of all critical components required for Railgun operation like