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

Add new fields for externalizing account alias #242

Merged
merged 10 commits into from
Nov 23, 2022
28 changes: 21 additions & 7 deletions services/basic_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ message AccountID {
int64 realmNum = 2;

/**
* The account number unique within its realm which can be either a non-negative integer or an alias public key.
* The account number unique within its realm which can be a non-negative integer, an alias public key or an EVM address.
* For any AccountID fields in the query response, transaction record or transaction receipt only accountNum will
* be populated.
*/
Expand All @@ -95,21 +95,23 @@ message AccountID {
* a protobuf Key message for any primitive key type. Currently only primitive key bytes are supported as an alias
* (ThresholdKey, KeyList, ContractID, and delegatable_contract_id are not supported)
*
* May also be the ethereum account 20-byte EVM address to be used initially in place of the public key bytes. This EVM
* address may be either the encoded form of the shard.realm.num or the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
*
* At most one account can ever have a given alias and it is used for account creation if it
* was automatically created using a crypto transfer. It will be null if an account is created normally.
* It is immutable once it is set for an account.
*
* If a transaction auto-creates the account, any further transfers to that alias will simply be deposited
* in that account, without creating anything, and with no creation fee being charged.
*
* If a transaction lazily-creates this account, a subsequent transaction will be required containing the public key bytes
* that map to the EVM address bytes. The provided public key bytes will then serve as the final alias bytes.
*/
bytes alias = 4;

steven-sheehy marked this conversation as resolved.
Show resolved Hide resolved
/**
* The ethereum account 20-byte EVM address to be used initially in place of the public key bytes. This EVM
* address may be either the encoded form of the shard.realm.num or the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
*
* If a transaction lazily-creates this account, a subsequent transaction will be required containing the public key bytes
* that map to the EVM address bytes. Lazy account creates will only support the keccak-256 hash of a ECDSA_SECP256K1 primitive key form.
*/
bytes evm_address = 5;
}
}

Expand Down Expand Up @@ -1592,3 +1594,15 @@ message StakingInfo {
int64 staked_node_id = 6;
}
}

message VirtualAddress {
/**
* The 20-byte EVM address that is derived from the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
*/
bytes address = 1;

/**
* Flag if this address should now be set or is the default address on the account.
*/
bool is_default = 2;
}
11 changes: 7 additions & 4 deletions services/crypto_create.proto
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ message CryptoCreateTransactionBody {
bool decline_reward = 17;

/**
* The bytes to be used as the account's alias. The bytes will be 1 of 2 options. It will be the
* serialization of a protobuf Key message for an ED25519/ECDSA_SECP256K1 primitive key type. If the
* account is ECDSA_SECP256K1 based it may also be the public address, calcluated as the last 20 bytes of
* the keccak-256 hash of the ECDSA_SECP256K1 primitive key. Currently only primitive key bytes are
* The bytes to be used as the account's alias. It will be the
* serialization of a protobuf Key message for an ED25519/ECDSA_SECP256K1 primitive key type. Currently only primitive key bytes are
* supported as the key for an account with an alias. ThresholdKey, KeyList, ContractID, and
* delegatable_contract_id are not supported.
*
Expand All @@ -175,4 +173,9 @@ message CryptoCreateTransactionBody {
* cover auto-renewal fees.
*/
AccountID auto_renew_account = 19;

/**
* EOA 20-byte address to create that is derived from the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
*/
bytes evm_address = 20;
}
5 changes: 5 additions & 0 deletions services/crypto_get_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ message CryptoGetInfoResponse {
* cover auto-renewal fees.
*/
AccountID auto_renew_account = 23;

/**
* List of virtual addresses each of which is an EVM address that maps to an ECDSA key pair a user must prove ownership of.
*/
repeated VirtualAddress virtual_addresses = 24;
}

/**
Expand Down
12 changes: 12 additions & 0 deletions services/crypto_update.proto
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,16 @@ message CryptoUpdateTransactionBody {
* account. Otherwise it updates the account's auto-renew account to the referenced account.
*/
AccountID auto_renew_account = 19;

oneof virtual_address_update {
/**
* The virtual address to be added.
*/
VirtualAddress add = 20;

/**
* The 20-byte EVM address of the virtual address that is being removed.
*/
bytes remove = 21;
}
}
6 changes: 6 additions & 0 deletions services/transaction_record.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,10 @@ message TransactionRecord {
*/
int32 prng_number = 20;
}

/**
* 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.
*/
bytes evm_address = 21;
}