Author [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] [EN] [ZH] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU] Topic: How to import account to CLI client?  (Read 302 times)

0 Members and 1 Guest are viewing this topic.

Offline clayop

How to import account to CLI client?
« on: October 04, 2014, 06:35:42 AM »

I attempted to "wallet_import_private_key [PrivKey] [account name]" but it gave me the error message as follow,

current_account.valid(): You must create an account before importing a key

How can I resolve this problem? Any clues?
Bitshares Korea - http://www.bitshares.kr
Vote for me and see Korean Bitshares community grows
delegate-clayop

Offline pc

  • Hero Member
  • *****
  • Posts: 1012
    • View Profile
    • Bitcoin - Perspektive oder Risiko?
  • BTS: cyrano
  • Witness: cyrano
  • Payrate: 100%
Re: How to import account to CLI client?
« Reply #1 on: October 04, 2014, 08:07:35 AM »
wallet_import_private_key has 4 arguments:
Code: [Select]
(wallet closed) >>> help wallet_import_private_key
Usage:
wallet_import_private_key <wif_key> [account_name] [create_new_account] [rescan]
Loads the private key into the specified account. Returns which account it was actually imported to.

Parameters:
  wif_key (wif_private_key, required): A private key in bitcoin Wallet Import Format (WIF)
  account_name (account_name, optional, defaults to null): the name of the account the key should be imported into, if null then the key must belong to an active account
  create_new_account (bool, optional, defaults to false): If true, the wallet will attempt to create a new account for the name provided rather than import the key into an existing account
  rescan (bool, optional, defaults to false): If true, the wallet will rescan the blockchain looking for transactions that involve this private key


So, to import the key into an existing account you have to do what you have already tried.
If you want to create a new account with an existing key, you have to set the third argument to true (and usually also the fourth).
Please vote for my BitShares witness "cyrano" and for my STEEM witness "cyrano.witness"!
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de

Offline clayop

Re: How to import account to CLI client?
« Reply #2 on: October 04, 2014, 05:20:40 PM »
wallet_import_private_key has 4 arguments:
Code: [Select]
(wallet closed) >>> help wallet_import_private_key
Usage:
wallet_import_private_key <wif_key> [account_name] [create_new_account] [rescan]
Loads the private key into the specified account. Returns which account it was actually imported to.

Parameters:
  wif_key (wif_private_key, required): A private key in bitcoin Wallet Import Format (WIF)
  account_name (account_name, optional, defaults to null): the name of the account the key should be imported into, if null then the key must belong to an active account
  create_new_account (bool, optional, defaults to false): If true, the wallet will attempt to create a new account for the name provided rather than import the key into an existing account
  rescan (bool, optional, defaults to false): If true, the wallet will rescan the blockchain looking for transactions that involve this private key


So, to import the key into an existing account you have to do what you have already tried.
If you want to create a new account with an existing key, you have to set the third argument to true (and usually also the fourth).

Great thanks!!!
Bitshares Korea - http://www.bitshares.kr
Vote for me and see Korean Bitshares community grows
delegate-clayop

Offline clayop

Re: How to import account to CLI client?
« Reply #3 on: October 04, 2014, 08:29:33 PM »
One more problem... I successfully import my account, but it seems not to be synced. (I import registered account but my account information reports that the account is not registered.
Bitshares Korea - http://www.bitshares.kr
Vote for me and see Korean Bitshares community grows
delegate-clayop

Offline Riverhead

Re: How to import account to CLI client?
« Reply #4 on: October 04, 2014, 08:39:35 PM »
Did you try wallet_account_register?

Offline clayop

Re: How to import account to CLI client?
« Reply #5 on: October 04, 2014, 08:47:37 PM »
Yes, but it doesn't work.

The situation is:
-I have one windows GUI wallet and one linux CLI wallet.
-Both have the same account with the same public Key
-While the account on windows GUI is registered, the account on linux CLI is not registered.

Bug??
Bitshares Korea - http://www.bitshares.kr
Vote for me and see Korean Bitshares community grows
delegate-clayop

Offline Riverhead

Re: How to import account to CLI client?
« Reply #6 on: October 04, 2014, 08:52:44 PM »
Try doing a wallet_regenerate_keys. It should be registered.

Offline clayop

Re: How to import account to CLI client?
« Reply #7 on: October 04, 2014, 09:13:21 PM »
Try doing a wallet_regenerate_keys. It should be registered.

I found the problem... I was on the wrong version. (Although I followed the instruction. Do I have to more?)

Here are commands I did

Code: [Select]
sudo apt-get update
sudo apt-get install cmake git libreadline-dev uuid-dev g++ libdb++-dev libdb-dev zip libssl-dev openssl build-essential python-dev autotools-dev libicu-dev libbz2-dev libboost-dev libboost-all-dev
git clone https://github.com/dacsunlimited/bitsharesx.git
cd bitsharesx
git submodule init
git submodule update
cmake .
make
Bitshares Korea - http://www.bitshares.kr
Vote for me and see Korean Bitshares community grows
delegate-clayop

 

Google+