C++ implementation of the daemon component exposing the Ethereum JSON RPC protocol within the Erigon architecture.
git clone --recurse-submodules https://github.com/torquem-ch/silkrpc.git
To update the submodules later on run
git submodule update --init --recursive
Building SilkRPC daemon requires
sudo apt-get install libgmp3-dev
; sudo apt-get install -y m4 texinfo bison
brew install gmp
git clone https://github.com/microsoft/mimalloc
cd mimalloc
mkdir -p out/release
cd out/release
cmake ../..
make
sudo make install
brew install mimalloc
sudo apt-get install python3
or brew install python3
pip3 install -r requirements.txt
from project folderPlease make your GCC or Clang compiler available as gcc
and g++
or clang
and clang++
at the command line prompt.
Once the prerequisites are installed, there are convenience bash scripts for complete rebuild and incremental build both in debug and release configurations:
# Complete rebuild
./rebuild_gcc_debug.sh
./rebuild_gcc_release.sh
# Incremental build
./build_gcc_debug.sh
./build_gcc_release.sh
# Complete rebuild
./rebuild_clang_debug.sh
./rebuild_clang_release.sh
# Incremental build
./build_clang_debug.sh
./build_clang_release.sh
The resulting build folders are build_[gcc, clang]_[debug, release]
according to your choice.
To enable parallel compilation, set the CMAKE_BUILD_PARALLEL_LEVEL
environment variable to the desired value as described here.
For example, in order to have 4 concurrent compile processes, insert in .bashrc
file the following line
export CMAKE_BUILD_PARALLEL_LEVEL=4
You can also perform the build step-by-step manually: just bootstrap cmake by running
mkdir build_gcc_release
cd build_gcc_release
cmake ..
(you have to run cmake ..
just the first time), then run the build itself
cmake --build .
Now you can run the unit tests
cmd/unit_test
and check the code style running
./run_linter.sh
You can clean the build using
cmake --build . --target clean
.\vcpkg\vcpkg install mpir:x64-windows mimalloc:x64-windows
INCLUDE
environment variable.PATH
environment variable.CTRL+Shift+B
%USERPROFILE%\CMakeBuilds\silkrpc\build
If you want to change this path simply edit CMakeSettings.json
file.We use the standard C++20 programming language. We follow the Google's C++ Style Guide with the following differences:
snake_case
for function names.using namespace foo
is allowed inside .cpp files, but not inside headers..clang-format
.From the build folder (build_[gcc, clang]_[debug, release]
according to your choice) you typically activate Silkrpc using:
$ cmd/silkrpcdaemon --target <core_service_host_address>:9090
where <core_service_host_address>
is the hostname or IP address of the Core services to connect to.
You can check all command-line parameters supported by Silkrpc using:
$ cmd/silkrpcdaemon --help
silkrpcdaemon: C++ implementation of ETH JSON Remote Procedure Call (RPC) daemon
Flags from silkrpc_daemon.cpp:
--http_port (Ethereum JSON RPC API local binding as string <address>:<port>); default: "localhost:8545";
--log_verbosity (logging verbosity level); default: c;
--num_contexts (number of running I/O contexts as integer); default: number of hardware thread contexts / 3;
--num_workers (number of worker threads as integer); default: 16;
--target (Core gRPC service location as string <address>:<port>); default: "localhost:9090";
--wait_mode (I/O scheduler wait mode); default: blocking;
You can also check the Silkrpc executable version by:
$ cmd/silkrpcdaemon --version
silkrpcdaemon version: 0.0.7-109+commit.bfe634dd
Currently Silkrpc is compatible only with Erigon2 2022.09.01-alpha
version: last integration and performance test sessions has been performed using Erigon1 at 4067b7c. In order to run Silkrpc with Erigon2, you must install and build Erigon2 following the usage instructions here.
Please note the following caveats:
--http=false
option to avoid conflicts on JSON RPC HTTP porttarget
setting matches Erigon2 private.api.addr
setting