# @alpha-network/keccak256-zk

### Description

The JavaScript SDK designed for verifying data existence using zero-knowledge proofs (ZKP) based on the Keccak256 hashing algorithm.

This SDK enables developers to confirm the validity of data in blockchain or distributed storage systems without revealing its actual content. It’s easy to integrate, making it ideal for blockchain applications, data privacy solutions, and decentralized projects.

### Installation

```shell
npm install @alpha-network/keccak256-zk
```

### Usage

#### Generate ZK Proof

To generate a zero-knowledge proof, use the `generateZkProof` function:

```typescript
import { generateZkProof } from '@alpha-network/keccak256-zk';

const dataBytes = new Uint8Array([/* your data bytes here */]);
const nonce = '12345678'; // Example nonce (must be 8 characters long)

try {
  const { proof, publicSignals } = await generateZkProof({ dataBytes, nonce });
  console.log('ZK Proof generated:', proof);
  console.log('Public Signals:', publicSignals);
  return { proof, publicSignals };
} catch (error) {
  console.error('Error generating ZK Proof:', error.message);
}
```

#### Verify ZK Proof

To verify a generated proof, use the `verifyZkProof` function:

```typescript
import { verifyZkProof } from '@alpha-network/keccak256-zk';

try {
  const isValid = await verifyZkProof({
    hash: expectedHash, // Keccak256 Hash
    nonce: expectedNonce,
    proof,
    publicSignals,
  });
  console.log('ZK Proof verification result:', isValid);
} catch (error) {
  console.error('Error verifying ZK Proof:', error.message);
}
```

### License

MIT

### Remote Repository

<https://github.com/alpha-network-inc/keccak256-zk-js>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alphaos.net/whitepaper/open-source-contributions/alpha-network-keccak256-zk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
