2

What makes them unique as compared to the ERC20? Is it the owner's address as included in the form of token id? So what makes them unique is the historical chain of addresses attached to it?

3

As you can see for example in this implementation, ERC721 contracts keep track of an owner (identified by its address) for each single token (identified by its token ID, a 256 bit number):

mapping (uint256 => address) internal tokenOwner;

Consequently, to transfer a token, a sender, a receiver, and the ID of the token to be transferred have to be provided:

function transferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
    ...

    removeTokenFrom(_from, _tokenId);
    addTokenTo(_to, _tokenId);

    ...
}

For comparison, the corresponding lines of this ERC20 implementation look like this:

mapping(address => uint256) balances;

function transfer(address _to, uint256 _value) public returns (bool) {
    ...

    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);

    ...
}

So here, there are no identifiable tokens, but for each user a balance is stored which is increased or decreased by a value. Transfers from different sources simply add up and it's impossible to distinguish them afterwards.

  • Just one more question, how is this token ID generated? There is no token ID for the ERC20 tokens? – Danny Apr 20 '18 at 6:21
1

The ERC-721 Standard explains the requirements of an ERC-721 token.

Each token has its own unique token ID, which never changes throughout the life of the token. Any given token can only belong to one person at a time, and tokens are transferred individually. Your token contract should keep track of who owns which specific tokens at any givevn time.

Tokens may have other metadata attached to them, depending on your needs.

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.