Primitives

This page describes the various structures of the Ellcrys blockchain.

Overview

A block is a container data structure. It is composed of a header and a collection of transactions. Transactions are collected into a block and cryptographically linked to another block to form a chain of blocks. A block has a limited size; In Bitcoin, a block's size is set at 1MB, whereas In Bitcoin Cash, the size of a block is set at 8MB. The larger the block size, the more transactions can be processed per second. Ellcrys' block size is set at 10MB.

Block Structure

An Ellcrys block is composed of a header, a list of transactions, a block hash and a signature.

Header

The header contains metadata about the block. It includes information about the current block number, proof-of-work proof, current and total difficulty, current state root hash and the hash of the previous block. The following code is an example structure of an Ellcrys header:

The unique number derived during proof-of-work that fulfills the current difficulty.

difficulty

BigInt

The block's difficulty.

totalDifficulty

BigInt

The cumulative of all blocks in the chain.

creatorPubKey

String

The public key of the block creator.

stateRoot

[32]Byte

The merkle root of the chain state after processing the block's transactions.

transactionRoot

[32]Byte

The merkle root of the collection of transactions.

timestamp

Int64

The UNIX time of creation of the block.

extra

[32]Byte

An optional 32 bytes field for include additional/future data.

Transactions

In most blockchain systems, transactions are the driving force and initiator of action. They are created by users or (smart contracts) to perform a specific function such as moving money from one account to another account. Transactions are signed and sent to a node on the network and subsequently included into a block.

Types of Transactions

Balance: A balance transaction moves money from one account to another account; It is the most common transaction that is capable of changing the balance of users' account.

var TxTypeBalance =0x1

Allocation: An allocation transaction is used to allocate new coins to users. They are used extensively in the genesis block to distribute initial coin supply. According to protocol specification, miners are expected to include an allocation transaction for paying transaction fees to themselves.

var TxTypeAlloc =0x2

Transaction Structure

The structure of a transaction includes information about the type of the transaction, financial information, destination address, authorising signature and more. Here is a sample of a transaction:

Hash

The hash is a 32 bytes Blake2b-256 hash. It is composed of a concatenation of the header and transactions. A block is considered invalid if the computed hash does not match the hash included in the block.

Signature

The signature of a block is created using the private key of the block creator to produce a 64 bytes output. The signed data is composed of the block's header and transactions.