You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
arnaucode 54d9934a3a updated paths of the derosuite package 6 years ago
..
inputmaturity updated paths of the derosuite package 6 years ago
mempool updated paths of the derosuite package 6 years ago
rpcserver updated paths of the derosuite package 6 years ago
alt_blocks.go updated paths of the derosuite package 6 years ago
block_chain_input.go updated paths of the derosuite package 6 years ago
blockchain.go updated paths of the derosuite package 6 years ago
blockheader.go updated paths of the derosuite package 6 years ago
caller.go Derosuite Status Update Release 2 6 years ago
checkpoints_static.go updated paths of the derosuite package 6 years ago
const.go updated paths of the derosuite package 6 years ago
create_miner_tx.go updated paths of the derosuite package 6 years ago
create_miner_tx_test.go updated paths of the derosuite package 6 years ago
genesis.go updated paths of the derosuite package 6 years ago
genesis_test.go Derosuite Status Update Release 2 6 years ago
median.go Derosuite Status Update Release 2 6 years ago
median_test.go Derosuite Status Update Release 2 6 years ago
outputs_index.go updated paths of the derosuite package 6 years ago
readme.txt Derosuite Status Update Release 2 6 years ago
reorg_test.go updated paths of the derosuite package 6 years ago
store.go updated paths of the derosuite package 6 years ago
transaction_verify.go updated paths of the derosuite package 6 years ago
tx_fees.go updated paths of the derosuite package 6 years ago

readme.txt

The blockchain is stored as follows, assuming genesis block is stored

each block has a single child to store main chain
each block can have multiple children to store numerous blocks as alternative


each block stores the following extra info
1) height
2) single parent
3) cumulative difficulty
4) size of block ( size of all transactions included within block + size of block )
5) timestamp
6) cumulative coins
7) block blob itself
8) child
9) multiple children ( alternative or orphan blocks )

storing block mean storing all attributes except child/children
connecting a block means setting child/children attributes properly


imagine the chain as a doubly linked list, with traversal possible using blockids as ptrs

the psedo code is as follows

1) verify incoming blockor semantic errors
2) verify block pow
3) verify each and every transaction for correctnes
4) store the transactions
5) store the block, height, cumulative difficulty, coins emission etc
6) check whether block is the new top,
7) if yes,update main chain
8) if not we have to do chain reorganisation at the top
9) choose the block with higher poW as new top
10) push alt chain txs to mem pool after verification
11) if block is being added somewhere in the middle, find the chain with higher Pow as main chain
12) push the orphan block txs to mempool after verification