Skip to content

Latest commit

 

History

History
executable file
·
108 lines (77 loc) · 3.38 KB

File metadata and controls

executable file
·
108 lines (77 loc) · 3.38 KB

What's in a Block?

区块是一组个扩展网络状态的交易和共识信息的集合. Mina 中的区块包括网络当前状态完全有效的证明.

Mina 中的区块由以下部分组成:

  • Protocol state
  • Protocol state proof
  • Staged ledger diff
  • Delta transition chain proof
  • Current protocol version
  • Proposed protocol version

当节点收到来自 peer 节点的区块时, 首先会对其进行验证, 将其应用于现有状态, 并添加到节点的 transition frontier. 如果根据共识规则, 它导致区块链的长度增加, 则更新节点的 tip, 并将 transition frontier 的根上移, 因为我们仅在 transition frontier 中维护 k 个区块.

在 Mina 中, 区块是 transitions 的同义词. 当从 Peer 节点收到此 transition(block)时, 它被称为 external transition, 而在本地生成和应用的 transition 称为 internal transition.

Protocol State

协议状态由上一个协议状态哈希和一个 bpdy 组成, 其中包含:

  • Genesis state hash
  • Blockchain state
  • Consensus state
  • Consensus constants

每个区块都包含前一个区块的协议状态哈希, 这样区块就可以形成一个不可变的链.

议状态哈希是由前一个状态哈希和 body 哈希的哈希确定的, 并充当每个区块的唯一标识符.

Blockchain State

区块链状态由以下部分组成:

  • Staged ledger hash
  • Genesis ledger hash
  • Ledger proof statement
  • Timestamp
  • Body reference

Ledger proof statement

账本证明 statement 包括:

  • Snarked ledger hash
  • Signed amount
  • Pending coinbase stack
  • Fee excess
  • Sok digest
  • Local state

Consensus State

共识状态包括:

  • Blockchain length
  • Epoch count
  • Min window density
  • Sub window density
  • Last VRF output
  • Total currency
  • Current global slot
  • Global slot since genesis
  • Staking epoch data
  • Next epoch data
  • Has ancestor in same checkpoint window
  • Block stake winner
  • Block creator
  • Coinbase receiver
  • Superchage coinbase Superchage

Consensus Constants

  • k
  • delta
  • slots_per_sub_window
  • slots_per_window
  • sub_windows_per_window
  • slots_per_epoch
  • grace period slots
  • grace period end
  • checkpoint_window_slots_per_year
  • checkpoint_window_size_in_slots
  • block_window_duration_ms
  • slot_duration_ms
  • epoch_duration
  • delta_duration
  • genesis_state_timestamp

Protocol State Proof

协议状态证明是证明区块生产者生成的新协议状态有效的区块链证明. 由于使用了递归 SNARK, 该协议状态证明证明链的整个历史都是有效的.

Staged Ledger Diff

当区块生产者赢得生成区块的 slot 时, 他们从交易和 SNARK 池中选择交易和所需的 SNARK 工作. 他们创建区块链的 proposed next 状态, 其中包括创建暂存账本的差异. 差异包括:

  • Transactions included in the block
  • A list of SNARK proofs generated by SNARK workers for prior transactions added
  • Pending coinbase

暂存账本可以被视为一个待处理账户数据库, 该数据库 applied 那些尚无可用的 SNARK 的交易(payments, coinbase and proof fee payments). 暂存账本由账户状态(账本)和没有 SNARK 证明的交易队列(即扫描状态)组成.

Delta Transition Chain Proof Delta

考虑到不利的网络条件, 在网络上广播或 gossiping 新生成的区块时, 允许网络延迟. delta transition chain proof 证明该区块是在分配的 slot 时间内产生的.