eth_sendRawTransaction - zkSync RPC Method
Submit signed transactions to zkSync Era. Essential for broadcasting transactions for RWA tokenization ($1.9B, 25% market share), hyperchain deployment via ZK Stack, and cross-chain DeFi.
Submits a pre-signed transaction for broadcast to zkSync Era.
Why zkSync? Build on Matter Labs' flagship zkEVM powering the Elastic Network of interoperable hyperchains with ZK Stack modular framework, hyperchain interoperability, native account abstraction, and $1.9B in tokenized real-world assets.
Use Cases
The eth_sendRawTransaction method is essential for:
- Broadcasting transactions - Submit signed transactions to the network
- Wallet operations - Send native tokens and interact with contracts
- DeFi operations - Execute swaps, provide liquidity for RWA tokenization ($1.9B, 25% market share), hyperchain deployment via ZK Stack, and cross-chain DeFi
- Batch operations - Submit multiple transactions efficiently
Request Parameters
The signed transaction data (RLP encoded)
Response Body
32-byte transaction hash
Code Examples
curl -X POST https://api-zksync-era-mainnet-full.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xf86c808504a817c80082520894..."],
"id": 1
}'import { JsonRpcProvider, Wallet, parseEther } from 'ethers';
const provider = new JsonRpcProvider('https://api-zksync-era-mainnet-full.n.dwellir.com/YOUR_API_KEY');
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider);
// Send native tokens
async function sendTransaction(to, value) {
const tx = await wallet.sendTransaction({
to: to,
value: parseEther(value)
});
console.log('Transaction hash:', tx.hash);
// Wait for confirmation
const receipt = await tx.wait();
console.log('Confirmed in block:', receipt.blockNumber);
return receipt;
}
// Send to contract
async function sendContractTransaction(contract, method, args, value = '0') {
const tx = await contract[method](...args, {
value: parseEther(value)
});
return await tx.wait();
}from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-zksync-era-mainnet-full.n.dwellir.com/YOUR_API_KEY'))
def send_transaction(private_key, to, value_in_ether):
account = w3.eth.account.from_key(private_key)
# Build transaction
tx = {
'nonce': w3.eth.get_transaction_count(account.address),
'to': to,
'value': w3.to_wei(value_in_ether, 'ether'),
'gas': 21000,
'gasPrice': w3.eth.gas_price,
'chainId': w3.eth.chain_id
}
# Sign transaction
signed_tx = account.sign_transaction(tx)
# Send transaction
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
print(f'Transaction hash: {tx_hash.hex()}')
# Wait for confirmation
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f'Confirmed in block: {receipt["blockNumber"]}')
return receiptpackage main
import (
"context"
"crypto/ecdsa"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
client, err := ethclient.Dial("https://api-zksync-era-mainnet-full.n.dwellir.com/YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
privateKey, err := crypto.HexToECDSA("YOUR_PRIVATE_KEY")
if err != nil {
log.Fatal(err)
}
publicKey := privateKey.Public()
publicKeyECDSA, _ := publicKey.(*ecdsa.PublicKey)
fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA)
nonce, _ := client.PendingNonceAt(context.Background(), fromAddress)
value := big.NewInt(1000000000000000000)
gasLimit := uint64(21000)
gasPrice, _ := client.SuggestGasPrice(context.Background())
toAddress := common.HexToAddress("0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91")
tx := types.NewTransaction(nonce, toAddress, value, gasLimit, gasPrice, nil)
chainID, _ := client.NetworkID(context.Background())
signedTx, _ := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)
err = client.SendTransaction(context.Background(), signedTx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Transaction hash: %s\n", signedTx.Hash().Hex())
}Error Handling
| Error Code | Message | Description |
|---|---|---|
| -32000 | Nonce too low | Transaction nonce already used |
| -32000 | Insufficient funds | Account has insufficient balance |
| -32000 | Gas too low | Gas limit insufficient |
| -32000 | Replacement underpriced | Gas price too low for replacement |
Related Methods
eth_estimateGas- Estimate gas requiredeth_gasPrice- Get current gas priceeth_getTransactionReceipt- Get transaction result
eth_accounts
Returns a list of addresses owned by the client on zkSync Era. Typically returns an empty array on public RPC endpoints.
eth_getTransactionByHash
Retrieve transaction details by hash on zkSync Era. Essential for ZK developers, RWA tokenization teams, and builders launching custom L2/L3 chains tracking transactions on Matter Labs' flagship zkEVM powering the Elastic Network of interoperable hyperchains.