Bitcoin Virtual Machine #0
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: https://github.com/TrustlessComputer/trustless-node-easy
Manual Setup
Install Bitcoin Core
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
:
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 download page.
Start your Bitcoin Virtual Machine #0:
If you set up your Bitcoin full node with a username and password, add those parameters.
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
Setup Bitcoin Virtual Machine #0 Explorer
Bitcoin Virtual Machine reuses Blockscout for blockchain exploration data such as blocks, transactions, and addresses.
Launch Bitcoin Virtual Machine #0 Explorer:
Open this URL on your browser:
Setup a development environment
There are many different tools for smart contract development. For this developer guide, we use Hardhat, but you're free to use a different tool.
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:
You can check the balance with:
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.
You can check your BVM balance on MetaMask.
Last updated