> ## 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.

<div className="flex flex-col gap-4 mt-8">
  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="do-i-need-a-paid-plan-to-use-virtual-environments" className="text-xl font-semibold">Do I need a paid plan to use Virtual Environments?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-can-i-create-virtual-environments" className="text-xl font-semibold">How can I create Virtual Environments?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        You can create a Virtual Environment in two ways:

        * From the [Dashboard UI](/virtual-environments/overview#quickstart)
        * Using the [Virtual Environment REST API](/api-reference#/operations/createVnet).
        * By [forking an existing Virtual Environment](/virtual-environments/develop/fork-testnet).
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="why-should-i-set-a-unique-chain-id" className="text-xl font-semibold">Why should I set a unique chain ID?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-virtual-environments-resolve-timestamps" className="text-xl font-semibold">How Virtual Environments resolve timestamps?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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`](/virtual-environments/admin-rpc/#evm_setnextblocktimestamp) and [`evm_increaseTime`](/virtual-environments/admin-rpc/#evm_increasetime).

        [Learn more →](/virtual-environments/develop/timestamps)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-mining-works" className="text-xl font-semibold">How mining works?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-does-state-sync-work" className="text-xl font-semibold">How does State Sync work?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [State Sync](/virtual-environments/state-sync) 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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="why-can-t-i-see-mainnet-transactions-with-state-sy" className="text-xl font-semibold">Why can't I see mainnet transactions with State Sync?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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?](/virtual-environments/state-sync#which-parent-network-state-does-latest-reflect)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="are-there-issues-with-state-sync" className="text-xl font-semibold">Are there issues with State Sync?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Behavior of mainnet contracts that cache `block.number` is unpredictable when running Virtual Environment
        transactions, since the [block number grows at different
        rates](/virtual-environments/state-sync#which-parent-network-state-does-latest-reflect) on mainnet and the Virtual Environment.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-can-i-speed-up-passage-of-time" className="text-xl font-semibold">How can I speed up passage of time?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        To enable faster testing of code that depends on current timestamp (e.g. yield and reward calculation), you can use [`tenderly_increaseTime`](/virtual-environments/admin-rpc#evm_increasetime).
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="do-testnets-support-websockets" className="text-xl font-semibold">Do Virtual Environments support WebSockets?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Yes, Virtual Environments do support WebSockets. Just use `wss://` instead of `https://` in an URL.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="when-would-i-fork-a-testnet" className="text-xl font-semibold">When would I fork a Virtual Environment?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        You can [fork an existing Virtual Environment](/virtual-environments/develop/fork-testnet) after deploying contracts and
        setting up your Virtual Environment state by [funding accounts](/virtual-environments/unlimited-faucet),
        [sending transactions](/virtual-environments/interact/send-transactions) or using [Admin RPC](/virtual-environments/admin-rpc).

        * **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](/virtual-environments/ci-cd/stage-contracts),
          your team members can do their work on their own working copy of the network.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-testnets-help-team-collaboration" className="text-xl font-semibold">How Virtual Environments help team collaboration?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        When using Virtual Environments to deploy smart contracts, members of your [**Tenderly
        Organization**](/platform/account/organizations/overview) 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 className="list-decimal ml-6">
          <li> [Stage contracts](/virtual-environments/ci-cd/stage-contracts) to a Virtual Environment.</li>
          <li> [Fork the staging Virtual Environment](/virtual-environments/develop/fork-testnet) 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 className="list-disc ml-3">
            <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>
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-to-stage-a-dapp-for-external-demos-and-communi" className="text-xl font-semibold">How to stage a dapp for external demos and community testing?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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**](/virtual-environments/overview#admin-rpc) (not Admin RPC) and connect it to other offchain components.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-can-i-revert-testnet-state" className="text-xl font-semibold">How can I revert Virtual Environment state?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Instead of reverting state, it's recommended to [fork an existing
        Virtual Environment](/virtual-environments/develop/fork-testnet) instead and do your testing on a disposable working
        copy.

        You can [Revert Virtual Environment state](/virtual-environments/develop/revert-state) if testing steps aren't
        repeatable otherwise.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-should-i-name-my-testnet" className="text-xl font-semibold">How should I name my Virtual Environment?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        For easier distinction, prefix your Virtual Environments with **`virtual`** (e.g. `virtualMainnet`). This is
        particularly useful for integrations such as [Viem](/virtual-environments/libraries/viem),
        [HardHat](/virtual-environments/develop/deploy-contracts), and
        [others](/virtual-environments/integrations).

        Alternatively, include the **purpose** in Virtual Environment's name:

        * **`internalTestingMainnet`**
        * **`demoMainnet`**
        * **`dataInsightsMainnet`**
        * **`ciMainnet`**
        * **`bugBountyBase`**
        * **`frontEndDevOptimism`**
        * **`communityTestingAvalanche`**
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-verification-visibility-in-testnets" className="text-xl font-semibold">What's verification visibility in Virtual Environments?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Virtual Environment's [Public explorer](/virtual-environments/explorer) 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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-do-i-run-foundry-scripts-on-virtual-environments" className="text-xl font-semibold">How do I run Foundry scripts on Virtual Environments?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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 \
        ```
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="when-i-fund-accounts-should-i-input-the-amount-in" className="text-xl font-semibold">When I fund accounts, should I input the amount in wei?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-the-difference-between-the-admin-rpc-and-pu" className="text-xl font-semibold">What's the difference between the Admin RPC and Public RPC?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        **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](/virtual-environments/admin-rpc) 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.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="can-i-impersonate-a-sender-on-testnets" className="text-xl font-semibold">Can I impersonate a sender on Virtual Environments?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        You can successfully send transactions using **any sender address** [via
        Dashboard](/virtual-environments/interact/send-transactions#sendnig-from-the-dashboard). Tenderly will run
        those transactions on Virtual Environments without checking signatures.
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-can-i-get-accurate-gas-estimations" className="text-xl font-semibold">How can I get accurate gas estimations?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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**](/node-rpc/rpc-reference?network=ethereum-mainnet\&method=tenderly_estimateGas) for single-transaction estimations with 100% accuracy
        * via [**tenderly\_estimateGasBundle**](/node-rpc/rpc-reference?network=ethereum-mainnet\&method=tenderly_estimateGasBundle) for estimation of multiple transactions with 100% accuracy
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="will-verification-work-if-i-use-tenderly-setcode" className="text-xl font-semibold">Will verification work if I use `tenderly_setcode`?</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        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.
      </div>
    </div>
  </Card>
</div>
