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.example
file to.env
. - Next update the values of
OPERATOR_ID
andOPERATOR_KEY
.
The
OPERATOR_ID
will be the ED25519 account ID and theOPERATOR_KEY
will be the DER Encoded Private Key. You can grab this information from https://portal.hedera.com/login
hederaAccountId
The account you want to verify association for.hederaTokenId
The token ID used to check ifhederaAccountId
is associated with it.