What is a block?

Blocks are one of the fundamental concepts in cryptocurrency. They are groups of data linked together and usually represent transactions and interactions. These blocks are verified by the network and committed into a distributed ledger after being confirmed. For example, in Bitcoin, blocks are verified and committed to the ledger through the mining process, and each block is linked to the next to form a chain.

Blocks in Nano

The Nano ledger is different; instead of a single chain for the whole ledger (where each block aggregates multiple transactions), each account has its own chain of blocks which are woven together as new transactions are added to the network to create a block lattice. The blocks in a Nano chain represent the changes that its owner, who holds the private key, has made to their account. These changes take one of the following forms:

A send block, which is signaled by a resulting lower balance in the chain.

block, which is signaled by a resulting lower balance in the chain. A receive block, which results in a higher balance in the chain.

block, which results in a higher balance in the chain. An open block, the first in every chain.

block, the first in every chain. A change block, used to choose a new representative.

block, used to choose a new representative. An epoch block.

Fig 1. Comparison between Bitcoin Blockchain and Nano Block Lattice

How does it work?

Originally, Nano had 4 different block types: Open, Send, Receive and Change, each with slightly different layouts. However, these have since been merged into a single block type called a State block. Each state block contains all the details of that account, including the address and balance, as well as details to help place the block in the correct position in its chain. A block is then authorized by a digital signature created using the block details and the account’s private key.

Fig 2. Components that go into a state block

The most recent block is called the head or frontier block as its at the front. With the introduction of state blocks, only the frontier is necessary to know everything about the current state of account. The exception are pending blocks, that is, those that have been sent by other accounts, but not yet received.

With all this data grouped together in the state block structure, it is easy to make changes:

To send some Nano, include the destination address in the block and reduce the account’s balance by the amount you are sending.

some Nano, include the destination address in the block and reduce the account’s balance by the amount you are sending. To receive Nano previously sent to an account, include the hash (unique id) of the corresponding send block and increase the balance by this amount.

Nano previously sent to an account, include the hash (unique id) of the corresponding send block and increase the balance by this amount. To change representative, include the new account in the representative field.

Notice that the amount transacted is not directly present in any block. To obtain this value, it is necessary to subtract the previous block’s balance from the frontier block’s balance.

Each block needs a work value; this is the resulting value following a resource consuming mathematical calculation and will be discussed in detail in a future Nano Education article. The idea is for this number to be hard to generate, but easy to validate. Interestingly, the work value is actually not included in the signature of the block, and can be obtained after the block is generated (but it needs to be present before the block is broadcast, or it will be rejected).

An example of a state block, in a JSON-encoded format:

"block": {

"type": "state",

"account": "nano_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx",

"previous": "92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D",

"representative": "nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou",

"balance": "3618869000000000000000000000000",

"link": "5C2FBB148E006A8E8BA7A75DD86C9FE00C83F5FFDBFD76EAA09531071436B6AF",

"link_as_account": "nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p",

"signature": "79240D56231EF1885F354473733AF158DC6DA50E53836179565A20C0BE89D473ED3FF8CD11545FF0ED162A0B2C4626FD6BF84518568F8BB965A4884C7C32C205",

"work": "fbffed7c73b61367"

}

It is important to note that other nodes in the network check the blocks to make sure that all the details line up and will reject an incorrect block — it is not possible to just create a new block with a larger balance than what has been sent to you.

Why does Nano have a Send and Receive block?

Every account has its own chain and this chain can only be altered with blocks signed by the account’s private key. When someone sends you Nano, they create a new block with a reduced balance and a destination address but they can not change your chain; instead, the funds remain as confirmed by the network, but in a limbo (known as pending) until the corresponding receive block is created and increases the balance proportionally. There is no limit to how long the funds can stay pending.