Mina中的stake_proof
Posted mutourend
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mina中的stake_proof相关的知识,希望对你有一定的参考价值。
1. 引言
前序博客有:
module Block_data = struct
type t =
stake_proof : Stake_proof.t
; global_slot : Mina_numbers.Global_slot.t
; global_slot_since_genesis : Mina_numbers.Global_slot.t
; vrf_result : Random_oracle.Digest.t
(* Stake_proof结构为: *)
type t =
delegator : Account.Index.Stable.V1.t
; delegator_pk : Public_key.Compressed.Stable.V1.t
; coinbase_receiver_pk : Public_key.Compressed.Stable.V1.t
; ledger : Mina_ledger.Sparse_ledger.Stable.V2.t
; producer_private_key : Private_key.Stable.V1.t
; producer_public_key : Public_key.Stable.V1.t
(* block_producer.ml中的block_data来源:*)
let data =
Consensus.Hooks.get_block_data ~slot_won
~ledger_snapshot
~coinbase_receiver:!coinbase_receiver
let get_block_data ~(slot_won : Slot_won.t) ~ledger_snapshot
~coinbase_receiver =
let delegator_pk, delegator_idx = slot_won.delegator in
let producer_public_key = slot_won.producer.public_key in
let producer_private_key = slot_won.producer.private_key in
let producer_pk = Public_key.compress producer_public_key in
Block_data.stake_proof =
producer_private_key
; producer_public_key
; delegator = delegator_idx
; delegator_pk
; coinbase_receiver_pk =
Coinbase_receiver.resolve ~self:producer_pk coinbase_receiver
; ledger =
Local_state.Snapshot.Ledger_snapshot.ledger_subset
[ Mina_base.(Account_id.create producer_pk Token_id.default)
; Mina_base.(Account_id.create delegator_pk Token_id.default)
]
ledger_snapshot
; global_slot = slot_won.global_slot
; global_slot_since_genesis = slot_won.global_slot_since_genesis
; vrf_result = slot_won.vrf_result
会调用is_satisfied
函数确认产块者的质押量和其vrf结果是否符合要求:
(* Check if
vrf_output / 2^256 <= c * (1 - (1 - f)^(amount / total_stake))
*)
let is_satisfied ~my_stake ~total_stake vrf_output = .......
附录1. Mina系列博客
Mina系列博客有:
- Mina概览
- Mina的支付流程
- Mina的zkApp
- Mina中的Pasta(Pallas和Vesta)曲线
- Mina中的Schnorr signature
- Mina中的Pickles SNARK
- Mina中的Kimchi SNARK
- Mina Kimchi SNARK 代码解析
- Mina Berkeley QANet测试网zkApp初体验
- Mina中的Poseidon hash
- Mina中的多项式承诺方案
- Recursive SNARKs总览
- Mina技术白皮书
- Mina代码解析
- Mina中的Snark Worker
- Mina中的Scan State
- Mina中的VRF
- Mina中的delta_transition_chain_proof/delta_block_chain_proof
- Mina中的stake delegation
- Mina如何实现22KB?
以上是关于Mina中的stake_proof的主要内容,如果未能解决你的问题,请参考以下文章