Compare commits

...

9 Commits

Author SHA1 Message Date
Some Random Crypto Guy 3e012bc1fb fixed segfault in clean wallet when calling yield_info 2024-06-22 20:34:40 +01:00
Some Random Crypto Guy f07d3942e1 fixed stake returned wallet balance; updated yield_info and supply_info commands 2024-06-22 19:40:19 +01:00
Neil Coggins b93cf3a2d0 bumped chain version; updated premine wallet for testnet 2024-06-21 14:16:20 +01:00
Some Random Crypto Guy 9ce266cea2 changes to some URLs to .io domain 2024-06-21 12:58:14 +01:00
Some Random Crypto Guy 193a22d55c fixed circulating supply calculation; more rebranding; bumped version number to v0.3.0 2024-06-20 12:02:43 +01:00
Some Random Crypto Guy 2f08b2fe2e Fixed bug in handling of yield payouts 2024-06-18 23:48:45 +01:00
Some Random Crypto Guy 6404d34e33 added K-anonymity helper functions 2024-06-18 23:47:00 +01:00
Some Random Crypto Guy f41c20ee7c updated ringct function libraries; fixed build issue with blockchain_utilities 2024-06-18 23:16:45 +01:00
Some Random Crypto Guy 7bb90f57d4 updated external modules 2024-06-18 21:31:00 +01:00
33 changed files with 453 additions and 266 deletions
+57 -15
View File
@@ -1179,21 +1179,38 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons
throw0(DB_ERROR(lmdb_error("Failed to add prunable tx prunable hash to db transaction: ", result).c_str()));
}
if (tx.type == cryptonote::transaction_type::MINER) {
// Update the circulating supply tally because of potentially burnt block_reward proportion
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type("SAL"));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
if (result && (m_height>0 || result != MDB_NOTFOUND))
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_source_tally = source_tally;
for (const auto& out: tx.vout) {
// Sanity check - prevent overflow
if (final_source_tally > final_source_tally + out.amount)
throw0(DB_ERROR("numeric overflow detected when adding miner_tx for db transaction"));
// Fetch the amount for this output
final_source_tally += out.amount;
}
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tx_id << "\n\tTally before burn = " << source_tally.str() << "\n\tTally after burn = " << final_source_tally.str());
}
if (tx.type == cryptonote::transaction_type::BURN || tx.type == cryptonote::transaction_type::CONVERT || tx.type == cryptonote::transaction_type::STAKE) {
// Get the current tally value for the source currency type
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type(tx.source_asset_type));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
boost::multiprecision::int128_t final_source_tally = source_tally - tx.amount_burnt;
boost::multiprecision::int128_t final_source_tally = source_tally - tx.amount_burnt - tx.rct_signatures.txnFee;
boost::multiprecision::int128_t coinbase = get_block_already_generated_coins(m_height-1);
if (source_tally == 0 && result == MDB_NOTFOUND) {
if (tx.source_asset_type == "SAL") {
final_source_tally += coinbase;
} else {
throw0(DB_ERROR("burn underflow - asset balance is zero for non-SAL asset"));
}
}
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tx_id << "\n\tTally before burn = " << source_tally.str() << "\n\tTally after burn = " << final_source_tally.str());
}
@@ -1219,6 +1236,8 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons
MDB_val_copy<uint64_t> source_idx(asset.first);
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
if (result)
throw0(DB_ERROR(lmdb_error("Failed to get circulating supply tally when adding db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_source_tally = source_tally + asset.second;
boost::multiprecision::int128_t coinbase = get_block_already_generated_coins(m_height-1);
if (source_tally == 0 && result == MDB_NOTFOUND) {
@@ -1340,7 +1359,29 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const
throw1(DB_ERROR(lmdb_error("Failed to add removal of prunable hash tx to db transaction: ", result).c_str()));
}
if (tx.type == cryptonote::transaction_type::CONVERT || tx.type == cryptonote::transaction_type::BURN) {
if (tx.type == cryptonote::transaction_type::MINER) {
// Update the circulating supply tally because of potentially burnt block_reward proportion
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type("SAL"));
boost::multiprecision::int128_t source_tally = 0;
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
if (result && (m_height>0 || result != MDB_NOTFOUND))
throw0(DB_ERROR(lmdb_error("remove_transaction_data() - Failed to get circulating supply tally when removing db transaction: ", result).c_str()));
boost::multiprecision::int128_t final_source_tally = source_tally;
for (const auto& out: tx.vout) {
// Sanity check - prevent underflow
if (final_source_tally < final_source_tally - out.amount)
throw0(DB_ERROR("remove_transaction_data() - numeric underflow detected when removing miner_tx for db transaction"));
// Fetch the amount for this output
final_source_tally -= out.amount;
}
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tip->data.tx_id << "\n\tTally before burn = " << source_tally.str() << "\n\tTally after burn = " << final_source_tally.str());
}
if (tx.type == cryptonote::transaction_type::BURN || tx.type == cryptonote::transaction_type::CONVERT || tx.type == cryptonote::transaction_type::STAKE) {
// Get the current tally value for the source currency type
MDB_val_copy<uint64_t> source_idx(cryptonote::asset_id_from_type(tx.source_asset_type));
@@ -1348,8 +1389,10 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const
result = read_circulating_supply_data(m_cur_circ_supply_tally, source_idx, source_tally);
if (result == MDB_NOTFOUND)
throw0(DB_ERROR("remove_transaction_data() - minted asset not found"));
boost::multiprecision::int128_t final_source_tally = source_tally + tx.amount_burnt;
boost::multiprecision::int128_t coinbase = get_block_already_generated_coins(m_height-1);
// Sanity check - prevent overflow
if (source_tally > source_tally + tx.amount_burnt + tx.rct_signatures.txnFee)
throw0(DB_ERROR("remove_transaction_data() - numeric overflow detected when processing C/B/S for db transaction"));
boost::multiprecision::int128_t final_source_tally = source_tally + tx.amount_burnt + tx.rct_signatures.txnFee;
write_circulating_supply_data(m_cur_circ_supply_tally, source_idx, final_source_tally);
LOG_PRINT_L1("tx ID " << tip->data.tx_id << "\n\tTally before remint =" << source_tally.str() << "\n\tTally after remint =" << final_source_tally.str());
}
@@ -3416,10 +3459,9 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
LOG_PRINT_L3("BlockchainLMDB::" << __func__ << " - mined supply for SAL = " << m_coinbase);
// SRCG: For V1, we can simply return this number, because there is no other source of coins
circulating_supply["SAL"] = m_coinbase;
return circulating_supply;
//circulating_supply["SAL"] = m_coinbase;
//return circulating_supply;
/*
check_open();
TXN_PREFIX_RDONLY();
@@ -3460,8 +3502,8 @@ std::map<std::string,uint64_t> BlockchainLMDB::get_circulating_supply() const
if (circulating_supply.empty()) {
circulating_supply["SAL"] = m_coinbase;
}
circulating_supply["BURN"] = m_coinbase - circulating_supply["SAL"];
return circulating_supply;
*/
}
uint64_t BlockchainLMDB::num_outputs() const
+125 -125
View File
@@ -133,59 +133,59 @@ monero_private_headers(blockchain_stats
${blockchain_stats_private_headers})
#monero_add_executable(blockchain_import
# ${blockchain_import_sources}
# ${blockchain_import_private_headers})
monero_add_executable(blockchain_import
${blockchain_import_sources}
${blockchain_import_private_headers})
#target_link_libraries(blockchain_import
# PRIVATE
# crypto
# cncrypto
# cryptonote_core
# blockchain_db
# oracle
# version
# epee
# ${Boost_FILESYSTEM_LIBRARY}
# ${Boost_SYSTEM_LIBRARY}
# ${Boost_THREAD_LIBRARY}
# ${CMAKE_THREAD_LIBS_INIT}
# ${EXTRA_LIBRARIES}
# ${Blocks})
target_link_libraries(blockchain_import
PRIVATE
crypto
cncrypto
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES}
${Blocks})
#if(ARCH_WIDTH)
# target_compile_definitions(blockchain_import
# PUBLIC -DARCH_WIDTH=${ARCH_WIDTH})
#endif()
if(ARCH_WIDTH)
target_compile_definitions(blockchain_import
PUBLIC -DARCH_WIDTH=${ARCH_WIDTH})
endif()
#set_property(TARGET blockchain_import
# PROPERTY
# OUTPUT_NAME "salvium-blockchain-import")
#install(TARGETS blockchain_import DESTINATION bin)
set_property(TARGET blockchain_import
PROPERTY
OUTPUT_NAME "salvium-blockchain-import")
install(TARGETS blockchain_import DESTINATION bin)
#monero_add_executable(blockchain_export
# ${blockchain_export_sources}
# ${blockchain_export_private_headers})
monero_add_executable(blockchain_export
${blockchain_export_sources}
${blockchain_export_private_headers})
#target_link_libraries(blockchain_export
# PRIVATE
# crypto
# cncrypto
# cryptonote_core
# blockchain_db
# oracle
# version
# epee
# ${Boost_FILESYSTEM_LIBRARY}
# ${Boost_SYSTEM_LIBRARY}
# ${Boost_THREAD_LIBRARY}
# ${CMAKE_THREAD_LIBS_INIT}
# ${EXTRA_LIBRARIES})
target_link_libraries(blockchain_export
PRIVATE
crypto
cncrypto
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
#set_property(TARGET blockchain_export
# PROPERTY
# OUTPUT_NAME "salvium-blockchain-export")
#install(TARGETS blockchain_export DESTINATION bin)
set_property(TARGET blockchain_export
PROPERTY
OUTPUT_NAME "salvium-blockchain-export")
install(TARGETS blockchain_export DESTINATION bin)
monero_add_executable(blockchain_blackball
${blockchain_blackball_sources}
@@ -213,95 +213,95 @@ set_property(TARGET blockchain_blackball
install(TARGETS blockchain_blackball DESTINATION bin)
#monero_add_executable(blockchain_usage
# ${blockchain_usage_sources}
# ${blockchain_usage_private_headers})
monero_add_executable(blockchain_usage
${blockchain_usage_sources}
${blockchain_usage_private_headers})
#target_link_libraries(blockchain_usage
# PRIVATE
# crypto
# cncrypto
# cryptonote_core
# blockchain_db
# oracle
# version
# epee
# ${Boost_FILESYSTEM_LIBRARY}
# ${Boost_SYSTEM_LIBRARY}
# ${Boost_THREAD_LIBRARY}
# ${CMAKE_THREAD_LIBS_INIT}
# ${EXTRA_LIBRARIES})
target_link_libraries(blockchain_usage
PRIVATE
crypto
cncrypto
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
#set_property(TARGET blockchain_usage
# PROPERTY
# OUTPUT_NAME "salvium-blockchain-usage")
#nstall(TARGETS blockchain_usage DESTINATION bin)
set_property(TARGET blockchain_usage
PROPERTY
OUTPUT_NAME "salvium-blockchain-usage")
install(TARGETS blockchain_usage DESTINATION bin)
#monero_add_executable(blockchain_ancestry
# ${blockchain_ancestry_sources}
# ${blockchain_ancestry_private_headers})
monero_add_executable(blockchain_ancestry
${blockchain_ancestry_sources}
${blockchain_ancestry_private_headers})
#target_link_libraries(blockchain_ancestry
# PRIVATE
# cryptonote_core
# blockchain_db
# oracle
# version
# epee
# ${Boost_FILESYSTEM_LIBRARY}
# ${Boost_SYSTEM_LIBRARY}
# ${Boost_THREAD_LIBRARY}
# ${CMAKE_THREAD_LIBS_INIT}
# ${EXTRA_LIBRARIES})
target_link_libraries(blockchain_ancestry
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
#set_property(TARGET blockchain_ancestry
# PROPERTY
# OUTPUT_NAME "salvium-blockchain-ancestry")
#install(TARGETS blockchain_ancestry DESTINATION bin)
set_property(TARGET blockchain_ancestry
PROPERTY
OUTPUT_NAME "salvium-blockchain-ancestry")
install(TARGETS blockchain_ancestry DESTINATION bin)
# monero_add_executable(blockchain_depth
# ${blockchain_depth_sources}
# ${blockchain_depth_private_headers})
monero_add_executable(blockchain_depth
${blockchain_depth_sources}
${blockchain_depth_private_headers})
#target_link_libraries(blockchain_depth
# PRIVATE
# cryptonote_core
# blockchain_db
# oracle
# version
# epee
# ${Boost_FILESYSTEM_LIBRARY}
# ${Boost_SYSTEM_LIBRARY}
# ${Boost_THREAD_LIBRARY}
# ${CMAKE_THREAD_LIBS_INIT}
# ${EXTRA_LIBRARIES})
target_link_libraries(blockchain_depth
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
#set_property(TARGET blockchain_depth
# PROPERTY
# OUTPUT_NAME "salvium-blockchain-depth")
#install(TARGETS blockchain_depth DESTINATION bin)
set_property(TARGET blockchain_depth
PROPERTY
OUTPUT_NAME "salvium-blockchain-depth")
install(TARGETS blockchain_depth DESTINATION bin)
#monero_add_executable(blockchain_stats
# ${blockchain_stats_sources}
# ${blockchain_stats_private_headers})
monero_add_executable(blockchain_stats
${blockchain_stats_sources}
${blockchain_stats_private_headers})
#target_link_libraries(blockchain_stats
# PRIVATE
# cryptonote_core
# blockchain_db
# oracle
# version
# epee
# ${Boost_FILESYSTEM_LIBRARY}
# ${Boost_SYSTEM_LIBRARY}
# ${Boost_THREAD_LIBRARY}
# ${CMAKE_THREAD_LIBS_INIT}
# ${EXTRA_LIBRARIES})
target_link_libraries(blockchain_stats
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${EXTRA_LIBRARIES})
#set_property(TARGET blockchain_stats
# PROPERTY
# OUTPUT_NAME "salvium-blockchain-stats")
#install(TARGETS blockchain_stats DESTINATION bin)
set_property(TARGET blockchain_stats
PROPERTY
OUTPUT_NAME "salvium-blockchain-stats")
install(TARGETS blockchain_stats DESTINATION bin)
monero_add_executable(blockchain_prune_known_spent_data
${blockchain_prune_known_spent_data_sources}
@@ -174,7 +174,7 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Salvium '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << desc_options << std::endl;
return 1;
}
@@ -240,7 +240,7 @@ int main(int argc, char* argv[])
/*
* The default output can be plotted with GnuPlot using these commands:
set key autotitle columnhead
set title "Monero Blockchain Growth"
set title "Salvium Blockchain Growth"
set timefmt "%Y-%m-%d"
set xdata time
set xrange ["2014-04-17":*]
+1 -1
View File
@@ -102,7 +102,7 @@ namespace tools
std::string get_update_url(const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user)
{
const char *base = user ? "https://downloads.salvium.network/" : "https://updates.salvium.network/";
const char *base = user ? "https://downloads.salvium.io/" : "https://updates.salvium.io/";
#ifdef _WIN32
static const char *extension = strncmp(buildtag.c_str(), "source", 6) ? (strncmp(buildtag.c_str(), "install-", 8) ? ".zip" : ".exe") : ".tar.bz2";
#elif defined(__APPLE__)
+1 -1
View File
@@ -71,7 +71,7 @@ target_link_libraries(cncrypto
epee
randomx
${Boost_SYSTEM_LIBRARY}
${SODIUM_LIBRARY}
${sodium_LIBRARIES}
PRIVATE
${EXTRA_LIBRARIES})
@@ -316,6 +316,53 @@ namespace cryptonote {
bool operator ==(const cryptonote::block& a, const cryptonote::block& b) {
return cryptonote::get_block_hash(a) == cryptonote::get_block_hash(b);
}
//--------------------------------------------------------------------------------
int compare_hash32_reversed_nbits(const crypto::hash& ha, const crypto::hash& hb, unsigned int nbits)
{
static_assert(sizeof(uint64_t) * 4 == sizeof(crypto::hash), "hash is wrong size");
// We have to copy these buffers b/c of the strict aliasing rule
uint64_t va[4];
memcpy(va, &ha, sizeof(crypto::hash));
uint64_t vb[4];
memcpy(vb, &hb, sizeof(crypto::hash));
for (int n = 3; n >= 0 && nbits; --n)
{
const unsigned int msb_nbits = std::min<unsigned int>(64, nbits);
const uint64_t lsb_nbits_dropped = static_cast<uint64_t>(64 - msb_nbits);
const uint64_t van = SWAP64LE(va[n]) >> lsb_nbits_dropped;
const uint64_t vbn = SWAP64LE(vb[n]) >> lsb_nbits_dropped;
nbits -= msb_nbits;
if (van < vbn) return -1; else if (van > vbn) return 1;
}
return 0;
}
crypto::hash make_hash32_loose_template(unsigned int nbits, const crypto::hash& h)
{
static_assert(sizeof(uint64_t) * 4 == sizeof(crypto::hash), "hash is wrong size");
// We have to copy this buffer b/c of the strict aliasing rule
uint64_t vh[4];
memcpy(vh, &h, sizeof(crypto::hash));
for (int n = 3; n >= 0; --n)
{
const unsigned int msb_nbits = std::min<unsigned int>(64, nbits);
const uint64_t mask = msb_nbits ? (~((std::uint64_t(1) << (64 - msb_nbits)) - 1)) : 0;
nbits -= msb_nbits;
vh[n] &= SWAP64LE(mask);
}
crypto::hash res;
memcpy(&res, vh, sizeof(crypto::hash));
return res;
}
//--------------------------------------------------------------------------------
}
//--------------------------------------------------------------------------------
+35 -9
View File
@@ -39,15 +39,6 @@ namespace cryptonote {
/************************************************************************/
/* */
/************************************************************************/
template<class t_array>
struct array_hasher: std::unary_function<t_array&, std::size_t>
{
std::size_t operator()(const t_array& val) const
{
return boost::hash_range(&val.data[0], &val.data[sizeof(val.data)]);
}
};
#pragma pack(push, 1)
struct public_address_outer_blob
@@ -121,6 +112,41 @@ namespace cryptonote {
bool operator ==(const cryptonote::transaction& a, const cryptonote::transaction& b);
bool operator ==(const cryptonote::block& a, const cryptonote::block& b);
/************************************************************************/
/* K-anonymity helper functions */
/************************************************************************/
/**
* @brief Compares two hashes up to `nbits` bits in reverse byte order ("LMDB key order")
*
* The comparison essentially goes from the 31th, 30th, 29th, ..., 0th byte and compares the MSBs
* to the LSBs in each byte, up to `nbits` bits. If we use up `nbits` bits before finding a
* difference in the bits between the two hashes, we return 0. If we encounter a zero bit in `ha`
* where `hb` has a one in that bit place, then we reutrn -1. If the converse scenario happens,
* we return a 1. When `nbits` == 256 (there are 256 bits in `crypto::hash`), calling this is
* functionally identical to `BlockchainLMDB::compare_hash32`.
*
* @param ha left hash
* @param hb right hash
* @param nbits the number of bits to consider, a higher value means a finer comparison
* @return int 0 if ha == hb, -1 if ha < hb, 1 if ha > hb
*/
int compare_hash32_reversed_nbits(const crypto::hash& ha, const crypto::hash& hb, unsigned int nbits);
/**
* @brief Make a template which matches `h` in LMDB order up to `nbits` bits, safe for k-anonymous fetching
*
* To be more technical, this function creates a hash which satifies the following property:
* For all `H_prime` s.t. `0 == compare_hash32_reversed_nbits(real_hash, H_prime, nbits)`,
* `1 > compare_hash32_reversed_nbits(real_hash, H_prime, 256)`.
* In other words, we return the "least" hash nbit-equal to `real_hash`.
*
* @param nbits The number of "MSB" bits to include in the template
* @param real_hash The original hash which contains more information than we want to disclose
* @return crypto::hash hash template that contains `nbits` bits matching real_hash and no more
*/
crypto::hash make_hash32_loose_template(unsigned int nbits, const crypto::hash& real_hash);
}
bool parse_hash256(const std::string &str_hash, crypto::hash& hash);
+5 -5
View File
@@ -216,7 +216,7 @@
#define HF_VERSION_ENABLE_ORACLE 2
#define HF_VERSION_SLIPPAGE_YIELD 2
#define TESTNET_VERSION 7
#define TESTNET_VERSION 8
#define STAGENET_VERSION 1
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8
@@ -298,7 +298,7 @@ namespace config
// Multisig
const uint32_t MULTISIG_MAX_SIGNERS{16};
std::array<std::string, 3> const ORACLE_URLS = {{"oracle.salvium.network:8443", "oracle.salvium.network:8443", "oracle.salvium.network:8443"}};
std::array<std::string, 3> const ORACLE_URLS = {{"oracle.salvium.io:8443", "oracle.salvium.io:8443", "oracle.salvium.io:8443"}};
std::string const ORACLE_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\n"
"MIIDRDCCAjYGByqGSM44BAEwggIpAoIBAQCZP7IJ5PcNvGbWiEqAioKF9wViVxEN\n"
@@ -337,12 +337,12 @@ namespace config
boost::uuids::uuid const NETWORK_ID = { {
0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x82, 0x53, 0x41, 0x4C, 0x00, TESTNET_VERSION
} };
std::string const GENESIS_TX = "020001ff000180c0d0c7bbbff6030279e90d3da9f9568396c5795833e6aed334d10b6bc08219de189e3ac6fade73c50353414c3c00000000000000210118c0fd33040975cb28c52cca0005a909661afeec61944e42b8646e069fd04209010000";
std::string const GENESIS_TX = "020001ff000180c0d0c7bbbff60302800b6eb882218e901c1c36bce474224456d82226260226d252459dfbadf186f70353414c3c00000000000000210171af115cca70fdcfdac362854ed9de472e242c8be5a3684e8a809d54f5dbdb18010000";
uint32_t const GENESIS_NONCE = 10001;
const uint64_t STAKE_LOCK_PERIOD = 20;
std::array<std::string, 3> const ORACLE_URLS = {{"oracle.salvium.network:8443", "oracle.salvium.network:8443", "oracle.salvium.network:8443"}};
std::array<std::string, 3> const ORACLE_URLS = {{"oracle.salvium.io:8443", "oracle.salvium.io:8443", "oracle.salvium.io:8443"}};
std::string const ORACLE_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\n"
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5YBxWx1AZCA9jTUk8Pr2uZ9jpfRt\n"
@@ -368,7 +368,7 @@ namespace config
const uint64_t STAKE_LOCK_PERIOD = 20;
std::array<std::string, 3> const ORACLE_URLS = {{"oracle.salvium.network:8443", "oracle.salvium.network:8443", "oracle.salvium.network:8443"}};
std::array<std::string, 3> const ORACLE_URLS = {{"oracle.salvium.io:8443", "oracle.salvium.io:8443", "oracle.salvium.io:8443"}};
std::string const ORACLE_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\n"
"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5YBxWx1AZCA9jTUk8Pr2uZ9jpfRt\n"
+1 -1
View File
@@ -4336,7 +4336,7 @@ bool Blockchain::calculate_yield_payouts(const uint64_t start_height, std::vecto
LOG_PRINT_L3("Blockchain::" << __func__);
// Clear the yield payout amounts
yield_container.empty();
yield_container.clear();
// Get the YIELD TX information for matured staked coins
std::vector<cryptonote::yield_tx_info> yield_entries;
+4 -3
View File
@@ -209,7 +209,7 @@ namespace cryptonote
static const command_line::arg_descriptor<std::string> arg_block_rate_notify = {
"block-rate-notify"
, "Run a program when the block rate undergoes large fluctuations. This might "
"be a sign of large amounts of hash rate going on and off the Monero network, "
"be a sign of large amounts of hash rate going on and off the Salvium network, "
"and thus be of potential interest in predicting attacks. %t will be replaced "
"by the number of minutes for the observation window, %b by the number of "
"blocks observed within that window, and %e by the number of blocks that was "
@@ -1294,6 +1294,7 @@ namespace cryptonote
std::vector<transaction> txs;
std::vector<crypto::hash> missed_txs;
uint64_t coinbase_amount = get_outs_money_amount(b.miner_tx);
coinbase_amount += b.miner_tx.amount_burnt;
this->get_transactions(b.tx_hashes, txs, missed_txs, true);
uint64_t tx_fee_amount = 0;
for(const auto& tx: txs)
@@ -1829,7 +1830,7 @@ namespace cryptonote
{
std::string main_message;
if (m_offline)
main_message = "The daemon is running offline and will not attempt to sync to the Monero network.";
main_message = "The daemon is running offline and will not attempt to sync to the Salvium network.";
else
main_message = "The daemon will start synchronizing with the network. This may take a long time to complete.";
MGINFO_YELLOW(ENDL << "**********************************************************************" << ENDL
@@ -2072,7 +2073,7 @@ namespace cryptonote
MDEBUG("blocks in the last " << seconds[n] / 60 << " minutes: " << b << " (probability " << p << ")");
if (p < threshold)
{
MWARNING("There were " << b << (b == max_blocks_checked ? " or more" : "") << " blocks in the last " << seconds[n] / 60 << " minutes, there might be large hash rate changes, or we might be partitioned, cut off from the Monero network or under attack, or your computer's time is off. Or it could be just sheer bad luck.");
MWARNING("There were " << b << (b == max_blocks_checked ? " or more" : "") << " blocks in the last " << seconds[n] / 60 << " minutes, there might be large hash rate changes, or we might be partitioned, cut off from the Salvium network or under attack, or your computer's time is off. Or it could be just sheer bad luck.");
std::shared_ptr<tools::Notify> block_rate_notify = m_block_rate_notify;
if (block_rate_notify)
+1 -1
View File
@@ -35,7 +35,7 @@
namespace daemon_args
{
std::string const WINDOWS_SERVICE_NAME = "Monero Daemon";
std::string const WINDOWS_SERVICE_NAME = "Salvium Daemon";
const command_line::arg_descriptor<std::string, false, true, 2> arg_config_file = {
"config-file"
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022, The Monero Project
# Copyright (c) 2016-2023, The Monero Project
#
# All rights reserved.
#
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022, The Monero Project
// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022, The Monero Project
// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022, The Monero Project
// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022, The Monero Project
// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
//
+44 -42
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022, The Monero Project
// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
@@ -57,28 +57,28 @@ extern "C"
// 1 1 52.8 70.4 70.2
// Pippenger:
// 1 2 3 4 5 6 7 8 9 bestN
// 2 555 598 621 804 1038 1733 2486 5020 8304 1
// 4 783 747 800 1006 1428 2132 3285 5185 9806 2
// 8 1174 1071 1095 1286 1640 2398 3869 6378 12080 2
// 16 2279 1874 1745 1739 2144 2831 4209 6964 12007 4
// 32 3910 3706 2588 2477 2782 3467 4856 7489 12618 4
// 64 7184 5429 4710 4368 4010 4672 6027 8559 13684 5
// 128 14097 10574 8452 7297 6841 6718 8615 10580 15641 6
// 256 27715 20800 16000 13550 11875 11400 11505 14090 18460 6
// 512 55100 41250 31740 26570 22030 19830 20760 21380 25215 6
// 1024 111520 79000 61080 49720 43080 38320 37600 35040 36750 8
// 2048 219480 162680 122120 102080 83760 70360 66600 63920 66160 8
// 4096 453320 323080 247240 210200 180040 150240 132440 114920 110560 9
// 1 2 3 4 5 6 7 8 9 bestN
// 2 555 598 621 804 1038 1733 2486 5020 8304 1
// 4 783 747 800 1006 1428 2132 3285 5185 9806 2
// 8 1174 1071 1095 1286 1640 2398 3869 6378 12080 2
// 16 2279 1874 1745 1739 2144 2831 4209 6964 12007 4
// 32 3910 3706 2588 2477 2782 3467 4856 7489 12618 4
// 64 7184 5429 4710 4368 4010 4672 6027 8559 13684 5
// 128 14097 10574 8452 7297 6841 6718 8615 10580 15641 6
// 256 27715 20800 16000 13550 11875 11400 11505 14090 18460 6
// 512 55100 41250 31740 26570 22030 19830 20760 21380 25215 6
// 1024 111520 79000 61080 49720 43080 38320 37600 35040 36750 8
// 2048 219480 162680 122120 102080 83760 70360 66600 63920 66160 8
// 4096 453320 323080 247240 210200 180040 150240 132440 114920 110560 9
// 2 4 8 16 32 64 128 256 512 1024 2048 4096
// Bos Coster 858 994 1316 1949 3183 5512 9865 17830 33485 63160 124280 246320
// Straus 226 341 548 980 1870 3538 7039 14490 29020 57200 118640 233640
// Straus/cached 226 315 485 785 1514 2858 5753 11065 22970 45120 98880 194840
// Pippenger 555 747 1071 1739 2477 4010 6718 11400 19830 35040 63920 110560
// 2 4 8 16 32 64 128 256 512 1024 2048 4096
// Bos Coster 858 994 1316 1949 3183 5512 9865 17830 33485 63160 124280 246320
// Straus 226 341 548 980 1870 3538 7039 14490 29020 57200 118640 233640
// Straus/cached 226 315 485 785 1514 2858 5753 11065 22970 45120 98880 194840
// Pippenger 555 747 1071 1739 2477 4010 6718 11400 19830 35040 63920 110560
// Best/cached Straus Straus Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip
// Best/uncached Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip Pip Pip
// Best/cached Straus Straus Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip
// Best/uncached Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip Pip Pip
// New timings:
// Pippenger:
@@ -443,7 +443,7 @@ size_t straus_get_cache_size(const std::shared_ptr<straus_cached_data> &cache)
return sz;
}
rct::key straus(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache, size_t STEP)
ge_p3 straus_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache, size_t STEP)
{
CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache->size >= data.size(), "Cache is too small");
MULTIEXP_PERF(PERF_TIMER_UNIT(straus, 1000000));
@@ -554,7 +554,13 @@ skipfirst:
ge_p1p1_to_p3(&res_p3, &p1);
}
return res_p3;
}
rct::key straus(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache, size_t STEP)
{
rct::key res;
const ge_p3 res_p3 = straus_p3(data, cache, STEP);
ge_p3_tobytes(res.bytes, &res_p3);
return res;
}
@@ -571,14 +577,6 @@ size_t get_pippenger_c(size_t N)
return 9;
}
struct pippenger_cached_data
{
size_t size;
ge_cached *cached;
pippenger_cached_data(): size(0), cached(NULL) {}
~pippenger_cached_data() { aligned_free(cached); }
};
std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<MultiexpData> &data, size_t start_offset, size_t N)
{
MULTIEXP_PERF(PERF_TIMER_START_UNIT(pippenger_init_cache, 1000000));
@@ -586,13 +584,11 @@ std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<Mu
if (N == 0)
N = data.size() - start_offset;
CHECK_AND_ASSERT_THROW_MES(N <= data.size() - start_offset, "Bad cache base data");
std::shared_ptr<pippenger_cached_data> cache(new pippenger_cached_data());
std::shared_ptr<pippenger_cached_data> cache = std::make_shared<pippenger_cached_data>();
cache->size = N;
cache->cached = (ge_cached*)aligned_realloc(cache->cached, N * sizeof(ge_cached), 4096);
CHECK_AND_ASSERT_THROW_MES(cache->cached, "Out of memory");
cache->resize(N);
for (size_t i = 0; i < N; ++i)
ge_p3_to_cached(&cache->cached[i], &data[i+start_offset].point);
ge_p3_to_cached(&(*cache)[i], &data[i+start_offset].point);
MULTIEXP_PERF(PERF_TIMER_STOP(pippenger_init_cache));
return cache;
@@ -600,14 +596,14 @@ std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<Mu
size_t pippenger_get_cache_size(const std::shared_ptr<pippenger_cached_data> &cache)
{
return cache->size * sizeof(*cache->cached);
return cache->size() * sizeof(ge_cached);
}
rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache, size_t cache_size, size_t c)
ge_p3 pippenger_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache, size_t cache_size, size_t c)
{
if (cache != NULL && cache_size == 0)
cache_size = cache->size;
CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache_size <= cache->size, "Cache is too small");
cache_size = cache->size();
CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache_size <= cache->size(), "Cache is too small");
if (c == 0)
c = get_pippenger_c(data.size());
CHECK_AND_ASSERT_THROW_MES(c <= 9, "c is too large");
@@ -661,9 +657,9 @@ rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<
if (buckets_init[bucket])
{
if (i < cache_size)
add(buckets[bucket], local_cache->cached[i]);
add(buckets[bucket], (*local_cache)[i]);
else
add(buckets[bucket], local_cache_2->cached[i - cache_size]);
add(buckets[bucket], (*local_cache_2)[i - cache_size]);
}
else
{
@@ -700,8 +696,14 @@ rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<
}
}
return result;
}
rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache, const size_t cache_size, const size_t c)
{
rct::key res;
ge_p3_tobytes(res.bytes, &result);
const ge_p3 result_p3 = pippenger_p3(data, cache, cache_size, c);
ge_p3_tobytes(res.bytes, &result_p3);
return res;
}
+11 -3
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022, The Monero Project
// Copyright (c) 2017-2023, The Monero Project
//
// All rights reserved.
@@ -35,10 +35,16 @@
#define MULTIEXP_H
#include <vector>
extern "C"
{
#include "crypto/crypto-ops.h"
}
#include "crypto/crypto.h"
#include "rctTypes.h"
#include "misc_log_ex.h"
#include <boost/align/aligned_allocator.hpp>
namespace rct
{
@@ -55,17 +61,19 @@ struct MultiexpData {
};
struct straus_cached_data;
struct pippenger_cached_data;
using pippenger_cached_data = std::vector<ge_cached, boost::alignment::aligned_allocator<ge_cached, 4096>>;
rct::key bos_coster_heap_conv(std::vector<MultiexpData> data);
rct::key bos_coster_heap_conv_robust(std::vector<MultiexpData> data);
std::shared_ptr<straus_cached_data> straus_init_cache(const std::vector<MultiexpData> &data, size_t N =0);
size_t straus_get_cache_size(const std::shared_ptr<straus_cached_data> &cache);
ge_p3 straus_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache = NULL, size_t STEP = 0);
rct::key straus(const std::vector<MultiexpData> &data, const std::shared_ptr<straus_cached_data> &cache = NULL, size_t STEP = 0);
std::shared_ptr<pippenger_cached_data> pippenger_init_cache(const std::vector<MultiexpData> &data, size_t start_offset = 0, size_t N =0);
size_t pippenger_get_cache_size(const std::shared_ptr<pippenger_cached_data> &cache);
size_t get_pippenger_c(size_t N);
rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache = NULL, size_t cache_size = 0, size_t c = 0);
ge_p3 pippenger_p3(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache = NULL, size_t cache_size = 0, size_t c = 0);
rct::key pippenger(const std::vector<MultiexpData> &data, const std::shared_ptr<pippenger_cached_data> &cache = NULL, const size_t cache_size = 0, const size_t c = 0);
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2022, The Monero Project
// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2022, The Monero Project
// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
+4 -4
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2016, Monero Research Labs
// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
@@ -671,7 +671,7 @@ namespace rct {
//Elliptic Curve Diffie Helman: encodes and decodes the amount b and mask a
// where C= aG + bH
static key ecdhHash(const key &k)
key genAmountEncodingFactor(const key &k)
{
char data[38];
rct::key hash;
@@ -700,7 +700,7 @@ namespace rct {
if (v2)
{
unmasked.mask = zero();
xor8(unmasked.amount, ecdhHash(sharedSec));
xor8(unmasked.amount, genAmountEncodingFactor(sharedSec));
}
else
{
@@ -715,7 +715,7 @@ namespace rct {
if (v2)
{
masked.mask = genCommitmentMask(sharedSec);
xor8(masked.amount, ecdhHash(sharedSec));
xor8(masked.amount, genAmountEncodingFactor(sharedSec));
}
else
{
+2 -1
View File
@@ -1,5 +1,5 @@
//#define DBG
// Copyright (c) 2016, Monero Research Labs
// Copyright (c) 2016-2023, Monero Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
@@ -184,6 +184,7 @@ namespace rct {
//Elliptic Curve Diffie Helman: encodes and decodes the amount b and mask a
// where C= aG + bH
key genAmountEncodingFactor(const key &k);
key genCommitmentMask(const key &sk);
void ecdhEncode(ecdhTuple & unmasked, const key & sharedSec, bool v2);
void ecdhDecode(ecdhTuple & masked, const key & sharedSec, bool v2);
+36 -12
View File
@@ -2982,13 +2982,13 @@ namespace cryptonote
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_get_circulating_supply(const COMMAND_RPC_GET_CIRCULATING_SUPPLY::request& req, COMMAND_RPC_GET_CIRCULATING_SUPPLY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
bool core_rpc_server::on_get_supply_info(const COMMAND_RPC_GET_SUPPLY_INFO::request& req, COMMAND_RPC_GET_SUPPLY_INFO::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx)
{
PERF_TIMER(on_get_circulating_supply);
PERF_TIMER(on_get_supply_info);
std::map<std::string, uint64_t> amounts = m_core.get_blockchain_storage().get_db().get_circulating_supply();
for (const auto &i: amounts)
{
COMMAND_RPC_GET_CIRCULATING_SUPPLY::supply_entry se(i.first, std::to_string(i.second));
COMMAND_RPC_GET_SUPPLY_INFO::supply_entry se(i.first, std::to_string(i.second));
res.supply_tally.push_back(se);
}
res.height = m_core.get_current_blockchain_height();
@@ -3006,20 +3006,44 @@ namespace cryptonote
return true;
}
// Iterate over the cache, supplying the data in a more accessible format
res.total_burnt = res.total_staked = res.total_yield = res.yield_per_stake = 0;
res.yield_data.clear();
for (const auto& entry: ybi_cache) {
// Skip this entry if out-of=range
// Check for last entry
if (entry.first == height - 1) {
res.total_staked = entry.second.locked_coins_tally;
if (entry.second.locked_coins_tally > 0) {
boost::multiprecision::uint128_t yield_per_stake = entry.second.slippage_total_this_block;
yield_per_stake *= COIN;
yield_per_stake /= entry.second.locked_coins_tally;
res.yield_per_stake = yield_per_stake.convert_to<uint64_t>();
}
}
// Skip this entry if out-of-range
if (req.from_height > 0 and entry.first < req.from_height) continue;
if (req.to_height > 0 and entry.first > req.to_height) continue;
// Clone the data into the response
COMMAND_RPC_GET_YIELD_INFO::yield_data_t yd;
yd.block_height = entry.second.block_height;
yd.slippage_total_this_block = entry.second.slippage_total_this_block;
yd.locked_coins_this_block = entry.second.locked_coins_this_block;
yd.locked_coins_tally = entry.second.locked_coins_tally;
yd.network_health_percentage = entry.second.network_health_percentage;
res.yield_data.push_back(yd);
// Do we need to include raw data?
if (req.include_raw_data) {
// Clone the data into the response
COMMAND_RPC_GET_YIELD_INFO::yield_data_t yd;
yd.block_height = entry.second.block_height;
yd.slippage_total_this_block = entry.second.slippage_total_this_block;
yd.locked_coins_this_block = entry.second.locked_coins_this_block;
yd.locked_coins_tally = entry.second.locked_coins_tally;
yd.network_health_percentage = entry.second.network_health_percentage;
res.yield_data.push_back(yd);
}
// Perform the aggregation
if (entry.second.locked_coins_tally == 0) {
res.total_burnt += entry.second.slippage_total_this_block;
} else {
res.total_yield += entry.second.slippage_total_this_block;
}
}
res.status = CORE_RPC_STATUS_OK;
return true;
+2 -2
View File
@@ -174,7 +174,7 @@ namespace cryptonote
MAP_JON_RPC_WE("get_output_histogram", on_get_output_histogram, COMMAND_RPC_GET_OUTPUT_HISTOGRAM)
MAP_JON_RPC_WE("get_version", on_get_version, COMMAND_RPC_GET_VERSION)
MAP_JON_RPC_WE_IF("get_coinbase_tx_sum", on_get_coinbase_tx_sum, COMMAND_RPC_GET_COINBASE_TX_SUM, !m_restricted)
MAP_JON_RPC_WE("get_circulating_supply", on_get_circulating_supply, COMMAND_RPC_GET_CIRCULATING_SUPPLY)
MAP_JON_RPC_WE("get_supply_info", on_get_supply_info, COMMAND_RPC_GET_SUPPLY_INFO)
MAP_JON_RPC_WE("get_yield_info", on_get_yield_info, COMMAND_RPC_GET_YIELD_INFO)
MAP_JON_RPC_WE("get_fee_estimate", on_get_base_fee_estimate, COMMAND_RPC_GET_BASE_FEE_ESTIMATE)
MAP_JON_RPC_WE_IF("get_alternate_chains",on_get_alternate_chains, COMMAND_RPC_GET_ALTERNATE_CHAINS, !m_restricted)
@@ -253,7 +253,7 @@ namespace cryptonote
bool on_get_output_histogram(const COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request& req, COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_version(const COMMAND_RPC_GET_VERSION::request& req, COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_coinbase_tx_sum(const COMMAND_RPC_GET_COINBASE_TX_SUM::request& req, COMMAND_RPC_GET_COINBASE_TX_SUM::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_circulating_supply(const COMMAND_RPC_GET_CIRCULATING_SUPPLY::request& req, COMMAND_RPC_GET_CIRCULATING_SUPPLY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_supply_info(const COMMAND_RPC_GET_SUPPLY_INFO::request& req, COMMAND_RPC_GET_SUPPLY_INFO::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_yield_info(const COMMAND_RPC_GET_YIELD_INFO::request& req, COMMAND_RPC_GET_YIELD_INFO::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_base_fee_estimate(const COMMAND_RPC_GET_BASE_FEE_ESTIMATE::request& req, COMMAND_RPC_GET_BASE_FEE_ESTIMATE::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
bool on_get_alternate_chains(const COMMAND_RPC_GET_ALTERNATE_CHAINS::request& req, COMMAND_RPC_GET_ALTERNATE_CHAINS::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL);
+11 -1
View File
@@ -1294,10 +1294,12 @@ namespace cryptonote
struct request_t
{
bool include_raw_data;
uint64_t from_height;
uint64_t to_height;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_OPT(include_raw_data, false)
KV_SERIALIZE_OPT(from_height, (uint64_t)0)
KV_SERIALIZE_OPT(to_height, (uint64_t)0)
END_KV_SERIALIZE_MAP()
@@ -1308,9 +1310,17 @@ namespace cryptonote
struct response_t
{
std::string status;
uint64_t total_burnt;
uint64_t total_staked;
uint64_t total_yield;
uint64_t yield_per_stake;
std::vector<COMMAND_RPC_GET_YIELD_INFO::yield_data_t> yield_data;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
KV_SERIALIZE(total_burnt)
KV_SERIALIZE(total_staked)
KV_SERIALIZE(total_yield)
KV_SERIALIZE(yield_per_stake)
KV_SERIALIZE(yield_data)
END_KV_SERIALIZE_MAP()
};
@@ -1440,7 +1450,7 @@ namespace cryptonote
typedef epee::misc_utils::struct_init<response_t> response;
};
struct COMMAND_RPC_GET_CIRCULATING_SUPPLY
struct COMMAND_RPC_GET_SUPPLY_INFO
{
struct request_t
{
+27 -9
View File
@@ -2349,7 +2349,7 @@ bool simple_wallet::welcome(const std::vector<std::string> &args)
message_writer() << tr("Flaws in Salvium may be discovered in the future, and attacks may be developed to peek under some");
message_writer() << tr("of the layers of privacy Salvium provides. Be safe and practice defense in depth.");
message_writer() << "";
message_writer() << tr("Welcome to Salvium and compliant financial privacy. For more information see https://salvium.network");
message_writer() << tr("Welcome to Salvium and compliant financial privacy. For more information see https://salvium.io");
return true;
}
@@ -3427,7 +3427,7 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("donate",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::donate, _1),
tr(USAGE_DONATE),
tr("Donate <amount> to the development team (donate.salvium.network)."));
tr("Donate <amount> to the development team (donate.salvium.io)."));
m_cmd_binder.set_handler("sign_transfer",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::sign_transfer, _1),
tr(USAGE_SIGN_TRANSFER),
@@ -8370,7 +8370,7 @@ bool simple_wallet::supply_info(const std::vector<std::string> &args) {
//supply_128 /= COIN;
uint64_t supply = supply_128.convert_to<uint64_t>();
message_writer(console_color_default, false) << boost::format(tr("\t%s\t:\t%d")) % supply_asset.first % print_money(supply);
message_writer(console_color_default, false) << boost::format(tr("\t%6s : %21.8d")) % supply_asset.first % print_money(supply);
/*
// get price
@@ -8411,22 +8411,40 @@ bool simple_wallet::yield_info(const std::vector<std::string> &args) {
return false;
// Scan the entries we have received to gather the state (total yield over period captured)
uint64_t total_burnt = 0;
uint64_t total_yield = 0;
uint64_t yield_per_stake = 0;
for (size_t idx=1; idx<ybi_data.size(); ++idx) {
total_yield += ybi_data[idx].slippage_total_this_block;
if (ybi_data[idx].locked_coins_tally == 0) {
total_burnt += ybi_data[idx].slippage_total_this_block;
} else {
total_yield += ybi_data[idx].slippage_total_this_block;
}
}
// Calculate the yield_per_staked_SAL value
if (ybi_data.back().locked_coins_tally > 0) {
boost::multiprecision::uint128_t yield_per_stake_128 = ybi_data.back().slippage_total_this_block;
yield_per_stake_128 *= COIN;
yield_per_stake_128 /= ybi_data.back().locked_coins_tally;
yield_per_stake = yield_per_stake_128.convert_to<uint64_t>();
}
// Output the necessary information about yield stats
message_writer(console_color_default, false) << boost::format(tr("YIELD INFO:\n\tTotal SAL supply: %d\n\tTotal coins locked: %d\n\tYield accrued over last %s: %d"))
% print_money(total_supply_128.convert_to<uint64_t>())
message_writer(console_color_default, false) << boost::format(tr("YIELD INFO:\n\tSupply coins burnt over last %s: %d\n\tTotal coins locked: %d\n\tYield accrued over last %s: %d\n\tYield per SAL staked: %d"))
% get_human_readable_timespan((ybi_data.size()-1) * DIFFICULTY_TARGET_V2)
% print_money(total_burnt)
% print_money(ybi_data.back().locked_coins_tally)
% get_human_readable_timespan((ybi_data.size()-1) * DIFFICULTY_TARGET_V2)
% print_money(total_yield);
% print_money(total_yield)
% print_money(yield_per_stake);
// Now summarise our own YIELD TXs that are yet to amture
tools::wallet2::transfer_container transfers;
m_wallet->get_transfers(transfers);
if (transfers.empty())
return true;
std::map<size_t, size_t> payouts;
message_writer(console_color_default, false) << boost::format(tr("\nSTAKED FUNDS:"));
for (size_t idx = transfers.size()-1; idx>0; --idx) {
@@ -8508,7 +8526,7 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
if (!payment_id_str.empty())
local_args.push_back(payment_id_str);
if (m_wallet->nettype() == cryptonote::MAINNET)
message_writer() << (boost::format(tr("Donating %s %s to The Salvium Team (donate.salvium.network or %s).")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % SALVIUM_DONATION_ADDR).str();
message_writer() << (boost::format(tr("Donating %s %s to The Salvium Team (donate.salvium.io or %s).")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % SALVIUM_DONATION_ADDR).str();
else
message_writer() << (boost::format(tr("Donating %s %s to %s.")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % address_str).str();
transfer(local_args);
+1 -1
View File
@@ -1,5 +1,5 @@
#define DEF_SALVIUM_VERSION_TAG "7f6b8da"
#define DEF_SALVIUM_VERSION "0.2.8"
#define DEF_SALVIUM_VERSION "0.3.1"
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
#define DEF_MONERO_VERSION "0.18.3.3"
#define DEF_MONERO_RELEASE_NAME "Zero"
+1 -1
View File
@@ -487,7 +487,7 @@ bool message_store::get_signer_index_by_monero_address(const cryptonote::account
return true;
}
}
MWARNING("No authorized signer with Monero address " << account_address_to_string(monero_address));
MWARNING("No authorized signer with Salvium address " << account_address_to_string(monero_address));
return false;
}
+19 -11
View File
@@ -2323,10 +2323,10 @@ bool wallet2::get_pricing_record(oracle::pricing_record& pr, const uint64_t heig
bool wallet2::get_circulating_supply(std::vector<std::pair<std::string, std::string>> &amounts)
{
// Issue an RPC call to get the block header (and thus the pricing record) at the specified height
cryptonote::COMMAND_RPC_GET_CIRCULATING_SUPPLY::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_CIRCULATING_SUPPLY::response res = AUTO_VAL_INIT(res);
cryptonote::COMMAND_RPC_GET_SUPPLY_INFO::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_SUPPLY_INFO::response res = AUTO_VAL_INIT(res);
m_daemon_rpc_mutex.lock();
bool r = invoke_http_json_rpc("/json_rpc", "get_circulating_supply", req, res, rpc_timeout);
bool r = invoke_http_json_rpc("/json_rpc", "get_supply_info", req, res, rpc_timeout);
m_daemon_rpc_mutex.unlock();
if (r && res.status == CORE_RPC_STATUS_OK)
{
@@ -2338,7 +2338,7 @@ bool wallet2::get_circulating_supply(std::vector<std::pair<std::string, std::str
}
else
{
MERROR("Failed to retrieve circulating supply from daemon");
MERROR("Failed to retrieve supply info from daemon");
return false;
}
}
@@ -2349,6 +2349,7 @@ bool wallet2::get_yield_info(std::vector<cryptonote::yield_block_info>& ybi_data
cryptonote::COMMAND_RPC_GET_YIELD_INFO::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_YIELD_INFO::response res = AUTO_VAL_INIT(res);
m_daemon_rpc_mutex.lock();
req.include_raw_data = true;
bool r = invoke_http_json_rpc("/json_rpc", "get_yield_info", req, res, rpc_timeout);
m_daemon_rpc_mutex.unlock();
if (r && res.status == CORE_RPC_STATUS_OK)
@@ -2542,12 +2543,6 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
bool ok = m_account.get_device().derive_subaddress_public_key(output_public_key, derivation, i, pk_change);
THROW_WALLET_EXCEPTION_IF(!ok, error::wallet_internal_error, "Failed to derive subaddress public key for TRANSFER TX");
// Find the TX public key for P_change
//auto search = m_salvium_txs.find(pk_change);
//if (search != m_salvium_txs.end()) {
// Store the origin index for the TX - this is needed when we want to SPEND the returned funds
check_acc_out_precomp_once(tx.vout[i], derivation, additional_derivations, i, is_out_data_ptr, tx_scan_info[i], output_found[i]);
THROW_WALLET_EXCEPTION_IF(tx_scan_info[i].error, error::acc_outs_lookup_error, tx, tx_pub_key, m_account.get_keys());
if (tx_scan_info[i].received)
@@ -2563,6 +2558,19 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
// Copy the origin TD
td_origin_idx = tx_scan_info[i].origin_idx;
if (tx.type == cryptonote::transaction_type::PROTOCOL) {
THROW_WALLET_EXCEPTION_IF(td_origin_idx >= get_num_transfer_details(), error::wallet_internal_error, "cannot locate protocol TX origin in m_transfers");
const transfer_details& td_origin = get_transfer_details(td_origin_idx);
THROW_WALLET_EXCEPTION_IF(td_origin.m_tx.type != cryptonote::transaction_type::STAKE, error::wallet_internal_error, "incorrect TX type for protocol_tx origin in m_transfers");
// Get the output key for the change entry
crypto::public_key pk_locked_coins = crypto::null_pkey;
THROW_WALLET_EXCEPTION_IF(!get_output_public_key(td_origin.m_tx.vout[td_origin.m_internal_output_index], pk_locked_coins), error::wallet_internal_error, "Failed to get output public key for locked coins");
// At this point, we need to clear the "locked coins" count, because otherwise we will be counting yield stakes twice in our balance
THROW_WALLET_EXCEPTION_IF(!m_locked_coins.erase(pk_locked_coins), error::wallet_internal_error, "Failed to remove protocol_tx entry from m_locked_coins");
}
}
}
}
@@ -2690,7 +2698,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
if (tx.type == cryptonote::transaction_type::STAKE) {
// Additionally, with YIELD TXs, we need to update our "balance staked" subtotal, because otherwise our balance is out by the staked coins until they mature!
// SRCG: must remember to deduct the number of staked coins when they mature!!
LOG_ERROR("***** STAKED COINS : " << tx.amount_burnt << " *****");
LOG_PRINT_L1("***** STAKED COINS : " << tx.amount_burnt << " *****");
m_locked_coins.insert({P_change, {0, tx.amount_burnt}});
}
+6 -6
View File
@@ -473,7 +473,7 @@ namespace tools
balance_info.balance = req.all_accounts ? m_wallet->balance_all(req.strict, asset) : m_wallet->balance(req.account_index, asset, req.strict);
if (!balance_info.balance)
continue;
balance_info.unlocked_balance = req.all_accounts ? m_wallet->unlocked_balance_all(req.strict, asset, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock) : m_wallet->unlocked_balance(req.account_index, "XHV", req.strict, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock);
balance_info.unlocked_balance = req.all_accounts ? m_wallet->unlocked_balance_all(req.strict, asset, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock) : m_wallet->unlocked_balance(req.account_index, asset, req.strict, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock);
balance_info.multisig_import_needed = m_wallet->multisig() && m_wallet->has_multisig_partial_key_images();
std::map<uint32_t, std::map<uint32_t, uint64_t>> balance_per_subaddress_per_account;
std::map<uint32_t, std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>>> unlocked_balance_per_subaddress_per_account;
@@ -914,7 +914,7 @@ namespace tools
}
if (addresses.empty())
{
er.message = std::string("No Monero address found at ") + url;
er.message = std::string("No Salvium address found at ") + url;
return {};
}
return addresses[0];
@@ -2223,7 +2223,7 @@ namespace tools
}
if (addresses.empty())
{
er.message = std::string("No Monero address found at ") + url;
er.message = std::string("No Salvium address found at ") + url;
return {};
}
return addresses[0];
@@ -3041,7 +3041,7 @@ namespace tools
}
if (addresses.empty())
{
er.message = std::string("No Monero address found at ") + url;
er.message = std::string("No Salvium address found at ") + url;
return {};
}
return addresses[0];
@@ -3095,7 +3095,7 @@ namespace tools
}
if (addresses.empty())
{
er.message = std::string("No Monero address found at ") + url;
er.message = std::string("No Salvium address found at ") + url;
return {};
}
return addresses[0];
@@ -4403,7 +4403,7 @@ namespace tools
}
if (addresses.empty())
{
er.message = std::string("No Monero address found at ") + url;
er.message = std::string("No Salvium address found at ") + url;
return {};
}
address = addresses[0];