Bitcoin Precompiles
Overview
A blockchain precompile refers to a set of special, pre-defined functions built into the native blockchain client software. These precompiles are available to blockchain developers via smart contract calls and can be used for a variety of use cases.
The common use case for these features in an EVM execution clients is to perform complex cryptographic operations such as hashing, digital signature verification, and mathematical operations.
On Sova we have created our own set of "Bitcoin precompiles". These precompiles have the ability to interact with the Bitcoin network via and rpc connection to a full Bitcoin node. Every node connected to the Sova Network is responsible for running a full Bitcoin node for the purpose of validating the chain and also broadcasting Bitcoin transactions if necessary.
You can think of a precompile as a "pre-deployed" contract on the Sova blockchain. Precompiles are special in that at the genesis of the chain, the 'contract logic' is already apart of every validator. Our Bitcoin precompile 'contract' allows Solidity developers to integrate directly with a Bitcoin node.
Technical Details
Essentially a precompile is a "predeployed" contract on the Sova blockchain and at the genesis of the chain, the precompile is apart of every validator. Each precompile address accepts a bytes payload consisting of a 4-byte method identifier followed by additional data required for the specific Bitcoin action.
sendrawtransaction
0x999
Signed raw transaction data
Sends a raw Bitcoin transaction
decoderawtransaction
0x998
Signed raw transaction data
Decode a raw Bitcoin transaction
convertaddress
0x998
EVM address
Converts a Sova address to corresponding BTC address
createandsignrawtransaction
0x996
Caller, withdrawal amount, BTC gas Limit, BTC block height
Create and sign a BTC transaction using network keys
Smart Contracts
When writing smart contracts for the Sova Network you can import SovaNetwork/contracts as a dependency in your smart contract:
import {SovaBitcoin} from "@sova-network/src/lib/SovaBitcoin.sol";
Last updated