Skip to content

DNS .p2p validation rules

Nikolai Mushegian edited this page Jun 8, 2014 · 1 revision

This file describes the extra data stores and validation rules for the extra transaction types that the .p2p blockchain has on top of the standard bitshares_toolkit.

Data Stores

Valid values for the name and value fields are described here.

Auction table

  • name *current_bid *current_bidder *required_bid *last_bid_block_num

We define an operation update_auction_table(name, current_bid, current_bidder, required_bid), which does what you expect. last_bid_block_num is updated automatically whenever an update_auction_table op succeeds.

Domain Record table

*name *owner *value *owner_state *last_update_block

Precommit table

*owner *hash

Transactions

Transactions are validated one at a time. All validation steps and operations are performed atomically. (Remember, any time you "withdraw" without depositing, you are destroying the shares AKA paying a transaction fee (to dividends)).

precommit(name, amount, owner)

Operations:

  1. withdraw from any address address_1 for at least MIN_TRX_FEE.
  2. `update_precommit_table(owner=owner, hash=HASH(name, amount)) AND NO OTHER OPERATIONS

Validation:

  • Either domain_records[name] must not exist, or owner_state[name] must be DOMAIN_STATE_EXPIRED
  • withdraw op succeeds (balances[address_1] > MIN_TRX_FEE)

first_bid(name, amount, owner)

This transaction type is detected by the presence of an update_auction_table op but WITHOUT a deposit.

Operations:

  1. withdraw(amount=AMOUNT1, owner=ANY_ADDR)
  2. `update_auction_table(name=name, current_bid=amount, current_bidder=owner, required_bid=2*amount)
  3. delete precommit_table[owner] AND NO OTHER OPERATIONS

Validation:

  • AMOUNT1 > GLOBAL_MIN_BID
  • withdraw op succeeds (balances[ANY_ADDR] > AMOUNT1)
  • domain_record_table[name] does not exist OR domain_record_table[name].owner_state == DOMAIN_STATE_EXPIRED
  • precommit_table[owner].hash == HASH(name, amount)
  • Transaction is signed by owner

Notice that it is the first first_bid, and not the first precommit, which determines who the first bidder is.

bid(name, amount, owner)

This transaction type is detected by the presence of an update_auction_table AND a deposit operation.

Operations:

  1. `withdraw(amount=AMOUNT1, address=ANY_ADDR)
  2. `deposit( amount=(AMOUNT1-auction_table[name].current_bid) * BIDDER_RETURN_RATIO, address=auction_table[name].current_bidder)
  3. `update_auction_table(name=name, current_bid = AMOUNT1, current_bidder = owner, required_bid = amount + (amount - auction_table[name].required_bid)) AND NO OTHER OPERATIONS

(notice a fee is paid equal to (AMOUNT1 - auction_table[name].current_bid) * (1 - BIDDER_RETURN_RATIO) )

Validation:

  • AMOUNT1 > auction_table[required_bid]
  • withdraw op succeeds
  • deposit op succeeds
  • CURRENT_BLOCK - auction_table[name] < AUCTION_DURATION_BLOCKS
  • update_auction_table op has exactly the values given in the description above

sell_domain(name, amount)

This transaction type is detected by the presence of a

update_domain(name, value, owner)

This transaction type is detected by the presence of a update_domain_record_table operation

Operations:

  1. update_domain_record_table(name=name, value=value, owner=owner)
  2. withdraw(amount=AMOUNT, addr=ANY_ADDR)

Validation:

  • Transaction is signed by domain_record_table[name].owner
  • AMOUNT > REQUIRED_TRX_FEE
Clone this wiki locally