> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# FAQ: Virtual Environments

> Answers to common questions about creating, forking, and managing Virtual Environments, including chain IDs, timestamps, State Sync, and team workflows.

> [card]
>
> ## Do I need a paid plan to use Virtual Environments?
>
> ***
>
> Yes. Virtual Environments are available on the paid plan. To enable them for your account, [contact our sales team](https://tenderly.co/contact-us) to schedule a call and discuss upgrading your plan.

> [card]
>
> ## Why do I get a quota limit error when my usage is low?
>
> ***
>
> On plans with a Virtual Environment write limit, each Virtual Environment accepts a fixed number of write operations over its lifetime, such as transactions, balance and storage changes, `evm_mine`, and `evm_increaseTime`. Once it's reached, writes return HTTP 403 with JSON-RPC error `-32004` and the message "You've reached the quota limit for your current plan", the same error as the monthly usage limit, even when the Usage page shows low usage. Reads and simulations keep working. Fork the Virtual Environment or create a new one to continue with a fresh count. See [Virtual Environment write limits](https://docs.tenderly.co/platform/account/billing/limits.md#virtual-environment-write-limits).

> [card]
>
> ## How can I create Virtual Environments?
>
> ***
>
> You can create a Virtual Environment in two ways:
>
> * From the [Dashboard UI](https://docs.tenderly.co/virtual-environments/overview.md#quickstart)
> * Using the [Virtual Environment REST API](https://docs.tenderly.co/api-reference/virtual-environments/create-environment.md).
> * By [forking an existing Virtual Environment](https://docs.tenderly.co/virtual-environments/develop/fork-testnet.md).

> [card]
>
> ## Why should I set a unique chain ID?
>
> ***
>
> Set a custom chain ID that's different from the parent network's chain ID.
>
> Recommendation: Add the prefix **`7357`** (*test*) to the original network's Chain ID. For example, if
> you're creating a Virtual Environment by forking the Ethereum Mainnet (chain ID: 1), set your Virtual
> Environment chain ID to something like `73571`.
>
> This is recommended for several reasons:
>
> * Since the Virtual Environment chain is independent of the Mainnet chain, it should have an independent and unique chain ID.
> * Using a unique chain ID is a **security measure** that protects your dapp against
>   [**transaction replay attacks**](https://quantstamp.com/blog/preventing-replay-attacks-post-ethereum-merge).
> * Wallets, such as MetaMask, will recognize that the **original chain ID is already in use** and will
>   potentially mistake your Virtual Environment for the parent network unless it uses a unique chain ID.

> [card]
>
> ## How Virtual Environments resolve timestamps?
>
> ***
>
> When a transaction or `eth_call` accesses **`block.timestamp`** within a contract, the value will depend whether the transaction targets `latest` or `pending` block.
>
> * For `pending` block the value is current time adjusted by the adjustment offset `block.timestamp == time.now() + adjustment_offset`.
> * For `latest` block the value is the timestamp of the latest block `block.timestamp == latest_block.timestamp`
>
> The `adjustment_offset` somes from time-adjustment methods [`evm_setNextBlockTimestamp`](https://docs.tenderly.co/virtual-environments/admin-rpc/#evm_setnextblocktimestamp) and [`evm_increaseTime`](https://docs.tenderly.co/virtual-environments/admin-rpc/#evm_increasetime).
>
> [Learn more →](https://docs.tenderly.co/virtual-environments/develop/timestamps.md)

> [card]
>
> ## How mining works?
>
> ***
>
> Each time you send a transaction to a Virtual Environment via `eth_sendTransaction` or `eth_sendRawTransaction`, a block is mined and block number increases by 1. The **initial block number** is taken from the latest block of the original chain at the time of creation.

> [card]
>
> ## How does State Sync work?
>
> ***
>
> [State Sync](https://docs.tenderly.co/virtual-environments/state-sync.md) enables a Virtual Environment to track the live state of the original
> network .
>
> * Until a Virtual Environment transaction modifies a storage slot, the Virtual Environment tracks the current value from the
>   original network.
> * After a Virtual Environment transaction modifies a slot `X` in a contract `C`, any subsequent read will yield that
>   value. The unmodified `C.Y` will reflect the value from the original network.

> [card]
>
> ## Why can't I see mainnet transactions with State Sync?
>
> ***
>
> State sync tracks state, but does not synchronize nor display original network
>
> * transactions
> * event logs
> * blocks
>
> A contract deployed on the original network after the Virtual Environment was created appears as code at its address (`eth_getCode` at `latest` returns its bytecode), with no deployment transaction visible on the Virtual Environment. The Virtual Environment's own block height is not an indicator of how fresh the synced state is; see [Which parent-network state does `latest` reflect?](https://docs.tenderly.co/virtual-environments/state-sync#which-parent-network-state-does-latest-reflect)

> [card]
>
> ## Are there issues with State Sync?
>
> ***
>
> Behavior of mainnet contracts that cache `block.number` is unpredictable when running Virtual Environment
> transactions, since the [block number grows at different
> rates](https://docs.tenderly.co/virtual-environments/state-sync.md#which-parent-network-state-does-latest-reflect) on mainnet and the Virtual Environment.
>
> An account's ETH balance, nonce, and code stop syncing together once any of them changes on the Virtual Environment, for example after you send a transaction from the account or call `tenderly_setBalance` on it. See [Why did an account stop syncing?](https://docs.tenderly.co/virtual-environments/state-sync.md#why-did-an-account-stop-syncing)

> [card]
>
> ## How can I speed up passage of time?
>
> ***
>
> To enable faster testing of code that depends on current timestamp (e.g. yield and reward calculation), you can use [`tenderly_increaseTime`](https://docs.tenderly.co/virtual-environments/admin-rpc#evm_increasetime).

> [card]
>
> ## Do Virtual Environments support WebSockets?
>
> ***
>
> Yes, Virtual Environments do support WebSockets. Just use `wss://` instead of `https://` in an URL.

> [card]
>
> ## When would I fork a Virtual Environment?
>
> ***
>
> You can [fork an existing Virtual Environment](https://docs.tenderly.co/virtual-environments/develop/fork-testnet.md) after deploying contracts and
> setting up your Virtual Environment state by [funding accounts](https://docs.tenderly.co/virtual-environments/unlimited-faucet.md),
> [sending transactions](https://docs.tenderly.co/virtual-environments/interact/send-transactions.md) or using [Admin RPC](https://docs.tenderly.co/virtual-environments/admin-rpc.md).
>
> * **Intact starting point**: By using a forked Virtual Environment to develop or experiment, your starting point
>   remains clean from changes.
> * **Working copy per team member**: After [staging smart contracts](https://docs.tenderly.co/virtual-environments/ci-cd/stage-contracts.md),
>   your team members can do their work on their own working copy of the network.

> [card]
>
> ## How Virtual Environments help team collaboration?
>
> ***
>
> When using Virtual Environments to deploy smart contracts, members of your [**Tenderly
> Organization**](https://docs.tenderly.co/platform/account/organizations/overview.md) will have direct access to the Virtual Environment.
>
> After deployment to a Virtual Environment, you can distribute chain and contract configuration so builders of other
> components such as UI, APIs, and data indexing can connect to staged contracts.
>
> Here are some recommendations:
>
> <ol>
>   <li> [Stage contracts](https://docs.tenderly.co/virtual-environments/ci-cd/stage-contracts.md) to a Virtual Environment.</li>
>   <li> [Fork the staging Virtual Environment](https://docs.tenderly.co/virtual-environments/develop/fork-testnet.md) for each team (frontend,
>   backend, etc.) to ensure boundaries between teams and reduce test-data noise in
>   development.</li>
>   <li> Update all relevant git repos with Virtual Environment config and contract information:</li>
>
>   <ul>
>     <li> Chain config: share the chain ID and Admin RPC (so other builders can control chain state)</li>
>     <li> Contracts' ABIs</li>
>     <li> Contracts' deployment addresses</li>
>   </ul>
>
>   <li>When developing locally (UI, backend), switch to the Virtual Environment.</li>
>   <li>Share failing transactions to smart contract developers</li>
> </ol>

> [card]
>
> ## How to stage a dapp for external demos and community testing?
>
> ***
>
> When staging your dapp for external and demo testing, make sure that:
>
> * Stage your contracts to a Virtual Environment.
> * Stage all your offchain components (backend, data indexing solutions, etc.) and have them connect to the Virtual Environment.
> * Connect your staged dapp via [**Public RPC**](https://docs.tenderly.co/virtual-environments/overview.md#admin-rpc) (not Admin RPC) and connect it to other offchain components.

> [card]
>
> ## How can I revert Virtual Environment state?
>
> ***
>
> Instead of reverting state, it's recommended to [fork an existing
> Virtual Environment](https://docs.tenderly.co/virtual-environments/develop/fork-testnet.md) instead and do your testing on a disposable working
> copy.
>
> You can [Revert Virtual Environment state](https://docs.tenderly.co/virtual-environments/develop/revert-state.md) if testing steps aren't
> repeatable otherwise.

> [card]
>
> ## How should I name my Virtual Environment?
>
> ***
>
> For easier distinction, prefix your Virtual Environments with **`virtual`** (e.g. `virtualMainnet`). This is
> particularly useful for integrations such as [Viem](https://docs.tenderly.co/virtual-environments/libraries/viem.md),
> [HardHat](https://docs.tenderly.co/virtual-environments/develop/deploy-contracts.md), and
> [others](https://docs.tenderly.co/virtual-environments/integrations.md).
>
> Alternatively, include the **purpose** in Virtual Environment's name:
>
> * **`internalTestingMainnet`**
> * **`demoMainnet`**
> * **`dataInsightsMainnet`**
> * **`ciMainnet`**
> * **`bugBountyBase`**
> * **`frontEndDevOptimism`**
> * **`communityTestingAvalanche`**

> [card]
>
> ## What's verification visibility in Virtual Environments?
>
> ***
>
> Virtual Environment's [Public explorer](https://docs.tenderly.co/virtual-environments/explorer.md) adheres to **verification visibility for
> contracts** you deploy and verify on the Virtual Environment:
>
> * **Full**: the public block explorer will display the entire source code of all functions
> * **ABI-only**: the public block explorer shows only function and events' names and signatures,
>   including argument names. This way your source code remains invisible outside of your project.
> * **None**: only show the final outcomes of transactions, without revealing the source code, or method
>   names.

> [card]
>
> ## How do I run Foundry scripts on Virtual Environments?
>
> ***
>
> Use the `--slow` flag when running Foundry scripts to prevent transaction batching. With this, a transaction is sent only after it’s preceding transaction is confirmed.
>
> ```bash lines={2} theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
> forge script script/Counter.s.sol:CounterScript \
> --slow
> --verify \
> --verifier-url $TENDERLY_VERIFIER_URL \
> --rpc-url $TENDERLY_VIRTUAL_TESTNET_RPC_URL \
> --private-key $PRIVATE_KEY  \
> --etherscan-api-key $TENDERLY_ACCESS_TOKEN \
> --broadcast \
> ```

> [card]
>
> ## When I fund accounts, should I input the amount in wei?
>
> ***
>
> When using the Unlimted Faucet in the Dashboard, `1` means `1 ETH`, both for **native and ERC-20
> balance**.
> In case of ERC-20 tokens, Tenderly automatically calculates the exact amount in wei, using the ERC-20 number of decimals.

> [card]
>
> ## What's the difference between the Admin RPC and Public RPC?
>
> ***
>
> **Public RPC** allows the standard JSON-RPC interaction. This is the RPC you'll use to integrate into
> your dapp's UI or backend when you're ready to demo your dapp externally.
>
> **Admin RPC** supports [additional RPC methods](https://docs.tenderly.co/virtual-environments/admin-rpc.md) allowing higher control
> over the network state and storage, as well as account balances. This is the RPC you'll use in your
> deployment scripts for programmatic network control.

> [card]
>
> ## Can I impersonate a sender on Virtual Environments?
>
> ***
>
> You can successfully send transactions using **any sender address** [via
> Dashboard](https://docs.tenderly.co/virtual-environments/interact/send-transactions.md#sendnig-from-the-dashboard). Tenderly will run
> those transactions on Virtual Environments without checking signatures.

> [card]
>
> ## How can I get accurate gas estimations?
>
> ***
>
> Gas usage reflects the accurate gas usage of all OPCODES from the original network. You can get gas usage:
>
> * in Transaction Overview via Dashboard,
> * via [**tenderly\_estimateGas**](https://docs.tenderly.co/node-rpc/rpc-reference.md?network=ethereum-mainnet\&method=tenderly_estimateGas) for single-transaction estimations with 100% accuracy
> * via [**tenderly\_estimateGasBundle**](https://docs.tenderly.co/node-rpc/rpc-reference.md?network=ethereum-mainnet\&method=tenderly_estimateGasBundle) for estimation of multiple transactions with 100% accuracy

> [card]
>
> ## Will verification work if I use `tenderly_setcode`?
>
> ***
>
> When deploying modified bytecode to an address, the verification information will no longer match and it will not be possible to access traces and debugger for target addresses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.