6

I thought I understood ERC-20 tokens. However, I wanted to purchase a small amount of basic attention token (like $5) to learn and experiment with. That's when I realized that I didn't understand them as well as I thought. The confusing part for me is basically in the transfer and storage. Allow me to use BAT as an example.

The Brave browser let's you add funds by sending Ether to your Brave wallet. The address of that wallet is provided in the Brave browser. Let's pretend that I didn't want to use all of the BAT immediately. So, I would want to store the BAT I didn't want to use on a hardware wallet like a Ledger. I'm trying this just to learn how it works. This is where I'm confused.

From my understanding, I don't see a way to send BAT to an address. Once it's in the Brave Wallet, it's there. Even if there was an option to "send" BAT to an address, I don't know what address on the Ledger to send it to. What denotes that a wallet address is a "BAT" wallet address? Does a single Ethereum wallet automatically recognize the token types? Or, does each token need it's own wallet? I've been told that Ledger wallets can hold BAT. Yet, the Ledger app only seems to recognize Ether.

So, does each ERC-20 token need it's own wallet? Or, do you just need one Ethereum wallet and the Ethereum platform recognizes the type of token? While I've used BAT as an example, I'm trying to understand it in the context of other ERC-20 tokens as well.

2

There is no difference between a wallet containing BAT and one that does not (aside from the fact that one can send now send BAT tokens, of course). In fact, the BAT tokens are never actually stored in the wallet. The tokens are "stored" in the BAT contract -- and this is true of all ERC-20-compliant tokens. Each ERC-20 contract contains a mapping of wallet addresses to account balances. An ERC-20-aware wallet will know that the ERC-20's software interface has a balanceOf function to examine token balances and some functions for transferring named transfer and transferFrom. You can think of "transfers to a wallet" as more of a "request to the relevant ERC-20 contract to hold tokens in trust on behalf of an owner of a wallet".

Since an account receiving a token doesn't actually receive any tokens (it's some number shifting in the token contract), to see if you have any tokens of a particular type, you need to query the mapping of the appropriate token. Some wallets may automatically check (AKA watch) some common tokens, but a fully-featured Ethereum wallet should be able to interact with any ERC-20 token; it just requires user input to direct its "attention" towards a particular ERC-20 contract. A non-fully-featured Ethereum wallet may not let you interact with the contract, even if you have received the tokens at your wallet address. In that case, you will need to export the private keys for the wallet and import them into a more featured wallet. Don't worry; those tokens aren't lost!

  • So, if I'm understanding you correctly, an Ethereum wallet holds Ether. Ether can be used to obtain ERC-20 tokens. The relationship between your Ethereum wallet and the ERC-20 compliant token are stored in the token's contract. Did I get it correct? – Zach Templeton Oct 26 '17 at 13:24
  • @ZachTempleton yes :) – lungj Oct 26 '17 at 13:32
0

If you want to send your BAT tokens to another ETH address, you can achieve this using MyEtherWallet on the contracts page. Please note that this is only possible if you have access to one of the following: your keystore / JSON file, mnemonic phrase, or private key. You will need to provide the address of the BAT token contract, which is:

0x0d8775f648430679a709e98d2b0cb6250d2887ef

You will also need to provide the ABI / JSON Interface of the transfer function which is typically:

[{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]

You will then need to select 'Access' and then 'Select a function' and in the drop down menu you should see the transfer function. Then you will need to fill out 2 parameters, the address you want to send tokens to and the amount of tokens you would like to send. Note that if you want to send 1 token, then you need to enter 1 followed by 18 0s. This is because BAT is an 18 decimal token. If you simply enter 1, then you will only be sending 0.000000000000000001 BAT.

  • If I'm understanding you correctly, this approach moves tokens from one ETH wallet to another. However, what if I want to convert the BAT token back to ETH in my wallet? How do I do that? – Zach Templeton Oct 26 '17 at 13:25
  • You cloud send your BAT tokens to a cryptocurrency exchange market that has BAT listed. Then you can trade them for ETH and send the ETH back to your wallet. – Zenos Pavlakou Oct 26 '17 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.