Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tintinweb/evm-shell
An interactive EVM repl/shell.
https://github.com/tintinweb/evm-shell
ethereum evm repl shell
Last synced: 25 days ago
JSON representation
An interactive EVM repl/shell.
- Host: GitHub
- URL: https://github.com/tintinweb/evm-shell
- Owner: tintinweb
- Created: 2021-09-02T14:46:32.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-30T11:50:25.000Z (about 3 years ago)
- Last Synced: 2024-10-03T12:40:02.306Z (about 1 month ago)
- Topics: ethereum, evm, repl, shell
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/evm-shell
- Size: 66.4 KB
- Stars: 32
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](https://diligence.consensys.net)
[[ ๐ ](https://diligence.consensys.net) [ ๐ฉ ](https://github.com/ConsenSys/vscode-solidity-doppelganger/blob/master/mailto:[email protected]) [ ๐ฅ ](https://consensys.github.io/diligence/)]## EVM Shell
A hands-on interactive EVM repl/shell. Low-level ethereum virtual machine inspection.
[๐พ](https://www.npmjs.com/package/solidity-shell) `npm install -g evm-shell`
In order to understand smart contracts you have to become a smart contract. `evm-shell` is your entrance to this rabbithole ๐ฐ๐ณ๏ธ.
Imagine, you wake up as a smart contract deployed at address `0xc0de00000000000000000000000000000000c0de`. Your friend at account `0xbabe00000000000000000000000000000000babe` is calling your contract code. You decide what to do, step-by-step, one [instruction](https://ethervm.io/) at a time. Perform arithmetic operations, manipulate the stack, memory, storage, emit events, and much more. Your code, your rules ๐.
![evm-shell](https://user-images.githubusercontent.com/2865694/135447272-12dd096f-8883-4c2d-871b-ed8102687033.gif)
```javascript
โ evm-shell
๐ Entering interactive EVM shell. 'help' is your friend. '[Tab]' for autocomplete.
โ chainId: 1
โ hardfork: london
โ address: 0xc0de00000000000000000000000000000000c0de
โ value: 100
โ gasLimit: 68719476735
โ gasPrice: 0
โ caller/origin:0xbabe00000000000000000000000000000000babe/0xbabe00000000000000000000000000000000babe๐ Bugs/Feedback โ github/@tintinweb
โ https://github.com/tintinweb/evm-shell/ | ConsenSys Diligence @ https://consensys.net/diligence/ยป push 1
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 2
[code ]: 0x6001
[gasUsed ]: 3
[stack ]: ["01"] โ
[memory ]: โ
[storage ]: []
[logs ]: []ยป push 0xfe
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 4
[code ]: 0x600160fe
[gasUsed ]: 6
[stack ]: ["01","fe"] โ
[memory ]: โ
[storage ]: []
[logs ]: []ยป mul
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 5
[code ]: 0x600160fe02
[gasUsed ]: 11
[stack ]: ["fe"] โ
[memory ]: โ
[storage ]: []
[logs ]: []```
### Hints
* **Note**: This is **not a simulator**, we actually run your code in the amazing [ethereumjs](https://github.com/ethereumjs) vm.
* **Note**: `.reset` completely removes all statements. `.undo` removes the last statement.
* **Note**: Automatically restores the state if you mess up because your instruction reverts ๐### Usage
Basically lists all supported evm instructions. Meta-commands are `dot`-prefixed.
```shell
ยป helpCommands:
help [command...] Provides help for a given command.
exit Exits application.
.show
.reset
.undo
.config
.opcodes
.step [step]
.stack
.memory
.state
.storage
.logs
.disasm
.load
stop [args...]
add [args...]
mul [args...]
sub [args...]
div [args...]
sdiv [args...]
mod [args...]
smod [args...]
addmod [args...]
mulmod [args...]
exp [args...]
signextend [args...]
lt [args...]
gt [args...]
slt [args...]
sgt [args...]
eq [args...]
iszero [args...]
and [args...]
or [args...]
xor [args...]
not [args...]
byte [args...]
shl [args...]
shr [args...]
sar [args...]
sha3 [args...]
address [args...]
balance [args...]
origin [args...]
caller [args...]
callvalue [args...]
calldataload [args...]
calldatasize [args...]
calldatacopy [args...]
codesize [args...]
codecopy [args...]
gasprice [args...]
extcodesize [args...]
extcodecopy [args...]
returndatasize [args...]
returndatacopy [args...]
extcodehash [args...]
blockhash [args...]
coinbase [args...]
timestamp [args...]
number [args...]
difficulty [args...]
gaslimit [args...]
chainid [args...]
selfbalance [args...]
basefee [args...]
pop [args...]
mload [args...]
mstore [args...]
mstore8 [args...]
sload [args...]
sstore [args...]
jump [args...]
jumpi [args...]
pc [args...]
msize [args...]
gas [args...]
jumpdest [args...]
push1 [args...]
push2 [args...]
push3 [args...]
push4 [args...]
push5 [args...]
push6 [args...]
push7 [args...]
push8 [args...]
push9 [args...]
push10 [args...]
push11 [args...]
push12 [args...]
push13 [args...]
push14 [args...]
push15 [args...]
push16 [args...]
push17 [args...]
push18 [args...]
push19 [args...]
push20 [args...]
push21 [args...]
push22 [args...]
push23 [args...]
push24 [args...]
push25 [args...]
push26 [args...]
push27 [args...]
push28 [args...]
push29 [args...]
push30 [args...]
push31 [args...]
push32 [args...]
dup1 [args...]
dup2 [args...]
dup3 [args...]
dup4 [args...]
dup5 [args...]
dup6 [args...]
dup7 [args...]
dup8 [args...]
dup9 [args...]
dup10 [args...]
dup11 [args...]
dup12 [args...]
dup13 [args...]
dup14 [args...]
dup15 [args...]
dup16 [args...]
swap1 [args...]
swap2 [args...]
swap3 [args...]
swap4 [args...]
swap5 [args...]
swap6 [args...]
swap7 [args...]
swap8 [args...]
swap9 [args...]
swap10 [args...]
swap11 [args...]
swap12 [args...]
swap13 [args...]
swap14 [args...]
swap15 [args...]
swap16 [args...]
log0 [args...]
log1 [args...]
log2 [args...]
log3 [args...]
log4 [args...]
create [args...]
call [args...]
callcode [args...]
return [args...]
delegatecall [args...]
create2 [args...]
staticcall [args...]
revert [args...]
invalid [args...]
selfdestruct [args...]
push
```## Examples
### Transaction vars: `msg.sender`, `tx.origin`, `this` etc.
```javascript
ยป caller
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 1
[code ]: 0x33
[gasUsed ]: 2
[stack ]: ["babe00000000000000000000000000000000babe"] โ
[memory ]: โ
[storage ]: []
[logs ]: []ยป address
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 1
[code ]: 0x30
[gasUsed ]: 2
[stack ]: ["c0de00000000000000000000000000000000c0de"] โ
[memory ]: โ
[storage ]: []
[logs ]: []
```### Memory manipulation
```javascript
ยป push 0x1337
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 3
[code ]: 0x611337
[gasUsed ]: 3
[stack ]: ["1337"] โ
[memory ]: โ
[storage ]: []
[logs ]: []ยป push 64
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 5
[code ]: 0x6113376040
[gasUsed ]: 6
[stack ]: ["1337","40"] โ
[memory ]: โ
[storage ]: []
[logs ]: []ยป mstore
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 6
[code ]: 0x611337604052
[gasUsed ]: 18
[stack ]: [] โ
[memory ]: 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001337 โ
[storage ]: []
[logs ]: []ยป push 64
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 8
[code ]: 0x6113376040526040
[gasUsed ]: 21
[stack ]: ["40"] โ
[memory ]: 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001337 โ
[storage ]: []
[logs ]: []ยป mload
ยป
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
[pc ]: 9
[code ]: 0x611337604052604051
[gasUsed ]: 24
[stack ]: ["1337"] โ
[memory ]: 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001337 โ
[storage ]: []
[logs ]: []
```____