Transferring Coin Tokens Using the Wallet and SDKs
Transferring Coin Tokens Using the Wallet and SDKs
Open your wallet and change to the TestNet
network. You should see a Coin
token with a balance of 100.000.000
. These tokens were minted during the deployment process, following the _deploy
method.
Since our contract follows the NEP-17 standard, wallets can interact with it without any additional configuration. You can use the wallet to transfer tokens to another address.
Making a Transfer using the Wallet
Sending tokens using the wallet is straightforward thanks to the NEP-17 standard:
- Open your wallet and click on the
Send
button. - Select the
Coin
token from the list. - Enter the amount you want to transfer. The wallet will automatically convert the amount to use the correct number of decimals.
- Enter the recipient’s address:
Nfc23YfxGgKbAiwTNe77FFi8DCkhbWmJyz
. This is Linkd’s TestNet address. - Review the transaction details and click on
Send
. - Use the Activity tab to check the transaction status. Alternatively, you can use a block explorer to verify the transaction using the transaction ID.
The Coin
contract has 8 decimals, so the amount you enter in the wallet will be multiplied by 10^8
before being sent to the contract. For example, sending 1
token will be converted to 100000000
before being transferred. Wallets and explorers always display the amount considering the token decimals.
Transferring Tokens using the SDKs
You can also transfer tokens using the SDKs. To do this, you need to call the transfer
method in the contract. The method requires the sender’s address, the recipient’s address, the amount to transfer and a data
parameter.
The data
parameter is used to pass additional information to the contract. It can be used to trigger specific actions or provide context to the contract. In our case, we don’t need to use it, so we can pass an empty byte array.
Transaction Fees
Using the network requires a fee to process transactions. The fees are always paid in GAS, the utility token on the Neo blockchain. Internally, fees are divided into Network and System fees. Network fees are used to pay for authentication, priority and transaction size. System fees are used to pay for the execution of the smart contract.
Behind the scenes, the wallet is using the testInvoke
RPC method to estimate the fees. This is necessary to ensure that the user has enough GAS to complete the transaction. The amount of GAS required depends on the complexity of the contract and the number of operations it performs. Setting the fee too low can result in the transaction failing due to insufficient GAS.