Safe Haskell | None |
---|---|
Language | Haskell2010 |
Block definitions
Synopsis
- data SignedBlock = SignedBlock {}
- data UnsignedBlock
- data SendBlock = SendBlock {}
- data ReceiveBlock = ReceiveBlock {}
- data OpenBlock = OpenBlock {}
- data ChangeBlock = ChangeBlock {}
- data StateBlock = StateBlock {}
- getSignedBlock :: BlockType -> Get SignedBlock
- verifySignedBlock :: SignedBlock -> Either SignedBlockError BlockHash
- getUnsignedBlock :: BlockType -> Get UnsignedBlock
- putSignedBlock :: SignedBlock -> (BlockType, Put ())
- putUnsignedBlock :: UnsignedBlock -> (BlockType, Put ())
- data BlockHash
- data BlockHashOrAccount
- blockHashOrAccountToAccount :: BlockHashOrAccount -> Either String Account
- blockHashOrAccountToBlockHash :: BlockHashOrAccount -> Either String BlockHash
- linkToAccount :: Link -> Either String Account
- linkToBlockHash :: Link -> Either String BlockHash
- zeroBlockHash :: BlockHash
- data Signature
- data SignedBlockError
- newtype Raw32ByteValue = Raw32ByteValue {}
- raw32ByteValueToByteString :: Raw32ByteValue -> ByteString
- generateRandomRaw32ByteValue :: MonadRandom m => m Raw32ByteValue
- data BlockType
- toBlockTypeValue :: BlockType -> Word8
- fromBlockTypeValue :: Word8 -> Maybe BlockType
- newtype Link = Link {}
- newtype ProofOfWork = ProofOfWork {}
Blocks
data SignedBlock #
Wraps a block with its proof of work and signature
SignedBlock | |
|
Instances
data UnsignedBlock #
An unsigned block
UnsignedBlockSend !SendBlock | |
UnsignedBlockReceive !ReceiveBlock | |
UnsignedBlockOpen !OpenBlock | |
UnsignedBlockChange !ChangeBlock | |
UnsignedBlockState !StateBlock |
Instances
Contents of a send block
SendBlock | |
|
Instances
Eq SendBlock # | |
Show SendBlock # | |
Generic SendBlock # | |
Validity SendBlock # | |
Defined in Gini.Core.Protocol.Types.Block.Internal | |
Persist SendBlock # | |
Defined in Gini.Core.Protocol.Types.Block.Internal | |
type Rep SendBlock # | |
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
ReceiveBlock | |
|
Instances
Contents of open block
OpenBlock | |
|
Instances
Eq OpenBlock # | |
Show OpenBlock # | |
Generic OpenBlock # | |
Validity OpenBlock # | |
Defined in Gini.Core.Protocol.Types.Block.Internal | |
Persist OpenBlock # | |
Defined in Gini.Core.Protocol.Types.Block.Internal | |
type Rep OpenBlock # | |
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
ChangeBlock | |
|
Instances
data StateBlock #
Contents of state block
StateBlock | |
|
Instances
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
Instances
Eq BlockHash | |
Show BlockHash | |
NFData BlockHash | |
Defined in Gini.Crypto.Hash | |
Display BlockHash | |
Defined in Gini.Crypto.Hash display :: BlockHash -> Utf8Builder textDisplay :: BlockHash -> Text | |
ByteArrayAccess BlockHash | |
Validity BlockHash | |
Defined in Gini.Crypto.Hash | |
Persist BlockHash | |
Defined in Gini.Crypto.Hash | |
PersistField BlockHash | |
Defined in Gini.Crypto.Hash toPersistValue :: BlockHash -> PersistValue fromPersistValue :: PersistValue -> Either Text BlockHash | |
PersistFieldSql BlockHash | |
Defined in Gini.Crypto.Hash |
data BlockHashOrAccount #
Block hash or account address
Instances
blockHashOrAccountToAccount :: BlockHashOrAccount -> Either String Account #
Convert BlockHashOrAccount
to Account
blockHashOrAccountToBlockHash :: BlockHashOrAccount -> Either String BlockHash #
Convert BlockHashOrAccount
to BlockHash
BlockHash with all zeros
Signature
Instances
Eq Signature | |
Show Signature | |
NFData Signature | |
Defined in Gini.Crypto.PubKey | |
Display Signature | |
Defined in Gini.Crypto.PubKey display :: Signature -> Utf8Builder textDisplay :: Signature -> Text | |
ByteArrayAccess Signature | |
Validity Signature | |
Defined in Gini.Crypto.PubKey | |
Persist Signature | |
Defined in Gini.Crypto.PubKey | |
PersistField Signature | |
Defined in Gini.Crypto.PubKey toPersistValue :: Signature -> PersistValue fromPersistValue :: PersistValue -> Either Text Signature | |
PersistFieldSql Signature | |
Defined in Gini.Crypto.PubKey |
data SignedBlockError #
Instances
Eq SignedBlockError # | |
Defined in Gini.Core.Protocol.Types.Block.Internal (==) :: SignedBlockError -> SignedBlockError -> Bool # (/=) :: SignedBlockError -> SignedBlockError -> Bool # | |
Show SignedBlockError # | |
Defined in Gini.Core.Protocol.Types.Block.Internal showsPrec :: Int -> SignedBlockError -> ShowS # show :: SignedBlockError -> String # showList :: [SignedBlockError] -> ShowS # | |
Display SignedBlockError # | |
Defined in Gini.Core.Protocol.Types.Block.Internal display :: SignedBlockError -> Utf8Builder textDisplay :: SignedBlockError -> Text |
Raw32ByteValue
newtype Raw32ByteValue #
A generic 256-bit (32-byte) value rendered as hex.
Instances
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
BlockTypeInvalid | 0x00 |
BlockTypeNotABlock | 0x01 |
BlockTypeSend | 0x02 |
BlockTypeReceive | 0x03 |
BlockTypeOpen | 0x04 |
BlockTypeChange | 0x05 |
BlockTypeState | 0x06 |
Instances
toBlockTypeValue :: BlockType -> Word8 #
fromBlockTypeValue :: Word8 -> Maybe BlockType #
Other types
Contents of state block's link field
Instances
Eq Link # | |
Show Link # | |
IsString Link # | |
Defined in Gini.Core.Protocol.Types.Block.Internal fromString :: String -> Link # | |
Generic Link # | |
Display Link # | |
Defined in Gini.Core.Protocol.Types.Block.Internal display :: Link -> Utf8Builder textDisplay :: Link -> Text | |
Validity Link # | |
Defined in Gini.Core.Protocol.Types.Block.Internal | |
Persist Link # | |
Defined in Gini.Core.Protocol.Types.Block.Internal | |
type Rep Link # | |
Defined in Gini.Core.Protocol.Types.Block.Internal type Rep Link = D1 (MetaData "Link" "Gini.Core.Protocol.Types.Block.Internal" "gini-core-0.1.0.0-CYC9q60CJ5rDf5hHcbgY0V" True) (C1 (MetaCons "Link" PrefixI True) (S1 (MetaSel (Just "unLink") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Raw32ByteValue))) |
newtype ProofOfWork #
Proof of work nonce