eth_sendRawTransaction
Execute signed Ethereum transactions or deploy smart contracts by submitting pre-signed transaction data to any EVM-compatible blockchain network.
Instructions
Creates new message call transaction or a contract creation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| signedTransactionData | Yes | Signed transaction data (hex string) |
Implementation Reference
- src/index.ts:555-585 (handler)The handler function executes the eth_sendRawTransaction by calling the generic makeRPCCall helper with the provided signed transaction data and formats the transaction hash response or error.async ({ signedTransactionData }) => { try { const result = await makeRPCCall("eth_sendRawTransaction", [ signedTransactionData, ]); return { content: [ { type: "text", text: formatResponse( { transaction_hash: result, status: "Transaction submitted successfully", }, "Raw Transaction Sent", ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: `Error: ${error.message}`, }, ], }; } },
- src/index.ts:550-554 (schema)Zod input schema defining the signedTransactionData parameter as a hex string.{ signedTransactionData: z .string() .describe("Signed transaction data (hex string)"), },
- src/index.ts:547-586 (registration)Registration of the eth_sendRawTransaction tool with server.tool, including name, description, schema, and handler reference.server.tool( "eth_sendRawTransaction", "Creates new message call transaction or a contract creation", { signedTransactionData: z .string() .describe("Signed transaction data (hex string)"), }, async ({ signedTransactionData }) => { try { const result = await makeRPCCall("eth_sendRawTransaction", [ signedTransactionData, ]); return { content: [ { type: "text", text: formatResponse( { transaction_hash: result, status: "Transaction submitted successfully", }, "Raw Transaction Sent", ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: `Error: ${error.message}`, }, ], }; } }, );
- src/index.ts:89-96 (helper)Generic RPC call helper function used by the handler to send the eth_sendRawTransaction RPC method to the Ethereum provider.async function makeRPCCall(method: string, params: any[] = []): Promise<any> { try { const result = await provider.send(method, params); return result; } catch (error: any) { throw new Error(`RPC call failed: ${error.message}`); } }