brc20-prog 0.16.6

BRC20 programmable module - Smart contract execution engine compatible with BRC20 standard
docs.rs failed to build brc20-prog-0.16.6
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: brc20-prog-0.16.4

BRC2.0

Join us: Discord / Telegram

BRC2.0 programmable module provides smart contract execution capabilities for BRC20 indexers.

This module allows users to inscribe smart contracts and function calls on Bitcoin blockchain to implement decentralised applications.

BRC2.0 runs on a custom EVM execution engine using revm. Our main reasons for choosing EVM are listed below:

  • Rich open-source ecosystem for tooling, including several different execution engines
  • Heavily tested open-source smart contract libraries that are readily available for various financial applications
  • Large and active developer community - many smart contract developers are already familiar with EVM and Solidity
  • EVM is deterministic and Turing complete.

See our proposal at bestinslot-xyz/brc20-prog-module-proposal for detailed information about how the BRC2.0 programmable module works.

See the Indexer Integration Guide on how to integrate the programmable module your BRC20 indexer.

For questions, comments and requests, use the issues section or Best in Slot discord server.

[!NOTE] This module is enabled on Bitcoin mainnet.

Usage

BRC2.0 Programmable Module is written in Rust, so you need Cargo installed in order to build and run the server.

Precompiled contracts require environment variables to work properly, see Configuration and Precompiles to learn how to set them up, otherwise precompiled contracts will fail.

Build and run brc20_prog:

cargo run --release

[!NOTE] You must use clang as CC. Try installing clang sudo apt install clang before running brc20_prog.

Eg. CC=/usr/bin/clang CXX=/usr/bin/clang++. Clang llvm version must be the same as the one used by rust compiler. On the rust side you should use RUSTFLAGS="-Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld".

Run with Docker:

A prebuilt image is published to Docker Hub as bestinslot/brc20-prog. Image tags track release versions (e.g. bestinslot/brc20-prog:0.16.0), with latest pointing at the newest release.

docker run --rm \
  -p 18545:18545 \
  -v brc20_prog_data:/var/lib/brc20-prog/data \
  --env-file .env \
  bestinslot/brc20-prog:latest

The image binds the JSON-RPC server to 0.0.0.0:18545 and stores its database under /var/lib/brc20-prog/data (mount a volume there to persist it). All other configuration is provided through environment variables, see env.sample and Configuration. Note that BITCOIN_RPC_URL must point at a Bitcoin RPC endpoint reachable from inside the container.

To build the image from source instead, run docker build -t brc20-prog . from the repository root.

Embed in an indexer:

An indexer written in Rust can run the module in its own process instead of calling it over JSON-RPC. See Embedding in an indexer.

Configuration

The server is configured through environment variables, and loads a .env file from the working directory. Start from env.sample; every variable, its default, authorization and the admin RPC listener are described in Configuration.

Documentation

License

Licensed under the Apache License, Version 2.0. See NOTICE.