Skip to content

halseth/elftrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitcoin Elftrace

Verify RISC-V binary execution in Bitcoin script.

What is this?

Bitcoin Elftrace is a proof of concept tool used to trace the execution of RISCV-32 binaries (ELFs), and generate Bitcoin script that can be used to verify this execution on-chain.

How do I use it?

See the compilation doc for an example of how to trace a RISC-V binary, or the ZK verification example for how to write a STARK verifier in Rust that can be traced.

What is this useful for?

Using this you can use your favourite language to write arbitrary programs that can be verified on Bitcoin. Paired with the "optimistic execution" smart contracting paradigm, this opens up the possibility for Bitcoin smart contracts to be arbitrary complex while still keeping the on-chain footprint low.

What is optimistic execution?

The idea is to write your UTXO smart contracts in a way that gives any spender the incentive to act honestly. If someone tries to spend the UTXO with an improper execution of the contract, they can be punished efficiently using a fraud proof.

How can I use elftrace to write Bitcoin smart contracts?

elftrace only (currently) generates the scripts needed to validate the program execution. You will need to wrap the program in a "MATT challenge" style script in order to set up a proper smart contract. See mattlab for an example.

Are there any limitations?

This is very much in a POC stage. Here's a non-exhaustive list of known issues/TODOs:

  • CScriptNum is used when doing operations on address locations and various other operations. This can fail if numbers exceed 31-bit.
  • RISC-V opcodes SLTI, LB, SLT, SRA currently not implemented.

When can I use this on mainnet?

In order to use this on mainnet we would need to deploy a covenant opcode. elftrace is based on the OP_CHECKCONTRACTVERIFY opcode proposed by MATT.

Come join us in getting covenants deployed on Bitcoin! 🤠

What does this enable on Bitcoin?

Having a covenant deployed on bitcoin would enable us to use this to create trustless two-way pegs, rollups, ZK verifiers... in general much more flexible ways of handing custody of coins to an on-chain computer program.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages