Suppose there is a live contract (on live network, not test network) out there on Binance Smart Chain and it has a payable function that I want to use. I want to use web3 to send a transaction and sign that transaction WITHOUT requiring manual confirmation using Metamask. I know infura does not support BSC. How is it possible to do this? I am willing to use either Javascript of python for the web3 script and library.

If this is not possible, is it possible for web3 to launch Binance Chain Wallet instead of Metamask? Or is it just Metamask?

Finally, suppose I have Metamask installed on both Chrome and Firefox. Does web3.js know which instance of Metamask to launch? Or does it only search the Metamask in whichever browser is my default browser?

EDIT: I already know that if I use Javascript (the most common choice for this task), then I need to use the web3.js library and probably hd-wallet-provider. The contract I want to connect with is not my contract, so truffle may or may not be useful. What I'm looking for are some more details as to how to connect to binance smart chain and how to sign transactions if I have a wallet mnemonic. Thanks.

  • Do you need BSC provider?! Commented Sep 14, 2021 at 22:41

1 Answer 1


Let's start with your last set of questions. Typically Metamask is used with some website - you go to the website and it asks you to connect Metamask. Therefore it's uses the Metamask from that browser. If you need to open Metamask from outside a website (unsure if that's even possible), it'd probably use your default browser's Metamask.

To sign transactions (without confirmation), you can use some scripting. What you basically need is:

  1. Your private key (or mnemonic)

  2. Access to a node client. Either your own, or a public node service provider - for BSC I believe Ankr for example offers some

  3. Some tools to do the heavy lifting for you. For example Hardhat or Truffle

What you do is create a small script (JavaScript) which takes your private key, creates the required transaction with the required parameters and sends it to the blockchain through the node client. No manual confirmations needed.

Similar stuff is possible also with Python, but I'm not familiar with those tools.

  • This answer just tells me top level things I already know. I was really looking for more programming details, like which js libraries do I need to use to connect to a binance smart chain contract and how do I sign a transaction without having to use Metamask. Thanks anyway.
    – Marc
    Commented Sep 15, 2021 at 14:54

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.