sv-evm-simulator
v1.0.3
Published
A libary to create a Ethereum blockchain simulator.
Downloads
2
Readme
SV-EVM-Simulator
Simulate a transaction on the current state of the Ethereum mainnet or any other EVM based network and view the outcomes.
Prerequisites
Install dependencies
Assuming you have Node.js installed, run the following command to install the required packages.
$ npm install sv-evm-simulator
Usage
- Install the sv-evm-simulator packages and import the EvmSimulator.
$ var EvmSimulator = require("./sv-evm-simulator");
- Verify the validity of the RPC_URL before creating a simulator instance with that URL.
$ let isValid = await EvmSimulator.utils.isRpcUrlValid(url);
- If the URL is valid, create a new simulator instance using the createSimulator function.
$ let simulator = new EvmSimulator.createSimulator(rpc_url, port);
- Next, create a new transaction using the createTransaction function, providing the receiver_address and amount.
// Ex: simulator.createTransaction("0x234471783F04Ee0F6844dA5120e43dB6d9968AD4", 5);
$ let txInfo = await simulator.createTransaction(receiver_address, amount);
- Finally, you can access the details of the transaction using the txInfo variable.