NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
std::unique_ptr implementation backed by Ethereum NFTs (github.com)
connor4312 1064 days ago [-]
Joking aside, their white paper (https://raw.githubusercontent.com/zhuowei/nft_ptr/main/white...) is a must-read.
penguin_booze 1064 days ago [-]
Thank you. I must say that this is the ONLY white paper I managed to understand, ever. Very concise. Kudos to the authors. I wish we had more like this.
iudqnolq 1063 days ago [-]
As are their benchmarks

> nft_ptr has negligible performance overhead compared to std::unique_ptr, as shown by this benchmark on our example program:

std::unique_ptr 0.005 seconds

nft_ptr 3 minutes

horsawlarway 1063 days ago [-]
I loved this section of the readme - I nearly choked I was laughing so hard.

That said, I don't really think 3 minutes is that terrible for what it's doing. But man the phrasing there tickled me.

cbolton 1063 days ago [-]
It would be nice to have energy consumption benchmarks too...
benmanns 1063 days ago [-]
And only one of these options costs $100s in gas fees.
athrowaway3z 1064 days ago [-]
I was tempted to open an issue:

Printing on green paper did not make it white.

stevewodil 1063 days ago [-]
Do it! Bug: printing the white paper on colored paper does not work as expected
vanderZwan 1064 days ago [-]
mhh__ 1063 days ago [-]
Maybe I'm too young, but I had no idea the phrase only originated in 1994
ttul 1063 days ago [-]
The presence of a white paper gives any project the luster of pseudo-academic rigor.
m3kw9 1063 days ago [-]
Did I just got hacked reading this “white paper”?
beached_whale 1064 days ago [-]
I just wanted to use a one word reply, but that might have lacked the context. So I will say, good job :)
rfoo 1064 days ago [-]
zajebisty
jnwatson 1064 days ago [-]
"For a limited time, you can buy any Git commit from this repository as a Non-Fungible Token on my Content-First Multimedia Proof-of-Authority revision-controlled realtime collaborative private enterprise blockchain (a shared Google Doc)."

Made my day.

richieartoul 1064 days ago [-]
This is one of the most subtley funny things I’ve ever seen on H.N, specifically because the target audience is so small. You have to understand both C++ memory management and what an NFT is.
grandmczeb 1064 days ago [-]
And it’s written in rust!
wyldfire 1064 days ago [-]
Wow, I thought for sure it was a punchline, but no:

> written in rust for the hipster cred.

I'm probably a founding member of the Rust Evangelism Strike Force but stuff like this seems ... way overboard. Almost like a Poe's Law demonstration - it's hard to determine whether it's satire or not.

nexuist 1064 days ago [-]
These are my favorite coding projects. No business case, no practicality for non-developers (or developers for that matter), no long term support, no problem solving. Just a love/hate letter to software and the absurdity it brings to our world.
gspr 1064 days ago [-]
I assume you're very familiar with Tom7, and in particular his SIGBOVIK submissions, but just in case: Tom7!

(Good starting point for anyone who's not: https://m.youtube.com/watch?v=HLRdruqQfRk )

sanxiyn 1064 days ago [-]
You may enjoy DOS Subsystem for Linux: https://github.com/haileysome/doslinux
wyldfire 1064 days ago [-]
I get the sense from other comments in this thread that I did indeed miss the point - it is satire. Just a little too subtle IMO.
sellyme 1064 days ago [-]
> Just a little too subtle IMO.

Direct quote from the linked page:

> As we all know, adding blockchain to a problem automatically makes it simple, transparent, and cryptographically secure.

TeMPOraL 1064 days ago [-]
Or:

> nft_ptr has negligible performance overhead compared to std::unique_ptr, as shown by this benchmark on our example program:

  Implementation        Runtime
  std::unique_ptr       0.005 seconds
  nft_ptr               3 minutes
pjc50 1063 days ago [-]
Of course it's satire; one of the most absurdist forms of satire is finding something ridiculous yet taken seriously, and treating it far more seriously than that.

Of course it's written in Rust.

floatingatoll 1064 days ago [-]
It’s still a punchline
aberoham 1064 days ago [-]
They should have called out the usage of Nocode to create the white paper
qeternity 1064 days ago [-]
> Future steps

> nft_ptr instances are themselves ERC-20 tokens with 0 supply, for forward compatibility with our next library, nft_shared_ptr.

> nft_shared_ptr will implement reference counting with security by selling shares to the owned object until the SEC complains.

The whole repo is a goldmine but this really had me in stitches.

TeMPOraL 1064 days ago [-]
I'd love to see how they'll implement nft_weak_ptr and its creation from and conversion to a nft_shared_ptr :).
wrigby 1063 days ago [-]
Aside from the brilliant satire, it’s worth pointing to the “What I Learned” section of the readme:

  how C++ smart pointers are implemented
  how to implement a Non-Fungible Token
  how the Ethereum ecosystem has evolved since I wrote my last smart contract in 2017
  how to integrate my previous Solidity, Truffle, and Ganache workflow with new tools such as OpenZeppelin and hosted wallets
  how to write a (trivial) program in Rust without fighting the borrow checker once
  how to use rust-web3, serde_json, and the openssl crates
  how to call Rust from C
I often struggle with deciding what to build as a practice project when I want to learn a new skill, and this is a good reminder that “humor” is an acceptable answer. Using a satirical project to learn how smart pointers are implemented is genius.
iudqnolq 1063 days ago [-]
The author has an excellent reply to a question on twitter

>> What are the gas prices like for copying a pointer?

> Copying an nft_ptr is illegal. Moving an nft_ptr takes 87,169 gas: https://goerli.etherscan.io/tx/0xcbe06fdd54bd9d221993c875022... at mainnet gas prices of ~100 Gwei, equal to 0.0087169 ETH, or $18.69 USD. (This was intentionally written to waste resources for no benefit, just like cryptocurrencies themselves)

> The C++ "as-if" rule means the compiler is allowed to optimize away the move, but it still needs to charge the $18.

iampims 1064 days ago [-]
> Made with by a Blockchain Expert who wrote like 100 lines of Solidity in 2017 (which didn't work)

This made me chuckle.

TeMPOraL 1064 days ago [-]
A masterfully executed satire!

The paranoid part of me worries this will be used for real in the future.

The thing with building abstractions is, once you cover enough pieces to make a complete abstraction, people might run away with it and build castles on top, completely ignoring that the abstraction is implemented in terms of a joke. And once enough software is built on it, it'll be easier to start optimizing the joke to work faster than to get rid of it...

(Also, I don't see any mention what happens to the NFT when the nft_ptr goes out of scope.)

newswasboring 1064 days ago [-]
Your second paragraph paints a pretty grim scenario. Has this ever happened before? Someone building castles on a joke abstraction?
davidhowlett 1064 days ago [-]
Flask was originally an April fools joke with what the author thought was a silly design. It is now widely used, including in production systems at my company.

http://mitsuhiko.pocoo.org/flask-pycon-2011.pdf

avery42 1063 days ago [-]
In case anyone wants a video of the original talk: https://archive.org/details/pyvideo_440___opening-the-flask
newswasboring 1063 days ago [-]
Lol this isn't grim at all. As far as I understand, they came up with a pretty good architecture as a joke.
mhh__ 1063 days ago [-]
Javascript?
1063 days ago [-]
pjc50 1063 days ago [-]
Dogecoin?
newswasboring 1063 days ago [-]
What infrastructure in made on top of dogecoin? I feel like everyone uses it as a joke coin.
varajelle 1064 days ago [-]
I was wondering if it was a joke, until I saw the white paper.
AndrewStephens 1064 days ago [-]
That’s the problem with all the idiotic blockchain projects around at the moment. I was only ninety percent sure it was a joke until about halfway through when the performance chart confirmed it but it is only slightly more ridiculous than several “legitimate” projects.
Clewza313 1064 days ago [-]
From the readme: "As we all know, adding blockchain to a problem automatically makes it simple, transparent, and cryptographically secure."
SAI_Peregrinus 1063 days ago [-]
Sadly that's pretty realistic as far as blockchain project author statements go.
imron 1064 days ago [-]
The benchmarks showing negligible performance differences also gave it away.
chrismorgan 1064 days ago [-]
Hmm, 994 bytes; that’s rather small, wonder what’s in it?—

Ah.

scharman 1064 days ago [-]
ok, u got me - it was clearly a parody, but the whitepaper made me check and it took a few seconds to click. Love ur work!
ShroudedNight 1064 days ago [-]
To be fair, the paper is white.
jb1991 1064 days ago [-]
Just look at the results from the “example program“ for benchmarking.
er4hn 1064 days ago [-]
WARNING: This code is not safe to store secrets with.

From the readme:

> others may view the NFT/use the object, but only the owner can transfer/destroy the NFT/object. > absolutely no protection against just pirating the image represented by the NFT/copying the pointer out of the unique_ptr

I would open an issue to support RFC 8959 and refuse to mint NFTs with secret-token URIs, but I think instead I will learn how to mint an NFT of RFC 8959.

kmarc 1064 days ago [-]
If you like this kind of humor, I'd recommend following Zhouwei Zhang on twitter[1] (not affiliated). His posts, I think, resonates well with HN's audience.

[1]: https://twitter.com/zhuowei

mhh__ 1064 days ago [-]
Considering unique_ptr is not zero cost, this is fair game I say.
beached_whale 1064 days ago [-]
With clang you can make a unique_ptr that is though. It just cannot be used for the std one as that would break existing code. But clang has an attribute [[clang::trivial_abi]] and with that the cost really is zero compared to a pointer.
MauranKilom 1064 days ago [-]
> Non-Fungible Tokens and std::unique_ptr have the exact same semantics:

> [...] absolutely no protection against just pirating the image represented by the NFT/copying the pointer out of the unique_ptr

Perfect!

FeepingCreature 1064 days ago [-]
"You can also help by going full r/roastme on my code: this is only my second Rust project, and I would appreciate guidance on my journey to carcinization."

This is a very clever joke, so let me dissect it:

The "carcinization" is a callout to, I presume, xkcd 2314 ( https://xkcd.com/2314/ ), about how crustaceans tend to repeatedly evolve into crabs, and xkcd 2418 ( https://xkcd.com/2418/ ), which makes the claim that any conversation with Randall evolves towards the topic of carcinization.

A cutesy nickname for Rust fans is "Rustaceans". (Rust-aceans, like crustaceans.) With some creativity, we may then see the process of becoming an experienced Rust user as another instance of carcinization, especially given the similarity between xkcd's "metacarcinization" and the way that rustaceans, as fans are wont to do, tend to find a way to make the conversation about Rust.

masklinn 1063 days ago [-]
> The "carcinization" is a callout to, I presume, xkcd 2314 ( https://xkcd.com/2314/ ), about how crustaceans tend to repeatedly evolve into crabs

That’s not an xkcd joke though, it’s an actual observation of evolutionary biology, first published in 1916.

FeepingCreature 1063 days ago [-]
Correct, but I suspect most geeks who know the term know it from xkcd, and that supports the additional metajoke about changing the topic to talk about Rust.
mmastrac 1064 days ago [-]
That's an expensive operation.
joshspankit 1064 days ago [-]
Was curious about this. If implemented, exactly how expensive would it get in the first 24h (assuming ETH at $2000USD)?
masklinn 1063 days ago [-]
Depends how often the pointer is moved. According to the author’s Twitter at the time they were asked each move cost $18.69.
joshspankit 1063 days ago [-]
Sorry, I know my question depends on a lot of variables.

I’m just looking for a “sanity check” example, but I only have a vague notion of pointer being a reference to a spot in memory, as well as knowing that doing transactions on the ETH network incurs fees.

Are there any “power user” examples? Like, how much would it cost to run `ls` on a folder of 200 files, or encoding a video with `ffmpeg` (or insert proper example here since I don’t know where `unique_ptr` is used lol)

iudqnolq 1062 days ago [-]
A lot :)

If you've ever programmed, imagine kinda-sorta one move per argument per time you call a function. Like `console.log(foo, bar)` would be two moves. (This isn't literally true, it over counts a bit). Ffmpeg would be in the tens of thousands of moves for encoding a short video, maybe? They don't use unique_ptr, so it's hard to do a counterfactual.

An imperfect analogy is this is like nails/screws when building a house.

tolbish 1064 days ago [-]
> - void Seal::MakeSound() { std::cout << "Ow, ow, ow!" << std::endl; }
mam2 1064 days ago [-]
"As we all know, adding blockchain to a problem automatically makes it simple, transparent, and cryptographically secure."
foota 1064 days ago [-]
And you thought memory management was expensive _before_!
DDR0 1064 days ago [-]
Actually it's cheaper this way, because you can sell the NFT to fund the operation. Before, you had to pay for everything it ran on!
TeMPOraL 1064 days ago [-]
That's why everyone loves JavaScript so much. You don't have to pay for the electricity your code burns, your users do.
neurostimulant 1063 days ago [-]
I wonder if it's possible to run a linux vm (ala jslinux) in browser, connect them to the network via a proxy to allow the apps inside the linux vm to make arbitrary connections (I think I saw a jslinux clone that uses some form of proxy to allow tcp access from inside the vm, but forgot the name), then run a kubernetes worker node in them. Then you can try to make the page viral somehow and then enjoy your huge and free kubernetes cluster!
TeMPOraL 1063 days ago [-]
I have a sinking suspicion that Facebook's Messenger webapp is doing exactly that - its UI has been very laggy for me in the past months, and the issue persists through refreshes, browser reboots and system reboots.

It's the only thing that makes sense. I mean, they couldn't have screwed up a chat client that badly...

foota 1063 days ago [-]
They don't have the same depth of experience in developing chat apps as some other bay area companies.
1064 days ago [-]
im3w1l 1063 days ago [-]
It's a bit complictated, requiring npm and cargo and c++. But still, a "hello world" demonstration like this is very valuable. It wouldn't surprise me if real projects use this as a starting point.
horsawlarway 1063 days ago [-]
This is the hardest I've laughed all year. Mad props to the author for poking fun while doing a very cool (and crazy) project.

Don't know why but the deadpan humor here really reminds me of reading Bill Bryson.

hjnilsson 1064 days ago [-]
Technical side-note: Are NFTs free to create and/or use? Or do they require contribution of processing power and/or paying "the Network" for it using your own ETH?
Jhsto 1064 days ago [-]
Kind of, you can use a development network to which you can get free tokens to pay the gas fees.
joshspankit 1064 days ago [-]
People are regularly paying $75-$250USD in gas fees to mint individual NFTs
somebodythere 1064 days ago [-]
Making pointers on mainnet is expensive these days, I was able to stand up a Ganache testnet so that my pointers are created faster and at lower cost. Fantastic library.
cinntaile 1063 days ago [-]
I hope someone turns this into an NFT, to complete the circle.
no-s 1063 days ago [-]
> how to write a (trivial) program in Rust without fighting the borrow checker once

curiously apt, yet true...

MarkSweep 1064 days ago [-]
This is great; now I feel like I have to rewrite programmerspoop.com in Rust to keep up.
sergiotapia 1064 days ago [-]
The Andy Kaufman of programmers
crazypython 1062 days ago [-]
It's thread-safe.
nessup 1062 days ago [-]
I logged into GitHub on mobile just to star this.
fctorial 1064 days ago [-]
Technology gone berzerk.
yjftsjthsd-h 1064 days ago [-]
Well yes, but it's a joke specifically making fun of that, so it's not really berserk itself.
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 23:31:31 GMT+0000 (Coordinated Universal Time) with Vercel.