pub fn new() -> Self {
        let parent: H256 = [0u8; 32].into();
        let nonce = 0u32;
        // let mut bytes32 = [255u8; 32];
        // bytes32[0] = 0;
        // bytes32[1] = 0;
        let mut bytes32 = [0u8; 32];
        bytes32[2] = 1u8;
        let difficulty: H256 = bytes32.into();
        let timestamp = 0u128;
        let transactions = Vec::new();
        let empty_tree = MerkleTree::new(&transactions);
        let merkle_root = empty_tree.root();
        let header = Header{ parent: parent, nonce: nonce, difficulty: difficulty, timestamp: timestamp, merkle_root: merkle_root };
        let content = Content{ data: transactions };
        let genesis = Block{ header: header, content: content };
        let mut blockmap = HashMap::new();
        let mut lengthmap = HashMap::new();
        let genesis_hash: H256 = genesis.hash();
        blockmap.insert(genesis_hash, genesis);
        lengthmap.insert(genesis_hash, 0);
        let tip = genesis_hash;
        Blockchain { blockmap: blockmap, lengthmap: lengthmap, tip: tip }
    }
/// Create a new blockchain, only containing the genesis block
Create a new blockchain, only containing the genesis block
Create a new blockchain only containing the genesis block
pub fn new() -> Self {
        let parent: H256 = [0u8; 32].into();
        let nonce = 0u32;
        // let mut bytes32 = [255u8; 32];
        // bytes32[0] = 0;
        // bytes32[1] = 0;
        let mut bytes32 = [0u8; 32];
        bytes32[2] = 1u8;
        let difficulty: H256 = bytes32.into();
        let timestamp = 0u128;
        let transactions = Vec::new();
        let empty_tree = MerkleTree::new(&transactions);
        let merkle_root = empty_tree.root();
        let header = Header{ parent: parent, nonce: nonce, difficulty: difficulty, timestamp: timestamp, merkle_root: merkle_root };
        let content = Content{ data: transactions };
        let genesis = Block{ header: header, content: content };
        let mut blockmap = HashMap::new();
        let mut lengthmap = HashMap::new();
        let genesis_hash: H256 = genesis.hash();
        blockmap.insert(genesis_hash, genesis);
        lengthmap.insert(genesis_hash, 0);
        let tip = genesis_hash;
        Blockchain { blockmap: blockmap, lengthmap: lengthmap, tip: tip }
    }
pub fn new ( ) -> Self { let parent : H256 = [ 0u8 ; 32 ] . into ( ) ; let nonce = 0u32 ; // let mut bytes32 = [255u8; 32]; // bytes32[0] = 0; // bytes32[1] = 0; let mut bytes32 = [ 0u8 ; 32 ] ; bytes32 [ 2 ] = 1u8 ; let difficulty : H256 = bytes32 . into ( ) ; let timestamp = 0u128 ; let transactions = Vec :: new ( ) ; let empty_tree = MerkleTree :: new ( & transactions ) ; let merkle_root = empty_tree . root ( ) ; let header = Header { parent : parent , nonce : nonce , difficulty : difficulty , timestamp : timestamp , merkle_root : merkle_root } ; let content = Content { data : transactions } ; let genesis = Block { header : header , content : content } ; let mut blockmap = HashMap :: new ( ) ; let mut lengthmap = HashMap :: new ( ) ; let genesis_hash : H256 = genesis . hash ( ) ; blockmap . insert ( genesis_hash , genesis ) ; lengthmap . insert ( genesis_hash , 0 ) ; let tip = genesis_hash ; Blockchain { blockmap : blockmap , lengthmap : lengthmap , tip : tip } }
Create a new blockchain, only containing the genesis block
Create a new blockchain only containing the genesis block