Reproduce and Verify a Transaction in Virtual TestNet
Fork a fixed block, execute a repeatable WETH deposit through RPC and Foundry, and verify the reset result.
Case objective
Create a Virtual TestNet from a fixed Ethereum block, execute the same WETH deposit() with the same inputs, and verify that rebuilding the network restores a consistent starting state.
Example transaction and context
This case forks block 19850321 and uses Foundry's cast to send 1 ETH to the Ethereum WETH contract:
| Input | Value |
|---|---|
| Source chain | Ethereum |
| Fork block | 19850321 |
| Test account | 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 |
| WETH | 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| Call | deposit() with 1 ether value |
Use these commands only against a Virtual TestNet. Use a test key and never place a production wallet key in shell history or documentation.
Questions to answer
- Does the RPC point to the expected fork block?
- Does
deposit()increase the WETH balance by exactly1 WETH? - After deleting and rebuilding from the same block, do the initial state and result remain consistent?
Investigation steps
-
Create an Ethereum Virtual TestNet with Block number set to
19850321. -
Copy the Public RPC URL from its detail page and define temporary local variables:
export SKYLENS_RPC_URL="<YOUR_RPC_URL>" export SKYLENS_TEST_KEY="<TEST_PRIVATE_KEY>" export SKYLENS_TEST_ACCOUNT="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" export WETH_ADDRESS="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" -
Verify the height and record the WETH balance before execution:
cast block-number --rpc-url "$SKYLENS_RPC_URL" cast call "$WETH_ADDRESS" \ "balanceOf(address)(uint256)" "$SKYLENS_TEST_ACCOUNT" \ --rpc-url "$SKYLENS_RPC_URL" -
Use Fund wallet to provide gas on the test network, then send the deposit:
cast send "$WETH_ADDRESS" "deposit()" \ --value 1ether \ --private-key "$SKYLENS_TEST_KEY" \ --rpc-url "$SKYLENS_RPC_URL" -
Query the WETH balance again, then open the transaction from Operations in Skylens.
-
Delete the network, rebuild it from block
19850321, repeat steps 2–5, and compare both records.
Key evidence
Preserve at least the following evidence for every run:
| Check | Expected result |
|---|---|
cast block-number | Initial height corresponds to the fork block; it advances according to test-network behavior after transactions |
cast send receipt | Successful status and a transaction hash visible in Operations |
| WETH balance delta | after - before = 1000000000000000000 wei |
| Balance Changes | Approximately -1 ETH and +1 WETH for the test account, plus gas |
| Balance after rebuild | Restored to the value at the fork block |
| Second balance delta | Again 1000000000000000000 wei |
Use a balance delta instead of assuming the account starts with zero WETH. The result remains verifiable even if the forked account already has a balance.
Conclusion
Both Virtual TestNets start from block
19850321and use the same account, contract, value, and calldata. Eachdeposit()increases WETH by exactly1e18wei. Rebuilding restores the same starting state, making the scenario repeatable and directly comparable.
Caveats
- Treat a Virtual TestNet RPC as an external service and never use a production private key.
- To reproduce a mainnet transaction, usually fork from the block immediately before it.
- Record and fix Warp time for time-dependent behavior; this WETH deposit is not time-dependent.
- Funding wallets, deploying contracts, and sending transactions mutate the current network, so reset or rebuild before another clean run.
