diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-19 01:11:35 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-21 19:28:15 +0000 |
commit | a5dbf7f5faf9013b3cc73e9b6d1fed93ed9c6805 (patch) | |
tree | 8b22b9941db812437f75350d9d34dca3e6d2f755 /tests/functional_tests | |
parent | functional_tests: support several daemons/wallets (diff) | |
download | monero-a5dbf7f5faf9013b3cc73e9b6d1fed93ed9c6805.tar.xz |
functional_tests: add multisig and cold signing tests
Diffstat (limited to 'tests/functional_tests')
-rwxr-xr-x | tests/functional_tests/cold_signing.py | 146 | ||||
-rwxr-xr-x | tests/functional_tests/functional_tests_rpc.py | 4 | ||||
-rwxr-xr-x | tests/functional_tests/multisig.py | 227 | ||||
-rw-r--r-- | tests/functional_tests/test_framework/wallet.py | 169 |
4 files changed, 544 insertions, 2 deletions
diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py new file mode 100755 index 000000000..2acdcb137 --- /dev/null +++ b/tests/functional_tests/cold_signing.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2019 The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import time + +"""Test cold tx signing +""" + +from test_framework.daemon import Daemon +from test_framework.wallet import Wallet + +class ColdSigningTest(): + def run_test(self): + self.create(0) + self.mine() + self.transfer() + + def create(self, idx): + print 'Creating hot and cold wallet' + + self.hot_wallet = Wallet(idx = 0) + # close the wallet if any, will throw if none is loaded + try: self.hot_wallet.close_wallet() + except: pass + + self.cold_wallet = Wallet(idx = 1) + # close the wallet if any, will throw if none is loaded + try: self.cold_wallet.close_wallet() + except: pass + + seed = 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted' + res = self.cold_wallet.restore_deterministic_wallet(seed = seed) + self.cold_wallet.set_daemon('127.0.0.1:11111', ssl_support = "disabled") + spend_key = self.cold_wallet.query_key("spend_key").key + view_key = self.cold_wallet.query_key("view_key").key + res = self.hot_wallet.generate_from_keys(viewkey = view_key, address = '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm') + + ok = False + try: res = self.hot_wallet.query_key("spend_key") + except: ok = True + assert ok + ok = False + try: self.hot_wallet.query_key("mnemonic") + except: ok = True + assert ok + assert self.cold_wallet.query_key("view_key").key == view_key + assert self.cold_wallet.get_address().address == self.hot_wallet.get_address().address + + def mine(self): + print("Mining some blocks") + daemon = Daemon() + wallet = Wallet() + + daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 80) + wallet.refresh() + + def transfer(self): + daemon = Daemon() + + print("Creating transaction in hot wallet") + + dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000} + payment_id = '1234500000012345abcde00000abcdeff1234500000012345abcde00000abcde' + + res = self.hot_wallet.transfer([dst], ring_size = 11, payment_id = payment_id, get_tx_key = False) + assert len(res.tx_hash) == 32*2 + txid = res.tx_hash + assert len(res.tx_key) == 0 + assert res.amount > 0 + amount = res.amount + assert res.fee > 0 + fee = res.fee + assert len(res.tx_blob) == 0 + assert len(res.tx_metadata) == 0 + assert len(res.multisig_txset) == 0 + assert len(res.unsigned_txset) > 0 + unsigned_txset = res.unsigned_txset + + print 'Signing transaction with cold wallet' + res = self.cold_wallet.sign_transfer(unsigned_txset) + assert len(res.signed_txset) > 0 + signed_txset = res.signed_txset + assert len(res.tx_hash_list) == 1 + txid = res.tx_hash_list[0] + assert len(txid) == 64 + + print 'Submitting transaction with hot wallet' + res = self.hot_wallet.submit_transfer(signed_txset) + assert len(res.tx_hash_list) > 0 + assert res.tx_hash_list[0] == txid + + res = self.hot_wallet.get_transfers() + assert len([x for x in (res['pending'] if 'pending' in res else []) if x.txid == txid]) == 1 + assert len([x for x in (res['out'] if 'out' in res else []) if x.txid == txid]) == 0 + + daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1) + self.hot_wallet.refresh() + + res = self.hot_wallet.get_transfers() + assert len([x for x in (res['pending'] if 'pending' in res else []) if x.txid == txid]) == 0 + assert len([x for x in (res['out'] if 'out' in res else []) if x.txid == txid]) == 1 + + res = self.hot_wallet.get_tx_key(txid) + assert len(res.tx_key) == 0 or res.tx_key == '01' + '0' * 62 # identity is used as placeholder + res = self.cold_wallet.get_tx_key(txid) + assert len(res.tx_key) == 64 + + +class Guard: + def __enter__(self): + for i in range(2): + Wallet(idx = i).auto_refresh(False) + def __exit__(self, exc_type, exc_value, traceback): + for i in range(2): + Wallet(idx = i).auto_refresh(True) + +if __name__ == '__main__': + with Guard() as guard: + cs = ColdSigningTest().run_test() diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py index db48844f3..abec0eef0 100755 --- a/tests/functional_tests/functional_tests_rpc.py +++ b/tests/functional_tests/functional_tests_rpc.py @@ -9,7 +9,7 @@ import socket import string USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]' -DEFAULT_TESTS = ['daemon_info', 'blockchain', 'wallet_address', 'integrated_address', 'mining', 'transfer', 'txpool'] +DEFAULT_TESTS = ['daemon_info', 'blockchain', 'wallet_address', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing'] try: python = sys.argv[1] srcdir = sys.argv[2] @@ -34,7 +34,7 @@ except: tests = DEFAULT_TESTS N_MONERODS = 1 -N_WALLETS = 3 +N_WALLETS = 4 monerod_base = [builddir + "/bin/monerod", "--regtest", "--fixed-difficulty", "1", "--offline", "--no-igd", "--p2p-bind-port", "monerod_p2p_port", "--rpc-bind-port", "monerod_rpc_port", "--zmq-rpc-bind-port", "monerod_zmq_port", "--non-interactive", "--disable-dns-checkpoints", "--check-updates", "disabled", "--rpc-ssl", "disabled", "--log-level", "1"] wallet_base = [builddir + "/bin/monero-wallet-rpc", "--wallet-dir", builddir + "/functional-tests-directory", "--rpc-bind-port", "wallet_port", "--disable-rpc-login", "--rpc-ssl", "disabled", "--daemon-ssl", "disabled", "--daemon-port", "18180", "--log-level", "1"] diff --git a/tests/functional_tests/multisig.py b/tests/functional_tests/multisig.py new file mode 100755 index 000000000..7cdddd009 --- /dev/null +++ b/tests/functional_tests/multisig.py @@ -0,0 +1,227 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2019 The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import time + +"""Test multisig transfers +""" + +from test_framework.daemon import Daemon +from test_framework.wallet import Wallet + +class MultisigTest(): + def run_test(self): + self.mine('493DsrfJPqiN3Suv9RcRDoZEbQtKZX1sNcGPA3GhkKYEEmivk8kjQrTdRdVc4ZbmzWJuE157z9NNUKmF2VDfdYDR3CziGMk', 5) + self.mine('42jSRGmmKN96V2j3B8X2DbiNThBXW1tSi1rW1uwkqbyURenq3eC3yosNm8HEMdHuWwKMFGzMUB3RCTvcTaW9kHpdRPP7p5y', 5) + self.mine('47fF32AdrmXG84FcPY697uZdd42pMMGiH5UpiTRTt3YX2pZC7t7wkzEMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUgxRd53', 5) + self.mine('44SKxxLQw929wRF6BA9paQ1EWFshNnKhXM3qz6Mo3JGDE2YG3xyzVutMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUiqhcwR', 5) + self.mine('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 60) + + self.create_multisig_wallets(2, 2, '493DsrfJPqiN3Suv9RcRDoZEbQtKZX1sNcGPA3GhkKYEEmivk8kjQrTdRdVc4ZbmzWJuE157z9NNUKmF2VDfdYDR3CziGMk') + self.import_multisig_info([1, 0], 5) + txid = self.transfer([1, 0]) + self.import_multisig_info([0, 1], 6) + self.check_transaction(txid) + + self.create_multisig_wallets(2, 3, '42jSRGmmKN96V2j3B8X2DbiNThBXW1tSi1rW1uwkqbyURenq3eC3yosNm8HEMdHuWwKMFGzMUB3RCTvcTaW9kHpdRPP7p5y') + self.import_multisig_info([0, 2], 5) + txid = self.transfer([0, 2]) + self.import_multisig_info([0, 1, 2], 6) + self.check_transaction(txid) + + self.create_multisig_wallets(3, 4, '47fF32AdrmXG84FcPY697uZdd42pMMGiH5UpiTRTt3YX2pZC7t7wkzEMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUgxRd53') + self.import_multisig_info([0, 2, 3], 5) + txid = self.transfer([0, 2, 3]) + self.import_multisig_info([0, 1, 2, 3], 6) + self.check_transaction(txid) + + self.create_multisig_wallets(2, 4, '44SKxxLQw929wRF6BA9paQ1EWFshNnKhXM3qz6Mo3JGDE2YG3xyzVutMStEicxbQGRfrYvAAYxH6Fe8rnD56EaNwUiqhcwR') + self.import_multisig_info([1, 2], 5) + txid = self.transfer([1, 2]) + self.import_multisig_info([0, 1, 2, 3], 6) + self.check_transaction(txid) + + def mine(self, address, blocks): + print("Mining some blocks") + daemon = Daemon() + daemon.generateblocks(address, blocks) + + def create_multisig_wallets(self, M_threshold, N_total, expected_address): + print('Creating ' + str(M_threshold) + '/' + str(N_total) + ' multisig wallet') + seeds = [ + 'velvet lymph giddy number token physics poetry unquoted nibs useful sabotage limits benches lifestyle eden nitrogen anvil fewest avoid batch vials washing fences goat unquoted', + 'peeled mixture ionic radar utopia puddle buying illness nuns gadget river spout cavernous bounced paradise drunk looking cottage jump tequila melting went winter adjust spout', + 'dilute gutter certain antics pamphlet macro enjoy left slid guarded bogeys upload nineteen bomb jubilee enhanced irritate turnip eggs swung jukebox loudly reduce sedan slid', + 'waking gown buffet negative reorder speedy baffles hotel pliers dewdrop actress diplomat lymph emit ajar mailed kennel cynical jaunt justice weavers height teardrop toyed lymph', + ] + assert M_threshold <= N_total + assert N_total <= len(seeds) + self.wallet = [None] * N_total + info = [] + for i in range(N_total): + self.wallet[i] = Wallet(idx = i) + try: self.wallet[i].close_wallet() + except: pass + res = self.wallet[i].restore_deterministic_wallet(seed = seeds[i]) + res = self.wallet[i].prepare_multisig() + assert len(res.multisig_info) > 0 + info.append(res.multisig_info) + + for i in range(N_total): + res = self.wallet[i].is_multisig() + assert res.multisig == False + + addresses = [] + next_stage = [] + for i in range(N_total): + res = self.wallet[i].make_multisig(info, M_threshold) + addresses.append(res.address) + next_stage.append(res.multisig_info) + + for i in range(N_total): + res = self.wallet[i].is_multisig() + assert res.multisig == True + assert res.ready == (M_threshold == N_total) + assert res.threshold == M_threshold + assert res.total == N_total + + while True: + n_empty = 0 + for i in range(len(next_stage)): + if len(next_stage[i]) == 0: + n_empty += 1 + assert n_empty == 0 or n_empty == len(next_stage) + if n_empty == len(next_stage): + break + info = next_stage + next_stage = [] + addresses = [] + for i in range(N_total): + res = self.wallet[i].exchange_multisig_keys(info) + next_stage.append(res.multisig_info) + addresses.append(res.address) + for i in range(N_total): + assert addresses[i] == expected_address + + for i in range(N_total): + res = self.wallet[i].is_multisig() + assert res.multisig == True + assert res.ready == True + assert res.threshold == M_threshold + assert res.total == N_total + + + def import_multisig_info(self, signers, expected_outputs): + assert len(signers) >= 2 + + print('Importing multisig info from ' + str(signers)) + + info = [] + for i in signers: + self.wallet[i].refresh() + res = self.wallet[i].export_multisig_info() + assert len(res.info) > 0 + info.append(res.info) + for i in signers: + res = self.wallet[i].import_multisig_info(info) + assert res.n_outputs == expected_outputs + + def transfer(self, signers): + assert len(signers) >= 2 + + daemon = Daemon() + + print("Creating multisig transaction from wallet " + str(signers[0])) + + dst = {'address': '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'amount': 1000000000000} + res = self.wallet[signers[0]].transfer([dst]) + assert len(res.tx_hash) == 0 # not known yet + txid = res.tx_hash + assert len(res.tx_key) == 32*2 + assert res.amount > 0 + amount = res.amount + assert res.fee > 0 + fee = res.fee + assert len(res.tx_blob) == 0 + assert len(res.tx_metadata) == 0 + assert len(res.multisig_txset) > 0 + assert len(res.unsigned_txset) == 0 + multisig_txset = res.multisig_txset + + daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1) + for i in range(len(self.wallet)): + self.wallet[i].refresh() + + for i in range(len(signers[1:])): + print('Signing multisig transaction with wallet ' + str(signers[i+1])) + res = self.wallet[signers[i+1]].sign_multisig(multisig_txset) + multisig_txset = res.tx_data_hex + assert len(res.tx_hash_list if 'tx_hash_list' in res else []) == (i == len(signers[1:]) - 1) + + if i < len(signers[1:]) - 1: + print('Submitting multisig transaction prematurely with wallet ' + str(signers[-1])) + ok = False + try: self.wallet[signers[-1]].submit_multisig(multisig_txset) + except: ok = True + assert ok + + print('Submitting multisig transaction with wallet ' + str(signers[-1])) + res = self.wallet[signers[-1]].submit_multisig(multisig_txset) + assert len(res.tx_hash_list) == 1 + txid = res.tx_hash_list[0] + + for i in range(len(self.wallet)): + self.wallet[i].refresh() + res = self.wallet[i].get_transfers() + assert len([x for x in (res['pending'] if 'pending' in res else []) if x.txid == txid]) == (1 if i == signers[-1] else 0) + assert len([x for x in (res['out'] if 'out' in res else []) if x.txid == txid]) == 0 + + daemon.generateblocks('42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 1) + return txid + + def check_transaction(self, txid): + for i in range(len(self.wallet)): + self.wallet[i].refresh() + res = self.wallet[i].get_transfers() + assert len([x for x in (res['pending'] if 'pending' in res else []) if x.txid == txid]) == 0 + assert len([x for x in (res['out'] if 'out' in res else []) if x.txid == txid]) == 1 + + +class Guard: + def __enter__(self): + for i in range(4): + Wallet(idx = i).auto_refresh(False) + def __exit__(self, exc_type, exc_value, traceback): + for i in range(4): + Wallet(idx = i).auto_refresh(True) + +if __name__ == '__main__': + with Guard() as guard: + MultisigTest().run_test() diff --git a/tests/functional_tests/test_framework/wallet.py b/tests/functional_tests/test_framework/wallet.py index 4f2997cc4..270c95f82 100644 --- a/tests/functional_tests/test_framework/wallet.py +++ b/tests/functional_tests/test_framework/wallet.py @@ -237,6 +237,22 @@ class Wallet(object): } return self.rpc.send_json_rpc_request(restore_deterministic_wallet) + def generate_from_keys(self, restore_height = 0, filename = "", password = "", address = "", spendkey = "", viewkey = ""): + generate_from_keys = { + 'method': 'generate_from_keys', + 'params' : { + 'restore_height': restore_height, + 'filename': filename, + 'address': address, + 'spendkey': spendkey, + 'viewkey': viewkey, + 'password': password, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(generate_from_keys) + def close_wallet(self): close_wallet = { 'method': 'close_wallet', @@ -313,3 +329,156 @@ class Wallet(object): 'id': '0' } return self.rpc.send_json_rpc_request(split_integrated_address) + + def auto_refresh(self, enable, period = 0): + auto_refresh = { + 'method': 'auto_refresh', + 'params' : { + 'enable': enable, + 'period': period + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(auto_refresh) + + def set_daemon(self, address, trusted = False, ssl_support = "autodetect", ssl_private_key_path = "", ssl_certificate_path = "", ssl_allowed_certificates = [], ssl_allowed_fingerprints = [], ssl_allow_any_cert = False): + set_daemon = { + 'method': 'set_daemon', + 'params' : { + 'address': address, + 'trusted': trusted, + 'ssl_support': ssl_support, + 'ssl_private_key_path': ssl_private_key_path, + 'ssl_certificate_path': ssl_certificate_path, + 'ssl_allowed_certificates': ssl_allowed_certificates, + 'ssl_allowed_fingerprints': ssl_allowed_fingerprints, + 'ssl_allow_any_cert': ssl_allow_any_cert, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(set_daemon) + + def is_multisig(self): + is_multisig = { + 'method': 'is_multisig', + 'params' : { + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(is_multisig) + + def prepare_multisig(self): + prepare_multisig = { + 'method': 'prepare_multisig', + 'params' : { + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(prepare_multisig) + + def make_multisig(self, multisig_info, threshold, password = ''): + make_multisig = { + 'method': 'make_multisig', + 'params' : { + 'multisig_info': multisig_info, + 'threshold': threshold, + 'password': password, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(make_multisig) + + def exchange_multisig_keys(self, multisig_info, password = ''): + exchange_multisig_keys = { + 'method': 'exchange_multisig_keys', + 'params' : { + 'multisig_info': multisig_info, + 'password': password, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(exchange_multisig_keys) + + def export_multisig_info(self): + export_multisig_info = { + 'method': 'export_multisig_info', + 'params' : { + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(export_multisig_info) + + def import_multisig_info(self, info = []): + import_multisig_info = { + 'method': 'import_multisig_info', + 'params' : { + 'info': info + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(import_multisig_info) + + def sign_multisig(self, tx_data_hex): + sign_multisig = { + 'method': 'sign_multisig', + 'params' : { + 'tx_data_hex': tx_data_hex + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(sign_multisig) + + def submit_multisig(self, tx_data_hex): + submit_multisig = { + 'method': 'submit_multisig', + 'params' : { + 'tx_data_hex': tx_data_hex + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(submit_multisig) + + def sign_transfer(self, unsigned_txset, export_raw = False, get_tx_keys = False): + sign_transfer = { + 'method': 'sign_transfer', + 'params' : { + 'unsigned_txset': unsigned_txset, + 'export_raw': export_raw, + 'get_tx_keys': get_tx_keys, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(sign_transfer) + + def submit_transfer(self, tx_data_hex): + submit_transfer = { + 'method': 'submit_transfer', + 'params' : { + 'tx_data_hex': tx_data_hex, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(submit_transfer) + + def get_tx_key(self, txid): + get_tx_key = { + 'method': 'get_tx_key', + 'params' : { + 'txid': txid, + }, + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(get_tx_key) |