Skip to content

Support passing PublicKey instead of PrivateKey for TokenKeys object in token creation #735

@skurzyp-arianelabs

Description

@skurzyp-arianelabs

Problem

The TokenKeys parameter in CreateTokenTransaction currently only accepts a PrivateKey (current code). This design prevents creating transactions in a non-custodial manner, as the transaction creator must possess the private key of the signer to set any of the token keys.

Since version 0.1.7, the SDK supports returning serialized transaction bytes (tx bytes), but the restriction on PrivateKey still prevents the intended separation of responsibilities.

Example scenario:

  • There are two accounts:

    1. An autonomous agent that constructs transactions.
    2. A human user who requests token creation and owns the signing keys.

In this case, the agent should be able to create a fungible token transaction where the supply key belongs to the human user. However, with the current implementation, the agent must have access to the user’s private key to complete the transaction — which is not acceptable in a non-custodial setup.

Desired behavior:
The SDK should allow using a PublicKey for TokenKeys, enabling the agent to fully construct and serialize the transaction to bytes. The serialized transaction can then be returned to the user for signing with their private key.

This approach aligns with the TypeScript SDK, which already supports setting PublicKey for token keys and facilitates secure, non-custodial transaction creation.

Solution

The requested functionality is supported in Typescript SDK. Please check out: https://github.com/hiero-ledger/hiero-sdk-js/blob/main/src/token/TokenCreateTransaction.js

Alternatives

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions