0

Does anyone know how I can initiate transaction from my DAPP to send BNB while connected to trust wallet using walletconnect?

I see an example for etheruem transaction here: https://docs.walletconnect.com/quick-start/dapps/client#send-transaction-eth_sendtransaction

But I don't know how to do this for BNB transaction: I found this article on binance docs: https://docs.binance.org/guides/concepts/walletconnect.html, and I know I can do something similar using sendCustomRequest method on wallet connect js integration, but I don't know the right parameters to send in the transaction request.

Also, while connecting to walletconnect, I want to be able to automatically pick smart chain network instead of the default which is ethereum mainnet.

I hope this is clear enough guys.

Thank you.

1 Answer 1

0

Binance Smart Chain is an EVM compatible blockchain. This means that any utilities you are accustomed to from Ethereum will work on BSC as well.

The sendTransaction({..., value: x }) method will transfer the utility token of the blockchain in question: ETH on Ethereum, BNB on BSC, Matic on Polygon POS and so on.

As for the network, the user is the one who can pick the necessary network from their wallet. What you may do if the user picked the wrong network is to suggest them to move to BSC from their wallet (Trust, Rainbow, Metamask etc.), through a warning in your UI.

3
  • the challenge here is how to get the BNB wallet address to use in the transaction parameter const tx = { from: "0xbc28Ea04101F03aA7a94C1379bc3AB32E65e62d3", // Required to: "0x89D24A7b4cCB1b6fAA2625Fe562bDd9A23260359", // Required (for non contract deployments) data: "0x", // Required gasPrice: "0x02540be400", // Optional gas: "0x9c40", // Optional value: "0x00", // Optional nonce: "0x0114", // Optional }; Jan 6, 2022 at 1:09
  • the challenge here is how to get the BNB wallet address to use in the transaction parameter const tx = { from: "0xbc28Ea04101F03aA7a94C1379bc3AB32E65e62d3", // Required to: "0x89D24A7b4cCB1b6fAA2625Fe562bDd9A23260359", // Required (for non contract deployments) data: "0x", // Required ... }; No matter the network chosen, the address returned by the wallet is always the ETH address, how do I get the BNB address then? From Above, from and to has to be BNB addresses . Jan 6, 2022 at 1:20
  • Same thing, BSC, Ethereum and any other EVM compatible blockchain use the same key derivation algorithm. So, if you have access to an address on Ethereum, you'll have access to that same address on any other EVM chain (through the same private key). See here an example from trust wallet: community.trustwallet.com/t/binance-smart-chain-address-change/…
    – razgraf
    Jan 6, 2022 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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