BVM
  • About bvm
    • Development infrastructure for Bitcoin
    • Follow our progress
  • getting started
    • Build a Bitcoin L2 with BVM Studio
    • Level up with Bitcoin dapps
    • Deploy your own Bitcoin dapp
  • L1 Scaling solutions
    • What are Bitcoin Shards? [WIP]
    • Compute sharding [WIP]
    • Data sharding [WIP]
    • Case studies [WIP]
      • SHARD_BVM
        • Bitcoin Virtual Machine #0
      • SHARD_DA [WIP]
      • SHARD_AI [WIP]
  • L2 Scaling solutions
    • What are Bitcoin rollups?
    • Optimistic rollups
    • ZK rollups
  • l3 scaling solutions
    • What are Bitcoin appchains?
    • Rollups from appchains to L2s
  • Bitcoin decentralized bridges
    • Bitcoin <> BVM bridge
    • Bitcoin <> Ethereum bridge [WIP]
    • Bitcoin <> Solana bridge [WIP]
  • bvm studio
    • Overview
    • Build a Bitcoin L2
    • Monitor a Bitcoin L2
    • Scale a Bitcoin L2
    • Building blocks
  • bitcoin heartbeats
    • Overview
    • Chain heartbeats
      • Key metrics
      • Bitcoin's 5 levels of scalability
    • Wallet heartbeats [WIP]
    • Dapp heartbeats [WIP]
  • bitcoin api
    • RaaS API
    • Chain API [WIP]
  • bitcoin dapps
    • Overview
    • EVM code tutorials
      • Build a Bitcoin Name System
      • Build an Ordinals alternative
      • BFS: Build an IPFS alternative
      • Decentralized AI
      • Auction
      • Decentralized Discord
      • Fully onchain Tic-Tac-Toe
      • BRC-721: NFTs
      • Operate your project using a DAO
      • Raise funds through a Crowdsale
      • Issue your own governance token
    • SVM code tutorials [WIP]
Powered by GitBook
On this page
  • Write the governance token issuance smart contract
  • Clone the smart contract examples
  • Compile and Deploy the contracts
  • Interact with the contracts
  1. bitcoin dapps
  2. EVM code tutorials

Issue your own governance token

PreviousRaise funds through a CrowdsaleNextSVM code tutorials [WIP]

Last updated 9 months ago

Once your ZK rollup on Bitcoin is up and running, it's common to issue a governance token that can be used for raising funds for future projects and for governing your project's activities as a DAO.

Since your ZK Rollup is EVM-compatible, dApps should be written in Solidity. If you are new to this programming language, please learn more about it .

The total amount of tokens in circulation can be set to a simple fixed amount or fluctuate based on any programmed ruleset.

Write the governance token issuance smart contract

Extending the OpenZeppelin ERC-20 contract, we create a governance token (BIT) for your Layer 2 on Bitcoin.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract Bitswap is ERC20 {
    constructor(uint256 initialSupply) ERC20("Bitswap", "BIT") {
        _mint(msg.sender, initialSupply);
    }
}

Clone the smart contract examples

We've prepared a few different examples for you to get started.

git clone https://github.com/trustlesscomputer/smart-contract-examples.git

Compile and Deploy the contracts

Interact with the contracts

Once the contracts are deployed, you can interact with them. We've prepared a few hardhat tasks to make it easy for you to interact with the contracts.

npx hardhat balanceERC20
npx hardhat transferERC20 --from <your-address> --amount <transfer-amount> --to <your-address>

Refer to the .

here
tutorial