Giter VIP home page Giter VIP logo

ethereal's Introduction

Ethereal is a command line tool for managing common tasks in Ethereum. It is designed to allow integration in to batch scripts and to be called from other programs by providing concise information and through use of the quiet mode where results are translated in to exit codes.

Installing Ethereal

Ethereal requires Go. With Go installed you can install Ethereal by running go get github.com/wealdtech/ethereal

Using Ethereal

Access to local wallets

Ethereal works with Geth, MIST and Parity wallets in the standard locations. A simple way to check the addresses that can be seen by Ethereal is to run ethereal account list which will list all accounts that Ethereal can see. If you expect an address to show up and it doesn't then please raise an issue with the relevant details.

If you use Parity and want to import a private key or a wallet from another system please see https://github.com/paritytech/parity/wiki/Backing-up-&-Restoring#restoring-options

If you use Geth and want to import a private key or a wallet from another system please see https://github.com/ethereum/go-ethereum/wiki/Managing-your-accounts

Access to Ethereum networks

Ethereal supports all main Ethereum networks It auto-detects the network by querying the connected node for the network ID. The connection should be geth-compatible, so either geth itself or parity with the --geth flag to enable geth compatibility mode. The connection could be a local node or a network service such as Infura.

Examples

Note that for most of the examples below additional information can be obtained by adding the --verbose flag to the command line.

Increase the gas price for transaction

You have submitted a transaction to the network but it's taking a long time to process because the gas price is too low.

ethereal transaction up --transaction=0x5219b09d629158c2759035c97b11b604f57d0c733515738aaae0d2dafb41ab98 --gasprice=20GWei --passphrase=secret

where transaction is the hash of the pending transactions, gasprice is the price you want to set for gas, and passphrase is the passphrase for the account that sent the transaction.

Cancel a transaction

You have submitted a transaction to the network by mistake and want to cancel it.

ethereal transaction cancel --transaction=0x5219b09d629158c2759035c97b11b604f57d0c733515738aaae0d2dafb41ab98 --passphrase=secret

where transaction is the hash of the pending transactions and passphrase is the passphrase for the account that sent the transaction.

Sweep Ether

You want to transfer all Ether in one account to another.

ethereal ether sweep --from=0x5FfC014343cd971B7eb70732021E26C35B744cc4 --to=0x52f1A3027d3aA514F17E454C93ae1F79b3B12d5d --passphrase=secret

where from is the address from which the Ether will be transferred, to is the address to which the Ether will be transferred, and passphrase is the passphrase for the from account.

Transfer a token

You want to transfer a token to another account.

ethereal token transfer --token=omg --from=0x5FfC014343cd971B7eb70732021E26C35B744cc4 --to=0x52f1A3027d3aA514F17E454C93ae1F79b3B12d5d --amount=10.2 --passphrase=secret

where token is the token to transfer, from is the address from which the token will be transferred, to is the address to which the token will be transferred, amount is the amount of the token to transfer, gasprice is the price you want to set for gas, and passphrase is the passphrase for the from account.

Please note that before using a token name such as 'omg' you should confirm that the contract address matches the expected contract address by using ethereal info --token=omg or similar.

Obtain information about a transaction

ethereal transaction info --transaction=0x5097a149236b675a5807ea78c657b64c71da48789476828fede68126769b24be

Deploy a contract

Ethereal can deploy a contract in various ways, but the easiest is to use solc to create a file containing both the ABI and bytecode, and use that. For example:

solc --optimize --combined-json=abi,bin MyContract.sol >MyContract.json
ethereal contract deploy --json=MyContract.json --from=0xdd8686E0Ea24bc74ea6a4688926b5397D167930E --passphrase=secret --constructor='constructor("hello")'

If the contract does not have a constructor the --constructor argument can be omitted.

Call a contract

You want to obtain information directly from a contract using its ABI, for example call the balanceOf() call of an ERC-20 token.

ethereal contract call --abi='./erc20.abi' --contract=0xd26114cd6EE289AccF82350c8d8487fedB8A0C07 --from=0x5FfC014343cd971B7eb70732021E26C35B744cc4 --call='balanceOf(0x5FfC014343cd971B7eb70732021E26C35B744cc4)'

where abi is the path to the contract's ABI, contract is the address of the contract to call, and call is the ABI method to call.

You can also use the JSON file as referenced in 'Deploy a contract' above, for example:

ethereal contract call --json=MyContract.json --from=0xdd8686E0Ea24bc74ea6a4688926b5397D167930E --call="getString()"

ethereal's People

Contributors

changwu-tw avatar mcdee avatar zergity avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.