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.

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:

header.json
{
  creatorPubKey: "48YQpehoRDYsivCbnedrz19DfTvh345PwWAKGN3jdUjPNdG3Lte",
  difficulty: "0x989680",
  extra: "0x",
  nonce: "0x61879fb427b56cef",
  number: "0x2",
  parentHash: "0x211df3aed05b45d620850f40c9b4eac006da7ee0f76a7fa99d5ac16a2c2ca42c",
  stateRoot: "0xc222870b2ca3f71d30b8d06b8e3f633812a8c0473cecc38b6fcc12eb5cad89ec",
  timestamp: "0x5bda0ad4",
  totalDifficulty: "0x1312d00",
  transactionsRoot: "0x0000000000000000000000000000000000000000000000000000000000000000"
}

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:

transaction.json
{
  fee: "0",
  from: "eNGGuhVSrXWWFYmVQBid9hFhiNLAfvPwzS",
  hash: "0xf91be74146afb8717834f70969d02edff4316508dc62ec8716104968391fc492",
  nonce: "0x0",
  senderPubKey: "497a8Z5sTvCgFZYyQQ8Uh3tgm726uPBzM4v3fNpcygevyCcTJf6",
  sig: "0xe579837d73b45af9cc9e381cfe7009106c5ea6c65a22356a61103e9724b92bbb8a7243a4765d28d9e2aa89d34df585efc08c07fff9eb4a649f60f03f3310890e",
  timestamp: "0x5bcc82b7",
  to: "eGzzf1HtQL7M9Eh792iGHTvb6fsnnPipad",
  type: "0x2",
  value: "100"
}

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.

Last updated