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
  • Quick Setup
  • Manual Setup
  • Install Bitcoin Core
  • Install Bitcoin Virtual Machine #0
  • Add Bitcoin Virtual Machine #0 to MetaMask
  • Setup Bitcoin Virtual Machine #0 Explorer
  • Setup a development environment
  • Setup your BVM wallets
  1. L1 Scaling solutions
  2. Case studies [WIP]
  3. SHARD_BVM

Bitcoin Virtual Machine #0

PreviousSHARD_BVMNextSHARD_DA [WIP]

Last updated 11 months ago

Bitcoin Virtual Machine #0 is a special computer. It brings the EVM to Bitcoin and is as the base layer for other Bitcoin Virtual Machines to build upon.

This guide will show you how to run a Bitcoin Virtual Machine full node.

Quick Setup

Follow the guide in this repo for easy setup:

curl -s https://raw.githubusercontent.com/TrustlessComputer/trustless-node-easy/main/setup-mainnet.sh -o setup-trustless.sh
chmod +x setup-trustless.sh
sh ./setup-trustless.sh

Manual Setup

Install Bitcoin Core

provides both a Bitcoin full node and a wallet. Working with Bitcoin Virtual Machine #0 requires a Bitcoin full node with RPC enabled.

After installing Bitcoin Core, run bitcoind with -server=1 :

./bitcoind -server=1

It may take some time for your Bitcoin full node to be fully synced.

Install Bitcoin Virtual Machine #0

Bitcoin Virtual Machine #0 is a Turing-complete virtual machine. It is written in Go, and pre-built binaries are available on the .

After downloading the binary, run chmod +x <filename> to allow executable permission. On MacOS, you may also have to go to Privacy & Security to allow the file to run.

Start your Bitcoin Virtual Machine #0:

./tc -c <btc-node-cookie-file-path> -i <your-tc-address> # specify your Bitcoin Virtual Machine native address

If you set up your Bitcoin full node with a username and password, add those parameters.

./tc -u <btc-node-username> -p <btc-node-password> -i <your-tc-address>

Since Bitcoin Virtual Machine #0 reuses EVM, your BVM native address is similar to an Ethereum address. You can create a new BVM address with any EVM-compatible wallet. We recommend MetaMask.

Add Bitcoin Virtual Machine #0 to MetaMask

In MetaMask, click on Networks --> Add Network --> Add a network manually. Use the following settings to point MetaMask to the Bitcoin Virtual Machine running on your machine.

  • Name: Bitcoin Virtual Machine

  • URL: http://localhost:10002

  • ChainID: 22213

  • Symbol: TC

BVM is the native cryptocurrency of Bitcoin Virtual Machine. Similar to ETH, you can use BVM to pay transaction fees, deploy smart contracts, and spend in dapps.

Setup Bitcoin Virtual Machine #0 Explorer

Launch Bitcoin Virtual Machine #0 Explorer:

docker compose -f docker/docker-compose-blockscout.yml up

Open this URL on your browser:

http://0.0.0.0:4000

Setup a development environment

npm install --save-dev hardhat

Setup your BVM wallets

Your Bitcoin Virtual Machine #0 uses two wallets: a Bitcoin wallet and a native wallet. You need funds in both wallets in order to operate Bitcoin Virtual Machine #0.

Bitcoin wallet

A Bitcoin Core wallet named tc is automatically created by Bitcoin Virtual Machine #0. Because Bitcoin Virtual Machine #0 uses Bitcoin Core to manage private keys, sign transactions, and broadcast transactions to the Bitcoin network, your tc wallet will need some sats.

Get a new address from your tc wallet and send it some funds:

./bitcoin-cli -rpcwallet=tc -getnewaddress

You can check the balance with:

./bitcoin-cli -rpcwallet=tc getbalances

Native wallet

Since Bitcoin Virtual Machine #0 reuses EVM, your native address is similar to an Ethereum address. You can create a new native address with any EVM-compatible wallet. We recommend MetaMask.

You will need some TC, the cryptocurrency of Bitcoin Virtual Machine. Similar to ETH, you can use BVM to deploy smart contracts, pay transaction fees, and spend in dapps.

The native address is the same as the one that you use to run your Bitcoin Virtual Machine #0.

./tc -i <your-tc-address>

You can check your BVM balance on MetaMask.

Bitcoin Virtual Machine reuses for blockchain exploration data such as blocks, transactions, and addresses.

There are many different tools for smart contract development. For this developer guide, we use , but you're free to use a different tool.

If you're brand new to smart contracts, start with the .

https://github.com/TrustlessComputer/trustless-node-easy
Bitcoin Core
download page
Blockscout
Hardhat
Introduction to Smart Contracts