gini-core-0.1.0.0

Safe HaskellNone
LanguageHaskell2010

Gini.Core.Protocol.Types.Block

Contents

Description

Block definitions

Synopsis

Blocks

data SignedBlock #

Wraps a block with its proof of work and signature

Constructors

SignedBlock 

Fields

Instances
Eq SignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show SignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic SignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep SignedBlock :: * -> * #

Validity SignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: SignedBlock -> Validation

type Rep SignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep SignedBlock = D1 (MetaData "SignedBlock" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "SignedBlock" PrefixI True) (S1 (MetaSel (Just "signedBlockBlock") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UnsignedBlock) :*: (S1 (MetaSel (Just "signedBlockSignature") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Signature) :*: S1 (MetaSel (Just "signedBlockWork") SourceUnpack SourceStrict DecidedStrict) (Rec0 ProofOfWork))))

data UnsignedBlock #

An unsigned block

Instances
Eq UnsignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show UnsignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic UnsignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep UnsignedBlock :: * -> * #

Validity UnsignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: UnsignedBlock -> Validation

type Rep UnsignedBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

data SendBlock #

Contents of a send block

Constructors

SendBlock 

Fields

Instances
Eq SendBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show SendBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic SendBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep SendBlock :: * -> * #

Validity SendBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: SendBlock -> Validation

Persist SendBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: SendBlock -> Put ()

get :: Get SendBlock

type Rep SendBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep SendBlock = D1 (MetaData "SendBlock" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "SendBlock" PrefixI True) (S1 (MetaSel (Just "sendBlockPrevious") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlockHash) :*: (S1 (MetaSel (Just "sendBlockDestination") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Account) :*: S1 (MetaSel (Just "sendBlockBalance") SourceUnpack SourceStrict DecidedStrict) (Rec0 Amount))))

data ReceiveBlock #

Contents of a receive block

Constructors

ReceiveBlock 

Fields

Instances
Eq ReceiveBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show ReceiveBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic ReceiveBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep ReceiveBlock :: * -> * #

Validity ReceiveBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: ReceiveBlock -> Validation

Persist ReceiveBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: ReceiveBlock -> Put ()

get :: Get ReceiveBlock

type Rep ReceiveBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep ReceiveBlock = D1 (MetaData "ReceiveBlock" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "ReceiveBlock" PrefixI True) (S1 (MetaSel (Just "receiveBlockPrevious") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlockHash) :*: S1 (MetaSel (Just "receiveBlockSource") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlockHash)))

data OpenBlock #

Contents of open block

Constructors

OpenBlock 

Fields

Instances
Eq OpenBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show OpenBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic OpenBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep OpenBlock :: * -> * #

Validity OpenBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: OpenBlock -> Validation

Persist OpenBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: OpenBlock -> Put ()

get :: Get OpenBlock

type Rep OpenBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep OpenBlock = D1 (MetaData "OpenBlock" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "OpenBlock" PrefixI True) (S1 (MetaSel (Just "openBlockSource") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlockHash) :*: (S1 (MetaSel (Just "openBlockRepresentative") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Representative) :*: S1 (MetaSel (Just "openBlockAccount") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Account))))

data ChangeBlock #

Contents of change block

Constructors

ChangeBlock 

Fields

Instances
Eq ChangeBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show ChangeBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic ChangeBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep ChangeBlock :: * -> * #

Validity ChangeBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: ChangeBlock -> Validation

Persist ChangeBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: ChangeBlock -> Put ()

get :: Get ChangeBlock

type Rep ChangeBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep ChangeBlock = D1 (MetaData "ChangeBlock" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "ChangeBlock" PrefixI True) (S1 (MetaSel (Just "changeBlockPrevious") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlockHash) :*: S1 (MetaSel (Just "changeBlockRepresentative") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Representative)))

data StateBlock #

Contents of state block

Constructors

StateBlock 

Fields

Instances
Eq StateBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show StateBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic StateBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep StateBlock :: * -> * #

Validity StateBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: StateBlock -> Validation

Persist StateBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: StateBlock -> Put ()

get :: Get StateBlock

type Rep StateBlock # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep StateBlock = D1 (MetaData "StateBlock" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) (C1 (MetaCons "StateBlock" PrefixI True) ((S1 (MetaSel (Just "stateBlockAccount") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Account) :*: S1 (MetaSel (Just "stateBlockPrevious") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlockHash)) :*: (S1 (MetaSel (Just "stateBlockRepresentative") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Representative) :*: (S1 (MetaSel (Just "stateBlockBalance") SourceUnpack SourceStrict DecidedStrict) (Rec0 Amount) :*: S1 (MetaSel (Just "stateBlockLink") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Link)))))

getSignedBlock :: BlockType -> Get SignedBlock #

Deserialize a SignedBlock, given the BlockType value.

verifySignedBlock :: SignedBlock -> Either SignedBlockError BlockHash #

Verifies the signature and produces block hash. (possibly other validations)

getUnsignedBlock :: BlockType -> Get UnsignedBlock #

Deserialize an UnsignedBlock, given the BlockType value.

putSignedBlock :: SignedBlock -> (BlockType, Put ()) #

Returns a BlockType value and a closure that will serialize the SignedBlock.

putUnsignedBlock :: UnsignedBlock -> (BlockType, Put ()) #

Returns a BlockType value and a closure that will serialize the UnsignedBlock.

Account and block

data BlockHash #

Instances
Eq BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Show BlockHash 
Instance details

Defined in Gini.Crypto.Hash

NFData BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

rnf :: BlockHash -> () #

Display BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

display :: BlockHash -> Utf8Builder

textDisplay :: BlockHash -> Text

ByteArrayAccess BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

length :: BlockHash -> Int #

withByteArray :: BlockHash -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: BlockHash -> Ptr p -> IO () #

Validity BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

validate :: BlockHash -> Validation

Persist BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

put :: BlockHash -> Put ()

get :: Get BlockHash

PersistField BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

toPersistValue :: BlockHash -> PersistValue

fromPersistValue :: PersistValue -> Either Text BlockHash

PersistFieldSql BlockHash 
Instance details

Defined in Gini.Crypto.Hash

Methods

sqlType :: Proxy BlockHash -> SqlType

data BlockHashOrAccount #

Block hash or account address

Instances
Eq BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

IsString BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep BlockHashOrAccount :: * -> * #

Display BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Validity BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: BlockHashOrAccount -> Validation

Persist BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: BlockHashOrAccount -> Put ()

get :: Get BlockHashOrAccount

type Rep BlockHashOrAccount # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep BlockHashOrAccount = D1 (MetaData "BlockHashOrAccount" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "BlockHashOrAccount" PrefixI True) (S1 (MetaSel (Just "unBlockHashOrAccount") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Raw32ByteValue)))

zeroBlockHash :: BlockHash #

BlockHash with all zeros

Signature

data Signature #

Instances
Eq Signature 
Instance details

Defined in Gini.Crypto.PubKey

Show Signature 
Instance details

Defined in Gini.Crypto.PubKey

NFData Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

rnf :: Signature -> () #

Display Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

display :: Signature -> Utf8Builder

textDisplay :: Signature -> Text

ByteArrayAccess Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

length :: Signature -> Int #

withByteArray :: Signature -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: Signature -> Ptr p -> IO () #

Validity Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

validate :: Signature -> Validation

Persist Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

put :: Signature -> Put ()

get :: Get Signature

PersistField Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

toPersistValue :: Signature -> PersistValue

fromPersistValue :: PersistValue -> Either Text Signature

PersistFieldSql Signature 
Instance details

Defined in Gini.Crypto.PubKey

Methods

sqlType :: Proxy Signature -> SqlType

Raw32ByteValue

newtype Raw32ByteValue #

A generic 256-bit (32-byte) value rendered as hex.

Instances
Eq Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

IsString Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep Raw32ByteValue :: * -> * #

Display Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

display :: Raw32ByteValue -> Utf8Builder

textDisplay :: Raw32ByteValue -> Text

Validity Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: Raw32ByteValue -> Validation

Persist Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

put :: Raw32ByteValue -> Put ()

get :: Get Raw32ByteValue

PersistField Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

toPersistValue :: Raw32ByteValue -> PersistValue

fromPersistValue :: PersistValue -> Either Text Raw32ByteValue

PersistFieldSql Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

sqlType :: Proxy Raw32ByteValue -> SqlType

type Rep Raw32ByteValue # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep Raw32ByteValue = D1 (MetaData "Raw32ByteValue" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "Raw32ByteValue" PrefixI True) (S1 (MetaSel (Just "unRaw32ByteValue") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ShortByteString)))

BlockType

data BlockType #

The block type determines what block is embedded in the message. For some message types, block type is not relevant and the block type is set to invalid or not_a_block

Instances
Bounded BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Enum BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Eq BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep BlockType :: * -> * #

Validity BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: BlockType -> Validation

PersistField BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

toPersistValue :: BlockType -> PersistValue

fromPersistValue :: PersistValue -> Either Text BlockType

PersistFieldSql BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

sqlType :: Proxy BlockType -> SqlType

type Rep BlockType # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep BlockType = D1 (MetaData "BlockType" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" False) ((C1 (MetaCons "BlockTypeInvalid" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "BlockTypeNotABlock" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "BlockTypeSend" PrefixI False) (U1 :: * -> *))) :+: ((C1 (MetaCons "BlockTypeReceive" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "BlockTypeOpen" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "BlockTypeChange" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "BlockTypeState" PrefixI False) (U1 :: * -> *))))

Other types

newtype Link #

Contents of state block's link field

Constructors

Link 

newtype ProofOfWork #

Proof of work nonce

Constructors

ProofOfWork 
Instances
Eq ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Show ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Generic ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Associated Types

type Rep ProofOfWork :: * -> * #

NFData ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

rnf :: ProofOfWork -> () #

Validity ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

validate :: ProofOfWork -> Validation

PersistField ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

toPersistValue :: ProofOfWork -> PersistValue

fromPersistValue :: PersistValue -> Either Text ProofOfWork

PersistFieldSql ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

Methods

sqlType :: Proxy ProofOfWork -> SqlType

type Rep ProofOfWork # 
Instance details

Defined in Gini.Core.Protocol.Types.Block.Internal

type Rep ProofOfWork = D1 (MetaData "ProofOfWork" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "ProofOfWork" PrefixI True) (S1 (MetaSel (Just "unProofOfWork") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)))