Bitcoin Precompiles
What is a Precompile?
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.
Overview
On the Sova network, all Bitcoin precompiles are located at address 0x0000000000000000000000000000000000000999
. This address accepts a bytes payload consisting of a 4-byte method identifier followed by any additional data required for the specific Bitcoin action.
Additionally, import https://github.com/SovaNetwork/contracts to import and use these precompiles in your solidity contracts.
Available Precompiles
sendrawtransaction
0x00000001
Signed raw transaction data
Sends a raw Bitcoin transaction
decoderawtransaction
0x00000002
Signed raw transaction data
Decode a raw Bitcoin transaction
verifysignature
0x00000003
Signed raw transaction data
Verifies the unlocking scripts in a signed transaction
convertaddress
0x00000004
EVM address
Converts a Sova address to corresponding BTC address
createandsignrawtransaction
0x00000005
See decoding scheme for input data structure
Create and sign a BTC transaction using network keys
Usage
For Foundry users, one way to interact with the precompile is to use cast. Below are examples for each precompile call using cast. Another way is to import SovaNetwork/contracts
as a dependency in your smart contract.
sendrawtransaction
decoderawtransaction
verifysignature
convertaddress
createandsignrawtransaction
Last updated