Skip to content

Conversation

@MonaaEid
Copy link
Contributor

@MonaaEid MonaaEid commented Nov 28, 2025

This pull request introduces:

  • An example demonstrating how to create an account using an EVM-style alias (EVM address).

  • The script guides users through generating an ECDSA key pair, creating an account with an EVM alias, and displaying the resulting account information.

Related issue(s):
Fixes #918

Checklist

  • Create examples/account/create_account_with_alias_transaction.py
  • Update CHANGELOG
  • Documented (Code comments)
  • Tested

…mple

Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
@github-actions
Copy link

Hi, this is MergeConflictBot.
Your pull request cannot be merged because it contains merge conflicts.

Please resolve these conflicts locally and push the changes.

To assist you, please read:

Thank you for contributing!

From the Hiero Python SDK Team

@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:

@MonaaEid MonaaEid changed the title feat: implement account creation with EVM-style alias transaction exa… feat: implement account creation with EVM-style alias transaction Nov 28, 2025
Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
@MonaaEid MonaaEid marked this pull request as ready for review November 28, 2025 21:18
Copilot AI review requested due to automatic review settings November 28, 2025 21:18
Copilot finished reviewing on behalf of MonaaEid November 28, 2025 21:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new example demonstrating how to create a Hedera account using an EVM-style alias derived from an ECDSA key pair. The example guides users through generating an ECDSA key, deriving an EVM address, and creating an account with that alias.

Key changes:

  • New example script showing EVM alias account creation workflow
  • CHANGELOG entries for the new example and unrelated bot workflow

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
examples/account/create_account_with_alias_transaction.py Implements the EVM alias account creation example with step-by-step guidance
CHANGELOG.md Documents the new example addition under the Unreleased section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add example demonstrating usage of `CustomFeeLimit` in `examples/transaction/custom_fee_limit.py`
- Added `.github/workflows/merge-conflict-bot.yml` to automatically detect and notify users of merge conflicts in Pull Requests.
- Added `.github/workflows/bot-office-hours.yml` to automate the Weekly Office Hour Reminder.
- feat: Implement account creation with EVM-style alias transaction example.
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The changelog entry format is inconsistent with other entries in the file. Most entries follow the pattern "Add example demonstrating..." or "Added..." without the "feat:" prefix. For consistency, consider changing to: "Add example demonstrating account creation with EVM-style alias transaction in examples/account/create_account_with_alias_transaction.py"

Suggested change
- feat: Implement account creation with EVM-style alias transaction example.
- Add example demonstrating account creation with EVM-style alias transaction in `examples/account/create_account_with_alias_transaction.py`

Copilot uses AI. Check for mistakes.

load_dotenv()
network_name = os.getenv('NETWORK', 'testnet').lower()
key_type = os.getenv('KEY_TYPE', 'ecdsa')
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The key_type variable is defined but never used in the code. It should either be removed or utilized in the example.

Copilot uses AI. Check for mistakes.
# uv run examples/account/create_account_with_alias_transaction.py
# python examples/account/create_account_with_alias_transaction.py
"""
Example: Create an account using an EVM-style alias (evm_address).
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The docstring is minimal compared to other examples in this directory (e.g., account_create_transaction.py). Consider adding a more comprehensive module-level docstring that includes:

  • A detailed description of what the example demonstrates
  • The specific features being showcased (ECDSA keys, EVM alias, etc.)
  • Usage instructions (how to run with python/uv)
  • Required environment variables
  • Expected outcomes

This would make the example more accessible and educational for users.

Suggested change
Example: Create an account using an EVM-style alias (evm_address).
Example: Create a Hedera account using an EVM-style alias (evm_address).
This example demonstrates how to:
- Generate a new ECDSA key pair.
- Derive an EVM-compatible address (alias) from the public key.
- Create a new Hedera account using the EVM address as an alias.
- Query and display the account information, including the contract account ID (alias).
Features showcased:
- ECDSA key generation
- EVM aliasing (evm_address)
- Account creation with alias
- Account info query
Usage:
uv run examples/account/create_account_with_alias_transaction.py
python examples/account/create_account_with_alias_transaction.py
Required environment variables (set in a .env file or your environment):
- OPERATOR_ID: The account ID of the operator (payer) account.
- OPERATOR_KEY: The private key of the operator account.
- NETWORK: (Optional) The Hedera network to use (default: testnet).
- KEY_TYPE: (Optional) The key type to use for the new account (default: ecdsa).
Expected outcome:
- A new Hedera account is created with an EVM-style alias.
- The script outputs the new account ID, EVM address, and detailed account information.
- The contract account ID (alias) is displayed if available.

Copilot uses AI. Check for mistakes.
key_type = os.getenv('KEY_TYPE', 'ecdsa')

def setup_client():
"""Setup Client """
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The docstring "Setup Client " is incomplete and lacks detail. Following the pattern in account_create_transaction.py, consider expanding this to document:

  • What the function does (connects to network, configures operator)
  • Return type and what's returned
  • Exceptions that may be raised
  • Required environment variables

Also note the trailing space in "Client " which should be removed.

Suggested change
"""Setup Client """
"""
Set up and return a Hedera Client configured for the specified network and operator.
This function connects to the Hedera network specified by the NETWORK environment variable,
and configures the client with the operator account and private key from the environment.
Returns:
Client: A configured Hedera Client instance.
Raises:
SystemExit: If required environment variables are missing or invalid.
Required Environment Variables:
- OPERATOR_ID: The account ID of the operator (payer) account.
- OPERATOR_KEY: The private key of the operator account.
- NETWORK: The Hedera network to connect to (e.g., 'testnet', 'mainnet', 'previewnet'). Defaults to 'testnet'.
- KEY_TYPE: The type of key to use (e.g., 'ecdsa'). Defaults to 'ecdsa'.
"""

Copilot uses AI. Check for mistakes.
key_type = os.getenv('KEY_TYPE', 'ecdsa')

def setup_client():
"""Setup Client """
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Trailing whitespace after "Client".

Suggested change
"""Setup Client """
"""Setup Client"""

Copilot uses AI. Check for mistakes.
public_key = private_key.public_key()
evm_address = public_key.to_evm_address()
if evm_address is None:
print("❌ Error generating ECDSA key pair")
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

The error message "Error generating ECDSA key pair" is misleading. The error occurs when to_evm_address() returns None, not during key generation (which happens on line 64). Consider a more accurate message like "Failed to generate EVM address from ECDSA public key".

Suggested change
print("❌ Error generating ECDSA key pair")
print("❌ Failed to generate EVM address from ECDSA public key")

Copilot uses AI. Check for mistakes.

- Add example demonstrating usage of `CustomFeeLimit` in `examples/transaction/custom_fee_limit.py`
- Added `.github/workflows/merge-conflict-bot.yml` to automatically detect and notify users of merge conflicts in Pull Requests.
- Added `.github/workflows/bot-office-hours.yml` to automate the Weekly Office Hour Reminder.
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Trailing whitespace at the end of the line.

Suggested change
- Added `.github/workflows/bot-office-hours.yml` to automate the Weekly Office Hour Reminder.
- Added `.github/workflows/bot-office-hours.yml` to automate the Weekly Office Hour Reminder.

Copilot uses AI. Check for mistakes.
MonaaEid and others added 3 commits November 29, 2025 00:06
…mple

Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
…mple

Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
…mple

Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
@manishdait
Copy link
Contributor

Hi @MonaaEid, Thanks for PR!

Could you please rename the example file to account_create_transaction_evm_alias.py? This will keep it consistent with our current file naming scheme.

…mple

Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
@MonaaEid
Copy link
Contributor Author

Hi @manishdait, please check

Copy link
Contributor

@manishdait manishdait left a comment

Choose a reason for hiding this comment

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

Hi @MonaaEid, just a few changes. The rest of the PR looks good.

…mple

Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
@MonaaEid MonaaEid requested a review from manishdait December 1, 2025 14:38
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.

Create examples/account/create_account_with_alias_transaction.py

2 participants