调研区块链虚拟机安全
EVM的不同实现
- EVM官方实现:Ethereum Virtual Machine (EVM) | ethereum.org
- Py-EVM - Python
- evmone - C++
- ethereumjs-vm - JavaScript
- eEVM - C++,微软开发
- revm - Rust
- SputnikVM:- rust
- pyethereum:- py,2023.3已被弃用
- 其他以太坊execution client的EVM, accessed at 2024/0314
其他VM
- NEO VM:采用C#实现,Neo链目前的市值排行66,NEO支持多种常用的编程语言,如C#、Java和Python等编写智能合约
- Solana Virtual Machine:Solana链(市值第7)上的虚拟机,rust实现.
- 智能合约语言可以是Rust, C, and C++,翻译成BPF字节码执行;支持交易并行
- Neon用于solana和EVM对齐
- Cardano:token ADA,目前市值排行8,采用Haskell语言实现,以KEVM,EVM的形式化验证版本为基础
- 其中Milkomeda C1是Cardano对应的EVM侧链
- Tezos:目前的市值排行52,项目采用的语言是OCaml,合约采用的编程语言是Archetype, LIGO, 和SmartPy,翻译为底层语言Michelson后在VM上执行
- 虚拟机的设计未详细介绍,参考资料What Smart Contracts are and How They Work
- github镜像:tezos/tezos-mirror: Github test mirror of the Octez software
WASM
- EOSIO, EOS-VM:第一个DpoS的链,C++实现,目前的市值排行57,采用WebAssembly(WASM)作为底层引擎,通过即时编译技术将智能合约字节码转换为本地机器码;同样支持多种编程语言,包括C++、Rust、Python等编写智能合约
- Near:采用Rust实现,Wasm作为执行引擎,市值排行43
- 国内的迅雷公司的迅雷链:采用Wasm作为VM,目前提供数字藏品
- Tron:市值10声称要支持WASM,但是根据官方白皮书的介绍,目前采用的实现是以太坊的fork
- Hera:Geth采用的Wasm,需要EVMC的支持
- awesome-wasm-tools:Wasm静态分析、动态分析和相关论文的仓库
学习资料
- fuzzinglab
- 开源工具集 FuzzingLabs
- medium Fuzz testing in webassembly vms https://medium.com/wasmer/fuzz-testing-in-webassembly-vms-3a301f982e5a
- 学习教程 https://fuzzinglabs.com/journey-fuzzing-webassembly-wasm-vm/
- 中科大CSS实验室 https://csslab-ustc.github.io/index.html
- 在py虚拟机 wasm虚拟机方面有很多工作
MOVE VM
- github的awesome库:https://github.com/MystenLabs/awesome-move#papers
- MoveVM:Facebook旗下的区块链项目Diem( Libra )采用的虚拟机,rust实现
- Sui:Mysten Labs于2022年3月发起的layer1 PoS公链,目前市值排行91,同样采用Move作为运行时
以太坊客户端
客户端多样性:https://clientdiversity.org/
- 执行客户端
- 共识客户端
根据以太坊主网的统计数据显示,geth是使用最广泛的客户端
- Geth:占比50.0%,采用go语言实现,最常用的客户端
- 支持Mainnet, Sepolia, Goerli
- Nethermind:占比29.3%,采用C#实现
- 支持Mainnet, Sepolia, Goerli, and more
- Erigon:占比11.12%,采用go语言实现,作为Openethereum的后继者
- Mainnet, Sepolia, Goerli, and more
- besu:占比9%,Java实现,Hyperledger 项目的一部分,是一个企业级以太坊客户端
- Mainnet, Sepolia, Goerli, and more
- reth:占比0.5%,Rust实现
- Mainnet, Sepolia, Goerli, and more
Openethereum:采用Rust实现,曾经仅次于geth, August 4, 2021已被弃用
Coregeth:Go实现,Geth的下游发行版
EVM兼容的区块链
所有兼容EVM的区块链可见 EVM公链列表CoinCarp
- Binance Smart Chain:token BNB,市值排行第4,由币安交易所推出
- 客户端bsc基于geth fork开发,EVM类似于geth
- Fantom:token FTM,市值排行63
- 客户端opera采用go实现,利用了EVM的实现go-opera
- Polygon:token MATIC,市值排行13
- 虚拟机是zkEVM,声称与EVM等价 Polygon zkEVM | Scaling for the Ethereum Virtual Machine
- Bor,EVM实现是geth的fork
- Avalanche:token AVAX,市值排行22
EIP
- CCS22:Empirical Analysis of EIP-1559: Transaction Fees, Waiting Time, and Consensus Security ,介绍了EIP1559的基本情况核对市场的影响https://cfcs.pku.edu.cn/news/240640.htm
测试用例
EVMtest 以太坊项目官方对客户端会进行单元测试,
Blockbench 区块链测试用例
数据集
- 11个fuzzer的综述论文 2000个合约 https://github.com/SE2023Test/SCFuzzers
web3bug:Code4rena审计过的项目,被论文广泛引用 https://github.com/ZhangZhuoSJTU/Web3Bugs/
IC综述论文数据集:https://github.com/StefanosChaliasos/sc-defi-security/
总结
- 可能的研究方向
- 虚拟机:目前学术论文的研究对象主要是EVM的官方实现(geth/aleth/js-evm/openethereum)和EVM兼容的链(FISCO-BCOS-evm),逐渐开始有向其他公有链项目采用的VM进行延伸(Neo)的工作。后续工作可以考虑对其他EVM兼容的区块链上的EVM实现(如SputnikVM)进行差分模糊测试和对其他非EVM的知名公有链的虚拟机(EOS-VM/Solana/Cardano)安全性进行研究
- 客户端:现有的对以太坊客户端的测试主要以Geth为主。但是从以太坊官方的统计数据来看,除了Geth之外,Nethermind、Eriqon、besu同样占有较大的比例,对以上客户端内的EVM实现进行差分模糊测试也是具有一定研究意义的
- 目前探索的方向:学习EVMfuzzer和NeoDiff,扩展到EVM compatible的链上
其他资料
- 6年前其他人总结的EVM相关的资料:pirapira/awesome-ethereum-virtual-machine: Ethereum Virtual Machine Awesome List (github.com)
- https://github.com/kareniel/awesome-evm-security
- WASM对应的VM:appcypher/awesome-wasm-runtimes: A list of webassemby runtimes (github.com)
- Move语言相关资料:MystenLabs/awesome-move: Code and content from the Move community. (github.com)