alchemyplatform/alchemy-web3

Unsupported method [eth_sendTransaction]

Closed this issue · 1 comments

Below is the code snippet for initiating web3 with Alchemy provider

import Web3 from 'web3'

const web3 = new Web3('https://eth-goerli.alchemyapi.io/v2/my-key')

Request

{"jsonrpc":"2.0","id":44,"method":"eth_sendTransaction","params":[{"from":"0xa7fc2009cc8b36997ef533dec396d6b4b00760e4","value":"0x16345785d8a0000","gas":"0x249f0","data":"0x4faa8a26000000000000000000000000a7fc2009cc8b36997ef533dec396d6b4b00760e4","gasPrice":"0x49504f80","to":"0xbbd7cbfa79faee899eaf900f13c9065bf03b1a74"}]}

Response

{"jsonrpc": "2.0", "id": 44, "error": {"code": -32601, "message": "Unsupported method [eth_sendTransaction]. See available methods at https://docs.alchemyapi.io/documentation/alchemy-api-reference/json-rpc"}}

brg8 commented

Hi there! This is a very old issue, but I figured I might as well respond. Alchemy does not hold your private keys, therefore we cannot sign transactions for you on our servers. In order to send a transaction with web3 you can first use signTransaction and then use sendRawTransaction with the signed tx as input. You can use our tutorial here as a reference: https://docs.alchemy.com/alchemy/tutorials/sending-txs.