A delegated reputation framework allows users to stake their social or financial capital by vouching for others, creating a web of trust. The core components are a registry of identities (like Ethereum addresses), a mapping of delegation links (e.g., Alice delegates 100 reputation points to Bob), and a scoring algorithm that calculates transitive reputation. This system is foundational for decentralized governance, curation markets, and trust-minimized credit scoring, moving beyond simple token-weighted voting.
Setting Up a Delegated Reputation Framework
Setting Up a Delegated Reputation Framework
A practical guide to implementing a delegated reputation system, covering core components, smart contract logic, and integration patterns.
The smart contract architecture typically involves two main contracts: a Reputation Token (an ERC-20 or ERC-1155 representing reputational stake) and a Delegation Registry. The registry stores directed graphs of delegations with weights. A critical function is delegate(address delegatee, uint256 amount), which transfers reputational voting power without transferring the underlying token ownership. Security considerations include preventing self-delegation loops and ensuring delegation sums cannot exceed a user's balance.
Calculating a user's effective reputation requires graph traversal. A common method is the PageRank algorithm, adapted for weighted, directed delegation graphs. For on-chain efficiency, scores can be computed off-chain via a subgraph (using The Graph protocol) and cached. A sample calculation for address X sums the reputation directly delegated to it, plus a fraction of the reputation delegated to its delegators, recursively, with a damping factor to reduce the influence of distant connections.
To integrate this framework, begin by forking an audited base like Compound's Governor Bravo delegation logic or OpenZeppelin's ERC20Votes. Key development steps are: 1) Deploy the reputation token, 2) Deploy the delegation registry linked to the token, 3) Implement an off-chain indexer to calculate and store reputation scores, and 4) Build view functions that fetch scores for use in dApp logic, such as proposal voting power.
Practical use cases include DAO governance, where members delegate their voting power to subject-matter experts, and decentralized curation platforms like Ocean Protocol's data marketplace, where stakers signal quality. When designing incentives, consider implementing slashing conditions for malicious delegation or decay mechanisms to ensure active participation. Always verify contract interactions using libraries like Ethers.js or Viem, and test delegation scenarios thoroughly on a testnet before mainnet deployment.
Prerequisites
Before implementing a delegated reputation framework, you must establish a foundational environment. This includes setting up a development stack, understanding core concepts, and configuring the necessary tools.
A delegated reputation framework allows users to assign their voting power or attestation rights to a trusted third party, known as a delegator or attester. This is a core primitive for scalable decentralized governance and identity systems, used by protocols like Optimism's Citizen House and Ethereum Attestation Service (EAS) schemas. To build with it, you need a working knowledge of smart contract interactions, event listening, and public key cryptography. Familiarity with concepts like signatures, delegation nonces, and revocation is essential.
Your development environment should be configured with Node.js (v18+), a package manager like npm or yarn, and a code editor such as VS Code. You will need to install key libraries: an Ethereum provider interface like ethers.js v6 or viem, a testing framework such as Hardhat or Foundry, and potentially SDKs for specific attestation protocols. For example, to interact with EAS, you would install @ethereum-attestation-service/eas-sdk. Ensure you have access to a blockchain node, either via a local testnet (e.g., Hardhat Network), a testnet RPC provider (Alchemy, Infura), or a public RPC endpoint.
You must also set up a wallet with testnet funds. Use a browser extension wallet (MetaMask) or a script-based wallet (via private key) for development. Acquire test ETH or other native tokens for the network you are targeting (e.g., Sepolia ETH, Optimism Goerli ETH) from a faucet. This is required to pay for gas when deploying contracts or submitting on-chain transactions like creating or delegating attestations. Keep your private keys and mnemonics secure in environment variables using a .env file and a package like dotenv.
Finally, define the scope of your framework. Decide on the reputation data model: What does an attestation represent? Is it a binary endorsement, a score, or a badge? Determine the delegation rules: Can delegations be revoked? Do they expire? Sketch the relationships between issuers, subjects, attesters, and verifiers. Having a clear schema before you write code will guide your contract design and API structure. Reference existing standards like EAS schema registries or ERC-20/ERC-721 voting tokens for inspiration on structuring your data.
Setting Up a Delegated Reputation Framework
A delegated reputation framework allows users to delegate their reputation score to trusted agents, enabling scalable and efficient governance, curation, and access control in decentralized systems.
A delegated reputation framework is a design pattern where a user's on-chain reputation score, often represented as a non-transferable token (NFT) or a soulbound token (SBT), can be delegated to another address. This delegation grants the agent the right to act on the user's behalf within a specific application context, such as voting in a DAO, curating a list, or accessing gated services. The core architecture typically involves three key components: a reputation registry (like Ethereum Attestation Service or a custom smart contract) that issues and tracks scores, a delegation module that manages delegation permissions, and an application contract that consumes the delegated authority.
To implement this, you first need a source of truth for reputation. This is often an ERC-1155 or ERC-721 contract where token ownership signifies a reputation score, or a registry like EAS where attestations link a subject to a specific data schema. The delegation logic is then built on top. A basic Solidity delegation contract might include a delegate function that records the delegatee and a revoke function. Crucially, the contract must check that the caller is the owner of the reputation token before allowing delegation, ensuring security and user sovereignty over their social capital.
Here is a simplified code example for a delegation manager contract:
solidity// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; contract ReputationDelegator { IERC721 public reputationToken; mapping(address => address) public delegateOf; constructor(address _reputationTokenAddress) { reputationToken = IERC721(_reputationTokenAddress); } function delegate(address to) external { require(reputationToken.balanceOf(msg.sender) > 0, "No reputation to delegate"); delegateOf[msg.sender] = to; emit Delegated(msg.sender, to); } function revoke() external { delete delegateOf[msg.sender]; emit Revoked(msg.sender); } }
This contract allows any holder of the specified ERC-721 reputation NFT to delegate their voting power to another address. A downstream governance contract would query delegateOf[user] to determine who is authorized to cast votes on their behalf.
Key design considerations include delegation scope (is it global or app-specific?), delegation expiry (time-bound vs. indefinite), and security models. For complex systems, consider using ERC-20 vote tokens that are minted upon delegation, as seen in Compound's Governor Bravo, or ERC-712 signed delegations for gasless approvals. The framework must also handle slashable conditions where malicious behavior by a delegate could result in a loss of the delegated reputation, a mechanism utilized by oracle networks like Chainlink and collaborative finance protocols like Hats Finance.
Practical use cases extend beyond voting. A delegated reputation framework can power curated registries (e.g., a token allowlist where delegates' reputations aggregate to determine inclusion), access control for premium features in a dApp, or sybil-resistant airdrops. When designing, prioritize transparency—all delegations should be on-chain events—and user experience, allowing easy delegation and revocation through frontends that integrate with wallets like MetaMask or Rabby. The end goal is to create a flexible primitive that turns static reputation into active, programmable social capital.
Delegation Model Comparison
Key design trade-offs for implementing a delegated reputation framework.
| Feature | On-Chain Registry | Off-Chain Aggregator | Hybrid (On-Chain Claims) |
|---|---|---|---|
Sovereignty & Portability | High: User controls keys, reputation is a transferable asset. | Low: Reputation is siloed within the aggregator's database. | Medium: Core claims are portable, but scoring logic may be fixed. |
Sybil Resistance Cost | High: Requires staking or transaction fees for each action. | Low: Centralized or social verification reduces per-action cost. | Medium: Staking for claims, but low-cost for scoring updates. |
Real-Time Update Latency | Slow: Limited by block time (e.g., 12 sec on Ethereum). | Fast: Sub-second updates possible. | Variable: Claim submission is slow, scoring can be fast. |
Computational Complexity | Limited: Expensive complex logic (e.g., PageRank) is prohibitive. | High: Can run any algorithm (ML, graphs) off-chain. | Medium: Simple on-chain logic, complex processing off-chain. |
Censorship Resistance | High: Immutable, permissionless submissions. | Low: Aggregator can censor data or users. | Partial: Claims are censorship-resistant, scoring can be gated. |
Implementation Example | ERC-20/ERC-721 with staking, ENS subdomains. | The Graph subgraphs, Ceramic streams, centralized API. | EAS (Ethereum Attestation Service) with off-chain verifiers. |
Gas Cost for Delegation | $10-50 | $0 | $5-20 |
Data Verifiability | Transparent: All data is publicly auditable on-chain. | Opaque: Users must trust the aggregator's data integrity. | Selective: Core claims are verifiable, derived scores may not be. |
Step-by-Step Implementation
This guide walks through implementing a delegated reputation framework using Chainscore's on-chain attestations, from smart contract setup to frontend integration.
A delegated reputation framework allows users to vouch for others, creating a web of trust anchored on-chain. The core components are a reputation registry smart contract and a system of attestations. Chainscore's AttestationStation contract on Base provides a gas-efficient, general-purpose attestation primitive. You'll deploy your own instance or use the canonical one. The contract stores key-value pairs where the about field is the user's address, the key is a string identifier (e.g., "delegated-rep-score"), and the value is the attestation data (e.g., a score or boolean). This creates a permanent, verifiable record of delegated trust.
Start by setting up your development environment. You'll need Node.js, a package manager like yarn or npm, and a wallet with testnet ETH. Clone the Chainscore Starter Kit which includes examples for interacting with the attestation contracts. The key dependency is the @chainscore/attestation-station package, which provides TypeScript bindings and utilities. Initialize a Hardhat or Foundry project if you plan to write custom registry logic. For simplicity, we'll use the existing AttestationStation contract at 0xEE36eaaD94d1Cc1d0eccaDb55C38bFfB6Be06C77 on Base Sepolia.
The core interaction is creating an attestation. Using Ethers.js and the starter kit, you can write a function like:
javascriptimport { AttestationStation } from '@chainscore/attestation-station'; const attestationStation = new AttestationStation(signer); const tx = await attestationStation.attest( delegateAddress, // about 'delegated-rep-tier', // key '3' // value encoded as a string );
This transaction signs and broadcasts the attestation, permanently linking your address as the creator, the delegate as the about, and the score as the value. You can attest to any string-based data, enabling flexible reputation models.
To make the system useful, you need to read and aggregate attestations. Create a reputation resolver contract or an off-chain indexer. A simple view function can sum scores from trusted issuers. For example, a Solidity resolver might iterate through a pre-approved list of issuer addresses and sum their value for a given user. Off-chain, you can query the AttestationCreated event logs using The Graph or a simple indexer. The Chainscore SDK provides a helper: AttestationStation.fetchAttestations({ about: userAddress, key: 'delegated-rep-score' }) which returns all relevant attestations for aggregation.
Finally, integrate the framework into your dApp's frontend. Display a user's aggregated reputation score, the list of attestations they've received, and allow trusted users to issue new ones. Implement checks to prevent self-attestation and Sybil attacks—consider requiring a staking mechanism or prior reputation to become an issuer. Always verify attestations on-chain before using them for governance, access control, or weighting. By leveraging Chainscore's primitive, you build a transparent, portable, and composable reputation layer for your application.
Implementing Slashing and Misuse Penalties
A guide to designing and implementing penalty mechanisms for delegated reputation systems, ensuring validator accountability and network security.
In a delegated reputation framework, participants stake tokens to signal trust in validators or data providers. To prevent malicious behavior, slashing is a critical penalty mechanism where a portion of this staked capital is burned or redistributed. This creates a direct economic disincentive for actions that harm the network, such as providing false data, going offline, or double-signing blocks. Properly calibrated slashing ensures that the cost of attack outweighs any potential gain, aligning the incentives of delegates with the health of the overall system.
Designing an effective slashing system requires defining clear, objective fault conditions. Common conditions include: unavailability (failing to submit attestations), equivocation (signing conflicting messages), and byzantine behavior (submitting provably false data). Each condition must be cryptographically verifiable on-chain. The penalty severity should be proportional to the fault; a minor, temporary downtime might incur a small penalty, while a deliberate attack attempting to corrupt the network state should result in a near-total slash of the staked funds.
Implementation involves writing secure smart contract logic. Below is a simplified Solidity example for a slashing condition based on submitting a provably false data point, verified against an on-chain oracle. The contract holds staked funds and allows anyone to submit a fraud proof.
solidityfunction slashForMisreport( address validator, uint256 stakeIndex, bytes32 reportedValue, bytes32 correctValue, bytes memory proof ) external { require( verifyFraudProof(reportedValue, correctValue, proof), "Invalid fraud proof" ); uint256 slashAmount = calculateSlashAmount(validator, stakeIndex); _slash(validator, stakeIndex, slashAmount); // Optionally reward the reporter _rewardReporter(msg.sender, slashAmount / 10); }
Beyond simple slashing, consider implementing misuse penalties for subtler attacks. These can include: - Toxic delegation: Delegating to a large number of validators to game voting power distribution. Mitigate with a tax on excessive delegation. - Reputation laundering: Rapidly redelegating stake to wash away a bad history. Implement a cooldown period or decaying penalty history. - Sybil attacks: Creating many identities. Require a minimum stake per identity or use proof-of-personhood. These mechanisms require more complex state tracking but are essential for robust security.
The parameters for slashing—such as the penalty percentage, the unbonding period for withdrawn stakes, and the reward for fraud reporters—must be carefully governed. Many protocols, like Ethereum's Beacon Chain or Cosmos Hub, use on-chain governance to adjust these parameters over time based on network performance. It's also crucial to have a clear appeals process or governance override for slashing events that may be contested or caused by software bugs, preventing unjust penalties from causing a loss of confidence in the system.
Use Cases and Applications
Delegated reputation frameworks enable trustless, scalable governance and access control by allowing users to delegate their on-chain reputation to trusted agents. These are the primary applications and tools for implementation.
Credit and Underwriting Delegation
DeFi lending protocols can incorporate non-financial reputation. A user with a strong history of successful repayments can delegate their "credit reputation" to a new address or vouch for another user's loan.
- ArcX's "Soulbound" credit score is a non-transferable NFT based on DeFi history.
- A delegated model allows established users to act as underwriters, taking a stake in the success of a borrower they recommend.
Resources and Further Reading
These resources cover the primitives, protocols, and design patterns needed to implement a delegated reputation framework. They focus on identity, trust delegation, reputation scoring, and verifiable attestations used in production Web3 systems.
Setting Up a Delegated Reputation Framework
A delegated reputation framework allows users to delegate their voting power or attestation rights to trusted entities. This guide covers the critical security architecture and auditing steps required for a robust implementation.
A delegated reputation framework is a core component of many decentralized governance and identity systems, such as those used by DAO voting or on-chain credential platforms. It enables users (delegators) to assign their reputation weight—often represented by tokens or non-transferable Soulbound Tokens (SBTs)—to a delegate who votes or attests on their behalf. The primary security challenge is ensuring this delegation is non-custodial; the delegator's assets or reputation score must never be at risk of theft or misuse by the delegate. The smart contract must enforce that delegates can only act within the explicitly granted permissions.
The core smart contract architecture should implement a clear separation between the reputation state and the delegation logic. A common pattern uses two main contracts: a ReputationToken (ERC-20, ERC-1155, or a custom SBT standard) that holds the immutable reputation score, and a DelegationRegistry that manages delegation mappings. Critical functions include delegate(address delegatee, uint256 amount), undelegate(), and voteByDelegate(uint256 proposalId). Each must include access controls (e.g., onlyDelegator or onlyDelegate) and reentrancy guards. Use OpenZeppelin's libraries for these security patterns.
Key security considerations for the delegation contract include slashing conditions, delegation expiry, and front-running protections. For example, a malicious delegate could be slashed (lose a portion of delegated reputation) for malicious voting, which requires a secure, permissioned slashing mechanism. Implement timestamp-based expiry using block.timestamp to prevent indefinite delegations. To mitigate front-running on delegation changes, consider using a commit-reveal scheme for critical governance votes. Always validate that the delegator has sufficient undelegated balance in the delegate function.
A comprehensive audit should test all state transitions and edge cases. Key audit areas include: the correctness of voting power calculations after partial undelegation, behavior when a delegator's underlying reputation tokens are transferred or burned, and the interaction with upgradeable contracts if used. Use static analysis tools like Slither or Mythril and fuzzing with Foundry to simulate random delegation and voting patterns. Formal verification tools like Certora can prove critical invariants, such as "the sum of all delegated amounts never exceeds the total token supply."
For production deployment, establish a timelock mechanism for any changes to the delegation contract's parameters, such as slashing severity or delegation cooldown periods. This prevents a malicious or compromised admin from altering rules unexpectedly. Consider integrating with a safe multisig like Safe{Wallet} for administrative functions. Document all user risks clearly, emphasizing that delegation does not transfer asset custody but does confer significant influence. Reference established implementations like OpenZeppelin Governor with delegation or Ethereum Attestation Service (EAS) schemas for real-world design patterns.
Frequently Asked Questions
Common questions and troubleshooting for developers implementing a delegated reputation system for on-chain governance.
A delegated reputation framework is a governance mechanism where a user's voting power is derived from a reputation score that can be delegated to other participants. Unlike simple token voting, it separates the right to vote from the right to delegate. The core components are:
- Reputation Token (Non-Transferable): A soulbound token (e.g., an ERC-721 or ERC-1155) minted to users based on predefined, verifiable criteria (e.g., protocol usage, contributions).
- Delegation Registry: A smart contract that records delegation links, allowing a delegator to assign their voting power to a delegatee.
- Voting Power Aggregator: A contract that calculates a user's total voting power by summing their native reputation and all reputation delegated to them.
This creates a fluid, expertise-based governance layer where informed community members can amass influence without requiring capital.
Conclusion and Next Steps
You have now configured the core components of a delegated reputation framework. This guide has covered the foundational setup, from smart contract deployment to frontend integration.
The framework you've built enables a community to delegate reputation scoring to specialized oracles. This separates the logic of reputation calculation from the application logic, creating a more modular and upgradeable system. Key components include the ReputationOracle contract for scoring logic, a DelegatedReputation registry for managing oracle permissions, and a frontend client that queries these on-chain sources. By using a standard like EIP-3668 for off-chain data, you ensure flexibility in how scores are computed and verified.
For production deployment, several critical steps remain. First, thoroughly audit your ReputationOracle logic for fairness and resistance to manipulation. Second, implement a robust oracle staking and slashing mechanism to align incentives and penalize malicious behavior. Third, establish a clear governance process, potentially using a DAO, for adding or removing delegated oracles. Tools like OpenZeppelin's Defender can help automate admin tasks and monitor for suspicious activity. Finally, consider integrating with a decentralized identity standard like Verifiable Credentials to link off-chain achievements to on-chain reputation.
To extend this system, explore advanced patterns. You could implement context-specific reputation by deploying multiple oracle contracts for different domains (e.g., lending, governance, content curation). Cross-chain reputation is another frontier; use a generic message passer like Axelar or LayerZero to synchronize reputation scores across multiple networks. For deeper analysis, refer to the Chainlink documentation on decentralized oracle networks or the EIP-3668 specification for technical details on offchain data retrieval.
The next practical step is to test your framework under simulated load. Use a forked mainnet environment with Foundry or Hardhat to simulate oracle responses and delegation actions. Measure gas costs for key operations and stress-test the withdrawal of a delegated oracle. Engage your community early by deploying to a testnet and running a bug bounty program. A well-architected delegated reputation system becomes a foundational primitive for building more sophisticated, trust-minimized, and community-governed applications.