apart-0.1.3: Get all your structure and rip it apart.

Safe HaskellSafe




data Transaction Source #

Simplified transaction type, no certificates/keys.




type Block = Stack Transaction Source #

Block is just a bunch of transactions, no pointers/keys here.

type Blockchain = Scattered Stack Block (Connection, Table) Source #

Our blockchain type is distributed - we really don't want to keep all chain in memory, instead, we'll store balance table of all accounts in some database.

genesis :: Block Source #

Let's suppose that genesis is a regular transaction, but proceeded from magic account 0 to real accounts.

Transaction 0 1000 1 :< Nothing

block :: Block Source #

First real block, 1 sends 50 tokens to 4.

Transaction 1 50 4 :< Nothing

mainchain :: Blockchain Source #

We're facing with increasing chain in memory, so, let's calculate UTXO for each account and put this information somewhere else.

Apart $ block :< Converted ...

verify :: Stack Transaction -> Blockchain -> Compose IO Maybe Block Source #

Verifying block is just a calculation UTXO for each account that trying to send money, so, we already have balance table and current block, the task becomes simple - just match transactions and balances.