def test_cvc_to_ltc_exch(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)

        # POST this to https://cors.shapeshift.io/sendamountProto2
        # {
        #    'depositAmount': '100',
        #    'withdrawal': 'LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V',
        #    'pair': 'CVC_LTC',
        #    'returnAddress': '0x3f2329c9adfbccd9a84f52c906e936a42da18cb8',
        #    'apiKey': '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
        #}

        signed_exchange_out1 = proto_exchange.SignedExchangeResponse()
        signed_exchange_out1.ParseFromString(
            binascii.unhexlify(
                '12411f868812f620b6baaa5699b28ba3c3d39626b3620298410b0357aeda5616fe162d270817b6699b9c96a175ab8b6308486727157602befc6ab47b1473436bc2c4f01a83020a310a03637663122a307831643863653930323266363238346333613563333137663866333436323031303732313465353435120502540be400189aa2f8ddf52c220302e5512a290a036c746312224c6876786b6b774d436a4441777970724e48685957385045396f4e66367753643256320401206eac3a310a03637663122a30783366323332396339616466626363643961383466353263393036653933366134326461313863623842406ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b4a030124f852109a8a4233bf254d6295850bc4c4fc82ce'
            ))

        exchange_type_out1 = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out1,
            withdrawal_coin_name='Litecoin',
            withdrawal_address_n=[2147483692, 2147483650, 2147483649, 0, 1],
            return_address_n=[2147483692, 2147483708, 2147483648, 0, 0])

        sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692, 2147483708, 2147483648, 0, 0],
            nonce=1,
            gas_price=20,
            gas_limit=20,
            value=0,
            to=binascii.unhexlify('41e5560054824ea6b0732e656e3ad64e20e94e45'),
            address_type=3,
            exchange_type=exchange_type_out1,
            chain_id=1,
            data=binascii.unhexlify(
                'a9059cbb000000000000000000000000' +
                '1d8ce9022f6284c3a5c317f8f34620107214e545' +
                '00000000000000000000000000000000000000000000000000000002540be400'
            ))

        self.assertEqual(sig_v, 37)
        self.assertEqual(
            binascii.hexlify(sig_r),
            '1238fd332545415f09a01470350a5a20abc784dbf875cf58f7460560e66c597f')
        self.assertEqual(
            binascii.hexlify(sig_s),
            '10efa4dd6fdb381c317db8f815252c2ac0d2a883bd364901dee3dec5b7d3660a')
        self.assertEqual(
            binascii.hexlify(hash),
            '3878462365df8bd2253c72dfe6e5cb744c64915e23fd5556f7077e43950a1afd')
        self.assertEqual(
            binascii.hexlify(signature_der),
            '304402201238fd332545415f09a01470350a5a20abc784dbf875cf58f7460560e66c597f022010efa4dd6fdb381c317db8f815252c2ac0d2a883bd364901dee3dec5b7d3660a'
        )

        #reset policy ('ShapeShift')
        self.client.apply_policy('ShapeShift', 0)
コード例 #2
0
    def test_ethereum_exch_signature_error1(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)

        signed_exchange_out1=proto_exchange.SignedExchangeResponse(
                                responseV2=proto_exchange.ExchangeResponseV2(
                                         withdrawal_amount=binascii.unhexlify('01a69189'),
                                         withdrawal_address=proto_exchange.ExchangeAddress(
                                                coin_type='ltc',
                                                address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V') ,

                                         deposit_amount=binascii.unhexlify('02076f02a152b400'),
                                         deposit_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x8cfbb7ef910936ac801e4d07ae46599041206743') ,

                                         return_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3f2329c9adfbccd9a84f52c906e936a42da18cb8') ,

                                         expiration=1480984776874,
                                         quoted_rate=binascii.unhexlify('0b54a1d6'),

                                         api_key=binascii.unhexlify('6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'),
                                         miner_fee=binascii.unhexlify('0186a0'),
                                         order_id=binascii.unhexlify('1924ae6635e34cdca8137861434d9ede'),
                                         ),
                                signature=binascii.unhexlify('0f61697158580925b64ba9b93677a47f996deac9529d98e15ee90fcc240b098ab84f2324a4ccab092a38f8720537636ef1d012903ac27697f184cc43269975a420')
                             )
        exchange_type_out1=proto_types.ExchangeType(
                              signed_exchange_response=signed_exchange_out1,
                              withdrawal_coin_name='Litecoin',
                              withdrawal_address_n=[2147483692,2147483650,2147483649,0,1],
                              return_address_n=[2147483692,2147483708,2147483648,0,0]
                            )

        try:
            sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692,2147483708,2147483648,0,0],
            nonce=01,
            gas_price=20,
            gas_limit=20,
            to=binascii.unhexlify('8cfbb7ef910936ac801e4d07ae46599041206743'),
            value=146207570000000000,
            address_type=3,
            exchange_type=exchange_type_out1,
            )
        except CallException as e:
            self.assertEndsWith(e.args[1], 'Exchange signature error')
            print "Negative Test Passed (test_ethereum_exch_signature_error1)!"
        else:
            self.assert_(False, "Failed to detect error condition")

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #3
0
    def test_eth_to_doge_exch(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)

        signed_exchange_out1=proto_exchange.SignedExchangeResponse(
                                responseV2=proto_exchange.ExchangeResponseV2(
                                         withdrawal_amount=binascii.unhexlify('6d4dc95317'),
                                         withdrawal_address=proto_exchange.ExchangeAddress(
                                                coin_type='doge',
                                                address='DQTjL9vfXVbMfCGM49KWeYvvvNzRPaoiFp') ,

                                         deposit_amount=binascii.unhexlify('02076f02a152b400'),
                                         deposit_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3d55d68b75d98ac3ac0d2ddf61554f00703d6357') ,

                                         return_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3f2329c9adfbccd9a84f52c906e936a42da18cb8') ,

                                         expiration=1480978325881,
                                         quoted_rate=binascii.unhexlify('02ebe9834161'),

                                         api_key=binascii.unhexlify('6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'),
                                         miner_fee=binascii.unhexlify('0bebc200'),
#                                         order_id=binascii.unhexlify('4a2320f8267b4b739fa452196d320abb'),
                                         order_id=binascii.unhexlify('4a2320f8267b4b739fa452196d320abb'),
                                         ),
                                signature=binascii.unhexlify('207f69cf0569f81d5758efb8f2e186e35bc84ce37ab198f88ef31342ef5213072942d063fb159aa7546dc7a8e72fc6d57932b0fcc62289bbf949ca508fea5e0e0c')
                             )
        exchange_type_out1=proto_types.ExchangeType(
                              signed_exchange_response=signed_exchange_out1,
                              withdrawal_coin_name='Dogecoin',
                              withdrawal_address_n=[2147483692,2147483651,2147483648,0,0],
                              return_address_n=[2147483692,2147483708,2147483648,0,0],
                            )
        sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692,2147483708,2147483648,0,0],
            nonce=01,
            gas_price=20,
            gas_limit=20,
            to=binascii.unhexlify('3d55d68b75d98ac3ac0d2ddf61554f00703d6357'),
            value=146207570000000000,
            address_type=3,
            exchange_type=exchange_type_out1,
            chain_id=1
            )

        self.assertEqual(sig_v, 37)
        self.assertEqual(binascii.hexlify(sig_r), '2b7623371374071496b9959ba027d69151d4f564bfe8839f03384891f6f739af')
        self.assertEqual(binascii.hexlify(sig_s), '3f2e154f3347f9f9f159fb852d5bda91debbdb5474271cbc0eb1ee0607275dc8')
        self.assertEqual(binascii.hexlify(hash), '45d16457804a1c60774c74d3c0c4345a8a5d92d4661e24e6f4722d644e3011aa')
        self.assertEqual(binascii.hexlify(signature_der), '304402202b7623371374071496b9959ba027d69151d4f564bfe8839f03384891f6f739af02203f2e154f3347f9f9f159fb852d5bda91debbdb5474271cbc0eb1ee0607275dc8')

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #4
0
    def test_exchange_src(self):
        self.requires_firmware("6.3.0")
        self.setup_mnemonic_nopin_nopassphrase()

        signed_exchange_out = proto_exchange.SignedExchangeResponse(
            responseV2=proto_exchange.ExchangeResponseV2(
                withdrawal_amount=unhexlify('03cfd863'),
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V'),
                deposit_amount=unhexlify('0186a0'),  # 100000 uATOM
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='atom',
                    address='cosmos18vhdczjut44gpsy804crfhnd5nq003nz0nf20v'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='atom',
                    address='cosmos15cenya0tr7nm3tz2wn3h3zwkht2rxrq7q7h3dj'),
                expiration=1480964590181,
                quoted_rate=unhexlify('04f89e60b8'),
                api_key=unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=unhexlify('0186a0'),  #100000
                order_id=unhexlify('b026bddb3e74470bbab9146c4db58019'),
            ),
            signature='FAKE_SIG')

        exchange_type_out = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out,
            withdrawal_coin_name='Litecoin',
            withdrawal_address_n=parse_path("m/44'/2'/1'/0/1"),
            return_address_n=parse_path("m/44'/118'/0'/0/0"))

        signature = self.client.cosmos_sign_tx(
            address_n=parse_path(DEFAULT_BIP32_PATH),
            account_number=19637,
            chain_id="cosmoshub-2",
            fee=5000,
            gas=200000,
            msgs=[
                make_send("cosmos15cenya0tr7nm3tz2wn3h3zwkht2rxrq7q7h3dj",
                          "cosmos18vhdczjut44gpsy804crfhnd5nq003nz0nf20v",
                          100000)
            ],
            memo=None,
            sequence=3,
            exchange_types=[exchange_type_out])

        self.assertEqual(
            hexlify(signature.signature),
            "4a200cc240df784ac19d1c51ee1ea47c8e257327dd3a3c4ff89d90cbba861b711d3a61929ce3c41e68c4722e63e6a60d553c46b82e9dac3b1f6ad9382b508ccf"
        )
        self.assertEqual(
            hexlify(signature.public_key),
            "03bee3af30e53a73f38abc5a2fcdac426d7b04eb72a8ebd3b01992e2d206e24ad8"
        )
コード例 #5
0
    def test_eth_to_ltc_exch(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)

        signed_exchange_out1=proto_exchange.SignedExchangeResponse(
                                responseV2=proto_exchange.ExchangeResponseV2(
                                         withdrawal_amount=binascii.unhexlify('01a69189'),
                                         withdrawal_address=proto_exchange.ExchangeAddress(
                                                coin_type='ltc',
                                                address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V') ,

                                         deposit_amount=binascii.unhexlify('02076f02a152b400'),
                                         deposit_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x8cfbb7ef910936ac801e4d07ae46599041206743') ,

                                         return_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3f2329c9adfbccd9a84f52c906e936a42da18cb8') ,

                                         expiration=1480984776874,
                                         quoted_rate=binascii.unhexlify('0b54a1d6'),

                                         api_key=binascii.unhexlify('6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'),
                                         miner_fee=binascii.unhexlify('0186a0'),
                                         order_id=binascii.unhexlify('1924ae6635e34cdca8137861434d9ede'),
                                         ),
                                signature=binascii.unhexlify('1f61697158580925b64ba9b93677a47f996deac9529d98e15ee90fcc240b098ab84f2324a4ccab092a38f8720537636ef1d012903ac27697f184cc43269975a420')
                             )
        exchange_type_out1=proto_types.ExchangeType(
                              signed_exchange_response=signed_exchange_out1,
                              withdrawal_coin_name='Litecoin',
                              withdrawal_address_n=[2147483692,2147483650,2147483649,0,1],
                              return_address_n=[2147483692,2147483708,2147483648,0,0]
                            )
        sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692,2147483708,2147483648,0,0],
            nonce=01,
            gas_price=20,
            gas_limit=20,
            to=binascii.unhexlify('8cfbb7ef910936ac801e4d07ae46599041206743'),
            value=146207570000000000,
            address_type=3,
            exchange_type=exchange_type_out1,
            chain_id=1,
            )

        self.assertEqual(sig_v, 37)
        self.assertEqual(binascii.hexlify(sig_r), 'b7b42e5eb594a991584264120e94aa82ddfa8d666a86ee71365894fca9f5b716')
        self.assertEqual(binascii.hexlify(sig_s), '24490cada2437842c9825aadebaefd1e5e14cd2dfc5dc45eec1bb868f45f37e6')
        self.assertEqual(binascii.hexlify(hash), '8315baffd719590fd7e0b2337c6a0ec7a0a3b4c46008413a58a1a2c219ffb55c')
        self.assertEqual(binascii.hexlify(signature_der), '3045022100b7b42e5eb594a991584264120e94aa82ddfa8d666a86ee71365894fca9f5b716022024490cada2437842c9825aadebaefd1e5e14cd2dfc5dc45eec1bb868f45f37e6')

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #6
0
    def test_eth_to_doge_exch(self):
        self.setup_mnemonic_nopin_nopassphrase()
	self.client.apply_policy('ShapeShift', 1)

        signed_exchange_out1=proto_exchange.SignedExchangeResponse(
                                responseV2=proto_exchange.ExchangeResponseV2(
                                         withdrawal_amount=binascii.unhexlify('6d4dc95317'),
                                         withdrawal_address=proto_exchange.ExchangeAddress(
                                                coin_type='doge',
                                                address='DQTjL9vfXVbMfCGM49KWeYvvvNzRPaoiFp') ,
  
                                         deposit_amount=binascii.unhexlify('02076f02a152b400'),
                                         deposit_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3d55d68b75d98ac3ac0d2ddf61554f00703d6357') ,

                                         return_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3f2329c9adfbccd9a84f52c906e936a42da18cb8') ,

                                         expiration=1480978325881,
                                         quoted_rate=binascii.unhexlify('02ebe9834161'),

                                         api_key=binascii.unhexlify('6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'),
                                         miner_fee=binascii.unhexlify('0bebc200'),
#                                         order_id=binascii.unhexlify('4a2320f8267b4b739fa452196d320abb'),
                                         order_id=binascii.unhexlify('4a2320f8267b4b739fa452196d320abb'),
                                         ),
                                signature=binascii.unhexlify('207f69cf0569f81d5758efb8f2e186e35bc84ce37ab198f88ef31342ef5213072942d063fb159aa7546dc7a8e72fc6d57932b0fcc62289bbf949ca508fea5e0e0c')
                             )
        exchange_type_out1=proto_types.ExchangeType(
                              signed_exchange_response=signed_exchange_out1,
                              withdrawal_coin_name='Dogecoin',
                              withdrawal_address_n=[2147483692,2147483651,2147483648,0,0],
                              return_address_n=[2147483692,2147483708,2147483648,0,0],
                            )
        sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692,2147483708,2147483648,0,0],
            nonce=01,
            gas_price=20,
            gas_limit=20,
            to=binascii.unhexlify('3d55d68b75d98ac3ac0d2ddf61554f00703d6357'),
            value=146207570000000000,
            address_type=3,
            exchange_type=exchange_type_out1,
            )

        self.assertEqual(sig_v, 27)
        self.assertEqual(binascii.hexlify(sig_r), '442ef56b78c8ea8a0764fdb5527dc3f18086a8b672eefdee7249b5c661a584c6')
        self.assertEqual(binascii.hexlify(sig_s), '15a25a0704e46be3f60339443ce9183ac7193cbd7a49c564d14ffc41b571657a')
        self.assertEqual(binascii.hexlify(hash), 'ff73eec0846adace28b29aad84e53f97360e843947a079e7aeaaeb2fd92c9675')
        self.assertEqual(binascii.hexlify(signature_der), '30440220442ef56b78c8ea8a0764fdb5527dc3f18086a8b672eefdee7249b5c661a584c6022015a25a0704e46be3f60339443ce9183ac7193cbd7a49c564d14ffc41b571657a')

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #7
0
    def test_eth_to_ltc_exch(self):
        self.setup_mnemonic_nopin_nopassphrase()
	self.client.apply_policy('ShapeShift', 1)

        signed_exchange_out1=proto_exchange.SignedExchangeResponse(
                                responseV2=proto_exchange.ExchangeResponseV2(
                                         withdrawal_amount=binascii.unhexlify('01a69189'),
                                         withdrawal_address=proto_exchange.ExchangeAddress(
                                                coin_type='ltc',
                                                address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V') ,
  
                                         deposit_amount=binascii.unhexlify('02076f02a152b400'),
                                         deposit_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x8cfbb7ef910936ac801e4d07ae46599041206743') ,

                                         return_address=proto_exchange.ExchangeAddress(
                                                coin_type='eth',
                                                address='0x3f2329c9adfbccd9a84f52c906e936a42da18cb8') ,

                                         expiration=1480984776874,
                                         quoted_rate=binascii.unhexlify('0b54a1d6'),

                                         api_key=binascii.unhexlify('6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'),
                                         miner_fee=binascii.unhexlify('0186a0'),
                                         order_id=binascii.unhexlify('1924ae6635e34cdca8137861434d9ede'),
                                         ),
                                signature=binascii.unhexlify('1f61697158580925b64ba9b93677a47f996deac9529d98e15ee90fcc240b098ab84f2324a4ccab092a38f8720537636ef1d012903ac27697f184cc43269975a420')
                             )
        exchange_type_out1=proto_types.ExchangeType(
                              signed_exchange_response=signed_exchange_out1,
                              withdrawal_coin_name='Litecoin',
                              withdrawal_address_n=[2147483692,2147483650,2147483649,0,1],
                              return_address_n=[2147483692,2147483708,2147483648,0,0]
                            )
        sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692,2147483708,2147483648,0,0],
            nonce=01,
            gas_price=20,
            gas_limit=20,
            to=binascii.unhexlify('8cfbb7ef910936ac801e4d07ae46599041206743'),
            value=146207570000000000,
            address_type=3,
            exchange_type=exchange_type_out1,
            )

        self.assertEqual(sig_v, 27)
        self.assertEqual(binascii.hexlify(sig_r), 'b82354764f4a206507365e63c40182748948624bb9e62651e1f1121f3a9f9095')
        self.assertEqual(binascii.hexlify(sig_s), '53b582ea05874f87eb84d8256248ff16cab872ba585305eaa9ba4d732df7b2d5')
        self.assertEqual(binascii.hexlify(hash), 'ac4f6a5e7f2543ad921029a805ddf07480aaf708811645ae9e0116d6bf87a284')
        self.assertEqual(binascii.hexlify(signature_der), '3045022100b82354764f4a206507365e63c40182748948624bb9e62651e1f1121f3a9f9095022053b582ea05874f87eb84d8256248ff16cab872ba585305eaa9ba4d732df7b2d5')

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #8
0
    def test_return_address_error(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)
        # tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
        # input 0: 0.0039 BTC
        inp1 = proto_types.TxInputType(
            address_n=[0],  # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
            # amount=390000,
            prev_hash=binascii.unhexlify(
                'd5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'
            ),
            prev_index=0,
        )

        signed_exchange_out1 = proto_exchange.SignedExchangeResponse(
            responseV2=proto_exchange.ExchangeResponseV2(
                withdrawal_amount=binascii.unhexlify('03cfd863'),
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V'),
                deposit_amount=binascii.unhexlify('0493e0'),  #300000
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='btc',
                    address='1EtCKS5SxoPeNnzrAjFpuNruBmq8EHvqdt'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='btc',
                    address='15jYdch7oghoPFDBQz8XDerbL382aT4U9e'),
                expiration=1480964590181,
                quoted_rate=binascii.unhexlify('04f89e60b8'),
                api_key=binascii.unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=binascii.unhexlify('0186a0'),  #100000
                order_id=binascii.unhexlify(
                    'b026bddb3e74470bbab9146c4db58019'),
            ),
            signature=binascii.unhexlify(
                '1fd1f3bdb3ebd7b82956d5422352fa1a10d27b361f65b2293436a5c5059c3c9f1e4eb30632cce2511d0c892cdbe0cb28347a5d8d800eba1248fc71aa5b6379da5a'
            ))

        exchange_type_out1 = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out1,
            withdrawal_coin_name='Litecoin',
            withdrawal_address_n=[2147483692, 2147483650, 2147483649, 0, 1],
            return_address_n=[2147483692, 2147483648, 2147483648, 0, 5]
            #error -^-
        )
        # Exhange Output address
        out1 = proto_types.TxOutputType(
            amount=300000,
            address='1EtCKS5SxoPeNnzrAjFpuNruBmq8EHvqdt',
            script_type=proto_types.PAYTOADDRESS,
            address_type=3,
            exchange_type=exchange_type_out1,
        )
        try:
            self.client.sign_tx('Bitcoin', [
                inp1,
            ], [
                out1,
            ])
        except CallException as e:
            self.assertEndsWith(e.args[1], 'Exchange return address error')
        else:
            self.assert_(False, "Failed to detect error condition")

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #9
0
    def test_ltc_to_eth_exchange(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)
        # tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
        # input 0: 0.0039 BTC
        inp1 = proto_types.TxInputType(
            address_n=[0],  # 175AmUerJ2wxKmyMTWdTbeoFh3o4a5dmDJ  
            # amount=2276970000000, ($22769.70)
            prev_hash=binascii.unhexlify(
                '4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c'
            ),
            prev_index=0,
        )

        signed_exchange_out1 = proto_exchange.SignedExchangeResponse(
            responseV2=proto_exchange.ExchangeResponseV2(
                withdrawal_amount=binascii.unhexlify('01d23650d8380800'),
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='eth',
                    address='0x3f2329c9adfbccd9a84f52c906e936a42da18cb8'),
                deposit_amount=binascii.unhexlify('01ccec55'),
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LfbEZX7Q88zDxXJ8meuc8YKJTDCFeW51F3'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LQgMuyB7VMKB4NrEv5YwcBfbbwXgwH2uFD'),
                expiration=1481074750525,
                quoted_rate=binascii.unhexlify('067d0007d7b2f400'),
                api_key=binascii.unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=binascii.unhexlify('2386f26fc10000'),
                order_id=binascii.unhexlify(
                    'b168e4ff7d634e35b2bba38ed2ba3098'),
            ),
            signature=binascii.unhexlify(
                '20b6a7c44f261906eba11ffae4a160f8ff98a8806ff9b2e233734aaa8f673ca0e401103c60660a57cf778a9078fa8b8cd586af5a94cd8284ffd9e285507b8e6bb9'
            ))

        exchange_type_out1 = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out1,
            withdrawal_coin_name='Ethereum',
            withdrawal_address_n=[2147483692, 2147483708, 2147483648, 0, 0],
            return_address_n=[2147483692, 2147483650, 2147483649, 0, 2])
        # Exhange Output address
        out1 = proto_types.TxOutputType(
            amount=30207061,
            address='LfbEZX7Q88zDxXJ8meuc8YKJTDCFeW51F3',
            script_type=proto_types.PAYTOADDRESS,
            address_type=3,
            exchange_type=exchange_type_out1,
        )
        with self.client:
            self.client.set_tx_api(tx_api.TxApiBitcoin)
            self.client.set_expected_responses([
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(
                    request_type=proto_types.TXMETA,
                    details=proto_types.
                    TxRequestDetailsType(tx_hash=binascii.unhexlify(
                        "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                    ))),
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=0,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=1,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=0,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=1,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=2,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=3,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=4,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=5,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=6,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=7,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=8,
                        tx_hash=binascii.unhexlify(
                            "4a405a771b1c16af9059e01aa1de19ae1e143da6a5a8d130d1591875a93f9e0c"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.ButtonRequest(
                    code=proto_types.ButtonRequest_SignExchange),
                proto.ButtonRequest(
                    code=proto_types.ButtonRequest_ConfirmOutput),
                proto.ButtonRequest(
                    code=proto_types.ButtonRequest_FeeOverThreshold),
                proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx),
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(request_type=proto_types.TXFINISHED),
            ])

            self.client.sign_tx('Litecoin', [
                inp1,
            ], [
                out1,
            ])

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #10
0
    def test_ltc_to_btc_return_address_error(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)
        # tx: 08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2
        # input 0: 5.83579345 BTC

        inp1 = proto_types.TxInputType(
            address_n=[0],  # 1rExUsv6RScHtQiLeSUv4ERGaAdxJTmDg  
            # amount=583579345,
            prev_hash=binascii.unhexlify(
                '08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2'
            ),
            prev_index=0,
        )

        signed_exchange_out1 = proto_exchange.SignedExchangeResponse(
            response=proto_exchange.ExchangeResponse(
                withdrawal_amount=533594,
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='btc',
                    address='19nkmC2y4Rq3DXia7Um5YW9hxkRhwA5ABN'),
                deposit_amount=90000000,
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LiZ9EjjyZYuKdkBSqzc7ZVHNQPubcUKuNC'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V'),
                expiration=1471629998149,
                quoted_rate=626216,
                api_key=binascii.unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=30000,
                order_id=binascii.unhexlify(
                    'bfe3a6b0afc64126a4d47612d229debf'),
            ),
            signature=binascii.unhexlify(
                '20cb8e122ab35ea5d7e4344ce57f1da9d3deba6f19178c5e7184fb2091a3101848784035d315ccff7282d08dc018686b583f794f8b6f0ad006d8423df6b85e2977'
            ))

        exchange_type_out1 = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out1,
            withdrawal_coin_name='Bitcoin',
            withdrawal_address_n=[2147483692, 2147483648, 2147483649, 0, 3],
            return_address_n=[2147483692, 2147483650, 2147483649, 0,
                              2],  #error added here!
        )
        # Exhange Output address
        out1 = proto_types.TxOutputType(
            amount=90000000,
            address='LiZ9EjjyZYuKdkBSqzc7ZVHNQPubcUKuNC',
            script_type=proto_types.PAYTOADDRESS,
            address_type=3,
            exchange_type=exchange_type_out1,
        )

        try:
            self.client.sign_tx('Litecoin', [
                inp1,
            ], [
                out1,
            ])  # << error added here!!!
        except CallException as e:
            self.assertEqual(e.args[1], 'Exchange return address error')
            print "Negative Test Passed (test_ltc_to_btc_return_address_error)!"
        else:
            self.assert_(False, "Failed to detect error condition")

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #11
0
    def test_ltc_to_btc_exchange(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)
        # tx: 08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2
        # input 0: 5.83579345 BTC

        print "This is a test"
        inp1 = proto_types.TxInputType(
            address_n=[0],  # 1rExUsv6RScHtQiLeSUv4ERGaAdxJTmDg  
            # amount=583579345,
            prev_hash=binascii.unhexlify(
                '08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2'
            ),
            prev_index=0,
        )

        signed_exchange_out1 = proto_exchange.SignedExchangeResponse(
            response=proto_exchange.ExchangeResponse(
                withdrawal_amount=533594,
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='btc',
                    address='19nkmC2y4Rq3DXia7Um5YW9hxkRhwA5ABN'),
                deposit_amount=90000000,
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LiZ9EjjyZYuKdkBSqzc7ZVHNQPubcUKuNC'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LhvxkkwMCjDAwyprNHhYW8PE9oNf6wSd2V'),
                expiration=1471629998149,
                quoted_rate=626216,
                api_key=binascii.unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=30000,
                order_id=binascii.unhexlify(
                    'bfe3a6b0afc64126a4d47612d229debf'),
            ),
            signature=binascii.unhexlify(
                '20cb8e122ab35ea5d7e4344ce57f1da9d3deba6f19178c5e7184fb2091a3101848784035d315ccff7282d08dc018686b583f794f8b6f0ad006d8423df6b85e2977'
            ))

        exchange_type_out1 = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out1,
            withdrawal_coin_name='Bitcoin',
            withdrawal_address_n=[2147483692, 2147483648, 2147483649, 0, 3],
            return_address_n=[2147483692, 2147483650, 2147483649, 0, 1],
        )
        # Exhange Output address
        out1 = proto_types.TxOutputType(
            amount=90000000,
            address='LiZ9EjjyZYuKdkBSqzc7ZVHNQPubcUKuNC',
            script_type=proto_types.PAYTOADDRESS,
            address_type=3,
            exchange_type=exchange_type_out1,
        )

        with self.client:
            self.client.set_expected_responses([
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(
                    request_type=proto_types.TXMETA,
                    details=proto_types.
                    TxRequestDetailsType(tx_hash=binascii.unhexlify(
                        "08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2"
                    ))),
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=0,
                        tx_hash=binascii.unhexlify(
                            "08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=0,
                        tx_hash=binascii.unhexlify(
                            "08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(
                        request_index=1,
                        tx_hash=binascii.unhexlify(
                            "08ebb7932ff4cd631f82e999b4d2f4dba119a8519991f7d13cbf12dfb3d7f3b2"
                        ))),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.ButtonRequest(
                    code=proto_types.ButtonRequest_SignExchange),
                proto.ButtonRequest(
                    code=proto_types.ButtonRequest_FeeOverThreshold),
                proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx),
                proto.TxRequest(
                    request_type=proto_types.TXINPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(
                    request_type=proto_types.TXOUTPUT,
                    details=proto_types.TxRequestDetailsType(request_index=0)),
                proto.TxRequest(request_type=proto_types.TXFINISHED),
            ])

            self.client.sign_tx('Litecoin', [
                inp1,
            ], [
                out1,
            ])

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #12
0
    def test_return_address_error(self):
        self.setup_mnemonic_nopin_nopassphrase()
        self.client.apply_policy('ShapeShift', 1)
        # tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882
        # input 0: 0.0039 BTC
        inp1 = proto_types.TxInputType(
            address_n=[0],  # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
            # amount=390000,
            prev_hash=binascii.unhexlify(
                'd5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'
            ),
            prev_index=0,
        )

        signed_exchange_out1 = proto_exchange.SignedExchangeResponse(
            response=proto_exchange.ExchangeResponse(
                withdrawal_amount=47535135,
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='ltc',
                    address='LgCD3vmz2TkYGbaDDy1YRyT4JwL95XpYPw'),
                deposit_amount=300000,
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='btc',
                    address='1AJaZuL6heuX8SJEthckaKKQPu2EbDMR3U'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='btc',
                    address='19nkmC2y4Rq3DXia7Um5YW9hxkRhwA5ABN'),
                expiration=1471627016859,
                quoted_rate=15878378378,
                api_key=binascii.unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=100000,
                order_id=binascii.unhexlify(
                    'f1c9ace477f04af79bcbc62f3756ae08'),
            ),
            signature=binascii.unhexlify(
                '1f3d840f06670c1688377255dbe5cfc53f8de8628aed7a73a09718d058aae4a13e24baf1b83838ffc580e1b9a0f479663027c14ab6da7069311a7c554157857680'
            ))

        exchange_type_out1 = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out1,
            withdrawal_coin_name='Litecoin',
            withdrawal_address_n=[2147483692, 2147483650, 2147483648, 0, 1],
            return_address_n=[2147483692, 2147483648, 2147483649, 0,
                              4],  # <<< error added here!!! 
        )
        # Exhange Output address
        out1 = proto_types.TxOutputType(
            amount=300000,
            address='1AJaZuL6heuX8SJEthckaKKQPu2EbDMR3U',
            script_type=proto_types.PAYTOADDRESS,
            address_type=3,
            exchange_type=exchange_type_out1,
        )

        try:
            self.client.sign_tx('Bitcoin', [
                inp1,
            ], [
                out1,
            ])
        except CallException as e:
            self.assertEqual(e.args[1], 'Exchange return address error')
            print "Negative Test Passed (test_return_address_error)!"
        else:
            self.assert_(False, "Failed to detect error condition")

        #reset policy ("ShapeShift")
        self.client.apply_policy('ShapeShift', 0)
コード例 #13
0
    def test_exchange_dst(self):
        self.requires_firmware("6.3.0")
        self.setup_mnemonic_nopin_nopassphrase()

        signed_exchange_out = proto_exchange.SignedExchangeResponse(
            responseV2=proto_exchange.ExchangeResponseV2(
                withdrawal_amount=unhexlify('03cfd863'),
                withdrawal_address=proto_exchange.ExchangeAddress(
                    coin_type='atom',
                    address='cosmos15cenya0tr7nm3tz2wn3h3zwkht2rxrq7q7h3dj'),
                deposit_amount=unhexlify(
                    '00000000000000000000000000000000000000000000000000000002540be400'
                ),
                deposit_address=proto_exchange.ExchangeAddress(
                    coin_type='cvc',
                    address='0x1d8ce9022f6284c3a5c317f8f34620107214e545'),
                return_address=proto_exchange.ExchangeAddress(
                    coin_type='cvc',
                    address='0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8'),
                expiration=1480964590181,
                quoted_rate=unhexlify('04f89e60b8'),
                api_key=unhexlify(
                    '6ad5831b778484bb849da45180ac35047848e5cac0fa666454f4ff78b8c7399fea6a8ce2c7ee6287bcd78db6610ca3f538d6b3e90ca80c8e6368b6021445950b'
                ),
                miner_fee=unhexlify('0186a0'),  #100000
                order_id=unhexlify('b026bddb3e74470bbab9146c4db58019'),
            ),
            signature='FAKE_SIG')

        exchange_type_out = proto_types.ExchangeType(
            signed_exchange_response=signed_exchange_out,
            withdrawal_coin_name='Cosmos',
            withdrawal_address_n=parse_path("m/44'/118'/0'/0/0"),
            return_address_n=parse_path("m/44'/60'/0'/0/0"))

        sig_v, sig_r, sig_s, hash, signature_der = self.client.ethereum_sign_tx(
            n=[2147483692, 2147483708, 2147483648, 0, 0],
            nonce=01,
            gas_price=20,
            gas_limit=20,
            value=0,
            to=unhexlify('41e5560054824ea6b0732e656e3ad64e20e94e45'),
            address_type=3,
            exchange_type=exchange_type_out,
            chain_id=1,
            data=unhexlify(
                'a9059cbb000000000000000000000000' +
                '1d8ce9022f6284c3a5c317f8f34620107214e545' +
                '00000000000000000000000000000000000000000000000000000002540be400'
            ))

        self.assertEqual(sig_v, 37)
        self.assertEqual(
            hexlify(sig_r),
            '1238fd332545415f09a01470350a5a20abc784dbf875cf58f7460560e66c597f')
        self.assertEqual(
            hexlify(sig_s),
            '10efa4dd6fdb381c317db8f815252c2ac0d2a883bd364901dee3dec5b7d3660a')
        self.assertEqual(
            hexlify(hash),
            '3878462365df8bd2253c72dfe6e5cb744c64915e23fd5556f7077e43950a1afd')
        self.assertEqual(
            hexlify(signature_der),
            '304402201238fd332545415f09a01470350a5a20abc784dbf875cf58f7460560e66c597f022010efa4dd6fdb381c317db8f815252c2ac0d2a883bd364901dee3dec5b7d3660a'
        )