Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Serialization Sandbox

A simple playground of different serialization types.

The objective of this repository is to provide a framework to choose different serialization mechanisms suitable for Ethereum.


  • Information Tests
    • Basic structure serialization of default values
    • Basic structure serialization with maximum values
  • Benchmark (in-progress)
    • Time taken to serialize/deserialize default values
    • Time taken to serialize/deserialize max values
    • Benchmark of serialize/deserialize read/write patterns.
  • Profile of operations
    • CPU profiling
    • Memory profiling
  • Summarising report
    • Research and references
    • Overviews
    • Discussion


Differences exist between implementations - mainly depiction in each schema language.

  • AttestationRecord - aggregate signatures (bytes in Cap'n Proto and Simple, Uint64 in Protobuf)
  • Int256 - not depicted in protobuf, as bytes in cap'n proto.
  • Int vs Uint - there is discrepancies. The cap'n proto tried to follow the protobuf implementation and adhere to Uint.
  • There are some discrepancies between protobuf - it favours uints over some fields making it less to serialize.

Running the tests

Install dependencies

Install Python deps for the sandbox and Beacon Chain:

$ pip install -r requirements.txt
$ pip install -r beacon_chain/requirements.txt

Ensure git sub-modules are present:

$ git submodule init
$ git submodule update

Install flatc the FlatBuffers compiler. On Arch Linux, you can use the flatbuffers-static AUR package, other platforms should be well supported too.

Building the messages

Using the scripts

Note: running ./ will also check and build files.

$ ./

Building yourself

Protobuf (requires protobuf : )

$ protoc -I=/path/to/repo/pbuf --python_out=/path/to/repo/pbuf /path/to/repo/pbuf/messages.proto

$ protoc -I=/path/to/repo/pbuf --python_out=/path/to/repo/pbuf /path/to/repo/pbuf/packedmessages.proto

FlatBuffers (reuqires flatbuffers: )

$ cd fbuffers

$ flatc messages.fbs --python

How to run

The test suite is split into two major commands:

  • message-size: compares the sizes of messages generated by various serializers.
  • timing: compares the running times of serialization/de-serialization operations.

Additionally there are some flags:

  -h, --help            show help message and exit
  -v, --verbose         Verbose (Show all prints)
  -ni, --no-info        Hide Informative Stats
  -r, --raw-output      Raw output as object instead of table
  -n REPEATS, --repeats REPEATS
                        Number of timeit repeats (only for timing).
  -l LOOPS, --loops LOOPS
                        Number of timeit loops (only for timing).

Message Size

$ python message-size


$ python timing


To run all tests:

$ ./


To run each individual test, it requires python dependencies to be installed and runs with Python3.

Note: BeaconChain requirements build with Python 3.6.6 and will not compile on 3.7 as of 21/08/2018

$ pip install -r requirements.txt

$ python cpnp/
$ python pbuf/
$ python smp/


Sandbox for testing different serialization mechanisms



No releases published


No packages published