Wallet Calls
Checks whether the wallet has just been created and has not yet had a password set.
Calling
set_password
will transition the wallet to the locked state.bool graphene::wallet::wallet_api::is_new()const
Return
True if the wallet is new.
Checks whether the wallet is locked (is unable to use its private keys).
bool graphene::wallet::wallet_api::is_locked()const
Return
True if the wallet is locked
Locks the wallet immediately.
void graphene::wallet::wallet_api::lock()
Unlocks the wallet.
The wallet remain unlocked until the
lock
is called or the program exits.When used in command line, if typed “unlock” without a password followed, the user will be prompted to input a password without echo.
void graphene::wallet::wallet_api::unlock(
string password)
Parameters
Sets a new password on the wallet.
The wallet must be either ‘new’ or ‘unlocked’ to execute this command.
When used in command line, if typed “set_password” without a password followed, the user will be prompted to input a password without echo.
void graphene::wallet::wallet_api::set_password(
string password)
Parameters
password
: a new password
Dumps all private keys owned by the wallet.
The keys are printed in WIF format. You can import these keys into another wallet using
import_key()
map<public_key_type, string> graphene::wallet::wallet_api::dump_private_keys()
Return
A map containing the private keys, indexed by their public key
Imports the private key for an existing account.
The private key must match either an owner key or an active key for the named account.
bool graphene::wallet::wallet_api::import_key(
string account_name_or_id,
string wif_key)
Parameters
Return
account_name_or_id
: the account owning the keywif_key
: the private key in WIF format
true if the key was imported
Imports accounts from a BitShares 0.x wallet file. Current wallet file must be unlocked to perform the import.
map<string, bool> graphene::wallet::wallet_api::import_accounts(
string filename,
string password)
Parameters
Return
filename
: the BitShares 0.x wallet file to importpassword
: the password to encrypt the BitShares 0.x wallet file
A map containing the accounts found and whether imported.
Imports from a BitShares 0.x wallet file, find keys that were bound to a given account name on the BitShares 0.x chain, rebind them to an account name on the 2.0 chain. Current wallet file must be unlocked to perform the import.
bool graphene::wallet::wallet_api::import_account_keys(
string filename,
string password,
string src_account_name,
string dest_account_name)
First Tab
Return
filename
: the BitShares 0.x wallet file to importpassword
: the password to encrypt the BitShares 0.x wallet filesrc_account_name
: name of the account on BitShares 0.x chaindest_account_name
: name of the account on BitShares 2.0 chain, can be same or different tosrc_account_name
Whether the import has succeeded
This call will construct transaction(s) that will claim all balances controlled by wif_keys and deposit them into the given account.
vector<signed_transaction> graphene::wallet::wallet_api::import_balance(
string account_name_or_id,
const vector<string> &wif_keys,
bool broadcast)
Parameters
account_name_or_id
: name or ID of an account that to claim balances towif_keys
: private WIF keys of balance objects to claim balances frombroadcast
: true to broadcast the transaction on the network
Suggests a safe brain key to use for creating your account.
create_account_with_brain_key()
requires you to specify a ‘brain key’, a long passphrase that provides enough entropy to generate cryptographic keys. This function will suggest a suitably random string that should be easy to write down (and, with effort, memorize).
brain_key_info graphene::wallet::wallet_api::suggest_brain_key()const
Return
A suggested brain_key
This method is used to convert a JSON transaction to its transacting ID.
transaction_id_type graphene::wallet::wallet_api::get_transaction_id(
const signed_transaction &trx)const
Parameters
Return
trx
: a JSON transaction
The ID (hash) of the transaction.
Get the WIF private key corresponding to a public key. The private key must already be in the wallet.
string graphene::wallet::wallet_api::get_private_key(
public_key_type pubkey)const
Parameters
Return
pubkey
: a public key in Base58 format
The WIF private key
Loads a specified Graphene wallet.
The current wallet is closed before the new wallet is loaded.
Important: This does not change the filename that will be used for future wallet writes, so this may cause you to overwrite your original wallet unless you also call
set_wallet_filename()
bool graphene::wallet::wallet_api::load_wallet_file(
string wallet_filename = "")
Parameters
Return
wallet_filename
: the filename of the wallet JSON file to load. Ifwallet_filename
is empty, it reloads the existing wallet file.
True if the specified wallet is loaded.
Transforms a brain key to reduce the chance of errors when re-entering the key from memory.
This takes a user-supplied brain key and normalizes it into the form used for generating private keys. In particular, this upper-cases all ASCII characters and collapses multiple spaces into one.
string graphene::wallet::wallet_api::normalize_brain_key(
string s)const
Parameters
Return
s
: the brain key as supplied by the user
The brain key in its normalized form.
Saves the current wallet to the given filename.
Important: This does not change the wallet filename that will be used for future writes, so think of this function as ‘Save a Copy As…’ instead of ‘Save As…’. Use
set_wallet_filename()
to make the filename persist.void graphene::wallet::wallet_api::save_wallet_file(
string wallet_filename = "")
Parameters
wallet_filename
: the filename of the new wallet JSON file to create or overwrite. Ifwallet_filename
is empty, save to the current filename.
Last modified 3yr ago