Skip to content

Conversation

@undefinedIsMyLife
Copy link

Description:

Add an example demonstrating how token pause keys work in the Hiero Python SDK.

  • Add examples/token_create_transaction_pause_key.py showing:
    • Creating a token without a pause key and failing to pause it
    • Creating a token with a pause key
    • Pausing and unpausing a token
    • Transfer failure while paused
    • Removing the pause key while the token is paused (token becomes permanently paused)
  • Add changelog entry for the example

Related issue(s):

Fixes #820

Notes for reviewer:

This example follows the same structure as existing examples and includes detailed comments explaining pause key behavior.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great going!

I suspect there are some 'hidden errors' where it looks like it works because of the print statements, but misses some important errors

For example, I don't think we have a way to remove a pause key, currently, in which case, your prints will still 'succeed' even though it never failed.

for example try to use this
def remove_pause_key(client, token_id, pause_key):
print("🔹 Removing pause key while token is UNPAUSED...")

# Step 1: Update token to remove the pause key
tx = (
    TokenUpdateTransaction()
    .set_token_id(token_id)
    .set_pause_key(None)  # Correct way to remove the key
    .freeze_with(client)
    .sign(pause_key)
)

receipt = tx.execute(client)

if receipt.status != ResponseCode.SUCCESS:
    print(f"❌ Failed to remove pause key: {ResponseCode(receipt.status).name}\n")
    return False

print("✅ Pause key removed successfully, verifying...")

# Step 2: Query the token info to verify pause key is gone
info = TokenInfoQuery().set_token_id(token_id).execute(client)

if info.pause_key is None:
    print("✅ Verification passed: Pause key is now None.\n")
    return True
else:
    print(f"❌ Verification failed: Pause key still exists: {info.pause_key}\n")
    return False

Verification failed: Pause key still exists:

Please take a look at the script, perhaps add more checks (or expand the unit or integration tests) to verify your theories

I don't think we can delete a key like this, so if we are missing a method in the transaction, please add that -- but i don't know/otherwise delete bonus section

Thanks

@exploreriii
Copy link
Contributor

Hi @undefinedIsMyLife please rebase and see feedback above when you can

@undefinedIsMyLife
Copy link
Author

I will do finish the issue by tonight or tomorrow is that fine? due to some urgent emergency i wasn't able to resolve the last issue

@exploreriii
Copy link
Contributor

sorry to hear that, take the time you need

@undefinedIsMyLife
Copy link
Author

Removed the bonus section since the SDK currently does not support removing a pause key, and the behavior cannot be demonstrated reliably. Updated the example to reflect only supported pause/unpause operations. Please review when you have time.

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @undefinedIsMyLife
Looking great! Just tidy up some of the error catching please so your print statements are as truthful as possible!

@github-actions
Copy link

Hi, this is WorkflowBot.
Your pull request cannot be merged as it is not passing all our workflow checks.
Please click on each check to review the logs and resolve issues so all checks pass.
To help you:

@exploreriii
Copy link
Contributor

Hi @undefinedIsMyLife please rebase this to pull in the recent changes from main
We were having problems with our tests, but these issues are now resolved thank you 👍

@exploreriii
Copy link
Contributor

request review if availalbe @tech0priyanshu

@undefinedIsMyLife undefinedIsMyLife force-pushed the example-token-pause-key-clean branch from 877ca52 to cd07a78 Compare November 26, 2025 17:00
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Would be really happy to merge this
We released a new version 0.1.9 so please update your changelog as described
Please also move the example to /tokens
Thank you!

exploreriii
exploreriii previously approved these changes Nov 27, 2025
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @undefinedIsMyLife this is approved!
But we cannot merge - please resolve the changelog conflict

that will mean pulling new data from upstream then rebasing
docs/sdk_developers/rebasing.md
ensure your upstream is set.

you'll then have a merge conflict:
docs/sdk_developers/merge_conflicts.md
This will be accepting both in this case, i think.

Thanks!

Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
@undefinedIsMyLife undefinedIsMyLife force-pushed the example-token-pause-key-clean branch from 95959fd to 58f6188 Compare November 28, 2025 17:54
…ro-ledger#833)

Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
@exploreriii
Copy link
Contributor

Sorry @undefinedIsMyLife we may have a bug, will get started on it #921

@undefinedIsMyLife
Copy link
Author

Thanks for the update!

I've restored the changelog entry exactly as requested.
Since the workflow bot issue has been confirmed and tracked in #921, I'll wait for the fix on your side.
Please let me know if anything else is needed from me!

Thanks again!

Signed-off-by: undefinedIsMyLife <shinetina169@gmail.com>
@tech0priyanshu
Copy link
Contributor

@undefinedIsMyLife Please add a changelog entry the file is currently missing.

@exploreriii
Copy link
Contributor

I appreciate your patience, we need to wait for the fix #924

@exploreriii
Copy link
Contributor

Hi @undefinedIsMyLife sincere apologies for the disruption and delays
We believe the check is now fixed, please could you rebase pulling in latest changes from main and this should go smoothly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Good First Issue: Create examples/token_create_transaction_pause_key.py

4 participants