Build an Ordinals alternative
Let's implement a simplified version of the Ordinals Protocol from scratch with Bitcoin Virtual Machine.
create an inscription
retrieve an inscription
send an inscription
buy and sell inscriptions
Write an Ordinals Protocol smart contract
It turns out that writing an Ordinals Protocol smart contract is very simple; all it is is a file storage system inside the Bitcoin network. Here is a basic contract to provide an Ordinals-like inscription system on Bitcoin Virtual Machine.
Extending ERC-721, we only need to implement the inscribe()
function to create an inscription as an NFT. Sending and receiving an inscription is now as simple as sending and receiving an NFT. You can also trade the inscription on open markets since it's an ERC-721.
Clone the smart contract examples
We've prepared a few different examples for you to get started. The Ordinal Theory example is located at smart-contract-examples/contracts/Ordinals.sol.
Compile the contracts
To compile your contracts, use the built-in hardhat compile
task.
Deploy the contracts
Review config file hardhat.config.ts
. The network configs should look like this.
Run the deploy scripts using hardhat-deploy
.
Make sure the accounts in hardhat.config.ts have some $BVM.
Interact with the contracts
Once the contracts are deployed, you can interact with them. We've prepared a few hardhat tasks
to make it easy for you to interact with the contracts.
Last updated