全部经验 · Rust scripts and ckb-std · 从这里开始 · 术语表
Molecule hash_type byte values实践来自一次修复
来自一次修复 · 核对结果:正确 · 核对于 2026-11-19
In the molecule Script encoding, hash_type is data=0, type=1, data1=2, data2=4; 3 is not a valid value. Using 2 where you meant data2 builds a valid data1 script with a different hash, so indexer queries on it return nothing. Assert the raw byte inside the encoded Script, or run against a real devnet, because mocks that reuse the same constant on both sides cannot catch it.
为什么重要: With data2 encoded as 2, the service built a data1 script that matched no cell, so its Node Cell query found nothing and every run reported dropped; the mock chain used the same constant on both sides and never caught it.
代码模式
const HASH_TYPE_DATA2: u8 = 2; // wrong, 2 is data1; correct value is 4- 概念
- Data encoding (molecule, hex, bigints), Indexer queries and cell collection, Testing and devnet
- 证据
- 来自一次修复: 来自一个项目,已对照其提交核对
- 首次出现
- 2026-11-15
- 最近改动
- 2026-11-15
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 正确:这条经验出自该提交,并且在今天的代码中仍然成立
来源(1)
- 2026-11-15 · psawyerberlin/ckb-revocable-timelock · 这个项目的更多经验
更多关于Rust scripts and ckb-std
- ckb-std C shim needs a RISC-V C toolchain (clang) in CI
- Median time vs tip timestamp for deadlines
- Use raw_data(), not as_slice(), when parsing a packed::Bytes witness
引用这条经验
LusoCryptoLabs, "Molecule hash_type byte values", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/molecule-hash-type-byte-values, CC BY 4.0, last changed 2026-11-15.