Todas as lições · Rust scripts and ckb-std · Começa aqui · Glossário
CKB blake160 is the first 20 bytes of the 32 byte ckbhashBásicoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
CKB blake160, used for lock args and pubkey hashes, is the first 20 bytes of the 32 byte blake2b digest personalized with "ckb-default-hash". A blake2b hasher configured with a 20 byte output length gives a different value, because the digest length is part of blake2b's parameter block. Always hash to 32 bytes and then truncate.
Porque importa: Lock args derived from a 20 byte blake2b digest do not match the pubkey hash that the secp256k1 blake160 lock checks, so cells sent to that lock cannot be unlocked.
Padrão
let mut hasher = blake2b_ref::Blake2bBuilder::new(20).personal(b"ckb-default-hash").build();Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- Tactus-Labs/tactus-o1:
crates/tactus-ordering-script/tests/hash_oracle.rs
- Conceitos
- Data encoding (molecule, hex, bigints), Witnesses and signatures
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-09
- Última mudança
- 2026-10-09
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-10-09 · Tactus-Labs/tactus-o1 · mais deste projeto
Mais sobre Rust scripts and ckb-std
- Use raw_data(), not as_slice(), when parsing a packed::Bytes witness
- Treat an absent WitnessArgs.lock as a load failure in ckb-std lock scripts
- Creation witness for an output type script goes in WitnessArgs.output_type
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "CKB blake160 is the first 20 bytes of the 32 byte ckbhash", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/ckb-blake160-is-the-first-20-bytes-of-the-32-byte-ckbhash, CC BY 4.0, last changed 2026-10-09.