Bitcoin Computer

A Javascript smart contract library for Bitcoin

Javascript Smart Contracts on Bitcoin

The Bitcoin Computer is a Turing complete layer-1 smart contract system for Bitcoin. It enables NFTs, fungible tokens, auctions, exchange, stable coins, chat, games, business applications, social networks on Bitcoin.

Simplified Application Development

Smart contract development on the Bitcoin Computer is (almost) as easy as web development as smart contracts can be written in Javascript and Typescript. Javascript objects can be stored on the blockchain instead of in a database so that applications can be developed without a backend. Most importantly, multiple users can interact with the same object which enables smart contracts secured by the byzantine fault tolerant consensus of Bitcoin.

Secure and Efficient Execution

Smart contracts on the Bitcoin Computer are evaluated by users as opposed to by miners. Both techniques are equally secure but there is a big difference in cost: miner validated smart contracts are charged per computational step whereas user validated smart contracts are charged by the size of the parameters in the constructor and function calls. This is much cheaper and makes it possible to run compute-intensive smart contracts on Bitcoin.

Freedom and Flexibility

Bitcoin Computer works on BitcoinSV and Bitcoin Cash and we are working on supporting more blockchains. We let you decide which cryptocurrency community to launch your product into as well as giving you the ability to build powerful multi currency applications.

How it works

Bitcoin Computer is a Javascript Bitcoin wallet that can generate special Javascript objects called smart objects. The difference between a normal object and a smart object is that the former is stored in the cells of local memory whereas the latter is stored in unspent outputs of Bitcoin transactions.

A new smart object can be created using the Bitcoin Computer library from a Javascript class and the parameters to the constructor. The creation of a smart object is recorded in unspent outputs on the blockchain. Each unspent output created corresponds to a cell that is allocated when the same object is created in memory

A smart object can be updated by calling one of its functions. Such an update is recorded in a transaction that spends the unspent outputs storing the old state and creating new outputs that represent the new state. This is reminiscent of updating the cells of local memory. The difference is that the history of a smart object is preserved in an audit trail on the blockchain. This makes it possible to see every previous state of a smart object.

Summing up, a smart object is exactly like a normal object but it is stored on the blockchain. The advantages of being stored on the blockchain are:

  • The blockchain is a persistent storage device. The objects created on the blockchain remain available after the computation terminates. This makes it easy to build serverless applications.

  • Bitcoin provides strong consensus. This allows multiple users to sync to the same smart object. If a user updates a smart object then the change propagates to all other synced users within a few seconds.

  • Unlike databases, blockchains are immutable. This does not mean that data cannot be updated, to the contrary, it means that a smart object is a persistent data structure that preserves all its previous states.

  • Bitcoin script provides fine-grained control over who may update which part of the blockchain. This introduces a natural notion of data ownership where only a distinguished user, called the owner, can update a smart object. The owner is not fixed and a new owner can be assigned when a smart object is updated.

  • Blockchains can store money in addition to data. Thus every smart object can store an amount of satoshi that are kept just as secure as the cryptocurrency in your Bitcoin wallet.

Download from NPM

https://www.npmjs.com/package/bitcoin-computer