Using Binance SC instead of ETH

Given MetaMask has connected using Binance SC, if I do a query for (‘EthTransactions’) will it return the Binance transaction when they happen, or does it only work for Eth?

Anyone know?

Hi. This concept takes some thinking to wrap your head around at first. The Moralis server and the dapp running in the browser are 2 separate environments.

What happens on the server is determined entirely by the network chosen when the server instance is created. That is the only network the server can watch and sync transactions and events from.

The network your wallet is connected to in the browser effects which address type you are authenticating with- i.e. Ethereum (or BTC, DOT, etc when those are supported). The next tricky part is that since Binance Smart Chain (BSC) and Polygon (MATIC) for that matter are all EVM compatible chains that use ETH addresses… when you authenticate with Moralis.Web3.authenticate() it doesn’t matter that that your wallet is connected to BSC, MATIC, or ropsten… the signature is identical either way.

Where the connected network DOES matter in the browser is when calling contract functions from the dapp. If your contract is deployed to ropsten and your wallet is connected to BSC then it’s not going to work so well as your contract does not exist on BSC :slight_smile:

Hope that makes sense.

1 Like

Alright let me rephrase; is Moralis code agnostic for all supported platforms; for instance, do I need to write different code depending on which network the user has authenticated by, or does the same code which reads history from ETH automatically fetch the information from Binance if that is what the user signed in using?

The method calls are all the same (Moralis.Web3.authenticate, Moralis.Query,, etc), but some of the parameter values may be different. For example to authenticate using Elrond (see the Moralis youtube video on Elrond):

const user = await Moralis.Web3.authenticate({ type: "erd" })

While the API should be the same, the names of things do change from chain to chain where those chains are fundamentally different.

Some values are prefixed with “eth”… like user.get("ethAddress"). And transaction tables like EthTokenBalance and EthTransactions. With Elrond these would be erdAddress and erdTransactions… or ada or btc, etc. In the user object especially these prefixes are needed as it’s possible to link multiple addresses from multiple different chains to the same user profile. While it’s currently only possible to sync the server to 1 chain, in the future it may be possible to sync to multiple chains at once and these prefixes will be necessary to keep the data separate.

Just to re-iterate though, what network the user is connected to in the browser only effects authentication, not which network the server monitors transactions from. These are unrelated.

Ok got ya, another question… I’m trying to get historical transactions and this works for Ethereum;

const Txs = Moralis.Object.extend("EthTransactions") let query = new Moralis.Query(Txs) query.equalTo("to_address", address) const resultsTo = await query.find()

but if I change the line Moralis.Object.extend to (“BscTransactions”) I get nothing, and there are no Bsc prefixed tables in the backend even after user has signed in using BSC. We have already enabled BSC ( and polygon ) on the EVM choices @ My Servers > View Details > EVM Configuration

Is there a step we are missing?

I’d wager a guess it’s because the BSC historical node is still 1.5million blocks behind. See the sync status here (BSC has been having lots of issues with this):

Also beware the contract event plugins can currently only listen to events on ETH as the UI has not yet been modified to allow the user to choose which chain to listen to, so it defaults to ETH. This task is on our list for the current sprint so will hopefully be done shortly.