if you’re filling bids as you go and don’t have a price target, how do you prevent low-ball bids from getting filled? You’d have to have a bidding period, then sort all bids to figure out which ones get filled. This leads to attack vectors where you can submit 1000s of bids to balloon the gas fees for the sorting operation.
You can do sorted insertions. When someone calls the on-chain
bid function, they provide a
nextBid hint that tells the on-chain contract where in the sorted list to put the things they are inserting. The contract would then verify that
prevBid was <
nextBid was >=
bid. If it is not, then the contract will walk the bids until it finds the right spot (this is to deal with race conditions between multiple bidders). In this scenario, the person doing the insert pays gas costs for sorting, and assuming throughput isn’t high insertion gas costs are pretty cheap since the sorting is done off-chain.
That sounds like it will work. I will use this method. Thanks.
we would like to build a decentralized Fed
Just to note that Fed original purpose is largely to secure the banking system against liquidity problems due to outstanding loans. We don’t have (yet) the blockchain mechanism of providing non p2p loans to businesses or consumers. We are just at the point of trying to use blockchain as a medium of exchange. Therefor the method for price stability can be much simplier than the one Fed’s using — in the end all coins we have now are always in the hands of their owners.
I’m not the original poster you were replying to but that is very interesting. Do you have further reading on the “purpose of the banking system is to [solve] liquidity problems due to outstanding loans (sc)”? I am under the impression that one of the Fed’s primary objectives is to keep its outstanding dollars in circulation at a stable unit of account since it serves the function of a central bank.
That is not a contradiction rather a consequence. The original purpose of CB is to prevent bank runs. Robert J. Shiller. Yale SE. Lecture #18. Monetary Policy