rust-cargosolanaanchor-solanasolana-cli

Difference between `cargo build` , `cargo build-bpf` and `cargo build-sbf`


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?


Solution

  • 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