Send Transactions in Ethereum

You can send a transaction in Sender using the eth_sendTransaction RPC method.
For example, the following JavaScript gets the user's accounts and sends a transaction when they select each button, and the following HTML displays the buttons.
const ethereumButton = document.querySelector('.enableEthereumButton');
const sendEthButton = document.querySelector('.sendEthButton');
let accounts = [];
// Send Ethereum to an address
sendEthButton.addEventListener('click', () => {
method: 'eth_sendTransaction',
params: [
from: accounts[0], // The user's active address.
to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', // Required except during contract publications.
value: '0x29a2241af62c0000', // Only required to send ether to the recipient from the initiating external account.
gasPrice: '0x09184e72a000', // Customizable by the user during MetaMask confirmation.
gas: '0x2710', // Customizable by the user during MetaMask confirmation.
.then((txHash) => console.log(txHash))
.catch((error) => console.error(error));
ethereumButton.addEventListener('click', () => {
async function getAccount() {
accounts = await sender.ethereum.request({ method: 'eth_requestAccounts' });
<button class="enableEthereumButton btn">Enable Ethereum</button>
<button class="sendEthButton btn">Send ETH</button>