1

The deployment script for a contract has the following logic. Take private key from database -> Create an account using Web3.eth.accounts.create() -> set the account as Admin in database -> deploy the contract.

I have a doubt here. If I try to run the script again, while creating the admin account from the same private key, will it create a new account (new address) or the same address and deploy the contract?

Thanks

  • 1
    It will generate the same address because it doesn't literally "create" an account instead it just generates the address which is deterministic and will be the same forever. – Zartaj Afser Dec 18 '23 at 07:18
  • As @ZartajAfser says a private key only has one public key. There's an algorithm that always generate the same public key from the private key https://ethereum.stackexchange.com/questions/3542/how-are-ethereum-addresses-generated. – Ismael Dec 28 '23 at 03:45

0 Answers0