r/programming • • Aug 11 '22

There aren't that many uses for blockchains

https://calpaterson.com/blockchain.html
6.5k Upvotes

2.2k comments sorted by

View all comments

1.7k

u/JessieArr Aug 11 '22

99 out of 100 ways people tell me blockchain is a a groundbreaking tech in one product or another fall into 1 of 3 categories:

  • Blockchain can't actually do what they say it can do.

  • Blockchain is unrelated and adds needless complexity to what they are saying is their product differentiator.

  • Blockchain only serves to generate hype, and the hype is what they're actually selling.

Don't get me wrong, the ability to create a ledger of transactions that is:

  • Distributed

  • Immutable

  • Publicly-readable

... and to have that be cryptographically sound is very cool and will definitely find some niche uses. But the "one day you'll buy gas at the gas station with Bitcoin!" crowd quite simply don't know what they're talking about.

663

u/rabid_briefcase Aug 11 '22 • Heart of Silver

As a long term network and distributed code programmer, I agree.

We had an interview just last week with a guy who was talking blockchain the whole time, so I asked him some questions:

Can you describe the Byzantine Generals problem? (reply: no idea.) Can you describe the Two Generals problem? After explaining both of them: how does blockchain help with each problem? (reply: no idea.) How does a distributed ledger remain consistent across machines? (first reply: because of blockchain! Asking for more detail reply: no idea.) How does ANY database transaction remain consistent? (reply: It doesn't because it's a database, that's why you need blockchain!) Imagine an ATM, when it's processing the transaction to state that you are withdrawing money let's say there is a network hiccup, how do banks guarantee the money has been taken out of the account exactly once, not more than once if packets are duplicated, not the money lost if the transmission didn't get through, what's one of the solutions you could implement? (reply: The only way to make it work is with blockchain.)

He was applying for a team lead position.

He did not get the job.

Blockchain is a great solution for a small set of incredibly difficult problems. Most people don't know those problems, nor do they understand how blockchain helps once are when presented with the problems it solves.

213

u/Kiloku Aug 11 '22

Imagine an ATM, when it's processing the transaction to state that you are withdrawing money let's say there is a network hiccup, how do banks guarantee the money has been taken out of the account exactly once, not more than once if packets are duplicated, not the money lost if the transmission didn't get through, what's one of the solutions you could implement?

I'm curious about that one. I don't do lots of network related software dev and my few forays into databases were simple queries. How does the bank guarantee that?

342

u/rabid_briefcase Aug 11 '22

There are several techniques, they fall under the blanket of concurrency control.

In databases these are run under transactions with the option to either commit or rollback, and the transactions themselves send messages in an idempotent way, such as using a sequence number.

Sequence number first, since it's easier to understand. If you receive message 4, then 5, then 4 again, you can track that you've already processed 4 so you ignore it. You can receive message 4 as many times as you want, the message can be replayed over and over, but since you've already processed it you'll never process it again. That's part of a principle called "idempotence". No matter how many times the person replays that they deposited $500 into their account, the action will only occur once. Even if the bank needs to re-submit every transaction that they ran because something went wrong and they recovered from backup, no matter how many times transaction 4 is run it will only be processed a single time, every subsequent time it will say "we already did transaction 4".

Multi-step transactions have variations based on factors like their likelihood of success, being optimistic, semi-optimistic, or pessimistic, variations of using single-phase or two-phase locking, and there are details on the way they behave on failure. This style has the phases begin, modify, validate, then commit or rollback.

Not bothering to crack open a specific book on the protocol and instead going from memory, the machine would contact the server with a transaction request. The machine will have had to already verify that it has the money in the till, and the connection would be verified as cryptographically secure, which automatically implements the typical protections against most replay attacks and such. Next, if there are sufficient funds the server would mark the the funds with a temporary lock as a pending transaction with a unique ID, then tell the machine that the transaction should proceed. The machine receives the message, and attempts to drop the money. Since messaging may be unreliable, the server should occasionally repeat the message until acknowledged. The machine sends a response that it will dispense the money for a given transaction ID, which optionally could require an acknowledgement and acknowledgement receipt if you're in a hostile environment. The machine then attempts to distribute the money. From there either the money is successfully distributed so the machine reports a commit to the server, there is a failure so the machine knows it didn't distribute the money so the machine reports a rollback to the server, or something has gone terribly wrong and the machine enters an alarmed state. In that state the bank knows the money was potentially withdrawn (with it's pending transaction ID), the machine keeps the video and other logs, and real life humans are called out to make a determination to either commit the transaction or roll it back.

While I wouldn't expect an interview candidate to get it perfect -- I know I could have easily left something out above and would double-check it against proven protocols -- I'd expect them to get at least a significant number of elements.

0

u/[deleted] Aug 11 '22

[deleted]

142

u/rabid_briefcase Aug 11 '22

There were various issues during the interview, and I was genuinely trying to sus out what he knew in general. The comment above was a simplification.

We actually covered a lot of topics. For many of them he was able to talk about the job in general, he knew vague concepts, but when it came to actual implementation details he couldn't do it. He could explain in vague academic terms what some differences in protocols were, but not give any examples of their use. Even talking about his work history and what he had accomplished, often it was evaded with "my team did it, not me." About 30 minutes in, we started going down his resume and asking specifics, "you wrote for this project you did x and y, can you describe what you specifically implemented, not your teammates?"

We had high hopes going in. When it was over, my co-interviewer and I were wondering if we could interview his former teammates instead.

33

u/Kopikoblack Aug 11 '22

Didn't know it was bad to use we or team in an interview. I got a habit of including the team itself for recognitions and because of this I use plural words in interview. Thanks for the information.

90

u/badaccountant7 Aug 11 '22

There’s a difference between saying “my team did it, not me” and “we did it”. Certainly don’t undersell yourself, but not acknowledging that teammates contributed as well can also be a red flag.

→ More replies (7)

21

u/Boring_Ad_3065 Aug 11 '22

I personally don’t think it’s bad to use the words appropriately. But if I say “I led the implementation of X” there’s an implication that you should understand X in a decently through way.

If you’re just a manager or PM, it’s should be clear on your resume (and honestly a non-technical resource shouldn’t go after a technical role). Managing people or projects well are useful skills, but separate from technical.

My guess is it was a business analyst who was trying to jump and make a raise. Wanted to find a team and take up a similar role where they produced little value.

→ More replies (7)
→ More replies (9)
→ More replies (4)
→ More replies (9)
→ More replies (24)

22

u/Paskee Aug 11 '22

ATM has multiple local logs.

Log will have if money was counted and presented to customer. Also if customer took the money and if presenter door was shut and mechanisam confirmed all prior actions can be verified.

Atm service provider can and do log analasys in case customer claims they did not get the money and account was charged.

In 99% of cases ATM will notice falty transaction ( did not get verification of trx ) and send cancel transaction message to bank. But it ussualy takes 24 hours to confirm. Because its not as fast as people think.

11

u/bacondev Aug 11 '22 edited Aug 12 '22

I don't know how it's done in the industry, but the way that I'd do it is by including a nonce with the transaction information. The server verifies that it has not processed a transaction associated with that nonce. If the verification succeeds, then it processes the transaction and sends a response to indicate that the transaction was a success. If the verification fails, then it rejects the transaction and sends a response to indicate why it was rejected. How the client handles a rejection or the lack of a response would vary, depending on the nature of the application.

Edit: In any case, this doesn't really help with duplicated packets if the communication is happening over TCP. The only thing that this accomplishes in this case is the prevention of replay attacks.

→ More replies (11)

33

u/acdha Aug 12 '22

reply: The only way to make it work is with blockchain.)

He was applying for a team lead position.

This is reminding me of a guy I interviewed during the dotcom era who claimed experience building payment systems. He told me that when you use HTTPS to connect to a website, your traffic goes over a dedicated leased line rather than the public internet.

SSL was newer then but … you’d think he might have considered not noticing a cable crew at his house. I gave him a couple of chances to clarify (maybe he was exaggerating his experience but was thinking about a backend system processing cards?) but he doubled down on it.

We did not hire him.

One of the big consulting companies did, apparently as an architect.

13

u/threequarterpotato Aug 11 '22

Hmm how does the blockchain help with the two generals problem? I don’t really think of them as being directly related.

→ More replies (7)
→ More replies (45)

207

u/[deleted] Aug 11 '22

It always breaks down at trustlessness. Companies don't actually want that so they end up doing weird shit like "creating a central authority to verify transactions" when they try to make things with it.

29

u/cwallen Aug 11 '22

trustlessess itself often breaks down for lots of uses. It only works if all data for the transaction resides only on the chain. If you need to represent anything real world you have to trust your data entry to not lie.

→ More replies (1)

179

u/donalmacc Aug 11 '22

people don't want it either.

123

u/lpreams Aug 11 '22

Yep. I heard someone point this out on a podcast a while ago, and I'd never really thought about it, but I LIKE having a centralized payment system. I LIKE that PayPal has access to modify transactions after they happen.

If I buy something through PayPal and get screwed, I can request a refund from/through PayPal. They might reject me depending on the circumstances, but there's at least a decent chance I'll get my money back. Or if my account is hacked or my password stolen, there's a pretty good chance I'll recover everything without too much headache.

If I get scammed or hacked on Bitcoin, it's over. Done. Immutable. Unless I'm lucky enough to be part of a truly massive hack, to where they patch the code and roll back whole blocks of transactions, I'm never getting my money back.

47

u/coldblade2000 Aug 11 '22

Is PayPal the best example? I remember the 2010's being filled to the brim with a daily story of how PayPal suspended another businesses PP account and was keeping upwards of 50k USD, with absolutely no reason or recourse given

33

u/kcen Aug 11 '22

The point is that there is always recourse via managed systems, particularly ones in countries with functioning legal systems. For example you can absolutely sue PayPal and a court system can help you find resolution.

There are totally good uses of blockchain tech, but almost everyone talking about how they are revolutionary has a very limited understanding of distributed systems design, modern payment processing, or how stupid your average user is.

→ More replies (8)
→ More replies (39)

30

u/[deleted] Aug 11 '22

The currency is technically decentralized but the entire ecosystem is not. Say you want to buy groceries with Bitcoin. You first need to get Bitcoin. You go to an exchange to buy some with USD - already, you’ve run into centralization. Immediately. And these are vectors through which people lose all of their money because the exchanges will just cut and run.

Technically there are decentralized exchanges, but there are more downstream centralized components that aren’t even worth getting into because the whole decentralization kick is bullshit.

→ More replies (31)
→ More replies (8)
→ More replies (61)

28

u/holloway Aug 11 '22

the ability to create a ledger of transactions that is: Distributed Immutable Publicly-readable ... and to have that be cryptographically sound is very cool and will definitely find some niche uses.

I too like Git.

→ More replies (21)

40

u/KevinCarbonara Aug 11 '22

I agree, it would be great to have a ledger/database that can be trusted and can't be manipulated by the owning company. But blockchain doesn't really serve that purpose, or to the extent that it does, it's not worth the cost.

43

u/josefx Aug 11 '22

it would be great to have a ledger/database that can be trusted and can't be manipulated by the owning company

That only ensures that the company can't manipulate already public history. It doesn't stop the company from entering garbage data in the first place.

23

u/i_hate_shitposting Aug 11 '22

Or from deciding that data already on the ledger is garbage and should be ignored/blocked from use.

→ More replies (8)
→ More replies (3)
→ More replies (278)