This module implements the Bitcoin consensus encode/decode functions
- Struct
Encoder
- Struct
Decoder
- Constants
- Function
encoder
- Function
decoder
- Function
unpack_encoder
- Function
unpack_decoder
- Function
emit_u64
- Function
emit_u32
- Function
emit_u16
- Function
emit_u8
- Function
emit_bool
- Function
emit_var_int
- Function
emit_var_slice
- Function
peel_var_int
- Function
peel_var_slice
- Function
peel_bool
- Function
peel_u64
- Function
peel_u32
- Function
peel_u16
- Function
peel_u8
use 0x1::vector;
struct Encoder has copy, drop, store
struct Decoder has copy, drop, store
const ErrorInvalidLength: u64 = 1;
const ErrorOutOfRange: u64 = 3;
const ErrorNonMinimalVarInt: u64 = 2;
public fun encoder(): consensus_codec::Encoder
public fun decoder(data: vector<u8>): consensus_codec::Decoder
public fun unpack_encoder(encoder: consensus_codec::Encoder): vector<u8>
public fun unpack_decoder(decoder: consensus_codec::Decoder): vector<u8>
public fun emit_u64(encoder: &mut consensus_codec::Encoder, v: u64)
public fun emit_u32(encoder: &mut consensus_codec::Encoder, v: u32)
public fun emit_u16(encoder: &mut consensus_codec::Encoder, v: u16)
public fun emit_u8(encoder: &mut consensus_codec::Encoder, v: u8)
public fun emit_bool(encoder: &mut consensus_codec::Encoder, v: bool)
public fun emit_var_int(encoder: &mut consensus_codec::Encoder, v: u64)
Emit a slice of bytes to the encoder with a varint length
public fun emit_var_slice(encoder: &mut consensus_codec::Encoder, v: vector<u8>)
public fun peel_var_int(decoder: &mut consensus_codec::Decoder): u64
Peel a slice of bytes from the decoder with a varint length
public fun peel_var_slice(decoder: &mut consensus_codec::Decoder): vector<u8>
public fun peel_bool(decoder: &mut consensus_codec::Decoder): bool
public fun peel_u64(decoder: &mut consensus_codec::Decoder): u64
public fun peel_u32(decoder: &mut consensus_codec::Decoder): u32
public fun peel_u16(decoder: &mut consensus_codec::Decoder): u16
public fun peel_u8(decoder: &mut consensus_codec::Decoder): u8