Saturday, May 7, 2022

individualism=democracy

individualism_democracy.rst.rst

Key Points

  • democracy = individualism
  • central control is abused (power, inequality)
  • central control needs checking (mutation and selection)
  • locality: work for yourself, local questions to local consensus
  • slow and statistical = stability
  • direct democracy with minimal law text
  • always alternatives, never monopoly
  • replace taxes by an economic supply and demand
  • country = administrative unit by geographic locality
  • the internet is an enabling technology

Introduction

The different meanings of value:

  • information: Value of a variable would be a time step or event of the variable. The variable is a time line (Information-time-energy)
  • economy: Value is the economic appreciation of a product that is sold.
  • ethics: Value of something not sold, but needing protection from society, like good air, friendly people around, fairness, stability, health, life, ...

Sociology studies societies. The topic here is from ethics, which tries to find better ways to live together. Here, ethical value is meant.

There is much awry in society. It goes on for too long. Then suddenly civilization collapses. There is a collapse currently in Ukraine coming form power concentration. How could such power concentration happen? One person deciding over millions: How absurd is that? Why did other countries do economy with a system that is unstable because controlled by one, not statistical? Now it breaks out on Ukraine and Russia and all the countries that have economic links to Russia. History has many such example.

In employment=inequality the topic was that centrally controlled companies lead to inequality. Central control is always abused. A dictator is always a traitor. Power concentration reduces the importance of the individual. Inequality reduces democracy.

Societies are going in the wrong direction because their growth was too fast and is organizationally lagging behind. Every little money, a little power, little CO2 can accumulate to too much. The individual needs to have feedback of its actions. The society needs better information channels, more timely feedback, to allow the individuals to make informed decisions.

The unit of control, of thinking, is a person. Control (coordination) is needed to produce a group action, but all systems have two forces: mutation and selection, which maps to control and checking. You (all) need to check on the coordinator that he acts in your interest. How to do the checking? Start with providing information.

We need to change laws, the programming code of society,

  • to avoid accumulation
  • to implement transparency and checking
  • to follow principles of nature, such as locality and mutation and selection.

Information is the key again. There is the need to think and educate to avoid collapses for the future. The internet is a enabling technology.

Physics

Let's refresh a basic understanding:

  • Everything is information (variable consisting of values), even physical matter.
  • Information does not exist without time. Actually: time is information.
  • There are as many separate time lines as there are independent systems.
  • Energy compares two systems: it is information/time or time1/time2.
  • The static of the dynamics is the value of the variable. The value has internal dynamics. Systems have subsystems.
  • In a system of systems the subsystems develop towards more independent time lines. The interaction between subsystems reduce (T becomes smaller) such that the subsystems have more time for themselves (entropy S rises). For humans that would be more individual freedom.
  • High entropy S of a system means that new resources (like energy dQ) gets distributed to all subsystems without much fuss (at low temperature T). For a society, this can be called a fair society.

Psychology

The brain is a dynamic system that reproduces the dynamics of the world around. If we see a car passing by, we can afterwards close the eyes and rerun what we have seen in our brain. This rerun is actually happing in the brain.

What we call information on a system, in the traditional sense, is a copy of the outside system in our brain, or rather, a more or less compressed model or program. To get into existence the program needs to run in our brain. But it is a reality in the brain that runs, not the system it describes.

When we love or get angry about someone or something, we actually get angry about the image in our brain first.

A movie about an actor is not the actor. If we see an actor or blogger every day, it is there in our brain, as if it was a member of the family, but it is a twice indirected image of the person, not the person itself.

A blogger with a million followers in Youtube gets money, e.g. in a live events, as if it was a member of the family. A million thanks, but people: it is not a family member.

Star: I don't know you.
 Fan: You talk to me every day.
 Fan: You are part of my family, now.
 Fan: That's why I give you money for food and gas.
Star: Thanks a million times.
 Fan: I also would fight to protect you.

Our brain is a parallel world and needs regular checkups with the real world. Mass media are an image and if they purportedly describe an actual situation (like news), they need regular checkups via independent channels.

The model in our brain needs constant crosschecks, too, for consistency.

Fans just support a football team or a sports star or a politician and want it to win, although there is no connection whatsoever. It is just an identification with that team or person, as if it was part of the family, because they follow every move and have constructed a parallel image of that team or person.

Politicians among others exploit that people are unable to wrap their head around mass media.

The ethical values of many are foundation of a society, no matter whether good or bad ethical values. A state or dictator controlled TV station can manipulate subtly, e.g. letting a person, the viewer identifies with, say something in the interest of the state. The viewer does not take or is not given the time to access long-term memory for crosscheck. So he just reruns what was just said. He might remember it later and use it for crosschecks, even if it was just an opinion without association to basic principles.

E.g. "It can't be the wages that companies don't find employees, as 1234 is a high wage." Is it really a high wage? What does the company earn? How is it shared? Are wages the right way to share the profit?

The state TV opinion gets told to millions, but the millions have no way to tell a different story, which is fundamentally undemocratic.

The internet (e.g. Youtube, Tiktok, Twitter, Facebook, Blogs, ..) allows everybody to make mass media. The 1-n becomes a n-m relation, which makes it harder to control the majority opinion. But those with a lot of money can still gain influence by buying n influencers to spread an opinion. Still the many alternative views make individuals compare and think and come to their own conclusion.

The internet allows so many more possibilities, away from centralization towards more democracy: collaboration (Wikipedia, Gitlab, Github, Google Docs, ...), shared consensus and control, cryptocurrencies, ... The internet allow the information channels that are still lagging behind the fast population growth.

Politics for Democracy

Politics IS NOT following.
Politics IS NOT fandom.
Politics IS defending one's own interests.
Politics IS programming a social code with a chance for consensus.

A dictator is the result of a political attitude of many. People brainwashed from dictatorships understand politics as "following someone" and not so much as defending one's interest in a consensus mechanism.

I once had an interview where he said: "I expect you to be proud to work in this company." What? Do you see the dictator's tactic to instill valuation to his advantage? Compare this to patriotism. If people are proud to make someone super-rich or super-powerful, they are not being democratic.

Democracy is more than a system, it is an attitude. Democracy is something an individual does. A democrat is an individualist that does not follow anybody, but supports and defends its own interest.

The attitude starts with education. The majority must understand their responsibility.

  • the danger in any tendency to following. It just produces factions fighting each other.
  • the danger to political monopoly.
  • the value in alternatives.
  • the value of transparency, of information.

History has shown that any centralization has been abused, be it in politics, be it in economy.

The individual must be important, nothing else.

Individualism = Democracy.

Individualism = Democracy

Ethical values are values that secure more tangible values in the society.

Ethical valuation happens by living a time line. Life can only be valuated by the one living it, the individual. Economic and ethical values can only be appreciated by individuals, directly or indirectly. So all values hinge on one value: Individual freedom within the society.

Democracy = Individualism = I AM IMPORTANT = YOU ARE IMPORTANT.

A society's purpose is the individual.

  • The individual lives in the society, because it has individual advantages.
  • The individual leaves the society (makes crimes, does not follow rules, leaves a company, ...), if the society misses its aim to improve the life of the individual.
  • To fulfill the aim of the society, the individual must understand, what is good for the society and act accordingly.

The society is the sum of all interactions. Every local interaction must aim for fairness. For every single interaction this means:

  • If I renounce on my fair share, I do no good to society.
  • If I keep more to myself, I do no good to society.

One starts with one's own individual value. This individual value is important to ourselves, because we planned it, worked on it, we safeguarded it, we depend on it. We want the society around us to protect it, too.

Aggression would secure individual value for a lone predator, but for individuals living together in a society, aggression exposes the individual to the aggression from others. Aggression is therefore not an ethical value. In humans, rage evolved to counter aggression.

Aggression must not be confused with anger. Anger is rather the response to aggression. Aggression is disrespect for the other in case of conflict. It is a stupid direct way to solve a problem, but it was successful until population density became two high.

There is a difference between in-group conflict and out-of-group conflict. The group as a whole attacking and conquering the resources of another group (aggression), was part of our evolution. In-group aggression would be sanctioned while conquering other territory would be supported.

The global disadvantageous consequences of Putin's invasion in Ukraine shows that on our planet humans are all in-group already. The global community needs to sanction such behavior.


It is not enough to unite to be stronger against the other. If the majority decides against the minority it is also wrong. The dictatorship of the majority is still dictatorship. Rules must be based on abstract thinking, that leaves the locality of one's own interest, that sees the perspective of all parties.

Alternatives to fighting and loosing on both sides, could be sharing, finding more resources together, creating an economy.

Inability to respect the individual interest in a conflict between parties meant war, deaths and thus an evolutionary disadvantage. Thinking abstractly, producing an inclusive ethics, was necessary due to the population explosion. But this population explosion was so fast, that some still have the small tribe behavior.

Following someone instead of representing one's interests, inability to see the propaganda, giving in to repression, inability to think of alternatives, the lack of initiative, ... all this stifles the development of a society, its economy.

If a dictator demands patriotism, which is just a thought, it is like religion demanding faith in god. Repression of "traitors" is like inquisition in the middle ages. We know that society was not very creative in the middle ages. The middle ages lasted so long because very few individuals opposed the religious repressions.

The unit of thinking in society is the human brain, the individual. Parallel independent thinking is a faster trial-and-error for the evolution of the society. Error in trial-and-error does not mean "I kill you because your opinion differs from mine", because that is evolutionary bad as it reduces the population of people trying and thinking by their own. Error is rather wrong by disproof via counterexample. The second trial-and-error method allows some to learn from the mistakes of others without dying.

A society with tendencies to control (the thinking of) many (religion, dogmas, propaganda, ...) is basically an evolutionary selection to stupidity. More so, any social structure based on central control is selection to stupidity, because the individual does not choose and so there is no evolutionary feedback, no selection, based on the choices people make.

A final consensus on ethics for our entire planet can only be based on abstract principles that value the individual: democracy = individualism.


Human's have started a new kind of evolution, that of science and technology. This development needs stability to flourish, not wars. Individuals depend on technology and technology depends on livelong stable interest and learning of individuals. Also geographical regions, countries, depend on technology. A region can prosper technologically only if it adopts democracy.


Democracy is something individuals do. If the individual does not care, there is no democracy. If the majority does not do democracy, there is no democracy.

Once a dictator could establish itself, and the individual realizes the repression too late, uncoordinated individual smart resistance, using the same weapons of the dictator, propaganda and violence, can also end the dictatorship again.

The power lies with the majority, not so much by uniting, but by shared a common ethics that is good for all: basically individualism.

Individuals need to use their power of shared values to collapse a society that does not protect them anyway, but subjugates them.

One can stay unpolitical only as long as individualism is common consensus, else one must act to reestablish democracy again (individualism = democracy).

In a dictatorship the total population is always larger than the police or other troops sent out to crush any acts of protest. It is a question of speed: make more protests per time than the system can handle in that time.

What is needed is initiative from everybody who sees its own interests in danger. In a society of individualists, of democrats, dictatorship has no chance.

It all starts with education.

Locality

Individual freedom is the ethical equivalent of a more general principle: Locality. A system moving towards higher entropy is moving towards more locality (to less central control). A system in equilibrium has maximal local freedom and maximal total information (energy), the sum of all independent time lines.

For a society to reach more individual freedom, individuals must strive for it. It is not automatic, because human interactions are not automatic. This "pursuit of happiness" strive is not the same in all. Those who strive will live better.

Fairness distribution cannot be dictated. That would be dictatorship. Communism was dictatorship. Companies where the wages are decided centrally is dictatorship.

How much a person earns should be decided by the individual economic links, according supply and demand.

Even if these deals were all fair, and even if all had the same strive, not all people would earn the same, because they work in different unlinked sectors. Fairness is a local concept. But overall differences will be far less than in societies that don't care about fairness.

Locally fair cooperation (organization) has an advantage for the individual: less individual effort means more individual freedom. Cooperation restricts freedom by choice, by own control, because it restricts freedom less than without cooperation. But to judge what is a fair cooperation, information about the profit is essential. Economic thinking must go beyond personal economics, it must look at the full picture.

The economic advantage is the reason why some animals developed group behavior. Behavior good for the group was encoded via emotional information processing:

  • envy if someone got more than was healthy for the group,
  • rage to protect the things one depended on
  • happiness in sharing and helping, and the like

Much of the programming of humans by evolution happened already before humans. Animal emotions control the interaction in group animals. The human is still animal, just the rational layer has grown.

The prehistory tribes where little companies.

The participation in the control of the cooperation secures the individual interest. The individual effort invested in the cooperation is at stake, if someone tries to gain more return of investment (ROI) than the rest. Equal access to information (symmetric information), ensures that members can sanction unfair behavior.

Economy

Democracy needs economically thinking individuals.

Information processing creates a time line, first in the head, then in reality.

  • simulate: plan, do, test in the head
  • actuate: map to reality

Time is information. Time is value. Information is value.

To harvest the profit, bookkeeping is central. It allows to compare the result with the original goal, the simulation with the reality.

All economy is based on individual valuation. The collective value is the sum of individual values. The individual interest is central and must be demanded in the collective bookkeeping. The economic approach records numbers and compares them. There is no allegiance or patriotism.

The political system is an economic system. They are intimately linked. Democracy requires good distribution of resources and vice versa, a demand for a fair share in all cooperations preserves democracy, i.e. individual freedom.

There are economic laws against monopoly, but still today, law grants employers control over employees, instead of vice-versa. Ownership on the means of production should not lead to ownership on people. To avoid a local monopoly or a natural monopoly the "owner" must become a service provider. Employees become self-employed or partnerships and rent. The illegality of a monopoly demands such a shift of control to the workers. The cost for the rent needs to be regulated. So basically the "owner" looses control to the benefit of more people. The spreading of control produces more overall economy. This is done for the electric grid or the railway lines and similar natural monopolies, but just recently and not yet everywhere.

Economies are political relationships between people and as manifold as the latter. An economy where the individual is important is ethically good and an economy that is centrally controlled is ethically bad. A company that is centrally controlled by so-called "owners" leads to wealth concentration that the "owners" cannot use and therefore is lost.

Work produces wealth, but work for someone burns a part of it for every individual, because it concentrates it and then gets unused and finally looses its value.

Work that does not have a local aim is lost.

Individuals can preserve their wealth, and thus freedom, only by a cooperation, where they can demand a fair share of profit. Access to information to all members of the venture is essential to fairness.

Educating individuals to hold individual freedom high, and to keep a ledger to secure fairness, is the only way a society can keep democracy.

If wealth concentrates, the system, the economy, as a whole slows down, because less and less can take part in the economy. The entropy of the economy decrease, the locality decreases.

In a democracy, individuals have enough resources to make decisions of relevance to them, to build a house, to buy food, clothes,..., a car. To go on holiday. To build relations. To have a good living standard. Because they know their own needs and can care for them.

Locality means that decisions can be made individually, or, in small groups on consensus.

Stability

Let's call democracy the consensus mechanism, where the individual is important.

Groups of groups also act on consensus. The higher the level the slower a consensus is reached. But the topics of higher level groupings is basically only to secure the freedom of smaller groups and eventually individuals. Fast decision in higher levels are not needed and not wanted, because the many groups and many individuals in lower levels need stability.

The slow process in higher levels needs to be protected against faster decision.

Giving individuals the power of higher levels is always disruptive. An individual thinks faster then the consensus mechanism and therefore decides in a way disruptive to many individuals.

Let's call an individual with power in a higher level a dictator. A dictator has one brain, which cannot grasp the valuation of the many individuals it decides upon. The living condition of an individual is the result of a lot of studying, planning and working, like building a house, raising children, working on relationships, ... This life can only be appreciated and valued by the individual living it. A dictator does not see those values. Allowing a dictator is giving up stability and putting one's own values in jeopardy.

Dictators are not bad people, but a bad system. To keep power, dictators do become real monsters very often, though.

Dictatorship and democracy are opposite.

  • Dictatorship is decision by one person over others, fast, for personal profit to the dictator or on a whim, disregarding individuals and entailing instability on the individual level.
  • Democracy is slow decision via consensus of many, i.e. stability on the individual level.

If the power is with the individual, the many individual decisions make the society statistical. A statistical society is a stable society. This needs to be extended to sources and reserves of energy. There must be no single point of failure. That is also why many small businesses are much better than a few large ones.

It can happen that in one level we have a dictatorship (e.g. a company) and in the next level we have a democracy (a country), or that they are side by side, like democratic country neighboring a dictatorship. Such adjacent groupings are in conflict, i.e. approach each other.

Only the ethical values and self-esteem of individuals can save freedom against the influence of a neighboring dictatorship. By physical laws more locality should result in the long run, i.e. democracy, because the entropy of a closed system rises. But non-closed systems can change temporarily from democracy to dictatorship, e.g. if a dictator attacks and takes over a democracy.

Law: The Program of Society

Before writing, the memory and the processing was in the head of a person only, which required that person as coordinator for a group action. This explains the human behavior to follow someone, when a group action is required. The coordinator is voted down or up depending on the advantages s/he brings to the members. This kind of representative democracy worked for small groups, but communication failed for larger groups.

With larger societies, where the individual counts, there cannot be any central coordinator any more, there cannot be any super important person, whose ethical values are more important. A large society just needs some minimal guidelines that does not bias, but makes every individual equally important.

Democracies operate according written rules, the law:

  • create the law text (legislature): parliament or congress (elected)
  • act according law (executive): administration (nominated by parliament or president)
  • check abidance to law (judiciary): judges (nominated or elected), prosecutors (nominated or elected), lawyers

Values lead to laws. This means, values are encoded in the law. There is no additional judging, as that would allow arbitrariness. For example: When you apply for unemployment money, there are certain rules, that you have the right to use and there is no additional judging, how much you use it and the like, because that is already encoded in the rules.

The society is a parallel computer like our brain, just bigger, and thus slower. The law is a program that guides the much faster individual interactions.

Written laws are important, because to trust by word is possible only within closely tied communities, like tribes or families, where all members lose, if the community breaks apart in case someone does not hold its word.

Law can only work well

  • if it avoids too many indirections
  • if it can be understood and applied by individuals
  • if it does not have bottlenecks

There is a deficiency in that regard in most current democracies.

The biggest deficiency, though, is that democracy does not yet permeated all levels of society. All levels need democracy.

For democracy to work the people must know the laws. The laws must be minimal. The law education must fit into compulsory school.

The idea of representative democracies is that some are entrusted by election to make laws in the interest of the voters. But since the voters do not know the laws it ends up to be an election for sympathy. What makes it still operable:

  • there are many representatives that need to fight with each other
  • there are proposals, discussions and finally and selection via voting
  • if things go worse, one can change representative

Representative democracy has shown to misrepresent the individual freedom, because too much controlled by people that could accumulate wealth and power.

Political representatives are also just individual brains, which make decisions without consensus, basically dictators on time.

Can they be held responsible at the next election, if they hide information? A democracy, where parties can hide information, is a bit a façade democracy.

The answer: more direct democracy.

An important prerequisite for direct democracy is to make the law smaller.

The internet and the methods from open source development can help to crowd-develop law texts.

Laws need to be stable. The consensus mechanism, the testing, should take a long time. It needs to be proven that certain changes in the law produces a better situation for individuals. Votes from the majority for a change is kind of a prove, but might not look ahead into the future far enough. So argumentations, computer-simulations, a public discussion are tools towards consensus.

If the law is small and knowable by anybody, the roles of legislative, executive and jurisdiction can be take over by anybody. The system has bottlenecks if experts are needed to fulfill the law. To take legal action via experts, lawyers and judges, should be needed only in corner cases.

To have too much law text makes it unusable to the individual and therefore is counter-democratic.

Economy Instead of Taxes

Taxes are bad.

Taxes mean concentration of wealth and thus power, especially if the country is still a dictatorship. The current invasion in Ukraine of Russian dictator Putin shows, that taxes are dangerous.

In a representative democracy there is at least some control over the use of tax money, but it is nevertheless not according the principle of evolution: Alternatives and choice or supply and demand.

Countries have historically become too large, beyond the principle of locality. Due to non-locality and lack of transparency of tax usage there is no way individuals can check on their ROI.

Historically taxes grew out of extortion by a feudal system.

Later, with democracies, one can understand taxes as a way to reduce communication effort and still have things cared for.

With the internet one has means to create more democracy again.

  • Automatic paying systems allows financing of infrastructure via pay per usage without hassle.
  • Local social services like schools, health system, roads, allow more individual control.
  • Local transparent public bookkeeping and consensus on pricing can avoid overpricing whenever it is not possible to provide alternative offers.
  • The individual can decide by its own economy whether to support a road or a hospital.
  • With direct democracy, permeating economy, wealth distribution becomes better, thus not needing taxes for wealth re-distribution any more. Insurance services can handle that, anyway.

This is just to show that there is still much to do to improve the life of individuals, to improve democracy. Initiative starts by giving individuals the understanding that they have possibilities to make their life better, that they have ways to influence things they are not happy with.

Taxes can be replaced by normal economy, by alternative products and customers. But for that the economy must become fair first and must be checked to be fair: basically employment must be replaced with partnerships and cooperations.

The state is basically a monopoly.

Local monopolies sometimes cannot be avoided and are OK if they

  • are local
  • have transparent bookkeeping
  • are controlled by direct consensus

A monopoly is like taxes, if you depend on the product. Vice versa: Taxes are a monopoly. A state is too large for general taxes, too large a monopoly. A monopoly is a single point of failure. A state is a single point of failure for too many people.

A larger organization can still be needed to provide services, that need support from a larger population:

  • Military protection (given that there are still dictatorships around)
  • Rules against environmental pollution
  • Standardizations of laws across administrative regions (schooling, traffic, units, ...)

But then again states are too small for really global questions. So they are basically historical intermediates to publicly supported international organizations for specific purposes, like NATO for military, WHO for health, UN, ... Also non-governmental organizations like WWF, Greenpeace, Human Rights Watch, Amnesty international, ... are publicly supported.

Why the monopoly taxes in between?

Country

I would have thought that countries are administrative entities, by historical chance, out of historical kingdoms, but that these kingdoms, i.e. that these dictatorships have been overcome. They have in my mind, but not in all minds, not even in the western world.

A dictator declared his subjects "his people". And "his people" took over this thought, his propaganda, against their own interest. It is this idea that made a nation. To continue with such an idea would be like having as many nations as there are political leaders or parties. Every football team would have its own nation.

Such ideas should be history. People (as plural to person) should be regarded as important individuals, as members of the human species, indiscriminate of place of birth. Everything else is anti-individual, anti-democratic, or just plain alienation.

But why is there still the nation printed in the passport? Why is voting or active political engagement linked to the passport and not to the place of residence?


Current democratic countries historically were dictatorships. They have not yet developed the full extend of democracy, of individualism and they don't protect the individual enough. There is still some way to go. Technology can help to make democracy more democratic.

The first civilizations emerged because people changed from hunter gatherers to farmers. Before that, in small tribes, information exchange and ensuing trust was possible.

With civilization the information flow could not keep up. Central decision without consensus was the result. With an army and scheming, like allegiance, and divide and conquer, individuals (dictators, emperors or imperialists) could control vast regions (empires) and extort the farmers.

The big empires tells a story of peaceful farmers living in abundance due to the new technique of agriculture. There was little resistance against ransacking and stealing. Finally they basically consented to be dominated. An alternative would have been to build their own protection, so protection money would have to be payed either way. This protection money became taxes later on.

Scheming for control also included propaganda and religion. Control the action by controlling thoughts and values.

A dictator would make propaganda to instill bride on its subjects, not to the advantage of the subjects, but as means to secure its own power. Subjects acting according his interests are good people, patriots. The others are enemies or traitors or simply bad people that deserve to be hated. The dictator does actually not know any of the judged people. This judging is propaganda meant to control its subjects. The actual traitor is the dictator. The propaganda jargon is completely misleading.

The traitor is the dictator.

Religion with one god that controls everything, just like the dictator, came very handy. The one god has unbelievable power and sees everything. No escape.

Exploitation via warfare can be seen as a technique. With all the prosperity that came from the new agriculture, raiders had immense resources basically at their disposal, because the effort to conquer was low. Given the little resistance some individuals could harvest large regions (Alexander the Great, Roman emperors, ...).

For emperors to have more language zones under their control was normal. More ethnically confined nationalism can be understood as counter-movement to imperialism. But it did not solve concentration of power and wealth. Capitalism had communism as counter-movement, but it did not solve concentration of power and wealth. These movements just show that people did not live well, that they tried to find alternatives, but were misguided by populists that promised a better life, but actually just wanted more control for themselves.

Unbiased education and own thinking would have helped. Education was what lead societies out of the middle ages. It produced alternative ideas and finally resistance (e.g. French revolution) and after too many wars finally also democracies.

But the world has many time lines. Not all developments are at the same stage. Some countries still follow imperialistic ideas. Some countries are still centrally controlled.


Technical advancement, air traffic, internet, container ships, and a Lingua Franca (English) made the world a village, with economic ties all over.

Every economic tie is also a dependency. Economic ties with a dictatorship is an investment with high risk, at the mercy of a dictators whims. Democracy therefore needs to be part of the consensus rules of trading entities. Ultimately not just the country, one trades with, should be democratic, but also the company.

Citizenship means participation in the consensus. Otherwise countries are just an arbitrary tagging of people, which leads to mistakes in thought. Some say this or that country acts or acted this or that way. That is a mistake of thought. A country does not act. People act. A country is many people brought together by historical coincidence, with different characters, different opinions. A dictator of a country and also an administration of a country acts. The people in a country often have no influence on that action, because the decisions are not done in consensus. Few countries have direct democracies, few have installed means to stop the administration in consensus. The major reason is that countries are the result of historical dictatorships (kingdoms), too big for direct consensus. They would need to be split into more levels of consensus regions.

But the shift is towards locality not just by geography.

Local has kind of a mathematical meaning: We have many dimensions. The same people can be local in one subspace, but far away in another. A locality is a grouping of people regarding a certain aspect (subspace). A country is a grouping by geography, a company is a grouping by product, a democrat is a grouping by value.

The questions of local interest must be decided via local consensus, or just individually. Local means by those concerned by the question, and not necessarily geographically local.

It would be wrong to force minorities into the majority decision, if more alternatives allow coexistence.

There are global problems, too. The internet allows to tackle them by a global consensus, beyond countries. One could allow the whole world to vote on the use of coal all over the world, because the whole world breaths the same air and the climate is linked across the globe. Administrative units (countries) would need to comply with such global consensus.

It is time to build political infrastructure for the whole planet earth.

Saturday, January 8, 2022

Cryptocurrencies as Money

Cryptocurrencies as Money

A free economy can be compared to statistical physics. There are many actors. Independent comparisons, information processing, produce local transactions, but level out into a collective valuation, collective prices, until a global market establishes in time (more or less stable) and space (over countries, continents and the planet), until the number of transaction are maximal, i.e. fulfill all needs in all remote corners of the planet. Maximum entropy is maximum information (processing) is maximum energy consumption. Limits/setbacks of growth are reached with energy limitation/exhaustion, but new sources, automation and finally AI help out.

Cryptocurrencies (short crypto, fungible and non-fungible tokens) are a very accessible interface and infrastructure for the bookkeeping of real assets by humans and/or trading bots. Cryptos can be the money of the future. What is missing yet, is the widespread adoption, which would make valuation statistical and thus stable.

Introduction

If you have a key to a lock (of a house), then you have access (to the house). The same key-lock principle is behind the private-public cryptographic key. Instead of a physical key-lock we deal with two sequences of bytes.

  • The private part is the "key"
  • The public part is the "lock" (but normally called "address")

In ECDSA keys, the public key can be generated from the private key. So by "key" mostly the private part is meant.

Having the key gives you ownership. Locks can be combined to produce shared ownership, where more keys are needed to unlock.

In general a token is a hash of some data. The hash of the public key(s) states ownership, either of an addable number (fungible) or of another token (non-fungible). The ownership can be redeemed using the private key(s), by creating a signature, that can be checked against the public key and thus verified by everybody.

In general a transaction has more inputs and more outputs.

Each node in the network has its own interpreter to check the signatures and do other tasks like executing smart contracts. This applies to EVM (Ethereum Virtual Machine), but also to bitcoin and its forks, like bitcoin-cash,

The private keys are stored in wallets. The wallet also cares to make new keys (HD Wallets).

The unspent transaction output (UTXO, Coin) is first created as the first transaction of a block (coinbase), as reward for mining the block. This numeric value is kept limited by network consensus thus can be used to temporarily replace other limited assets, i.e. it can function as money, as long as the network is online. To keep the network running, nodes are motivated to join and stay by block reward and fees.

A small change in data, and the hash is completely different. The network of miners accepts only blocks with a hash less than a certain number (difficulty). For that only (all) values nonce number is tried.

The difficulty avoids that one can provide all the blocks and thus have control over a chain.

Blocks are chained together by the previous block hash (hashPrevBlock). The blockchain forms a public decentralized ledger, secure, because it cannot be changed unless one is able to redo the difficulty of all blocks following the changed one and overtake the network.

The network nodes check that the difficulty is met and wouldn't accept a block otherwise. Nodes build on the longest chain.

The difficulty is adjusted regularly (every 14 days or 14*24*6=201614*24*6 = 2016 blocks for bitcoin) such that the network can produce no more than about one block per 10 minutes.

Money is a collective product. The consensus rules and validation are a collective product. The joint usage of the network are a collective product. Together they make a collective value, they make money (= fiat money).

Time = Value = Transaction

Value can mean:

  • an element of a variable: most elementary
  • a number: mostly the result of counting values in variables (information)
  • human valuation/pricing: this considers human needs
  • ethical value: considering human needs, but eluding pricing

The values of a variable are exclusive. The value implies the variable.

The values of the variable must occur for a variable to exist. Selection of values of the variable cycles. Every value takes time or better is a time step of the variable. One cycle is one variable, is one time.

Every variable is also an independent time.

Information is the number of values of a variable. As such information is a quantity characterizing a variable, not a value. But since variables are values for higher level, the information (extension) is an extensive value. It motivates addition and ultimately all other operations.

Most values consist of internal variables. Internal communication produces inertia, because a level has a more or less fixed speed of communication, with a maximum speed for the lowest level.

When one variable separates into more independent variables they also form independent times. The variables get out of sync without communication.

Independent times make their value combinations random. Such a system of independent variables forms an exponential number of value combinations. If SS is the number of identical and independent variables of size nn, nSn^S is the number of value combinations.

The information speed comes into play when comparing to another variable. Information/Information = time/time = information/time = energy (see earlier blog). While information is conserved, energy is not. The information stays constant even if it spreads to more variables, in the same level or vertically in the hierarchy. pV=ST+UpV = ST + U becomes pV=STpV=ST, if the internal information (energy) UU is ignored, because locked up, anyway, i.e. not spreading vertically.

A transaction is the movement of a packet to new coordinates (value = location = selection = owner). In physics, the packet is internal physical information, internal variables/times. In human economy, it is valuated/priced considering human needs. The transactions by themselves form values, a variable, in the observed level. The packet is transacted based on a price agreement. As the transaction is also with information/price (food, gas, fee, VAT), the internal value of the packet (rest mass) is lower.

  • Physics: For a variable to exist, the values must occur.
  • Economics: For a valuation/price to exist and persist, transactions must occur.

Note

  • A transaction is a time step of economy and it has a price.
  • Transactions are needed to maintain value.
  • The transactions of a product represent a cycle, a variable.
  • A product has inner cycles (those of components).
  • Products of higher level move slower and have a higher price (mass).
  • The economic pricing hierarchy builds on top of basic living cost.

Money, Pricing

In human economics, transaction of physical resources are associated with a (numerical) value through the valuation/pricing process, that takes into account the demand/need of a resource and their limited availability specific to a person or a group of people.

Valuation of a product is a comparison with other products. If one person would do that, it would create its own valuation scale. The major products an individual compares to are due to its basic needs: food, housing, clothing, ... To compare, the person simulates having the product. A product needs to be personally used to have personal value. As the person has limited time values (.e.g seconds per life), a person's total valuation is limited.

Individuals averaged over a large population, or better a large number of transactions, produces money.

We don't use gold coins any more, we are on the verge of not using paper bills any more, either. We are left with only numbers. But the numbers have a value through the trust in each other that they will redeem the number with same valuation. Like, if you helped me for a day, I give you a bill or text you a message, which remembers you, that I Owe yoU (IOU) a day of help, too.

We collect such IOU's, so we don't need to stash food ourselves, because others do it for us. We can redeem our IOU's, when we are hungry.

Money is collective trust in the promises made by others, by the society. The valuation of money rises and falls with honorable and trustworthy behavior.

Valuation varies between people, space and time. Traders calculate with the valuation of other people, and especially use the valuation differences between people (arbitrage). In order to exploit the valuation difference, the trader relies on secrecy:

  • that the valuation of one party stays unknown to the other party and
  • that the calculations leading to the price offered by the trader stays secret

Secrecy and trust do not go well together,

  • Valuation differences, i.e. lucrative business ideas, do not stay secret long, but attract competitors.
  • Companies are short-lived, if their products that don't live up to the promises.
  • Outright lies, fake it till you make it, regularly lead to gigantic crashes in the finances.

Secrecy exists, but it does actually not matter so much. Even without it there is division of labor (including mental work) due to the expertise necessary and the limited time of one to do all alone. Sharing information without limit, nowadays so easy, boosts the economy.

Traders are like Maxwell demons, like are biological cells, plants, herbivores, carnivores, ..., farmers, traders, engineers, businessmen, investors, ... They all process information in a successively higher level, and can have a positive energy balance from it. Energy is information/time, the higher the level, the slower. But the information packets matter. A scientist has a long curriculum on its shoulder, like a complex protein has a long chemical pathway.

An important criterion in valuation is the marginal profit/loss (MP=MRMCMP = MR-MC), i.e. profit change by one more/less customer, product or whatever other unit, because it tells in which direction to go to maximize profit.

All this comparison in an economy creates stable prices (more global prices in space as well as time).

The collective comparison produces a common currency. Although just a number, that currency is limited, because also input channels, e.g. via work, is compared to the same scale.

Pricing is not solely based on calculations or statistics, though. Also power hierarchies or human relations play a role. Sometimes prices can even be dictated.

Comparing is work and many people don't spend too much effort on it, also because the effort very quickly surpasses the value of the product. Sharing information, the rating of other people, reduces the effort considerably.

The scarcity (limited supply and demand) is an essential feature of money, just like of every other product.

Scarcity could be named stability of valuation in a statistical sense. It does not refer to one person or one product. It does not mean that an individual should suffer of scarcity. It just means that sudden collective changes of valuation through a change in trust or supply and demand brings some disruption, with winners and losers, and needs time to stabilize again.

For a (stable) valuation there need to be (many) transactions. Transactions need consensus of more people to use the currency. The currency needs to be well distributed over a large basis of users to maximize transactions.

Money, despite varying prices, still represents real resources. In accounting, the real resources are assets, while the money is equity+liability. Assets = money. But it is a local assumption, because the pricing changes. There need to be regular currency adaptations.

The price can change because of more demand of a real resource (assets), but it can also change because the money supply changes.

A sudden change in money supply will change the demand on assets, which will change their prices. The same happens when the asset supply changes. Also both supplies can change. After one-sided changes it takes some time for prices to stabilize again.

If a money supply change reflects the resource/asset supply change, then the price stays stable.

Often there is one currency but many assets. But more generally there are different types of assets, as well as different types of currencies. One can make a currency per product. The currencies have their exchange rates. To compare, one needs to convert to one currency (valuation/pricing). One common currency stays relatively stable, because averaged over many transactions.

A countries legal tender is kept stable by adapting the supply,

  • either by issuing new money or
  • by buying up money of its currency

A central organization has control by issuing or withholding money. The control is exerted via parameters like interest rate. More money will be issued,

  • if the central bank interest is low
  • if the state's public spending is high

It is not just the political authority that control the money supply. Basically, those who own, do control. So centrally owned money means central control of money supply, and so indirectly central control of average pricing of products, i.e. the inflation.

General inflation is not just due to money supply, but also by the change in pricing of important products, which are ingredients of a large portion of all products, like energy and work force.

  • by central pricing agreements like that for work force
  • by change of taxes
  • by a change in supply, e.g. by deciding to get out of fossil energy supply
  • by a change in demand

Every product is its own currency. A currency is a product like every other. But a central currency is a special product, because it is more centrally controlled than any other product.

Central control would need a lot of information to make a good control. Normally central control is associated with inadequate reaction to changes.

A transaction needs a compromise between the parties. First, the compromise was quite local to a transaction and was done through bargaining. But with more bookkeeping and calculations, larger chains of transactions are taken into account. They lead to narrower price ranges of buyers and sellers. Transactions happen if the price ranges overlap. The bookkeeping and other kind of communication over space and time, like collective price agreements or dictation, make prices more global in space and time, i.e. more stable.

Many local independent decisions normally produce a better stable result via the law of large numbers than by central control. A globally used independent, not centrally controlled, exchange currency would become stable after some time and stay stable unless disruptive events occur.

Note

  • A currency is like every product.
  • Transactions (supply and demand) are needed for valuation/pricing, of money as well as of real assets.
  • Difference in valuation above fee produce transactions.
  • Many transactions produce a stable currency in the absense of disruption.

Traditional Money Compared to Crypto

Crypto has all the qualities of traditional money:

  • the paper bill number corresponds to a crypto key hash (number), but that bill/number is just the carrier of value and can be exchanged by another paper bill or crypto key (fungible)
  • like the paper bill, a crypto-key has a value associated to it
  • instead of putting the bill into your physical wallet, you put the crypto key into a digital wallet
  • the crypto key is the record of your belonging, like the paper bill you own
  • Your physical wallet or your bank account is your bookkeeping, just like the digital wallet is your bookkeeping. The wallet is like an account.

The role of money is to allow bookkeeping.

But for global/long-term bookkeeping, money needs to be stable, else one better considers it as an asset, a product.

Since crypto is not widely adopted yet, it is unstable, because not averaged over a large number of diverse transactions.

Wide adoption needs and produces stability.

Currently crypto is better considered an asset, like a physical product or like shares on a company.

Governments regard a crypto as an asset, like shares.

Shares do get quite independent from the company that issued them. Their price is rather dominated by supply and demand. Only occasionally good or bad news from the company change the behavior of traders. If the link to the company is removed then we basically are equivalent to a crypto, meaning that then both have no links to real assets other then through the valuation via supply and demand.

On the other hand many cryptos are driven by ads and influencers, with a company behind it that organizes that, and also controls the consensus centrally. This is very much like traditional shares.

Cryptos can replace traditional shares: Instead of issuing shares, a company can issue a crypto to finance itself.

  • The manufacturer can have its own fungible token to express the market valuation (EIP-20) of its products.
  • Or every product item can get its own non-fungible token (NFT, EIP-721, deed). It does not matter how the token is generated. It points to metadata via tokenURI that has more asset information. Ownership is not encoded in the token hash, but with separate addresses, like for fungible tokens.

Market

Market cap(italization) is coin supply times current price of one coin with respect to a FIAT currency.

Cryptos can be bought and sold in exchanges or privately.

The crypto's exchange rate, i.e. its price, depends on the limited supply and demand.

For the demand it must satisfy needs.

  • Provide a money infrastructure easily usable via smartphones (or other computers)
  • Keep the coin supply limited
  • Serve as an exchange currency between other currencies over time or space
  • Represent bookkeeping, possibly local for a product or a company
  • Trade and exploit valuation differences

For supply, block reward and fee keep the network running:

  • Crypto is created as reward for mining blocks: The coinbase is the first transaction of a block and it creates new output without input, i.e. new coin.
  • The output can be sold for other currencies, which gives the coin a price.
  • Transaction within the network do have a fee to account for the physical resources involved (electricity, computers) to reward the block miner and to avoid DoS attacks.
  • Fee burning reduces the supply more, when demand is more, thus working against inflation, and possibly producing deflation.
  • Buy back and burn by sending to an unusable address, is also used to reduce the supply.

All cryptos fulfill basically the same goal. That some are valued more than others is to some extend irrational speculation, to some extend limited support from wallets and crypto exchanges, to some extend lack of trust.

Currently, speculation is the major motive. This leads to unstable coins, if there are only big players, because big players decide slowly and keep a trend going, trying to drag others along and win from their movements. There are not enough independent actors to keep the coin stable.

A crypto cannot produce coin forever,

  • because computers work with limited width numbers
  • because any real resource is also limited
  • because a unique consensus does not cover all needs
  • because for scalability more networks are more efficient

Bitcoin, for example, reduces block subsidy gradually to 0. The assumption is that fee and valuation can keep the nodes online.

Scalability

The independent movements of a large population to fulfill their daily needs would make a crypto stable. That is the case for large fiat currencies.

No current crypto currency network can process that many transactions, therefore they rise the fee to keep away the masses.

Ethereum can process around 7-15 transactions per second, Bitcoin around 3-7. Second layer networks like Lightning for Bitcoin and Raiden for Ethereum, or sharding (partitioning of the database) are efforts to increase scalability, maintaining security and decentralization.

Second-layer networks reduce fees, because some communication is done off-chain.

Bitcoin has about 13000 listening nodes. A high node count produces more load for transactions, because every node needs to process them.

The fee is an important criterion to choose a crypto.

Exponential growth is a consequence of independent times/actors (Boltzmann statistics). Current exponential fees make the fee market "exponential-exponential". The fee rate should be constant. A fee competition between cryptos can help. But there is also the network competition for more hash power that asks for more reward.

Many different cryptos can be a remedy to the scalability problem. Each crypto can represent a local usage (can even be pegged to a local asset). The coins stabilize each other by exchange sites. Some exchange sites have a site-specific exchange coin as intermediary.

Trading bots can exploit valuation differences of various cryptos, level them out and thus produce a stable coin that can work as money.

Trust

A currency is an IOU. The amount of currency a person possesses, is a promise of society to redeem later with same assets.

A currency is stable if people trust in it, and they trust in it if it is stable.

You cannot trust anybody but the statistics of large number.

Individual decisions should not be made due to currency value, because it ruins statistics.

A Currency must be stable.

  • A deflationary currency is bad, because it postpones transactions, and loses the link to real economy
  • An inflationary currency is bad, because it prevents long-term planning.

Large fiat currencies are rather stable through the sheer amount of transactions. Stablecoin is normally pegged to to important fiat currencies like the Dollar (Tether), Euro or Yen.

Cryptos need to be trustworthy

  • the network needs to be reliable and stay online all the time
  • the link to real assets (NFT) must be correct
  • The way programming decisions are made, whether centralized or via enhancement proposal publicly scrutinized

Trading Bot

Stability is relative, though. Just as intermediary to an exchange, a short term stability is already enough. A bot can quickly react on changes, exploit them and produce stability, for people to use.

For a valuation to be stable its supply must change according to its demand. The bot can swap falling cryptos with rising ones, leveling them out. This swapping is the result of many bots buying low and selling high, but for them small amounts already matter.

Note

speculation on trends

The principle of speculation is to act before others and gain from others.

If one is first to buy in an upward trend, and first to sell in a downward trend, one earns most. If one is first in the game, one earns most.

  • By convincing others their behavior is a result and thus is of course later.
  • Otherwise one observes and anticipates the actions of others before they actually happen. Predictable behavior is always losing in speculation.

Buy when price is minimum, sell when price is maximum.

With slow competition:

  • buy, when the price starts to increase and
  • sell, when it starts to decrease

But, with fast competition, a minimum in local time, is already beyond the minimum, when the exchange serializes independent requests. Then

  • buying, when the price falls and
  • sell when the price rises

Fast bot competition produces so small and fast vibrations that the currency seems stable for the human eye.

Let's envision a future time where every person has its own avatar bot and their are additional bots in several levels. The ultimate demand is from humans, though. The avatar must see the human demand. For that, currencies must be pegged to real assets.

  • Let's assume a currency pegged to a local electricity power station (LOCTRO).
  • The demand increases locally in space and time, due to cold weather and electric heating.
  • The power station decides to increase the price of LOCTRO to gain on the demand.
  • A local consumer bot on electricity (BOTTRO) sees changes in LOCTRO. It exchanges LOCTRO for FARTRO (farther away power station).
  • The bot is fast and humans will actually see no change in price in BOTTRO. BOTTRO is a stable mix.
  • When all use more electricity, because suddenly everybody charges its electric car, a personal consumption avatar can swap BOTTRO's for other cryptos, telling the person to reduce electricity consumption, to use the bike instead of the EV.
  • Investors see BOTTRO increase, such that a larger local investments makes sense. They build a new power station and power storage.
  • After the investment has been payed off, competition makes BOTTRO fall and become stable again.

Bots can help stabilize local changes. Speculative human changes are local changes. Bots can help to merge the many cryptos into a stable global money.

Note

  • The role of money is to allow bookkeeping.
  • A crypto is like money, but the public ledger/network brings along the full infrastructure for bookkeeping.
  • More cryptos with (automatic) trading between them are a remedy to the scalability problem.

DEFI and DAO

DEFI: decentralized finance

DAO: decentralized autonomous organization

Cryptos are public ledgers. This does not yet make them decentralized finance, if the consensus rules are centrally dictated. Rather it also needs organizational decentralization that distribute control over the programming of the consensus rules.

The ledger only records transactions. For transactions to increase and become statistical the coin must be distributed. Only in combination with fair organizational rules, that care for a good distribution, transactions and thus valuation of the coin becomes decentralized.

Decentralized finance usually just refers to the public ledger, and the avoidance of a third person in transactions via smart contracts. It does not refer to a fair distribution. For fair distribution the participants in transactions must care for fairness. Fairness is an ethical value of humans, but often cannot unfold due to lack of information, centrally imposed to keep the advantage and power.

The distribution of information is the first step to fairness. The following crypto properties help towards fairness:

  • The ledger is public.
  • Smart contracts are programmed and can be reviewed before adoption.
  • Neither can be modified afterwards.
  • Smart contracts can be done without the need to trust a third party.

Extra fairness effort on top of the public ledger is still needed, though. The DAO needs its own purpose, its own constitution, local consensus rules, The data for a specific DAO needs to be made conveniently manageable for its members according to the DAO's constitution.

Bitcoin is a public ledger, but it is yet mostly used by rich people that have money to speculate on ups and downs of its exchange rate. The bitcoin capital is in the hands of a few and therefore not stable.

Everything develops by proposal and acceptance/adoption. So someone needs to (centrally) develop a proposition. If others accept the proposal a consensus has been reached.

A new crypto/blockchain/DAO needs someone to start it. If it gets adopted a consensus has been reached.

But people should also verify that the further governance is decentralized else their investment is laid into the hands of a few, which is not decentralized finance any more.

Source Code

bitcoin-core was the first and is now reference implementation to many forks. The forks, like bitcoin-cash-node, share much code with bitcoin-core and regularly take over changes from bitcoin-core.

Here some central identifiers. Initial v means vector, i.e. many:

CBlock(Header): vtx (nVersion hashPrevBlock hashMerkleRoot nTime nBits nNonce)
CTransaction: vin vout nVersion nLockTime hash
CTxIn: prevout scriptSig nSequence
CTxOut: nValue scriptPubKey
COutPoint: txid n
CChain: vChain of CBlockIndex
CScriptCheck: scriptPubKey amount ptxTo nIn nFlags cacheStore txdata pTxLimitSigChecks pBlockLimitSigChecks
CTxMemPool: mapTx
CConnMan: vNodes
CNode: hSocket, vRecvMsg

Note

hash

Hashes are used for

  • transactions (txid)
  • public key (Pay-to-PubKey Hash = P2PKH)
  • signatures (content according SigHashType + private key)
  • blocks (hashPrevBlock)
  • proof-of-work (POW): find a nonce that makes the block hash smaller than nBits

While POW's smaller-than task is hard, finding the data exactly hashing to a given hash is almost impossible. Hashing is a trapdoor.

Node

A bitcoin node is a bitcoind daemon running on a computer. Each node is its own time. Parallel times means parallel independent information.

To manage to maintain the consistency of many transactions, transactions are divided into blocks.

A mining node creates blocks (CBlock) that are filled with transactions (vtx) from the mempool of transactions (addTxs). The block is like a page in a ledger.

To make a common ledger, a common time, more mining nodes need to find a way to choose, who contributes the next block with transactions to the chain.

The first mining node that fulfills the proof-of-work, adds a block to to the longest chain. The frequency of blocks is controlled by the difficulty.

CBlockHeader::hashPrevBlock of each block fixes content of the previous block, because changing the content would produce a different hash that would not fit any more to hashPrevBlock of the next block. The hash brings the blocks into a sequence, a chain (vChain).

This ledger is replicated in all full nodes.

CBlock is derived from CBlockHeader and contains the transactions (vtx).

The hashPrevBlock that fulfills the nBits difficulty is based on data in the header (hashMerkleRoot, nTime, nNonce). The transactions are included in the hash indirectly via the hashMerkleRoot field.

The block chain is like its own time. The many different times of all the nodes create one common time.

The result of hashing is random. To find hashPrevBlock that meets the difficulty the hashes per second matter. Whether they are achieved in parallel or sequentially does not matter. This way many slow machines can be as fast as one fast machine. The fastest machine must not be more than 50% of the hash frequency of the whole network, else that fast machine could tamper with a block and then rebuild the chain and produce a longest chain, that would be accepted by the network.

Network

The network has a documented protocol.

Nodes in the network are characterized by permission flags like PF_MEMPOOL,...

The nodes exchange NetMsgType messages:

CConnMan::ThreadMessageHandler
    PeerLogicValidation::ProcessMessages
        ::ProcessMessage
            ::RelayTransaction
            ::ProcessGetData
            ::Process...
                CInv//ventory

A PeerLogicValidation implements the NetEventsInterface interface with SendMessages and ProcessMessages.

Only full mining nodes create new blocks. They need and others can fetch all accumulated unconfirmed transactions (NetMsgType::MEMPOOL/[GET]BLOCKTXN). Other nodes RelayTransaction one-by-one (NetMsgType::TX), so after some time all nodes will have all relevant transactions.

CInv types correspond to NetMsgType commands:

MSG_TX: NetMsgType::TX
MSG_BLOCK: NetMsgType::BLOCK
MSG_FILTERED_BLOCK: NetMsgType::MERKLEBLOCK
MSG_CMPCT_BLOCK: NetMsgType::CMPCTBLOCK
MSG_DOUBLESPENDPROOF: NetMsgType::DSPROOF

Each node constantly communicates with other nodes:

  • connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::TX, ...)), ...
  • ProcessMessage according to the protocol, especially:
    • fetch new blocks and determine ChainActive (longest chain) (ActivateBestChain/FindMostWorkChain)
    • fetch new transactions as they need to be in the block before the block hash is created

ZeroMQ or zmq is an additional optional protocol to broadcast transactions and blocks.

Transactions

Each of the transactions vtx in a CBlock have

  • many inputs (vin)
  • many outputs (vout)

A transaction can

  • split the vin[i] to more vout[j], to take only part of a vout[n].nValue addressed by vin[i] and keep the rest via one's own change address, or it can
  • combine more vin[i] (previous vout[k].nValue) to one new vout[j].nValue.
  • or mix otherwise

vin is the n'th vout of another transaction (txid), referenced via prevout:COutPoint{txid;n}.

The unspent coin is important for validation.

cacheCoins:CCoinsMap is a map from vin[m].prevout to Coin{TxOut{nValue,scriptPubKey}} (CCoinsViewCache::FetchCoin()). This map is also stored in a leveldb .lvl database (CDBWrapper). The CBlockTreeDB is also stored in a leveldb database.

The Coin can be fetched from a CTxMemPool with mempool.get(txid).vout[n]. mempool holds enough transactions to check yet unstable blocks (COINBASE_MATURITY) against double spending.

Older transactions are secured in blocks by hashPrevBlock. Many blocks are serialized into one .blk file.

The sum of all vout[].nValue, i.e. GetValueOut(), minus the sum of all the vout[vin[].prevout], i.e. GetValueIn(), is fee.

Fee

The fee of a transaction is Σoutput - Σinput. The fees of all transactions mined into a block contribute to the coinbase, together with the subsidy. The fees are not linked to its original transaction via address keys. The coinbase has no input, but its output is subsidy+fee.

When mining a block the transactions are ordered high fee first. With more transaction available than fitting into a block those with higher fee are chosen, while the others wait for the next block.

There is a blockMinFeeRate(DEFAULT_BLOCK_MIN_TX_FEE_PER_KB) to accept to block and a GetMinFee() to accept a transaction into the transaction pool (g_mempool). The latter is influenced by the maxMemPoolSize configuration. The largest fee of the transaction falling out becomes the minimum of those allowed in. GetMinFee() gets exponentially smaller with a half life of 12 hours (or 6 or 3 depending on how fast the traffic goes down).

The users decide on the fees, but it is a guess, because if too low the transaction will not get into a block. A stuck transaction can be manually prioritisetransaction'ed, thus circumventing currently higher fees. But for that you need RPC access to a node.

The number of blocks in the network are kept at a constant rate (e.g. 1 / 10 min). With constant block size, even a larger network cannot serve more transactions. A larger network only produces more load for transactions.

In nature exponential behavior comes from independent times. The resource usage of a transaction can be considered constant (proportional to the number of network nodes). But those doing transactions are independent and thus produce an exponential memory usage. In the presence or constant memory, the fee will have an exponential behavior, shutting out an exponentially growing number of smaller fee transactions.

getmempoolinfo informs about the current GetMinFee().

GetMinFee() is a rate per KB. The actual fee is GetMinFee().GetFee(<transaction size in bytes>).

On Ethereum the fee required to make transaction go through is called gas. EIP-1559 burns a base fee. Miners only get the difference to the base fee. The base fee changes with the traffic. Burning the base fee means more is burned the more traffic. The supply becomes smaller, when the demand becomes higher. This increases the price of the coin (deflationary coin/token).

Script

Bitcoin has no fields for addresses one spends money to or from. The addresses are buried in a script indirectly addressing public keys as hashes. To redeem a vout[i]->vin[j] from one transaction to another, the following script composition must evaluate to true (done by CScriptCheck):

[ <vin[j].scriptSig> ]  [ <vout[i].scriptPubKey> ]

The first part comes from the later transaction's vin[j].

There are more variants, the most frequent one is P2PKH.

P2PK:

[ <signature> ]    [ <public key> OP_CHECKSIG ]

P2PKH:

[ <Signature> <Public Key> ] [ OP_DUP OP_HASH160 <public key hash> OP_EQUAL OP_CHECKSIG ]

P2SH allows to provide the public keys (or locks) in a script only when actually spending:

[ <only push data to stack> <script> ] [ OP_HASH160 <script hash> OP_EQUAL ]

e.g.:

[ <signature> {<pubkey> OP_CHECKSIG} ] [ OP_HASH160 <hash of {<pubkey> OP_CHECKSIG>}> OP_EQUAL ]

The hash prevents linking an UTXO to the public key and avoids that future more powerful computers can infer the private key from the public. Hashes are also smaller and thus easier to be communicated on paper or screen printout, either via binary-to-text encoding like base58 or a QR code.

ECDSA cryptography (secp256k1 for Bitcoin) allows to recover the public key from the private key. So only the private key needs to be saved.

The public key can also be recovered from a signature and the message/hash that was signed. This is actually how <signature> <public key> OP_CHECKSIG works. To redeem, OP_CHECKSIG needs to have access to the private key. How the hash for the signature is created is known by SigHashType. The last byte of the signature encodes sigHashType for SignatureHash(), VerifySignature(). SignatureHash in script/interpreter.cpp shows what is signed. sigHashType can decide that more of the transaction than just vout[i]->vin[j] is signed, normally sigHashType=SIGHASH_ALL, i.e. the whole transaction is signed in each vout[i]->vin[j] link.

Everybody can recreate the same hash using the same data in the same order, but only the owner of the private key can make a signature of the hash fitting to he public key it contains.

When redeeming, the signature can be published, so that everybody can verify that the token was redeemed righteously (scriptSig).

SignSignature can be used to fill vin[i].scriptSig, i.e. to redeem a transaction.

The sigHashType used in scriptSig does not depend on scripPubKey, i.e. OP_CHECKSIG will succeed if the public key fits to the signature, independent of the content that was signed.

Token

In general the hash of some data is called token. For example, in pay-to-public-key-hash (P2PKH), the public key is the essential part in scriptPubKey. It is thus an ownership token.

EIP-20 (ERC-20) is a specification of fungible tokens on the ethereum network. Coins are fungible tokens: They don't identify an asset. 200000 compatible tokens exist. They are all traded on the Ethereum network, and can thus be exchanged against each other. UNI from uniswap is such a ERC-20 token.

EIP-721 specifies non-fungible token (NFT, deed). The value of NFT's is in its links to physical assets or other non-copyable items like contracts (mortgages and the like).

It is interesting that NFT's are used for images and other things that have no link to real assets, but that consist of data only, and can be copied easily.

OpenSea is a marketplace for NFT's.

Wallet

Coins is an unspent output of transactions (UTXO, COutPoint). To use coins one needs to have

  • the private key fitting to the public key hash in scriptPubKey (for P2PKH)
  • the transaction hash (txid)
  • the index n into vout of txid

The public bitcoin site one can queried with a key hash, i.e. with an address, e.g.:

https://www.blockchain.com/btc/address/1EwpnNBdFJykwxp6X8v9AfZnup9bgmrLE1

Wallets can find transactions with importprivkey.

ScanForWalletTransactions allows to find the COutPoint{txid,n} for the private keys it contains. A wallet then stores the transaction hashes for its keys.

So what is important is only the keys. Only keys need backup.

For anonymity a new key is used for every transaction output.

With HD Wallets (HD = hierarchical deterministic), keys are generated from a seed and thus only the seed needs backup. With it the wallet can construct the keys and then query the blockchain.

Using the same HD wallet, the seed (key, phrase) can be used to regain access to all coins. The HD wallet name should be backed up, too, or the key derivation path.

Non-custodial software wallets:

Bitcoin: Bitcoin, Electrum, Pywallet, ...

Lightning: eclair, breez, muun, ...

ERC-20: bitbox, coinomi, metamask, zengo, brd, edge, trust bitpay (open source, visa functionality, segwit, schnorr)

Mining

Choose one time line (block chain) for more separate times (nodes).

  • Make adding a block hard enough by proof-of-work (POW) to last enough human-relevant time to accumulate transactions (10 min).
  • Make it easy to check the POW result.
  • A random POW algorithm (trial-error) makes two parallel similar nodes about twice as fast, because twice as many trials are done.
  • If none of the nodes is faster than the rest together it is impossible to overtake the longest chain.
  • A node adds a block to the longest chain (= chain with most work).
  • Longest chain with POW is the main consensus rule to choose the common time (ChainActive).
  • ActivateBestChain/FindMostWorkChain decides to switch ActiveChain.
  • Transactions (and its fees) count only in a matured ChainActive.

POW loop:

  • try a nonce until the block hash becomes smaller then a arith_uint256 bnTarget, constructed from nBits (difficulty).

    The arith_uint256 type is used to represent a block hash. SetCompact constructs a large arith_uint256 bnTarget number from a compact uint32_t nBits.

  • GetNextWorkRequired calculates nBits, CheckProofOfWork checks.

  • A node mines in response to generatetoaddress.

    CreateNewBlock() create a CBlockTemplate, on which one finds nNonce, then ProcessNewBlock()/ActivateBestChain()/ConnectTip()/ConnectBlock()

getblocktemplate is

  • an RPC API function
  • a protocol

getblocktemplate allows to do mining separately:

  • the miner asks the server about some fixed data (nVersion, hashPrevBlock, nTime, nBits) that needs to go into the block via getblocktempate.
  • The miner can change hashMerkleRoot, nTime, nNonce to produce a hash that meets nBits difficulty.
  • The miner calls submitblock on the server.

For a pure mining implementation in an ASIC, libblkmaker can be used to call getblocktemplate to a server. Then the miner can be simple, concentrating only on changing values to meet the difficulty (mining).

A bitcoin full node (server) can have more miners. This is called a mining pool. The full node is the server. It redistributes the reward to the miners.

Consensus

Apart from fulfilling the difficulty on longest chain, there are other relevant rules that decide, whether transactions and blocks are accepted by the network (MAX_MONEY, MedianTimePast(), ...). The coin is the result of the network consensus rules. The consensus rules decide, which transactions and blocks are accepted. The consensus rules are like a parallel program producing one time: the blockchain.

The nodes could have completely different implementations, if the behavior is the same. Two different implementations would need long testing against each other to produce the same behavior. The nodes are controlled by different parties, but they still choose the same implementation to produce the same behavior. The implementation of peers is not visible, though. If advantages are detected, individual nodes slightly change implementation and behavior here and there. The network adapts slowly by introducing new rules and checks them starting from a specific height or MedianTimePast() time. The upgrades have are named after BIPs or get special names, like taproot.

Changes in the behavior need to be taken over by all nodes simultaneously, or they are backward incompatible.

hard fork

If more nodes do not agree on the new rules, the transactions and/or blocks are mutually not accepted any more, which is a hard fork of the network and the into separate branches.

soft fork

In a soft fork changes need to have backward compatible behavior, to allow communication until almost all nodes are upgraded.

Fork above refers to chain forks. The software that creates a chain can also be forked. The software fork can possibly create a completely new chain with its own genesis block.

RPC Command

After starting, bitcoind exposes its interface as RPC. The RPC names and parameters are also command line arguments of bitoin-cli.

To list commands:

bitcoin-cli help

The simplest way to send money:

bitcoin-cli sendtoaddress [address] [amount]

Further information: