Skip to main content

Ethereum contract tool(command line)

Project description

Ethct: Ethereum contract tool (command line)

1. Now support:

  • Contract compiliation
  • Contract deployment
  • Contract function calls
  • Retrieve infomation from chain

2. Install

Install solc on MacOS:

brew tap ethereum/ethereum
brew install solidity

For Linux/Windows, please refer to the Solidity documentation.

Install ethct:

pip install ethct

3. Usage

  1. Config the tool first:

    ethct --config --privkey <PRIVKEY> --infurakey <INFURAKEY> --network <NETWORK>
    
  2. Compile a contract and save the output files:

    ethct --compile test.sol --save
    
  3. Deploy a contract on ropsten testnet:

    ethct --deploy test.sol --network ropsten
    
  4. Call contract function:

    ethct --address 0x71c46Ed333C35e4E6c62D32dc7C8F00D125b4fee --abi ./build/CaptureTheEther.abi --call 'setNickname ccyanxyz'
    
  5. Call a payable function:

    ethct --address 0x2F796FaC147d6fff8b2485d05aE7FB823A478317 --abi ./build/PredictTheBlockHashChallenge.abi --call 'lockInGuess 0x0000000000000000000000000000000000000000000000000000000000000000 value:1'
    

    'value:1' means the value of this transaction is 1 ether.

  6. Get contract storage:

    ethct --getstorage 0x2F796FaC147d6fff8b2485d05aE7FB823A478317 --position 2
    
  7. Get block:

    ethct --getblock <BLOCKNUM>/latest/earliest/pending/<BLOCKHASH>
    
  8. Get transaction:

    ethct --gettx <TXHASH>
    
  9. Get balance:

    ethct --getbalance <ADDRESS>
    

4. Why build this

To make my life easier completing the CaptureTheEther challenges.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ethct-19.10.31.5.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

ethct-19.10.31.5-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page