Skip to content

esthercodez1/bitcoin-native-dao

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin Native DAO Smart Contract

Overview

This smart contract implements a decentralized autonomous organization (DAO) specifically designed for Bitcoin holders, enabling advanced governance, voting, staking, and treasury management functionalities.

Features

Key Functionalities

  • Staking: Users can stake their Bitcoin tokens
  • Proposal Creation: Stakeholders can create governance proposals
  • Voting: Stake-weighted voting system
  • Treasury Management: Execute proposals that transfer funds
  • Flexible Governance: Configurable parameters like minimum stake, quorum, and voting periods

Unique Characteristics

  • Minimum stake requirement
  • Stake-based voting power
  • Whitelisted recipient management
  • Proposal lifecycle management

Contract Components

Constants

  • contract-owner: The initial deployer of the contract
  • Various error codes for different scenarios

Data Variables

  • minimum-stake: Minimum amount required for staking (default: 1 BTC)
  • proposal-count: Tracks total number of proposals
  • quorum-percentage: Percentage of votes required to pass a proposal (default: 51%)
  • voting-period: Duration of voting period (default: ~1 day in Bitcoin blocks)

Main Functions

Staking

  • stake(amount): Stake Bitcoin tokens
    • Requires minimum stake amount
    • Locks tokens for ~2 weeks
  • unstake(amount): Withdraw staked tokens
    • Only after lock period expires

Proposal Management

  • create-proposal(title, description, amount, recipient):
    • Create a new governance proposal
    • Requires minimum stake
    • Validates recipient address
  • vote(proposal-id, vote-bool):
    • Cast a vote on an active proposal
    • Voting power based on staked amount
  • execute-proposal(proposal-id):
    • Execute proposal after voting period
    • Checks quorum requirements
    • Transfers funds if proposal passes

Admin Functions

  • update-minimum-stake(new-minimum)
  • update-quorum-percentage(new-percentage)
  • update-voting-period(new-period)
  • set-whitelisted-recipient(recipient, status)

Security Measures

  • Owner-only administrative functions
  • Stake-based proposal creation
  • Whitelisted recipient validation
  • Locked staking periods
  • Quorum-based proposal execution
  • Multiple validation checks

Error Handling

Comprehensive error codes covering scenarios like:

  • Insufficient balance
  • Invalid proposals
  • Voting restrictions
  • Unauthorized actions

Usage Example

;; Stake tokens
(contract-call? .bitcoin-dao stake u1000000)

;; Create a proposal
(contract-call? .bitcoin-dao create-proposal
    "Fund Community Project"
    "Proposal to fund blockchain education"
    u500000
    'ST2CY5V39MWKFS1R8MYXZ1Q5A9VQ26H9K4KENR3V)

;; Vote on a proposal
(contract-call? .bitcoin-dao vote u1 true)

Deployment Requirements

  1. Stacks blockchain environment
  2. Minimum of 1 BTC equivalent for initial deployment
  3. Owner account for administrative functions

Configuration

Initial configuration can be set during contract initialization:

  • Minimum stake amount
  • Quorum percentage
  • Voting period duration

Limitations and Considerations

  • Voting power directly correlates with staked amount
  • Proposals require a minimum stake to create
  • Funds are transferred in STX, not native Bitcoin
  • Whitelisted recipient mechanism for additional security

Recommended Improvements

  • Implement more granular voting mechanisms
  • Add time-locked governance tokens
  • Develop more complex proposal types
  • Enhance recipient validation

Contributing

Contributions are welcome. Please submit pull requests or open issues on the project repository.

About

A smart contract enabling a decentralized autonomous organization (DAO) for Bitcoin holders. Features include advanced governance, voting, staking, and treasury management functionalities.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors