38 #include <boost/program_options.hpp> 39 #include <boost/algorithm/string.hpp> 40 #include <boost/format.hpp> 53 using boost::lexical_cast;
54 namespace po = boost::program_options;
56 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 57 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "wallet.gen_multisig" 61 const char*
tr(
const char* str)
90 std::vector<boost::shared_ptr<tools::wallet2>> wallets(total);
91 for (
size_t n = 0; n < total; ++n)
96 wallets[n]->generate(
name, pwd_container->password(), rct::rct2sk(
rct::skGen()),
false,
false, create_address_file);
100 std::vector<crypto::secret_key> sk(total);
101 std::vector<crypto::public_key> pk(total);
102 for (
size_t n = 0; n < total; ++n)
104 wallets[n]->decrypt_keys(pwd_container->password());
110 wallets[n]->encrypt_keys(pwd_container->password());
114 std::vector<std::string> extra_info(total);
115 std::stringstream ss;
116 for (
size_t n = 0; n < total; ++n)
119 std::vector<crypto::secret_key> skn;
120 std::vector<crypto::public_key> pkn;
121 for (
size_t k = 0; k < total; ++k)
125 skn.push_back(sk[k]);
126 pkn.push_back(pk[k]);
129 extra_info[n] = wallets[n]->make_multisig(pwd_container->password(), skn, pkn,
threshold);
130 ss <<
" " <<
name << std::endl;
134 while (!extra_info[0].
empty())
136 std::unordered_set<crypto::public_key> pkeys;
137 std::vector<crypto::public_key> signers(total);
138 for (
size_t n = 0; n < total; ++n)
146 for (
size_t n = 0; n < total; ++n)
148 extra_info[n] = wallets[n]->exchange_multisig_keys(pwd_container->password(), pkeys, signers);
152 std::string address = wallets[0]->get_account().get_public_address_str(wallets[0]->nettype());
155 catch (
const std::exception &e)
164 int main(
int argc,
char* argv[])
168 po::options_description desc_params(
wallet_args::tr(
"Wallet options"));
177 boost::optional<po::variables_map> vm;
178 bool should_terminate =
false;
181 "electroneum-gen-multisig [(--testnet|--stagenet)] [--filename-base=<filename>] [--scheme=M/N] [--threshold=M] [--participants=N]",
182 genms::tr(
"This program generates a set of multisig wallets - use this simpler scheme only if all the participants trust each other"),
184 boost::program_options::positional_options_description(),
186 "electroneum-gen-multisig.log" 190 if (should_terminate)
193 bool testnet, stagenet;
199 if (testnet && stagenet)
212 if (!(*vm)[
"threshold"].defaulted())
221 if (!(*vm)[
"participants"].defaulted())
230 if (threshold <= 1 || threshold > total)
const char * tr(const char *str)
const command_line::arg_descriptor< std::vector< std::string > > arg_command
const char * tr(const char *str)
const char * i18n_translate(const char *s, const std::string &context)
Holds cryptonote related classes and helpers.
std::enable_if<!std::is_same< T, bool >::value, bool >::type has_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg)
void add_arg(boost::program_options::options_description &description, const arg_descriptor< T, required, dependent, NUM_DEPS > &arg, bool unique=true)
std::pair< boost::optional< boost::program_options::variables_map >, bool > main(int argc, char **argv, const char *const usage, const char *const notice, boost::program_options::options_description desc_params, const boost::program_options::positional_options_description &positional_options, const std::function< void(const std::string &, bool)> &print, const char *default_log_name, bool log_to_console)
T get_arg(const boost::program_options::variables_map &vm, const arg_descriptor< T, false, true > &arg)
std::string to_string(t_connection_type type)
int main(int argc, char *argv[])
#define CATCH_ENTRY_L0(lacation, return_val)