Crate ckb_resource

Source
Expand description

Bundles resources in the ckb binary.

This crate bundles the files ckb.toml, ckb-miner.toml, default.db-options, and all files in the directory specs in the binary.

The bundled files can be read via Resource::Bundled, for example:

// Read bundled ckb.toml
use ckb_resource::{Resource, CKB_CONFIG_FILE_NAME};

let ckb_toml_bytes = Resource::bundled(CKB_CONFIG_FILE_NAME.to_string()).get().unwrap();
println!("ckb.toml\n{}", String::from_utf8(ckb_toml_bytes.to_vec()).unwrap());

These bundled files can be customized for different chains using spec branches. See Template.

Structs§

Error
The error type for I/O operations of the Read, Write, Seek, and associated traits.
Template
A simple template which supports spec branches and variables.
TemplateContext
The context used to expand the Template.

Enums§

Resource
Represents a resource, which is either bundled in the CKB binary or resident in the local file system.

Constants§

AVAILABLE_SPECS
The list of bundled chain specs.
CKB_CONFIG_FILE_NAME
CKB config file name.
CODE_HASH_DAO
Data hash of the cell containing DAO type script.
CODE_HASH_SECP256K1_BLAKE160_MULTISIG_ALL
Data hash of the cell containing secp256k1 blake160 multisig all lock script.
CODE_HASH_SECP256K1_BLAKE160_SIGHASH_ALL
Data hash of the cell containing secp256k1 blake160 sighash all lock script.
CODE_HASH_SECP256K1_DATA
Data hash of the cell containing secp256k1 data.
DB_OPTIONS_FILE_NAME
The file name of the generated RocksDB options file.
DEFAULT_P2P_PORT
The default P2P listen port 8115.
DEFAULT_RPC_PORT
The default RPC listen port 8114.
DEFAULT_SPEC
Default chain spec.
MINER_CONFIG_FILE_NAME
CKB miner config file name.
SPEC_DEV_FILE_NAME
The relative spec file path for the dev chain.

Statics§

BUNDLED
Bundled resources in ckb binary.

Type Aliases§

Result
A specialized Result type for I/O operations.