Skip to content

Latest commit

 

History

History
101 lines (91 loc) · 5.36 KB

fip-0042.md

File metadata and controls

101 lines (91 loc) · 5.36 KB
fip title status type author created updated
42
Enable FIO Address and Domain registration in a single transaction
Final
Functionality
Pawel Mastalerz <[email protected]>
2022-02-17
2024-01-19

Abstract

This FIP introduces a new action which registers both the FIO Domain and FIO Address in a single action. It also allows the user to specify, in the same action, if the domain should be public or private.

New actions

Contract Action Endpoint Description
fio.address regdomadd /register_fio_domain_address Registers FIO Domain and FIO Address.

Motivation

Currently it is not possible to register a FIO Domain and FIO Address in a single transaction. One has to register a FIO Domain first and then the owner has to register a FIO Address on it. This creates difficulties when the registration is not performed by the owner, e.g. the registration site operated by the Foundation. The registration site collects funds (e.g. BTC) and then registers the domain to owners FIO Public Key. However, it cannot register the FIO Address in the same process, because if the domain is private only the owner can register and they have to pay with FIO Tokens from their own account.

This FIP enables the creation of a FIO Domain and FIO Address in a single transaction.

Specification

New actions

Register FIO Domain and Address

Registers FIO Domain and FIO Address.

Contract: fio.address

New action: regdomadd

New end point: /register_fio_domain_address

New fee: register_fio_domain_address, not bundle-eligible, fee amount will be determined during development and updated here

RAM increase: To be determined during implementation

Request body

Parameter Required Format Definition
fio_address Yes Valid FIO Address FIO Address on a new domain. Both the domain and FIO Address will be registered.
is_public Yes 0 or 1 0 - the domain will be private; 1 - the new domain will be public.
owner_fio_public_key Yes String FIO Public Key of the owner of the FIO Domain and FIO Address being registered.
max_fee Yes Positive Int Maximum amount of SUFs the user is willing to pay for fee. Should be preceded by /get_fee for correct value.
tpid Yes FIO Address FIO Address of the entity which generates this transaction. TPID rewards will be paid to this address. Set to empty if not known.
actor Yes 12 character string Valid actor of signer
Example
{
  "fio_address": "purse@alice",
  "is_public": 0,
  "owner_fio_public_key": "FIO8PRe4WRZJj5mkem6qVGKyvNFgPsNnjNN6kPhh6EaCpzCVin5Jj",
  "max_fee": 30000000000,
  "tpid": "rewards@wallet",
  "actor": "aftyershcu22"
}

Processing

  • Request is validated per Exception handling.
  • New account is created with owner_fio_public_key if it does not yet exist.
  • RAM of actor calling action is increased.
  • register_fio_domain_address is charged to actor calling action.
  • Check for maximum FIO transaction size is applied.
  • FIO Domain is registered with is_public as supplied with owner_fio_public_key as owner.
  • FIO Address is registered on new domain with owner_fio_public_key as owner.

Exception handling

Error condition Trigger Type fields:name fields:value Error message
Invalid FIO Address Format of FIO Address not valid. 400 "fio_address_domain" Value sent in, i.e. "-alice@-purse&purse" "Invalid FIO Address format."
FIO Domain already registered Supplied FIO Domain has alreday been registered. 400 "fio_address_domain" Value sent in, i.e. "alice@purse" "Domain already registered, use regaddress instead."
Invalid is_public is_public is not 0 or 1 400 "is_public" Value sent in, i.e. "2" "Invalid is_public format, use 0 or 1."
Invalid FIO Public Key Format of FIO Public Key is not valid. 400 "owner_fio_public_key" Value sent in, i.e. "123" "Invalid FIO Public Key format"
Invalid fee value max_fee format is not valid 400 "max_fee" Value sent in, e.g. "-100" "Invalid fee value"
Fee exceeds maximum Actual fee is greater than supplied max_fee 400 "max_fee" Value sent in, e.g. "1000000000" "Fee exceeds supplied maximum"
Insufficient balance Available balance in account is less than fee 400 "max_fee" Value sent in, e.g. "100000000000" "Insufficient balance"
Invalid TPID tpid format is not valid 400 "tpid" Value sent in, e.g. "notvalidfioaddress" "TPID must be empty or valid FIO address"
Signer not actor Signer not actor 403 Type: invalid_signature

Response body

Parameter Format Definition
status String OK if successful
expiration date-time Timestamp of domain expiration
fee_collected Int Amount of SUFs collected as fee
Example
{
  "status": "OK",
  "expiration": "2020-09-11T18:30:56",
  "fee_collected": 1000000000
}

Rationale

An alternative approach was considered to modify regaddress action to automatically register a FIO Domain if supplied FIO Address is on a non-existent domain. However, it was considered confusing to the user and would forced them to figure out what fee would be charged upon successful registration.

Implementation

TBD

Backwards Compatibility

No changes to existing actions. However, any statistics system which looks for regdomain to figure out new domain registrations would have to be updated to also look at regdomadd.

Future considerations

None

Discussion link

https://fioprotocol.atlassian.net/browse/WP-949