[tests] don't override __init__() in individual tests
[bitcoinplatinum.git] / test / functional / signmessages.py
blob5fdfeceb76a0941ff2feb4da232190e775a92f90
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):
10 def set_test_params(self):
11 self.setup_clean_chain = True
12 self.num_nodes = 1
14 def run_test(self):
15 message = 'This is just a test message'
17 # Test the signing with a privkey
18 privKey = 'cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N'
19 address = 'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB'
20 signature = self.nodes[0].signmessagewithprivkey(privKey, message)
22 # Verify the message
23 assert(self.nodes[0].verifymessage(address, signature, message))
25 # Test the signing with an address with wallet
26 address = self.nodes[0].getnewaddress()
27 signature = self.nodes[0].signmessage(address, message)
29 # Verify the message
30 assert(self.nodes[0].verifymessage(address, signature, message))
32 if __name__ == '__main__':
33 SignMessagesTest().main()