0.4.1 • Published 7 days ago

@witnessco/client v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 days ago

Witness Client

Features

Witness Client: A client for interacting with Witness.

  • Fetch-based client built on OpenAPI specification
  • Supports customizing fetch function for different environments
  • Configurable with API key and custom RPC URL
  • Verifies proofs against the chain

Usage

bun add @witnessco/client
import { WitnessClient } from '@witnessco/client'

// Instantiate a new client, default params should suffice for now.
const witness = new WitnessClient()

// Unique string, so we get an unseen leafHash.
const sampleString = `Check the chain! @ ${Date.now()}`
const leafHash = witness.hash(sampleString)

console.log(`Posting leaf hash ${leafHash}`)
await witness.postLeaf(leafHash)
console.log('Waiting for onchain inclusion (may take up to 10min)')
await witness.waitForCheckpointedLeafHash(leafHash)

// Get the timestamp for the leaf.
const timestamp = await witness.getTimestampForLeafHash(leafHash)
console.log(`Leaf ${leafHash} was timestamped at ${timestamp}`)

// Get and verify proof.
const proof = await witness.getProofForLeafHash(leafHash)
const verified = await witness.verifyProofChain(proof)
console.log(`Proof verified: ${verified}`)

See this repl for a live example.

Contract Deployments

Canonical deployments for Witness.sol are available as follows:

Chain IDDeployment Address
Mainnet (1)0x0000000e143f453f45B2E1cCaDc0f3CE21c2F06a
Base (8453)0x0000000e143f453f45B2E1cCaDc0f3CE21c2F06a
Optimism (10)0x0000000e143f453f45B2E1cCaDc0f3CE21c2F06a
Sepolia (11155111)0x00000008bcf12Eeb9E4162687D6D251f0F4e7FC2
Base Sepolia (84532)0x0000000159C8253802551eEaf8b475db1A50d712
Optimism Sepolia (11155420)0x0000000a3fa5CFe56b202F376cCa7334c93aEB8b
Arbitrum Sepolia (421614)0x00000006399970c8bdad606abD03b1712974E4eA
Gnosis Chiado (10200)0x000000031C0d9df77F390CED953219E561B67089

See the contracts-core repo for more details.

More Info

See docs.witness.co for more background on Witness, or the contracts-core repo for more details on the contracts.

Built With

0.4.1

7 days ago

0.4.0

7 days ago

0.4.0-beta.0

7 days ago

0.3.1

12 days ago

0.3.0-beta.2

29 days ago

0.3.0-beta.3

29 days ago

0.3.0

29 days ago

0.3.0-beta.1

29 days ago

0.2.0

1 month ago

0.1.15

1 month ago

0.1.16

1 month ago

0.1.14

3 months ago

0.1.12

3 months ago

0.1.13

3 months ago

0.1.10

3 months ago

0.1.11

3 months ago

0.1.8

3 months ago

0.1.9

3 months ago

0.1.7

3 months ago

0.1.6

3 months ago

0.1.5

3 months ago

0.1.4

3 months ago

0.1.2

3 months ago