DeXit Network
Search…
⌃K
Links

Importing accounts

Import a keyfile
It is also possible to create a new account by importing a private key. For example, a user might already have some ether at an address they created using a browser wallet and now wish to use a new Geth node to interact with their funds. In this case, the private key can be exported from the browser wallet and imported into Geth. Geth requires the private key to be stored as a file which contains the private key as unencrypted canonical elliptic curve bytes encoded into hex (i.e. plain text key without leading 0x). The new account is then saved in encrypted format, protected by a passphrase the user provides on request. As always, this passphrase must be securely and safely backed up - there is no way to retrieve or reset it if it is forgotten!
$ geth account import --datadir /some-dir ./keyfile
The following information will be displayed in the terminal, indicating a successful import:
​
Please enter a passphrase now.
Passphrase:
Repeat Passphrase:
Address: {7f444580bfef4b9bc7e14eb7fb2a029336b07c9d}
This import/export process is not necessary for transferring accounts between Geth instances because the key files can simply be copied directly from one keystore to another.
It is also possible to import an account in non-interactive mode by saving the account password as plaintext in a .txt file and passing its path with the --password flag on startup.
geth account import --password path/password.txt path/keyfile
In this case, it is important to ensure the password file is not readable by anyone but the intended user. This can be achieved by changing the file permissions. On Linux, the following commands update the file permissions so only the current user has access:
chmod 700 /path/to/password
cat > /path/to/password
<type password here>

Import a presale wallet

Assuming the password is known, importing a presale wallet is very easy. The wallet import commands are used, passing the path to the wallet.
geth wallet import /path/presale.wallet