方便开发,创建数据结构
Tip /// The state of the current fork tip
pub struct Tip {
/// Height of the tip (max height of the fork)
pub height: u64,
// Last block pushed to the fork
pub last_block_pushed: String,
// Block previous to last
pub prev_block_to_last: String,
// Total difficulty accumulated on that fork
pub total_difficulty: u64,
}
Status /// Status page containing different server information
pub struct Status {
// The protocol version
pub protocol_version: u32,
// The user user agent
pub user_agent: String,
// The current number of connections
pub connections: u32,
// The state of the current fork Tip
pub tip: Tip,
}
TxHashSet /// TxHashSet
pub struct TxHashSet {
/// Output Root Hash
pub output_root_hash: String,
// Rangeproof root hash
pub range_proof_root_hash: String,
// Kernel set root hash
pub kernel_root_hash: String,
}
TxHashSetNode /// Wrapper around a list of txhashset nodes, so it can be /// presented properly via json
pub struct TxHashSetNode {
// The hash
pub hash: String,
}
Output
pub struct Output {
/// The output commitment representing the amount
pub commit: PrintableCommitment,
/// Height of the block which contains the output
pub height: u64,
}
PrintableCommitment
pub struct PrintableCommitment {
pub commit: pedersen::Commitment,
}
OutputPrintable // As above, except formatted a bit better for human viewing
pub struct OutputPrintable {
/// The type of output Coinbase|Transaction
pub output_type: OutputType,
/// The homomorphic commitment representing the output's amount
/// (as hex string)
pub commit: pedersen::Commitment,
/// Whether the output has been spent
pub spent: bool,
/// Rangeproof (as hex string)
pub proof: Option<String>,
/// Rangeproof hash (as hex string)
pub proof_hash: String,
/// Block height at which the output is found
pub block_height: Option<u64>,
/// Merkle Proof
pub merkle_proof: Option<MerkleProof>,
}
TxKernelPrintable // Printable representation of a block
pub struct TxKernelPrintable {
pub features: String,
pub fee: u64,
pub lock_height: u64,
pub excess: String,
pub excess_sig: String,
}
BlockHeaderInfo // Just the information required for wallet reconstruction
pub struct BlockHeaderInfo {
// Hash
pub hash: String,
/// Height of this block since the genesis block (height 0)
pub height: u64,
/// Hash of the block previous to this in the chain.
pub previous: String,
}
BlockHeaderPrintable
pub struct BlockHeaderPrintable {
// Hash
pub hash: String,
/// Version of the block
pub version: u16,
/// Height of this block since the genesis block (height 0)
pub height: u64,
/// Hash of the block previous to this in the chain.
pub previous: String,
/// Root hash of the header MMR at the previous header.
pub prev_root: String,
/// rfc3339 timestamp at which the block was built.
pub timestamp: String,
/// Merklish root of all the commitments in the TxHashSet
pub output_root: String,
/// Merklish root of all range proofs in the TxHashSet
pub range_proof_root: String,
/// Merklish root of all transaction kernels in the TxHashSet
pub kernel_root: String,
/// Nonce increment used to mine this block.
pub nonce: u64,
/// Size of the cuckoo graph
pub edge_bits: u8,
/// Nonces of the cuckoo solution
pub cuckoo_solution: Vec<u64>,
/// Total accumulated difficulty since genesis block
pub total_difficulty: u64,
/// Variable difficulty scaling factor for secondary proof of work
pub secondary_scaling: u32,
/// Total kernel offset since genesis block
pub total_kernel_offset: String,
}
BlockPrintable // Printable representation of a block
pub struct BlockPrintable {
/// The block header
pub header: BlockHeaderPrintable,
// Input transactions
pub inputs: Vec<String>,
/// A printable version of the outputs
pub outputs: Vec<OutputPrintable>,
/// A printable version of the transaction kernels
pub kernels: Vec<TxKernelPrintable>,
}
CompactBlockPrintable
pub struct CompactBlockPrintable {
/// The block header
pub header: BlockHeaderPrintable,
/// Full outputs, specifically coinbase output(s)
pub out_full: Vec<OutputPrintable>,
/// Full kernels, specifically coinbase kernel(s)
pub kern_full: Vec<TxKernelPrintable>,
/// Kernels (hex short_ids)
pub kern_ids: Vec<String>,
}
BlockOutputs // For wallet reconstruction, include the header info along with the // transactions in the block
pub struct BlockOutputs {
/// The block header
pub header: BlockHeaderInfo,
/// A printable version of the outputs
pub outputs: Vec<OutputPrintable>,
}
OutputListing // For traversing all outputs in the UTXO set // transactions in the block
pub struct OutputListing {
/// The last available output index
pub highest_index: u64,
/// The last insertion index retrieved
pub last_retrieved_index: u64,
/// A printable version of the outputs
pub outputs: Vec<OutputPrintable>,
}
PoolInfo
pub struct PoolInfo {
/// Size of the pool
pub pool_size: usize,
}