A simple client SDK for interacting with ZK-enhanced features in PQC-Quorum.
npm install @cheny56/zk-clientA simple client SDK for interacting with ZK-enhanced features in PQC-Quorum.
This SDK provides utilities for:
- Sending ZK-enhanced transactions
- Verifying ZK proofs
- Querying ZK transaction status
- Managing verification keys
```
zk-client/
├── js/ # JavaScript/TypeScript SDK
│ ├── index.js # Main SDK entry point
│ ├── zk-client.js # ZK RPC client
│ └── types.js # Type definitions
├── go/ # Go client library
│ └── client.go # Go ZK client
├── examples/ # Usage examples
│ ├── send-zk-tx.js # Send ZK transaction example
│ └── verify-proof.js # Verify proof example
└── README.md # This file
`javascript
const { ZKClient } = require('./js');
// Connect to node
const client = new ZKClient('http://localhost:8545');
// Check if ZK is enabled
const enabled = await client.isZKEnabled();
console.log('ZK enabled:', enabled);
// Get supported proof systems
const systems = await client.getSupportedProofSystems();
console.log('Supported systems:', systems);
// Send a ZK transaction
const txHash = await client.sendZKTransaction({
from: '0x...',
to: '0x...',
zkProofSystem: 1, // Groth16
zkProof: '0x...',
zkPublicInputs: ['0x...'],
zkVerificationKeyHash: '0x...'
});
`
`go
import "github.com/ethereum/go-ethereum/zk-client/go"
client, _ := zkclient.NewClient("http://localhost:8545")
// Check if ZK is enabled
enabled, _ := client.IsZKEnabled(context.Background())
// Send ZK transaction
txHash, _ := client.SendZKTransaction(context.Background(), zkclient.ZKTxArgs{
From: common.HexToAddress("0x..."),
To: &toAddr,
ZKProofSystem: zkclient.Groth16,
ZKProof: proofBytes,
})
`
| ID | Name | Description | Status |
|----|------|-------------|--------|
| 1 | Groth16 | ZK-SNARK over BN256 | ✅ Enabled |
| 2 | PLONK | Universal SNARK | 🚧 Coming soon |
| 3 | STARK | Transparent, PQ-secure | 🚧 Coming soon |
#### ZKClient(rpcUrl)
Create a new ZK client instance.
#### client.isZKEnabled(blockNumber?)
Check if ZK precompiles are enabled at the given block.
#### client.getSupportedProofSystems()
Get list of supported ZK proof systems.
#### client.sendZKTransaction(args)
Send a ZK-enhanced transaction.
#### client.sendRawZKTransaction(signedTx, args)
Send a pre-signed ZK transaction.
#### client.verifyProof(args)
Verify a ZK proof off-chain.
#### client.getZKTransactionInfo(txHash)
Get detailed information about a ZK transaction.
#### client.estimateZKGas(args)
Estimate gas for a ZK transaction.
#### client.getSupportedCredentialTypes()
Get list of supported credential types.
#### client.getSupportedPredicates()
Get list of supported predicates for selective disclosure.
#### client.createPresentationRequest(args)
Create a presentation request for credential verification.
`javascript`
const request = await client.createPresentationRequest({
verifier: '0x...',
credentialType: ZKClient.CredentialType.KYC,
predicates: [{
type: 'Comparison',
attribute: 'kycLevel',
operator: '>=',
value: '0x02'
}],
trustedIssuers: ['0x...'],
expiresInSeconds: 300
});
#### client.verifyCredentialProof(proof, predicates)
Verify a credential proof against predicates.
#### client.getPermissionLevel(account)
Get the permission level for an account.
| Code | Name | Description |
|------|------|-------------|
| 1 | Identity | Basic identity credential |
| 2 | KYC | Know Your Customer verification |
| 3 | Age | Age verification |
| 4 | Membership | Organization membership |
| 5 | Role | Role/permission credential |
| 6 | Accreditation | Accredited investor/entity |
| 255 | Custom | Custom credential type |
| Level | Name | Description |
|-------|------|-------------|
| 0 | None | No permissions |
| 1 | Read | Can read state |
| 2 | Transact | Can send transactions |
| 3 | ContractDeploy | Can deploy contracts |
| 4 | Admin | Full admin access |
The SDK requires a connection to a PQC-Quorum node with ZK features enabled.
`json``
{
"config": {
"zkPrecompileBlock": 0
}
}
- This SDK is in early development
- API may change as ZK features evolve
- Proof generation should be done off-chain using gnark or similar libraries
LGPL-3.0