Smart Contract Guide
π Quick Start
To run the smart contract, you need run the following command
1. Clone and Install
git clone https://github.com/your-org/gelap-contracts
cd gelap-contracts
forge install2. Run Tests
forge test3. Deploy
# Set up environment
cp .env.example .env
# Edit .env with your configuration
# Deploy to testnet
forge script script/DeployGelap.s.sol --rpc-url $RPC_URL --broadcastποΈ Project Structure
gelap-contracts/
βββ src/
β βββ GelapShieldedAccount.sol # Main contract
βββ test/
β βββ Deposit.t.sol # Deposit tests
β βββ Transact.t.sol # Transaction tests
β βββ Withdraw.t.sol # Withdrawal tests
β βββ mocks/
β βββ MockSP1Verifier.sol # Mock verifier
βββ script/
β βββ DeployGelap.s.sol # Deployment script
βββ docs/ # Documentation
βββ lib/ # Dependenciesπ Key Features
Privacy: Hide transaction amounts and participants
Zero-Knowledge Proofs: Powered by SP1 zkVM
ERC20 Support: Works with any ERC20 token
Merkle Tree: Efficient state management
Double-Spend Protection: Nullifier tracking
π Core Concepts
Commitments
Private notes representing token ownership. Each commitment contains:
Token address
Amount
Owner's public key
Blinding factor (randomness)
Nullifiers
Unique identifiers that prevent double-spending without revealing which note was spent.
Merkle Tree
A 32-level tree storing all commitments. The root represents the current state.
SP1 zkVM
Zero-knowledge virtual machine that proves correct state transitions off-chain.
π Links
GitHub: gelap-contracts
SP1 Docs: docs.succinct.xyz
Foundry: book.getfoundry.sh
π€ Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
π License
MIT License - see LICENSE file for details
π Support
Issues: GitHub Issues
Discord: Join our Discord
Email: support@gelap.xyz
β οΈ Disclaimer
This software is in active development and has not been audited. Use at your own risk. Do not use in production without a professional security audit.
Last updated