RFC: Native DNS on top of pubkey-hash addresses #3454
Replies: 4 comments 19 replies
-
Caveat: what happens if I'm logged in damir.massa and while being logged in, I change the owner/target or delete the domain damir.massa ? |
Beta Was this translation helpful? Give feedback.
-
Open question: what about the reverse lookup ? |
Beta Was this translation helpful? Give feedback.
-
I like the proposal. I didn't understand the Personal thoughts about the comments :
I don't see a real usage as soon as the address has been transferred we don't need to have the owner informations. It would take some storage space and so cost more coins to create a DNS address for no real value. Maybe worth implementing it in a v2 but I'm not a fan of paying more for something in the future.
What would be the use cases ? It could add a lot of computation power no ? I don't have real opinions right now |
Beta Was this translation helpful? Give feedback.
-
Here is a possible V1 allowing Massa Station to proxy .massa addresses, everything else is removed and can be added later: StateWe add a new table The first field Booking a domain nameA new transaction type
As there is no transfer/free possibility, storage cost can be interpreted as a burn. Resolving a domain name with the APIResolution is done only with the API. Storage CostsWorks exactly as for other state tables, paying storage costs when increasing state size. |
Beta Was this translation helpful? Give feedback.
-
Introduction
We need a native DNS, instead of a smart contract DNS so that you can simply send coins to myaddress.massa without specifying to which DNS contract you refer to. We could hardcode only the DNS smart contract address natively to achieve this, but it's probably a good idea to implement the full DNS natively to save gas as those are a few simple functions used very frequently.
@damip proposed a native DNS (#2646) replacing pubkey-hash addresses with ".massa" chosen addresses, where ".massa" chosen addresses are associated to pubkeys (not pubkey hash), with no P2PK (pay to pubkey) possibility.
There are several downsides with this approach:
Here I instead propose building the native DNS on top of pubkey-hash addresses.
This is a general description, not a detailed specification.
Note: With both approaches we gain a small amount of Account Abstraction (AA), but the full AA can only be achieved with smart contract accounts, for which I think the simplest approach for Massa would be to follow EIP-2938 with a new type of transaction and a PAYGAS opcode (cf #3456 discussion).
Address
A domain name is a
.massa string
.Now, an
address
can be either apubkey-hash
or a.massa string
domain name.State
We add a new table
DNS
to the state.The
DNS
table is composed of(.massa string, address, is_immutable)
rows, indexed by the first field (whose items appear at most once).The first field
.massa string
is the domain name that was booked, and which points to the second field, theaddress
.The
is_immutable
field specifies ifaddress
can change in the future.Caller and Login
A new ABI call
LOGIN(dn)
allows to login to a domain namedn
, changing the current identity/account/caller address todn
andLOGOUT
reverts the caller address to the previous one.LOGIN(dn)
succeeds only if the current caller is the address associated todn
in the DNS.A pubkey-hash address can login to a domain name address which can login to another domain name address etc.
Booking/Transferring/Freezing/Freeing a domain name
A new transaction type
DNS_TX
allows to book, transfer, freeze or free a domain name.DNS_TX(BOOK, dn, address)
books the domain namedn
and assigns it to any addressaddress
. Succeeds only ifdn
is not already booked.DNS_TX(TRANSFER, dn, address)
transfers the domain namedn
and assigns it to any addressaddress
. Succeeds only if the transaction caller is the address associated todn
in the DNS and theis_immutable
field isFalse
.DNS_TX(FREEZE, dn)
freezes the domain namedn
by setting theis_immutable
field toTrue
. Succeeds only if the transaction caller is the address associated todn
in the DNS and theis_immutable
field isFalse
.DNS_TX(FREE, dn)
frees the domain namedn
. Succeeds only if the transaction caller is the address associated todn
in the DNS and theis_immutable
field isFalse
.New ABI calls allow to do the same operations from smart contracts.
Resolving a domain name
When a normal transaction sends coins to an address that is not a pubkey-hash, then the address is resolved with the DNS (recursively if needed), and the coins are transfered to the pubkey-hash. Succeeds only if a pubkey-hash was resolved, fails if detecting a cycle or if there is no address associated.
A
RESOLVE(address)
ABI allows to resolve an address from a smart contract. Returns the pubkey-hash or fails.Storage Costs
Works exactly as for other state tables, paying storage costs when increasing state size, getting back storage costs when decreasing state size.
Staking
Only pubkey-hash addresses can buy rolls and stake.
Example Use Case: ERC-20
An ERC-20 contract stores how much coins a given address has.
Now the address can be either a
pubkey-hash
or a.massa string
domain name.In order to spend the ERC-20 of a domain name address, one has to
LOGIN
before.Comments:
DNS
table with(.massa string, owner_address, resolved_address)
to cover more use cases ?.massa
addresses to be a key in the ledger to cover more use cases ?Beta Was this translation helpful? Give feedback.
All reactions