Crate exonum_btc_anchoring [] [src]

Introduction

Private blockchain infrastructure necessitates additional measures for accountability of the blockchain validators. In public proof of work blockchains (e.g., Bitcoin), accountability is purely economic and is based on game theory and equivocation or retroactive modifications being economically costly. Not so in private blockchains, where these two behaviors are a real threat per any realistic threat model that assumes that the blockchain is of use not only to the system validators, but also to third parties.

This crate implements a protocol for blockchain anchoring onto the Bitcoin blockchain that utilizes the native Bitcoin capabilities of creating multisig(p2sh) transactions. This transactions contains metadata from Exonum blockchain (block's hash on corresponding height) and forms a chain.

You can read the details in specification.

Examples

Create application with anchoring service

extern crate exonum;
extern crate exonum_btc_anchoring as anchoring;
extern crate exonum_configuration as configuration;
use exonum::helpers::fabric::NodeBuilder;
use exonum::helpers;

fn main() {
    exonum::crypto::init();
    helpers::init_logger().unwrap();
    let node = NodeBuilder::new()
       .with_service(Box::new(configuration::ServiceFactory))
       .with_service(Box::new(anchoring::ServiceFactory));
    node.run();
}

Re-exports

pub use cmd::AnchoringServiceFactory as ServiceFactory;

Modules

api

Anchoring rest api implementation.

blockchain

Blockchain implementation details for the anchoring service.

cmd

Basic clap factory implementation. This module collect all basic CommandExtension that we can use in anchoring bootstrapping process.

observer

Anchoring transactions' chain observer.

Structs

AnchoringConfig

Public part of anchoring service configuration stored in blockchain.

AnchoringHandler

Internal anchoring service handler. Can be used to manage the service.

AnchoringNodeConfig

Private part of anchoring service configuration stored on a local machine.

AnchoringRpcConfig

Bitcoind rpc configuration.

AnchoringService

Anchoring service implementation for the Exonum blockchain.

RpcClient

Enums

BitcoinNetwork

The cryptocurrency to act on

Error

Anchoring btc service Error type.

Constants

ANCHORING_SERVICE_ID

Anchoring service id.

ANCHORING_SERVICE_NAME

Anchoring service name.

Traits

BitcoinRelay

Functions

gen_anchoring_testnet_config

Same as gen_anchoring_testnet_config_with_rng but it uses default random number generator.

gen_anchoring_testnet_config_with_rng

Generates testnet configuration by given rpc for given nodes amount using given random number generator.

gen_btc_keypair

Same as gen_btc_keypair_with_rng but it uses default random number generator.

gen_btc_keypair_with_rng

Generates public and secret keys for Bitcoin node using given random number generator.