Alpha Network
  • World's first decentralized data execution layer of AI
  • Market Opportunity
  • AlphaOS
    • How does it Work?
    • Use Cases
    • Update History
    • Terms of Service
    • Privacy Policy
  • Alpha Chain
    • Blockchain Architecture
    • Roles
      • Provider
      • Labelers
      • Preprocessors
    • Data Privacy and Security
    • Decentralized Task Allocation Virtual Machine
    • Data Utilization and AI Training
    • Blockchain Consensus
  • Distributed Crawler Protocol (DCP)
  • Distributed VPN Protocol (DVP)
    • Architecture
    • Benefits
  • Tokenomics
  • DePin's Sustainable Revenue
  • Committed to Global Poverty Alleviation
  • Open Source Contributions
    • @alpha-network/keccak256-zk
Powered by GitBook
On this page
  • Description
  • Installation
  • Usage
  • License
  • Remote Repository

Was this helpful?

  1. Open Source Contributions

@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

npm install @alpha-network/keccak256-zk

Usage

Generate ZK Proof

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

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:

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

PreviousCommitted to Global Poverty Alleviation

Last updated 7 months ago

Was this helpful?

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