-
Notifications
You must be signed in to change notification settings - Fork 92
feat: implement account creation with EVM-style alias transaction #922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: implement account creation with EVM-style alias transaction #922
Conversation
…mple Signed-off-by: MonaaEid <monaa_eid@hotmail.com>
|
Hi, this is MergeConflictBot. Please resolve these conflicts locally and push the changes. To assist you, please read: Thank you for contributing! From the Hiero Python SDK Team |
|
Hi, this is WorkflowBot.
|
Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
There was a problem hiding this 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. |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
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"
| - 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` |
|
|
||
| load_dotenv() | ||
| network_name = os.getenv('NETWORK', 'testnet').lower() | ||
| key_type = os.getenv('KEY_TYPE', 'ecdsa') |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
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.
| # 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). |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
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.
| 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. |
| key_type = os.getenv('KEY_TYPE', 'ecdsa') | ||
|
|
||
| def setup_client(): | ||
| """Setup Client """ |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
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.
| """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'. | |
| """ |
| key_type = os.getenv('KEY_TYPE', 'ecdsa') | ||
|
|
||
| def setup_client(): | ||
| """Setup Client """ |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace after "Client".
| """Setup Client """ | |
| """Setup Client""" |
| public_key = private_key.public_key() | ||
| evm_address = public_key.to_evm_address() | ||
| if evm_address is None: | ||
| print("❌ Error generating ECDSA key pair") |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
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".
| print("❌ Error generating ECDSA key pair") | |
| print("❌ Failed to generate EVM address from ECDSA public key") |
|
|
||
| - 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. |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
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.
| - 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. |
…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>
|
Hi @MonaaEid, Thanks for PR! Could you please rename the example file to |
…mple Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com>
|
Hi @manishdait, please check |
manishdait
left a comment
There was a problem hiding this 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>
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
examples/account/create_account_with_alias_transaction.py