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

# Sending Transactions to Virtual Environments

> Send signed and unsigned transactions to a Virtual Environment over JSON-RPC, and fund accounts with Admin RPC cheatcodes.

Virtual Environments allow you to send transactions to the virtual network. The process of sending transactions is identical to sending transactions on the real network.

Transactions can be sent through the Dashboard UI or via RPC. This page shows you how to do it using both methods.

## Sending via RPC

Use the `eth_sendRawTransaction` RPC method to send transactions to your Virtual Environment.

The example below shows you how to send a transaction using Viem, Ethers.js and the cURL command. The code snippets are runnable without changes.

<Tabs>
  <Tab title="Shell">
    ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    curl $TENDERLY_VIRTUAL_TESTNET_RPC \
        -X POST \
        -H "Content-Type: application/json" \
        -d '{
              "jsonrpc": "2.0",
              "id": 0,
              "method": "eth_sendRawTransaction",
              "params": [
                "0x095ea7b300000000000000000000000040bdb4497614bae1a67061ee20aade3c2067ac9e00000000000000000000000000000000000000000000000000000000000186a0"
              ]
        }'
    ```
  </Tab>

  <Tab title="virtual-environments/src/viem-send-tx.ts">
    Find more details on Viem integration by reading [this guide](/virtual-environments/libraries/viem).

    ```typescript showLineNumbers title="virtual-environments/src/viem-send-tx.ts" lines={2,4, 17, 23} theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}

    const EXPLORER_BASE_URL = vMainnet.blockExplorers.default;

    const account = privateKeyToAccount(generatePrivateKey());

    (async () => {
      const client = createWalletClient({
        account,
        chain: vMainnet,
        transport: http(vMainnet.rpcUrls.default.http[0]),
      });

      await tenderlySetBalance(client, [
        [account.address],
        "0xDE0B6B3A7640000",
      ]);


      const tx = await client.sendTransaction({
        to: "0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC",
        value: parseEther("0.01"),
      });

      console.log(`${EXPLORER_BASE_URL}/tx/${tx}`);
    })();
    ```
  </Tab>

  <Tab title="send-tx.ts">
    Find more details on Ethers integration by reading [this guide](/virtual-environments/libraries/ethers).

    ```ts title="send-tx.ts" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}

    await (async () => {
      const provider = new ethers.JsonRpcProvider(process.env.TENDERLY_VIRTUAL_TESTNET_RPC!);

      const signer = Wallet.fromPhrase(Mnemonic.fromEntropy(ethers.randomBytes(24)).phrase, provider);

      await provider.send("tenderly_setBalance", [
        signer.address,
        "0xDE0B6B3A7640000",
      ]);

      const tx = await signer.sendTransaction({
        to: "0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC",
        value: ethers.parseEther("0.01"),
      });

      console.log(`${process.env.VIRTUAL_MAINNET_EXPLORER!}/tx/${tx.hash}`);
    })();
    ```
  </Tab>
</Tabs>

## Sending from the Dashboard

Transactions sent from the Dashboard will be recorded in the Virtual Environment's state. These transactions **do not need to be signed** and can be sent to and from any address on the Virtual Environment.

From the Explorer view, click on the **Send icon** from the top right to access the **Send Transaction** input form.

[Watch on Loom →](https://www.loom.com/embed/e376ad4184ab4294b9e0ca57033af568?sid=0cdaf910-aad4-41fc-86a6-6bc678032341)

<Steps>
  ### Select a contract

  In the **address** field, paste the address of the DAI stablecoin contract:`0x6B175474E89094C44Da98b954EedeAC495271d0F`.

  The receiving contract can be any of the following:

  * Virtual Contract [deployed on the Virtual Environment](/virtual-environments/develop/deploy-contracts)
  * Contract added to your [Tenderly project](/platform/account/projects/overview)
  * Any pre-existing contract on the network

  ### Specify the call data

  For contracts that are [verified on Tenderly](/contract-verification/overview) (privately or publicly) or publicly on Etherscan or Blockscout,
  you can use the **Choose function and parameters**.

  1. Select the **`approve`** function
  2. Paste an address you wish to approve DAI to (`0x40BdB4497614bAe1A67061EE20AAdE3c2067AC9e`)
  3. Set the wei amount of DAI you want to approve. For example, `10000000000000000000`.

  <Note>For unverified contracts, you need to **enter raw input data/calldata** in hex form.</Note>

  ### Fill in transaction parameters

  You can fill in the following options:

  * **From**: Any account address since transactions on Virtual Environments don't need to be signed. Use `0xbd8daa414fda8a8a129f7035e7496759c5af8570` or any address you funded with DAI.
  * **Gas**: Defaults to `800000` or set the desired gas (limit)
  * **Gas Price**: Defaults to `0` or an arbitrary gas price
  * **Value**: Defaults to `0` or specify an arbitrary transaction value, that will be deducted from the sender's (**from**) balance.

  <Note>
    Sender accounts need to have sufficient funds to send transactions. Use the [Unlimited Faucet](/virtual-environments/unlimited-faucet) to top up any account with any balance before sending transactions on Virtual Environments.
  </Note>

  ### Send transaction

  Click **Send Transaction**.

  Sent transactions will appear in the [Virtual Environment Explorer](/virtual-environments/explorer). Click on the transaction to inspect the call trace, debug using Debugger, or re-simulate with different parameters.

  <img src="https://mintcdn.com/tenderly/XsEZlaGXYskrtN68/images/testnets/dai-send-tx.png?fit=max&auto=format&n=XsEZlaGXYskrtN68&q=85&s=e87158c2e275276447fb71683b0f03e2" alt="" width="3456" height="2160" data-path="images/testnets/dai-send-tx.png" />
</Steps>

## Next steps

* [Simulate a transaction](/virtual-environments/interact/simulate-transactions): Run transaction simulations from the Dashboard or via RPC
* [Deploy a smart contract](/virtual-environments/develop/deploy-contracts): Start deploying and monitoring smart contracts
* [Stage dapps](/virtual-environments/ci-cd/stage-dapps): Learn how to connect the Virtual Environment to you dapp's UI
* [Debug transactions](/virtual-environments/develop/debug-transactions) by using Tenderly Debugger.
