I am working on developing Dapp and facing a challenge.

▶ Thing I want to achieve ◀

  • I'd like to create a new wallet instance, then when deploying a contract, I want to pay transaction costs from a signer wallet which would be a hardware wallet like Trezor/Ledger.

▶ Problems that I'm facing ◀

  • Since I cannot retrieve private keys from a hardware wallet, I can only create the new wallet with createRandom() method in ethers.js, which means I cannot technically connect the hardware wallet to the new wallet as a signer.

▶ Current implementation ◀

  • Using createRandom() to instantiate a new wallet.
    const newWallet = ethers.Wallet.createRandom().connect(provider);
  • Then send some token from the hardware wallet to the new wallet
  • Deploy contract(= transaction costs would be paid by the transferred token)

▶ Question ◀

  • Are there any ways to connect the hardware wallet to the new wallet instance? If that's possible, the transaction costs may be paid by the signer (= the connected hardware wallet).
  • If that's not, are there any ways to pay transaction costs from the hardware wallet?
  • Or, maybe it can be achieved if I can calculate total transaction costs BEFORE deployment, does anyone know to do so?

Since I'm still new to the blockchain space, it'd be appreciated if someone would give me some advice.


Your Answer

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

Browse other questions tagged or ask your own question.