
Bitcoin Developer Guide - dollaaron
https://bitcoin.org/en/developer-guide
======
wdewind
Can someone who has a better understanding of BTC than me explain something?
How do the escrow-like instruments and other contractual instruments built on
top of the block chain work? How are they better than existing contractual
instruments? How do you guarantee that something that is contractually agreed
upon for money (ie: I will transfer you a file, upon me sending the file your
funds will be released to me) actually happens? Or am I fundamentally missing
something?

Edit: thanks all for replies, learned a lot.

~~~
mike_hearn
A long time ago I wrote the following wiki page, following a variety of
conversations with Satoshi on the topic:

[https://en.bitcoin.it/wiki/Contracts](https://en.bitcoin.it/wiki/Contracts)

Quoting from the top:

 _A distributed contract is a method of using Bitcoin to form agreements with
people via the block chain. Contracts don 't make anything possible that was
previously impossible, but rather, they allow you to solve common problems in
a way that minimizes trust. Minimal trust often makes things more convenient
by allowing human judgements to be taken out of the loop, thus allowing
complete automation._

Let's take one example, 2-of-3 dispute mediation. Elsewhere in this thread,
some people are saying things like "if you don't trust your escrow agent with
your money, why do you trust them to make a decision". These are very
different kinds of trust. Typically online payment networks bundle them
together. You trust your bank and credit card company with your money (more
accurately, you don't trust them, but you know ultimately the costs of their
failures will be socialised), and then because they are always the middleman
you end up trusting them to do dispute mediation as well.

The problem is, they often aren't very good at it. Companies like PayPal tend
to see dispute mediation as a cost of business rather than their core
competency. Innovation in this space is rare. PayPal's policies, for example,
make selling something to someone else who is standing in front of you
impossible - you _must_ be able to prove you mailed the item and if you can't,
you automatically lose the dispute and the payment will be reversed. This
policy is so deeply unintuitive that there's a whole industry of scammers out
there who steal things from people by exploiting it. There isn't much scope
here for doing anything better: payment networks tend to have a small set of
one-size-fits-all policies and you can't go to the market to find a new one.

Now consider the Bitcoin approach. For many transfers there is no possibility
of dispute mediation and thus none of the overheads associated with it. This
often makes sense: either you know there will be no dispute (e.g. a gift from
a family member) or you have other ways to resolve disputes (e.g. salary
payments). When you want dispute mediation however you can agree on a mutually
satisfactory mediator.

This mediator has very limited power. Contrary to what other people here seem
to think, this _does_ matter. For example, the mediator cannot steal the
money, thus they make a poor target for hackers. If the mediator is a company
there is very little temptation for bad insiders. They are not accepting
deposits so all the complicated regulations that are triggered by that act
don't apply. There is no possibility of them lending the money in escrow out
and going fractional reserve.

Really all they can do is resolve a dispute badly, but there's no profit in
that. So by preventing the mediator from accessing the money, all kinds of
possible failure modes are avoided. In turn this means you can access a far
wider set of possible mediators. For example, if you are trying to buy an
antique violin over the internet PayPal's mediation policies are less than
ideal:

[http://www.theguardian.com/world/2012/jan/04/paypal-buyer-
de...](http://www.theguardian.com/world/2012/jan/04/paypal-buyer-destroys-
violin)

With Bitcoin you could ask an actual expert in antique violins to act as the
mediator. They do not need to be a computer security expert, they don't need
to worry about becoming a target for physical theft or extortion, they don't
need to worry they might accidentally lose the keys and destroy the money.
There's tons of things they don't need to worry about. They could (if it
existed) just use a friendly desktop app to pick a winner in case of a
dispute. That means they can spend all their time inventing precise and well
designed ways to resolve any dispute, fully leveraging their domain knowledge.

That's just one example of how redistributing and carefully controlling trust
relationships can result in better outcomes.

~~~
sanswork
>Really all they can do is resolve a dispute badly, but there's no profit in
that.

Except there is profit in that if one side has paid them to resolve the
dispute badly. Which is exactly back to where you are in the current system so
you haven't actually solved or improved on anything you've just changed it.

~~~
clarkmoody
Before entering the contract, both sides ideally will agree on a mediator of
disputes. There could be a marketplace for mediators. If a seller of an item
does not approve the mediator the scammer buyer wants, then the transaction
never takes place.

Systems that enforce lock-in of mediators will be pushed out of the market
when more open systems come online.

Also, both sides put up some collateral, which both forfeit in the case of an
unresolved dispute. A scammer will still pay some value into the multi-party
transaction, so operations will not last long if many disputes go unresolved.

~~~
sanswork
That system already exists with trusted 3rd parties and escrow systems though.
You aren't improving the existing systems at all though because you still
require just as much trust all you're doing is changing the currency used.

All the bitcoin escrow solutions are just a variation on "I want to use this
3rd party to ensure trust but I don't trust them enough to actually do so". It
doesn't work like that though so you end up with "I want to use this 3rd party
to ensure trust but I don't trust them enough to actually do so but I will end
up having to".

>Also, both sides put up some collateral, which both forfeit in the case of an
unresolved dispute. A scammer will still pay some value into the multi-party
transaction, so operations will not last long if many disputes go unresolved.

So if I am scammed I not only lose out on the scam but I am further punished
by the protocol to lose this collateral as well?

~~~
mpyne
> So if I am scammed I not only lose out on the scam but I am further punished
> by the protocol to lose this collateral as well?

Well, that's the Bitcoin philosophy in a nutshell: they solve the problem of
being screwed by third-parties by arranging the system so that when you
inevitably do get screwed, you will have to sagely acknowledge that it was
_your own_ fault the whole time.

The math is perfect after all, which means the system is perfect, so by
reductio ad absurdum if you get a crazy result (e.g. being screwed by a
mediator) it must be due to a crazy axiom on your part (e.g. your decision to
use a shitty mediator).

Now, doesn't that make you feel better? Welcome to the Jungle; you lost your
money fair and square, and you have only yourself to blame.

------
swalsh
"It then sends the 80-byte block header to its mining hardware (an ASIC) along
with a target threshold (difficulty setting)."

I've always wondered, would it be possible to make the difficulty setting
dynamically determined based on some econometric derived from the bitcoin
chain? (such as if you see the economies velocity slowing down, perhaps you
lower the threshold) or the opposite.

If it was, that may be one way to stabilize the prices, at least of the
currency itself.

~~~
natrius
No one has figured out a way to do this without outside information. Some
blockchains include price feeds from the outside world that let algorithms
keep prices relatively stable. Others use votes by currency holders to adjust
the money supply both directly and indirectly (via interest rates) like a
central bank would. Both strategies have led to cryptocurrencies that track
the price of the dollar.

~~~
phogster
Can you give examples of cryptocurrencies that track the price of the dollar?

~~~
natrius
The two I'm familiar with are BitShares and NuBits. BitShares uses contracts-
for-difference and price feeds to create stable "BitAssets", like BitUSD,
BitCNY, and BitGold. NuBits is a central bank on a blockchain, and it uses its
control of the monetary base and interest rates to peg its value to the
dollar.

Disclaimer: I own some BitShares. I won't answer more questions here to keep
things on topic, so email those to me.

------
deweller
Mastering Bitcoin is another resource that explains the bitcoin protocol in
detail.

[http://chimera.labs.oreilly.com/books/1234000001802/index.ht...](http://chimera.labs.oreilly.com/books/1234000001802/index.html)

It is available to read online for free.

~~~
Transisto
... on github.

------
smaps
Is this a new thing? I haven't seen a comprehensive list like this for bitcoin
tech specs before, and I do follow bitcoin waaaaaay too much.

Seems like this will be a very useful thing with more people starting to use
bitcoin!

~~~
dollaaron
I think it's been around for a while, but has been updated/revamped
significantly since the last time I saw it.

------
seanalltogether
I'm curious how the whole system will scale as the number of transactions
increase. Does it take longer and longer for nodes to verify transactions as
the blockchain grows?

~~~
haakon
There is one transaction block issued every 10 minutes. It can be no larger
than 1 MB in size. Miners typically prioritise transactions with higher
transaction fees. When block space becomes scarce, transactions with low or no
fee will have to wait in line longer.

The current plan seems to be to start increasing the block size limit by 50%
per year in order to allow higher transaction volume. Block size limit has
always been a contentious issue.

~~~
smaps
>There is one transaction block issued every 10 minutes.

Just to clarify for anyone new to bitcoin... blocks aren't "issued" every 10
minutes exactly. On average there is a new block found every 10 minutes (or
so).

------
jasonisalive
I was just reading this. Excellent resource, probably the first time I feel I
am starting to grasp how all the different pieces of Bitcoin fit together.

There's also: [https://bitcoin.org/en/developer-
reference](https://bitcoin.org/en/developer-reference) \- though I'm not quite
sure how the two relate.

------
whitten
Does anyone here know how the [http://ai-coin.org](http://ai-coin.org) site
ties into this info from bitcoin.org ?

------
apo
Here's another helpful resource:

[http://enetium.com/resources/Bitcoin.pdf](http://enetium.com/resources/Bitcoin.pdf)

