基于区块链的毕业设计Etheno – 埃塞诺

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Etheno – 埃塞诺 是一篇很好的国外资料

Etheno

Etheno - 埃塞诺 Etheno - 埃塞诺

Etheno - 埃塞诺

Etheno is the Ethereum testing Swiss Army knife. It’s a JSON RPC multiplexer, analysis tool wrapper, and test integration tool. It eliminates the complexity of setting up analysis tools like Manticore and Echidna on large, multi-contract projects. In particular, custom Manticore analysis scripts require less code, are simpler to write, and integrate with Truffle.

If you are a smart contract developer, you should use Etheno to test your contracts. If you are an Ethereum client developer, you should use Etheno to perform differential testing on your implementation. For example, Etheno is capable of automatically reproducing the Constantinople gas usage consensus bug that caused a fork on Ropsten.

Etheno is named after the Greek goddess Stheno, sister of Medusa, and mother of Echidna—which also happens to be the name of our EVM property-based fuzz tester.

Features

  • JSON RPC Multiplexing: Etheno runs a JSON RPC server that can multiplex calls to one or more clients
    • API for filtering and modifying JSON RPC calls
    • Enables differential testing by sending JSON RPC sequences to multiple Ethereum clients
    • Deploy to and interact with multiple networks at the same time
  • Analysis Tool Wrapper: Etheno provides a JSON RPC client for advanced analysis tools like Manticore
    • Lowers barrier to entry for using advanced analysis tools
    • No need for custom scripts to set up account and contract state
    • Analyze arbitrary transactions without Solidity source code
  • Integration with Test Frameworks like Ganache and Truffle
    • Run a local test network with a single command
    • Use Truffle migrations to bootstrap Manticore analyses
    • Symbolic semantic annotations within unit tests

Quickstart

Use our prebuilt Docker container to quickly install and try Etheno:

docker pull trailofbits/etheno docker run -it trailofbits/etheno  # Run one of the examples etheno@982abdc96791:~$ cd examples/BrokenMetaCoin/ etheno@982abdc96791:~/examples/BrokenMetaCoin$ etheno --truffle --ganache --manticore --manticore-max-depth 2 --manticore-script ExploitMetaCoinManticoreScript.py 

Alternatively, natively install Etheno in a few shell commands:

# Install system dependencies sudo apt-get update && sudo apt-get install python3 python3-pip -y  # Install Etheno pip3 install --user etheno  # Use the Etheno CLI cd /path/to/a/truffle/project etheno --manticore --ganache --truffle 

Usage

Etheno can be used in many different ways and therefore has numerous command-line argument combinations.

JSON RPC Server and Multiplexing

This command starts a JSON RPC server and forwards all messages to the given clients:

etheno https://client1.url.com:1234/ https://client2.url.com:8545/ http://client3.url.com:8888/ 
  • --port or -p allows you to specify a port on which to run Etheno’s JSON RPC server (default is 8545)
  • --run-publicly allows incoming JSON RPC connections from external computers on the network
  • --debug will run a web-based interactive debugger in the event that an internal Etheno client throws an exception while processing a JSON RPC call; this should never be used in conjunction with --run-publicly
  • --master or -s will set the “master” client, which will be used for synchronizing with Etheno clients like Manticore. If a master is not explicitly provided, it defaults to the first client listed.
  • --raw, when prefixed before a client URL, will cause Etheno to auto-sign all transactions and submit then to the client as raw transactions

Geth and Parity Integration

A Geth and/or Parity instance can be run as a private chain with

  • --geth or -go for Geth
  • --parity or -pa for Parity

Each will be instantiated with an autogenerated genesis block. You may provide a custom genesis.json file in Geth format using the --genesis or -j argument. The genesis used for each run will automatically be saved to the log directory (if one is provided using the --log-dir option), or it can be manually saved to a location provided with the --save-genesis option.

The network ID of each client will default to 0x657468656E6F (equal to the string etheno in ASCII). This can be overridden with the --network-id or -i option.

EIP and hard fork block numbers can be set within a custom genesis.json as usual, or they may be specified as command-line options such as --constantinople.

Ganache Integration

A Ganache instance can automatically be run within Etheno:

etheno --ganache 
  • --ganache-port will set the port on which Ganache is run; if omitted, Etheno will choose the lowest port higher than the port on which Etheno’s JSON RPC server is running
  • --ganache-args lets you pass additional arguments to Ganache
  • --accounts or -a sets the number of accounts to create in Ganache (default is 10)
  • --balance or -b sets the default balance (in Ether) to seed to each Ganache account (default is 100.0)
  • --gas-price or -c sets the default gas price for Ganache (default is 20000000000)

NOTE: As of September, 2020, there is an upstream bug in ganache-cli that prevents it from being run on Node version 14. If you intend to use Truffle and/or Ganache, we suggest using Node 12 (e.g., with nvm).

Differential Testing

Whenever two or more clients are run within Etheno, the differential testing plugin will automatically be loaded. This plugin checks for a variety of different discrepancies between the clients, such as gas usage differences. A report is printed when Etheno exits.

This plugin can be disabled with the --no-differential-testing option.

Property-Based Fuzz Testing

Echidna can be run to fuzz test the clients, which is useful for differential testing:

etheno --echidna 

By default, Echidna deploys a generic fuzz testing contract to all clients, enumerates a minimal set of transactions that maximize the coverage of the contract, sends those transactions to the clients, and then exits.

  • --fuzz-limit limits the number of transactions that Echidna will emit
  • --fuzz-contract lets the user specify a custom contract for Echidna to deploy and fuzz

Manticore Client

Manticore—which, by itself, does not implement a JSON RPC interface—can be run as an Etheno client, synchronizing its accounts with Etheno’s master client and symbolically executing all transactions sent to Etheno.

etheno --manticore 

This alone will not run any Manticore analyses; they must either be run manually, or automated through the --truffle command;

  • --manticore-verbosity sets Manticore’s logging verbosity (default is 3)
  • --manticore-max-depth sets the maximum state depth for Manticore to explore; if omitted, Manticore will have no depth limit

Truffle Integration

Truffle migrations can automatically be run within a Truffle project:

etheno --truffle 

When combined with the --manticore option, this will automatically run Manticore’s default analyses on all contracts created once the Truffle migration completes:

etheno --truffle --manticore 

This requires a master JSON RPC client, so will most often be used in conjunction with Ganache. If a local Ganache server is not running, you can simply add that to the command:

etheno --truffle --manticore --ganache 

If you would like to run a custom Manticore script instead of the standard Manticore analysis and detectors, it can be specified using the --manticore-script or -r command.

This script does not need to import Manticore or create a ManticoreEVM object; Etheno will run the script with a global variable called manticore that already contains all of the accounts and contracts automatically provisioned. See the BrokenMetaCoin Manticore script for an example.

Additional arguments can be passed to Truffle using --truffle-args.

Logging

By default, Etheno only prints log messages to the console with a log level defaulting to INFO. An alternative log level can be specified with --log-level or -l. You can specify a log file with the --log-file option. In addition, you can provide the path to a logging directory with --log-dir in which the following will be saved:

  • a complete log file including log messages at all log levels;
  • separate log files for each Etheno client and plugin;
  • the genesis file used to instantiate clients;
  • a subdirectory in which each client and plugin can store additional files such as test results;
  • a script to re-run Geth and/or Parity using the same genesis and chain data that Etheno used.

Requirements

  • Python 3.6 or newer
  • Manticore release 0.2.2 or newer
  • Flask, which is used to run the JSON RPC server

Optional Requirements

  • Truffle and Ganache for their associated integrations
  • Geth and/or Parity, if you would like to have Etheno run them
  • Echidna, for smart contract fuzzing and differential testing
    • Note that Etheno currently requires the features in the dev-no-hedgehog branch; Etheno will prompt you to automatically install this when you try and run it the first time
    • Running Echidna also requires the solc compiler

Getting Help

Feel free to stop by our Slack channel for help on using or extending Etheno.

Documentation is available in several places:

  • The wiki contains some basic information about getting started with Etheno and contributing

  • The examples directory has some very minimal examples that showcase API features

License

Etheno is licensed and distributed under the AGPLv3 license. Contact us if you’re looking for an exception to the terms.


Etheno

<Etheno>Etheno - 埃塞诺

Etheno - 埃塞诺

<Etheno>

Etheno是以太坊eth测试瑞士军刀。它是一个JSON-RPC多路复用器、分析工具包装器和测试集成工具。它消除了在大型、多合同项目上设置分析工具(如Manticore和Echidna)的复杂性。特别是,定制的Manticore分析脚本需要更少的代码,更易于编写,并且与Truffle集成。

如果您是智能合约开发人员,则应使用Etheno测试您的合约。如果您是以太坊eth客户机开发人员,您应该使用Etheno对您的实现执行差异测试。例如,Etheno能够自动复制导致Ropsten分叉的君士坦丁堡天然气使用共识错误。

特性

  • JSON-RPC多路复用:Etheno运行一个JSON-RPC服务器,该服务器可以将调用多路传输到一个或多个客户端API,以过滤和修改JSON-RPC调用,从而通过将JSON-RPC序列发送到多个客户端来实现差异测试以太坊eth客户端同时部署到多个网络并与多个网络交互
  • 分析工具使用高级分析工具,无需使用高级分析工具来分析客户机的“无障碍”和“无需使用高级分析工具”
  • 使用单个命令运行本地测试网络

快速启动

埃塞诺是以希腊女神塞诺命名的,她是美杜莎的妹妹,也是针鼹的母亲,这也是我们基于EVM属性的模糊测试仪的名字。

docker pull trailofbits/etheno docker run -it trailofbits/etheno  # Run one of the examples etheno@982abdc96791:~$ cd examples/BrokenMetaCoin/ etheno@982abdc96791:~/examples/BrokenMetaCoin$ etheno --truffle --ganache --manticore --manticore-max-depth 2 --manticore-script ExploitMetaCoinManticoreScript.py 

使用我们预先构建的Docker容器快速安装并尝试Etheno:

# Install system dependencies sudo apt-get update && sudo apt-get install python3 python3-pip -y  # Install Etheno pip3 install --user etheno  # Use the Etheno CLI cd /path/to/a/truffle/project etheno --manticore --ganache --truffle 

使用情况

或者,在几个shell命令中本机安装Etheno:

JSON RPC服务器和多路复用

Etheno可以以多种不同的方式使用,因此有许多命令行参数组合。

etheno https://client1.url.com:1234/ https://client2.url.com:8545/ http://client3.url.com:8888/ 
  • –公开运行允许从网络上的外部计算机传入JSON RPC连接
  • –如果内部Etheno客户端在处理JSON RPC调用时引发异常,则debug将运行基于web的交互式调试器;这决不能与–run public一起使用
  • –master或-s将设置“master”客户端,它将用于与Manticore等Etheno客户端同步。如果没有显式地提供主服务器,它将默认为列出的第一个客户机。
  • –raw在客户端URL前面加前缀时,将使Etheno自动签名所有事务,然后作为原始事务提交给客户端
  • –geth或-go for geth

Geth和奇偶校验集成

此命令启动JSON RPC服务器并将所有消息转发给给定的客户端:

  • –奇偶校验或-pa表示奇偶校验
  • –ganache port将设置运行ganache的端口;如果忽略,Etheno将选择较低的端口而Etheno的JSON RPC服务器运行的端口

一个Geth和/或奇偶校验实例可以作为私有链运行,

每个实例都将用一个自动生成的genesis块实例化。你可以提供一个定制创世纪.json使用–genesis或-j参数以Geth格式提交。每次运行使用的genesis将自动保存到log目录中(如果使用–log dir选项提供了一个),也可以手动将其保存到带有–save genesis选项的位置。

每个客户端的网络ID将默认为0x657468656E6F(等于ASCII中的字符串etheno)。这可以用–network id或-i选项覆盖。

差异测试

EIP和硬叉块编号可以在自定义中设置创世纪.json或者可以将它们指定为命令行选项,例如–constantinople。

etheno --ganache 
  • –ganache args允许您向ganache传递额外的参数
  • –accounts或-a设置要在ganache中创建的帐户数(默认值为10)
  • –balance或-b将默认余额(以太形式)设置为每个ganache帐户的种子(默认值为100.0)
  • –gas price or-c设置Ganache的默认天然气价格(默认值为200000000000)
  • –fuzz limit限制Echidna将发出的事务数

Ganache实例可以在Etheno中自动运行:

基于属性的模糊测试

注意:截至2020年9月,Ganache cli中存在一个上游错误,它阻止了它在节点版本14上运行。如果您打算使用Truffle和/或Ganache,我们建议使用Node 12(例如,与nvm一起使用)。

只要在Etheno中运行两个或多个客户端,就会自动加载差异测试插件。此插件检查客户端之间的各种不同差异,例如气体使用差异。当Etheno退出时,将打印报告。

Manticore客户端

可以使用–no differential testing选项禁用此插件。

etheno --echidna 

可以运行Echidna来对客户端进行模糊测试,这对于差异测试很有用:

  • –fuzz contract允许用户为Echidna指定要部署和fuzz的自定义协定
  • –manticore verbosity设置manticore的日志记录详细程度(默认值是3)

Truffle集成

默认情况下,Echidna将一个通用的模糊测试契约部署到所有客户端,枚举一组最小的事务,最大限度地扩大契约的覆盖范围,将这些事务发送到客户端,然后退出。

etheno --manticore 

Manticore本身不实现JSON-RPC接口,可以作为Etheno客户机运行,将其帐户与Etheno的主客户端同步,并象征性地执行发送到Etheno的所有事务。

  • ——manticore max depth设置manticore要探索的最大状态深度;如果省略,manticore将没有深度限制
  • 一个完整的日志文件,包括所有日志级别的日志消息;

记录

仅此操作不会运行任何Manticore分析;它们必须手动运行,或者通过–truffle命令自动运行;

etheno --truffle 

truffle迁移可以在truffle项目中自动运行:

etheno --truffle --manticore 

与–Manticore选项结合使用时,一旦Truffle迁移完成,这将自动对创建的所有契约运行Manticore的默认分析:

etheno --truffle --manticore --ganache 

这需要一个主JSON RPC客户端,因此通常与Ganache一起使用。如果本地Ganache服务器没有运行,只需将其添加到命令中:

如果要运行自定义Manticore脚本而不是标准的Manticore分析和检测器,则可以使用–Manticore脚本或-r命令指定它。

此脚本不需要导入Manticore或创建ManticoreEVM对象;Etheno将使用名为Manticore的全局变量运行脚本,该变量已包含自动设置的所有帐户和合同。有关示例,请参见BrokenMetaCoin Manticore脚本。

要求

可以使用–Truffle参数将其他参数传递给Truffle。

  • 每个Etheno客户端和插件的单独日志文件;
  • 用于实例化客户端的genesis文件;
  • 每个客户端和插件都可以在其中存储额外文件(如测试结果)的子目录;
  • 使用Etheno使用的相同的genesis和chain数据重新运行Geth和/或奇偶校验的脚本。
  • Python3.6或更新版本

可选要求

  • Manticore 0.2.2或更新版本
  • Flask,用于运行JSON RPC服务器
  • Truffle和Ganache,以进行关联的集成

获取帮助

  • Geth和/或奇偶校验,前提是您希望Etheno运行它们
  • Echidna,以便进行智能合约模糊化和差异化测试请注意,Etheno当前需要dev no hedgehog分支中的功能;Etheno将在您第一次尝试运行Echidna时提示您自动安装它,这也需要solc编译器
  • 注意,Etheno目前需要dev no hedgehog分支中的功能;当您第一次尝试运行它时,Etheno将提示您自动安装它

许可证

默认情况下,Etheno只将日志消息打印到控制台,日志级别默认为INFO。可以使用–log level或-l指定备用日志级别。可以使用–log file选项指定日志文件。此外,您可以使用–log dir提供日志目录的路径,其中将保存以下内容:

请随时访问Slack频道,以获取有关使用或扩展Etheno的帮助。

  • 文档在多个地方提供:

  • wiki包含一些关于Etheno入门和贡献的基本信息。

License

示例目录中有一些展示API功能的非常小的示例。

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/17503.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Etheno – 埃塞诺

提供最优质的资源集合

立即查看 了解详情