diff --git a/libraries/plugins/peerplays_sidechain/CMakeLists.txt b/libraries/plugins/peerplays_sidechain/CMakeLists.txt index b61e908d..57a91935 100755 --- a/libraries/plugins/peerplays_sidechain/CMakeLists.txt +++ b/libraries/plugins/peerplays_sidechain/CMakeLists.txt @@ -22,6 +22,8 @@ add_library( peerplays_sidechain hive/operations.cpp hive/transaction.cpp hive/types.cpp + ethereum/transaction.cpp + ethereum/types.cpp ) if (ENABLE_DEV_FEATURES) diff --git a/libraries/plugins/peerplays_sidechain/ethereum/transaction.cpp b/libraries/plugins/peerplays_sidechain/ethereum/transaction.cpp new file mode 100644 index 00000000..f952dadd --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/ethereum/transaction.cpp @@ -0,0 +1,57 @@ +#include + +#include + +#include +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +digest_type transaction::digest() const { + digest_type::encoder enc; + fc::raw::pack(enc, *this); + return enc.result(); +} + +transaction_id_type transaction::id() const { + auto h = digest(); + transaction_id_type result; + memcpy(result._hash, h._hash, std::min(sizeof(result), sizeof(h))); + return result; +} + +digest_type transaction::sig_digest(const chain_id_type &chain_id) const { + digest_type::encoder enc; + fc::raw::pack(enc, chain_id); + fc::raw::pack(enc, *this); + return enc.result(); +} + +void transaction::set_expiration(fc::time_point_sec expiration_time) { + expiration = expiration_time; +} + +void transaction::set_reference_block(const block_id_type &reference_block) { + ref_block_num = fc::endian_reverse_u32(reference_block._hash[0]); + ref_block_prefix = reference_block._hash[1]; +} + +void signed_transaction::clear() { + operations.clear(); + signatures.clear(); +} + +const signature_type &signed_transaction::sign(const ethereum::private_key_type &key, const ethereum::chain_id_type &chain_id) { + digest_type h = sig_digest(chain_id); + signatures.push_back(key.sign_compact(h, true)); + return signatures.back(); +} + +signature_type signed_transaction::sign(const ethereum::private_key_type &key, const ethereum::chain_id_type &chain_id) const { + digest_type::encoder enc; + fc::raw::pack(enc, chain_id); + fc::raw::pack(enc, *this); + return key.sign_compact(enc.result(), true); +} + +}}} // namespace graphene::peerplays_sidechain::ethereum diff --git a/libraries/plugins/peerplays_sidechain/ethereum/types.cpp b/libraries/plugins/peerplays_sidechain/ethereum/types.cpp new file mode 100644 index 00000000..7a62cc58 --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/ethereum/types.cpp @@ -0,0 +1,73 @@ +#include + +#include +#include +#include +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +std::string public_key_type::prefix = KEY_PREFIX_STM; + +public_key_type::public_key_type() : + key_data(){}; + +public_key_type::public_key_type(const fc::ecc::public_key_data &data) : + key_data(data){}; + +public_key_type::public_key_type(const fc::ecc::public_key &pubkey) : + key_data(pubkey){}; + +public_key_type::public_key_type(const std::string &base58str) { + const size_t prefix_len = prefix.size(); + FC_ASSERT(base58str.size() > prefix_len); + FC_ASSERT(base58str.substr(0, prefix_len) == prefix, "", ("base58str", base58str)); + auto bin = fc::from_base58(base58str.substr(prefix_len)); + auto bin_key = fc::raw::unpack(bin); + key_data = bin_key.data; + FC_ASSERT(fc::ripemd160::hash(key_data.data, key_data.size())._hash[0] == bin_key.check); +}; + +public_key_type::operator fc::ecc::public_key_data() const { + return key_data; +}; + +public_key_type::operator fc::ecc::public_key() const { + return fc::ecc::public_key(key_data); +}; + +public_key_type::operator std::string() const { + binary_key k; + k.data = key_data; + k.check = fc::ripemd160::hash(k.data.data, k.data.size())._hash[0]; + auto data = fc::raw::pack(k); + return prefix + fc::to_base58(data.data(), data.size()); +} + +bool operator==(const public_key_type &p1, const fc::ecc::public_key &p2) { + return p1.key_data == p2.serialize(); +} + +bool operator==(const public_key_type &p1, const public_key_type &p2) { + return p1.key_data == p2.key_data; +} + +bool operator!=(const public_key_type &p1, const public_key_type &p2) { + return p1.key_data != p2.key_data; +} + +}}} // namespace graphene::peerplays_sidechain::ethereum + +namespace fc { + +using namespace std; + +void to_variant(const graphene::peerplays_sidechain::ethereum::public_key_type &var, fc::variant &vo, uint32_t max_depth) { + vo = std::string(var); +} + +void from_variant(const fc::variant &var, graphene::peerplays_sidechain::ethereum::public_key_type &vo, uint32_t max_depth) { + vo = graphene::peerplays_sidechain::ethereum::public_key_type(var.as_string()); +} + +} // namespace fc diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/asset.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/asset.hpp new file mode 100644 index 00000000..05aed34f --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/asset.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +#define HBD_NAI "@@000000013" +#define HBD_PRECISION 3 +#define HBD_SYMBOL_U64 (uint64_t('S') | (uint64_t('B') << 8) | (uint64_t('D') << 16)) +#define HBD_SYMBOL_SER (uint64_t(3) | (HBD_SYMBOL_U64 << 8)) + +#define HIVE_NAI "@@000000021" +#define HIVE_PRECISION 3 +#define HIVE_SYMBOL_U64 (uint64_t('S') | (uint64_t('T') << 8) | (uint64_t('E') << 16) | (uint64_t('E') << 24) | (uint64_t('M') << 32)) +#define HIVE_SYMBOL_SER (uint64_t(3) | (HIVE_SYMBOL_U64 << 8)) + +#define TBD_NAI "@@000000013" +#define TBD_PRECISION 3 +#define TBD_SYMBOL_U64 (uint64_t('T') | (uint64_t('B') << 8) | (uint64_t('D') << 16)) +#define TBD_SYMBOL_SER (uint64_t(3) | (TBD_SYMBOL_U64 << 8)) + +#define TESTS_NAI "@@000000021" +#define TESTS_PRECISION 3 +#define TESTS_SYMBOL_U64 (uint64_t('T') | (uint64_t('E') << 8) | (uint64_t('S') << 16) | (uint64_t('T') << 24) | (uint64_t('S') << 32)) +#define TESTS_SYMBOL_SER (uint64_t(3) | (TESTS_SYMBOL_U64 << 8)) + +struct asset { + static uint64_t hbd_symbol_ser; + static uint64_t ethereum_symbol_ser; + share_type amount; + uint64_t symbol; +}; + +}}} // namespace graphene::peerplays_sidechain::ethereum + +namespace fc { +void to_variant(const graphene::peerplays_sidechain::ethereum::asset &var, fc::variant &vo, uint32_t max_depth); +void from_variant(const fc::variant &var, graphene::peerplays_sidechain::ethereum::asset &vo, uint32_t max_depth); +} // namespace fc + +FC_REFLECT(graphene::peerplays_sidechain::ethereum::asset, (amount)(symbol)) diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/authority.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/authority.hpp new file mode 100644 index 00000000..d4d5455f --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/authority.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include + +#include + +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +struct authority { + authority() { + } + + enum classification { + owner = 0, + active = 1, + key = 2, + posting = 3 + }; + + uint32_t weight_threshold = 0; + fc::flat_map account_auths; + fc::flat_map key_auths; +}; + +}}} // namespace graphene::peerplays_sidechain::ethereum + +FC_REFLECT_ENUM(graphene::peerplays_sidechain::ethereum::authority::classification, + (owner)(active)(key)(posting)) + +FC_REFLECT(graphene::peerplays_sidechain::ethereum::authority, + (weight_threshold)(account_auths)(key_auths)) diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/ethereum_operations.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/ethereum_operations.hpp new file mode 100644 index 00000000..4b8a7399 --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/ethereum_operations.hpp @@ -0,0 +1,123 @@ +#pragma once + +#include +#include + +#include + +#include +#include +#include +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +struct vote_operation {}; +struct comment_operation {}; + +struct transfer_operation { + ethereum::account_name_type from; + ethereum::account_name_type to; + ethereum::asset amount; + std::string memo; +}; + +struct transfer_to_vesting_operation {}; +struct withdraw_vesting_operation {}; +struct limit_order_create_operation {}; +struct limit_order_cancel_operation {}; +struct feed_publish_operation {}; +struct convert_operation {}; +struct account_create_operation {}; + +struct account_update_operation { + ethereum::account_name_type account; + fc::optional owner; + fc::optional active; + fc::optional posting; + ethereum::public_key_type memo_key; + std::string json_metadata; +}; + +struct witness_update_operation {}; +struct account_witness_vote_operation {}; +struct account_witness_proxy_operation {}; +struct pow_operation {}; +struct custom_operation {}; +struct report_over_production_operation {}; +struct delete_comment_operation {}; +struct custom_json_operation {}; +struct comment_options_operation {}; +struct set_withdraw_vesting_route_operation {}; +struct limit_order_create2_operation {}; +struct claim_account_operation {}; +struct create_claimed_account_operation {}; +struct request_account_recovery_operation {}; +struct recover_account_operation {}; +struct change_recovery_account_operation {}; +struct escrow_transfer_operation {}; +struct escrow_dispute_operation {}; +struct escrow_release_operation {}; +struct pow2_operation {}; +struct escrow_approve_operation {}; +struct transfer_to_savings_operation {}; +struct transfer_from_savings_operation {}; +struct cancel_transfer_from_savings_operation {}; +struct custom_binary_operation {}; +struct decline_voting_rights_operation {}; +struct reset_account_operation {}; +struct set_reset_account_operation {}; +struct claim_reward_balance_operation {}; + +struct delegate_vesting_shares_operation { + ethereum::account_name_type delegator; + ethereum::account_name_type delegatee; + ethereum::asset vesting_shares; +}; + +}}} // namespace graphene::peerplays_sidechain::ethereum + +FC_REFLECT(graphene::peerplays_sidechain::ethereum::vote_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::comment_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::transfer_operation, + (from)(to)(amount)(memo)) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::transfer_to_vesting_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::withdraw_vesting_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::limit_order_create_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::limit_order_cancel_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::feed_publish_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::convert_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::account_create_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::account_update_operation, + (account)(owner)(active)(posting)(memo_key)(json_metadata)) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::witness_update_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::account_witness_vote_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::account_witness_proxy_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::pow_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::custom_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::report_over_production_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::delete_comment_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::custom_json_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::comment_options_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::set_withdraw_vesting_route_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::limit_order_create2_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::claim_account_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::create_claimed_account_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::request_account_recovery_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::recover_account_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::change_recovery_account_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::escrow_transfer_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::escrow_dispute_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::escrow_release_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::pow2_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::escrow_approve_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::transfer_to_savings_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::transfer_from_savings_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::cancel_transfer_from_savings_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::custom_binary_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::decline_voting_rights_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::reset_account_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::set_reset_account_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::claim_reward_balance_operation, ) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::delegate_vesting_shares_operation, + (delegator)(delegatee)(vesting_shares)) diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/operations.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/operations.hpp new file mode 100644 index 00000000..586d31dd --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/operations.hpp @@ -0,0 +1,69 @@ +#pragma once + +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +typedef fc::static_variant< + vote_operation, + comment_operation, + + transfer_operation, + transfer_to_vesting_operation, + withdraw_vesting_operation, + + limit_order_create_operation, + limit_order_cancel_operation, + + feed_publish_operation, + convert_operation, + + account_create_operation, + account_update_operation, + + witness_update_operation, + account_witness_vote_operation, + account_witness_proxy_operation, + + pow_operation, + + custom_operation, + + report_over_production_operation, + + delete_comment_operation, + custom_json_operation, + comment_options_operation, + set_withdraw_vesting_route_operation, + limit_order_create2_operation, + claim_account_operation, + create_claimed_account_operation, + request_account_recovery_operation, + recover_account_operation, + change_recovery_account_operation, + escrow_transfer_operation, + escrow_dispute_operation, + escrow_release_operation, + pow2_operation, + escrow_approve_operation, + transfer_to_savings_operation, + transfer_from_savings_operation, + cancel_transfer_from_savings_operation, + custom_binary_operation, + decline_voting_rights_operation, + reset_account_operation, + set_reset_account_operation, + claim_reward_balance_operation, + delegate_vesting_shares_operation> + ethereum_operation; + +}}} // namespace graphene::peerplays_sidechain::hive + +namespace fc { + +void to_variant(const graphene::peerplays_sidechain::ethereum::ethereum_operation &var, fc::variant &vo, uint32_t max_depth = 5); +void from_variant(const fc::variant &var, graphene::peerplays_sidechain::ethereum::ethereum_operation &vo, uint32_t max_depth = 5); + +} // namespace fc + +FC_REFLECT_TYPENAME(graphene::peerplays_sidechain::ethereum::ethereum_operation) diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/transaction.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/transaction.hpp index 116a6df3..61fc39c6 100644 --- a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/transaction.hpp +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/transaction.hpp @@ -3,17 +3,23 @@ #include #include +#include +#include + #include #include - +#include namespace graphene { namespace peerplays_sidechain { namespace ethereum { +typedef fc::ecc::private_key private_key_type; +typedef fc::sha256 chain_id_type; class transaction { +public: uint16_t ref_block_num = 0; uint32_t ref_block_prefix = 0; fc::time_point_sec expiration; - std::vector operations; + std::vector operations; extensions_type extensions; digest_type digest() const; @@ -23,6 +29,7 @@ class transaction { void set_expiration(fc::time_point_sec expiration_time); void set_reference_block(const block_id_type &reference_block); +/* /// Serialises this transaction to an RLPStream. /// @throws TransactionIsUnsigned if including signature was requested but it was not initialized void streamRLP(RLPStream& _s, IncludeSignature _sig = WithSignature, bool _forEip155hash = false) const; @@ -57,6 +64,7 @@ protected: mutable h256 m_hashWith; ///< Cached hash of transaction with signature. mutable boost::optional
m_sender; ///< Cached sender, determined from signature. +*/ }; class signed_transaction : public transaction { diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/types.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/types.hpp new file mode 100644 index 00000000..f8a06c6c --- /dev/null +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/ethereum/types.hpp @@ -0,0 +1,72 @@ +#pragma once + +#include +#include + +namespace graphene { namespace peerplays_sidechain { namespace ethereum { + +#define KEY_PREFIX_STM "STM" +#define KEY_PREFIX_TST "TST" + +enum network { + mainnet, + testnet +}; + +struct void_t {}; + +typedef fc::static_variant future_extensions; +typedef fc::flat_set extensions_type; + +typedef fc::ecc::private_key private_key_type; +typedef fc::sha256 chain_id_type; +typedef std::string account_name_type; +typedef fc::ripemd160 block_id_type; +//typedef fc::ripemd160 checksum_type; +typedef fc::ripemd160 transaction_id_type; +typedef fc::sha256 digest_type; +typedef fc::ecc::compact_signature signature_type; +typedef fc::safe share_type; +//typedef safe ushare_type; +//typedef uint16_t weight_type; +//typedef uint32_t contribution_id_type; +//typedef fixed_string<32> custom_id_type; + +struct public_key_type { + + static std::string prefix; + + struct binary_key { + binary_key() { + } + uint32_t check = 0; + fc::ecc::public_key_data data; + }; + fc::ecc::public_key_data key_data; + public_key_type(); + public_key_type(const fc::ecc::public_key_data &data); + public_key_type(const fc::ecc::public_key &pubkey); + explicit public_key_type(const std::string &base58str); + operator fc::ecc::public_key_data() const; + operator fc::ecc::public_key() const; + explicit operator std::string() const; + friend bool operator==(const public_key_type &p1, const fc::ecc::public_key &p2); + friend bool operator==(const public_key_type &p1, const public_key_type &p2); + friend bool operator<(const public_key_type &p1, const public_key_type &p2) { + return p1.key_data < p2.key_data; + } + friend bool operator!=(const public_key_type &p1, const public_key_type &p2); +}; + +}}} // namespace graphene::peerplays_sidechain::ethereum + +namespace fc { +void to_variant(const graphene::peerplays_sidechain::ethereum::public_key_type &var, fc::variant &vo, uint32_t max_depth = 2); +void from_variant(const fc::variant &var, graphene::peerplays_sidechain::ethereum::public_key_type &vo, uint32_t max_depth = 2); +} // namespace fc + +FC_REFLECT(graphene::peerplays_sidechain::ethereum::public_key_type, (key_data)) +FC_REFLECT(graphene::peerplays_sidechain::ethereum::public_key_type::binary_key, (data)(check)) + +FC_REFLECT(graphene::peerplays_sidechain::ethereum::void_t, ) +FC_REFLECT_TYPENAME(graphene::peerplays_sidechain::ethereum::future_extensions) diff --git a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_eth.hpp b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_eth.hpp index d322da3a..a690bc40 100644 --- a/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_eth.hpp +++ b/libraries/plugins/peerplays_sidechain/include/graphene/peerplays_sidechain/sidechain_net_handler_eth.hpp @@ -119,6 +119,7 @@ public: std::string walletprocesspsbt(std::string const &tx_psbt); bool walletpassphrase(const std::string &passphrase, uint32_t timeout = 60); + std::string chain_id;//256 bit value private: class ethereum_function_call_encoder { public: @@ -140,7 +141,6 @@ private: std::vector owners; uint32_t threshold; std::unordered_map m_requests; - std::string chain_id;//256 bit value std::string balance; std::string code; diff --git a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_eth.cpp b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_eth.cpp index 2b939085..0abd9ba7 100644 --- a/libraries/plugins/peerplays_sidechain/sidechain_net_handler_eth.cpp +++ b/libraries/plugins/peerplays_sidechain/sidechain_net_handler_eth.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include extern "C" { @@ -291,6 +292,8 @@ uint64_t eth_rpc_client::add_owner(const std::string& addr ) { uint64_t id = eth_sign(account_address, message); m_requests[t_id] = req_t::ADD_OWNER; + + return 0; } uint64_t eth_rpc_client::remove_owner(const std::string& addr, uint32_t threshold) { @@ -318,6 +321,8 @@ uint64_t eth_rpc_client::remove_owner(const std::string& addr, uint32_t threshol std::string refundReceiver = "0000000000000000000000000000000000000000"; m_requests[t_id] = req_t::REMOVE_OWNER; + + return 0; } std::string eth_rpc_client::addmultisigaddress(const uint32_t nrequired, const std::vector public_keys) { @@ -1032,13 +1037,12 @@ std::string sidechain_net_handler_eth::create_transaction() { } std::string sidechain_net_handler_eth::sign_transaction(const sidechain_transaction_object &sto) { -/* std::stringstream ss_trx(boost::algorithm::unhex(sto.transaction)); - hive::signed_transaction htrx; + ethereum::signed_transaction htrx; fc::raw::unpack(ss_trx, htrx, 1000); - std::string chain_id_str = node_rpc_client->get_chain_id(); - const hive::chain_id_type chain_id(chain_id_str); + std::string chain_id_str = eth_client->chain_id;//eth_rpc_client->get_chain_id(); + const ethereum::chain_id_type chain_id(chain_id_str); fc::optional privkey = graphene::utilities::wif_to_key(get_private_key(plugin.get_current_son_object().sidechain_public_keys.at(sidechain))); signature_type st = htrx.sign(*privkey, chain_id); @@ -1046,8 +1050,7 @@ std::string sidechain_net_handler_eth::sign_transaction(const sidechain_transact std::stringstream ss_st; fc::raw::pack(ss_st, st, 1000); std::string st_str = boost::algorithm::hex(ss_st.str()); -*/ - return "";//st_str; + return st_str; }