Skip to content

Repository files navigation

Bitcoin Computer

Bitcoin Computer

npm version License: MIT GitHub stars

Turing-complete smart contracts on UTXO chains, written in JavaScript
website · docs · telegram

Objects live in UTXOs. Ownership is as strong as holding bitcoin. No sidechains. No extra tokens. No trusted intermediaries. Computation cost is independent of the number of steps.

Write normal JavaScript/TypeScript classes. Calling a method that changes state automatically builds, funds, signs and broadcasts a real transaction on a UTXO chain.

Supported chains: Bitcoin · Litecoin · Dogecoin · Pepecoin

Why Bitcoin Computer?

  • Native UTXO ownership — Smart objects are stored in outputs. Only the owner can update them.
  • Cost independent of computational complexity — All logic runs on the client. You pay for the size of the metadata, not for the number of computational steps.
  • Real JavaScript — No new language or virtual machine. Use the tools and libraries you already know.
  • Multichain by design — The same contract code runs on Bitcoin, Litecoin, Dogecoin and Pepecoin.
  • Perfectly sharded — Users only compute the objects they care about. There is no global state execution.
  • Composable — Objects can freely reference each other (with explicit ownership consent).
  • Compatible — Works alongside Ordinals, Runes, BitVM and other Bitcoin protocols.

Quick Example

You need to have node.js installed. First download and install the Bitcoin Computer library from npm:

# Create packages.json file
npm init -y

# Install library
npm install @bitcoin-computer/lib

Then create a file index.mjs.

import { Computer, Contract } from "@bitcoin-computer/lib";

class Counter extends Contract {
  constructor() {
    super({ n: 0 });
  }
  inc() {
    this.n += 1;
  }
}

// Connects to the public Litecoin regtest node
const computer = new Computer({ chain: "LTC", network: "regtest" });
await computer.faucet(1e5);

const counter = await computer.new(Counter);
await counter.inc();

console.log(counter);
// → Counter { n: 1, _id: "...", _rev: "...", _root: "...", _satoshis: <dust>, _owners: [...] }

Execute the smart contract.

node index.mjs

The expected output is:

Counter {
  n: 1,
  _id: <transaction id>:<output number>,
  _rev: <transaction id>:<output number>,
  _root: <transaction id>:<output number>,
  _satoshis: 7860n,
  _owners: [<string encoding of public key>]
}

Getting Started

Full setup instructions (browser, Node, local node, templates):

docs.bitcoincomputer.io/start

Live Demos

  • Wallet — Non-custodial wallet with smart object support
  • Explorer — Block explorer that understands smart contracts
  • NFT App — Mint, send and view non-fungible tokens

Monorepo Structure

Core

Package Description
@bitcoin-computer/lib Main client library — smart contracts, evaluation, wallet helpers
@bitcoin-computer/node Indexer + REST API server (the “Bitcoin Computer Node”)
@bitcoin-computer/nakamotojs Low-level transaction building and parsing

Applications

Package Description
wallet Non-custodial wallet
explorer Blockchain explorer with smart-object support
chat P2P chat over Bitcoin / Litecoin
nft Non-fungible token application

Standard Contracts

Package Description
TBC20 Fungible token standard (ERC-20 equivalent)
TBC721 Non-fungible token standard (ERC-721 equivalent)
TBC777 Programmable escrow token standard (similar to ERC-777)
swap Atomic swap and sale contracts

Templates & Docs

How It Works (High Level)

  1. You define a class C that extends Contract.
  2. c = await computer.new(C, args) evaluates the constructor inside a secure SES compartment and creates a transaction whose outputs represent the new objects.
  3. Calling a method on c that mutates state creates another transaction. The previous revision is spent and a new revision is created.
  4. The library maintains a partially-persistent object graph (node-copying method) so that history is efficient and concurrent evaluation is safe.
  5. Dual-layer security proxies prevent unauthorized mutation outside of a transition. Only the methods you defined can change state.
  6. Contracts can safely read chain state through a restricted InnerComputer API.

For the full technical design see the documentation.

Community

Contributions are welcome. See the contributing guidelines in the individual packages.

License & Legal

This software is licensed under the MIT License. See LICENSE.md.

The software includes patented technology (U.S. Patent Nos. 11,188,911 and 11,694,197 and related family members).
The patented technology is currently available under free open terms for all uses. BCDB Inc. reserves the right to introduce paid commercial licensing terms in the future. Transactions created before 2026-06-15 are grandfathered.

When using direct on-chain storage, transactions include minimal technical dust required by the Bitcoin protocol plus a small amount for UTXO hygiene. See LEGAL.md and the Fees documentation for full details.

For alternative licensing inquiries contact clemens@bitcoincomputer.io.


Questions? Join the Telegram.

About

A Turing-Complete Metaprotocol for Bitcoin, Litecoin and other UTXO Based Blockchains

Topics

Resources

Stars

47 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages