Auctions
This guide explains how to conduct fast decentralised auctions on pod. In these auctions, bidders submit bids before a predetermined deadline, and then anyone can query for the set of valid bids.
This collection of bids is the only output exposed by the protocol. Higher-order logic — such as pricing mechanism, validity filters, or winner selection — can be implemented on top of the primitive described here.
For an example implementation, go to examples/auctions of podnetwork/pod-sdk github repository.
Auction Contract
Solidity
The solidity smart contract code shows how to implement a basic decentralised auction on pod.
The requireTimeBefore primitive provided by pod ensures that a supermajority of pod validators received the bid before the deadline has passed. Even if a minority of validators is unavailable or faulty at the time, the bid will be accepted and these validators will eventually also include the bid in their ledger.
The contract assumes that the deadline for an auction_id is known between the bidders and if someone submits the wrong deadline the bid will be filtered out by the bidders.
Submitting a bid
Bid submission follows the standard way to send a transaction with a smart contract call to any EVM-based chain.
Reading bids
To read the bids submitted to the auction, use eth_getLogs making sure to filter for the correct event signature, auction_id and deadline, therefore rejecting any bids that were submitted with the wrong deadline.
However, before reading bids, it is essential to make sure that there will not be more bids that will be accepted by a supermajority of the validators after reading. This can be tricky because each node on the network receives a transaction at different timestamps, but also because some of the nodes can be malicious.
The rpc interface of a pod fullnode provides wait_past_perfect_time(deadline) method, that guarantees that all transactions that will ever pass the check requireTimeBefore(deadline) for this deadline will already have been executed by the full node.