If i follow the steps mentioned in How to create an account in ethereumj.
It creates new account every time with different private key/address/public key. I would like to create different address/public key for same password every time.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
It creates new account every time because,
ECKey key = new ECKey(); // it will take new random entity //every time and it is the right way to create new accounts, in java
I think you are confusing a private key with a password.There is nothing called a password in Ethereumj implementation.
A private key has to be as random as possible.And since humans can not be good/smart enough to create a random number that would help generate a public key and eventually an address from that( which needs to be unique as well ) . The ECKey constructor internally uses SecureRandom() generator to create a random text that would generate a public key which is unique enough ( given the randomness of private key , the address is mathematically guaranteed ).
If you are coming from geth background with web3.personal object way of generating accounts, then I see your point of confusing a password with private key . But note the account you generate has nothing to do with the password you are providing. The password is used only to encrypt the keystore file, which contains your private key and other information.And your private key is still random there and you don't even know the seed used for it.
However for smart guys, you can generate a unique text such as TimeStamp+myuniquepass+randomnumber , this can be used the following way.But If I were you I would still use the ECKey key = new ECKey() way of creating / generating accounts.
> ECKey key = > ECKey.fromPrivate(HashUtil.sha3(TimeStamp+myuniquepass+randomnumber .getBytes())); // not working code , but you get the point. > > > byte addr = key.getAddress(); > byte priv = key.getPrivKeyBytes(); > byte pb= key.getPubKey(); > > String addrBase16 = Hex.toHexString(addr); > String privBase16 = Hex.toHexString(priv);