Discover Packages
github.com/dusk-network/dusk-blockchain
pkg
core
chain
package
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Dec 24, 2019
License: MIT
Opens a new window with license information.
Imports: 27
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
Chain
Responsibility
Given a block, verify whether the block is valid according to the consensus rules
Given a transaction, verify whether a transaction is valid
API
AcceptBlock(block) Verifies and saves a block
VerifyBlock(block) - Verifies a block is valid, including the transactions
VerifyTX(tx) - Verifies a tx is valid. For the mempool
Usage
AcceptBlock will be used by all nodes, when they recieve a new proposed block, that should be added to the chain
VerifyBlock will be used by consensus nodes, to verify that a block is valid without saving it.
VerifyTX will be used by the mempool to Verify a TX is valid and can be added to the mempool.
Consensus Rules
No double spending, check with utxo database
time difference between the last block should not be more than 60 minutes
Current blockheader, should reference the previous block header
Seed, public key, etc in block should be X Bytes
Zkproof should be valid in block
Certificates in the block of provisioners, should be valid.
Timestamp of previous block should be less than current block
Specification
Chain is the only process with a RW copy to the database
Expand ▾
Collapse ▴
Documentation
¶
Chain represents the nodes blockchain
This struct will be aware of the current state of the node.
New returns a new chain object
AcceptBlock will accept a block if
1. We have not seen it before
2. All stateless and statefull checks are true
Returns nil, if checks passed and block was successfully saved
Source Files
¶
Click to show internal directories.
Click to hide internal directories.