simulate_blockchain: Simulate a blockchain

Description Usage Arguments Value

View source: R/simulation.R

Description

Simulate a blockchain

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
simulate_blockchain(
  n,
  attack_power = 0,
  t1 = ceiling(1/3 * n),
  t2 = ceiling(2/3 * n),
  n_miners = 10000,
  block_rate = 1/600,
  block_size = 1,
  n_genesis_blocks = 1,
  burn_in = n_genesis_blocks,
  fixed_block_interval = TRUE
)

Arguments

n

the size of blockchain, i.e. the total number of blocks in the blockchain

attack_power

the percentage of attacker's computing power

t1

the first time point of attack

t2

the second time point of attack

n_miners

the number of miners

block_rate

the block genration rate (blocks per sec)

block_size

the block size (MB)

burn_in

the burn in time points, in which period all blocks are generated by the genesis miner

Value

This function will return a list with the following components:

adj_mat

The adjacent matrix of generated blockchain.

block_info

A list that contains information of blockchain and blocks.


wulingyun/BlockSim documentation built on Dec. 4, 2019, 1:54 a.m.