1

From a command line, I run parity account new.

I am then asked to enter a password (twice), and an account-address is printed.

In addition to that, a JSON file is created.

Finally, I use this NodeJS code in order to generate the private key for my account-address:

let fs         = require("fs");
let keythereum = require("keythereum");
let keyObject  = JSON.parse(fs.readFileSync(KEY_FILE_NAME, "utf8"));
let privateKey = keythereum.recover(MY_PASSWORD, keyObject).toString("hex");
console.log(privateKey);

Is this pair of [public address, private key] suitable for every Ethereum network?

Can I safely use it on any testnet as well as on mainnet?

Or do I need to "register" it in a network before it is considered a valid account on it?

Thank you!

UPDATE:

To elaborate a little bit, I would like to share my understanding of how things work.

Suppose that someone sends 1 ether to 0x1234567812345678123456781234567812345678, and that no one has ever generated an account with this address.

When we check the balance of this account (on etherscan.io, for example), we will see that it stores 1 ether even though no one has ever generated it.

Now, if someone extremely lucky generates an account with this address, then they will be able to use the private key in order to withdraw the funds.

If I am correct in this description, then the immediate conclusion is that no such thing as "account registration" is required.

Am I right?

2 Answers 2

1

All ethereum compatible networks use the same type of private keys and the addresses have the same format, ie ETH mainnet, testnets like ropsten, rinkeby, kovan, ETC mainnet, etc. all can use the same private key/address.

You do not have to "register" an account. All accounts are already "created and initialized" with a zero balance.

It is possible that someones creates a private key that will generate the same address than you have, and it will have full access to all your funds. But it is something very very very unlikely.

1

To add to Ismael's answer, as outlined by Nick here,

Ethereum addresses are 160 bit hashes, meaning there are 2^160 possible hashes. Per the birthday problem, the chance of a collision rises to 50% when there are about 2^80 accounts created.

To give you an idea of how unlikely that is, if every person on earth spent all their time doing nothing but generating Ethereum accounts, and they generated one a second, they'd only generate about 2^57 of them. To generate 2^80 and reach a 50% probability of finding a collision, they'd need to keep on generating one per second for about 8 million years.

In short, the way Ethereum guarantees account uniqueness is by having such a mindbogglingly large number of possible addresses that no conceivable random process could ever generate a duplicate. This is also how account security is ensured - if you can generate a duplicate key hash, you can also steal someone's ether!

You can send Ether to any valid address even if no-one knows the private key for that address. Addresses do not need to be initialised.

You can use a generated address on any Ethereum network but I would not recommend it. Imagined for example that you generate a mnemonic (private key) and use it on both Ropsten and Mainnet. You happily enter your mnemonic on a third party ropsten development website because it 'is just a testnet' key. All of a sudden you have lost your Ether on mainnet.

It is the same reason why you don't reuse passwords across website as if one website is compromised then all of your accounts are compromised.

0

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.