mirror of
https://github.com/luxfi/fhe.git
synced 2026-07-26 23:16:08 +00:00
- data-seal: Verifiable Data Integrity Seal (PIP-0010/LP-0535) FHE-encrypted tamper-proof sealing with Public/ZK/Private modes, batch sealing, homomorphic verification - content-provenance: AI & Media Content Provenance (PIP-0011/LP-7110) Model manifests, output attestation via homomorphic comparison, media derivation DAGs - encrypted-crdt: Encrypted CRDT (PIP-0013/LP-6500) LWW-Register with FHE values, OR-Set with tag-based add/remove, Lamport timestamp conflict resolution, deterministic merge - shadow-governance: Shadow Government Protocol (PIP-7010) Anonymous ministries, encrypted voting with homomorphic tallying, nullifier-based anti-fraud, quorum enforcement Each example includes Solidity contracts, Hardhat tests, CLI tasks, and README linking to corresponding PIP and LP specifications.
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { task } from "hardhat/config";
|
|
import { fhe, Encryptable } from "@luxfhe/sdk/node";
|
|
|
|
task("task:batch-seal", "Create a batch of data integrity seals")
|
|
.addParam("contract", "DataSeal contract address")
|
|
.addParam("count", "Number of seals to create")
|
|
.addOptionalParam("mode", "Seal mode: 0=Public, 1=ZK, 2=Private", "0")
|
|
.setAction(async ({ contract, count, mode }, hre) => {
|
|
const [signer] = await hre.ethers.getSigners();
|
|
const dataSeal = await hre.ethers.getContractAt("DataSeal", contract);
|
|
|
|
const n = parseInt(count);
|
|
const hashes: string[] = [];
|
|
const tags: bigint[] = [];
|
|
const encTags: any[] = [];
|
|
|
|
for (let i = 0; i < n; i++) {
|
|
const content = `batch-document-${i}-${Date.now()}`;
|
|
hashes.push(hre.ethers.keccak256(hre.ethers.toUtf8Bytes(content)));
|
|
const tag = BigInt(Math.floor(Math.random() * 1000000));
|
|
tags.push(tag);
|
|
const [enc] = await fhe.encrypt([Encryptable.uint32(tag)]);
|
|
encTags.push(enc);
|
|
}
|
|
|
|
console.log(`Creating batch of ${n} seals...`);
|
|
const tx = await dataSeal.connect(signer).batchSeal(hashes, encTags, parseInt(mode));
|
|
const receipt = await tx.wait();
|
|
|
|
console.log(`Batch sealed: ${n} documents`);
|
|
console.log("Tags (save for verification):", tags.map(String));
|
|
});
|