def test_create_and_sign(self): collateral_pub = '02c59b76fabcfc146c75365da6475f33d8fa596ef76b4b301d66da74180c429c78' # XJtSNWxWufU5XAh59JfXPx9peodJwTqPqf delegate_pub = '03fa334250ddb2a51b30b31a98922a5e1c107042a482b68fc74999c6962ae3276e' # XMy7W6qnXjKQzjKCD4JpkNBccMXwqQdGjn protocol_version = 70103 ip = '0.0.0.0' port = 20000 addr = NetworkAddress(ip=ip, port=port) vin = { 'prevout_hash': '00' * 32, 'prevout_n': 0, 'scriptSig': '', 'sequence': 0xffffffff } last_ping = MasternodePing(vin=vin, block_hash='ff' * 32) announce = MasternodeAnnounce(vin=vin, addr=addr, collateral_key=collateral_pub, delegate_key=delegate_pub, protocol_version=protocol_version, last_ping=last_ping) collateral_wif = 'YV56icVrjNioXn9kpZeL3DvtC7aN7kt8tr5ur2wqpMaXeJ3YQirG' delegate_wif = 'YQ6GbE34bXDgMgJEEJ87Buri6MCCcCNZoozpc34ima1PBjKqA8fj' announce.last_ping.sign(delegate_wif, bfh(delegate_pub), 1461858375) sig = announce.sign(collateral_wif, 1461858375) address = 'XJtSNWxWufU5XAh59JfXPx9peodJwTqPqf' self.assertTrue(announce.verify(address)) self.assertTrue( bitcoin.verify_message(address, sig, announce.serialize_for_sig()))
def test_create_and_sign(self): collateral_pub = '038ae57bd0fa5b45640e771614ec571c7326a2266c78bb444f1971c85188411ba1' # XahPxwmCuKjPq69hzVxP18V1eASwDWbUrn delegate_pub = '02526201c87c1b4630aabbd04572eec3e2545e442503e57e60880fafcc1f684dbc' # Xx2nSdhaT7c9SREKBPAgzpkhu518XFgkgh protocol_version = 70103 ip = '0.0.0.0' port = 20000 addr = NetworkAddress(ip=ip, port=port) vin = { 'prevout_hash': '00' * 32, 'prevout_n': 0, 'scriptSig': '', 'sequence': 0xffffffff } last_ping = MasternodePing(vin=vin, block_hash='ff' * 32) announce = MasternodeAnnounce(vin=vin, addr=addr, collateral_key=collateral_pub, delegate_key=delegate_pub, protocol_version=protocol_version, last_ping=last_ping) collateral_wif = 'XJqCcyfnLYK4Y7ZDVjLrgPnsrq2cWMF6MX9cyhKgfMajwqrCwZaS' delegate_wif = 'XCbhXBc2N9q8kxqBF41rSuLWVpVVbDm7P1oPv9GxcrS9QXYBWZkB' announce.last_ping.sign(delegate_wif, bfh(delegate_pub), 1461858375) sig = announce.sign(collateral_wif, 1461858375) address = 'XahPxwmCuKjPq69hzVxP18V1eASwDWbUrn' self.assertTrue(announce.verify(address)) self.assertTrue( bitcoin.verify_message(address, sig, announce.serialize_for_sig()))
def test_create_and_sign(self): collateral_pub = '0218864d879997fefbb2846e54ac4db0df99029b91cd12be32312d7e0da45029a8' # PUFpXCipFhCM1n3CvY1pdJnsuBYGXopNoZ delegate_pub = '0329e04e958045a2866e59d13423772e16551cc1bedc50adb0e10b33ae28146cfc' # P9h6zCz253jmc4TvqgKPRNpkx5qELdNWWT protocol_version = 70103 ip = '0.0.0.0' port = 20000 addr = NetworkAddress(ip=ip, port=port) vin = { 'prevout_hash': '00' * 32, 'prevout_n': 0, 'scriptSig': '', 'sequence': 0xffffffff } last_ping = MasternodePing(vin=vin, block_hash='ff' * 32) announce = MasternodeAnnounce(vin=vin, addr=addr, collateral_key=collateral_pub, delegate_key=delegate_pub, protocol_version=protocol_version, last_ping=last_ping) collateral_wif = 'XDL8kYsDheEviC7EYMNbo3Myy1txzKyfhZFZBaYUSPDPm9BZZae8' delegate_wif = 'XFsDL1FgC4VWQWZQu1NZAs5ri1rUP8mu1CviQYBbXedBTK37uppF' announce.last_ping.sign(delegate_wif, bfh(delegate_pub), 1461858375) sig = announce.sign(collateral_wif, 1461858375) address = 'PUFpXCipFhCM1n3CvY1pdJnsuBYGXopNoZ' self.assertTrue(announce.verify(address)) self.assertTrue( ecc.verify_message_with_address(address, sig, announce.serialize_for_sig()))