Web3, getTransactions fails with chain: ganache

Getting error trying to call getTransaction for Ganache config.


const options = { chain: “ganache”,
address: “0x6EBB6B428d1052De7eB3fc945a518297A74B0d61”,
order: “desc”,
from_block: “0” };

const transactions = await Moralis.Web3API.account.getTransactions(options);

ERROR: moralis.js:22304 POST https://ilbzvqwvs999.usemoralis.com:2053/server/functions/getTransactions 400 (Bad Request)

Also, when trying out Morialis Web3 API online, it doesn’t show ganache as a chain option although the documentation says it supports it.

I have followed all the doc and videos and have the proxy running.
“Devchain Proxy Server” says “CONNECTED”.

Why can’t I develop using Ganache and call Morallis Web3 functions?

I am using the “Morallis Web Wallet” example to test this. everything runs fine until I try to get any transactions, balances, etc.

Thanks

Hello,
web3api functions currently don’t work with a local devchain. you could still get the transactions from what got synced in your Moralis db, but the part with web3api will not work.

Then what blockchain do I develop on using fake tokens?

Thanks

You can use public testnet chain like Rinkeby, BSC Testnet and etc…

Are the test nets fake tokens? Like fake ETH?

You can deploy any fake token you need on a testnet, you can get native currency for a testnet from a faucet.

Do I need to set up a rinkeby metamask account to make the “Web Wallet” example work?
Since the getTransactions are configured for chain: rinkeby
??
I just don’t see any transactions once I do something like transfer ETH from one account to the other.

1 Like

You can use web3api with any chain, that request will not use your current metamask selected network, that request will be handled by Moralis infrastructure.
For example:

x = await Moralis.Web3API.token.getTokenPrice({address: “0xe9e7cea3dedca5984780bafc599bd69add087d56”, chain: “bsc”})

will work independently of what network you have selected in metamask.

I just don’t see any transactions once I do something like transfer ETH from one account to the other.

What you mean with this part, where did you look for transactions?

I run the “Web Wallet” example and set for Ganache when I transfer 1 ETH from one address to another I see the transfer in the Ganache main screen, but when I getTransactions it says there are zero. I need to set up the “Web Wallet” so when I do a transfer of ETH that I see that transaction when I do a getTransactions, but it never shows anything, not even balances.

how do you use getTransactions now, with what parameters?

You will have to make a transaction with metamask in rinkeby testnet, or in another testnet, and then to get the list of transactions from that specific network, you will not use Ganache any more when you are doing transactions in a testnet.