After going through Kathryn “Blondiebytes” Hodge’s “Ten Days of Blockchain” video tutorial twice (following along the second time), I’m back to the Reach version of “Alice’s Auction” (this time with a fighting chance of understanding what I’m looking at.
![]()
I’ve managed (with some help on the Reach Discord) to dope out that the new bid gets transferred from the new bidder into the contract implicitly in the PAY_EXPR of the parallelReduce, while the previous bid (if any) gets returned to the previous bidder explicitly in the CONSENSUS_EXPR of the parallelReduce. (Although . . . does the “require(bid > currentPrice)” in the CONSENSUS_EXPR stop the aforementioned implicit transfer in the PAY_EXPR if it fails?)
I’m having trouble wrapping my mind around the front-end (index.mjs):
-
I see that, in three different runs of the program, the bidders act in what appears to be a pseudorandom sequence. Yet the only call to Math.random I see is for the bid amounts. How is this happening?
-
I also see that each bidder is “deciding to bid” some random amount exactly once. This would seem to simulate not a “live auction,” but a “single round of sealed bids” auction. Am I understanding this correctly?