Hi community,
Ergo Auction House is live!
I have started the first auction, everyone is welcomed to place bids and also start new auctions!
The only wallet supported currently is the node’s wallet. Hopefully, soon support for other wallets like Yoroi will be added. I personally will add support for Yoroi when it is ready on Yoroi’s side but contributions are also very welcomed.
For some non-technical aspects, please see the FAQ page of the website. Below are some technical details about the app.
Auction Contract
The auction contract is very similar to the discussion here. A lot of the credit must go to @robert @jasondavies @kushti and @scalahub for their great discussion in that post which led to the current contract and app.
{
val seller = SELF.R4[Coll[Byte]].get
val endTime = SELF.R5[Int].get
val minBidDelta = SELF.R6[Long].get
val currBidder = SELF.R8[Coll[Byte]].get
val currBid = SELF.value
val auctionLogic = if (HEIGHT < endTime) {
val newSelf = OUTPUTS(0)
val oldBidRefundBox = OUTPUTS(1)
val newBid = newSelf.value
newSelf.tokens(0) == SELF.tokens(0) &&
newSelf.propositionBytes == SELF.propositionBytes &&
newBid >= currBid + minBidDelta &&
oldBidRefundBox.propositionBytes == currBidder &&
oldBidRefundBox.value >= currBid &&
newSelf.R4[Coll[Byte]].get == seller &&
newSelf.R5[Int].get == endTime &&
newSelf.R6[Long].get == minBidDelta &&
newSelf.R9[Coll[Byte]] == SELF.R9[Coll[Byte]] &&
newSelf.R7[Coll[Byte]] == SELF.R7[Coll[Byte]]
} else {
val winnerBox = OUTPUTS(0)
val sellerBox = OUTPUTS(1)
val feeBox = OUTPUTS(2)
val dataInput = CONTEXT.dataInputs(0)
val auctionFee = currBid / dataInput.R4[Int].get
val feeTo = dataInput.R5[Coll[Byte]].get
dataInput.tokens(0)._1 == auctionTwinToken &&
feeBox.value >= auctionFee &&
feeBox.propositionBytes == feeTo &&
winnerBox.tokens(0) == SELF.tokens(0) &&
winnerBox.propositionBytes == currBidder &&
sellerBox.value >= currBid - auctionFee - maxFee * 2 &&
sellerBox.propositionBytes == seller
}
sigmaProp(auctionLogic)
}
Where auctionTwinToken is “35f2a7b17800bd28e0592559bccbaa65a46d90d592064eb98db0193914abb563” and maxFee is 3000000 nano ERG.
Business Aspect
There is a business aspect behind Ergo Auction House similar to one I have explained here. When some auctioning is over, a small percentage of the final bid (2% currently) will go to the Ergo Auction House’s coordinator.
To elaborate more, the auctionTwinToken specified in the auction’s contract is the business’s token in a quantity of two. One of them is used to represent the data input, the other will be in hands of the business coordinator. One who has access to the second pair can receive the auction’s profit by modifying the data input. Here is the data input’s contract:
{
val isCoordinator = INPUTS(1).tokens(0)._1 == SELF.tokens(0)._1
sigmaProp(isCoordinator && SELF.id == INPUTS(0).id)
}
This has some nice implications; For example, The coordinator can auction the second pair of the auctionTwinToken and hence auction the Ergo Auction House’s business.
Some Security Aspects
The server is only being used to serve the app, Ergo Auction House will never send requests/info to the server.
The website is currently being served over HTTP since the node runs over HTTP and browsers don’t allow mixed-contents (HTTPS contexts to use HTTP requests). In order to participate in auctions or start new ones, one needs to have access to her node locally (or some kind of secure private network); Although it is possible to use node through the internet, I strongly advise against doing so.
The app is completely open-sourced and accessible here.
Contributions are welcomed!