Beispiel #1
0
    def test_create_p2pk_script(self):
        template = self.templates['Pay-To-Public-Key']

        templates_vars = [
                {'Recipient': '0x03569988948d05ddf970d610bc52f0d47fb21ec307a35d3cbeba6d11accfcd3c6a'},
                {'Recipient': '03569988948d05ddf970d610bc52f0d47fb21ec307a35d3cbeba6d11accfcd3c6a'}
        ]

        for template_vars in templates_vars:
            script_out = script_gen.template_to_script(template, template_vars)
            self.assertEqual('0x03569988948d05ddf970d610bc52f0d47fb21ec307a35d3cbeba6d11accfcd3c6a OP_CHECKSIG', script_out)
Beispiel #2
0
    def test_create_p2pkh_script(self):
        template = self.templates['Pay-To-Public-Key-Hash Output']

        templates_vars = [
                {'Recipient': '1111111111111111111114oLvT2'},
                {'Recipient': '0' * 40},
                {'Recipient': '0x' + '0' * 40}
        ]

        for template_vars in templates_vars:
            script_out = script_gen.template_to_script(template, template_vars)
            self.assertEqual('OP_DUP OP_HASH160 0x0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG', script_out)
Beispiel #3
0
    def test_create_p2sh_sig_script(self):
        template = self.templates['Pay-To-Script-Hash Signature Script']

        templates_vars = [
                {'Signature': '0x304402200a156e3e5617cc1d795dfe0c02a5c7dab3941820f194eabd6107f81f25e0519102204d8c585635e03c9137b239893701dc280e25b162011e6474d0c9297d2650b46901',
                'RedeemScript': 'OP_1 0x0208b5b58fd9bf58f1d71682887182e7abd428756264442eec230dd021c193f8d9 0x0245af4f2b1ae21c9310a3211f8d5debb296175e20b3a14b173ff30428e03d502d OP_2 OP_CHECKMULTISIG'},
                {'Signature': '0x304402200a156e3e5617cc1d795dfe0c02a5c7dab3941820f194eabd6107f81f25e0519102204d8c585635e03c9137b239893701dc280e25b162011e6474d0c9297d2650b46901',
                'RedeemScript': '0x51210208b5b58fd9bf58f1d71682887182e7abd428756264442eec230dd021c193f8d9210245af4f2b1ae21c9310a3211f8d5debb296175e20b3a14b173ff30428e03d502d52ae'}
        ]

        for template_vars in templates_vars:
            script_out = script_gen.template_to_script(template, template_vars)
            self.assertEqual('0x304402200a156e3e5617cc1d795dfe0c02a5c7dab3941820f194eabd6107f81f25e0519102204d8c585635e03c9137b239893701dc280e25b162011e6474d0c9297d2650b46901 0x51210208b5b58fd9bf58f1d71682887182e7abd428756264442eec230dd021c193f8d9210245af4f2b1ae21c9310a3211f8d5debb296175e20b3a14b173ff30428e03d502d52ae', script_out)
Beispiel #4
0
    def test_op_return_script(self):
        template = self.templates['Null Output']
        template_vars = {'Text': 'testing'}

        script_out = script_gen.template_to_script(template, template_vars)
        self.assertEqual('OP_RETURN 0x74657374696e67', script_out)