How Note Protocol Enables Native Smart Contracts on Bitcoin

Note Nation
Coinmonks
3 min readJun 23, 2024

--

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

Contributors and Technical Expertise

The primary contributors to Note Protocol are active members of the BSV community and are highly skilled, with the second-highest code contributions to the sCrypt programming language (ranking first among non-official contributors). Their expertise is evident in the high level of completion of their product.

Detailed Explanation of Note Protocol

In the latest article by the code contributors (https://noteprotocol.org/zh/docs/tutorial/basic/), the operational process and fundamental logic of Note Protocol are described in detail:

As illustrated above, Note Protocol ingeniously uses engineering methods to ensure the security of users’ funds through simple or complex Bitcoin on-chain contracts, obtaining user authorization for operations, then executing off-chain contracts driven by the indexer virtual machine, and finally outputting the results and constructing a Merkle tree locally. Note Protocol’s n20 assets bind the user’s address UTXO, ensuring the entire process is reproducible and verifiable. The security of user funds and the execution results are guaranteed by cryptography and the Bitcoin blockchain. The first usable public version of Note Protocol was completed as early as February 2024, making it the first and only usable Bitcoin-native smart contract protocol on the market.

Programming Language and Framework of Note Protocol

Note Protocol uses TypeScript as its programming language. TypeScript is a high-level programming language that allows developers to easily create Bitcoin smart contracts. The runtime framework for Note Protocol is provided by sCrypt, which offers a Bitcoin smart contract virtual machine (BVM) and an integrated development environment (IDE) for developers. Below is an example of a smart contract that describes a token contract whose issuance is continuously halved based on the amount issued and block time:

Storage and Execution of On-Chain and Off-Chain Contracts

Note Protocol includes two types of contracts: on-chain contracts and off-chain contracts. The first type is the on-chain contract, which, by generating a 1KB Bitcoin script, allows the indexer to call and verify transactions to ensure they comply with protocol rules and safeguard user funds. The second type is the developer-written off-chain application smart contract, which can be stored in the segregated witness section of the Bitcoin blockchain (or elsewhere) as long as it does not exceed the 4MB block size limit. The storage and spending of core user funds are locked and unlocked by Bitcoin on-chain contracts, with the security of user funds guaranteed by the Bitcoin blockchain, making the entire process verifiable. Both on-chain and off-chain contracts in Note Protocol can be stored on the Bitcoin blockchain, and the indexer executes contracts by observing Bitcoin blocks. For large contracts, developers can choose to store oversized off-chain contracts on other blockchains such as RXD or BSV.

Ecosystem (as of June 2024)

The Note Protocol community ecosystem is flourishing. As of June 2024, the community has completed a graphical wallet (ChainBow 3 Test Version https://chainbow.io/), a command-line wallet (https://github.com/NoteProtocol/NoteWallet), a block explorer (https://explorer.noteprotocol.org), an N20 trading market, and a browser plugin wallet (https://alpha.notemarket.io/). A DEX (decentralized exchange) developed by major code contributors is also about to be released. The official website’s tutorials on smart contract development and deployment are continually being updated. In terms of user growth, there are over 3,000 on-chain user addresses on Note Protocol, with more than 2,000 non-zero balance addresses.

About This Article

This article was written by Note Protocol community enthusiast Alex L (https://twitter.com/0xAlex_Crypto) based on existing information and code. If there are any errors, corrections are welcome. This article is open for reprinting; please indicate the author, source, and original link.

--

--