2

Here is sp_consensus_babe https://releases.parity.io/substrate-rustdoc/src/sp_consensus_babe/lib.rs.html#86 and pallet_babe :https://crates.parity.io/src/pallet_babe/lib.rs.html#18-975

What is difference between them and when to use each of them?

1 Answer 1

2

The first part of sp-consensus-babe sp stands for substrate primitives, meaning packages that usually includes elements providing the foundational structures and functionalities.

In this case, sp-consensus-babe is a crate that is used by the BABE pallet.

You might use BABE pallet when you want to include such a pallet in your runtime (blockchain) because you want your blockchain to produce blocks following the BABE block production mechanism.

You might use primitives from sp-consensus-babe in a context where you are building a crate or some code, and you might need the primitives existing there. Just including it in the Cargo.toml file, as others do, should be enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.