npm install @baseline-protocol/api(npm package soon to be published)
Building
You can build the package locally with npm run build.
Testing
Run the local test suite with npm test.
Baseline JSON-RPC Module
An initial set of JSON-RPC methods have been defined for inclusion in the specification. These methods allow easy interaction with on-chain shield contracts (which contain merkle-tree fragments) and maintain full merkle-trees (along with metadata) in local off-chain storage.
Method
Params
Description
baseline_getCommit
address, commitIndex
Retrieve a single commit from a tree at the given shield contract address
baseline_getCommits
address, startIndex, count
Retrieve multiple commits from a tree at the given shield contract address
baseline_getRoot
address
Retrieve the root of a tree at the given shield contract address
baseline_getProof
address, commitIndex
Retrieve the membership proof for the given commit index
baseline_getTracked
Retrieve a list of the shield contract addresses being tracked and persisted
baseline_verifyAndPush
sender, address, proof, publicInputs, commit
Inserts a single commit in a tree for a given shield contract address
baseline_track
address
Initialize a merkle tree database for the given shield contract address
baseline_untrack
address
Remove event listeners for a given shield contract address