OpenParable
Skip to content
← Back to skills

Send Eth

Apps & Automation
send-eth

Send Eth is an Agent Skill for apps & automation published in the Nethereum/Nethereum repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Send ETH between Ethereum addresses using Nethereum. Use when the user wants to transfer Ether, create a transaction, send crypto, or move funds between wallets. Also triggers for questions about gas, nonce, transaction receipts, EIP-1559 fees, or draining an account balance.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/Nethereum/Nethereum/blob/HEAD/plugins/nethereum-skills/skills/send-eth/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/send-eth, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Send ETH with Nethereum

NuGet: Nethereum.Web3

Two approaches — EtherTransferService (handles gas/nonce/signing automatically) or manual transaction signing (full control).

Quick Start: EtherTransferService

using Nethereum.Web3;
using Nethereum.Web3.Accounts;

var privateKey = "0xYOUR_PRIVATE_KEY";
var account = new Account(privateKey, Chain.MainNet);
var web3 = new Web3(account, "https://mainnet.infura.io/v3/YOUR-PROJECT-ID");

var receipt = await web3.Eth.GetEtherTransferService()
    .TransferEtherAndWaitForReceiptAsync("0xRecipientAddress", 1.5m);

Amount is in ETH (not wei) — 1.5m sends 1.5 ETH.

Legacy Transfer with Gas Price

var receipt = await web3.Eth.GetEtherTransferService()
    .TransferEtherAndWaitForReceiptAsync(toAddress, 1.11m, gasPriceGwei: 2);

gasPriceGwei is in Gwei for convenience.

EIP-1559 Transfer with Fee Suggestion

var transferService = web3.Eth.GetEtherTransferService();
var fee = await transferService.SuggestFeeToTransferWholeBalanceInEtherAsync();

var receipt = await transferService
    .TransferEtherAndWaitForReceiptAsync(
        toAddress, 0.1m,
        maxPriorityFee: fee.MaxPriorityFeePerGas.Value,
        maxFeePerGas: fee.MaxFeePerGas.Value);

Estimate Gas Before Sending

var transferService = web3.Eth.GetEtherTransferService();
var estimatedGas = await transferService.EstimateGasAsync(toAddress, 1.11m);

var receipt = await transferService
    .TransferEtherAndWaitForReceiptAsync(toAddress, 1.11m, gasPriceGwei: 2, estimatedGas);

Send Entire Balance (EIP-1559)

var transferService = web3.Eth.GetEtherTransferService();
var fee = await transferService.SuggestFeeToTransferWholeBalanceInEtherAsync();

var amount = await transferService
    .CalculateTotalAmountToTransferWholeBalanceInEtherAsync(
        fromAddress, maxFeePerGas: fee.MaxFeePerGas.Value);

var receipt = await transferService
    .TransferEtherAndWaitForReceiptAsync(
        destinationAddress, amount,
        fee.MaxPriorityFeePerGas.Value, fee.MaxFeePerGas.Value);

Multi-chain Support

var mainnet = new Account(privateKey, Chain.MainNet);    // Chain ID 1
var sepolia = new Account(privateKey, 11155111);          // Sepolia testnet
var polygon = new Account(privateKey, 137);               // Polygon mainnet
// Same address on all chains, only chain ID differs

Source: AccountTypesDocExampleTests.ShouldCreateAccountForDifferentChains

Manual Signing: Legacy Transaction

var signer = new LegacyTransactionSigner();
var receiverAddress = "0x13f022d72158410433cbd66f5dd8bf6d2d129924";
var amount = BigInteger.Parse("1000000000000000000"); // 1 ETH in wei
BigInteger nonce = 0;
BigInteger gasPrice = BigInteger.Parse("20000000000"); // 20 Gwei
BigInteger gasLimit = 21000;

var signedRlpHex = signer.SignTransaction(
    privateKey, receiverAddress, amount, nonce, gasPrice, gasLimit);

Source: SignerDocExampleTests.ShouldSignLegacyTransaction

Manual Signing: EIP-1559 Transaction

var signer = new Transaction1559Signer();
BigInteger chainId = 1;
BigInteger nonce = 0;
BigInteger maxPriorityFeePerGas = BigInteger.Parse("2000000000");  // 2 Gwei
BigInteger maxFeePerGas = BigInteger.Parse("100000000000");        // 100 Gwei
BigInteger gasLimit = 21000;
var receiverAddress = "0x13f022d72158410433cbd66f5dd8bf6d2d129924";
BigInteger amount = BigInteger.Parse("1000000000000000000");       // 1 ETH

var transaction = new Transaction1559(
    chainId, nonce, maxPriorityFeePerGas, maxFeePerGas,
    gasLimit, receiverAddress, amount, null, new List<AccessListItem>());

var signedRlpHex = signer.SignTransaction(privateKey, transaction);

Source: SignerDocExampleTests.ShouldSignEip1559Transaction

After manual signing, broadcast with:

await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + signedRlpHex);

Required Usings

using Nethereum.Web3;
using Nethereum.Web3.Accounts;
using Nethereum.Signer;
using Nethereum.Model;
using System.Collections.Generic;
using System.Numerics;