Quickstart
Get up and running with CredDAO in just a few minutes.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js 20+
- npm or pnpm
- Solana CLI tools
- A Solana wallet (Phantom or Solflare recommended)
Installation
Install the CredDAO SDK in your project:
npm install @creddao/sdk @solana/web3.js @coral-xyz/anchorInitialize the Client
Create a new CredDAO client instance:
import { CredDAOClient } from '@creddao/sdk';
import { Connection, clusterApiUrl } from '@solana/web3.js';
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
// Connect to Solana
const connection = new Connection(clusterApiUrl('devnet'), 'confirmed');
// Create provider with your wallet
const provider = new AnchorProvider(
connection,
wallet, // Your wallet adapter
{ commitment: 'confirmed' }
);
// Initialize client
const client = new CredDAOClient({
provider,
programId: new PublicKey('CreDDAo111111111111111111111111111111111111'),
});Register as a Member
Before participating in governance, register your wallet:
// Register with an initial FairScore
const tx = await client.registerMember({
fairscore: 50, // Initial score (will be updated by oracle)
});
console.log('Registered!', tx.signature);View Your Profile
Fetch your member profile to see your reputation tier:
const profile = await client.getMemberProfile(wallet.publicKey);
console.log('FairScore:', profile.fairscore.toNumber());
console.log('Tier:', profile.tier); // 'gold', 'silver', etc.
console.log('Active Days:', profile.activeDays.toNumber());Cast a Vote
Participate in active proposals:
// Get active proposals
const proposals = await client.getActiveProposals();
// Cast your vote
await client.castVote({
proposalAddress: proposals[0].publicKey,
vote: VoteType.For, // 0: For, 1: Against, 2: Abstain
});Calculate Voting Power
See how much your vote counts:
const tokenBalance = 10000; // Your token holdings
const fairscore = profile.fairscore.toNumber();
const votingPower = client.calculateVotingPower(tokenBalance, fairscore);
console.log('Quadratic Base:', votingPower.quadraticBase);
console.log('Reputation Multiplier:', votingPower.reputationMultiplier);
console.log('Total Voting Power:', votingPower.totalPower);Next Steps
Smart Contracts
Understand the on-chain programs that power CredDAO.
SDK Reference
Explore the full SDK API documentation.
Frontend Components
React components and hooks for your app.
Create a Proposal
Learn how to submit governance proposals.
Delegation
Delegate your voting power to trusted members.
Admin Panel
Manage and moderate your DAO.
Frontend Quickstart
Clone and run the frontend:
git clone https://github.com/creddao/creddao
cd creddao
npm install
# Start API
cd api && npm run dev
# Start Frontend
cd ../frontend && npm run devReact Hooks
Use CredDAO hooks in your React app:
import { useFairScore, useVotingPower, useProposals } from '@creddao/react-hooks'
function GovernanceDashboard() {
const { data: score } = useFairScore()
const { votingPower } = useVotingPower(1000)
const { data: proposals } = useProposals({ state: 'active' })
return (
<div>
<h2>Your Voting Power: {votingPower}</h2>
<p>Tier: {score?.tier}</p>
<p>Active Proposals: {proposals?.length}</p>
</div>
)
}Proposal Templates
Use pre-built templates for common governance actions:
import { TemplateSelector } from '@creddao/react-components'
<TemplateSelector
onSelect={(title, description, type) => {
// Populate your form
}}
/>