# How many bytes do I need to store an IOTA seed?

IOTA seeds consist of 81 trytes. Assuming a balanced trinary system, the tryte domain is $$[-1, 0, 1]$$. The maximum decimal number of a single tryte is 13, because $$1\cdot3^0 + 1\cdot3^1 + 1 \cdot 3^2 = 13$$. Consequently, I would need 4 bits to store a tryte.

I am wondering how many bits are necessary to store a IOTA seed. The maximum decimal number of an IOTA seed would be $$x = \sum\limits_{i=0}^{80} 3^i$$. The number of necessary bits would be $$log_2(x)$$, which is quite large.

Is this calculation correct?

## migrated from crypto.stackexchange.comOct 30 '18 at 18:29

This question came from our site for software developers, mathematicians and others interested in cryptography.

• While the maximum value is 13, the minimum value is not 0 but -13, so you have a total of 27 values and need 5 bits and not 4 to store a tryte. – mihi Oct 30 '18 at 22:21
• IOTA seeds consist of 81 trytes?? Programmatically I can create a Seed consisting only of 2 TRYTES. 1 TRYTE is not possible since there is a mechanism to go through a Seeds address space on the first TRYTE. – instantlink Nov 17 '18 at 17:43

You are confusing trits and trytes, see this for details.

A (balanced) trit is something that can represent an element of the set $$\{-1,0,1\}$$ but a tryte is an element made by 3 trits. As such, it can represent $$3^3=27$$ values. It follows that 81 trytes can represent $$27^{81}$$ values and you would need $$\lceil \log_2(27^{81}) \rceil=386$$ bits to represent that space.

However it could be simpler to represent a trit as two bits, a tryte as 6 bits, and therefore a seed as $$6*81=486$$ bits as this would be simpler to convert to/from ternary.

• Or a tryte as 5 bits (instead of 6). – mihi Oct 30 '18 at 22:21

I do not get why one trit would be able to store 13 decimal values. The difference between trit and bit is that bit can store 2 possible values (thus base 2) and trit can store 3 possible values (base 3).

The calculation $$log_2(3^{81})$$ seems correct (thanks Christoph).

• You want $log_2(3^{81})$ without the extra summ around. – Christoph Egger Oct 30 '18 at 15:37
• Yes, you are right, $3^{81}$ is the maximum decimal number. – Damian Oct 30 '18 at 15:41
• A balanced tryte can store 27 values. However, 13 is the largest decimal one, because 1*3^0 + 1*3^1 + 1*3^2 = 13. The domain of a balanced tryte is [-13, 13]. – null Oct 31 '18 at 7:59