/GPU-Merkle-Patricia-Trie

An optimized Merkle Patricia Trie implementation on GPU, fully compatible with and integrable into Ethereum. The paper is published on VLDB 2024.

Primary LanguageCuda

GPU Merkle Patricia Trie

Note: We are working on completing this documents.

Dependencies

  • crypto++ 8.7
  • libxml2
  • gtest
  • golang

Submodules

We have two externel git submodules. One includes our modified go-ethereum implementation and experiments. Another includes our modified ycsb generator. They are forked from open-sourced branch.

For anonymity, we removed the .gitmodules and also make them anonymous. Please download Geth and YCSB into current folder before you start to build.

Data

You can load the ycsb and wiki dataset by runing our script

bash download_data.sh

Ethereum transaction dataset is a financial dataset. It should be downloaded from Google BigQuery by following query.

select *
from bigquery-public-data.crypto_ethereum.transactions 
where 
  EXTRACT(date FROM block_timestamp) between "2022-11-15" and "2022-12-29"

The results need to be exported to one or multiple csv files and saved in /ethereum/transactions/ folder.

Build

mkdir build
cd build
cmake ../mpt-with-compress/
cmake --build . -j

For Ethereum transaction processing case study:

bash geth_install_libgmpt.sh

Run

Experiments

You can run unit tests in go-ethereum/trie/experiments_test.go and

bash do_all_experiments.sh

Profiling

You can run the experiments and generate profiling report by profile.sh. The Nsight Compute report will be stored in ./profile/. If you'd like a csv version, just run convert_to_csv.sh and you will get all csv reports in ./profile/.

Case study: Applied to Go-ethereum

We integrate GPU MPT into go-ethereum using cgo.

Install

First make sure the gmpt target is compiled. Then run geth_install_libgmpt.sh to install the library and header files into go-ethereum's folder.

Configure geth to use GPU MPT

  • TODO

Code Structure

Overview

.
├── dataset           # created by [download_data.sh](./download_data.sh)
├── go-ethereum       # forked from official go-ethereum. downloaded by git submodule
├── YCSB-C            # YCSB workload generator. downloaded by git submodule
├── mpt-with-compress # GPU MPT implementations
└── mpt-no-compress   # You can ignore it

Key Algorithms

Extension of LockNU

Key experiments

Please refer to ./do_all_experiments.sh, ./go-ethereum/trie/experiments_test.go and ./go-ethereum/miner/benchmark_test.go.