scala-tron icon indicating copy to clipboard operation
scala-tron copied to clipboard

Create Address Command

Open Rovak opened this issue 7 years ago • 6 comments

Address Creation

Add functionality to generate new addresses

CLI

The user wants to create a new address using the CLI

> key --create
Key Created!
Address: 1BUo6dhbemHJWpSXc5HkywPc3ExEBisAtb
Private Key: L4zFXjeNz8n62gE8areGTkMwCus7vQfuZnDwZkq5GChrQF4BBr74

Don't lose your private key!

Web Api

The user wants to create a new address using the Web Api

Request

POST /api/key

Response

{
  "address": "1BUo6dhbemHJWpSXc5HkywPc3ExEBisAtb",
  "private_key": "L4zFXjeNz8n62gE8areGTkMwCus7vQfuZnDwZkq5GChrQF4BBr74"
}

Usage

The address can then be used in conjunction with the send command

> wallet --key L3MNySDoLAiJU8ze3V7XZpxYKvywbNjxyAboNhsYVSnR3ZYZMahq
> send --to 1BUo6dhbemHJWpSXc5HkywPc3ExEBisAtb --amount 10

Sources:

  • https://bitcoinj.github.io/working-with-the-wallet

Rovak avatar Jan 21 '18 13:01 Rovak

This seems good for now. If we want to make this further friendly for the end user, we need to add another point of return from failure (loosing private key)

For instance in: Exodus( wallet for ethereum and some of its tokens) gives the user a list of 15 words which have to be given to the app in the same sequence in case of a loss of the private key. NEON which is a wallet for neo gives the user a *.keystore file.

What I mean from multiple points of return is something like the above mentioned examples. After the user generates a private key or a new wallet, we need to give the user also another thing (file or any cryptographic data) which will not make the user loose his/her holding in case of missing his private key. For instance, we can give the user a keystore file which has the key encrypted in some format in it.

If the user looses his/her private key, all he has to do is give the keystore file to the app and he will get his private key regenerated.

Note: This does not mean that the keystore option is compulsory. It can also be kept optional for the user (for instance is the user adds a flag --nokeystore then the app wont generate a keystore). I think an added 'optional' (good) feature is definitely a bonus

vinayphadnis avatar Jan 21 '18 14:01 vinayphadnis

Adding a recovery method is a good idea but i wonder how the private key be recovered from 15 words without storing the (private key, words) combination somewhere. Any idea how it works in the exodus wallet?

The keystore should optionally be generated with an extra option in the wallet command, i would suggest a --keystore <file> option

> key --create --keystore = /home/rovak/wallet.keystore`
Key Created!
Address: 1BUo6dhbemHJWpSXc5HkywPc3ExEBisAtb
Private Key: L4zFXjeNz8n62gE8areGTkMwCus7vQfuZnDwZkq5GChrQF4BBr74
Keystore: /home/rovak/wallet.keystore

Rovak avatar Jan 21 '18 14:01 Rovak

Exodus is a third party software so there is a high chance that they have (private key, words) somewhere stored on their server. This makes it highly centralised and also not very good on a security point of view.

The --keystore option seems good!

vinayphadnis avatar Jan 21 '18 14:01 vinayphadnis

While updating the README.md file, 1)I will add the print block sample as discussed over here 2)will add what is discussed on this issue concerning the command for creating a wallet 3)Should I add the --keystore <file> option as of now (in the README file) ?

vinayphadnis avatar Jan 22 '18 08:01 vinayphadnis

I've started point 2 in #20

Rovak avatar Jan 22 '18 08:01 Rovak

I've reduced the scope of this issue from creating a wallet to creating addresses

Rovak avatar Jan 22 '18 17:01 Rovak