Repository navigation
Open
Labels
approvedIssue has been approved by team memberIssue has been approved by team memberpythonPull requests that update python codePull requests that update python codescope: DLTinvolves engineering for distributed ledger technologyinvolves engineering for distributed ledger technologyskill: intermediaterequires some knowledge of the codebase with some defined steps to implement or examplesrequires some knowledge of the codebase with some defined steps to implement or examples
Description
🐞 Problem Description
To check that a signature (or a signed transaction) really comes from a given Hedera account, a user has to:
- Run an
AccountInfoQueryto get the account's current key. - Make sure that key is a single
PublicKeyand not aKeyListor threshold key. - Verify the signature against that key.
The Java and JS SDKs wrap these steps in AccountInfoFlow (verifySignature / verifyTransactionSignature). The Python SDK has no equivalent.
There is a second gap. PublicKey has verify(signature, data), but nothing that checks a Transaction's signatures against the key (Java has PublicKey.verifyTransaction). The flow needs it, and it is also useful on its own.
💡 Expected Solution
from hiero_sdk_python import AccountInfoFlow
ok = AccountInfoFlow.verify_signature(client, account_id, message, signature)
ok = AccountInfoFlow.verify_transaction_signature(client, account_id, signed_tx)🛠️ Implementation Notes
- Add
src/hiero_sdk_python/account/account_info_flow.pywith anAccountInfoFlowclass that only has static methods:@staticmethod def verify_signature(client: Client, account_id: AccountId, message: bytes, signature: bytes) -> bool: ... @staticmethod def verify_transaction_signature(client: Client, account_id: AccountId, transaction: Transaction) -> bool: ...
- Add a private helper
_get_account_public_key(client, account_id) -> PublicKey. It runsAccountInfoQuery().set_account_id(account_id).execute(client)and returnsinfo.keyif it is aPublicKey. If the key is aKeyList, a threshold key, a contract ID key or missing, raise a clear error that names the account. Java does the same withUnsupportedOperationException. -
PublicKey.verify()currently raisesInvalidSignatureand returnsNone. The flow methods should returnbool:Truewhen the signature is valid,Falsewhen it is not. Any other error (network, precheck, unsupported key) should still propagate. - Add
PublicKey.verify_transaction(transaction: Transaction) -> bool:- The transaction must be frozen.
- For every body in
transaction._signature_map(one per node), find theSignaturePairwhosepubKeyPrefixmatches this key and verify it over the body bytes. - Return
Trueonly if every node body has a valid signature from this key. - Look at the Java
PublicKey.verifyTransactionfor the exact rules. ReuseTransaction.get_signatures()if it fits.
- Export
AccountInfoFlowfromhiero_sdk_python/__init__.py. - Add an example at
examples/account/account_info_flow.pythat signs a message and a transaction with an account's key and verifies both.
Async variants are out of scope.
🧪 Testing
- Unit tests for
PublicKey.verify_transaction: ED25519 and ECDSA keys, a valid signature, a wrong key, a tampered body, a transaction that isn't frozen, and multiple nodes where only some bodies are signed. - Unit tests for
AccountInfoFlowwith a mockedAccountInfoQuery: valid and invalid signatures, and theKeyList/ missing key error paths. - Integration test: create an account, sign a message and a transaction with its key, and verify both through the flow. A signature from a different key must return
False.
✅ Acceptance Criteria
-
AccountInfoFlow.verify_signatureandAccountInfoFlow.verify_transaction_signatureare available and returnbool -
PublicKey.verify_transactionis added - Unsupported account key types raise a clear error
- Unit and integration tests pass, and an example is added
📚 References
- Java: https://github.com/hiero-ledger/hiero-sdk-java/blob/main/sdk/src/main/java/com/hedera/hashgraph/sdk/AccountInfoFlow.java
- Java
PublicKey.verifyTransaction: https://github.com/hiero-ledger/hiero-sdk-java/blob/main/sdk/src/main/java/com/hedera/hashgraph/sdk/PublicKey.java - JS: https://github.com/hiero-ledger/hiero-sdk-js/blob/main/src/account/AccountInfoFlow.js
- Python building blocks:
src/hiero_sdk_python/crypto/public_key.py(verify),src/hiero_sdk_python/transaction/transaction.py(get_signatures,_signature_map),src/hiero_sdk_python/account/account_info.py
Metadata
Metadata
Assignees
Labels
approvedIssue has been approved by team memberIssue has been approved by team memberpythonPull requests that update python codePull requests that update python codescope: DLTinvolves engineering for distributed ledger technologyinvolves engineering for distributed ledger technologyskill: intermediaterequires some knowledge of the codebase with some defined steps to implement or examplesrequires some knowledge of the codebase with some defined steps to implement or examples
Activity
github-actions commentedon Nov 12, 2026
Thanks for your submission.
This issue is awaiting approval from @hiero-ledger/hiero-sdk-python-triage and @hiero-ledger/hiero-sdk-python-committers and @hiero-ledger/hiero-sdk-python-maintainers.
github-actions commentedon Nov 13, 2026
Approved by @hiero-ledger/hiero-sdk-python-triage and @hiero-ledger/hiero-sdk-python-committers and @hiero-ledger/hiero-sdk-python-maintainers.
github-actions commentedon Nov 13, 2026
anchit-goel commentedon Nov 13, 2026
/assign
github-actions commentedon Nov 21, 2026
Hi @anchit-goel 👋
This issue has been assigned but no pull request has been created yet.
Are you still planning on working on it?
If you are, please create a draft PR linked to this issue or comment
/workingto let us know.If you're no longer able to work on this issue, you can comment
/unassignto release it.From the Python SDK Team