CKB Pulse

All lessons · Rust scripts and ckb-std · Start here · Glossary

Enable molecule bytes_vec so ckb-std scripts contain no atomic instructionsWorkingChecked by the owner

Checked by the owner · Check: right · Checked 2026-11-19

With ckb-std 0.16, molecule's default Bytes uses the external bytes crate, which emits lr.d/sc.d atomic instructions that the CKB VM rejects, so the built lock script was not executable on chain. Adding molecule 0.8 with default-features = false and features = ["bytes_vec"] to the script crate makes feature unification swap in molecule's Vec-backed Bytes, and the commit reports the artifact then had zero atomic instructions.

Why it matters: Without the bytes_vec feature, the external bytes crate's atomic refcounting compiles into the RISC-V script, so the CKB VM cannot execute the deployed script and cells locked by it cannot be unlocked on chain.

Pattern

Prefer
molecule = { version = "0.8", default-features = false, features = ["bytes_vec"] }

Taken from the commit, shortened.

A test changed in the same commit

It sits next to the fix. We did not run it.

Concepts
Other
Evidence
Checked by the owner: checked by the owner of the project it came from, who is also the publisher of these lessons
First seen
2026-09-30
Last changed
2026-10-22
Last checked
2026-11-19
Check against the commit
right: the lesson follows from its commit and still holds in the code today

Sources (2)

More about Rust scripts and ckb-std

All 35 in this topic

Checked by @LusoCryptoLabs (owner of the project), 2026-11-19.

Do you maintain a project this lesson came from? Confirm or correct it

Cite this lesson
LusoCryptoLabs, "Enable molecule bytes_vec so ckb-std scripts contain no atomic instructions", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/enable-molecule-bytes-vec-so-ckb-std-scripts-contain-no-atom, CC BY 4.0, last changed 2026-10-22.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.