1234567891011121314151617181920212223242526{-# OPTIONS --safe #-} open import Leios.Preludeopen import CategoricalCrypto -- | Typeclass for machines that behave like a blockchain---- Parameterised over the type of participants (producers). At use sites,-- `Participant` is typically instantiated to `Fin n` where `n` is the number-- of nodes.module Blockchain.IsBlockchain (Participant : Type) where data BlockChainInfo (Block : Type) : Type where Chain : BlockChainInfo Block Slot : BlockChainInfo Block bciQueryType : ∀ {Block : Type} → BlockChainInfo Block → TypebciQueryType {Block = Block} Chain = List BlockbciQueryType Slot = ℕ record IsBlockchain (Block : Type) {A B : Channel} (m : Machine A B) : Type₂ where field isConstrained : IsConstrained m (bciQueryType {Block}) isPure : IsPure isConstrained producer : Block → Participant slotOf : Block → ℕ