JavaScript Smart Contracts on Bitcoin.

A Turing-complete metaprotocol for UTXO-based blockchains.

Runs on Bitcoin, Litecoin, Dogecoin, Pepecoin. Bitcoin Cash soon.

index.html
<html>
  <head>
    <script type="module">
      import { Computer, Contract }
        from 'https://unpkg.com/@bitcoin-computer/lib/dist/bc-lib.browser.min.mjs'

      // A smart contract
      class Counter extends Contract {
        constructor() { super({ n: 0 }) }
        inc() { this.n += 1 }
      }

      // Create and fund a wallet on testnet
      const computer = new Computer()
      await computer.faucet(1e5)

      // Create and update an on-chain object
      const counter = await computer.new(Counter);
      document.getElementById("count").innerHTML = counter.n;
      await counter.inc(); // Update
      document.getElementById("count").innerHTML = counter.n;
    </script>
  </head>
  <body>
    <span style="font-size:200px" id="count">*</span>
  </body>
</html>

Save this as a file and open it in a browser. That is a smart contract running on testnet.

Full walkthrough

Try It in the Playground.

The Counter from the code above becomes an object on testnet. Calling inc() changes its value.

Open the playground
Loading the playground
The Bitcoin Computer playground with the Counter smart contract ready to load

The editor works best on a bigger screen. Tap the picture to open the playground.

  1. Sign In

    Click Sign in, then Log In to create an in-browser wallet.

  2. Fund the Wallet

    The wallet starts empty. Click on Wallet, then on Fund from faucet to add free testnet coins.

  3. Create the Counter, Then Update It

    Scroll down and click Create object. Open the object, and call inc() with Call method.

Five Things Already Running on It.

All open source. Clone any of them and ship your own.

Order-book exchange showing new sell and buy orders and open order tables

An Order-Book Exchange on Bitcoin

Ethereum exchanges use automated market makers, not because they trade better but because a real order book needs more compute than the chain can afford. On Bitcoin Computer the order book runs as a smart contract. That makes order books, the best trading algorithm there is, available to decentralized exchanges for the first time, with high capital efficiency.

Chess game showing a board, move history and a balance in Litecoin

Chess for Money

Two players put coins down. The winner takes them at the end of the game. Checking whether a chess position is winning takes more compute than an entire Ethereum block allows. On Bitcoin Computer it is a 1ms computation on the user's device.

NFT gallery with artworks stored on-chain

A Bitcoin-Only NFT Site

Mint NFTs and store the metadata or the artwork itself on-chain. Clone the repo, add your branding, and launch your own trading site.

Block explorer with a code editor for creating smart objects

A Block Explorer You Can Write To

Browse smart objects on Bitcoin, create new ones, and update any object you own by calling a method on it.

Non-custodial wallet showing a Litecoin balance, a send form and recent transactions

A Non-Custodial Wallet for Coins and Assets

Holds your money and your on-chain assets across Bitcoin, Litecoin, Dogecoin, Bitcoin Cash and Pepecoin. Wallet developers can add the same support to their own product.

No Bridge.No New Chain.No New Language.

No Middlemen That Hold Your Coins

With a Bridge You Send coin Bridge Locks Bitcoin The bridge's key controls your coin Bitcoin Computer You Sign with your key Bitcoin Your key controls your coin
A bridge adds a hop that holds your coin. Bitcoin Computer has none.

Most ways to run smart contracts on Bitcoin use a separate chain joined to Bitcoin by a bridge. Your coins typically move to an address that middlemen control. Bitcoin Computer runs directly on Bitcoin and Bitcoin-like chains. The coin that carries your object stays under your key, and its code and every call made to it are written into ordinary transactions. There is no bridge, no custodian, and nobody who can switch it off.

Fees Stay Flat No Matter How Much the Contract Computes

Fee 1 1,000 1,000,000 Computational steps Account model Bitcoin Computer inc() 4,122 sats big() 4,122 sats inc(): 1 step, 4,122 sats big(): 1,000,000 steps, 4,122 sats
Bitcoin Computer, measured on testnetAccount model, where every step is charged

Only the people who use a contract run its code, not every validator on the network. The fee pays for the bytes a transaction takes up, not for the work inside it, so a call that runs a million steps costs the same as a call that runs one. On an account-model chain every validator would run all million steps and charge for each.

CallStepsFeeTransaction
inc()14,122 satsf864a813…e878
big()1,000,0004,122 sats21b2bfcf…2ad3

Both transactions are 626 bytes. The second one took the counter from 1 to 1,000,001. See the object.

Your Data Is as Hard to Change as Your Coins

Your Bitcoin BTC 0.5 BTC Your key Tries to spend it Rejected Anyone else Your Data n:3 Your object Your key Tries to change it Rejected Anyone else
Same kind of coin, same key, same rule. Miners enforce both.

A smart object is carried by a coin, an unspent transaction output with a small amount in it. Updating the object means spending that output and creating a new one for the next version, which takes the owner's private key. So changing someone else's data is exactly as hard as stealing their Bitcoin, and miners enforce it.

Every Version Is Kept, Signed and Timestamped

VersionnConfirmedTransaction
1017 Sep 20264d4fcd51…c1c1
2117 Sep 2026cc79fb09…6bb3
3217 Sep 2026f1e64b1d…385c
4317 Sep 2026c5892dd4…2528

All four were confirmed at 05:44 UTC in block 657 of the test network. See the object in the explorer.

Every update is a new transaction, and the old ones stay on the chain, signed and timestamped. The table above is a real Counter on the test network: four revisions, each one a transaction you can open in the explorer.

Your Normal Tools

Your IDE, your package manager, your linter and your test runner all work as they do for any web project.

Browser and Node.js

Contracts run in modern JavaScript engines, so you get their speed and their security work for free.

Built-In Encryption

Keep user data private with encryption that is part of the library, not something you bolt on.

On-Chain or Off-Chain Storage

Put data where it belongs. Games, DeFi and digital assets each need a different mix.

Compatible with Runes and Ordinals

Fungible and non-fungible tokens work alongside the protocols people already use.

GDPR and CCPA

Designed from the start so that meeting privacy law is not a retrofit.

What People Build with It.

Games

Monetize player-to-player payments, tournaments, levels, items and achievements without ever holding player funds.

Runes and Ordinals Apps

Build fungible and non-fungible token applications that stay compatible with the protocols people already trade on.

DeFi

Exchanges, lending platforms and stablecoins, built on real order books instead of automated market makers.

Shared Data Between Organizations

Keep records synchronized across companies with a signed history of every change, and skip the manual reconciliation.

Need a Team to Build It?

MetaRune Labs is the official development partner. They have shipped several applications on Bitcoin Computer and know the platform well. Tell us what you want to build and we will make the introduction.

Where the Project Lives

Build Your First JavaScript Smart Contract In Your Browser