-
Notifications
You must be signed in to change notification settings - Fork 15
Definitions
This page defines the core data structures and roles that exist in Hyperdrive.
Transaction
A transaction is a user-defined data structure that can be executed over some initial state to transform it into a new output state. A transaction must be executed in full, or not at all. In this way, we say that transactions are atomic.
execute :: (Tx t, State s) => t -> s -> sAn ordered list of transactions can be also be executed over some initial state to transform it into a new output state. The transactions are executed sequentially, and the output state of one execution is used as the initial state for the next execution. An ordered list of transactions can be executed in concurrently if, and only if, the final output state is equal to the output state that would result from sequential execution.
execute :: (Tx t, State s) => [t] -> s -> s
execute txs initialState = foldr (\tx state -> execute tx state) initialState txsIt is assumed that a transaction can be serialised to/from bytes as required by the peer-to-peer networking and persistent storage device. No other properties or functionalities are assumed.
class Tx t where
serialise :: t -> [Byte]
deserialise :: [Byte] -> tPlan
A plan is a user-defined data structure that stores the precomputed data that is needed to execute an ordered list of transactions. The precomputed data required depends on the number of transactions, the initial state, and the secure multi-party computation algorithm.
It is assumed that a plan can be serialised to/from bytes as required by the peer-to-peer networking and persistent storage device. No other properties or functionalities are assumed.
class Plan p where
serialise :: p -> [Byte]
deserialise :: [Byte] -> pState
A state is a user-defined data structure that is stored within a block and represents the state of the parent block after all transactions in the parent block have been executed on the state stored in the parent block.
stateAtHeight :: Height -> State
stateAtHeight 0 = genesisState
stateAtHeight height = execute (txsAtHeight (height-1)) (stateAtHeight (height-1))In secure multi-party computations it is common that different parties will have different local states. The state stored in a block
It is assumed that a state can be serialised to/from bytes as required by the peer-to-peer networking and persistent storage device. No other properties or functionalities are assumed.
class State s where
serialise :: s -> [Byte]
deserialise :: [Byte] -> sBlock
Signatory
Message