I was using metamask (window.ethereum) as my Web3 provider but for production was going to switch to Alchemy and realized that the provider.listAccounts() method stopped working with Alchemy provider. Looking at source code looks like it always returns an empty array. Reading the docs I find that

Since Alchemy does not store keys, this will always return empty.

Does this mean that in production I would use Metamask provider to query the accounts and then Alchemy to do everything else ? What are some alternatives that don't require using both ? Thanks

1 Answer 1


As far as my understanding goes, you would end up using a fast connection provider, such as Alchemy when reading all the necessary info from your dapp. You won't get any accounts from Alchemy, since it's not Alchemy's keys that you want. When interacting with the blockchain (actually sending transactions), you'll need to send a request to the user's Metamask (provider), since they are the one that are in possession of the private keys that will be used to sign a transaction. The transaction then is directly sent from Metamask to the blockchain, so the "writing" part is generally handled by the users web3 provider. I say generally, because you could request the user to sign a transaction and then send that signed transaction back through Alchemy, although there shouldn't be any benefit of doing this.

Edit: To actually answer your question though, you can either just use the user's connection through Metamask (although this is mostly slow and will probably be rate-limited and fail when making many requests at once) or you use Alchemy to read from the blockchain and the user's provider to write to the blockchain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.