1

I am new to blockchain and I am using solana/anchor/cargo/rust to build a project. I am confused about these commands. What is the difference between cargo build, cargo build-bpf and cargo build-sbf?

Inaara Kalani
  • 265
  • 7
  • 24

1 Answers1

7

cargo build - Unless otherwise directed to build for a different architecture, this will compile your rust source and emit an executable file.

cargo build-bpf - Solana programs (smart contracts) are compiled to BPF (google it) bytecode. The Solana program run-time executes your smart contract in a BPF VM. deprecated in favor of:

cargo build-sbf - More comprehensive implementation of generated byte-code and interpreter

Frank C.
  • 7,758
  • 4
  • 35
  • 45
  • Is there a reference in the Solana GitHub repo for the difference between `cargo build-bpf` and `cargo build-sbf`? More comprehensive implementation is a bit ambiguous. – asdragnea Jul 25 '23 at 15:56