Solidity Tutorial : all about Bytes

Jean Cvllr
11 min readAug 1, 2019

Bytes are a large aspect of Solidity, whether when using fixed size bytesN or dynamic size bytes array. We will see in this article their difference, bitwise operations related to fixed-sized array bytesN and we can use them to perform some generic methods like concatenating.

Table of Content :

  1. Endianness & bytes data layout in Solidity
  2. Fixed-size byte arrays
  3. Dynamically-size byte arrays
  4. Bitwise operations in Solidity
  5. An array of bytes = a little difference
  6. Bytes as function arguments
  7. Conversion between addresses and bytes20
  8. Advanced operations with Bytes
  9. A word of warning with Solidity bytes

1. Endianness & bytes data layout in Solidity

Introduction to Endianness

In computing, the term endianness corresponds to how the low level bytes of any data are stored and ordered. Therefore, it defines the internal ordering of the computer or machine memory.

We refer to multi-byte data types data that its t(uint, float, string, etc…). There are two ways for ordering multi-byte data types in computer: in…

--

--

Jean Cvllr
Jean Cvllr

Written by Jean Cvllr

Smart Contract engineer at @LUKSO. Full Stack Developer. https://github.com/CJ42

Responses (5)