Skip to content
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

Allow Setting of EVM Address by EOA #1082

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
215 changes: 215 additions & 0 deletions HIP/hip-1082.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
---
hip: 1082
title: Allow Setting of EVM Address by EOA
author: Nana Essilfie-Conduah <@Nana-EC>
working-group: Richard Bair <@rbair>, Atul Mahamuni <@atul-hedera>, Ty Smith <ty-swirldslabs>,
Serg Metelin <@sergmetelin>, Ali Nikan <@alinik4n>, Greg Scullard <@gregscullard>
mgarbs marked this conversation as resolved.
Show resolved Hide resolved
requested-by: Hedera community
type: Standards Track
category: Service
needs-council-approval: Yes
status: Draft
created: 11-18-24
discussions-to: https://github.com/hashgraph/hedera-improvement-proposal/discussions/1070
updated: 12-06-24
replaces: 631
requires: 583
---

## Abstract

HIP 583 opened the doors for greater account compatibility with EVM flows by utilizing the account alias to encompass
rbair23 marked this conversation as resolved.
Show resolved Hide resolved
the EVM address. However, given the static nature of the alias and concerns of complexity, existing accounts were not
allowed to update their alias and set one if it was null. This HIP aims to rectify this by allowing EOAs who have no
rbair23 marked this conversation as resolved.
Show resolved Hide resolved
alias set to set it to an ECDSA key derived evm address value they own.

This HIP also replaces the need for [HIP 631: Account Virtual Addresses](https://hips.hedera.com/hip/hip-631) as it
aimed to resolve this issue as well as provide even greater functionality. A form of HIP 631 could be revisited in the
future but not with the goal of providing address equivalence with the EVM.

## Motivation

The EVM address alias introduced in HIP 583 allowed for ECDSA based accounts to interact with the EVM in the same way
other EVM chains do. Particularly, functionality like the `ecrecover` that relies on the relationship between key and
address (pivotal to many DEXs) was unblocked and allowed greater EVM equivalence on the Hedera network.
However, HIP 583 intentionally provided no solution for accounts with no alias regardless of key type (ED, EC or
complex keys). Though these accounts were afforded the hedera num account alias (long zero), this format would not
allow accounts to utilize the `ecrecover` precompile in the expected manner.
This continued incompatibility has remained and inhibited web3 EVM tooling support.

Providing a solution to this gap is a necessity to make it easy for EVM dApps in the web3 community to come to
Hedera without needing to change their smart contracts.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The EVM address alias introduced in HIP 583 allowed for ECDSA based accounts to interact with the EVM in the same way
other EVM chains do. Particularly, functionality like the `ecrecover` that relies on the relationship between key and
address (pivotal to many DEXs) was unblocked and allowed greater EVM equivalence on the Hedera network.
However, HIP 583 intentionally provided no solution for accounts with no alias regardless of key type (ED, EC or
complex keys). Though these accounts were afforded the hedera num account alias (long zero), this format would not
allow accounts to utilize the `ecrecover` precompile in the expected manner.
This continued incompatibility has remained and inhibited web3 EVM tooling support.
Providing a solution to this gap is a necessity to make it easy for EVM dApps in the web3 community to come to
Hedera without needing to change their smart contracts.
On Ethereum, every account is addressed by an address which is derived from an ECDSA public key. The
EVM also has a specific instruction, `ecrecover`, that given an ECDSA signature can extract the public key
and convert that public key into an address. This allows an EVM program to figure out the address of
transaction signers.
Hiero accounts are not limited to ECDSA keys, and Hiero accounts can rotate their keys. Both of these
features are not found in Ethereum Externally Owned Accounts (EOA), and present some conflict with the
`ecrecover` operation. The EVM address alias introduced in [HIP-583](https://hips.hedera.com/hip/hip-583)
was added so that accounts could be created that augmented their account administration key (typically
referred to simply as the "account key" or "key"), with an EVM compatible "alias". This alias could match
exactly what an address would be on Ethereum. The user could call a smart contract, signed with the
private key associated with their alias, and the smart contract could use `ecrecover` to recover the public
key, derive the alias, and lookup the account.
However, not all accounts on Hedera use ECDSA keys or were created after HIP-583 was defined. This HIP
adds support for specifying an alias on an account, even if it already exists, so long as that account does
not already have an alias. [HIP-631]((https://hips.hedera.com/hip/hip-631) defines a more complex set of
rules that would allow multiple aliases to be defined for any given account. This HIP differs from HIP-631 in
that it supports only a single alias. HIP-631 could be implemented compatibly at a later date if desired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


## Rationale

[HIP 631: Account Virtual Addresses](https://hips.hedera.com/hip/hip-631) lays out the challenges faced by accounts
without an ECDSA derived EVM address that want to interact with the EVM in a way that complies with the Hedera native
model and the EVM model. However, HIP 631 offered feature rich complexity that may be difficult for DApps, wallets and
users to follow completely.

Instead of the full HIP 631, an intermediate approach i.e. a HIP 631 Lite (this HIP) could unblock users without an
EVM address. It would enable accounts to interact with the EVM in a compliant manner regardless of the public key on
its account.

In a sense the current network already supports the ability to set the evm address, it just requires the logic to be
done on account creation. Thus by lifting the limit of not being able to set the alias after account creation, whiles
still requiring that the current alias be unset this HIP ushers in the ability for those previously blocked accounts to
interact with the EVM as expected.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[HIP 631: Account Virtual Addresses](https://hips.hedera.com/hip/hip-631) lays out the challenges faced by accounts
without an ECDSA derived EVM address that want to interact with the EVM in a way that complies with the Hedera native
model and the EVM model. However, HIP 631 offered feature rich complexity that may be difficult for DApps, wallets and
users to follow completely.
Instead of the full HIP 631, an intermediate approach i.e. a HIP 631 Lite (this HIP) could unblock users without an
EVM address. It would enable accounts to interact with the EVM in a compliant manner regardless of the public key on
its account.
In a sense the current network already supports the ability to set the evm address, it just requires the logic to be
done on account creation. Thus by lifting the limit of not being able to set the alias after account creation, whiles
still requiring that the current alias be unset this HIP ushers in the ability for those previously blocked accounts to
interact with the EVM as expected.
[HIP-631: Account Virtual Addresses](https://hips.hedera.com/hip/hip-631) lays out the challenges faced by
accounts without an ECDSA derived EVM address that want to interact with the EVM in a compatible way while still
supporting key rotation and complex keys. While HIP-631 may be a comprehensive solution to the problem, it
requires complex user flows in wallets that may cause more pain than it resolves.
Instead, an intermediate approach i.e. a HIP 631 Lite (this HIP) could help users without an EVM address. It would
enable accounts to interact with the EVM, even contracts using `ecrecover`, regardless of the public key on its account.
In a sense, the current network already supports the ability to set the EVM address, it just only works during account creation. Thus, this HIP allows those previously created accounts to be updated and interact with the
EVM as one would expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


### Foundational Concepts

The following are some clarifying concepts to increase clarity around aliases
- Every account on the network has 1 or 2 evm addresses. Either only the Hedera num alias (long zero) or the Hedera num
alias (long zero) and an EVM address alias (standard ECDSA derived EVM address).
- When a user interacts with the EVM the network will utilize the ECDSA derived EVM address alias on an account if
present. If not it will utilize the long zero.
- Accounts with an ECDSA derived EVM address are fully compatible with expectations of contracts that utilize the
ecrecover precompile.
- Accounts without an ECDSA derived EVM address alias will not match the expectation of the ecrecover precompile
calculations. This has effects on certain DApp behaviour.
- Smart contracts can and do cache the evm address of an account and often use it to assign attributes such as access
and ownership. As a result it was important to maintain a static alias to avoid unintended differences in
expectation
- Account key rotation has no impact on the evm address utilized when an account interacts with the EVM
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The following are some clarifying concepts to increase clarity around aliases
- Every account on the network has 1 or 2 evm addresses. Either only the Hedera num alias (long zero) or the Hedera num
alias (long zero) and an EVM address alias (standard ECDSA derived EVM address).
- When a user interacts with the EVM the network will utilize the ECDSA derived EVM address alias on an account if
present. If not it will utilize the long zero.
- Accounts with an ECDSA derived EVM address are fully compatible with expectations of contracts that utilize the
ecrecover precompile.
- Accounts without an ECDSA derived EVM address alias will not match the expectation of the ecrecover precompile
calculations. This has effects on certain DApp behaviour.
- Smart contracts can and do cache the evm address of an account and often use it to assign attributes such as access
and ownership. As a result it was important to maintain a static alias to avoid unintended differences in
expectation
- Account key rotation has no impact on the evm address utilized when an account interacts with the EVM
Every account in Hiero has a 20-byte EVM alias by default. It is created **not** by using the key on the account,
which may change, but by computing a "long-zero" alias by taking the account ID (such as 0.0.1234) and
converting it into a 20-byte representation.
Given any account, you can send HBAR, or Tokens, to any other account by using either its Account ID, or by using
its built-in long-zero alias.
A user may specify an alias **in addition to** the long-zero alias. This additional alias is typically based on an
ECDSA key, exactly the same way as it is done in Ethereum. This key may, or may not, be the admin key on the
account. But to use this alias, the user must assert they own the key by signing the transaction that sets the alias
with the corresponding private key of that alias, to prevent "alias squatting" by malicious actors.
When a user interacts with a smart contract, if a user-defined alias based on ECDSA is present, it will be used as
the address by which the smart contract interacts with the account. The smart contract will not be able to use
the long-zero address. If the account does not have a user-defined alias based on ECDSA, then the long-zero
alias will be used to represent the account in the smart contract system.
Accounts with user-defined aliases based on ECDSA work with smart contracts that make use of `ecrecover`.
Accounts that work with smart contracts using their long-zero address will not work with smart contracts that
use `ecrecover`.
Smart contracts can, and frequently do, store in state the EVM address of accounts that use the smart contract.
For this reason, smart contracts **will not work** with accounts whose EVM address changes. This is why
the user-defined alias cannot be changed after it has been set, since this has become the address by which
contracts will refer to the account.
Due to this fact, the user must always sign contract calls with the key associated with the user-defined ECDSA
alias, and must never lose that key. If for any reason the key must be rotated, all value in the account must be
transferred to a new account, possibly incurring custom fees for HTS tokens. This is the same as how it works
on Ethereum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


<aside>
🚨 **Open Task:** : Add account, address key relationship diagram for clarity
</aside>

## User stories

1. As an existing account with an ED key but no EVM address alias, I would like to set an ECDSA derived EVM address
Copy link
Contributor

Choose a reason for hiding this comment

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

In this user story, wouldn't the user have to update the ED key to the new ECDSA key that corresponds with the EVM address for 'ecrecover' to function? Maybe I'm misunderstanding the phrase 'correct ecrecover functionality', or is the implication that the key is being updated as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the user would just use their ECDSA key in a wallet to sign. So far as the EVM address can be extracted from the signature the ecercover flow would work

alias on my account that will identify my account on the EVM.
2. As an existing account with an EC key but no EVM address alias, I would like to set an ECDSA derived EVM address
alias on my account that will identify my account on the EVM.
3. As an existing account with a complex key but no EVM address alias, I would like to set an ECDSA derived EVM address
alias on my account that will identify my account on the EVM.
5. As an existing account with a newly set ECDSA derived EVM address, I want my account to conform with `ecrecover`
expectations as long as I sign the transaction with the ECDSA key that corresponds to the EVM address alias.
This key may or may not be the key currently on my account.
5. As an account with an EVM address alias set after creation, I would like to set an evm address override to my
previous long zero address for a `ContractCreate` transaction.
6. As an account with an EVM address alias set after creation, I would like to set an evm address override to my
previous long zero address for a `ContractCall` transaction.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this out of scope / too complex for this HIPs user story?
As an existing account with an ED key but no EVM address alias, I would like to update my key to an ECDSA key and set my EVM address to be derived from the new ECDSA key.

Copy link
Contributor Author

@Nana-EC Nana-EC Dec 7, 2024

Choose a reason for hiding this comment

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

Out of scope, not too complex but would be enabled by this HIP and current network functionality.
Such a user could rotate their keys before or after setting the EVM address.
They could actually do it in one single CryptoUpdate also.
Key rotation is not tied to alias value

Copy link
Member

Choose a reason for hiding this comment

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

I didn't think it was out of scope, but explicitly in scope. Key rotation is already supported as you said, and setting the alias if it was null is also in scope. So what @ty-swirldslabs is asking for should be a natural consequence of this HIP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I read this as a User story to 1) rotate keys 2) set new ECDSA derived evm address.

  1. is existing network logic hence my out of scope comment as it's already covered
  2. is covered by the first user story.

Valid point though so I've added a new user story to highlight the chaining of actions as this is valuable for users.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this resolved @ty-swirldslabs @Nana-EC ?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
5. As an account with an EVM address alias set after creation, I would like to set an evm address override to my
previous long zero address for a `ContractCreate` transaction.
6. As an account with an EVM address alias set after creation, I would like to set an evm address override to my
previous long zero address for a `ContractCall` transaction.
5. As an account owner with an EVM address alias set after creation, I have already made some smart contract calls
using my long-zero EVM address, and I would like to continue using the long-zero address for specific
`ContractCall` transactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
6. As a wallet provider, I want to create accounts ahead of time with no alias, and then when the user takes
possession of the account, they can set the key and alias to an ECDSA key for full EVM compatibility
7. As a wallet provider, I want to track which alias an account has used with which smart contract, so that
accounts that had previously used a smart contract with a long-zero address will continue to use the long-zero
address, even if they have a new EVM friendly alias that they use with other accounts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change

## Specification

The main change to the network is simple - `CryptoUpdate` transactions will support setting a new ECDSA derived
`evm_address` if the current value is unset.
Copy link
Member

Choose a reason for hiding this comment

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

This HIP requires two changes to consensus nodes:

  1. Modify CryptoUpdate transactions so allow the alias to be set to an ECDSA derived address if the alias
    has never been set.
  2. Modify ContractCall to support an "EVM address override", so the long-zero or ECDSA derive alias may
    be explicitly used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


### Protobuf
```protobuf
message CryptoUpdateTransactionBody {
...

/**
* EOA 20-byte address to create that is derived from the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
*/
bytes evm_address = 19;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* EOA 20-byte address to create that is derived from the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
*/
bytes evm_address = 19;
/**
* An EVM-compatible 20-byte address derived the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
* The transaction MUST be signed by the corresponding private key, and the `alias` on the account MUST
* be unset prior to this call. Once set, this value cannot be changed.
*/
bytes alias = 19;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change

}
```

Additionally, `ContractCreate` and `ContractCall` EVM transactions will need to support the ability to specify the
a Hedera Num Alias alias EVM address to use on the transaction. This is because on the HAPI side all aliases are
rbair23 marked this conversation as resolved.
Show resolved Hide resolved
rbair23 marked this conversation as resolved.
Show resolved Hide resolved
applicable and thus the flexibility of the API is important to maintain.
Also, accounts that previously had no ECDSA derived EVM address were likely created via the HAPI flow and it may
be important for an EOA to utilize the long zero address even after setting a new ECDSA derived EVM address.
For transactions that utilize the `EthereumTransaction` a compliant ECDSA derived EVM address is provided by default
when using EVM tools.

```protobuf
message ContractCreateTransactionBody {
...
/**
* The 20-byte EVM address to use for the given transaction. This address must be the Hedera num alias of the account.
*/
bytes evm_address_override = 21;
Copy link
Member

Choose a reason for hiding this comment

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

This name seems ambiguous to me. It could be the address of the contract or the sender. What about from like in eth_call? Or other alternatives like from_address or sender?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point.
sender might be cleaner as in implementation this is setting the EOA msg.sender observed by the EVM

}

message ContractCallTransactionBody {
...
/**
* The 20-byte EVM address to use for the given transaction. This address must be the Hedera num alias of the account.
*/
bytes evm_address_override = 5;
}
```

No change is needed to expose the evm address as it is covered by the `evm_address` property on `TransactionRecord`
Copy link
Member

Choose a reason for hiding this comment

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

We have both evm_address and alias in the TransactionRecord. The documentation for evm_address is suspicious:

The new default EVM address of the account created by this transaction. This field is populated only when the EVM address is not specified in the related transaction body

I'm not exactly sure what that means. We should double check on whether we write the evm_address, alias, or both in the transaction record after an update. And we should move this comment into the previous section for CryptoUpdateTransactionBody.


### HSCS System Contract API
The HAS system contract will need to be updated to add support for a `setEVmAddressAlias()` function to expose the
`CryptoUpdate` HAPI functionality and allow EOAs to call this logic directly from dApps.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The HAS system contract will need to be updated to add support for a `setEVmAddressAlias()` function to expose the
`CryptoUpdate` HAPI functionality and allow EOAs to call this logic directly from dApps.
The Hedera Account Service (HAS) system contract will need to be updated to add support for a `setEvmAddressAlias()` function to expose the
`CryptoUpdate` HAPI functionality and allow EOAs to call this logic directly from dApps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change

### SDK

SDKs will need to update the `AccountUpdateTransaction` to support the `setAlias()` function as it does on
`AccountCreateTransaction`. This will populate the `evm_address` in the `CryptoUpdateTransactionBody`to be submitted.

`ContractCreateTransaction` and `ContractExecuteTransaction` will need to support a new `setEVmAddressOverride()`
function to set the `evm_address_override` property on the respective `ContractCreate` and `ContractCall` transactions.

### Mirror Node

Mirror Nodes should be sure to support the setting of the evm address value on an account when processing a
`CryptoUpdate` transaction. As in the case of a `CryptoCreate` the new value can be retrieved from the `evm_address`
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't mention changes around processing contract call and create.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The CN should ensure that the override address is adopted fully by the EVM, so there should be no changes to Mirror Node processing on those calls.
The sender value in ContractFunctionResult should be that of the override utilized in the transaction body.
Do you see any processing changes as a result of this or in other areas?
I'm happy to call them out or address them if they were missed

Copy link
Member

Choose a reason for hiding this comment

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

Can we detail any API changes? My assumption that there's no new fields but that existing fields in /api/v1/accounts/{id} will show the updated evm_address and the existing from in contract result APIs will show the override?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, the evm_address for an account will show the new value.
New contract results would also show the override.
Older accounts values and contract results should show the long zero if that's what was in the record file for correctness.
As such there shouldn't be any API field changes.
DO you see otherwise?

Added some details for this

property on `TransactionRecord`.
If no custom logic already exists to ignore this Mirror Nodes will be unimpaired by the change
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Mirror Nodes should be sure to support the setting of the evm address value on an account when processing a
`CryptoUpdate` transaction. As in the case of a `CryptoCreate` the new value can be retrieved from the `evm_address`
property on `TransactionRecord`.
If no custom logic already exists to ignore this Mirror Nodes will be unimpaired by the change
Mirror Nodes should be sure to support the setting of the evm address / alias value on an account when processing
a `CryptoUpdate` transaction. As in the case of a `CryptoCreate` the new value can be retrieved from the `evm_address` property on `TransactionRecord`.
If no custom logic already exists to ignore this Mirror Nodes will be unimpaired by the change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


### Wallets

The HIP provides opportunities for increased user functionality.
- Wallets are encouraged to create accounts with an ECDSA derived address alias
- Wallets are encouraged to support the ability for users to set an ECDSA derived alias in the future. This may require
wallets to support multiple keys for users that may decide to interchange between addresses.

## Backwards Compatibility

This does not break previous functionality but rather adds new scoped support for a change that is possible at account
creation time. However, it may be said that there is a behaviour change here that is important to note. This change
is accepted as the benefits of unblocking existing accounts outweighs the cons. The ability to override the address
also ensure there's a pathway for EOA to set their long zero address if needed.
Finally, it is appropriate for clients to query mirror node for accurate account details. Clients that do this will
avoid not be impacted by this change.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This does not break previous functionality but rather adds new scoped support for a change that is possible at account
creation time. However, it may be said that there is a behaviour change here that is important to note. This change
is accepted as the benefits of unblocking existing accounts outweighs the cons. The ability to override the address
also ensure there's a pathway for EOA to set their long zero address if needed.
Finally, it is appropriate for clients to query mirror node for accurate account details. Clients that do this will
avoid not be impacted by this change.
Any account interacting with a smart contract using its long-zero address, that subsequently sets an ECDSA derived alias, MAY need to use the `evm_address_override` when working with that smart contract,
if the smart contract maintained a reference to the account. Alternatively, the user may call the smart
contract using the `evm_address_override` to move assets or data contained within the smart contract
from the long-zero address to their new ECDSA-derived address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


## Security Implications

Smart contracts have their logic self contained in byte code. Therefore, the implications of address changes are
dictated by each smart contract and not the network. A smart contract may cache an EOA address on first interaction and
utilize that to identify them in future. The cached address could dictate balance access or other privileged access.

As such, an EOA that has interacted with a smart contract using their long zero address and then sets an ECDSA derived
EVM address after will be responsible for any unexpected interactions with the smart contract.
It is advised that an EOA in this case first transfer all in contract storage assets to the EVM address prior to
setting their alias.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Smart contracts have their logic self contained in byte code. Therefore, the implications of address changes are
dictated by each smart contract and not the network. A smart contract may cache an EOA address on first interaction and
utilize that to identify them in future. The cached address could dictate balance access or other privileged access.
As such, an EOA that has interacted with a smart contract using their long zero address and then sets an ECDSA derived
EVM address after will be responsible for any unexpected interactions with the smart contract.
It is advised that an EOA in this case first transfer all in contract storage assets to the EVM address prior to
setting their alias.
None.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adopted change


## How to Teach This

SDK examples, blogs and tutorials on docs.hedera.com
mgarbs marked this conversation as resolved.
Show resolved Hide resolved

## Reference Implementation


## Rejected Ideas

### Implement HIP 631
[HIP 631: Account Virtual Addresses](https://hips.hedera.com/hip/hip-631) would have added the ability add evm address
and specify any one of them as the desired address for use. However, this didn't unblock existing account and offered
likely complex UX that would overcomplicated the issue at this time. Focusing on setting aliases that were already null
and supporting evm address only for accounts that migrated themselves provides a solution that is focused and less
complex.
Copy link
Member

Choose a reason for hiding this comment

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

Is this true? I thought 631 allowed having multiple aliases, and thus would support going from null to an alias as well. The only problem with 631 was that it was complicated by having multiple aliases, and we decided to try a simpler approach with just 1 alias (in addition to the long-zero).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HIP 631 specifically reserved a different space in state for the multiple virtual addresses but maintained a single account.alias field as immutable

With Virtual Addresses, keys remain the signing permission authority and can be changed but Virtual Addresses (not tied to the alias) provide the value for a transactions EVM address.

Pulled from HIP 631, also the account diagram notes virtual addresses as a different field altogether. We never stated the ability to set a the null alias, so even with multiple virtual addresses an account could still have a null alias


## Open Issues

While a HIP is in draft, ideas can come up which warrant further discussion. Those ideas should be recorded so people
know that they are being thought about but do not have a concrete resolution. This helps make sure all issues required
for the HIP to be ready for consideration are complete and reduces people duplicating prior discussions.
mgarbs marked this conversation as resolved.
Show resolved Hide resolved

## References


mgarbs marked this conversation as resolved.
Show resolved Hide resolved

## Copyright/license

This document is licensed under the Apache License, Version 2.0 -- see [LICENSE](../LICENSE) or
(https://www.apache.org/licenses/LICENSE-2.0)
Loading