Why Does Bitcoin Need Smart Contracts?

Note Nation
Coinmonks
5 min readJul 13, 2024

--

Bitcoin has revolutionized traditional concepts of currency and transactions. While primarily used as a decentralized digital currency, the underlying blockchain technology of Bitcoin holds vast potential. Smart contracts are self-executing agreements embedded in the blockchain through computer code. When specific conditions are met, smart contracts automatically execute the corresponding actions without the need for third-party intervention. However, Bitcoin’s built-in script (Bitcoin Script) has several major limitations, including:

  1. Simplicity of Bitcoin Script Language: Bitcoin Script is very basic, containing only fundamental opcodes. These opcodes can implement simple logic and conditions but cannot handle complex smart contract logic.
  2. Lack of State Storage: Bitcoin Script does not have built-in state storage mechanisms, meaning it cannot maintain a state tree to record contract state changes like Ethereum. This limits Bitcoin Script’s ability to implement complex contracts.
  3. Resource Constraints: To prevent script attacks that consume excessive resources, the Bitcoin network imposes strict limits on the size and execution steps of scripts. This means complex contracts may not be executable on the Bitcoin network.

As a result, smart contracts on Bitcoin have not been widely adopted for a long time. However, the programmability brought by smart contracts can enhance Bitcoin’s application scenarios and functionalities, including:

  1. Enhanced Functionality: Introducing smart contracts can support more complex transactions and application scenarios such as decentralized finance (DeFi), non-fungible tokens (NFTs), and supply chain management.
  2. Increased Efficiency: Many transactions require third-party intermediaries, increasing costs and potential delays. Smart contracts automatically execute transactions under predefined conditions, eliminating the need for third parties, significantly increasing transaction efficiency, and reducing costs.
  3. Support for Innovation: Smart contracts can foster many new applications and business models. For example, introducing smart contracts to the Bitcoin network can enable decentralized autonomous organizations (DAOs), decentralized exchanges (DEXs), and more innovative decentralized applications (DApps). These innovations can enrich the Bitcoin ecosystem, attract more developers and users, and drive further development of Bitcoin.

The Solution Brought by Note Protocol

Note Protocol (https://noteprotocol.org/) is a Bitcoin-native smart contract protocol that combines Bitcoin’s native script functions (Opcodes), off-chain smart contracts, the sCrypt programming language, and the BVM virtual machine. Note Protocol brings advanced smart contract functionality and complete programmability to Bitcoin.

Note Protocol cleverly employs engineering methods, using simple or complex Bitcoin on-chain contracts to ensure the security of user funds and obtain user authorization operations. Then, the on-chain contracts transfer to a virtual machine driven by an indexer to execute off-chain contracts. Finally, the results are outputted and a Merkle tree is constructed locally. Note Protocol’s n20 assets bind to the user’s address UTXO, and the entire process can be reproduced and verified. User funds’ security and execution results are jointly guaranteed by cryptography and the Bitcoin blockchain. Note Protocol completed its first usable public version as early as February 2024, making it the first and only usable Bitcoin-native smart contract protocol on the market.

Note Protocol is committed to building a robust ecosystem. As of July 2024, the community has completed the following ecosystem projects:

Wallet Software

  • NoteWallet: NoteWallet is an open-source command-line wallet that supports both BTC mainnet and testnet. It demonstrates functionalities such as contract code upload, contract deployment, token mining, and transaction transfers. Its code showcases many technical details of the NOTE protocol and serves as a minimalist Bitcoin wallet, supporting various address formats and illustrating the complete process from UTXO to transaction construction. #TypeScript #OpenSource
  • ChainBow Wallet: ChainBow Wallet is a smart mobile Bitcoin wallet app for iOS/Android, designed according to the BIP44 standard. It supports multiple cryptocurrencies, mainnet and testnet, allows multiple wallets creation within the app, and each wallet supports multiple addresses. The interface offers multiple languages including Chinese, Japanese, and English, with light and dark themes. The built-in DAPP browser is very powerful, and the app is currently in the testing phase. #iOS #Android #DApp
  • NOTE Market Wallet: NOTE Market Wallet is an open-source browser plugin wallet that supports Chrome/Firefox browsers. Its code is forked from the UniSat browser plugin wallet, maintaining consistent product quality and user experience. It supports BTC mainnet and testnet, allows multiple wallet creation, and supports DAPP. #Chrome#FireFox #DApp
  • pyNoteWallet: pyNoteWallet is a command-line wallet written in Python, compatible with the TypeScript version, making it easier for Python developers to understand the NOTE protocol and the Bitcoin transaction process. #Python #OpenSource

DEX Decentralized Exchanges

  • NoteMarket: NoteMarket is the first decentralized exchange market for the NOTE protocol, supporting BTC mainnet, allowing direct trading of NOTE UTXO from wallet addresses, and providing UTXO splitting functionality. #DEX
  • UtxoExchange: UtxoExchange is a decentralized Bitcoin exchange market supporting BTC mainnet and testnet, offering locked coin trading without affecting wallet usage, direct order posting without UTXO splitting, testnet token trading, and mining rewards for transactions, significantly reducing most transaction fees. #DEX
  • Satsx: The earliest trading website providing OTC trading for NOTE. #Discontinued

Blockchain Explorer

  • Explorer: Explorer is a blockchain explorer customized for the NOTE protocol. It allows users to view address balances, block heights, transaction statuses, and details. It supports both BTC mainnet and testnet. Besides being a regular balance query tool, it is an essential tool for developers. #BlockchainExplorer

Development Tools

  • sCrypt: sCrypt is an advanced Bitcoin smart contract language. Its compiler can compile into native Bitcoin opcodes. It provides necessary documentation, a VSCode plugin, and development and testing tools, with numerous code examples available on GitHub. The NOTE protocol uses it for off-chain contract development, eliminating the need to learn all the concepts. #Compiler #DevelopmentTools #Examples

Open Source Code Examples

  • scryptdemo: scryptdemo is the first contract code example, providing templates for development and testing. Developers can use it as a basis for their projects. #OpenSource #SmartContract
  • scrypt-verify: scrypt-verify is the off-chain contract verification code for the NOTE protocol. It is based on scryptlib and provides Satoshi Nakamoto’s original BVM for contract verification. #OpenSource #SmartContract

Data Services

  • UrChain: UrChain is a professional blockchain infrastructure platform providing data services for Bitcoin and other cryptocurrencies, supporting UTXO queries and transaction broadcasting. Through its API, it offers blockchain access for wallets and DEX services. It supports multiple cryptocurrencies and both mainnet and testnet. #Infura#DataServices

Projects

  • NOTE.SV: NOTE.SV is a password and encrypted note management software. It encrypts content according to the NOTE protocol and stores it on the blockchain. Each note is encrypted with a different private key, distributed across blockchain nodes worldwide, ensuring secure and permanent content storage. NOTE.SV was the earliest application of the NOTE protocol, with its design inspiring the protocol’s creation. #Application #RealWorld

Other Tools

  • Balance Inquiry: A token address balance inquiry tool. The unit of measurement is Zhang = 1000 tokens.
  • NoteMinter: NoteMinter is a dedicated tool for mining NOTE tokens, written in Go. #Go #OpenSource
  • Testnet One-Click Token Issuance: A testnet one-click token issuance website. Many testnet tokens have been deployed using this site. #Utility

--

--