A Deep Dive into Mochimo — Part II: Dissecting the Blockchain

Ortis
Mochimo Official
Published in
4 min readOct 8, 2019

This is the second part of a series of articles about the Mochimo blockchain, a 100% original, no-ICO, no-presale crypto currency project.
Follow us on Twitter, Discord, Reddit

If you haven’t already, read our previous article A Deep Dive Into Mochimo — Part I: Playing Tag with Quantum Computers and WOTS+

Blockchain 101

A blockchain is exactly what it says on the tin: a chain of blocks. Blocks are data; in essence, a blockchain is a distributed database in which each block is numbered, signed, and references the signature (or hash) of the previous block so we can verify that the chain is not broken (which would be indicated by a mismatch between signatures/hashes).

Crypto currencies use the blockchain technology as a distributed ledger to allow uncensored transactions between actors. Each transaction is recorded in these blocks and together they hold the full history of every single transaction that has ever taken place.

Structure of a block

Each implementation of blockchain follows the principles mentioned above, but the structure of blocks differs from one implementation to another.
In Mochimo, a block is composed of a header, a trailer, and some transactions in between.

Structure of a block in the Mochimo blockchain

The C code of the block header:

Source code of the block header
  • hdrlen: length of the header
  • maddr: WOTS+ address of the miner of the block
  • mreward: the amount of the reward for the miner of the block

C code of the transaction structure:

Source code of the transaction entry
  • src_addr: address of the sender
  • dst_addr: address of the recipient
  • chg_addr: new address of the sender after the transaction is completed
  • send_total: total amount sent
  • change_total: balance of the sender after the transaction is completed
  • tx_fee: the transaction fee
  • tx_sig: signature of the transaction
  • tx_id: id of the transaction

C code of the block trailer structure:

Source code of the block trailer
  • phash: signature of the previous block
  • bnum: block number
  • mfee: minimum transaction fee of the miner of the block
  • tcount: number of transactions in the block
  • time0: mining start time
  • difficulty: block difficulty
  • mroot: Merkel root
  • nonce: some data used to mine a valid block
  • stime: mining end time
  • bhash: signature of the block

One of the hot topics in the cypto space is the ideal size of a block. What will be the average size of a block on the Mochimo blockchain when it reaches the peak utilization of Bitcoin ?

The total number of transactions per day on the Bitcoin blockchain peaked at 500K on December 2017.

Considering that the size of a Mochimo block header is 2220 bytes, the block trailer is 160 bytes, the block transaction is 8824 bytes, and the block time is 337.5 seconds (5minutes 37 seconds), the average transaction per block will be 500K / (86400 seconds per day/337.5) = 1953. Note: the exact number is actually 1960, for reasons that will be explained in the next article.

Then the size of a Mochimo block packing 1960 transactions is 2220 + (1960 * 8824) + 160 = 17.3Mb. This is negligible in terms of today’s Internet capabilities.

The Mochimo development team has already developed and tested features that will allow for an increase to the number of transactions by a factor 100 while keeping the size of the block unchanged. But that is a story for a future article.

Structure of the ledger

The ledger is a digital book that matches an address to a balance and is updated with the transactions contained in a block. Every time a block is mined, each transaction is processed and the balance of both sender and recipient are updated.

Each entry of the ledger is represented by a structure called LENTRY:

Source code of the ledger entry
  • addr: address of the account
  • balance: balance of the account

Put together, these entries make up the ledger and represent the distribution of the total supply of MCM at any point in time.

Ortis.

Edited by Kashmyr

About the author: I am a contributor to the Mochimo project and a founder of the mining pool illamanudi.
Twitter, GitHub

--

--