java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder<AccountID,AccountID.Builder>
com.google.protobuf.GeneratedMessageLite.Builder<AccountID,AccountID.Builder>
com.hedera.hashgraph.sdk.proto.AccountID.Builder
- All Implemented Interfaces:
com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,AccountIDOrBuilder,Cloneable
- Enclosing class:
AccountID
public static final class AccountID.Builder
extends com.google.protobuf.GeneratedMessageLite.Builder<AccountID,AccountID.Builder>
implements AccountIDOrBuilder
* A unique identifier for an Hedera account. An account identifier is of the form `shard.realm.[number|alias]`.<br/> The identifier MAY use the alias form when transferring HBAR to a public key before the account for that key is created, when only the alias value is known, or in some smart contracts that use the EVM address style alias to refer to Accounts.<br/> When the account entry is completed, the alias SHALL be stored separately in the Account record, and the identifier in the Account SHALL use the `accountNum` form. --- ### Additional Notes #### Alias There is considerable complexity with `alias` (aka `evm_address`) for Accounts. Much of this comes from the existence of a "hidden" alias for almost all accounts, and the reuse of the alias field for both EVM reference and "automatic" account creation.<br/> For the purposes of this specification, we will use the following terms for clarity. - `key_alias`<br/> The account public key as a protobuf serialized message and used for auto-creation and subsequent lookup. This is only valid if the account key is a single `primitive` key, either Ed25519 or ECDSA_SECP256K1. - `evm_address`<br/> Exists for every account and is one of - `contract_address`<br/> The 20 byte EVM address prescribed by `CREATE` or `CREATE2` - `evm_key_address`<br/> An arbitrary 20 byte EVM address that, for a usable externally owned account (EOA) SHALL be the rightmost 20 bytes of the Keccak-256 hash of a ECDSA_SECP256K1 key.<br/> Such accounts may be created in one of three ways: - Sending hbar or fungible tokens to an unused ECDSA_SECP256K1 key alias. - Sending hbar or fungible tokens to an unassigned 20-byte EVM address. - Submitting a `CryptoCreate` signed with the corresponding private key. - `long_zero`<br/> A synthetic 20 byte address inferred for "normally" created accounts. It is constructed from the "standard" AccountID as follows. 1. 4 byte big-endian shard number 1. 8 byte big-endian realm number 1. 8 byte big-endian entity number<br/> The `alias` field in the `Account` message SHALL contain one of four values for any given account. - The `key_alias`, if the account was created by transferring HBAR to the `key_alias` public key value. - The `evm_key_address` if the account was created from an EVM public key - The `contract_address` if the account belongs to an EVM contract - Not-Set/null/Bytes.EMPTY (collectively `null`) if the account was created normally If the `alias` field of an `Account` is any form of `null`, then the account MAY be referred to by `alias` in an `AccountID` by using the `long_zero` address for the account.<br/> This "hidden default" alias SHALL NOT be stored, but is synthesized by the node software as needed, and may be synthesized by an EVM contract or client software as well. --- #### Alias forms An `AccountID` in a transaction MAY reference an `Account` with `shard.realm.alias`.<br/> If the account `alias` field is set for an Account, that value SHALL be the account alias.<br/> If the account `alias` field is not set for an Account, the `long_zero` alias SHALL be the account alias.Protobuf type
proto.AccountID-
Field Summary
Fields inherited from class com.google.protobuf.GeneratedMessageLite.Builder
instance -
Method Summary
Modifier and TypeMethodDescription* A whole number account number, unique within its realm and shard.* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.* A whole number realm identifier.* A whole number shard identifier.long* A whole number account number, unique within its realm and shard.com.google.protobuf.ByteStringgetAlias()* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.long* A whole number realm identifier.long* A whole number shard identifier.boolean* A whole number account number, unique within its realm and shard.booleanhasAlias()* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.setAccountNum(long value) * A whole number account number, unique within its realm and shard.setAlias(com.google.protobuf.ByteString value) * An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.setRealmNum(long value) * A whole number realm identifier.setShardNum(long value) * A whole number shard identifier.Methods inherited from class com.google.protobuf.GeneratedMessageLite.Builder
build, buildPartial, clear, clone, copyOnWrite, copyOnWriteInternal, getDefaultInstanceForType, internalMergeFrom, isInitialized, mergeFrom, mergeFrom, mergeFrom, mergeFromMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Method Details
-
getAccountCase
- Specified by:
getAccountCasein interfaceAccountIDOrBuilder
-
clearAccount
-
getShardNum
public long getShardNum()* A whole number shard identifier.
int64 shardNum = 1;- Specified by:
getShardNumin interfaceAccountIDOrBuilder- Returns:
- The shardNum.
-
setShardNum
* A whole number shard identifier.
int64 shardNum = 1;- Parameters:
value- The shardNum to set.- Returns:
- This builder for chaining.
-
clearShardNum
* A whole number shard identifier.
int64 shardNum = 1;- Returns:
- This builder for chaining.
-
getRealmNum
public long getRealmNum()* A whole number realm identifier.
int64 realmNum = 2;- Specified by:
getRealmNumin interfaceAccountIDOrBuilder- Returns:
- The realmNum.
-
setRealmNum
* A whole number realm identifier.
int64 realmNum = 2;- Parameters:
value- The realmNum to set.- Returns:
- This builder for chaining.
-
clearRealmNum
* A whole number realm identifier.
int64 realmNum = 2;- Returns:
- This builder for chaining.
-
hasAccountNum
public boolean hasAccountNum()* A whole number account number, unique within its realm and shard. <p> For any AccountID fields in the query response, transaction records, transaction receipts, or block stream `accountNum` MUST be used.
int64 accountNum = 3;- Specified by:
hasAccountNumin interfaceAccountIDOrBuilder- Returns:
- Whether the accountNum field is set.
-
getAccountNum
public long getAccountNum()* A whole number account number, unique within its realm and shard. <p> For any AccountID fields in the query response, transaction records, transaction receipts, or block stream `accountNum` MUST be used.
int64 accountNum = 3;- Specified by:
getAccountNumin interfaceAccountIDOrBuilder- Returns:
- The accountNum.
-
setAccountNum
* A whole number account number, unique within its realm and shard. <p> For any AccountID fields in the query response, transaction records, transaction receipts, or block stream `accountNum` MUST be used.
int64 accountNum = 3;- Parameters:
value- The accountNum to set.- Returns:
- This builder for chaining.
-
clearAccountNum
* A whole number account number, unique within its realm and shard. <p> For any AccountID fields in the query response, transaction records, transaction receipts, or block stream `accountNum` MUST be used.
int64 accountNum = 3;- Returns:
- This builder for chaining.
-
hasAlias
public boolean hasAlias()* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.
bytes alias = 4;- Specified by:
hasAliasin interfaceAccountIDOrBuilder- Returns:
- Whether the alias field is set.
-
getAlias
public com.google.protobuf.ByteString getAlias()* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.
bytes alias = 4;- Specified by:
getAliasin interfaceAccountIDOrBuilder- Returns:
- The alias.
-
setAlias
* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.
bytes alias = 4;- Parameters:
value- The alias to set.- Returns:
- This builder for chaining.
-
clearAlias
* An alias value.<br/> Alias is a value used in some contexts to refer to an account when account number is not available, and may be an alias public key, or an EVM address.
bytes alias = 4;- Returns:
- This builder for chaining.
-