gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
841 stars 342 forks source link

[Discussion] `std.ZeroAddress` #2316

Open leohhhn opened 2 weeks ago

leohhhn commented 2 weeks ago

Description

Should we have a ZeroAddress constant in Gno which will represent a universal burn address? This should be an address for which nobody can obtain the private key. I've found it missing multiple times when developing.

For example, in the case of GRC20 and other similar tokens, people usually send the tokens they want to burn to a zero address.

This "burn" functionality can be implemented in two ways as I see:

WDYT?

linhpn99 commented 2 weeks ago

If we prioritize transaction transparency, approach 2 is likely the better method

thinhnx-var commented 2 weeks ago

@leohhhn : In my view, we surely need ZeroAddress. This is the basis of tokens. I was suprised when I saw this issue :) And I also think this implementation should be inspired by ETH 0x00 address.

moul commented 2 weeks ago

Yes, the feature seems useful and will likely improve readability.

Just considering whether std is the most appropriate place. Perhaps we should explore ways to limit the size of the std API.

leohhhn commented 2 weeks ago

We could have a "consts" stdlib or similar for this if we had more constants. Related.

I think std is the right place right now, and as soon as #1695 is merged, we can work on the split of std and have a separate place for it.

@thinhnx-var @linhpn99 - would you be open to doing a bit of research on the best way to do this? One solution is to simply have a constant that is std.Address(""), but possibly there is a better way where we actually utilize the address derivation system to generate something that would be akin of a zero address. It needs to not have a private key or similar. It should also be harmonious with std.Address.IsValid() in some way. Also, please think about the possible use cases and examples, and provide them along with the PR, so that the case for it is even stronger.

If you can, after doing the research, please post your suggested approach either here on in the PR description.

thinhnx-var commented 2 weeks ago

@leohhhn yea I am working on this and will update our approach and implementation over here.

grepsuzette commented 1 week ago

Good idea.

Which is best:

AddressZero is more scary. There's a movie called Patient Zero.

thinhnx-var commented 1 week ago

@grepsuzette I am thinking about (maybe) the best approach and you are giving me one more thing to put in mind. Cool :D