Skip to main content
All CollectionsDevelop with Core
Core API Calls: eth_sendTransaction
Core API Calls: eth_sendTransaction
A
Written by Ana
Updated this week

(Restricted) Creates a new wallet confirmation to make an Ethereum transaction from the user's account. This method requires that the user has granted permission to interact with their account first, so make sure to call eth_requestAccounts (recommended) or wallet_requestPermissions first.

Params(1)

1. Transaction (required)

The transaction object to sign and send.

The parameters to customize a transaction. If a to address is not provided. It will be assumed that the transaction is a contract creation transaction, and the data field of the transaction will be used as the contract initialization code. gasPrice cannot be used together with maxPriorityFeePerGas and maxFeePerGas.

to string

Match pattern:^0x[0-9,a-f,A-F]{40}$

from string (required)

Match pattern:^0x[0-9,a-f,A-F]{40}$

gas string

Match pattern:^0x([1-9a-f]+[0-9a-f]*|0)$

value string

Match pattern:^0x([1-9a-f]+[0-9a-f]*|0)$

data string

Match pattern:^0x[0-9a-f]*$

gasPrice string

The gas price the sender is willing to pay to miners in wei. Used in pre-1559 transactions.

Match pattern:^0x([1-9a-f]+[0-9a-f]*|0)$

maxPriorityFeePerGas string

Maximum fee per gas the sender is willing to pay to miners in wei. Used in 1559 transactions.

Match pattern:^0x([1-9a-f]+[0-9a-f]*|0)$

maxFeePerGas string

The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei. Used in 1559 transactions.

Match pattern:^0x([1-9a-f]+[0-9a-f]*|0)$

Result (TransactionHash)

The transaction hash of the sent transaction.

string

Match pattern:^0x[0-9a-f]{64}$

Errors

Code

Message

4100

The requested account and/or method has not been authorized by the user.

Example

Request

await window.ethereum.request({
"method": "eth_sendTransaction",
"params": [
{
"to": "0x5f660cf90B0C6D0220023402AC11E1CA7D0f60e7",
"from": "0xBB900BbE1A20dA4d474666B79a5fa6CE12629733",
"gas": "0x76c0",
"value": "0x16345785d8a0000",
"data": "0x",
"gasPrice": "0x4a817c800"
}
]
});

Result

"0xfea8c300c0441794bc0b03290d01acf3ce2eb658a83f1d156944da914090186a"


For any additional questions, please view our other knowledge base articles or contact a Product Support team member via the chat button. Examples are for illustrative purposes only.

Did this answer your question?