0

This question already has an answer here:

Can we send tokens with data input? I did a bit of research on erc20 but maybe this is quite complicated. Will erc 721 do this?

marked as duplicate by Ismael, Richard Horrocks, alberto, shane, Majd TL Oct 13 at 10:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Can you give an example of data input? – Enrique Alcazar Oct 8 at 6:28
1

ERC20 and ERC721 are, by definition, interfaces.

You cannot attach extra data to the prescribed functions, e.g. transfer() because that will break compatibility with the standard interface.

You didn't say what you want to achieve so it's not possible to be specific about the solution. Two common approaches spring to mind.

ERC20 is for fungible assets - every instance is materially equal to the others. You can use this to represent a medium of exchange (e.g. currency), fractional ownership, general-admission seating, etc. You can separate the "extra data" into a separate function or separate contract that deals with both the extra data and the exchange of tokens.

ERC721 is for non-fungible assets - every instance is unique and materially different from the others, e.g. collectables, cryptokitties, reserved seating, etc. ERC721 deals with common functions, again transfer() and it is silent on the matter of metadata associated with each token.

A housekey would be an example. Such a thing can use a common set of rudimentary functions (e.g. transfer() from Alice to Bob) and custom metadata suitable to the application. The shape of the teeth is unique in each instance. ERC721 allows the introduction of additional functions (e.g. cutKey()) that can write to the arbitrary metadata of each instance.

Hope it helps.

  • thank you Rob Hitchens – StupidDev Oct 13 at 19:35

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