You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 21, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+31-7Lines changed: 31 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ Options:
29
29
*`-a` or `--accounts`: Specify the number of accounts to generate at startup.
30
30
*`-b` or `--blocktime`: Specify blocktime in seconds for automatic mining. Default is 0 and no auto-mining.
31
31
*`-d` or `--deterministic`: Generate deterministic addresses based on a pre-defined mnemonic.
32
+
*`-n` or `--secure`: Lock available accounts by default (good for third party transaction signing)
32
33
*`-m` or `--mnemonic`: Use a specific HD wallet mnemonic to generate initial addresses.
33
34
*`-p` or `--port`: Port number to listen on. Defaults to 8545.
34
35
*`-h` or `--hostname`: Hostname to listen on. Defaults to Node's `server.listen()`[default](https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback).
@@ -38,15 +39,31 @@ Options:
38
39
*`-f` or `--fork`: Fork from another currently running Ethereum client at a given block. Input should be the HTTP location and port of the other client, e.g. `http://localhost:8545`. You can optionally specify the block to fork from using an `@` sign: `http://localhost:8545@1599200`.
39
40
*`--debug`: Output VM opcodes for debugging
40
41
41
-
You can also specify `--account=...` (no 's') any number of times passing arbitrary private keys and their associated balances to generate initial addresses:
*`--account`: Specify `--account=...` (no 's') any number of times passing arbitrary private keys and their associated balances to generate initial addresses:
Note that private keys are 64 characters long, and must be input as a 0x-prefixed hex string. Balance can either be input as an integer or 0x-prefixed hex value specifying the amount of wei in that account.
51
+
52
+
An HD wallet will not be created for you when using `--account`.
53
+
54
+
*`-u` or `--unlock`: Specify `--unlock ...` any number of times passing either an address or an account index to unlock specific accounts. When used in conjunction with `--secure`, `--unlock` will override the locked state of specified accounts.
You can also specify a number, unlocking accounts by their index:
46
61
47
-
Note that private keys are 64 characters long, and must be input as a 0x-prefixed hex string. Balance can either be input as an integer or 0x-prefixed hex value specifying the amount of wei in that account.
62
+
```
63
+
$ testrpc --secure -u 0 -u 1
64
+
```
48
65
49
-
An HD wallet will not be created for you when using `--account`.
66
+
This feature can also be used to impersonate accounts and unlock addresses you wouldn't otherwise have access to. When used with the `--fork` feature, you can use the TestRPC to make transactions as any address on the blockchain, which is very useful for testing and dynamic analysis.
50
67
51
68
##### Library
52
69
@@ -76,6 +93,8 @@ Both `.provider()` and `.server()` take a single object which allows you to spec
76
93
*`"total_accounts"`: `number` - Number of accounts to generate at startup.
77
94
*`"fork"`: `string` - Same as `--fork` option above.
78
95
*`"time"`: `Date` - Date that the first block should start. Use this feature, along with the `evm_increaseTime` method to test time-dependent code.
96
+
*`"locked"`: `boolean` - whether or not accounts are locked by default.
97
+
*`"unlocked_accounts"`: `Array` - array of addresses or address indexes specifying which accounts should be unlocked.
79
98
80
99
# IMPLEMENTED METHODS
81
100
@@ -99,6 +118,8 @@ The RPC methods currently implemented are:
99
118
*`eth_getLogs`
100
119
*`eth_getStorageAt`
101
120
*`eth_getTransactionByHash`
121
+
*`eth_getTransactionByBlockHashAndIndex`
122
+
*`eth_getTransactionByBlockNumberAndIndex`
102
123
*`eth_getTransactionCount`
103
124
*`eth_getTransactionReceipt`
104
125
*`eth_hashrate`
@@ -113,6 +134,9 @@ The RPC methods currently implemented are:
113
134
*`net_listening`
114
135
*`net_peerCount`
115
136
*`net_version`
137
+
*`miner_start`
138
+
*`miner_stop`
139
+
*`rpc_modules`
116
140
*`web3_clientVersion`
117
141
*`web3_sha3`
118
142
@@ -121,7 +145,7 @@ There’s also special non-standard methods that aren’t included within the or
121
145
*`evm_snapshot` : Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the integer id of the snapshot created.
122
146
*`evm_revert` : Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to. If no snapshot id is passed it will revert to the latest snapshot. Returns `true`.
123
147
*`evm_increaseTime` : Jump forward in time. Takes one parameter, which is the amount of time to increase in seconds. Returns the total time adjustment, in seconds.
124
-
*`evm_mine` : Force a block to be mined. Takes no parameters.
148
+
*`evm_mine` : Force a block to be mined. Takes no parameters. Mines a block independent of whether or not mining is started or stopped.
0 commit comments