Question on ganache about Address/Account generated #3111
-
Hi, It is my first time asking a question on Github. Thank you in advance for all your valuable answers. My question is : will the accounts generated with Ganache be deleted ? To put in context, if I have understood correctly, Truffle is using a local development blockchain called Ganache. So everytime I enter
Most of the time, I don't even use most of them, so I thought that these accounts would be temporary and deleted. However, as I followed some youtube tutorial, I happened to deploy on Rinkeby a simple smart contract using one of the account. (using https://rinkeby.etherscan.io/address/0x81c2a65455fbf40608ba066f434b471e49200a94 I am very confused, I thought Ganache was only local, why the address worked on a public testnet ? Can I really use a Ganache account to deploy on Mainnet ? Thank you for reading |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @AndyWaiHim, excellent question! I agree that it can be confusing. I'll do my best to answer! Ganache uses a twelve word mnemonic to generate 10 accounts on startup. These are valid Ethereum accounts, meaning that each generated account has a private key that can be used to sign transactions. When you are running truffle migrations on the Ganache network, Ganache verifies that the private key is valid for the account sending the transactions, and updates Ganache's VM state accordingly. However, like I stated above, these are valid Ethereum accounts. Basically any 40-character hexadecimal string with That being said, when you are ready to actually deploy a smart contract, we do not recommend using Ganache to generate your accounts. Use a wallet like MetaMask to generate the accounts and manage your private keys and use the Truffle Dashboard for deployment. I hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Thank you very much @MicaiahReid, it does help and I have a better understanding. If I have understand correctly, I can conclude that the 10 accounts will never be deleted and stay valid Ethereum accounts. (Edit : to be more accurate, the account are already in the Ethereum blockchain and Ganache just calculate the valid private key associated) Thank you again. |
Beta Was this translation helpful? Give feedback.
Hi @AndyWaiHim, excellent question! I agree that it can be confusing. I'll do my best to answer!
Ganache uses a twelve word mnemonic to generate 10 accounts on startup. These are valid Ethereum accounts, meaning that each generated account has a private key that can be used to sign transactions. When you are running truffle migrations on the Ganache network, Ganache verifies that the private key is valid for the account sending the transactions, and updates Ganache's VM state accordingly.
However, like I stated above, these are valid Ethereum accounts. Basically any 40-character hexadecimal string with
"0x"
in front of it is a valid address that can receive funds. If you want to waste som…