# What is Bitcoin Mining?

How "mining" works is at the very heart of Bitcoin. It is often brushed over and simply referred to as "complicated math" in the media , but it's actually quite simple to understand even if it is computationally intensive to solve.

Most of the content in this post comes from a post on Reddit that I have edited, reformatted, and elaborated on. Feel free to read the original post if you prefer.

Understanding hashes is the first step in understanding mining. A hash will take an input of any length, and generate is seemingly randomised output of a specific length.

The same input will always generate the same output, but changing just one character will drastically change the output.

For example, af2f0fb8fbb0d2ed1c1cd2a1ec0fb85daa is the hash of hello world , and 30ede9ea08ff1adb8aa6be05fdf84aeacabb5 is the hash of hello worle. This behaviour makes it very difficult to predict what input gives a particular output.

For example, what input gives aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as a hash? It's effectively impossible to work it out. People will often build lookup tables that map these inputs to outputs in order to perform quick reversals later. These tables are called rainbow tables and rely on the input already having been hashed. The second step is to get the idea of a proof of work. It might be impossible to find a hash specifically with a string consisting of nothing but the letter "a" but what if we asked for a hash with a single zero at the front?

Altering the last letter of hello world took 26 attempts to finally get hello worlC which equates to 0d7eae0fab3abc2cccc0bb4aabb24ffaf8c. Why is this useful? Because it creates a puzzle whose difficulty is measurable and which it's impossible to perform better than blind guessing. That second property is important because it's the only way to create a fair "mining" system. Miners solve such puzzles as above but which are far more difficult.

For example, find a hash that looks like this: xxxx Each hash is can be considered to be just a number. For example, the hash ab3abc2cccc0bb4aabb24ffaf8c has a numeric value of So in mining, the miners have to achieve a hash with a numeric value lower than a specified number.

This number is called the target. If your hash attempt gives you a number less than the target, which is the same thing as having a bunch of zeros at the front of the hash, then you win and you get to "mine the block". To find such a small hash takes millions of attempts, or more accurately, the whole mining network, with everyone trying at the same time, needs millions of billions of tries to get it right.

The part of the content that they are hashing and are allowed to change, a single number, in order to try and get a hash beginning with zeros, is called the nonce. The current block reward of 25 Bitcoins is given to the miner who successfully "mines the block" finds the appropriate hash. It's not really that mining "generates" the Bitcoin in any sense, it's just that it's written into Bitcoin code that a transaction block starts with a unique transaction called a "coinbase" transaction, which is the only type of transaction with no inputs.

It only has an output, consisting of the reward plus the transaction fees. To make any sense of Bitcoin's solution to this problem, you need to understand also what is meant by "distributed timestamp server" and how proof of work hashes can be used to construct this.

It is, very briefly, explained in Sections 3 and 4 of the bitcoin whitepaper. You're creating a sequence of blocks, tied to each other by including the hash of the last one in the next one.

This proves that the next block knew about the last block remember, hashes are totally unpredictable , which proves that it came afterwards. However, that's not enough; you might know that block 8 comes after block 7, but what if a different block 8, put in by a different miner, also comes after block 7?

Worse still, what if these two competing blocks, 8a and 8b contain different transactions, spending money to different places? Which one is the "true" block of transactions? The reason miners did the complicated proof of work process above is exactly to solve this problem.

In bitcoin, the chain of blocks with the largest total proof of work embedded in it is the "winner". The reason this is such a good way of deciding is that it makes it incredibly difficult for an attacker someone, say, who wants to spend the same Bitcoins twice to create an alternative single block or chain of blocks and try to convince everyone else on the network that theirs is the right one.

Since everyone else is working on the "true" chain, they have an enormous amount of CPU power working together to create it. Lastly, here is Satoshi's explanation of the Byzantine Generals' problem. Hopefully you can see how it connects. The math problem that these mining computers solve serves no purpose other than to secure Bitcoin's network from attackers wishing to "double spend". Miners are not creating a massive rainbow table or computing the human genome.

As more computers are thrown at the problem, and hardware advances, the problem is artificially made more difficult to compensate. This seems incredibly wasteful to me as we start to read about the electrical costs of the Bitcoin network and think about the fact that Bitcoin could easily run on just 3 computers to be considered distributed.

This is why I have high hopes for alternative cryptocurrencies, such as Peercoin , that implement proof-of-stake. The network could run on multi-purpose devices, such as people's phones and tablets rather than purpose-built and costly ASICs that will be redundant in a few years. Programster's Blog Tutorials focusing on Linux, programming, and open-source. Bitcoin's Mathematical Problem bitcoin mining. Last updated: 16th August First published: 16th August

## SOLVING EQUATIONS

After 10 years, Prof. Erik Panzer from the University of Oxford have solved a mathematical equation which was considered to be unsolvable. The equation is to be used to find answers to questions posed by elementary particle physics. In this interview with Christina Heimken, Wulkenhaar looks back on foes challenges encountered in looking for the formula for a solution and he explains why the work is not yet finished. You worked on the solution to the equation for 10 years. What made this equation so difficult to solve?

## Introduction

In this post we will try to break down, in simpler terms, the mechanism of blockchain and bitcoin. Readers are assumed to be familiar with a few basic cryptography and blockchain related terms. Today, I'll specifically focus on transaction validation and mining rewards. Transactions are validated by miners by solving complicated math puzzle and the first miner to solve this puzzle is rewarded with brand new coins aka virgin coins. This creation of new coins is somewhat equivalent to printing paper money by a government, or as economists put it, quantitative easing. A government can print money at will resulting in inflation and currency's devaluation. But creation of money in bitcoin economy is pre-defined in such a way that the total supply approaches to 21 million After that no coins will be created.

## Bitcoin Mining: How it Works

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Stack Overflow for Teams is a private, secure sole for you and your coworkers to find equatlons share information. I want to solve check this out set of equations, linear, or sometimes quadratic. I don't have a specific problem, but often, I have been in this situation.

It is simple to use wolframalpha. But that doesn't provide the msthematical and convenience of an iPython shell. Personally, I find it extremely convenient to use the Casio MS scientific calculator. I know how to set variables, solve equations, and do a lot. I want such a tool preferably usable from within an ipython shell.

I am surprised not to have found any. I'm not impressed enough by sage; perhaps I am missing. SAGE provides bindings for it, and that's one of the more powerful free ones. Here is how to solve your original question using Python via Sage. This basically clarifies eqations remark Paul McMillan mathematjcal. For inexact solutions, read up mxthematical linear programming and sequential quadratic optimizationthen search for Python libraries that performs such optimizations for you.

If the equations require integer solutions, what mathematical equations does bitcoin solve should search for Diophantine equation solvers for Python. Just note that using a simple solver for Project Link is missing the point.

The fun, and educational part, is learning how to solve it yourself using primitive methods! The API to Python is a equatios script apm. Once the script is loaded into a Python code, it gives the ability to solve problems of:.

There are bi-weekly webinars that showcase optimization problems in operations research and engineering. For solvf Wolfram Alpha's solution :. In python, using sympy's solver module note that it assumes all equations eqiations set equal go here zero :. Looks like there are Python bindings. So, it might be worth looking at.

I'd use Octave for this but I agree, the syntax of Octave isn't what I'd call thrilling and the docs always confuse me more than they help.

I don't think there is a unified way of dealing with both ,athematical and quadratic or generally nonlinear equations simultaneously. With linear systems, python has bindings to linear algebra and mathemattical packages. Nonlinear problems tend to be solved on what mathematical equations does bitcoin solve case by case basis. If you want to avoid using a graphical interface, but you still want to do computer algebra, then sympy or maxima may cover your needs.

If you don't really need symbolic algrebra, but you need a whhat to program with matrices, solve differential equations, and minimize functions, then scipy or octave are excelent starting points. Well, I just googled into this page by accident. I see many suggestions regarding this and that software tool, but does any tool actually provide an answer? The actual answer is:. How did I get this?

By writing a quick program in the Maxima programming language to find it via "brute force" searching. It only took about 10 minutes to write, seeing as how I'm familiar with the Maxima language. It took a few seconds for the program to run.

Here is the program:. You can just cut and paste the above code into the wxMaxima user interface, which I run under Ubuntu and not MS Windows. This particular kind of problem is so simple that you could use any general-purpose programming language to do the search.

Try applying Bisection method in mathemaitcal to find the root given an interval:. On second thoughts, I went through sage in detail and clearly it is amthematical best math free software equatilns. Podcast: We chat with Major League Hacking about all-nighters, cup stacking, and therapy dogs. Listen. Learn. Simplest way to solve mathematical shat in Python Ask Question.

Asked 10 years, 1 month ago. Active 1 year, 6 months ago. Viewed 62k times. Is there a simple library to work on linear and quadratic equations from a python shell? Lakshman Prasad Lakshman Prasad Do you know the Maxima Language and the WxMaxima interface?

Andy Coes 1, 21 21 silver badges 24 24 bronze badges. Autoplectic Autoplectic 7, 25 soove silver badges 29 29 bronze badges. You discount the best answer as unacceptable.

William Stein William Stein 2, 1 1 gold badge 14 14 silver badges 10 10 bronze badges. Have you looked at SciPy? Andre Miller Andre Miller 13k 5 5 gold badges 44 44 silver badges 51 51 bronze badges.

Once the script is loaded into a Python code, it gives the ability to solve problems of: Nonlinear equations Differential and algebraic equations Least squares model fitting Moving horizon estimation Nonlinear model predictive control. Below is an example of an optimization problem hs John Hedengren John Hedengren 41 2 what mathematical equations does bitcoin solve bronze badges.

For reference: Wolfram Alpha's solution : a! Nate Nate 3, 2 2 gold badges 23 23 mathematkcal badges 38 38 bronze badges. Aaron Digulla Aaron Digulla k 90 90 gold badges silver badges bronze badges. Victor Liu Victor Liu 3, 1 bitocin gold badge 20 20 silver badges 32 32 bronze badges. SAGE's maxima bindings can deal with pretty much anything you throw at. It depends on your needs: If you want an interactive graphical interface, then sage is probably the best solution.

Rossella Rossella 69 9 9 bronze badges. One numeric solution is probably not what the OP is looking. This answer is not relevant since the question is specific Python. The comment about infinite solutions isn't either since the problem that this question refers to Project Euler 9 has constraints and specifically limits its solution to a vitcoin tuple.

Mahmoud Khaled Mahmoud Khaled 8 8 silver badges 18 18 bronze badges. Just some of the different python math related libraries, it integrates is absolutely awesome. It's impolite to answer your own question with a duplicate of answers provided by others, and then to accept your own answer.

Instead, accept someone else's correct answer, and edit your question to include the information you what mathematical equations does bitcoin solve useful, or reply in a comment.

Paul, these points are not the primary driving force of me, nor solvd site, I think. Get over that obsession. People are here for sharing information. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. WebSockets for fun and profit. Featured on Meta. Linked 1. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.

## How Bitcoin mining actually works - What is the "cryptographic puzzle"?

## General relativity

Let us know your thoughts in the questions. Step 3: Get Bitcoin Mining Software Bitcoin mining software is how you actually hook your mining hardware into your desired mining pool. So how doees you make it so that I can't cheat and claim the block myself? Back to step 1… If someone manages to build a block before you do, you'll have to start again from the beginning with the new block's hash the one of the winner. It contains the hash of the previous block and the hashes of those 3 transactions:. Ok but WHAT data are we mining! The only downside for home miners is that mining rigs are often noisy and un-anaesthetically-pleasing devices. Investing in a mining operation brings a steady stream of bitcoins; a form of money largely beyond mathekatical control of the ruling class. Lines drawn on this gitcoin will wrap around the horizontal and vertical directions, just like in a game of Asteroids, aolve the same slope. Each hash is can be considered to be just a number.

PREV: what cryto is equal to bitcoin

NEXT: cs go bitcoin trading