eth_sendTransaction
Sends a transaction using an unlocked account on the node. Important: Most RPC providers don't support this method for security reasons, as it requires private keys to be stored on the server.
Security Considerations
- This method requires an unlocked account on the node
- Private keys must be available to the RPC server
- Most production RPC providers disable this method
- Use
eth_sendRawTransaction
with client-side signing instead
Parameters
Object
- The transaction object:from
:DATA
, 20 Bytes - The address the transaction is sent fromto
:DATA
, 20 Bytes - (optional) The address the transaction is directed togas
:QUANTITY
- (optional) Integer of the gas provided for the transaction executiongasPrice
:QUANTITY
- (optional) Integer of the gasPrice used for each paid gasvalue
:QUANTITY
- (optional) Integer of the value sent with this transactiondata
:DATA
- (optional) The compiled code of a contract OR the hash of the invoked method signature and encoded parameters
Returns
DATA
- The transaction hash of the submitted transaction.
Implementation Example
Examples
- cURL
- JavaScript
curl -X POST https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{
"from": "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a"
}],
"id": 1
}'
const response = await fetch('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_sendTransaction',
params: [{
from: '0x9b2055d370f73ec7d8a03e965129118dc8f5bf83',
to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
gas: '0x76c0',
gasPrice: '0x9184e72a000',
value: '0x9184e72a'
}],
id: 1
})
});
const data = await response.json();
console.log('Transaction hash:', data.result);
Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
Note: This method is typically not available on hosted RPC providers for security reasons. Use eth_sendRawTransaction
with client-side signing libraries instead.
Alternative Approach
For secure transaction sending, use client-side signing with libraries like ethers.js or web3.js, then submit the signed transaction using eth_sendRawTransaction
.
Need help? Contact our support team or check the Chiliz documentation.