Hacker News new | ask | show | jobs
by malgorithms 3186 days ago
I'm on the Keybase team and as you can see we jumped to sponsor a small block. We participated in this for two reasons:

(1) shazow (co-author) was also the author of the official Keybase Chrome and Firefox extensions, and he did an amazing job. We'd gamble on anything he does. The space we bought wasn't that expensive from a company perspective, and it was an educational experience. And maybe it will draw us attention.

(2) Holy crap, it's really impressive a dapp like this is possible with Ethereum. If it hasn't sunk in yet how this thing works, really read the FAQ and stop to think about it. As shazow and ontoillogical said, "there's no backend!" and "It's immortalized!"

4 comments

By the way, here's a GIF of what the buying process looks like:

https://gfycat.com/BleakSimilarGermanspaniel

This is the part that blows my mind, it feels like magic every time.

(P.S. Thanks for your support, Chris!)

Payment as part of the protocol alone will make DAPPs a game changer.
That GIF is neat, but I don't see your ad when I look at the page.
It looks like they did it on the Rinkeby Testnet for that demo so they wouldn't have to spend real Ether.
Wait so how/where is the url/title/image stored? (I assume it's a url?)

I notice you buy it then you later change the details?

it's stored on the blockchain, inside the transaction that calls the payable function.

The setup is done in two steps:

1. you must pay for a rectangle area via the `buy` function (notice the `payable` specifier):

    function buy(uint _x, uint _y, uint _width, uint _height) payable returns (uint idx) {
2. then you can setup your ad via the publish function:

    function publish(uint _idx, string _link, string _image, string _title, bool _NSFW) {

~~~

For more details in 1:

* the cost of the area you're trying to buy is calculated as _width * _height * pixelsPerCell * weiPixelPrice

* with weiPixelPrice = 1000000000000000 and pixelsPerCell = 100

* The grid is defined as a double array of 100x100:

    bool[100][100] public grid;
* The for loop checks that none of these pixels are set to true, if any pixel is then `revert` reverts any changes to the state that happened during execution. Otherwise the relevant coordinates are all set to true.

* The space is reserved under the address that send the ether (`msg.sender`). To do that, an `Ad` struct is filled with the information and it is pushed unto the state.

   Ad memory ad = Ad(msg.sender, _x, _y, _width, _height, "", "", "", false, false);
   idx = ads.push(ad) - 1;
* It returns an index (`Idx`) that you can use to specify the details of your ad later.

~~~

For more details in 2:

* You must pass the `index` of your reserved space as argument to the function

* It will check that your address is indeed the address which reserved the space:

   require(msg.sender == ad.owner);
* It sets everything to the arguments of the function you're calling.

* An event is triggered, it is probably being listened to by the web app so that the web page can be updated live

   Publish(_idx, ad.link, ad.image, ad.title, ad.NSFW || ad.forceNSFW);

~~~

Notes:

* Looks like you can call the `publish` function over and over. Modifying your ad over and over.

* There is a `forceNSFW` function that the contract owner can use to force an ad to have the `NSFW` flag. But this can be re-modified again and again by the ad owner.

* But the owner of the contract can remove ownership of an Ad, so there's that.

* I just audited the contract and I couldn't find any vulnerability.

We'd gamble on anything he does.

Well said, because the dynamic is the same. Throw money at the house and hope you win. The house does.

This can't be duplicated (maybe every few years), it's a copy of a previous project, and it is literally a page of ads that won't be worth anything in a month or less. It only has value because of the attention people are giving it right now, so maybe reconsider the investment.

Own a piece of blockchain history!

That doesn't feel the least bit hucksterish to you? They say the same thing about those commemorative coins they sell on late night TV. The only person who gets anything out of this is shazow, so I'm not sure why people are so willingly enthusiastic about supporting it. It has no value except to itself.

I think you're missing what is interesting about this, from a technical point of view.

This is neat, and novel:

> "Ads displayed above are loaded directly from the Ethereum Blockchain. This Decentralized Application (DApp) does not have a traditional backend. No MVC framework, no SQL database. It's just a JavaScript application served statically from Github which speaks to the Ethereum blockchain using Web3.js."

That they're profiting from it is just an amusing side effect, imo.

That is cool! But, if this DApp thing takes off, how will Ethereum nodes be compensated for essentially acting as a free CDN?

It works fine as long as there aren’t a lot of users, but once the user count become substantial, Ethereum nodes will need compensation in order to serve the amount of data needed. Is there a workable solution for this?

The images are actually hosted over http (or ipfs or swarm). The former requires you to find a host, and the later two have ways of compensating for traffic :)
The tagline is a reference to the original's "Own a piece of internet history!"
Getting to work with shazow has been the best part of this project.

A+ would pair program again.

<3
Could Keybase resell the ad space or even subdivide later and .... profit?