Add print-genesis-tx option.
This commit is contained in:
parent
f4769d87ad
commit
7f23949066
|
@ -1,9 +1,10 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -90,3 +90,5 @@
|
||||||
|
|
||||||
#define THREAD_STACK_SIZE 5 * 1024 * 1024
|
#define THREAD_STACK_SIZE 5 * 1024 * 1024
|
||||||
|
|
||||||
|
#define GENESIS_COINBASE_TX_HEX ""
|
||||||
|
|
||||||
|
|
|
@ -617,25 +617,30 @@ namespace cryptonote
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
void generate_genesis_tx(transaction& tx) {
|
||||||
|
account_public_address ac = boost::value_initialized<account_public_address>();
|
||||||
|
std::vector<size_t> sz;
|
||||||
|
construct_miner_tx(0, 0, 0, 0, 0, ac, tx); // zero fee in genesis
|
||||||
|
blobdata txb = tx_to_blob(tx);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_genesis_tx_hex() {
|
||||||
|
transaction tx;
|
||||||
|
|
||||||
|
generate_genesis_tx(tx);
|
||||||
|
blobdata txb = tx_to_blob(tx);
|
||||||
|
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);
|
||||||
|
|
||||||
|
return hex_tx_represent;
|
||||||
|
}
|
||||||
|
|
||||||
bool generateGenesisBlock(block& bl)
|
bool generateGenesisBlock(block& bl)
|
||||||
{
|
{
|
||||||
//genesis block
|
//genesis block
|
||||||
bl = boost::value_initialized<block>();
|
bl = boost::value_initialized<block>();
|
||||||
|
|
||||||
//TODO Uncomment this code block on the first network launch. It will generate and print you genesis block's hash.
|
//hard code coinbase tx in genesis block, because "tru" generating tx use random, but genesis should be always the same
|
||||||
//TODO Then you must copy it and put to genesis_coinbase_tx_hex variable
|
std::string genesis_coinbase_tx_hex = GENESIS_COINBASE_TX_HEX;
|
||||||
/*
|
|
||||||
account_public_address ac = boost::value_initialized<account_public_address>();
|
|
||||||
std::vector<size_t> sz;
|
|
||||||
construct_miner_tx(0, 0, 0, 0, 0, ac, bl.miner_tx); // zero fee in genesis
|
|
||||||
blobdata txb = tx_to_blob(bl.miner_tx);
|
|
||||||
std::string hex_tx_represent = string_tools::buff_to_hex_nodelimer(txb);
|
|
||||||
std::cout << "Genesis coinbase tx hex: " << hex_tx_represent << std::endl;
|
|
||||||
*/
|
|
||||||
|
|
||||||
//hard code coinbase tx in genesis block, because "true" generating tx use random, but genesis should be always the same
|
|
||||||
//TODO After you obtain hash of the genesis block put it here and recompile sources!
|
|
||||||
std::string genesis_coinbase_tx_hex = "";
|
|
||||||
|
|
||||||
blobdata tx_bl;
|
blobdata tx_bl;
|
||||||
string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
|
string_tools::parse_hexstr_to_binbuff(genesis_coinbase_tx_hex, tx_bl);
|
||||||
|
|
|
@ -81,6 +81,7 @@ namespace cryptonote
|
||||||
crypto::hash get_block_longhash(crypto::cn_context &context, const block& b, uint64_t height);
|
crypto::hash get_block_longhash(crypto::cn_context &context, const block& b, uint64_t height);
|
||||||
bool generateGenesisBlock(block& bl);
|
bool generateGenesisBlock(block& bl);
|
||||||
bool generateTestnetGenesisBlock(block& bl);
|
bool generateTestnetGenesisBlock(block& bl);
|
||||||
|
std::string get_genesis_tx_hex();
|
||||||
bool parse_and_validate_block_from_blob(const blobdata& b_blob, block& b);
|
bool parse_and_validate_block_from_blob(const blobdata& b_blob, block& b);
|
||||||
bool get_inputs_money_amount(const transaction& tx, uint64_t& money);
|
bool get_inputs_money_amount(const transaction& tx, uint64_t& money);
|
||||||
uint64_t get_outs_money_amount(const transaction& tx);
|
uint64_t get_outs_money_amount(const transaction& tx);
|
||||||
|
|
|
@ -38,10 +38,20 @@ namespace
|
||||||
const command_line::arg_descriptor<bool> arg_console = {"no-console", "Disable daemon console commands"};
|
const command_line::arg_descriptor<bool> arg_console = {"no-console", "Disable daemon console commands"};
|
||||||
const command_line::arg_descriptor<bool> arg_testnet_on = {"testnet", "Used to deploy test nets. Checkpoints and hardcoded seeds are ignored, "
|
const command_line::arg_descriptor<bool> arg_testnet_on = {"testnet", "Used to deploy test nets. Checkpoints and hardcoded seeds are ignored, "
|
||||||
"network id is changed. Use it with --data-dir flag. The wallet must be launched with --testnet flag.", false};
|
"network id is changed. Use it with --data-dir flag. The wallet must be launched with --testnet flag.", false};
|
||||||
|
const command_line::arg_descriptor<bool> arg_print_genesis_tx = {"print-genesis-tx", "Prints genesis' block tx hex to insert it to config and exits"};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool command_line_preprocessor(const boost::program_options::variables_map& vm);
|
bool command_line_preprocessor(const boost::program_options::variables_map& vm);
|
||||||
|
|
||||||
|
void print_genesis_tx_hex() {
|
||||||
|
std::string tx_hex = cryptonote::get_genesis_tx_hex();
|
||||||
|
|
||||||
|
std::cout << "Insert this line into your coin configuration file as is: " << std::endl;
|
||||||
|
std::cout << "#define GENESIS_COINBASE_TX_HEX \"" << tx_hex << "\"" << std::endl;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -69,6 +79,7 @@ int main(int argc, char* argv[])
|
||||||
command_line::add_arg(desc_cmd_sett, arg_log_level);
|
command_line::add_arg(desc_cmd_sett, arg_log_level);
|
||||||
command_line::add_arg(desc_cmd_sett, arg_console);
|
command_line::add_arg(desc_cmd_sett, arg_console);
|
||||||
command_line::add_arg(desc_cmd_sett, arg_testnet_on);
|
command_line::add_arg(desc_cmd_sett, arg_testnet_on);
|
||||||
|
command_line::add_arg(desc_cmd_sett, arg_print_genesis_tx);
|
||||||
|
|
||||||
cryptonote::core::init_options(desc_cmd_sett);
|
cryptonote::core::init_options(desc_cmd_sett);
|
||||||
cryptonote::core_rpc_server::init_options(desc_cmd_sett);
|
cryptonote::core_rpc_server::init_options(desc_cmd_sett);
|
||||||
|
@ -90,6 +101,11 @@ int main(int argc, char* argv[])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command_line::get_arg(vm, arg_print_genesis_tx)) {
|
||||||
|
print_genesis_tx_hex();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string data_dir = command_line::get_arg(vm, command_line::arg_data_dir);
|
std::string data_dir = command_line::get_arg(vm, command_line::arg_data_dir);
|
||||||
std::string config = command_line::get_arg(vm, arg_config_file);
|
std::string config = command_line::get_arg(vm, arg_config_file);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define BUILD_COMMIT_ID "@VERSION@"
|
#define BUILD_COMMIT_ID "@VERSION@"
|
||||||
#define PROJECT_VERSION "1.0.0"
|
#define PROJECT_VERSION "1.0.1"
|
||||||
#define PROJECT_VERSION_BUILD_NO "1"
|
#define PROJECT_VERSION_BUILD_NO "1"
|
||||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")"
|
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
/*
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
* WalletTransactionSender.cpp
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
*
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
* Created on: 18 июня 2014 г.
|
|
||||||
* Author: milo
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "WalletTransactionSender.h"
|
#include "WalletTransactionSender.h"
|
||||||
#include "WalletUtils.h"
|
#include "WalletUtils.h"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
// Copyright (c) 2011-2014 The Cryptonote developers
|
||||||
// Distributed under the MIT/X11 software license, see the accompanying
|
// Distributed under the MIT/X11 software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue