0

How can we deploy contracts using web3.js or ethers.js just like thirdweb does?

I create a contract on web3.js then used the deploy function with send but then alchemy gave an error that it can't access users private key

Then I tried signing a transaction and then send Raw Transaction but this was not working, any solutions to this?

1
  • What error did you get when submitting a signed transaction?
    – Richard
    Jan 3 at 11:25

1 Answer 1

0

With Ethers you can use a ContractFactory which is connected to the signer that should deploy the contract.

A signer can for example be a Ethers Wallet.

3
  • But I don't have private key of that user, is there a way, I can let them sign contract deployment with Metamask? Jan 4 at 15:20
  • you can use the Web3Provider and pass window.ethereum (the injected MM connector) to it. Then you can get the signer with getSigner. This signer can be used with the ContractFactory as mentioned above.
    – Richard
    Jan 4 at 15:24
  • I have created a proxy contract that uses the new solidity keyword to create a new copy of that contract and the call that function from ethers js Jan 5 at 11:18

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.