ethereum / EIPs

The Ethereum Improvement Proposal repository
https://eips.ethereum.org/
Creative Commons Zero v1.0 Universal
12.83k stars 5.25k forks source link

Proposed ERC20 change: make 18 decimal places compulsory #724

Closed vbuterin closed 2 years ago

vbuterin commented 6 years ago

Rationale:

holiman commented 6 years ago

I think this is a very good idea, and strongly support it.

djrtwo commented 6 years ago

How would we handle existing erc20s with other choice of decimals? Recommend a hard fork (move balance to new contract)?

On Thursday, September 28, 2017, Martin Holst Swende < notifications@github.com> wrote:

I think this is a very good idea, and strongly support it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ethereum/EIPs/issues/724#issuecomment-332766243, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXf-2G78x19t8XByBCKSzbZ14ShdYwpks5sm1iFgaJpZM4Pm5UT .

alexvandesande commented 6 years ago

The main issues, IMHO:

My proposal would be:

1) Set 18 decimals as the standard for any tokens that do not specify decimals(). This should include wallets: Mist for example assumes 0 decimals if no other standard is set 2) Remove decimals from the standard and most libraries and encourage its deprecation 3) Encourage all new tokens to coalesce into 18 decimals

pdaian commented 6 years ago

ACK @alexvandesande idea of setting this as a default NACK on removing option to set decimals.

Tokens that have real utility may not be arbitrarily divisible to 18 decimal places, and this would create a more confusing user experience for these tokens.

Example: consider an API token where 1 unit gives access to a functionality worth $5. Requiring 18 decimals gives you one of two choices: either allow people to hold "partial API credits", which may be confusing to users, or give your token a very high per-unit valuation, which may also be confusing to users.

To solve the light client issue, perhaps require tokens to issue an event on genesis with their lite-client-pertinent parameters.

MysticRyuujin commented 6 years ago

Could the standard not be updated to be encouraged to define the decimals within their contract through a standardized variable or return function, which could be read by the wallets, otherwise default to 18 unless otherwise specified? I'd agree that we should maintain the option for != 18 decimals but encourage some default and not break backwards compatibility.

Souptacular commented 6 years ago

ERC-20 is a finalized community standard (#20). Imo if a standard, such as ERC-20, were to be updated after finalization it should either take on a new ERC number, such as #223, or take on a versioning scheme such as "version 2". For this particular case I suggest that this rule be added to another upcoming token standard, such as #223. This prevents already existing ERC-20 tokens from not being considered "ERC-20 compliant".

MysticRyuujin commented 6 years ago

@Souptacular I absolutely agree with this. The IETF RFC process is exactly the same, once an RFC is finalized it's done. Future RFCs can superseded previous RFCs and building on #223 is the way to go. #20 would simply be "updated" to state that it is updated by #223 and no longer best practice once finalized (if accepted and finalized).

ligi commented 6 years ago

I strongly support a token standard with a fixed number of decimals! With the words of @prusnak (CTO of @satoshilabs) :

decimals should be killed with fire ( https://github.com/ethereum/EIPs/pull/681#issuecomment-319340073 )

Really good for offline-solutions/hardware wallets!

MysticRyuujin commented 6 years ago

223 already defines a decimals() return function so at this point I think the debate is just "Make 18 mandatory?" - My vote is no, too restrictive.

prusnak commented 6 years ago

Introducing decimals was a very bad engineering move in the first place. I support having the fixed value.

MicahZoltu commented 6 years ago

Please discuss further in #223. #20 is finalized and therefore immutable at this point aside from typos and readability. This would be a backward incompatible change to #20 so it can't be implemented as an extension EIP on top of #20. #223 is a proposal for a new token, and while there is some contention around it it currently contains the most discussion, including arguments for and against decimals.

Arachnid commented 6 years ago

Discussion doesn't need to be merged to #223 - that's just one proposal for a new token standard. We could just as easily define a new standard that extends #20 by only adding a restriction on decimals.

5chdn commented 6 years ago

My support level for this proposal is over 9000! :fire:

mcdee commented 6 years ago

Over 40% of the tokens listed at http://etherscan.io/tokens do not use 18 for their decimals value. Retrospectively changing the ERC-20 specification would cause far more harm than good.

holiman commented 6 years ago

Example: consider an API token where 1 unit gives access to a functionality worth $5. Requiring 18 decimals gives you one of two choices: either allow people to hold "partial API credits", which may be confusing to users, or give your token a very high per-unit valuation, which may also be confusing to users.

I think the case of non-divisable tokens is a pretty good usecase; where a token represents a non-divisable thing. Such as tokens representing membership or Beertoken (where one wei would be one atto-beer). But I'd rather see the a boolean: isDivisable or something like that, where anything divisable would always use 18 decimals.

And I don't think this necessarily is tied to #223, but I agree not to retroactively change ERC20. This should be a new ERC.

alexvandesande commented 6 years ago

Can we please focus on the topic itself and not on the format of the ERC? It's clear by now that this is not about ERC20, but a forward looking standard?

@mcdee

Over 40% of the tokens listed at http://etherscan.io/tokens do not use 18 for their decimals value. Retrospectively changing the ERC-20 specification would cause far more harm than good.

Great point, let's go for numbers! Using MyEtherWallet Big list of tokens of 191 popular tokens here are the stats I calculated:

    decimals  Percent of tokens
      0        10% 
      1        0.5% 
      2        3.1% 
      3        1.5% 
      4        1% 
      5        1% 
      6        2.6% 
      7        0.5% 
      8        21% 
      9        3.6% 
      10       0.5% 
      11       0% 
      12       1.5% 
      13       0% 
      14       0% 
      15       0.5% 
      16       1.5% 
      17       0% 
      18       51% 

Over 51% use 18 decimals, followed by 21% that uses 8 decimals, followed by 10% using no decimals at all. (no one uses more). Seems the standard is coalescing for 18.

For me, even if this proposal is not accepted, is already data enough for Mist to guess the default of 18 for any tokens that do not specify it.

5chdn commented 6 years ago

I believe tokens deployed with the Parity DApp default to 8 decimals. That could explain why so many tokens have 8. But I'm happy to change that to anything that makes sense.

mcdee commented 6 years ago

@alexvandesande my numbers were to highlight how changing the spec retrospectively would be bad rather than any suggestion about values for the future.

There are good arguments for the divisibility of tokens at the least being 0 (indivisible) or some high value (e.g. 18 near-continuous). This could be enabled with a flag rather than an int, although then it would still require a query of the blockchain to find out its value and so doesn't help the offline use case.

Hard-coding decimals to 18 makes it impossible to have an indivisible token (the token itself can handle indivisibility inside its own contract but what about partial token transfer on exchanges for example?). Losing such functionality seems like a big step.

Arachnid commented 6 years ago

I personally don't think indivisible tokens are a big issue. Every use case I can think of can simply take the floor of the number of tokens when counting, eg, memberships, subscriptions, badges, etc. Token contracts can be written to only transfer whole numbers if desired, too, and exchanges wishing to list that token will have to adapt.

mcdee commented 6 years ago

@Arachnid but how would an exchange know that a token is meant to be indivisible?

shrugs commented 6 years ago

mcdee's point is definitely worth considering; we currently have this extra logic for variable decimals, but if we want to also support indivisible tokens via a boolean, we're just adding a different (and more specific) logic to contracts that interact with these new standardized tokens.

Perhaps a middle ground: say we have an indivisible token contract with exactly 10 total supply. the contract provides some sort of indicator that they are indivisible (aka have 0 decimal places) via an optional public constant. Then any dapp that interacts with these indivisible tokens either

1) doesn't know they're indivisible, but does know the totalSupply is 10 but represents that as 10 / 10^18, 2) does know that and represents it as 10

Regardless, the math is the same (the token is indivisible), and only the presentation is affected. It might be weird handling 1e-18 tokens on a frontend that is offline or not updated, but users would ideally be aware of the indivisibility of the token they're interacting with.

Additionally, if an indivisible token wanted to be able to be traded on an exchange divisibly (I'm really surprised autocorrect understands that word), but only used indivisibly, it could do the "only whole numbers accepted" logic in its own contracts, isolating the extra logic.

Dexaran commented 6 years ago

If I understand it correctly, the proposal is to remove the decimals variable from the token standard at all AND consider each token has 18 decimals. Right?

Arachnid commented 6 years ago

@mcdee That's up to the exchange. They can add a field for it in their database.

Nevertheless, I'd like to hear a use-case for an indivisible token that should actually prohibit part-tokens rather than just round them down when counting them for whatever purpose they exist.

mcdee commented 6 years ago

That's up to the exchange. They can add a field for it in their database.

But how does the token owner let the exchange know? The only sane method is to add a field to their contract to allow the exchanges to pick up the value, and we're right back where we started.

Nevertheless, I'd like to hear a use-case for an indivisible token that should actually prohibit part-tokens rather than just round them down when counting them for whatever purpose they exist.

As to flooring partial token transfers: let's say that I have a token I want to be indivisible and the code receives a request to transfer 1.510^18 tokens. Rounding it down so that only 110^18 tokens is transferred is bad because the contract hasn't done what was requested of it. Should the contract throw instead? That would confuse users as they could see that their balance was enough to carry out the transfer.

As to a use case for indivisible tokens, how about a token that represents 100g of physical gold? The company needs to be able to exchange tokens for physical gold if required, and doesn't want someone turning up with 0.00876543212345678 tokens expecting them to be changed for a sliver of metal. The general point holds for many items where a single token could represent a physical or logical entity and the token holder doesn't want said entity to be partially owned.

Arachnid commented 6 years ago

But how does the token owner let the exchange know? The only sane method is to add a field to their contract to allow the exchanges to pick up the value, and we're right back where we started.

Are you presupposing an exchange that automatically lists tokens? I was thinking of 'traditional' exchanges.

Nevertheless, there are always going to be tokens that have weird transfer conditions, etc. Perhaps such tokens simply won't work with some exchanges.

As to flooring partial token transfers: let's say that I have a token I want to be indivisible and the code receives a request to transfer 1.510^18 tokens. Rounding it down so that only 110^18 tokens is transferred is bad because the contract hasn't done what was requested of it. Should the contract throw instead? That would confuse users as they could see that their balance was enough to carry out the transfer.

No, it would transfer 1.5e18 base tokens. If you previously had 3 tokens and the recipient had 0, you now both have 1.5 tokens - and for the purpose of counting subscriptions / badges / whatever, you each have 1.

As to a use case for indivisible tokens, how about a token that represents 100g of physical gold? The company needs to be able to exchange tokens for physical gold if required, and doesn't want someone turning up with 0.00876543212345678 tokens expecting them to be changed for a sliver of metal. The general point holds for many items where a single token could represent a physical or logical entity and the token holder doesn't want said entity to be partially owned.

Then the store need merely say "we only accept integer numbers of tokens", and reject all offers to exchange fractional amounts.

mcdee commented 6 years ago

Are you presupposing an exchange that automatically lists tokens? I was thinking of 'traditional' exchanges.

0x (and other distributed exchanges/exchange protocols) allow any ERC-20 token, so yes automatic.

Then the store need merely say "we only accept integer numbers of tokens"...

This and the idea of notifying exchanges of divisibility is moving functionality that currently exists in ERC-20 through use of decimals to manual or otherwise off-chain notifications/enforcement. Doesn't feel very "smart contract" to me.

Hard-coding decimals to 18 is a reduction in the on-chain functionality that exists today, to the benefit of UIs for offline transaction generation. From Alex's post above just under half of existing tokens made a different choice which must suggest that there is utility in having the option available.

realcodywburns commented 6 years ago

The simplest solution would be to subclass tokens. Keep the existing, or substantially similar standard, and allow for sub-classification as: ERC2x.1 atomic units; ERC2x.2 10^8; ERC2x.3 10^18. This would keep things backward compliant with ERC20 while allowing for some degree of predictability for HW wallets. All pre-class tokens should default to ERC20.3for compatibility.

Arachnid commented 6 years ago

This and the idea of notifying exchanges of divisibility is moving functionality that currently exists in ERC-20 through use of decimals to manual or otherwise off-chain notifications/enforcement. Doesn't feel very "smart contract" to me.

I agree about divisiblity - but I don't think a store saying they'll only accept integer numbers of tokens is a problem. In fact, the "10g of gold token" you hypothesise seems more useful if it can be subdivided, even if you can only redeem integer quantities.

I'm ambivalent about the proposal to hardcode decimals, but I don't think indivisible tokens are a compelling argument against it.

alexvandesande commented 6 years ago

I agree. A token can be indivisible and still have 18 decimal points that aren't used, and in the implementation, just fail if someone tries to send less than 1.

An app that isn't aware of the indivisibility, would just present your balance as 1.000000000000000000 (which any reasonable app would just display 1), and it will fail when sending less than 1.

Same things for an exchange: it can allow to sell fractions of the token, it just needs to alert the user that they won't be able to withdrawal floating point amounts.

Personally, I decided to go forward and update the ERC20 example on the homepage to have 18 decimals as the strongly suggested default. No change on the ERC at all.

DaveAppleton commented 6 years ago

So, we have two tokens, one to 8 d.p. and one to 18 d.p and both were deliberate calculated decisions that actually make sense to us.

It makes no sense for the first to be subdivided to smaller fractions because there is no utility in those smaller numbers - but I would have to add MORE code to ensure that all transfers are rounded to 8 dp? That really makes no sense to me at all.

On the other hand, accepting but disregarding the fractions below the 8 dp range also makes no sense because the remainder bits would be worthless yet charged for in an exchange.

To summarise, the argument for 18 is because we have a standard that 1) Wallets developers can't get right? 2) Token programmers can't get right? 3) ?

I can see no valid justification for either #1 or #2.

alexvandesande commented 6 years ago

@DaveAppleton the main argument for this is for clients that can't connect to the blockchain but want to display token information. It would be the case for the nano ledger wallet, for instance or an offline device.

Arachnid commented 6 years ago

So, we have two tokens, one to 8 d.p. and one to 18 d.p and both were deliberate calculated decisions that actually make sense to us.

It makes no sense for the first to be subdivided to smaller fractions because there is no utility in those smaller numbers - but I would have to add MORE code to ensure that all transfers are rounded to 8 dp? That really makes no sense to me at all.

I'm not sure I follow.

If you have legacy tokens, they're just that, and have whatever number of decimal places they have. You can migrate them to a new token or not, as you wish.

If you're designing new tokens, do you have a compelling use-case that requires exactly 8 decimal places?

abandeali1 commented 6 years ago

I want to point out that requiring 18 decimal places does break fungibility for tokens that are intended to be divisible by less than that. An extreme example: I have a token with a total supply of 10^18 that is intended to be completely indivisible and can only be "used" in increments of 10^18. If I transfer 1% of the token to another address, that address's share of the token is worth significantly more than 1% of the full token's value since I cannot use the token without it.

I dislike making any changes to how tokens are transferred (failing on partial values or taking the floor of partial values) because it adds too much unpredictability that can't be easily verified on-chain.

I think there should be a strong push for token creators to use 18 decimal places where it makes sense. I can even see 18 decimals adding value in tokens that would otherwise be less divisible (like fiat tokens, gold tokens, etc). But UIs that aren't connected to the blockchain will have to make assumptions about decimals anyways if they want to work with any existing ERC20 tokens, so I don't think there is a great reason to make this mandatory.

3esmit commented 6 years ago

Why are 18 decimals a standard for ETH at all? And why it should be for other tokens as well? Why 10% of tokens uses 0 decimals and 21% uses 8 decimals?

Once I designed a AbstractToken I made the decimals be useful in case of an overflow at token generation function, so all balances would store what decimal it used, and if at generate it would change the decimals and rebase the amount. Wallet would have to call decimals everytime to know the balance. I abandoned this because it seemed too much gas and complication and a too far remote benefict.

AFDudley commented 6 years ago

Just some food for thought. https://twitter.com/EnigmaMPC/status/918657632667426818

mcdee commented 6 years ago

@AFDudley is there anything there that wouldn't be fixed by wallet software obtaining information directly from the contract given its address?

o0ragman0o commented 6 years ago

To my mind 18 decimals places is required to cover the granularity of gas resource accounting at machine instruction scale, up to the scale of human accounting. Human scale precision rarely needs to be more than say 6 decimal places while gas calculation have to cover multiplications of gas price and gas used each of 6~9 orders of magnitude resulting in solutions in the order of 12 to 18 orders of magnitude. We can see here a cross over scales which is reflected in the human scale representation of transaction fees.

Because tokens don't require gas accounting, they shouldn't need more than human readable precision, so 18 decimal places is unnecessary, however, in the ICO's I've been contracted to write which which insist upon a USD denomination (a bad idea), I've found the exchange rate maths to be greatly simplified by giving the token 1 to 1 parity of decimals places.

On 12 October 2017 at 04:24, Ricardo Guilherme Schmidt < notifications@github.com> wrote:

Why are 18 decimals a standard for ETH at all? And why it should be for other tokens as well? Why 10% of tokens uses 0 decimals and 21% uses 8 decimals?

Once I designed a AbstractToken https://github.com/ethereans/abstract-token/blob/master/contracts/AbstractToken.sol I made the decimals be useful in case of an overflow at token generation function, so all balances would store what decimal it used, and if at generate it would change the decimals and rebase the amount. Wallet would have to call decimals everytime to know the balance. I abandoned this because it seemed too much gas and complication and a too far remote benefict.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ethereum/EIPs/issues/724#issuecomment-335903113, or mute the thread https://github.com/notifications/unsubscribe-auth/AMMqOkrJVHfPzIW-hQhfqdwDKJSyDkl5ks5srQfVgaJpZM4Pm5UT .

Arachnid commented 6 years ago

@o0ragman0o You're talking about decimal places like they're a scarce resource. What's the harm in having more decimal places than you need?

o0ragman0o commented 6 years ago

Nothing in particular, but excess decimals can make contract readability and testing more annoying. I don't see any argument for setting a compulsory fixed point though, especially not now there are so many tokens out there.

On 15 October 2017 at 20:36, Nick Johnson notifications@github.com wrote:

@o0ragman0o https://github.com/o0ragman0o You're talking about decimal places like they're a scarce resource. What's the harm in having more decimal places than you need?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ethereum/EIPs/issues/724#issuecomment-336702416, or mute the thread https://github.com/notifications/unsubscribe-auth/AMMqOvixsnnT8ntgPLtFckWnd2V3Nzydks5sseA7gaJpZM4Pm5UT .

3esmit commented 6 years ago

When thinking about the divisibility of tokens, and the fact that we use only integral numbers, seems to be good to have more decimals then needed, so these precision errors will be irrelevant.

AFDudley commented 6 years ago

@mcdee sure. But that just sounds like you're putting the standard up the stack. Which is problematic given the maturity of the stack and the scarcity of skill throughout the space. All of this needs to be closer to foolproof.

mcdee commented 6 years ago

@AFDudley not pushing the standard anywhere, but even if decimals disappeared tomorrow the token would still have its name, symbol and total supply embedded in the contract and it makes sense for any user-facing interfaces to pull said data from the contract rather than ask user's to transpose it themselves.

3esmit commented 6 years ago

Shouldn't we look at IEEE 754? I found this https://en.wikipedia.org/wiki/Octuple-precision_floating-point_format

A binary256 would have a significant precision of 237 bits (approximately 71 decimal digits) and exponent bias 262143.

I guess is not the case because we don't need the precision, this obviously would be useful for advanced scientific purposes (not the case of smart contracts), but then we should standarize the 18 decimal places for currency purposes with the formal process of EIP.

DaveAppleton commented 6 years ago

When thinking about the divisibility of tokens, and the fact that we use only integral numbers, seems to be good to have more decimals then needed, so these precision errors will be irrelevant.

You're talking about decimal places like they're a scarce resource. What's the harm in having more decimal places than you need?

1) It is a bad idea to change something that is already established and has found significant use cases with non-18 values. 2) Anybody who has a valid non-18 use case would be forced to implement special logic in approve, transfer, transferFrom and all other functions to truncate to 18 dp. which strikes me as both a waste of gas and a disaster waiting to happen. 3) If people tried to transfer 0.0000000001 of a unicorn - how do you handle it in a way that the user can understand bearing in mind that the average user does not read logs?

jrpereira commented 6 years ago

A token can be indivisible and still have 18 decimal points that aren't used, and in the implementation, just fail if someone tries to send less than 1.

The point of decimals is not to establish a minimum, it's to establish a minimum increment. A token can represent a unit of something, and that unit can be divisable only down to a certain amount, for a reason.

There seems to be some confusion between unit and precision in this discussion. Depending on what we're measuring, we can have the same SI Unit, but different precision needs. Let's consider the metric weight unit in the SI, for instance:

  1. I sell a product by the kilo, and the smallest unit the scales I use can detect are "grams", so I want my token to have exactly 3 decimals.
  2. I sell a product by the kilo, and the minimum contract is for 1 unit (eg, futures on pistaccio production). The unit is still SI kilogram, so I want 0 decimals.
  3. I sell a product by the ton, and that's the minimum contract (eg, futures on wheat production). The unit is still SI kilogram, but I only want multiples of 1000. Right now I can't do this with ERC20, unless I'm willing to change the token to represent a non-SI unit (ton).
  4. Another example - I am representing a currency that tracks USD amount in a real-world bank account. The balance in said accounts can only vary by a cent, so I need it to have 2 decimals. And yes, the math (eg, calculate % interest) can use any precision I want, but at the end of the day, I can only store increments in 1 cent, and my token should reflect that.

You're talking about decimal places like they're a scarce resource. What's the harm in having more decimal places than you need?

Well, the point is that more decimal places may not mean anything. If I have a token where only 3 decimals make sense, the UI should be able to use the decimals() field to provide a fixed-size display, and there should be no way to store values that don't make sense.

Ultimately, it shouldn't matter much how tokens are stored internally, what matters is how people perceive and interact with value. As we are today, most sane wallets already multiply by 10**decimals(), not by 10**18 - that's a behaviour we should keep.

As a sidenote, I can't help but feel that JS's lack of native support for infinite precision, led us to go back to the stone age. :) We should be able to use 20.0002 rather than 20000200000000000000 - now that would be something.

nickjuntilla commented 6 years ago

As @o0ragman0o put it 18 decimals only makes sense in trying to find a common ground between human readable ETH and gas prices. For tokens this only forces us to have extra complication.

Ideally keeping the bulk of your numbers ahead of the decimal makes things easier to talk about. Look at bitcoin. We are forced to make up units to make talking about 1 hundredth and 1 thousandth easier to talk about. If you can accurately predict the popularity of your token you don't have to make up these units. With USD we have dollars and cents and most things cost more than a penny. What would happen if most things cost less than a penny? What if a pack of gum costs 0.0003 of your token? Now you need a new word. Every popular token will need list of tiny units.

The point is if you don't want to keep making up names for every small amount of every token then you will keep your units ahead of the decimal. Just because 18 decimals is good for Ethereum doesn't mean it's good for every token. In fact it's probably worse in almost every other case.

For display if you have 18 decimals and you want to accurately display how many tokens someone has you must print down to 0.000000000000000001 for legal purposes. You can't say they have 0.000. That would be incorrect. That is a display nightmare. If your token only has 3 decimals for instance you can legally tell someone they have 0.001 and it is accurate.

There are no indivisible tokens such as securities tokens representing 1 stock. This is a very strong case for 0 decimals. It's easy to fit them into the ERC20 standard as-is.

We already have all the tools we need in the current ERC20 to handle most cases. Once you add the code to handle the decimals you never have to deal with it again.

You will also encourage more bugs. If apps start expecting tokens to have 18 decimals and then one comes along that does not there will be a bug. This means that as long as even 1 popular token uses a different amount of decimals you will need to code for it and since that number is currently 49% the day will never come when you can expect 100% at 18 decimals. In fact with the coming representation of more real world assets it will probably become more likely that some tokens will require a specific divisibility.

It seems to me that the status quo is working fine and is very future friendly. I can understand the desire simplify things, but I think if we would have started off at mandatory 18 we would have eventually had to add the optional decimal place as a feature. I think removing it is not progress. I think we will likely have to add more features, not remove them. I think it is very convenient that we have the decimal feature and allows for many use cases while being very explicit in how we handle it in the code. It's mostly for display only so all you have to do is insert the decimal at end for your display. It's a simple modification that handles real world use cases for tokens. Tokens are not the same as Ethereum.

MicahZoltu commented 6 years ago

@nickjuntilla Discussion about decimals should be moved to one of the new token standards, as ERC20 is final and thus immutable aside from grammar/spelling/clarity updates.

If you can accurately predict the popularity of your token

If you decide to continue discussing elsewhere, this is the point you are going to have to argue much more strongly for. Predicting the future value of your token is nearly impossible. Even fiat currency which has a guiding hand trying really hard to keep its value fixed still fluctuates with time (a penny/pence/cent used to be meaningful, but it no longer is).

meisser commented 6 years ago

There are lots of use-cases that require 0 decimals for legal reasons. For example, it is legally impossible to own 13.2 shares of a company. So if you want to properly implement shares on the blockchain, you must be able to enforce decimals = 0 with ERC-20. Otherwise, you cannot use ERC-20 tokens for shares or bonds and many other established financial constructs.

MicahZoltu commented 6 years ago

That can be implemented in the token by having it throw if a user tries to transfer a non-insignificant number of tokens. See ERC-777 for some thoughts on this.

meisser commented 6 years ago

@MicahZoltu That would result in a horrible user experience. It should not be the responsibility of the user to get the number of significant digits right in a transaction, this should be automatically done by the wallet. Thus, there must be a way to signal to the wallet what the granularity is, which is done with the decimals field in ERC-20. The approach of ERC-777 is inferior in many regards. Also note that the natural interpretation of an integer including uint256 is to say that 1 means 1, and not that 1 means 0.000000000000000001.