mythril.ethereum.interface.rpc package

Submodules

mythril.ethereum.interface.rpc.base_client module

This module provides a basic RPC interface client.

This code is adapted from: https://github.com/ConsenSys/ethjsonrpc

class mythril.ethereum.interface.rpc.base_client.BaseClient[source]

Bases: object

The base RPC client class.

eth_blockNumber()[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber

TESTED

eth_coinbase()[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase

TESTED

eth_getBalance(address=None, block='latest')[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance

TESTED

eth_getBlockByNumber(block='latest', tx_objects=True)[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber

TESTED

eth_getCode(address, default_block='latest')[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode

NEEDS TESTING

eth_getStorageAt(address=None, position=0, block='latest')[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat

TESTED

eth_getTransactionReceipt(tx_hash)[source]

TODO: documentation

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt

TESTED

mythril.ethereum.interface.rpc.client module

This module contains a basic Ethereum RPC client.

This code is adapted from: https://github.com/ConsenSys/ethjsonrpc

class mythril.ethereum.interface.rpc.client.EthJsonRpc(host='localhost', port=8545, tls=False)[source]

Bases: mythril.ethereum.interface.rpc.base_client.BaseClient

Ethereum JSON-RPC client class.

close()[source]

Close the RPC client’s session.

mythril.ethereum.interface.rpc.constants module

This file contains constants used used by the Ethereum JSON RPC interface.

mythril.ethereum.interface.rpc.exceptions module

This module contains exceptions regarding JSON-RPC communication.

exception mythril.ethereum.interface.rpc.exceptions.BadJsonError[source]

Bases: mythril.ethereum.interface.rpc.exceptions.EthJsonRpcError

An RPC exception denoting that the RPC instance returned a bad JSON object.

exception mythril.ethereum.interface.rpc.exceptions.BadResponseError[source]

Bases: mythril.ethereum.interface.rpc.exceptions.EthJsonRpcError

An RPC exception denoting that the RPC instance returned a bad response.

exception mythril.ethereum.interface.rpc.exceptions.BadStatusCodeError[source]

Bases: mythril.ethereum.interface.rpc.exceptions.EthJsonRpcError

An RPC exception denoting a bad status code returned by the RPC instance.

exception mythril.ethereum.interface.rpc.exceptions.ConnectionError[source]

Bases: mythril.ethereum.interface.rpc.exceptions.EthJsonRpcError

An RPC exception denoting there was an error in connecting to the RPC instance.

exception mythril.ethereum.interface.rpc.exceptions.EthJsonRpcError[source]

Bases: Exception

The JSON-RPC base exception type.

mythril.ethereum.interface.rpc.utils module

This module contains various utility functions regarding the RPC data format and validation.

mythril.ethereum.interface.rpc.utils.clean_hex(d)[source]

Convert decimal to hex and remove the “L” suffix that is appended to large numbers.

Parameters:d
Returns:
mythril.ethereum.interface.rpc.utils.ether_to_wei(ether)[source]

Convert ether to wei.

Parameters:ether
Returns:
mythril.ethereum.interface.rpc.utils.hex_to_dec(x)[source]

Convert hex to decimal.

Parameters:x
Returns:
mythril.ethereum.interface.rpc.utils.validate_block(block)[source]
Parameters:block
Returns:
mythril.ethereum.interface.rpc.utils.wei_to_ether(wei)[source]

Convert wei to ether.

Parameters:wei
Returns:

Module contents