types crate provides common data structures, cryptographic utilities, and type definitions used throughout the Ubu-Block system.
Overview
This crate contains:- Core blockchain types (Block, BlockType)
- P2P messaging protocol types
- Election data models
- Configuration structures
- Cryptographic functions
- Error types
Modules
config
Configuration structures for the application.crypto
Cryptographic utilities for signing and hashing.error
Error types for the blockchain.std::error::Error and can be converted using ? operator.
models
Election-related data structures.Geographic Models
Political Models
p2p
Peer-to-peer networking types.P2PMessage
The protocol message enum for peer communication.PeerConnection
Tracks the state of a peer connection.P2PConfig
Configuration for P2P networking.max_peers: 50ping_interval: 30 secondsconnection_timeout: 10 secondssync_batch_size: 100 blocksmax_message_size: 10 MB
results
Result aggregation types for different geographic levels.Core Types
Block
The main blockchain block structure.Methods
BlockType
The type of data contained in a block.CandidateResult
Represents votes for a candidate at a polling station.PubKey
Public key information.ElectionBlockHeader
Block header used for hashing.Type Aliases
Constants
Serialization
All public types implementSerialize and Deserialize from serde, and are compatible with bincode for efficient binary serialization.
Platform Support
Cryptographic functions (crypto module) are only available on non-WASM targets. The #[cfg(not(target_arch = "wasm32"))] attribute gates these features.