blockcypher / blockcypher-python

Python library for the BlockCypher web services
https://www.blockcypher.com/dev/bitcoin
Apache License 2.0
213 stars 122 forks source link

ltc1 addresses are not supported in simple_spend ? #118

Closed shbhmbnsl1 closed 1 year ago

shbhmbnsl1 commented 1 year ago

I am trying to use simple spend function to transfer litecoins from one wallet to another wallet. The receiver wallet address is something like "ltc1qlcptsyemnw9dmh4peux2xcyz8tr5l490y68lhj" and this gives me error :

I tried a different format Litecoin address and it seems to work, Example: "LRkzJFHR9PgdPvG2zt622DWgH3Hnw29qD4"

print(simple_spend(from_privkey=private_key, to_address=address,
  File "/opt/homebrew/lib/python3.10/site-packages/blockcypher/api.py", line 1701, in simple_spend
    raise Exception('TX Verification Error: %s' % err_msg)
Exception: TX Verification Error: Script 0014fe02b8133b9b8adddea1cf0ca360823ac74fd4af Does Not Contain a Valid Output Address: {'ltc1qlcptsyemnw9dmh4peux2xcyz8tr5l490y68lhj', 'LRkzJFHR9PgdPvG2zt622DWgH3Hnw29qD4'}

Usage:

simple_spend(from_privkey=private_key, to_address=receiver,
              to_satoshis=10000000, coin_symbol='ltc', api_key=apiKey)

Other functions like get_address_details are working for all types of wallet addresses, the problem seems to be only in simple_spend function.

Can you please help or suggest a workaround.

quentinlesceller commented 1 year ago

This might be an issue with the bech32 addresses. Try the create_unsigned_tx function.