diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_ethereum.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_ethereum.cpp index 163f2599..8ceb582b 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_ethereum.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_ethereum.cpp @@ -67,7 +67,8 @@ std::string ethereum_rpc_client::get_network_id() { std::string ethereum_rpc_client::get_nonce(const std::string &address) { std::string reply_str = eth_get_transaction_count("[\"" + address + "\", \"latest\"]"); - return retrieve_value_from_reply(reply_str, ""); + const auto nonce_val = ethereum::from_hex(retrieve_value_from_reply(reply_str, "")); + return nonce_val == 0 ? ethereum::add_0x("0") : ethereum::add_0x(ethereum::to_hex(nonce_val)); } std::string ethereum_rpc_client::get_gas_price() { @@ -639,7 +640,7 @@ std::string sidechain_net_handler_ethereum::sign_transaction(const sidechain_tra #ifdef SEND_RAW_TRANSACTION ethereum::raw_transaction raw_tr; - raw_tr.nonce = ethereum::add_0x(ethereum::to_hex(ethereum::from_hex(rpc_client->get_nonce(ethereum::add_0x(public_key))))); + raw_tr.nonce = rpc_client->get_nonce(ethereum::add_0x(public_key)); raw_tr.gas_price = rpc_client->get_gas_price(); raw_tr.gas_limit = rpc_client->get_gas_limit(); raw_tr.to = wallet_contract_address;