A Practical Introduction to Blockchain with Python(adilmoujahid.com) |
A Practical Introduction to Blockchain with Python(adilmoujahid.com) |
"A blockchain is a distributed database that allows direct transactions between two parties without the need of a central authority."
Which as a developer, I feel like I have a good handle on - but where I continually come up short is figuring out what I'd use such a data store for when building an application?
The article starts off calling blockchain tech "significant and disruptive technologies that came into existence since the inception of the Internet."
I'd love if someone had some examples of practical applications or uses that are being developed or could point me in the right direction.
So if it can’t do the first thing it promises it can do, maybe it becomes more like a Rube Goldberg machine than something that is meant to be useful/practical. The fact that people are praising CryptoKitties as a “practical application” seems to support the Rube Goldberg machine/toy theory.
There's a big difference between centralized influence and centralized control. The 2010 and 2013 examples were fairly homogeneous, because the changes were fairly obvious and reasonable, the thought leaders were widely trusted, and almost all the users followed them. But a large number of people didn't follow when Ethereum split (hence Ethereum Classic) or when Bitcoin split in 2017 (hence Bitcoin Cash).
Thought leaders like Satoshi and Vitalik can influence most of the community of their respective coins, but they can't force anyone to accept their blocks.
> So if it can’t do the first thing it promises it can do, maybe it becomes more like a Rube Goldberg machine than something that is meant to be useful/practical. The fact that people are praising CryptoKitties as a “practical application” seems to support the Rube Goldberg machine/toy theory.
The problem I think is that decentralized control is really the only thing that blockchains offer over existing data stores. If you don't care about decentralized control, existing distributed logs such as Datomic are superior to blockchain in every way.
I would go so far as to say that the vast majority of blockchain users fall into two categories:
1. People who don't understand decentralization. 2. People who don't care about decentralization but are riding the hype (whether they understand decentralization or not).
This is why so many "blockchain applications" look like Rube Goldberg machines:
1. People who don't understand decentralization use it to implement things that would be much better served by an existing distributed datastore such as Datomic. 2. People who are just riding hype don't need to implement anything serious to fool people. They can implement a Rube Goldberg machine and there will always be suckers who take it seriously as long as it ticks the "blockchain" hype tickbox.
Very few people actually understand decentralization AND care about it, and even fewer of those have the technical chops to implement them. So I think it will take time for more complex blockchain killer apps to emerge.
It's worth noting that the first simple blockchain application, cryptocurrency, has already had pretty immense effects on our society, from darknet markets to crypto exchanges. You can argue whether the uses people use cryptocurrency for are good, but you can't argue it isn't useful--it's just not complex (from a logical standpoint--it's just a ledger--obvously it's technically and socially complex).
With the same basic code base, I've built:
A basic asset tracking system. Think shipping containers.
A simple IoT API (logging sensor data).
A crude lap time tracker for racing drones. This would be easily shareable and loaded into different tracks to log your progress. I build racing drones as a hobby.
The really useful thing about the blockchain is that I can define a data structure and then design systems that consume it. Making the data portable.
Feel free to email me with questions. It's a fun tech to work with and simpler than people make it look.
PS: For more info on cryptokitties (and copycats collectibles), see the Awesome CryptoKitties page -> https://github.com/openblockchains/awesome-cryptokitties
PPS: A great way to learn about cryptokitties (and copycat collectibles) is to build your own version from scratch :-) see the (in-progress) open source copycats version (in ruby) -> https://github.com/openblockchains/copycats
So the benefit of this application vs a traditionally structured app (lets call it RESTKitties) is what?
That the external ledger of kitty creation and transfers is open and public for everyone? So you have more confidence that the central organization isn't manipulating the ecosystem in some nefarious way?
I am not sure if that is supposed to be sarcasm or not.
- they are database
- they are distributed
- everybody has the entire db
- it's transparent: everyone see the content
- it's temper proof
- it has a notion of temporality
- it has a notion of transactions, and each transaction has a unique id and an history
- transactions have authors, sources and destinations, with unique identifiers that can't be faked.
Hence it's a transaction based system that is a source of truth that can be audited from end to end by anybody.
So the only applications that are interesting for the blockchain are the ones mapping to this EXACT concept. Otherwise, you don't need a blockchain.
But because of the bubble, people are now using the blockchain for everything, since that gives visibility. I have friends myself that have projects making ICO just for that. And it works. Their product clearly didn't need a coin, but they raised several millions of euros to build their stuff.
Ok, so what kind of project DOES match the blockchain paradigm?
So money, obviously is a contender.
But voting systems as well.
Or a mix of both, such as betting (see the wagger project).
Compliance systems are another use case. E.G: make a public database of all plane inspections or food products origin.
Being decentralized doesn't mean blockchain systems don't have central authorities. The decentralized nature mean the data access (and potentially production) is not on a central system, which has great benefits. But as soon has you need human actions, you need something to tell them in which direction to go.
So you need a central authority for the part dealing with the humans.
E.G: for the voting system, something to register the citizen and produce the polls. For the betting system, something to introduce the bet results into the blockchain. Etc.
One alternative to that we are experimenting with currently as a community is the use masternodes (POS machines holding a lot of coins out of the market for a long period of time to show their commitment). It's basically an oligarchy.
The coin Polis is an example of that: they make proposals of things to finance, and each masternode vote yes or no for the proposal.
They are a lot of masternode coins, now, for various uses. Zencash uses them to distribute the messages of its chat system, wagger to introduce the data from bets into the chain, etc.
But most of the masternodes are just used to increase the ponzi effect (we build and host masternode for our clients as a service so we have a large sample of them on our servers).
I feel like a broken record when I point out yet again that this is a technical non-solution to a human problem. The same bad actors who would falsify inspection records or food origin information will have no issue simply falsifying it into the blockchain instead of whatever current system is used.
The problem with bad actors faking records has everything to do with the bad actors and nothing whatsoever to do with the mechanism by which the records are recorded. The blockchain solves absolutely nothing in these use cases.
I'm aware of sites that tell you whether you need a blockchain or not for your application, but they don't say what to use if only one or two of the requirements for a blockchain are not needed. What would a decentralized DNS strictly need if the notion of transaction wasn't required (but only the latest value)?
You should also tell people under what license you're releasing your changes :)
https://github.com/ltavag/blocks
Always love to see the interest here, I'm excited for the technology to become detached from Crypto speculation!
That's a pretty big "potentially" since many of those organizations use centralization as a defense against bad actors.
As a sidenote, I have been working in C++-land for a while now, and its really cool to see how the examples both contain a simple blockchain implementation along with the views for a Flask web UI in the same file. I wonder if there are web libraries available to do something similar in C++?
(except in this case there is a self destruct function that would freeze the game forever)
It could also help analyze tendencies and adjust.
And as usual, you would get more accountability, which never hurts (Steven ! Why is the website down ? - * Steven quickly revert back his silly click * - Errr, nothing. No reason. Everything is alright !)
It's basically by-passing a lot of bureaucracy, cut some of the news reporting middle ware and give a central source of truth (or lie) for a given issue. It's not a silver bullet, but it's a damn good improvement.
Technology and social progress goes hand in hand.
Can you give me an exact, explicit, description of exactly how use of blockchain would have prevented (eg) the oft-cited melamine milk poisoning scandal in China?
> It's basically by-passing a lot of bureaucracy
That bureaucracy caught the problem. Physical testing of the product uncovered the bad actor. How on earth would blockchain have helped?
> cut some of the news reporting middle ware
???
> give a central source of truth (or lie) for a given issue
There already is. And obviously the problem is when it's a lie. What value does blockchain bring? What good does it bring if the lie is more visible? And if there's no bad actors then there was no problem anyway.
> It's not a silver bullet, but it's a damn good improvement.
It's not any kind of bullet. I just don't see any improvement. Exactly what has improved and how? Consumers can reassure themselves that every step in the chain says everything is OK, rather than relying on the manufacturer to do that, which they do. And? If the manufacturer did not believe everything to be OK, the product would not even be on the shelf. The consumer will never see anything other than "everything OK!".
> Technology and social progress goes hand in hand.
Hype and money also go hand in hand. I don't think you've refuted my point successfully. As always, I want to be convinced otherwise, but I'm just not hearing anything compelling.
I can't give you an exact, explicit description on __exactly__ how smiling more could have prevented one specific argument. But I can tell you that globally it will improve your relationships.
The point is that the track records are not only visible, in a standard format and accessible by all, but also with a permanent impossible to alter format.
So the data is more visible, more easily to a vastly greater number of people. And people can't rewrite history afterward.
You don't need to request papers to some kind of administration.
You don't need to scan thousands of papers.
You don't need to fight the PR trying to tell they never said that.
Again, it's not a silver bullet. But if you ever tried to do a citizen investigation, you knew that the process just to get the administrative data is excruciating.
The block chain helps with that, and so help citizen be part of their democratic process.
In turn, globally, this will help diminishing the number of problem than the one you describe. Not a specific instance, but the global number.
> It's basically by-passing a lot of bureaucracy
> That bureaucracy caught the problem.
Not the same bureaucracy. Besides, the chinese bureaucracy probably knew the probleme since day one and just "caught them" because they stopped paying something.
> Physical testing of the product uncovered the bad actor. How on earth would blockchain have helped?
By giving an easier opportunity to the public to have basic data to compare to the one they get if they choose to investigate.
Democracy is about having the people execicing power, not relying on institution to do everything.
It's like saying "how a knife is going to solve my hunger problem?". Well it won't. But it will make it easier to engage in the process of solving it.
> cut some of the news reporting middle ware
Data journalism is a thing.
> give a central source of truth (or lie) for a given issue
> There already is.
You never tried to investigate obviously. It's a maze of offices that don't talk to each others using incompatible format they make very hard to obtain. And that's just the official, potentially faked record.
You can't bust institutions all the time when they make bad move. But you can make it easier. The block chain can help with that. It makes fact checking easier, because half of what you need, the official story, is in one place, one format, accessible by all.
> What good does it bring if the lie is more visible? And if there's no bad actors then there was no problem anyway.
Visibility is everything. Try to ask your company to reveal salaries of each employees, including bosses. What do you think will happen ?
> Hype and money also go hand in hand.
That's not mutually exclusive with usefullness.
> I don't think you've refuted my point successfully. As always, I want to be convinced otherwise, but I'm just not hearing anything compelling.
It's my last attempt. It's ok. Not everybody needs to understand everything.
I asked you direct questions and you have answered none of them. Yes I am aware of what a blockchain is, to the finest detail. There is no need to reiterate its features.
You haven't answered my questions at all. I directly challenged you on how blockchain would have helped in a famous case of "food products origin" - an example you yourself mentioned. You have utterly failed to answer that, instead holding forth on the value of smiles, PR, silver bullets, irrelevant theories about chinese governance, democracy and its virtuousness, company salaries, how hype is actually good, and my own lacking IQ.
Can you please just answer my damn question, or do the honourable thing and admit you have no fucking idea how blockchain helps foodchain security.
At the end of the day, when consensus breaks in unforeseen circumstances-- whether through a bug or an attack (the difference is purely syntactic)--people turn to the developers to tell them which consensus ruleset to follow. If you disagree with the developers, your chain gets called something else, as we've seen with Bitcoin Cash and Ethereum Classic.
With the 2013 Bitcoin fork, there were 2 ledgers and the network could not find consensus until the developers realized this and told everyone what to do 4 hours later. That's the developers controlling the system.
And who controls the developers? Their big bad State.
And not everyone listened.
> At the end of the day, when consensus breaks in unforeseen circumstances-- whether through a bug or an attack (the difference is purely syntactic)--people turn to the developers to tell them which consensus ruleset to follow.
Not everyone turns to the developers.
In a decentralized system, people have the ability to disagree with the developers and literally anyone else you might name as a central authority, and have that disagreement make a meaningful difference (a fork). That's obviously significant.
> If you disagree with the developers, your chain gets called something else, as we've seen with Bitcoin Cash and Ethereum Classic.
Who cares?
When the Bitcoin fork happened, I supported the Bitcoin Cash blockchain. I don't give a crap about the name. If I get the blockchain implementation I want, you can call it whatever you want.
In other words, someone creating Bitcoin Cash doesn't somehow prove that Bitcoin is decentralized... We still need to analyze each currency individually if we're going to have any meaningful conversation about their merits.
For instance, Satoshi told people something that all participants considered reasonable, and so the participants reacted accordingly. Systemic reasonable behavior is not inconsistent with the principle of decentralization, it's a consequence of it.
The origin of systemically-reasonable policy is orthogonal to the idea of decentralization, unless that origin is structurally mandated.
But I'm with you man, if we as a decentralized group come up with a reasonable hierarchy of trust supported by free speech and democracy, then we can create a systemically-reasonable Money that we can all agree is good.
Having some Eminence say "This is what we should do" and then having a wide network of people go and do that is _not_ a problem. What _is_ a problem is if some eminence says "This is what we should do" and having a bunch of other people say "I don't want to do that" or "That doesn't make sense" or "This will be bad for me" and then _having to do it anyway_. That's the issue. Having to get permission for the US Govt before you change how nodes work, that's an issue. Having some dev frown and say "I can't get the majority to adopt my pull request because of stupid Greg Maxwell" is not an issue.
No complex system involving humans will ever get around the importance of human communication and coordination and agreement, and that is not a technological problem to be solved. A system that artificially mandates who those humans should be, or what kinds of solutions they can offer, that _is_ a problem to be solved, and Bitcoin does a nice job of solving it as well as it can reasonably be solved.
Of course, this is an empirical question. I could be wrong, and the data will demonstrate that in time. But so far there is no such demonstration of wrongness, and the chaos and arguing between various factions (e.g., Segwit2x, Bitcoin Cash) are not evidence in favor of that hypothesis.
By validating the blocks against the rules you've chosen and choosing the longest valid blockchain.
> How will a merchant know which currencies to accept if they have no names?
By choosing the blockchain they agree with the rules of.
> When I'm trading Bitcoin for Litecoin, am I just trading the same thing for itself?
No, but the name isn't the important difference. The important difference is that Bitcoin proof of work uses SHA while Litecoin proof of work uses Scrypt, so the blocks of one don't validate under the rules of the other.
No, everyone does not consider it a different currency, you consider it a different currency. The name changed, sure, but again, who cares? A rose by another name would smell as sweet.
Calling either BTC or BCH a different currency from the original bitcoin really just shows a lack of understanding of what a fork is. Both BTC and BCH have made changes that weren't in the original BTC.
Um ok we're spreading lies now. Do you have evidence that the vast majority of people consider Bitcoin Cash and Bitcoin to be the same currency and I'm alone in considering these 2 blockchains 2 different currencies?
No, I didn't say that.
I'm saying that neither Bitcoin nor Bitcoin Cash are identical the original Bitcoin. Both have added changes, and this will be true of any blockchain that is being actively developed. In fact, to say that Bitcoin before the fork is the same coin as Bitcoin when Satoshi made it is also a bit off, because there were changes added before the fork, too.
I'm saying that saying that considering either one of these to be different from the original Bitcoin is a moot point, because any conceptualization of being the same coin doesn't really fit. The only way you could say that any variation of Bitcoin is the same coin is by saying that they build on the same blockchain, but both BTC and BCH fit that criteria.
You've focused in on the names people call the coins, which is pretty much the least important way one could say that coins are the same--implementation is far more relevant than name.
In the end, the only thing that really makes sense to say is that modern BTC and BCH are both variants of the original Bitcoin. It doesn't really make sense to say that either is the original Bitcoin, because both have introduced changes. It also doesn't make sense to say that either isn't the original Bitcoin, because they both originate on the same blockchain. The idea you're trying to apply here, that a fork means a new coin was created and the old coin continues on, just doesn't really capture the full truth of situation.
Looking at popular opinion as if that had any relation to reality is not going to help you understand what's going on here. Most people don't understand Bitcoin, so looking at the opinions of most people as if there's any truth there is pointless.
How will the merchants in your world know which currency they're accepting?
Admittedly, that's beyond the technical ability of many people, but names don't solve this problem in any way. I can pull a copy of the BCH source code, find/replace every displayed text that says "Bitcoin Cash" with "Bitcoin" but that changes nothing about the currency being exchanged.