Package: eth-testrpc
# Ethereum Test RPC server[![Join the chat athttps://gitter.im/pipermerriam/eth-testrpc](https://badges.gitter.im/pipermerriam/eth-testrpc.svg)](https://gitter.im/pipermerriam/eth-testrpc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)## Ethereum Test RPCLimited RPC client intended for use with automated testing. Uses
[pythereum](https://github.com/ethereum/pyethereum) to run an Ethereum client
behind the scenes without the need for mining or networking. The result is an
Ethereum client that provides instant results and quick feedback during
development.### InstallInstalling is easy, through pip:` $ pip installeth-testrpc`Or, to upgrade:` pip installeth-testrpc--upgrade`Or, to install with gevent threads` pip installeth-testrpc[gevent]`And then set the environment variableTESTRPC_THREADING_BACKEND=gevent### RunInstalling through pip will make thetestrpc-pycommand available on your machine:` $ testrpc `This will run testrpc on localhost:8545. You can pass through a different port (-p, –port) or domain (-d, –domain).### Implemented methodsThe RPC methods currently implemented are:eth_coinbaseeth_accountseth_gasPriceeth_blockNumbereth_sendTransactioneth_sendRawTransactioneth_calleth_getCompilerseth_compileSolidityeth_getCode(only supports block number “latest”)eth_getBalanceeth_getTransactionCounteth_getTransactionByHasheth_getTransactionReceipteth_newBlockFilter(temporarily removed until implemented in underlying library)eth_newFilter(temporarily removed until implemented in underlying library)eth_getFilterChanges(temporarily removed until implemented in underlying library)eth_uninstallFilter(temporarily removed until implemented in underlying library)eth_protocolVersion( seerpc_configure)eth_syncing( seerpc_configure)eth_mining( seerpc_configure)web3_sha3web3_clientVersionnet_version(seerpc_configure)net_listening(seerpc_configure)net_peerCount(seerpc_configure)There’s also special non-standard methods that aren’t included within the original RPC specification:evm_reset: No params, no return value.evm_snapshot: No params. Returns the integer id of the snapshot created.evm_revert: One optional param. Reverts to the snapshot id passed, or the latest snapshot.When callingevm_reset, thetestrpcwill revert the state of its internal
chain back to the genesis block and it will act as if no processing of
transactions has taken place. Similarly, you can useevm_snapshotandevm_revertmethods to save and restore the evm state as desired. Example use
cases for these methods are as follows:evm_reset: Run once at the beginning of your test suite.evm_snapshot: Run at the beginning of each test, snapshotting the state of the evm.evm_revert: Run at the end of each test, reverting back to a known clean state.TestRPC also exposes theevm_minemethod for advancing the test evm by some
number of blocks.evm_mine: Optionally supply an integer for the number of blocks to mine.  Default is 1 block. No return value.TestRPC exposes thetesting_timeTravelmethod for fast-forwarding to a future timestamp.testing_timeTravel: Takes an integer timestamp that must be greater than the timestamp of the current latest block.TestRPC exposes therpc_configuremethod which can be used to modify the
static values returned by the following endpoints.eth_protocolVersion(default63)eth_syncing(defaultFalse)eth_mining(defaultTrue)net_version(default1)net_listening(defaultFalse)net_peerCount(default0)homestead_block_number(default0)dao_fork_block_number(default0)anti_dos_fork_block_number(default0)clearing_fork_block_number(default0)Therpc_configuretakes two parameters.key: string representing the rpc method on which you want to change the return value.value: the value that should be returned by the endpoint.Thehomestead,dao,anti_dosandclearingfork configurations determine
which block number the respective fork rules should come into effect.  All
default to0.TestRPC uses a default gas limit of 4000000.  To change this set the
environment variableTESTRPC_GAS_LIMITto the desired value.### Releasing a new version (for eth-testrpc developers)Bump version number insetup.pyAdd entry toCHANGES.txtTag the release.` git tag-s-m"X.X.X Release" vX.X.X git push--tags`Go make the release on github for the tag you just pushedBuild and push release to PyPI` make release `### LicenseMIT### ConsensysThis library was originally authored by Consensys and transferred later when it
was no longer maintained.  A big thanks for them to creating this extremely
useful library.