Understanding IOTA: Trits & Trytes

in iota •  last year 

IOTA Logo

Many have heard of bits and bytes before, while trits and trytes are most likely new. Since IOTA relies on the ternary system instead of the binary system, this article will describe what it is all about. Admittedly, the subject is not light fare, yet I will try to make the topic a bit more tangible.

Basics

One bit (portmanteau of binary digit) can take exactly two states(2^1 =2): 0 and 1.
Eight bits make up one byte (2^8 = 256) and can thus represent 256 combinations.

A trit (portmanteau of trinary digit) can take exactly three states (3^1 = 3): -1, 0, and 1
Three trits make a tryte (3^3 = 27).

The IOTA alphabet consists of 27 characters. More precisely from the 26 capital letters A-Z and the number 9. A tryte can thus be used to represent a character from the IOTA alphabet.

Illustrated Example

To illustrate this, let's look at an example of how text is rendered in trytes. Suppose that we want to write the word HODL in the tangle, so it must first be converted to trytes, since only trytes can be written in the tangle.

First, each letter must be assigned its ASCII decimal value. For H, the ASCII value is 72, for O 79, for D 68 and L 76. Then the respective ASCII decimal value is modulated by 27, the number of characters of the IOTA alphabet. The resulting remainder results in the first part of the tryte. The remainder defines the position of the letter in the IOTA alphabet. Then the remainder value is subtracted from the ASCII value and divided by the number of characters of the IOTA alphabet to obtain the second value of the tryte or the position of the second letter in the IOTA alphabet.

Subsequently, the step is performed for each character individually.

H = 72
72 mod 27 = 18
(72 - 18) / 27 = 2
H is represented by the letters 18 and 2, hence R and B.

O = 79
79 mod 27 = 25
(79 - 25) / 27 = 2
O is represented by the letters 15 and 2, hence Y and B.

D = 68
68 mod 27 = 14
(68 - 14) / 27 = 2
D is represented by the letters 14 and 2, hence N and B.

L = 76
76 mod 27 = 22
(76 - 22) / 27 = 2
L is represented by the letters 22 and 2, hence V and B.

The word HODL is thus represented by the trytes RB YB NB VB.

An IOTA seed consists of 81 trytes. This results in 27^81 combinations, a number with 115 zeros or about 87 unvigintillion (the name really exists) combinations.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

@wiredcrypto, I gave you an upvote on your post! Please give me a follow and I will give you a follow in return and possible future votes!

Thank you in advance!