Issue your own governance token

Once your Layer 2 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.
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

Compile the contracts

To compile your contracts, use the built-in hardhat compile task.
cd smart-contract-examples
npm install
npx hardhat compile

Deploy the contracts

Review config file hardhat.config.ts. The network configs should look like this.
networks: {
mynw: {
url: "<your layer 2's RPC url>",
accounts: {
mnemonic: "<your mnemonic with funds>"
timeout: 100_000,
blockscoutVerify: {
blockscoutURL: "<your layer 2's explorer url>",
Run the deploy scripts using hardhat-deploy.
npx hardhat deploy --tags ERC20
Make sure the accounts in hardhat.config.ts have some TC in your Layer 2 that are bridged from Bitcoin Virtual Machine Layer 1.

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>