29 #include <boost/algorithm/string.hpp> 30 #include <boost/algorithm/string/trim_all.hpp> 57 string confirm =
getPassword(
"Please confirm the passphrase by entering it again: ");
60 cout <<
"Passwords were different. Try again." << endl;
68 pair<string, string>
createPassword(
KeyManager& _keyManager, std::string
const& _prompt, std::string
const& _pass = std::string(), std::string
const& _hint = std::string())
75 string confirm =
getPassword(
"Please confirm the passphrase by entering it again: ");
78 cout <<
"Passwords were different. Try again." << endl;
81 if (hint.empty() && !pass.empty() && !_keyManager.
haveHint(pass))
83 cout <<
"Enter a hint to help you remember this passphrase: " << flush;
86 return make_pair(pass, hint);
120 string arg = argv[i];
121 if (arg ==
"--wallet-path" && i + 1 < argc)
122 m_walletPath = argv[++i];
123 else if (arg ==
"--secrets-path" && i + 1 < argc)
124 m_secretsPath = argv[++i];
125 else if ((arg ==
"-m" || arg ==
"--master") && i + 1 < argc)
126 m_masterPassword = argv[++i];
127 else if (arg ==
"--unlock" && i + 1 < argc)
128 m_unlocks.push_back(argv[++i]);
129 else if (arg ==
"--lock" && i + 1 < argc)
131 else if (arg ==
"--kdf" && i + 1 < argc)
133 else if (arg ==
"--kdf-param" && i + 2 < argc)
139 else if (arg ==
"newbare")
140 m_mode = OperationMode::NewBare;
141 else if (arg ==
"inspect")
142 m_mode = OperationMode::Inspect;
143 else if ((arg ==
"-s" || arg ==
"--sign-tx" || arg ==
"sign") && i + 1 < argc)
145 m_mode = OperationMode::SignTx;
146 m_signKey = argv[++i];
148 else if (arg ==
"--show-me-the-secret")
150 else if (arg ==
"--tx-data" && i + 1 < argc)
153 m_toSign.data =
fromHex(argv[++i]);
157 cerr <<
"Invalid argument to " << arg << endl;
160 else if (arg ==
"--tx-nonce" && i + 1 < argc)
163 m_toSign.nonce =
u256(argv[++i]);
167 cerr <<
"Invalid argument to " << arg << endl;
170 else if (arg ==
"--force-nonce" && i + 1 < argc)
173 m_forceNonce =
u256(argv[++i]);
177 cerr <<
"Invalid argument to " << arg << endl;
180 else if ((arg ==
"--tx-dest" || arg ==
"--tx-to" || arg ==
"--tx-destination") && i + 1 < argc)
183 m_toSign.creation =
false;
188 cerr <<
"Invalid argument to " << arg << endl;
191 else if (arg ==
"--tx-gas" && i + 1 < argc)
194 m_toSign.gas =
u256(argv[++i]);
198 cerr <<
"Invalid argument to " << arg << endl;
201 else if (arg ==
"--tx-gasprice" && i + 1 < argc)
204 m_toSign.gasPrice =
u256(argv[++i]);
208 cerr <<
"Invalid argument to " << arg << endl;
211 else if (arg ==
"--tx-value" && i + 1 < argc)
214 m_toSign.value =
u256(argv[++i]);
218 cerr <<
"Invalid argument to " << arg << endl;
221 else if (arg ==
"--decode-tx" || arg ==
"decode")
222 m_mode = OperationMode::DecodeTx;
223 else if (arg ==
"--import-bare" || arg ==
"importbare")
224 m_mode = OperationMode::ImportBare;
225 else if (arg ==
"--list-bare" || arg ==
"listbare")
226 m_mode = OperationMode::ListBare;
227 else if (arg ==
"--export-bare" || arg ==
"exportbare")
228 m_mode = OperationMode::ExportBare;
229 else if (arg ==
"--inspect-bare" || arg ==
"inspectbare")
230 m_mode = OperationMode::InspectBare;
231 else if (arg ==
"--recode-bare" || arg ==
"recodebare")
232 m_mode = OperationMode::RecodeBare;
233 else if (arg ==
"--kill-bare" || arg ==
"killbare")
234 m_mode = OperationMode::KillBare;
235 else if (arg ==
"--create-wallet" || arg ==
"createwallet")
236 m_mode = OperationMode::CreateWallet;
237 else if (arg ==
"-l" || arg ==
"--list" || arg ==
"list")
238 m_mode = OperationMode::List;
239 else if ((arg ==
"-n" || arg ==
"--new" || arg ==
"new") && i + 1 < argc)
241 m_mode = OperationMode::New;
244 else if ((arg ==
"-i" || arg ==
"--import" || arg ==
"import") && i + 2 < argc)
247 m_inputs =
strings(1, argv[++i]);
250 else if ((arg ==
"--import-presale" || arg ==
"importpresale") && i + 2 < argc)
252 m_mode = OperationMode::ImportPresale;
253 m_inputs =
strings(1, argv[++i]);
256 else if ((arg ==
"--import-with-address" || arg ==
"importwithaddress") && i + 3 < argc)
258 m_mode = OperationMode::ImportWithAddress;
259 m_inputs =
strings(1, argv[++i]);
260 m_address =
Address(argv[++i]);
263 else if (arg ==
"--export" || arg ==
"export")
265 else if (arg ==
"--recode" || arg ==
"recode")
266 m_mode = OperationMode::Recode;
267 else if (arg ==
"kill")
268 m_mode = OperationMode::Kill;
269 else if (arg ==
"--no-icap")
271 else if (m_mode == OperationMode::DecodeTx || m_mode == OperationMode::Inspect || m_mode == OperationMode::Kill || m_mode == OperationMode::SignTx || m_mode == OperationMode::ImportBare || m_mode == OperationMode::InspectBare || m_mode == OperationMode::KillBare || m_mode == OperationMode::Recode || m_mode ==
OperationMode::Export || m_mode == OperationMode::RecodeBare || m_mode == OperationMode::ExportBare)
272 m_inputs.push_back(arg);
281 while (m_icap && k.
address()[0])
290 return Secret(secretStore().secret(secretStore().readKeyContent(json), [&](){
return getPassword(
"Enter passphrase for key: "); }));
294 return Secret(secretStore().secret(u, [&](){
return getPassword(
"Enter passphrase for key: "); }));
295 if (_signKey.substr(0, 6) ==
"brain#" && _signKey.find(
":") != string::npos)
296 return KeyManager::subkey(KeyManager::brain(_signKey.substr(_signKey.find(
":"))), stoul(_signKey.substr(6, _signKey.find(
":") - 7)));
297 if (_signKey.substr(0, 6) ==
"brain:")
298 return KeyManager::brain(_signKey.substr(6));
299 if (_signKey ==
"brain")
300 return KeyManager::brain(
getPassword(
"Enter brain wallet phrase: "));
308 for (
Address const& aa: keyManager().accounts())
309 if (keyManager().accountName(aa) == _signKey)
316 return keyManager().secret(a, [&](){
return getPassword(
"Enter passphrase for key (hint:" + keyManager().passwordHint(a) +
"): "); });
317 cerr <<
"Bad file, UUID or address: " << _signKey << endl;
328 case OperationMode::CreateWallet:
330 KeyManager wallet(m_walletPath, m_secretsPath);
331 if (m_masterPassword.empty())
332 m_masterPassword =
createPassword(
"Please enter a MASTER passphrase to protect your key store (make it strong!): ");
335 wallet.
create(m_masterPassword);
339 cerr <<
"unable to create wallet" << endl << boost::diagnostic_information(_e);
343 case OperationMode::DecodeTx:
348 cout <<
"Transaction " << t.
sha3().
hex() << endl;
351 cout <<
" type: creation" << endl;
352 cout <<
" code: " <<
toHex(t.
data()) << endl;
356 cout <<
" type: message" << endl;
357 cout <<
" to: " << userVisible(t.
to()) << endl;
358 cout <<
" data: " << (t.
data().empty() ?
"none" :
toHex(t.
data())) << endl;
364 cout <<
" creates: " << userVisible(
toAddress(s, t.
nonce())) << endl;
365 cout <<
" from: " << userVisible(s) << endl;
369 cout <<
" from: <unsigned>" << endl;
372 cout <<
" nonce: " << t.
nonce() << endl;
373 cout <<
" gas: " << t.
gas() << endl;
378 cout <<
" v: " << (int)t.
signature().
v << endl;
385 cerr <<
"Invalid transaction: " << ex.
what() << endl;
389 case OperationMode::SignTx:
391 Secret s = getSecret(m_signKey);
392 if (m_inputs.empty())
393 m_inputs.push_back(
string());
394 for (
string const& i: m_inputs)
403 cout << t.
sha3() <<
": ";
407 cout << i +
".signed" << endl;
414 cerr <<
"Invalid transaction: " << ex.
what() << endl;
419 case OperationMode::Inspect:
422 if (m_inputs.empty())
423 m_inputs.push_back(
toAddress(KeyManager::brain(
getPassword(
"Enter brain wallet key phrase: "))).hex());
424 for (
auto i: m_inputs)
427 if (!keyManager().accountName(a).empty())
428 cout << keyManager().accountName(a) <<
" (" << a.
abridged() <<
")" << endl;
432 cout <<
" Raw hex: " << a.
hex() << endl;
435 Secret s = keyManager(
true).secret(a);
441 case OperationMode::ListBare:
442 if (secretStore().keys().empty())
443 cout <<
"No keys found." << endl;
445 for (
h128 const& u: std::set<h128>() + secretStore().keys())
446 cout <<
toUUID(u) << endl;
448 case OperationMode::NewBare:
451 m_lock =
createPassword(
"Enter a passphrase with which to secure this account: ");
453 h128 u = secretStore().importSecret(k.secret().ref(), m_lock);
454 cout <<
"Created key " <<
toUUID(u) << endl;
455 cout <<
" ICAP: " <<
ICAP(k.address()).encoded() << endl;
456 cout <<
" Raw hex: " << k.
address().hex() << endl;
459 case OperationMode::ImportBare:
460 for (
string const& input: m_inputs)
470 u = secretStore().importKey(input);
472 if (!u && b.
size() == 32)
473 u = secretStore().importSecret(b, lockPassword(
toAddress(
Secret(b)).abridged()));
476 cerr <<
"Cannot import " << input <<
" not a file or secret." << endl;
479 cout <<
"Successfully imported " << input <<
" as " <<
toUUID(u);
482 case OperationMode::InspectBare:
483 for (
auto const& i: m_inputs)
486 h128 u = secretStore().readKey(i,
false);
487 bytesSec s = secretStore().secret(u, [&](){
return getPassword(
"Enter passphrase for key " + i +
": "); });
488 cout <<
"Key " << i <<
":" << endl;
489 cout <<
" UUID: " <<
toUUID(u) <<
":" << endl;
492 cout <<
" Secret: " << (m_showSecret ?
toHex(s.
ref()) : (
toHex(s.
ref().cropped(0, 8)) +
"...")) << endl;
497 cout <<
"Key " << i <<
":" << endl;
500 cout <<
" Secret: " << (m_showSecret ?
toHex(s.
ref()) : (
toHex(s.
ref().cropped(0, 8)) +
"...")) << endl;
504 cout <<
"Key " <<
a.abridged() <<
":" << endl;
506 cout <<
" Raw hex: " <<
a.hex() << endl;
509 cerr <<
"Couldn't inspect " << i <<
"; not found." << endl;
511 case OperationMode::ExportBare:
break;
512 case OperationMode::RecodeBare:
513 for (
auto const& i: m_inputs)
515 if (secretStore().recode(u, lockPassword(
toUUID(u)), [&](){
return getPassword(
"Enter passphrase for key " +
toUUID(u) +
": "); },
kdf()))
516 cerr <<
"Re-encoded " <<
toUUID(u) << endl;
518 cerr <<
"Couldn't re-encode " <<
toUUID(u) <<
"; key corrupt or incorrect passphrase supplied." << endl;
520 cerr <<
"Couldn't re-encode " << i <<
"; not found." << endl;
522 case OperationMode::KillBare:
523 for (
auto const& i: m_inputs)
525 secretStore().kill(u);
527 cerr <<
"Couldn't kill " << i <<
"; not found." << endl;
529 case OperationMode::New:
532 tie(m_lock, m_lockHint) =
createPassword(keyManager(),
"Enter a passphrase with which to secure this account (or nothing to use the master passphrase): ", m_lock, m_lockHint);
534 bool usesMaster = m_lock.empty();
535 h128 u = usesMaster ? keyManager().import(k.secret(), m_name) : keyManager().import(k.secret(), m_name, m_lock, m_lockHint);
536 cout <<
"Created key " <<
toUUID(u) << endl;
537 cout <<
" Name: " << m_name << endl;
539 cout <<
" Uses master passphrase." << endl;
541 cout <<
" Password hint: " << m_lockHint << endl;
542 cout <<
" ICAP: " <<
ICAP(k.address()).encoded() << endl;
543 cout <<
" Raw hex: " << k.
address().hex() << endl;
548 if (m_inputs.size() != 1)
550 cerr <<
"Error: exactly one key must be given to import." << endl;
554 h128 u = keyManager().store().importKey(m_inputs[0]);
556 bytesSec s = keyManager().store().secret(u, [&](){
return (pw =
getPassword(
"Enter the passphrase for the key: ")); });
559 cerr <<
"Error: couldn't decode key or invalid secret size." << endl;
563 bool usesMaster =
true;
564 if (pw != m_masterPassword && m_lockHint.empty())
566 cout <<
"Enter a hint to help you remember the key's passphrase: " << flush;
567 getline(cin, m_lockHint);
570 keyManager().importExisting(u, m_name, pw, m_lockHint);
571 auto a = keyManager().address(u);
573 cout <<
"Imported key " <<
toUUID(u) << endl;
574 cout <<
" Name: " << m_name << endl;
576 cout <<
" Uses master passphrase." << endl;
578 cout <<
" Password hint: " << m_lockHint << endl;
580 cout <<
" Raw hex: " <<
a.hex() << endl;
583 case OperationMode::ImportWithAddress:
585 if (m_inputs.size() != 1)
587 cerr <<
"Error: exactly one key must be given to import." << endl;
591 string const& i = m_inputs[0];
600 u = keyManager().store().importKey(i);
602 if (!u && b.
size() == 32)
603 u = keyManager().store().importSecret(b, lockPassword(
toAddress(
Secret(b)).abridged()));
606 cerr <<
"Cannot import " << i <<
" not a file or secret." << endl;
609 keyManager().importExisting(u, m_name, m_address);
610 cout <<
"Successfully imported " << i <<
":" << endl;
611 cout <<
" Name: " << m_name << endl;
612 cout <<
" UUID: " <<
toUUID(u) << endl;
613 cout <<
" Raw hex: " << m_address << endl;
616 case OperationMode::ImportPresale:
621 keyManager().import(k.
secret(), m_name, pw,
"Same passphrase as used for presale key");
624 case OperationMode::Recode:
625 for (
auto const& i: m_inputs)
629 Secret s = keyManager().secret(
a, [&](){
return pw =
getPassword(
"Enter old passphrase for key '" + i +
"' (hint: " + keyManager().passwordHint(
a) +
"): "); });
632 cerr <<
"Invalid password for key " << userVisible(
a) << endl;
635 pair<string, string> np =
createPassword(keyManager(),
"Enter new passphrase for key '" + i +
"': ");
636 if (keyManager().recode(
a, np.first, np.second, [&](){ return pw; },
kdf()))
637 cout <<
"Re-encoded key '" << i <<
"' successfully." << endl;
639 cerr <<
"Couldn't re-encode '" << i <<
"''; key corrupt or incorrect passphrase supplied." << endl;
642 cerr <<
"Couldn't re-encode " << i <<
"; not found." << endl;
644 case OperationMode::Kill:
647 for (
auto const& i: m_inputs)
650 keyManager().kill(
a);
652 cerr <<
"Couldn't kill " << i <<
"; not found." << endl;
655 cout << count <<
" key(s) deleted." << endl;
658 case OperationMode::List:
660 if (keyManager().store().keys().empty())
662 cout <<
"No keys found." << endl;
668 for (
auto const& u: keyManager().store().keys())
672 cout <<
toUUID(u) <<
" " <<
a.abridged();
674 cout <<
" " << s << string(35 - s.size(),
' ');
675 cout <<
" " << keyManager().accountName(
a) << endl;
679 for (
auto const&
a: keyManager().accounts())
682 cout <<
" (Brain) " <<
a.abridged();
684 cout <<
" " << keyManager().accountName(
a) << endl;
686 for (
auto const& u: bare)
687 cout <<
toUUID(u) <<
" (Bare)" << endl;
695 return m_lock.empty() ?
createPassword(
"Enter a passphrase with which to secure account " + _accountName +
": ") : m_lock;
701 <<
"Secret-store (\"bare\") operation modes:" << endl
702 <<
" listbare List all secret available in secret-store." << endl
703 <<
" newbare Generate and output a key without interacting with wallet and dump the JSON." << endl
704 <<
" importbare [ <file>|<secret-hex> , ... ] Import keys from given sources." << endl
705 <<
" recodebare [ <uuid>|<file> , ... ] Decrypt and re-encrypt given keys." << endl
706 <<
" inspectbare [ <uuid>|<file> , ... ] Output information on given keys." << endl
708 <<
" killbare [ <uuid> , ... ] Delete given keys." << endl
709 <<
"Secret-store configuration:" << endl
710 <<
" --secrets-path <path> Specify Web3 secret-store path (default: " << SecretStore::defaultPath() <<
")" << endl
712 <<
"Wallet operating modes:" << endl
713 <<
" createwallet Create an Ethereum master wallet." << endl
714 <<
" list List all keys available in wallet." << endl
715 <<
" new <name> Create a new key with given name and add it in the wallet." << endl
716 <<
" import [<uuid>|<file>|<secret-hex>] <name> Import keys from given source and place in wallet." << endl
717 <<
" importpresale <file> <name> Import a presale wallet into a key with the given name." << endl
718 <<
" importwithaddress [<uuid>|<file>|<secret-hex>] <address> <name> Import keys from given source with given address and place in wallet." << endl
719 <<
" export [ <address>|<uuid> , ... ] Export given keys." << endl
720 <<
" inspect [ <address>|<name>|<uuid>|<brainwallet> ] ... Print information on the given keys." << endl
722 <<
" kill [ <address>|<uuid>, ... ] Delete given keys." << endl
723 <<
"Brain wallet operating modes:" << endl
724 <<
"WARNING: Brain wallets with human-generated passphrasses are highly susceptible to attack. Don't use such a thing for" << endl
725 <<
"anything important." << endl
726 <<
" newbrain [ <name>|-- ] Create a new 13-word brain wallet; argument is the name or if --, do not add to wallet." << endl
727 <<
" importbrain <name> Import your own brain wallet." << endl
728 <<
"Brainwallets are specified as: brain((#<HD-index>):<brain-phrase>), e.g. brain:PASSWORD." << endl
729 <<
"Wallet configuration:" << endl
730 <<
" --wallet-path <path> Specify Ethereum wallet path (default: " << KeyManager::defaultPath() <<
")" << endl
731 <<
" -m, --master <passphrase> Specify wallet (master) passphrase." << endl
733 <<
"Transaction operating modes:" << endl
734 <<
" decode ( [ <hex>|<file> ] ) Decode given transaction." << endl
735 <<
" sign [ <address>|<uuid>|<file>|<brainwallet> ] ( [ <hex>|<file> , ... ] ) (Re-)Sign given transaction." << endl
736 <<
"Transaction specification options (to be used when no transaction hex or file is given):" << endl
737 <<
" --tx-dest <address> Specify the destination address for the transaction to be signed." << endl
738 <<
" --tx-data <hex> Specify the hex data for the transaction to be signed." << endl
739 <<
" --tx-nonce <n> Specify the nonce for the transaction to be signed." << endl
740 <<
" --tx-gas <n> Specify the gas for the transaction to be signed." << endl
741 <<
" --tx-gasprice <wei> Specify the gas price for the transaction to be signed." << endl
742 <<
" --tx-value <wei> Specify the value for the transaction to be signed." << endl
743 <<
"Transaction signing options:" << endl
744 <<
" --force-nonce <n> Override the nonce for any transactions to be signed." << endl
746 <<
"Encryption configuration:" << endl
747 <<
" --kdf <kdfname> Specify KDF to use when encrypting (default: sc rypt)" << endl
748 <<
" --kdf-param <name> <value> Specify a parameter for the KDF." << endl
751 <<
" --lock <passphrase> Specify passphrase for when encrypting a (the) key." << endl
752 <<
" --hint <hint> Specify hint for the --lock passphrase." << endl
754 <<
"Decryption configuration:" << endl
755 <<
" --unlock <passphrase> Specify passphrase for a (the) key." << endl
756 <<
"Key generation configuration:" << endl
757 <<
" --no-icap Don't bother to make a direct-ICAP capable key." << endl
770 std::string s = boost::trim_copy_if(
contentsString(_input), is_any_of(
" \t\n"));
778 static bool isTrue(std::string
const& _m)
780 return _m ==
"on" || _m ==
"yes" || _m ==
"true" || _m ==
"1";
785 return _m ==
"off" || _m ==
"no" || _m ==
"false" || _m ==
"0";
793 if (_w.
load(m_masterPassword))
795 if (!m_masterPassword.empty())
797 cout <<
"Password invalid. Try again." << endl;
798 m_masterPassword.clear();
800 m_masterPassword =
getPassword(
"Please enter your MASTER passphrase: ");
804 KDF kdf()
const {
return m_kdf ==
"pbkdf2" ? KDF::PBKDF2_SHA256 : KDF::Scrypt; }
809 return keyManager().address(u);
811 for (
Address const&
a: keyManager().accounts())
812 if (keyManager().accountName(
a) == _s)
821 m_keyManager.reset(
new KeyManager(m_walletPath, m_secretsPath));
822 if (m_keyManager->exists())
823 openWallet(*m_keyManager);
824 else if( !walletLess )
826 cerr <<
"Couldn't open wallet. Does it exist?" << endl;
830 return *m_keyManager;
836 return m_keyManager->store();
838 m_secretStore.reset(
new SecretStore(m_secretsPath));
839 return *m_secretStore;
850 string m_secretsPath = SecretStore::defaultPath();
851 string m_walletPath = KeyManager::defaultPath();
865 bool m_showSecret =
false;
875 string m_kdf =
"scrypt";
std::string encoded() const
h128 fromUUID(std::string const &_uuid)
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::string toHex(T const &_data, int _w=2, HexPrefix _prefix=HexPrefix::DontAdd)
KeyManager & keyManager(bool walletLess=false)
string getAccountPassword(KeyManager &keyManager, Address const &a)
std::pair< Address, bytes > address(std::function< bytes(Address, bytes)> const &_call, Address const &_reg) const
std::string const & accountName(Address const &_address) const
Secret getSecret(std::string const &_signKey)
void writeFile(std::string const &_file, bytesConstRef _data, bool _writeDeleteRename=false)
Write the given binary data into the given file, replacing the file if it pre-exists.
static bytes inputData(std::string const &_input, bool *_isFile=nullptr)
void setNonce(u256 const &_n)
Sets the nonce to the given value. Clears any signature.
Simple class that represents a "key pair".
const char * what() const noexceptoverride
h160 Address
An Ethereum address: 20 bytes.
Address const & sender() const
void openWallet(KeyManager &_w)
SecureFixedHash< 32 > Secret
std::vector< std::string > strings
std::hash for asio::adress
std::string contentsString(std::string const &_file)
Retrieve and returns the contents of the given file as a std::string.
Secret const & secret() const
vector_ref< _T > cropped(size_t _begin, size_t _count) const
unique_ptr< KeyManager > m_keyManager
unique_ptr< SecretStore > m_secretStore
Where the keys are.
std::string const & passwordHint(Address const &_address) const
OperationMode m_mode
Operating mode.
SignatureStruct const & signature() const
string m_name
Creating/importing.
bytes rlp(IncludeSignature _sig=WithSignature) const
string createPassword(std::string const &_prompt)
Do not include a signature.
bytesConstRef ref() const
bytes fromHex(std::string const &_s, WhenError _throw=WhenError::DontThrow)
Base class for all exceptions.
Address userToAddress(std::string const &_s)
High-level manager of password-encrypted keys for Ethereum.
string m_masterPassword
Wallet passphrase stuff.
void create(std::string const &_pass)
static bool isFalse(std::string const &_m)
Address to() const
Synonym for receiveAddress().
std::vector< byte > bytes
h256 kdf(Secret const &_priv, h256 const &_hash)
Key derivation.
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
map< string, string > m_kdfParams
bytes const & data() const
bytes asBytes(std::string const &_b)
Converts a string to a byte array containing the string's (byte) data.
h256 sha3(IncludeSignature _sig=WithSignature) const
static void streamHelp(ostream &_out)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
std::string formatBalance(bigint const &_b)
User-friendly string representation of the amount _b in wei.
Address toAddress(Public const &_public)
Convert a public key to address.
std::vector< T > & writable()
Address const & address() const
Retrieve the associated address of the public key.
std::string userVisible(Address const &_a) const
TransactionSkeleton m_toSign
Address const & safeSender() const noexcept
Like sender() but will never throw.
static bool isTrue(std::string const &_m)
Encapsulation of an ICAP address.
#define pass(a, b, c, mul, X)
bool load(std::string const &_pass)
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
Manages encrypted keys stored in a certain directory on disk.
SecretStore & secretStore()
std::string abridged() const
bool haveHint(std::string const &_pass) const
strings m_inputs
Importing.
std::string getPassword(std::string const &_prompt)
Requests the user to enter a password on the console.
struct evm_uint160be address(struct evm_env *env)
KeyCLI(OperationMode _mode=OperationMode::None)
std::string lockPassword(std::string const &_accountName)
bytes contents(std::string const &_file)
Retrieve and returns the contents of the given file.
#define DEV_IGNORE_EXCEPTIONS(X)
void sign(Secret const &_priv)
Sign the transaction.
Encodes a transaction, ready to be exported to or freshly imported from RLP.
std::string toUUID(h128 const &_uuid)
bool interpretOption(int &i, int argc, char **argv)
std::unordered_set< h160 > AddressHash
A hash set of Ethereum addresses.