Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- data Transaction = Transaction {}
- type Block = Stack Transaction
- type Blockchain = Scattered Stack Block (Connection, Table)
- genesis :: Block
- block :: Block
- mainchain :: Blockchain
- verify :: Stack Transaction -> Blockchain -> Compose IO Maybe Block
Documentation
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.
Let's suppose that genesis is a regular transaction, but proceeded from magic account 0 to real accounts.
Transaction
0 1000 1:<
Nothing
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.