I am using python-sdk to perform stellar operations. Now I need to validate a stellar address. I know that the JS sdk has got a function StrKey.isValidEd25519PublicKey(address); however I cannot find the same in Python SDK.

Any idea, how I can do this?

2 Answers 2


check this out: https://github.com/StellarCN/py-stellar-base/blob/6329db3658c9b646a69c567019d95b41b7363eee/stellar_base/utils.py#L251

def is_valid_address(address):
    return decode_check('account', address)
except (DecodeError, TypeError):
    raise StellarAddressInvalidError('Invalid Stellar Address: {}'.format(address))

Thats how i have done it:

from stellar_sdk.exceptions import Ed25519PublicKeyInvalidError

def check_stellar_address(address):
        Account(account_id=address, sequence=0)
        return True

    except Ed25519PublicKeyInvalidError:
        return False

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.