Native ECC implementation vs EOSVM

pEOS
2 min readNov 20, 2019

--

Here we present our findings regarding the performance of EOSVM compared to native code when doing elliptic curve cryptography. Evidence presented here is to support our EOS improvement proposal regarding the implementation of EC intrinsics in EOSIO.

In order to compare the performance we use a simple ECC library that is easy to compile for EOSIO and can run inside a contract without many modifications. We don’t use this in our pEOS implementation as it lacks some mathematical optimizations and precalculations, however, it is very good for comparing the performance while running the same code.

You can download the library from: https://github.com/ANSSI-FR/libecc

The library contains a test suite that provides a benchmark with singing and verifying random data. Namely the program: src/ec_self_tests.c . This program initializes the library, generates a key pair and performs 300 signatures and verification of those signatures. Below we can see the same code implemented as an EOS contract action called bench:

https://gist.github.com/peosdev/ea0c38b88fa812f5e9cf7dc49c443325

Running the default native implementation of the benchmark we get around 250 signatures/sec. The same code running interpreted by EOSVM, with the node running on the same machine, fails to finish within the transaction time limits imposed by the system. As a matter of fact the code gist above only attempts to do one signature (not 300 like the original test).

So the results of the benchmark can be summarized below:

Native signature: 4ms
EOSVM signature: >30ms

We think the results speak for themselves.

Conclusions

EOSVM represents a huge step ahead in the web assembly interpretation, providing in some cases orders of magnitude better performance. However, doing computationally heavy EC calculations can be taxing on the system. Taking into account the cryptographical nature of blockchains and the problems witnessed lately with EOSIO performance, we think it’s of paramount importance that we enable advanced cryptographic dapps to be able to use the network efficiently.

*Tests were performed using EOSIO v2.0.0-rc2

--

--

pEOS

enables private & untraceable transactions on EOS.Find out more at https://peos.one