sendTransaction - SDK
Submits transaction to the network to be mined. The transaction must be signed, and be valid (i.e. the nonce is correct and the account has sufficient balance to pay for the transaction).
Submits transaction to the network to be mined. The transaction must be signed, and be valid (i.e. the nonce
is correct and the account has sufficient balance to pay for the transaction).
Don’t have an API key?
Start using this method in your app today. Get started for free
Description
Submits transaction to the network to be mined. The transaction must be signed, and valid (i.e. the nonce
is correct and the account has sufficient balance to pay for the transaction).
Parameters
Response
TransactionResponse
object parameters
Example Request and Response
Prerequisite: You will need to install the Alchemy SDK before making requests with it.
The commands for installing it using npm or yarn are given below:
Request
Response
Use Cases
Here are some potential use cases for the sendTransaction
method:
-
Sending ETH:
sendTransaction
can be used to send Ether from one Ethereum address to another. This is one of the most common use cases for sendTransaction. -
Deploying a smart contract: When you deploy a smart contract to the Ethereum blockchain, you need to send a transaction that includes the bytecode of the contract.
sendTransaction
can be used to send this transaction. -
Interacting with a smart contract: Once a smart contract has been deployed, you can interact with it by sending transactions that call its functions.
sendTransaction
can be used to send these transactions. -
Token transfers: Tokens on the Ethereum blockchain are often built using smart contracts.
sendTransaction
can be used to transfer tokens from one Ethereum address to another.
Related Methods
Here are the methods related to sendTransaction
:
- sendPrivateTransaction: Used to send a single transaction to Flashbots. Flashbots will attempt to send the transaction to miners for the next 25 blocks.