Hacker News new | ask | show | jobs
by jashmenn 3186 days ago
I love this idea! I actually just finished creating a video course that teaches you how to build a similar thing: https://www.newline.co/courses/million-ether-homepage/

In our version you're able to bid for each pixel -- if the previous owner is outbid, the funds are returned. Sending funds in Solidity from a contract is really tricky to handle because there are so many ways it can go wrong.

For example, when you send funds to an address, it can purposefully reject your payment and even call back into your own functions. This is like if when you called a REST API, the API was potentially malicious and could call any public function in your code (!).

This is a really fun project and it's cool to see how you can connect web-apps to the Ethereum network.

2 comments

Don't send when someone is outbidded add a pendingReturns mapping of addresses and when someone is outbidded keep a track of returns and add another function for withdrawal

https://solidity.readthedocs.io/en/develop/solidity-by-examp...

let users pull vs push

I am also working on a Ethereum contract, Solidity language has great risks but also is great fun

Very cool, thanks for sharing! Another challenging dimension is to balance what the EVM is good for with the problem you're actually trying to solve. It's certainly interesting to work in an environment where inefficiency literally translates into money.

Going for literally every pixel is too expensive, so we went for deci-pixels (10x10 pixel blocks). Incidentally, the original Million Dollar Homepage took the same approach to avoid fragmenting the space too much.

How expensive is the search for empty blocks going to be towards the end? Would it be possible to introduce a more efficient algorithm in the future, or would it invalidate past sales?
We have an array index lookup for empty slots, the search should be constant time throughout.