Associating an account with a Hedera Native token is unique to Hedera and is required for someone to send an HTS token to a wallet. Needing to associate protects a wallet holder from recieving unwanted tokens.
Using the mirror nodes is the recommended way to check if an account is currently associated with an HTS token. It’s important to note when you associate with a token it will show you have a 0 balance of that token. Once you receive that token your balance will go up as expected.
- First rename the
.env.examplefile to.env. - Next update the values of
OPERATOR_IDandOPERATOR_KEY.
The
OPERATOR_IDwill be the ED25519 account ID and theOPERATOR_KEYwill be the DER Encoded Private Key. You can grab this information from the Hedera Portal
hederaAccountIdThe account you want to verify association for.hederaTokenIdThe token ID used to check ifhederaAccountIdis associated with it.