@pixel-protocol/sdk
v0.1.0
Published
Official SDK for Pixel Protocol - Decentralized Reputation Infrastructure
Maintainers
Readme
Pixel Protocol SDK
The official SDK for interacting with Pixel Protocol - a decentralized reputation infrastructure.
Installation
npm install @pixel-protocol/sdkQuick Start
import { PixelProtocol } from "@pixel-protocol/sdk";
// Initialize the SDK
const pixelProtocol = new PixelProtocol({
rpcUrl: "YOUR_RPC_URL",
chainId: 1, // or your preferred chain
credentialIssuerAddress: "YOUR_CONTRACT_ADDRESS",
reputationCalculatorAddress: "YOUR_CONTRACT_ADDRESS",
zkpVerifierAddress: "YOUR_CONTRACT_ADDRESS",
subgraphUrl: "YOUR_SUBGRAPH_URL",
});
// Initialize (connects wallet and sets up ZKP)
await pixelProtocol.initialize();
// Get a user's reputation profile
const profile = await pixelProtocol.getReputationProfile("0x...");
console.log("Credentials:", profile.credentials);
console.log("Reputation Score:", profile.score);
// Prove credential ownership with zero knowledge
const proof = await pixelProtocol.proveCredentialOwnership(
"credentialId",
"I have a positive payment history"
);
// Verify the proof
const isValid = await pixelProtocol.zkp.verifyProof(proof);Features
- Full smart contract interaction layer
- Subgraph querying for efficient data retrieval
- Zero-knowledge proof generation and verification
- Wallet management and connection
- TypeScript support with full type definitions
- Comprehensive credential management
- Reputation score calculation
- Privacy-preserving proofs
Documentation
Smart Contract Interactions
// Issue a new credential
const credentialId = await pixelProtocol.contracts.issueCredential(
userAddress,
"issuer1",
"paymentHistory",
{ score: 95, date: "2025-08-09" }
);
// Verify a credential
const isValid = await pixelProtocol.contracts.verifyCredential(credentialId);
// Calculate reputation score
const score = await pixelProtocol.contracts.calculateScore(
userAddress,
"default"
);Subgraph Queries
// Get all credentials for a user
const credentials = await pixelProtocol.subgraph.getUserCredentials(
userAddress
);
// Search credentials with filters
const filtered = await pixelProtocol.subgraph.searchCredentials({
credentialType: "paymentHistory",
fromTimestamp: 1628553600,
});Zero-Knowledge Proofs
// Create a proof of meeting a score threshold
const proof = await pixelProtocol.proveReputationScore(80);
// Verify a batch of proofs
const isValid = await pixelProtocol.zkp.verifyBatch(proofs);Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
License
MIT License
