0

I am writing an NFT smart contract for a client. Is there a way that I can deploy this contract using the private keys of his wallet so that he is set as owner while at the same not not being able to see it?

How do blockchain developers deploy contracts for their clients without the client needing to trust the developer?

1 Answer 1

1

It's not possible to deploy a contract from someone else's address without knowing the private key. However, there are some workarounds. You can create a javascript function (using web3/ethers) that will deploy the contract. Your client can call the function and approve it using their wallet.

A much better way would be to deploy it yourself and then transfet the ownership to your client. This will be trivial to execute if you are using Owanable.sol from Openeppelin. However, you'll end up paying the gas fee for the contract creation.

4
  • I am using Ownable.sol, i have some functions that are onlyOwner. What I thought about was since he does trust me I could set it up so that we have 2 accounts. 1 for deploying the contract (of which i know the private keys) and the other I send all payments to, and I dont know his private keys.
    – omneuro
    Jan 27, 2022 at 9:17
  • You could do that too. Although transferring ownership would be an easier approach.
    – pbsh
    Jan 27, 2022 at 9:19
  • OK gonna read more into that thanks for the heads up. Just checking it’s a function in ownable right
    – omneuro
    Jan 27, 2022 at 9:30
  • Yeah, you can check out the Ownable.sol contract or OpenZeppelin Docs
    – pbsh
    Jan 27, 2022 at 10:24

Your Answer

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

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