Convert Figma logo to code with AI

dapphub logodapptools

Dapp, Seth, Hevm, and more

2,086
323
2,086
171

Top Related Projects

8,104

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.

14,020

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.

OpenZeppelin Contracts is a library for secure smart contract development.

3,826

Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Rootstock, Tron and other EVM-compatible blockchains.

5,235

Static Analyzer for Solidity and Vyper

22,999

Solidity, the Smart Contract Programming Language

Quick Overview

Dapptools is a suite of Ethereum-focused CLI tools developed by DappHub. It provides a comprehensive set of utilities for Ethereum smart contract development, testing, and deployment, with a focus on the Solidity programming language. Dapptools aims to streamline the development process for decentralized applications (dapps) on the Ethereum blockchain.

Pros

  • Comprehensive toolset for Ethereum development, including testing, deployment, and interaction with smart contracts
  • Fast and efficient testing framework (dapp test) with support for fuzz testing
  • Powerful command-line interface for interacting with Ethereum networks and smart contracts
  • Seamless integration with other Ethereum development tools and libraries

Cons

  • Steep learning curve for developers new to Ethereum or command-line tools
  • Limited documentation and community support compared to more mainstream Ethereum development tools
  • Primarily focused on Solidity, with less support for other smart contract languages
  • Requires familiarity with Unix-like systems and command-line interfaces

Code Examples

  1. Running tests with dapp test:
dapp test

This command runs all the tests in the current project directory.

  1. Deploying a contract with seth:
seth send --create out/MyContract.bin 'constructor(uint256)' 1000

This example deploys a contract named MyContract with a constructor parameter of 1000.

  1. Interacting with a deployed contract using seth:
seth call $CONTRACT_ADDRESS 'balanceOf(address)(uint256)' $USER_ADDRESS

This command calls the balanceOf function on a deployed contract, passing a user's address as an argument.

Getting Started

To get started with Dapptools, follow these steps:

  1. Install Dapptools:
curl https://dapp.tools/install | sh
  1. Create a new Dapp project:
dapp init my-project
cd my-project
  1. Write your Solidity contracts in the src/ directory.

  2. Write tests in the src/ directory with a .t.sol extension.

  3. Run tests:

dapp test
  1. Deploy your contract:
dapp build
seth send --create out/MyContract.bin 'constructor()'

For more detailed instructions and advanced usage, refer to the official Dapptools documentation.

Competitor Comparisons

8,104

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.

Pros of Foundry

  • Faster compilation and testing speeds due to Rust implementation
  • Built-in fuzzing capabilities for more robust testing
  • Simpler installation process and better Windows support

Cons of Foundry

  • Smaller ecosystem and fewer available tools compared to Dapptools
  • Steeper learning curve for developers familiar with JavaScript-based tools

Code Comparison

Dapptools (using Seth):

seth send $CONTRACT "transfer(address,uint256)" $RECIPIENT $AMOUNT

Foundry (using Cast):

cast send $CONTRACT "transfer(address,uint256)" $RECIPIENT $AMOUNT

Both tools offer similar functionality for interacting with smart contracts, but Foundry's Cast command tends to be faster in execution.

Additional Notes

Foundry is gaining popularity due to its performance advantages and modern tooling approach. However, Dapptools still has a strong user base and a more extensive set of tools for various blockchain development tasks. The choice between the two often depends on specific project requirements and developer preferences.

14,020

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.

Pros of Truffle

  • More user-friendly and easier to set up for beginners
  • Extensive documentation and large community support
  • Integrated testing framework with Mocha and Chai

Cons of Truffle

  • Slower compilation and deployment compared to Dapptools
  • Less flexibility for advanced users who prefer command-line tools
  • Limited support for formal verification

Code Comparison

Truffle (JavaScript):

const MyContract = artifacts.require("MyContract");

module.exports = function(deployer) {
  deployer.deploy(MyContract);
};

Dapptools (Seth):

#!/usr/bin/env bash
set -e
export ETH_GAS=4000000
seth send --create out/MyContract.bin 'MyContract()'

Truffle provides a more structured and JavaScript-based approach to contract deployment, while Dapptools uses shell scripts and command-line tools for a more lightweight and flexible deployment process. Truffle's approach may be more familiar to web developers, while Dapptools caters to users comfortable with Unix-like environments and command-line interfaces.

OpenZeppelin Contracts is a library for secure smart contract development.

Pros of OpenZeppelin Contracts

  • Comprehensive library of secure, tested, and community-reviewed smart contracts
  • Regularly updated with new features and security improvements
  • Extensive documentation and integration guides

Cons of OpenZeppelin Contracts

  • May include unnecessary complexity for simple projects
  • Potential for over-reliance on pre-built contracts, limiting custom development

Code Comparison

OpenZeppelin Contracts:

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("MyToken", "MTK") {
        _mint(msg.sender, initialSupply);
    }
}

DappTools:

pragma solidity ^0.8.6;

contract MyToken {
    mapping(address => uint) public balanceOf;
    uint public totalSupply;

    constructor(uint _supply) {
        balanceOf[msg.sender] = _supply;
        totalSupply = _supply;
    }
}

The OpenZeppelin example showcases the simplicity of creating an ERC20 token using their library, while the DappTools example demonstrates a more bare-bones approach to token creation.

3,826

Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Rootstock, Tron and other EVM-compatible blockchains.

Pros of Mythril

  • Specialized in security analysis and vulnerability detection for smart contracts
  • Supports multiple blockchain platforms beyond Ethereum
  • Utilizes symbolic execution and SMT solving for in-depth analysis

Cons of Mythril

  • Steeper learning curve for non-security experts
  • May produce false positives in some cases
  • Limited functionality outside of security analysis

Code Comparison

Mythril (vulnerability detection):

def check_integer_overflow(self, state, node):
    state.world_state.constraints.append(
        ULT(node.value, BitVecVal(2**256, 256))
    )
    return [Issue(...)]

Dapptools (testing and deployment):

function testDeployment() public {
    MyContract deployedContract = new MyContract();
    assertTrue(address(deployedContract) != address(0));
    assertEq(deployedContract.owner(), address(this));
}

Mythril focuses on detecting vulnerabilities in smart contract code, while Dapptools provides a broader set of development tools for testing, deployment, and interaction with smart contracts. Mythril's code example shows its approach to checking for integer overflow, whereas Dapptools' example demonstrates a simple deployment test.

5,235

Static Analyzer for Solidity and Vyper

Pros of Slither

  • Focuses specifically on security analysis and vulnerability detection in Solidity code
  • Provides a wide range of built-in detectors for common smart contract vulnerabilities
  • Easily integrates into CI/CD pipelines for automated security checks

Cons of Slither

  • Limited to static analysis and doesn't provide full development environment tools
  • May produce false positives that require manual verification
  • Steeper learning curve for interpreting and acting on analysis results

Code Comparison

Slither (vulnerability detection):

slither.detectors.reentrancy.reentrancy.ReentrancyRead
slither.detectors.variables.uninitialized_state_variables.UninitializedStateVarsDetection
slither.detectors.attributes.const_functions_state.ConstantFunctionsState

Dapptools (development and testing):

dapp build
dapp test
seth send $CONTRACT "transfer(address,uint256)" $RECIPIENT $AMOUNT

Slither excels in automated security analysis, while Dapptools provides a comprehensive suite of development tools for Ethereum projects. Slither is more focused on vulnerability detection, whereas Dapptools offers a broader range of functionalities for building, testing, and interacting with smart contracts. The choice between them depends on specific project needs and development workflow preferences.

22,999

Solidity, the Smart Contract Programming Language

Pros of Solidity

  • Official Ethereum smart contract language with extensive documentation and community support
  • Continuously updated with new features and improvements for Ethereum development
  • Integrated with most Ethereum development tools and frameworks

Cons of Solidity

  • Focused solely on smart contract development, lacking broader development tooling
  • Steeper learning curve for developers new to blockchain and smart contract concepts
  • Limited testing and debugging capabilities within the repository itself

Code Comparison

Solidity (smart contract example):

pragma solidity ^0.8.0;

contract SimpleStorage {
    uint256 private storedData;

    function set(uint256 x) public {
        storedData = x;
    }

    function get() public view returns (uint256) {
        return storedData;
    }
}

Dapptools (testing example using ds-test):

pragma solidity ^0.8.0;

import "ds-test/test.sol";

contract SimpleStorageTest is DSTest {
    SimpleStorage store;

    function setUp() public {
        store = new SimpleStorage();
    }

    function testSetAndGet() public {
        store.set(42);
        assertEq(store.get(), 42, "Storage value mismatch");
    }
}

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Dapp tools by DappHub Chat

Hello!

dapptools is a suite of Ethereum focused CLI tools following the Unix design philosophy, favoring composability, configurability and extensibility.

This repository contains the source code for several programs hand-crafted and maintained by DappHub, along with dependency management, courtesy of Nix.

  • dapp - All you need Ethereum development tool. Build, test, fuzz, formally verify, debug & deploy solidity contracts.
  • seth - Ethereum CLI. Query contracts, send transactions, follow logs, slice & dice data.
  • hevm - Testing oriented EVM implementation. Debug, fuzz, or symbolically execute code against local or mainnet state.
  • ethsign - Sign Ethereum transactions from a local keystore or hardware wallet.

Development Status

dapptools is currently in a stage of clandestine development where support for the casual user may be deprived. The software can now be considered free as in free puppy. Users seeking guidance can explore using foundry as an alternative

Installation

Install Nix if you haven't already (instructions). Then install dapptools:

With flakes

nix profile install github:dapphub/dapptools#{dapp,ethsign,hevm,seth}

Nix will offer to use the dapptools binary cache, which will speed up installs, but requires you to trust both us and the Cachix infrastructure.

Legacy

curl https://dapp.tools/install | sh

This configures the dapphub binary cache and installs the dapp, solc, seth and hevm executables.

NOTE: Arm support in the GHC haskell compiler is still fairly bleeding edge, until this situation stabilises, users of M1 macs must run dapptools (and the installer!) under rosetta 2 (i.e. as an emulated x86 program). Make sure /etc/nix/nix.conf contains system = x86_64-darwin.

You can also install an individual tool with:

nix-env -iA <tool> -f $(curl -sS https://api.github.com/repos/dapphub/dapptools/releases/latest | jq -r .tarball_url)

If you instead want to build from master, change the url to https://github.com/dapphub/dapptools/archive/master.tar.gz.

Prebuilt hevm binary

Static binaries for linux and macos of hevm are available for each release at https://github.com/dapphub/dapptools/releases.

Most functionality is available out of the box, but for symbolic execution you will need solc and (z3 or cvc4 (or both)).

Getting started

For more information about the tools, consult the individual README pages:

or use the --help flag for any tool.

We're also happy to answer any questions at https://dapphub.chat/.

Examples

Deploy a 'Hello World' contract and call it:

export ETH_RPC_URL=https://mainnet.infura.io/v3/$YOUR_API_KEY
export ETH_FROM=$YOUR_ADDRESS
echo 'contract Hello { function hi() public pure returns(string memory) {return "Hello, World!";}}' | solc --bin -o . --overwrite -
HELLO=$(seth send --create $(<Hello.bin))
seth call $HELLO "hi()(string)"

Debug the first transaction of the latest block in the interactive debugger:

export ETH_RPC_URL=https://mainnet.infura.io/v3/$YOUR_API_KEY
seth run-tx $(seth block latest transactions | jq .'[0]' -r) --debug

If Vitalik's next transaction were a contract deployment, calculate the address it would be deployed at:

export ETH_RPC_URL=https://mainnet.infura.io/v3/$YOUR_API_KEY
dapp address 0xab5801a7d398351b8be11c439e05c5b3259aec9b $(seth nonce 0xab5801a7d398351b8be11c439e05c5b3259aec9b)

Symbolically explore the possible execution paths of a call to dai.transfer(address,uint):

seth bundle-source 0x6b175474e89094c44da98b954eedeac495271d0f > daisrc.json && \
hevm symbolic --address 0x6b175474e89094c44da98b954eedeac495271d0f --rpc $ETH_RPC_URL  --debug --sig "transfer(address,uint256)" --json-file daisrc.json

Contributing

Contributions are always welcome! You may be interested in the architecture of this repository.

built with nix