Remove unused Python imports
[bitcoinplatinum.git] / test / functional / signmessages.py
blob42f6a9daaf1fd7c7bc9f22c6e38592072f050798
1 #!/usr/bin/env python3
2 # Copyright (c) 2016 The Bitcoin Core developers
3 # Distributed under the MIT software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 """Test RPC commands for signing and verifying messages."""
7 from test_framework.test_framework import BitcoinTestFramework
9 class SignMessagesTest(BitcoinTestFramework):
11 def __init__(self):
12 super().__init__()
13 self.setup_clean_chain = True
14 self.num_nodes = 1
16 def run_test(self):
17 message = 'This is just a test message'
19 # Test the signing with a privkey
20 privKey = 'cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N'
21 address = 'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB'
22 signature = self.nodes[0].signmessagewithprivkey(privKey, message)
24 # Verify the message
25 assert(self.nodes[0].verifymessage(address, signature, message))
27 # Test the signing with an address with wallet
28 address = self.nodes[0].getnewaddress()
29 signature = self.nodes[0].signmessage(address, message)
31 # Verify the message
32 assert(self.nodes[0].verifymessage(address, signature, message))
34 if __name__ == '__main__':
35 SignMessagesTest().main()