1

Im deploying to the BSC testnet:

bscTest: {
      provider: () => new HDWalletProvider(privateKey, `https://data-seed-prebsc-1-s1.binance.org:8545/`),
      network_id: 97,
      confirmations: 1,
      timeoutBlocks: 200,
      skipDryRun: false,
      from: "0x96122617199a33fd297cbBA77Bec8EAc0a745D67",
      gas: 10000000,
      
    },

All successfully deployed, I'm trying to interact with that contract with the imported address, but i'm getting:

Error: Unknown address - unable to sign transaction for this address: "0x32159ea969bf703cfe9655b526ec29d63c55abdb"\n'

This address comes from https://vanity-eth.tk/ and I filled it with BNB from https://testnet.binance.org/faucet-smart, how can I use this address in truffle console? how import the private key for that address.

1 Answer 1

1

With @truffle/hdwallet-provider you can instantiate it with an array of private keys.


const privateKeys = [
  "1234..",
  "8888..",
]
const addressIndex = 0
const numberOfAddresses = 2
const providerOrUrl = "http://localhost:8545"


...

bscTest: {
  provider: () => {
    return new HDWalletProvider({
      privateKeys,
      providerOrUrl,
      addressIndex,
      numberOfAddresses,
    })
4
  • Hey thanks, I've done that in truffle-config, but im unable to use the imported address in the truffle console
    – redigaffi
    Apr 24, 2021 at 7:26
  • @redigaffi Is the private key correct? Did you start the console with the correct network?
    – Ismael
    Apr 24, 2021 at 20:32
  • Yes it is, because I can deploy to testnet, the problem is when using that address in the truffle console.
    – redigaffi
    Apr 25, 2021 at 8:17
  • @redigaffi If you can deploy the wallet is configured correctly, so problem is in the console either you are not loading the correct network or you are using it incorrectly. What command are you trying to use from the console? What is the exact error message? Did you specify 'from' with the correct wallet? What command line you use launch to launch truffle console?
    – Ismael
    Apr 25, 2021 at 15:35

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.