Assuming a decentralized exchange like this, wouldn't this basic logic guarantee profits every single day? Let's say that Bisq releases their API (which seems imminent) tomorrow. Now, we can automate talking to Bisq to trade between Bitcoin and whatevercoin.
If I do the following:

Manually put 0.01 BTC into my Bisq account.
Start my bot loop which connects every minute or something similar to the Bisq API to check the price of Bitcoin.
Note the current price of Bitcoin.
Wait a minute.
Check the price of Bitcoin versus whatevercoin.
If the difference to Bitcoin's benefit is larger than arbitrary small amount, buy predetermined arbitrary small amount of whatevercoins for Bitcoin.
If the difference to Bitcoin's benefit is smaller than arbitrary small amount, buy predetermined arbitrary small amount of Bitcoin for whatevercoins.
If the Bitcoin price goes up too much in a too short period of time, pause trading until it's become stable again.
Regularly send out some Bitcoin profits from Bisq to my normal wallet, always keeping at least 0.01 BTC in there.

This logic seems way too basic and naive to ever work. There must be something I'm missing. Would this not guarantee constant profits since, with the exception of steep bull runs (which this bot would detect and pause for), the price goes up and down all the time during the day?
Even including "expensive" offers (not exactly market price), and Bisq trading fees, that could easily be accounted for to determine if it's meaningful to buy or if it has to wait another minute, etc.
Would this not guarantee constant profits? In what scenario would this not guarantee that your coins slowly but surely increase all the time?
Is this exactly what will happen when they release the API? Should I be not wasting one second right now but instead get to work to actually code together this script to be one of the first to take advantage of it when it's released? Or have I missed some basic point which would quickly drain my 0.01 BTC?

What goes wrong is that you make a profit on every trade, but you are holding lots of bitcoin when it goes down and lots of whatevercoin when it goes down. Adverse selection causes you to take huge losses when you aren't trading! When bitcoin is going down, everybody wants you to take theirs. When bitcoin is going up, everybody wants yours.


order of group of points of secp256k1 points on curve secp256k1 form a group E(Fp) over field Fp.

p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1  is prime.

n is the order of group E,
n=115792089237316195423570985008687907852837564279074904382605163141518161494337

Is n prime too?

Is E(Fp) a cyclic group?

Theorem.
Working over a finite field, the group of points E(Fp) is always either a cyclic group or the product of two cyclic groups.

The comment stating n “has to be prime” is a bit confusing.

The order of base point “has” to be prime in the sense that this is a requirement in the particular documents defining standard curves—for example, in SECG, which includes secp256k1. Bitcoin's base point order r is prime.

In SECG, it is also stated that cofactor of secp256k1 curve is 1, which makes n = r × 1, again prime. A group of prime order is obviously cyclic.


Does the chain become computationally more expensive to validate over time? Since there is only one chain per coin, doesn't that mean it becomes computationally more expensive to validate the chain the older the coin is and the longer the chain becomes?

Validation of proof of work is extremely cheap, and scales linearly with the length of the chain. That is to say, validating the proof of work for 2N blocks will take only twice as long as validating the proof of work for N blocks.

The part that does not scale linearly over the life of the chain is the transactions themselves - signature validation is expensive, and as networks get more busy, validating the transaction signatures and the utxo set takes up the bulk of the block validation time. These are limited by the SIGOPS limit of a block, which limits how many signature verification operations a block may have
(although it is not an exact 1:1 correlation, but more of an upper limit/yardstick to manage script complexity), and the block size, which puts an upper limit on how many transactions can be in a block.

Note that transaction validation as an isolated operation is still mostly linear - signature validation has a fixed, but high cost. Validating 2N signatures will take roughly twice as long as validating N signatures. It's just that blockchains naturally tend to grow at an exponential rate, so the number of transactions in block 2N may be exponentially more than those in block N, thus leading to a non-linear validation time.

A blockchain such as Bitcoin that runs at near-full capacity most of the time will still have a linear validation cost for recent blocks.


Is there any specific transaction fee? Is there any specific percentage of transaction fee that is suppose to be paid by all the participants as per value of their BTC transaction?

no, trx fees are not calculated based on the value of a transfer.
TX fees incentivise miners, to include your trx in the block. Generally one can say, the higher you create your TX fee, the more probable it will be included in the next block. Or vice versa, the lower your TX fee, the longer it will have to wait, until it get's processed by a miner.


how do i brute force my wallet.dat to get my private key i am not really a computer programmer, but i want to get my private key from my wallet.dat, i have just the wallet.dat file and the public address where the bitcion was send. From my previous researches, i was told brute force the wallet is good to use, like i said i got just the wallet.dat file, but while trying to see on how i could proceed with the brute force process, it requires a hastcat and a master key whereas i have just the .dat file.
my question are

how do i get the hashcat? is there a site i will go and putin some particular word to be able to get the hashcat? if yes which word?

how do i get the master key as well since i have just the wallet.dat and the address in which the bitcoin was send to

If you are using Bitcoin Core:
1 - Go to window > console
2 - Type listunspent
3 - You will get a list of addresses with the spendable amount
4 - Copy one of those addresses
5 - Type dumpprivkey pasteYourAddressHere


Can't link my Paper Wallet to Blockchain So I've created a Paper wallet using bit address.org, and have joined Blockchain.com, but can't find out how to link the two?

Also the strategy I'm using at the moment-till maybe "you" say otherwise, is-I've bought Bitcoin using Coinbase, and am trying to send money to my bitaddress.org Paper Wallet-but Coinbase isn't showing me how to do this? So I can then register the transaction-and others on the Blockchain on blockchain.com Do you think I'm using the right strategy?

Thoughts

When you are in your Coinbase account use their "Send" feature to send coins to your paper wallet. It will then prompt you for a wallet address to send the coins to. Enter your paper wallet address there. Choose the amount to send, etc.

More here: https://support.coinbase.com/customer/en/portal/articles/971437-how-do-i-send-digital-currency-to-another-wallet-

If you are keeping the coins for yourself, there are better alternatives than paper wallet. If you are giving as a gift, just make sure recipient knows what to do or no do with the wallet.


How to make Abe query MySQL instead of reading from the bitcoin block.dat for each request? After getting abe set up and running, I tried querying it, eg: ...:2750/chain/Bitcoin .. but looking at the abe output, I notice every page load - abe was opening the blk00000.dat  file rather than using MySQL [which I have configured abe to use].

My abe.conf looks like this;

dbtype MySQLdb
connect-args {"user":"test","db":"abe","passwd":"test"}
upgrade
port 2750
host localhost

I have checked the 'abe' MySQL database and the data is in there, I am just unable to figure out why abe isn't querying that and instead opening the blk00000.dat file. . . which is making every request I make to abe unbearably slow.

So my question is:
How to make Abe query MySQL instead of reading from the bitcoin block.dat for each request ?

I'm still loading the blockchain into my database, but are you starting Abe with the --config option pointing to your configuration file?

See line 49 in https://github.com/bitcoin-abe/bitcoin-abe/blob/master/README-MYSQL.txt


Bitcoin has vanished for 3 weeks? I sent bitcoin with a 0.00000494BTC fee to an online market vendor. The transaction took 4 days to confirm by which time the market had cancelled the order. This was over 3 weeks ago now but no bitcoin has come back into my electrum wallet. Do I have to do anything to get it back? Or will it eventually show up? Or is it gone for good? Any help would be really appreciated.

If you're saying the transaction is confirmed now, then those coins are now in the possession of the market.  You can't reverse the transaction - that is what "confirmed" means.  So in order to get your coins back, you will have to ask the market for a refund.  Nobody else has the power to make it happen.

The fact that the market cancelled the order is purely internal to them.  It didn't prevent the money from being transferred - in fact there is no way they could do that.

It is possible that they will refuse, or that they deleted the private keys corresponding to the destination address before the transaction was confirmed.  In that case, too bad.  You could try to get your money back through legal process (a lawsuit or similar), but you can't do it unilaterally through purely technical means.


Is the appreciation in bitcoins taxable? If you have large gains in bitcoin, is there any way that it can be taxed?  If I have $5000, and it appreciates to $10,000 worth of bitcoin, when I sell bitcoin for dollars can it be taxed as a capital gain?  I would think that since there is no documentation to support it that it would be difficult.

My guess is that as long as you have a receipt for the buy, and one for the sell then there is no reason why the government would say no to taking their share if it. I guess it's just classed as currency trading??


Are Bitcoin signatures currency specific? I am wondering whether signatures for Bitcoin-like currencies are currency specific, or given one program that can sign a Bitcoin raw/JSON transaction one can create valid signatures for other coins as well?

That is to say, if a program takes:

A private key
A pre-contructed raw / JSON transaction

Is the signing process requiring something specific to a given currency, like referencing an address in a different form or using some currency-specific bytes?

All coins use ECDSA to sign transactions in a similar manner, the main difference between most coins is what would constitute a valid signature, typically the first character(s) of a public address (e.g. bitcoin starts with 1 or 3 and litecoin starts with L). Therefore a certain public key could not be used directly to sign a transaction of another coin, with exception to coins such as devcoin, which uses the same address type.

You could write a program which starting from a certain private key, auto-increments until a valid address is found.


Using secp256k1 in personal project I am trying to use secp256k1 for a toy project that I am working on for learning purposes. I am using Ubuntu 20.04 and I can clone and compile the library just fine. I have tried to include it in a simple hello world c file and I get the following error: secp256k1/src/num.h:19:2: error: #error "Please select num implementation" 19 | #error "Please select num implementation"
I have tried googling this but I can't seem to find anything (only https://github.com/breadwallet/breadwallet-ios/issues/60 but not sure how it applies to my situation). All I did was use this line #include "src/secp256k1.c" in my toy C code. I can't seem to find any documentation or walkthrough guide on simple usage of the library such as generating private keys and addresses (besides secp256k1.h). Any help would be appreciated!

See here for an example of a #define configuration. You may then search for those macros in the repo to see their alternatives and define the relevant ones before you #include "src/secp256k1.c"

I can't seem to find any documentation or walkthrough guide on simple usage of the library

This library is not meant for use as a single header, as explained in the README.md:

Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.")

The conventional way of using this library is compiling it and calling the linker when you compile your code with libsecp256k1.a for static linking (You may do gcc your-code.c libsecp256k1.a)
However, I used the library once with an #include only a long time ago, without any problems. That works, and as I described at the top, you just need a few #defines.
secp256k1.h is self-explanatory. You might want to read it all similarly to reading a story. Then you should be able to find the relevant functions.


How to sign a message using Bitcoin private key? How does one create a proper signature for a given message using Bitcoin private keys?

I have an input address of

5JeWZ1z6sRcLTJXdQEDdB986E6XfLAkj9CgNE4EHzr5GmjrVFpf

or

6d7f6815bd7927423a728db28c5f4ea4032a81ab8dbca06ec41476508de48a6d

I want to sign message:

test

I convert it to hex:

74657374

I feed it to a signing function of ECDSA library that uses secp256k1, and I get two outputs,

r = D16A44BF1095FB7D517C7C4DD6A51E3EFD29548C5CAD8CA4AB763946D02AE0E8
s = 2AB3E674B788804B87CED50619A1EFA267E17D20C016D0779BC3203D40E8105D

If I marshal it with DER/asn1 as a list of Big Integers, I get a result of:

MEUCIQDRakS/EJX7fVF8fE3WpR4+/SlUjFytjKSrdjlG0Crg6AIgKrPmdLeIgEuHztUGGaHvomfhfSDAFtB3m8MgPUDoEF0=

If I marshal them as a list of byte arrays, I get

MEQEINFqRL8Qlft9UXx8TdalHj79KVSMXK2MpKt2OUbQKuDoBCAqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==

if I marshal them as one long byte array, I get 0WpEvxCV+31RfHxN1qUePv0pVIxcrYykq3Y5RtAq4Ogqs+Z0t4iAS4fO1QYZoe+iZ+F9IMAW0HebwyA9QOgQXQ==

None of them appear to work as signatures when I try to verify the message signature using tools like http://brainwallet.org/#verify .

How do I properly sign messages using Bitcoin private keys to be compatible with BitcoinQT?

Using bitcoind and bitcoin-cli you can do it as follows:

bitcoin-cli signmessage 1DiWX6p3FdHPZqN88vMeGVXSwAQ1h7BeVj 'Hello world!'


How to get a complete list of transactions? listtransactions - 9 provides the latest transactions and actually all =)

How to get all transactions?

listtransactions "" 9999999999

The number at the end is the number of transactions to list. Instead of just 9, if you set a number there larger than the number of transaction (I'm assuming you have less than 9999999999 transactions), you'll get all transactions. Here's the API documentation, for reference:

listtransactions [label] [count] [skip]

if a label name is provided, this will return only incoming transactions paying to addresses with the specified label.

count is the number of transactions to return (default 10)

skip is the number of transactions to skip (default 0)

For example to list transactions 100 to 120

bitcoin-cli listtransactions "*" 20 100


Online wallet to redeem pre-fork paper wallet for both Bitcoin and Bitcoin Cash I have BTC (pre-fork) and now BCH(BCC) on a paper wallet. What's the best online wallet to transfer them into to ensure I retain both coins and also to be able to transact with them?

This is copied from  the Electrum website today:

Recommendation on how to redeem Bitcoin Cash

July 31st, 2017.

Electrum is a Bitcoin wallet created by Thomas Voegtlin in 2011.
Electrum is distributed by Electrum Technologies GmbH, a company
registered in Germany, using the website https://electrum.org

Electrum users who are not interested in Bitcoin Cash do not need to
worry nor to take any particular action. The following note is only
for users who want to access their Bitcoin Cash (BCC).

"Electron Cash" is a fork of Electrum for Bitcoin Cash. Electron Cash
is not endorsed by Electrum. It is open source, and binaries
(executables files) are available for Windows, OSX and
Android. However, when you run binaries instead of source code, you
have no guarantee that they match the source code. This is why wallet
binaries are usually signed by developers. A digital signature engages
the responsability of the person who signs.

The person who distributes the Electron Cash binaries has decided to
remain anonymous, and uses the fake name "Jonald Fyookball" in order
to sign Electron Cash binaries. Thus, if these binaries contain code
that is designed to steal your bitcoins, the author of the theft will
be anonymous and walk away safely with your funds.

This danger is exacerbated by the fact that the default behaviour of
Electron Cash is to silently copy all your Electrum wallets into its
own directory. Thus, if you run Electron Cash on a machine where you
previously used Electrum, all your pre-existing wallets will be
available in Electron Cash, and you will only need to enter your
password in order to expose your bitcoins to potential theft.

Therefore, users who want to run the Electron Cash binaries should do
it on a separate machine, that does not have their Bitcoin wallet. We
recommend to proceed as follows:

Install Electron Cash on a machine that does not have your
Electrum wallets.
Wait until the BCC hard fork has taken place, and a few BCC blocks
have been mined.
Move all your Electrum funds to a new Electrum wallet. This will
move only your BTC, and not your BCC, because the BCC blockchain has
replay protection. Wait until the transaction is confirmed.
Enter the seed of your (now empty) old wallet or private keys in
Electron Cash. Since the BTC have been moved to a new wallet,
entering your old seed in Electron Cash will not put your BTC funds
at risk.

Following these 4 easy steps you will be able to access your BCC
without compromising your BTC.


Forks/ alternative coins and paper wallets So I have some bitcoin on paper wallets purchased at ATMs  well prior to the bitcoin cash split. I have only kept cold-storage paper thus far, but recently purchased a Ledger Nano S. My question is, with the forks of BC cash and the coming BC gold, am I missing out on these "matching funds" from the forks by not having these coins sitting in an exchange or online wallet?

No, you can, at any time you want, import those private keys into a Bitcoin Cash or Bitcoin Gold client and move those coins. You control the private keys, so you control those coins so long as the networks that they are on are still functional.


I had $1000 on an encrypted wallet and need to restore it on bitcoin qt I reinstalled windows7, but luckily it saved my old windows in windows.old plus i backed up encrypted wallet to external device.  How exactly do I restore it?

Be very careful. First, shutdown Bitcoin-Qt completely. Rename its current wallet.dat file to something else (you can delete it, but just rename it to be safe). Then put your backup in its place. Start Bitcoin-Qt and you're done.


How to get Coinbase Text for newly found block Websites like blockchain.info and btc.com give Relayed By information to find who found the block. I can see coinbase text in the website https://coin.dance/blocks. Is it possible to get that information using bitcoin-cli ?

Certainly. Use bitcoin-cli getblock <hash> 2 to get the full details of a block (you may want to pipe the output to less as there will be a lot of output). The first transaction in the block (the first transaction in the array tx) is the coinbase transaction. In there, there is a field labeled coinbase. That contains the hex of the bytes of whatever data miners are putting there in the transaction. Drop the hex into whatever Hex to Ascii converter you want and you will get text. Note that some miners may not include readable text in their coinbases.


When an attacker publishes a longer chain, does Bitcoin Core emit a warning? I tried answering a question about a majority-attacker's power to change the blockchain yesterday.

There is one thing I haven't been able to get a clear picture on, yet:
When a previously unknown chain fork of at least 7 blocks length is published, how does Bitcoin Core react?

main.h: CheckForkWarningConditions appears to emit a warning stating "Chain state database corruption likely".

Would Bitcoin Core accept the chain fork if it had the most work? How prominent is the warning to the user? Does Bitcoin Core need manual intervention to decide which fork to accept?

When a previously unknown chain fork of at least 7 blocks length is published, how does Bitcoin Core react?

It reorganizes to that chain, any transactions that were lost are returned to the nodes mempool.

  Would Bitcoin Core accept the chain fork if it had the most work?

Any valid chain with the most work will be reorganised to.

  How prominent is the warning to the user?

That warning isn't shown to a user in a reorganisation. Users are shown a warning when there is a significantly higher chain than them with valid proof of work but invalid contents, or alternatively when a soft fork takes the block version number higher than their client is aware of. When a warning is shown to a uiser through the alert system, it is either in the alerts field of the RPC output or in a small yellow bar in the GUI client.

  Does Bitcoin Core need manual intervention to decide which fork to accept?

The code has the rules, if users made their own decisions about what constituted "valid" the network would fragment. There is no concept of an "evil" chain or an "attacking" chain, only the best chain.


Can one wallet send/receive bitcoins from/to multiple sources simultaneously? Let's say for example I put my public bitcoin address on a website for donations and multiple people for around the world deposit bitcoins simultaneously to that same wallet:

Will all deposit transactions be valid on the bitcoin network or might some transactions "overwrite" the other?
While receiving bitcoins from someone (not yet a verified transaction on the network), can I withdraw or pay bitcoins using the same wallet given the amount only include previous bitcoins and does include the new deposit?

You seem to be missing Unspent Transaction Outputs (UTXO) as a piece of the puzzle here:
Every transaction on the network results in one or more UTXO. You can think of them as a bill with the value of the received transaction. Every time you make a transaction,  the UTXO you put in get destroyed and new ones spendable by the recipient get created. Since each UTXO is unique, they cannot clash with each other (you getting a bill from one person doesn't stop you from getting another from someone else), and you can only spend them once you have received them.


produce a public key from private key with ecc, with clear description about k=k*g According to this answer: https://bitcoin.stackexchange.com/a/63996/100526
When he wants to generate a public key from the private key, he has used K=k*G. but I can't understand it's result.
If we assume our private key is (according to the answer) :

0F479245FB19A38A1954C5C7C0EBAB2F9BDFD96A17563EF28A6A4B1A2A764EF4

and according to Secp256k1 G point is:

- Compressed form (prefix 02)
02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798

 - Uncompressed form (prefix 04)
04 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8

So to calculate the public key I used this site: https://www.boxentriq.com/code-breaking/big-number-calculator

I used compressed form and private key:
0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798  *  0F479245FB19A38A1954C5C7C0EBAB2F9BDFD96A17563EF28A6A4B1A2A764EF4

and result is :

25d355ebb23e6ce0fd5463bf40e6da2ccc4e2e8ce654db6a8a8e5a275f0d2266005569112cfda60d14f9b6d0c0218cc072047a3b2fcf97aee95a437b4bb6cce0

but in that answer the result is :

02E8445082A72F29B75CA48748A914DF60622A609CACFCE8ED0E35804560741D29

what's wrong?

When talking about math using a curve, when we use terms like addition and multiplication, we don't mean normal additional and multiplication. We are referring to operations on the curve that have properties similar to addition and multiplication. To get the correct results, you have to use the actual operations on the curve, not normal addition and multiplication.


Bitcoin Core RPC "importaddress" for a P2SH watch-only I am trying to import a p2sh address as watch-only:

bitcoin-cli importaddress <P2SH ADDRESS> true true

for which the command seems to execute, pause, then after a few minutes give me the error message:

  error: couldn't connect to server: unknown (code -1)
      (make sure server is running and you are connecting to the correct RPC port)

Why is this not working for me?

I believe the issue is that you forgot the label parameter. According to the RPC help documentation, the parameters for importaddress should be:

 importaddress "address" "label" rescan p2sh

You have used "address", rescan and p2sh but not label, so the error is likely due to an issue converting the parameters you provided into the ones it expected.

But the fact that the error message is so hard to understand / unrelated to the actual error is a bug, please open an issue on github here: https://github.com/bitcoin/bitcoin/issues


How much will be the fee after all bitcoins are mined? Because mining is every time harder, and hence more expensive, right now is profitable because the btc is rising, but what will happen when btc price is stable and miners won't get any extra reward, only the fee.
If the fee is high then we will end in a worst scenario than current transactions with banks :(
Is there any approximation about this fee? (In btc because we won't know the price in usd)

EDIT
similar question (but too old, without answer):
How much will transaction fees eventually be?
Maybe this could be a good approximation
How many BTC are transferred per day (daily volume)?: 750.000 BTC (source: https://coinmarketcap.com/currencies/bitcoin)
How many BTC are mined (generated as reward) every day?:
1800 BTC (source: https://www.bitcoinblockhalf.com/)
How much is paid in fee every day?: 34 BTC (source: https://blockchain.info/stats)

So right now the fee is 34 / 750.000 = 0.0045%
But if we mined everything, then we need to pay the 1800BTC to miners in fees to compensate so will be (1800+34) / 750.000 = 0.25%
If this is the case I think is cheaper than current bank transactions fees...

But I'm not sure if this is a valid approximation, fee seems to change a lot (not sure why or even how to read this graph either): https://bitcoinfees.info/

As fees for transactions are a free market and supply is limited (due to the block weight/size limit), the price will be whatever people are willing to pay. Those who pay less than the market rate will see their transactions slowed down or ignored; those who pay more will see them processed quickly.

What is not known is whether the resulting fees paid will be sufficient to keep the network secure. As security against chain rewriting is proportional to the cost spent by miners, we can expect that it is also proportional to how much miners are paid. If people are not willing to pay high fees at all, the security may collapse in a tragedy of the commons. If people do, and the value secured by the network is high, fees may grow very high as well.

What Bitcoin (the blockchain) technology offers you is an independent currency, beyond control of banks or nations, which permits you to autonomously audit the entire system. While you don't have to, it permits you to be your own bank and be entirely independent from third parties.

What it does not offer directly is a convenient payment system. Bitcoin transactions are slow, inconvenient, inefficient, and unreliable - and perhaps expensive too. They are pretty much the opposite of what a consumer would want as a payment system.

However, due to being a natively digital currency, without third parties that can deny you access to the system, the hope is that it can be used as a base layer in a financial system upon which actual payment technology can be built (sometimes called "layer two"). A very promising proposal that is being actively worked on is Lightning. Lightning offers cheap, reliable, fast payments, on top of the Bitcoin chain. However, not every Lightning payment corresponds to a transaction on-chain. Yet, its security is very similar to the blockchain itself and still does not rely on third parties.


Created an HTML5 Game, best way to integrate Bitcoin? Okay so I just finished up a ping pong HTML5 game I've been working on as practice, and I was thinking of integrating Bitcoin into the game so when a user wins vs. the CPU, they get a small amount of bitcoin sent to their account, or to an account created for them.

Can anyone point me to a resource to get this done?

I think I can do this with BitcoinJS but it is not available for Windows.

Not sure what I'm doing, so any help would be great!

You're going to need a fairly intense system to support something like that. You won't be able to send Bitcoins securely in your game, so you will need a server handling requests to send. Check out the Bitcoind api commands and the various libraries you can use to access Bitcoind. Node.js has an interesting and simple library.

The main trouble you are going to have is people who are trying to game your system. You will need to verify (somehow) that a player did actually beat your game. What is stopping me from sending thousands of requests, stating that I won? People will figure out the server you send the requests to quickly.


Differences between MemoryBlockStore and SPVBlockStore What are differences between MemoryBlockStore and SPVBlockStore in bitcoinj?

Which should be used for downloading the blockchain and why?

Can I use same SPVChain format file for all wallets?

MemoryBlockStore keeps StoredBlocks in memory and it is used primarily for unit testing.

Whereas SPVBlockStore holds a limited number of block headers in a memory mapped ring buffer. With such a store, you may not be able to process very deep re-orgs and could be disconnected from the chain (requiring a replay), but as they are virtually unheard of this is not a significant risk.
You can find the reference document from the following link:

MemoryBlockStore
https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/MemoryBlockStore.html

SPVBlockStore
https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/store/SPVBlockStore.html


Armory Ubuntu/Debian 0.96.0 signed with a different key than listed on the website I downloaded the Armory version for Ubuntu/Debian from here:
https://www.bitcoinarmory.com/download/

Under the "Offline Signing Key" section it lists the public key for verification to be: 98832223.   This key is also used throughout their verification instructions.  They also show the fingerprint for this key on that page.

However, the files I downloaded are signed with key 4922589A.  I looked that key up on pgp.mit.edu and it shows the key owned by "goatpig (Offline signing key for Armory releases)"  Now, I see that goatpig is the name of one of the contributors on github, but really anyone can make a key with that name and since the website doesn't reference the key, or give me a fingerprint for the key, that I can find, I am hesitant to trust it.

My question here really is, can anyone confirm what the proper public key is to verify the armory downloads.  Did I miss something?

--update

I see there are two armory websites  www.bitcoinarmory.com and btcarmory.com.  each has a 0.96.0 download and the hash of both installs are the same, so I assume they are the same file, they are also both signed with the same public key.  The difference is that bitcoinarmory.com says to verify with 98832223 and btcarmory says to verify with 4922589A.  Very confusing, but my best guess is that  4922589A is actually the proper key to verify the signature with.  Either way, I think I'm just going to stick with bitcoin-qt unless someone can help clear this up.

https://bitcoinarmory.com is no longer Armory's official website. The official website is actually https://btcarmory.com. bitcoinarmory.com still hosts the new binaries, but they are only a mirror and everything else on the site is outdated.

Since Armory's development changed a few years ago, the actual release signing key is 4922589A as that is the new maintainer's signing key. This key is used on Armory 0.94.0 and above. The old signing key, 98832223, is the old maintainer's signing key.


Is ViaBTC the only public Bitcoin Cash pool? Is ViaBTC the only public Bitcoin Cash pool?
I have spent hours in searching but could not find another one.

As the price of Bitcoin Cash surges, a lot of people want to mine it.

Thank you in advance for your answers!

No, http://pool.Bitcoin.com also offers BCH mining as far as i'm concerned, see

https://news.bitcoin.com/bitcoin-com-pool-members-now-have-the-option-to-mine-bitcoin-cash/

Which is https://stratum.bcc.pool.bitcoin.com:3333/


Risk of using pre-release test build Installing bitcoind from github, I forgot to pass "git checkout v0.8.6" (current version at time of writing), and of course, go the following error in getinfo.

"This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"

This got me thinking, what kinds of unexpected problems which could happen?

It might contain security vulnerabilities (which could potentially expose your private key), but that's extremely unlikely. Something more plausible (but still unlikely) is corrupting your wallet.dat, so be sure to back it up before upgrading.

As a normal user, the test build ought to be safe for most purposes. The main risk, I guess, is for people operating exchanges, mining pools, etc., where you can't afford to go down in the middle of operation. The test build is more likely to crash (or fail to work in some way) rather than be insecure.


Help - Running R9 290x graphics card headless in Linux Running Ubuntu 13.10. When I hook up the card to a monitor through HDMI, cgminer detects the card. When I unplug the HDMI cable from the monitor, the system throws a blank screen. I can ssh in from another computer, but when I run cgminer, cgminer tells me that the card isn't detected:

"clDevicesNum returned error, no GPUs usable"
"0 GPU devices max detected"

From various online forums, people have stated that dummy plugs won't work on the R9 290x because this card has only digital inputs (AMD got rid of analog), so the resistor trick won't work here even with DVI-VGA passive adapters.

Furthermore, people have said that with newer cards like mine, dummy plugs aren't necessary.

The only difference I see is that I'm using ubuntu while the people in the forums were using Windows 7 or 8. However, I'm using Catalyst 13.12, so I should be good?

What am I doing wrong? Can someone help me?

I had the same issue with my R290 cards and was able to have them work after initialiazing xinit:

Create an xinit file:

sudo vi /etc/init.d/xinit

Put inside:

#!/bin/bash
# standard functions library
. /lib/lsb/init-functions
# Start the xinit
start() {
        # Start xinit on background and redirect stdout and stderr to log file
        echo "Starting xinit"
        xinit &> /var/log/xinit.log &
}
# Restart the xinit
stop() {
        echo "Stopping xinit"
        killall xinit
}
### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status xinit
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
exit 0
# end of file

ESC :wq  ==> to save and quit vi editor

Then make this script executable and set it up for automatic startup.

sudo chmod +x /etc/init.d/xinit
sudo update-rc.d xinit defaults 90

export DISPLAY=:0
echo export DISPLAY=:0 >> ~/.bashrc

sudo reboot

It worked for me!

BTC: 1KsRn32jBwA21fLyVMdVWdGLxAa3vo82Zy

LTC: LQC2cfKFNri8AHeME6QQqVeB4BD6tQEdDE

P.S. xinit setup taken from http://infi.wikidot.com/blog:1


Does an eBay listing that accepts Bitcoin violate their payments policy? eBay's payments policy says that the listing must accept at least one payment method that is PayPal, credit card, etc.   It does not appear to say that other payment methods cannot be offered though.

http://pages.ebay.com/help/policies/accepted-payments-policy.html

Would a listing that has in the description something like the following be a violation of that policy?

  Also will accept Bitcoin for payment.

Under "Payment methods not allowed on eBay" we can see:

Send cash or money orders through instant, point-to-point cash transfer services (that are not banks) such as Western Union or MoneyGram

Pay using online or other payment methods not specifically permitted in this policy

So we have two points against using Bitcoins, technically making it a violation of that policy. This question, however, would be better asked directly to eBay.


Can Bitcoin be recovered from a child key alone? I have a question regarding BIP-32 and keys.
Imagine a scenario in which a user creates a new Bitcoin wallet with a seed phrase. He then generates a new address and sends 1 BTC to this address.
Under the covers, my understanding is that a master private/public key will be created from the seed phrase. Then, a child key is created under the parent key for the address.
Now, suppose this user completely loses their seed phrase / master keys, BUT they somehow have a copy of the child key pair that contains their Bitcoin.
Is it possible to recover their Bitcoin from that child key alone? If so, what is the process? Are individual child keys just the same as normal (non BIP-32) key/pairs?
Thanks!

Under the covers, my understanding is that a master private/public key will be created from the seed phrase. Then, a child key is created under the parent key for the address.

That's correct.

Now, suppose this user completely loses their seed phrase / master keys, BUT they somehow have a copy of the child key pair that contains their Bitcoin.
Is it possible to recover their Bitcoin from that child key alone? If so, what is the process? Are individual child keys just the same as normal (non BIP-32) key/pairs?

Key derivation is not part of the protocol. It is simply an approach wallets use to avoid the need to store backups of every separate key generated. Old wallet software (2009-2013 era) didn't use BIP32 at all.
BIP32 is just used to turn parent keys into child keys, and then those child keys are used for signing. As far as the protocol is concern, the parents don't exist.
So the process is exactly the same with or without: you sign directly with the child key. If you have that child you, you can sign, regardless of where it came from.


Wondering about the viability of a Hardware Wallet I want to roll my own hardware wallet using a USB stick. I have some concerns:

Do I need to download the entire blockchain in order to create a new wallet?
Do I need to download and store the entire blockchain on the USB in order to send and receive funds?
Do I need to plug in the USB wallet in order to send funds?
Do I need to plug in the USB wallet in order to receive funds?

.

I'm hoping that the answer to the first question is "no", as I really am not keen on downloading and maintaining a local copy of the entire blockchain. It's such a waste of space.
I'm hoping that the answer to the second question is "no". Because again, I really don't want to spend time and bandwidth downloading the entire blockchain, and also I don't want to have to store it. Those are gigabytes that could be spent on something else.
I'm hoping that the answer to question three is "no" for security reasons.  I don't want random cυnts on the other side of the world transfering my money without my consent.
I'm hoping that the answer to question four is "yes" for convenience reasons. I don't want to have to plug in the wallet every time someone sends me money.

My understanding is that there is the public key for receiving, and the private key for sending. Am I correct in thinking that the only thing you fundamentally have to keep secure is the private key? If that's the case, surely I don't have to download the entire blockchain?

I want to roll my own hardware wallet using a USB stick.

An ordinary USB stick cannot be made into a hardware wallet.

Hardware wallet incorporates cryptographic hardware designed for cryptocurrencies and has firmware to interact with software on another device (PC, phone, etc)

No and Yes.

Normal wallet software has some utility while it is synchronising, but until it has synchronised it can't show the amount you control and therefore may not be able to create transactions using those amounts.

An  SPV wallet doesn't need to download the blockchain but is less secure.
A full-node wallet cannot create transactions involving unspent transaction amounts it does not know about.
A wallet must be online to send transactions.
A wallet need not be online for money to be transferred to your control but the wallet won't know about it until it is made online or is able to communicate with other software that is online.


Where is the "New Genesis Hash Generator" code in newest Bitcoin source code? I am trying to generate my own genesis hash by modifying some hardcoded parameter in main.cpp.

It worked in previous version of Bitcoin, but now it seems that the "Genesis Generator" has been removed.

Where is the "New Genesis Hash Generator" code in newest Bitcoin source code?

Problem Solved!

The new genesis generator locates at "chainparams.cpp"


How do I withdraw my bitcoins and spend them? I run a small business online.  I am interested in using Bitcoin to accept monies from my customers but to be honest the whole thing has me a bit confused.  I am in the UK how would I be able to exchange my Bitcoins for £ sterling and then subsequently spend it?

Trade them for USD, GBP or EUR on a trading site such as https://mtgox.com and transfer it to your bank account.

Or you can spend them directly at any other business that accepts bitcoins as payment.


Off-chain transactions with Coinbase Recently I created an account/wallet on coinbase.com. Then I transferred my BTCs I already had from blockchain.info to the wallet on Coinbase.

A bit later I bought some new bitcoins directly from Coinbase with my credit card and I expected that I'm able to see something like a transaction ID and a block reference once the new BTCs arrived in my wallet.

Interestingly I got the BTCs but there's no transaction of block reference as expected.

On support.coinbase.com they say:

  You can view most digital currency transactions on the network's respective blockchain, which records and verifies the legitimacy of transactions. However, when transferring from a Coinbase account to another Coinbase account, the transactions occur off the blockchain. […] For these "off-chain" transactions, you won't be able to view the bitcoin transfer in the blockchain, and there won't be an "Advanced Details" link when you click on the transaction.

As far as I understand the bitcoin blockchain the idea behind the whole thing is that everybody knows how many bitcoins I own (yes I know, my identity are hash addresses).

But if there's something like off-chain transactions this means that I don't own the BTCs I bought with my credit card, from a technical point of view because no one (the distributed ledger) know's about this transaction.

Is this correct?

From the perspective of the Bitcoin network, Coinbase owns both the Bitcoins you transferred in, and the Bitcoins they sold to you.

This is useful from a technical perspective, because Coinbase can have as many transactions within their system as they want, and no-one outside of Coinbase needs to keep track of them.

This is problematic because Bitcoin can't give you any guarantee that Coinbase won't take your Bitcoins, and Bitcoin can't give you any guarantee that Coinbase has enough assets to pay all of their account holders.

Coinbase could publish an audit showing how much Bitcoin all of their account holders are supposed to have, and signed statements showing control of enough Bitcoins to cover those obligations, though.


Pros and cons of using Mt. Gox as an e-wallet Mt. Gox obviously allows you to send bitcoins to it, and to receive them to an address of your choice; hence I'm wondering if there is any reason not to use it as an e-wallet.

Unless I'm mistaken, it's much bigger (by far) than any other bitcoin exchange, bank or proper e-wallet, so we can reasonably expect it being more secure, supported and safe.

Why should I use a specialised e-wallet instead?

Because Mt.Gox has to abide by anti money laundering laws they require at least some form of identification. Although this is a requirement for Fiat to Bitcoin conversion there is no need to link your normal bitcoin transactions to your Bank Account / Identity. Wallet services that deal solely with bitcoin do not need to comply with AML laws and hence require no identification or bank details.
Mt.gox doesn't support many features that My Wallet does: Export private keys - Generate New Address - Unconfirmed transactions - Alerts - Multi Recipient Transactions - Paper Wallets - Labelling Addresses.
Even though Mt.gox is the largest and most trusted exchange you are still using them as a bank and are not in control of your own private keys. One of the key advantages of bitcoin is it allows you to be in control of your money without needing a third party. With the new javascript based wallet services your keys are encrypted and decrypted inside your own browser so you never share your keys with the server. Some trust is still required unless you use a paper wallet, but it is at least a happy medium.
Withdrawal limits.
No way to know if Mt.Gox actually has your funds and is not operating as a fractional reserve.

Disclaimer: I am biased because I operate My Wallet


I need a bitcoin or usd payment for my site Just service with simple API. I want to allow clients to pay usd or bitcoin. Then after payment complete i need to add my custom value on my site client purse. Is there simple system for it?
Back end server on java

Checkout the Coinbase API: https://developers.coinbase.com/

Coinbase is very well known and trusted.

Then for the USD option you could have another button that links to Paypal, Stripe, 2Checkout, etc..


How would a restaurant accept Bitcoin? How would a customer pay either the whole bill, or just the tip in Bitcoin?

What technology is best suited for this? (pay by barcode)

Must the waiter have an iPhone wallet as well?

How would the restaurant associate payments to customers?

I would envision that when the waiter brings the bill, there would also be a QR code printed on it.  This would be a one-time address owned by the restaurant, and given only to this customer for their particular bill.  If payment is made to this address, then the restaurant knows that the customer paid (or at least someone did).  An amount would probably not be included in the barcode, which would make it easier for the customer to send extra as a tip to the waitstaff.  This is similar to when a customer leaves a stack of banknotes on the table as payment, indicating that the waiter keeps the change as a tip.  The restaurant would be responsible for distributing tips to the waitstaff, just as they are today when you pay with a card.

Alternatively, two barcodes could be printed on the bill.  One would encode the address and amount of the bill to be paid to the restaurant, and another for the address that goes to the waitstaff.  I feel this would be less likely, since it is less convenient to the customer, and makes it more difficult to divide tips in cases where the tips are shared by the whole waitstaff.

By using a barcode printed on the bill, the restaurant's ticketing system will have incorporated the Bitcoin wallet, so the waitstaff does not need to worry about it.  The system would monitor addresses given to customers, and show an idicator when a customer has paid.  The waiter will have very little interaction with Bitcoin, if at all.


-regtest generate 101 not working when I type
bitcoin-cli -regtest generate 101

in the powershell it gives me this error:
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest generate 101
error code: -32601
error message:

I am running bitcoind in regtest too ,this is the last message that I got fom bitcoind:
Adding fixed seed nodes as DNS doesn't seem to be available.

please help

the answer is :
bitcoin-cli -regtest generatetoaddress < nblocks > < address >


Private Keys / Transaction Verification Perhaps an ignorant question, my background is in finance not cryptography.  After a transaction is made and "signed" with the sender's private key, how can other nodes verify it without knowing the private key?

It seems in all the videos / text I've reviewed in trying to better understand Bitcoin & blockchain tech, people quickly gloss over the transaction verification piece and don't really explain how it works.

Thanks.

To validate transactions, Bitcoin uses Elliptic Curve cryptography. Specifically, an Elliptic Curve Digital Signature Algorithm (ECDSA) on the curve secp256k1.

ECDSA includes three important pieces of data. The private key (a large random number), the public key and a digital signature. These pieces of data have a mathematical relationship such that the public key and a digital signature can inexpensively be computed from the private key, but the private key cannot be computed inexpensively from either the public key or a single digital signature.

There also exists a mathematical relationship between the public key and a digital signature which allows anyone to inexpensively verify that a digital signature was computed from the same private key used to compute the public key. Knowledge of the private key is not required to know that a digital signature was computed from the same private key as the public key.

How can we know that a digital signature is authentic without knowledge of the private key?

By knowledge of the Elliptic Curve parameters and the four following equations...

(1) Qa = dA * G

(2) P = k * G

(3) S = k^-1 (z + dA * R) mod p

(4) P = S^-1 * z * G + S^-1 * R * Qa

where...

Qa is the public key,

dA is the private key,

G is the point of reference in our curve parameters,

P is a point on our Elliptic Curve,

k is a large random number (not the private key),

S is the second half of the digital signature,

z is the hash of the message being signed (encoded as a large integer),

R is the first half of the digital signature (and also the x coordinate of P),

p is a very large prime number defined by our curve parameters.

And then, by substituting (1) into (4) we have...

(5) P = S^-1 * z * G + S^-1 * R * dA * G

Factorizing (5) leaves us with...

(6) P = S^-1 (z + R * dA) * G

Now, substituting in (2), we have...

(7) k * G = S^-1 (z + R * dA) * G

Which can be simplified to...

(8) k = S^-1 (z + R * dA)

Lastly, we invert k and S leaving us with...

(9) S = k^-1 (z + R * dA)

Which is the equation first used to create the signature by the private key holder.

This proof informs us that if the x coordinate of P from (4) is equal to R, then the digital signature (R, S) was generated from the private key dA.

Please see here for a longer explanation and here and here to understand how ECDSA is applied in the Bitcoin system.


How can I run Bitcoin-QT client behind a restrictive firewall using a putty tunnel? I am on Windows machine on a network that is closed for all incoming packets and outgoing packets only work for port 80.

In the network I have access to a Linux via SSH that is open for in and out access.

I want to run the wallet client Bitcoin-QT on the restricted Windows machine, I setup a tunnel using D9050 to the open Linux and then I told Bitcoin-QT that there is socks proxy on localhost port 9050.

The client runs and starts to show connections (which is doesn't show without the tunnel) but it doesn't start downloading the block chain :(

Help ?

The easiest way to make this work would be to install cygwin on your windows machine, specifically ssh client package.

Then from a cygwin shell, run ssh -D 8080 user@linuxHost.

Now you can point the qt client to localhost:8080 as the socks proxy.


How do dividends work on GLBSE? I found a GLBSE ticker that I want to invest in. The people behind it claim that it pays dividends (see http://www.blockminers.com/index.php). If I buy this stock on GLBSE, where do my dividends go? Into my GLBSE account balance?

Dividends do indeed go into your GLBSE account balance, which you can withdraw to a Bitcoin address if you so wish. (Source)


Why is it impossible to modify a transaction in the blockchain? Many pages (including Wikipedia) say that it is impossible to modify a transaction which is already in the blockchain included.

But why is it so difficult?

Each block in the blockchain commits to all of the transactions in the block and the order that they are in. It does this by including the hash of all of the transactions in the block header, which is then part of the data that is hashed for the proof of work.

Modifying a transaction in a block will change the hash of all of the transactions which ultimately changes the hash of the block header. This will likely make the block header's hash have an invalid proof of work. Thus in order to modify the transaction, you would have to redo the block's proof of work, i.e. remine the block.

Furthermore, the block header includes the hash of the previous block. So if you want to change a transaction, you will need to also remine all of the blocks following the block which contains the transaction you modified. Lastly, your set of modified blocks are actually a blockchain fork. In order to get it to be accepted by the rest of the network, your fork will need to have more cumulative work than the current blockchain, which effectively means that your fork needs to be longer than the current blockchain.

Overall, modifying transactions already in the blockchain requires remining blocks, and after a transaction already has a few confirmations, doing this requires immense amounts of computing power. So much computing power is required that modifying blocks is effectively impossible to do.


Transaction Sent Taking almost 2 days , what's wrong? Help pls i'm very confused, i sent some btc almost 2 days a go using the default fee and it hasn't gone thru, what could be causing this?
Has never happened before, since this i've already put the fee on max and other transactions works but this one still isn't going thru...
BlockChain Link: https://blockchain.info/tx-index/e94022faf0fbdea8ef413237cd53498e73977830f9b8284183be87dc958ac919

is it stuck? can i do something to fix this?

Any Help is welcome, will be willing to tip if someone helps with the case..

For the block 441662, actual block, the medium fees are around 0.0007 BTC per a transaction's size equal to 226 byte.

Your transaction has 0.0001 BTC as fees for a transaction's size equal to 520 byte.

So, miners will ignore your transaction until one of them pick it up in his block or stay ignored and finally refused (if it'll take a long time or if there is something with your transaction) and the coin will return to the sender.

You can also rebrocast your transaction again untill it'll be confirmed as soon as possible.

Next time try to put more fees in order to have fast confirmations.


Implementation of BIP39, I want to generate a BIP39 512-bits seed from 12 mnemonics but failed I have a question.
I used the website (https://www.mobilefish.com/download/ethereum/bip39.html) to generate a 12-words mnemonic(English word list) without password and got below:

"organ rate senior panel first task siren room deer excite bachelor project"

And the 512-bits seed is like:
"53329c51c9416d4d2fe46ecd8edab1c9a5289b3366c98bb6ee843e7bd4242ee46b6be686aef697d23278062d8c033cf2788df96cc4f24375682f36eb9a66996d"

However, I tried to generate 512-bits seed by myself but failed.

I used online PBKDF2 SHA-512 Hashes: https://stuff.birkenstab.de/pbkdf2/

And entered like below but got wrong result.
Message: organrateseniorpanelfirsttasksirenroomdeerexcitebachelorproject
Salt: mnemonic
Iterations: 2048
Key length: 64

What I got is: 559c3427c333595e3ef78cc19d7f412452a763a09b66c8c7da2b49ecf12cd5d51ae7cb9bffe9d33ca358a421e984b626053192eea36ba909d307df0fa9ceda60

Please help to answer it....
Thanks!

Just as a side note: What you get from 12 words is a seed of 512 bit length because it was stretched with PBKDF2. The entropy is only 128 bit with 12 words (each word represents 11 bits of information ~= 132 bit with 4 bit checksum).

If you look at a library like https://github.com/bitcoinjs/bip39/blob/master/src/index.js for example, you see that the spaces between the words aren't removed. If you paste the original words into the PBKDF2 tool you get the correct seed.


What is the best consumer grade hardware for litecoin mining? I want to start litecoin mining and have following questions:

Given that I already have a desktop, and with the investment of < 500$ for GPUs, what is the best hardware to mine litecoins?
Is it worth mining litecoins with such hardware?
Are ASICs available for litecoin mining? If not, any possibility of them coming soon?

Given that I already have a desktop, and with the investment of < 500$ for GPUs, what is the best hardware to mine litecoins?

You would probably want to invest in 1 AMD Radeon card, for example 280x or 290. This is private opinion based, but AMD seems to provide good hash rate for money. Have a look at litecoin hardware comparison site for the estimated hash rate.

  Is it worth mining litecoins with such hardware?

If you can get around 750 KH/s, this would yield around $130 over 30 days (source). Note the price is fluctuating a lot, so by no means this is set in stone.

  Are ASICs available for litecoin mining?

No, there aren't at the moment. It takes time to develop and test custom circuit. Not advertising here, but this company appears to offer two models: 5 MH/s (£1350) and 25 MH/s (£5450) with the release date due in Q2-Q3 2014. It's up to you if you would trust them and pay a deposit. Obviously, there will be many others cooking similar stuff in the next half a year (Q1-Q2 2014).


Which textbook provides the best introduction to Bitcoin? Can you please nominate a proper textbook about Bitcoin that covers the cryptographic tools utilized in Bitcoin?

REGARDING TEXTBOOKS ONLY:

The best one is Bitcoin and Cryptocurrency Technologies by Narayanan & Bonneau et al.
You can get a draft version for free from Arvind Narayanan's blog.

The one by Andreas M. Antonopoulos, Mastering Bitcoin is good too.

Roger Wattenhofer & Christian Decker et al also wrote a nice one called "The Science of the Blockchain" about blockchains in general.


Safely interrupt -reindex? My database became corrupted and I had to reindex:

bitcoind --daemon -reindex

It takes my computer quite some time and CPU power. It's been running for an hour but it will take at least 4 more hours to finish. With this high a load, I can't do my work on it, so I'd like to interrupt this process without losing the current progress, and continue later. Is that possible?

Yes. You can just stop bitcoind (using bitcoin-cli stop, or just killing it with SIGINT). Next time invoke it without -reindex, and it will continue from where it left off. If you do pass -reindex again, it will start over.


What would stop some major company from blacklisting specific Bitcoins based on the "inputs" used and their "origins"? I remember news about some exchange actually banning users based on some kind of "reputation score" on the inputs/coin parts they controlled/used, or got Bitcoin sent to them from. So even years and years back, they had this mapped out somehow.
Why can't they do the same today? Aren't they? If not, why? Why do they not take this obvious path to harassing and restricting people to only use Bitcoin in "approved" ways with "approved" people/entities?
Did they stop doing it for some reason? What stops them from doing this and thus locking out tons of people who have "dealt with undesirables"?

Because a transactions with 5 inputs and 5 outputs is possible and it doesn't make sense to ask the question "the output to me comes from which input?"
Simply, transactions are about total input value and total output value and the rest is miner fees. Tracking a coin's origin is not technically possible.


cgminer settings [ ati / amd radeon HD6870 GPU ] scrypt I'm found that speed of my cgminer should be around 320kh/s:

https://litecoin.info/Mining_hardware_comparison

ati / amd radeon HD6870 GPU

The wiki recommend use this -I 19 -g 1 -w 256 --thread-concurrency 8192

However, I can not use -I more than 11, because hardware errors HW

My current success is ~ 150Kh/s:

./cgminer --scrypt --gpu-platform 0 -T --no-submit-stale --queue 4 --scan-time 1 --intensity 11  --thread-concurrency 2048 --load-balance --url stratum+tcp://

(5s):141.5K (avg):141.3Kh/s | A:631234  R:0  HW:0  WU:118.9/m
(5s):153.7K (avg):147.4Kh/s | A:1261234  R:0  HW:0  WU:141.2/m

When I set --intensity more than 11, i'm always get a hardware error and no accepted shares:

12 - only errors - HW, no accepted shares:

(5s):145.5K (avg):145.0Kh/s | A:0  R:0  HW:12  WU:9.1/m

(5s):145.9K (avg):145.1Kh/s | A:0  R:0  HW:12  WU:8.2/m

(5s):147.0K (avg):145.4Kh/s | A:0  R:0  HW:13  WU:7.5/m

...

16 - speed growth, but no accepted shares, only HW :

(5s):179.4K (avg):279.3Kh/s | A:0  R:0  HW:39  WU:27.2/m

(5s):226.5K (avg):269.4Kh/s | A:0  R:0  HW:54  WU:13.7/m

18 - very huge desktop lag, no accepted shares, and HW growth very fast:

(5s):188.2K (avg):296.4Kh/s | A:0  R:0  HW:52  WU:0.0/m

(5s):230.4K (avg):295.9Kh/s | A:0  R:0  HW:82  WU:0.0/m

(5s):256.3K (avg):295.9Kh/s | A:0  R:0  HW:106  WU:0.0/m

(5s):271.9K (avg):295.8Kh/s | A:0  R:0  HW:126  WU:0.0/m

20 - good bye Desktop. HW

(5s):273.9K (avg):287.7Kh/s | A:0  R:0  HW:194  WU:1.3/m

(5s):285.6K (avg):289.4Kh/s | A:0  R:0  HW:224  WU:1.1/m

(5s):264.7K (avg):292.4Kh/s | A:0  R:0  HW:325  WU:1.6/m

This is around declared in Wiki 320ks/s, but it is not a workable state, there are only errors - HW.

However, there is another mistake in wiki: --thread-concurrency 8192, my card have no enough RAM:

 [2013-12-02 17:02:00] Maximum buffer memory device 0 supports says 134217728
 [2013-12-02 17:02:00] Your scrypt settings come to 13428326

This told me cgminer, when I make +1 to  --thread-concurrency 2049

What is the magical border between 11 and 12 intensity?

I do not touch default Core and Memory Clocks:

$ amdconfig  --odgc

Default Adapter - AMD Radeon HD 6800 Series
                            Core (MHz)    Memory (MHz)
           Current Clocks :    300           300
             Current Peak :    915           1050
  Configurable Peak Range : [400-1100]     [500-1260]
                 GPU load :    8%

How can I achieve workable 320 kh/s, as wiki told?

Optimum hash rate depends not just on the parameters sent to cgminer but also on how was this program compiled, if it's 32bits/64bits, and the OS configuration.

The best results I've seen are with Gentoo Linux - as you may know, with this distro you first stablish your specific hardware configuration and then compile everything from code, thus optimizing all our software for the hardware you have to extract the most value off of it.

Something you do can do without going the esoteric route of OS tweaking, you could try modifying the GPU's mem clock as well as (slightly) overclocking. Usually, once you hit the point of diminishing returns with the intensity, thread-concurrency and work unit those are the next values to tweak.

If you haven't read the "README" file from Con Kolivas himself, when discussing Litecoin he delineates an optimizing algorithm in which you first find a sweat spot with intensity, then with another value, then another... finally going to mem clock and overclocking, he says you'll extract the best performance that way - such approach is valid for all scrypt-based coins.


Tips for child key derivation I am trying to make the child key derivation using the extended keys of the BIP32 document (https://en.bitcoin.it/wiki/BIP_0032). Assuming that an extended key is only a base58 encoded serialization of some data, i have decoded the extended keys that I find in "Test Vector 1":

bx-windows-x64-icu.exe base58-decode
 xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw
 0488b21e013442193e8000000047fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141035a784662a4a20a65bf6aab9ae98a6c068a81c52e4b032c0fb5400c706cfccc56b8b9c580
bx-windows-x64-icu.exe base58-decode
 xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7
 0488ade4013442193e8000000047fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae623614100edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea0a794dec

I decode the result obtained for the private key:

0488ade4 is "magic" field for xprv
01 is "depth"
3442193e is "parentfingerprint"
80000000 is "key index"
47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141 is chain code"
00 edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea is "key"

  What are the last bytes? (0a794dec)

In the next operation (HMAC-SHA512) I used the chain code obtained, the key and the next depth (80000002), but I'm not sure.

HMAC-SHA512( 47fdacbd0f1097043b78c63c20c34ef4ed9a111d980047ad16282c7ae6236141,
          00edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea0a794dec80000002 )

I got a 64 bytes result: the 32 bytes on the right become the child's chain code. I "added" the 32 bytes on the left to the parent's key.

3bf125923e89743b3414e76f30c662aae014e1cbd4f8251fea0d556758d66227+ edb2e14f9ee77d26dd93b4ecede8d16ed408ce149b6cd80b0715a2d911a0afea
= 29a406e1dd70f16211a89c5c1eaf341af96ed2f9c11c5cef315099b39a40d0d0

To get the fingerprint from the parent, I need to know the public key. Since it is in the form of a private key, we will have to multiply with the generator point.

  Would anyone know how to recommend a Bx command or a tool to carry out
  this step?

What are the last bytes? (0a794dec)

The checksum.

  In the next operation (HMAC-SHA512) I used the chain code obtained, the key and the next depth (80000002), but I'm not sure.

Yep, that's it : I can see you also prepanded the 0x00 (because serialized privkeys are 32 bytes while serialized compressed public keys are 33 bytes).

  I got a 64 bytes result: the 32 bytes on the right become the child's chain code. I "added" the 32 bytes on the left to the parent's key.

You need a proper tool to perform this addition : you need to compute this addition modulo the curve order.

Since you use bx, you might want to give ec-add-secrets a look.

  Would anyone know how to recommend a Bx command or a tool to carry out this step?

You could use ec-multiply-secrets by passing G (the generator point) as the point parameter.

G = 0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798

EDIT: As another tool if you know a bit of Python you might want to hack with https://github.com/darosior/python-bip32 . I tried to keep it minimal.


Is blockchain.info storing paper wallet (offline) private keys? Does anyone know if it is safe to use blockchain.info "Watch Only" addresses?
The real question is what happens after I perform a transaction - sending BTCs out of such a wallet. Will blockchain.info record the "offline" private key used for such transaction somewhere on the server?

My Wallet's warning for watch-only addresses ("You will not be able to send bitcoins from this address without later providing the private key") can be a bit confusing.

It's possible to specify an address and watch it. And it's possible to import a private key to be able to use the associated address as if it was generated with the My Wallet client.

But these two features are really unrelated. You don't "send out of a watch-only address", rather you import a private key thus making it no longer a watch-only address.

So the question is really whether My Wallet's "Import Private key" feature is safe. I don't have the official answer, but I see no reason why it shouldn't follow the same policy as other keys - the private key is encrypted in your browser (and as needed, decrypted and used to sign) and never leaves your computer in plaintext. If that's true, it is safe as the server never sees your plaintext key.


Should I try to get fuzz testing working on MacOS or should I stick to Linux? The Bitcoin Core fuzzing docs contain some hints for getting fuzz testing working on MacOS. But if I have access to a Linux machine/VM should I stick to doing all fuzzing on Linux? I'm assuming there is no little benefit to the project as a whole that people are fuzzing on different operating systems (other than expanding the number of people fuzzing Bitcoin Core).

If you have access to a Linux machine/VM you should probably do fuzzing on that rather than MacOS. It is likely you will need to do more troubleshooting getting set up on MacOS. However, people have got fuzzing working on MacOS e.g. robot-dreams during this Bitcoin Core PR review club session on fuzz testing:

I was able to get things work by following the "macOS hints for libFuzzer", but I had to remove the --disable-asm flag when running ./configure

In addition brakmic has some additional guidance for those trying to get set up on MacOS:

Take care of having an LLVM/Clang environment that contains fuzzing libraries. The default one from Apple is not enough, so that you will have to install it with brew, if not already done.
When executing ./configure you should put --disable-asm to avoid errors with certain assembly code from Bitcoin Core's code. There's an entry about it here and it seems to have something to do with sanitizers you have to compile for fuzzing.
Take care of giving the correct path for clang and clang++, like CC=/path/to/clang CXX=/path/to/clang++
If you run into problems with "boost sleep" or some of boost's libraries can't be found, like boost.thread or boost.filesystem, add this to your configure:

CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk"

Notice: I am using Catalina 10.15.1, so your SDK might be different and you should adapt the path accordingly.
Here's my complete configure, just in case.

./configure --disable-ccache --enable-fuzz --with-sanitizers=fuzzer,address,undefined --with-boost CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk" CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ LDFLAGS="-L/usr/local/lib/darwin/" --disable-asm

On the benefit to the Bitcoin Core project overall, I would say the greatest benefit would be onboarding fuzz testers and reviewers of the various fuzzing PRs as quickly as possible. Unit tests and functional tests need to pass on various operating systems but the ultimate aim of fuzz testing is examining for edge cases, the majority of which won't be dependent on the operating system. So whatever will get you up and running the quickest is the optimal approach.


Accesing bitcoind through terminal on mac How do I use bitcoind through Terminal on Mac OSX? I think this is not adressed by these questions, but honestly, I'm not sure:

Bitcoin-Qt command line control on Mac

What are the steps in building bitcoind on Mac OS X 10.6?

Per Gavin Andresen's answer on the first post to which you linked, Bitcoin-Qt for Mac does not ship with bitcoind. However, you can still access it with curl or wget, or using the provided Python wrapper. See the post for more.

If you are adamant about using bitcoind itself, your best bet is to compile your own bitcoind using my instructions or using the instructions provided in the source distribution of bitcoin.


I made a payment of bitcoin into escrow for services that were not delivered and bitcoin not returned I made a payment of bitcoin into escrow for services that were not delivered. I requested that the funds be returned and they have been removed from escrow, but never returned to me. Can I do anything to recover my funds?

You can contact the service provider, and the escrow agent to request a refund, but beyond that there is likely nothing that can be done. If you have lost a substantial amount of money, you could file reports with your local law enforcement agency, but understand that there is almost no chance they will be able to help you recover the funds.

Bitcoin transactions are not reversible, once confirmed several blocks deep in the blockchain history, the chance of that transaction being removed or replaced is basically zero. The only way those funds can be returned, is if the person who now controls them decides to send a transaction paying you back.

Sorry for your loss here, it is unfortunate to hear that even after employing an escrow agent, your trade did not go as planned.


After power hit, wallet won't load I downloaded Bitcoin core wallet a few days ago. It was all going well, it synced just to about 25 weeks ago or something. One day the power went down and it shutdown the computer.

When I started bitcoin core again it loaded up to "loading wallet" and is stuck there. Unfortunately I already send a few BTC's to the wallet. Since I could not access my wallet, I figured that my BTC's are lost but then I start reading about accessing my wallet using Bitcoind, however when I create the bitcoin.conf file with the

rpcuser=bitcoinrpc
rpcpassword=xxxxxxxxxxxx

It wont recognize it and still give me the same error and crash as before I created the file.

I am currently running on Windows XP. So since I can't access my wallet, and since the manual way does not seem to work either, is there any other way to withdraw the coins from the wallet? If not can anyone help me with the bitcoind problem. Thanks a lot.

The levelDB gets corrupted if bitcoind stops abruptly, like during an outage.

I'm not that familiar with running bitcoin core on Windows, but this fixes the issue on Linux. It isn't the quickest or best solution, but if manually transferring wallet.dat isn't an option (and you can't dump the private key as another person suggested because bitcoind won't run) this may work for you:

Go into your bitcoin data folder and delete the 'blocks' and 'chainstate' directories and restart bitcoind. It will of course have to re-download the blockchain and re-index which will take a long time, maybe even a week, but it will eventually catch up and you can use bitcoin core again.


Where to get a `BIP32 test pubkey` I would like to create a gateway on MyCelium.com. This is for my testing, so I want to test it out first. But I struggle in getting a BIP32 test pubkey.

There is no documentation on MyCelium.com, neither even Google. It is really frustrating to go through this. Could anybody please help? Thanks.

You can use http://bip32.org/, there is a selection box in the top right hand corner of the page to choose Bitcoin Testnet. That will generate you an extended private key from a passphrase of your choosing. Note that I recommend you Do NOT use any keys generated from websites online for real world payments. But for testing this out it should be fine. Using the default passphrase it generated me:
tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK

Once you have generated an extended private key at the top, starting with tprv, you can then select "Info: m" in the Derivation Path box, which will show you the extended public master key. In this case it generated:
tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B

Again feel free to use this for testing, but please generate an extended key correctly for the mainnet in a secure way, do not use random websites to do it!


Are transactions many-to-many? If so, who decides on the grouping? When I go to blockchain.info and explore transactions, I see a lot of individual transactions that seem to show bunches of addresses sending to bunches of other addresses.

https://blockchain.info/tx/221668ab11014c34da20296a1607ecc7967d1bdeecb884f1bf163e6b6c9f1d72

Does the Bitcoin network/protocol control that automatically, or is that done by the individual/agent initiating the transaction? e.g. Let's say I want to send 123 to one address. Is that going to be grouped into a big transaction involving many people and many recipients (including mine), or is it going to appear in the history as a transaction between strictly two addresses?

Transactions are not grouped or collected together in any fashion, unless the sender of every Bitcoin within that transaction agrees to that. CoinJoin is one way of grouping your transaction together with other people.

There is also a proposal called 'MimbleWimble,' which would make it possible to combine many transactions. This has not been implemented, though.


bitcoin testnet is mining about 50 blocks per minute right now - why? The bitcoin test network is mining about 50 blocks every minute for the last several hours. What is going on?

You can see here: https://www.blocktrail.com/tBTC

There is an adjustment for the testnet when a block takes 20 minutes or longer to mine, it will adjust the difficulty down to 1. This was caused presumably because of the difference between blocktimes of 1356765 and 1356766 because block 1356767 was reset to 1.

Every 2016 blocks, the difficulty is adjusted, but it can only be increased by a factor of 4 each time.

pow.cpp as of version 0.16.2

// Special difficulty rule for testnet:
// If the new block's timestamp is more than 2* 10 minutes
// then allow mining of a min-difficulty block.
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2)
    return nProofOfWorkLimit;


Why are other sell limit orders being filled before mine on exchanges like gdax? If I place a sell limit order for ETH/BTC for 4 ETH at 0.07086, when there’s currently only 0.5 ETH on it. It becomes 4.5 ETH total. Then I see it start flashing up and down, up to 10, or 20, then back down to 4.5. Multiple times. That means orders are being placed after mine that’s being sold at 0.07086 right? Why is mine not selling?

Another side question is, why are sell limit orders being filled at prices higher than market price? Why would people pay 0.0710 or more when there are sell orders much cheaper.

Look at the trade history on the right. Do you see any price other that the current ask and bid ? This means that orders with values other than 9000 and 8999.99 (to take the example below) are not filled, so those orders are getting canceled.

Keep in mind that this domain is heavily automated and most of the activity you see here is bots fighting each other. So this level of frequent adding/cancelling orders on the order book is quite normal.


What do i do with Bitcoin? How to start my Bitcoin? I heard a little bit about Bitcoin and people earning money from it. How do i start my Bitcoin. I am very new to this.

This is a bitcoin developer portal, here neither you will earn any bitcoin nor anybody will tell how how to earn it and stuff.  If you want to start with bitcoin developement start with fullnode. You will get all required information there


How is block reward set in time? Many coins have dynamic block reward over the time, for example Bitcoin was 50BTC/block years ago and now 25BTC. My question is how is it defined in the source code ? I searched in Litecoin's source code but found nothing... Is it done manually by releasing a new version each xxxx blocks ?

The relevant function in the current latest git revision:

int64_t GetBlockValue(int nHeight, int64_t nFees)
{
    int64_t nSubsidy = 50 * COIN;

    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
    nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval());

    return nSubsidy + nFees;
}

Which is used later in ConnectBlock(), as follows :

 if (block.vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
        return state.DoS(100,
                         error("ConnectBlock() : coinbase pays too much (actual=%"PRId64" vs limit=%"PRId64")",
                               block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees)),
                         REJECT_INVALID, "coinbase too large");


BIP32 derivation path Why does BIP32 use the derivation path m/0'/0'/k' by default? What is the significance of this particular path, and why not just use m/k' or m/k directly?

The tree structure is used for organizing the keys you generate. Its just a suggested way to do it.
The first number is the account, in this case account 0 (the default account). This let's you support multiple separate accounts with keys of their own.
Then you have the chain, either 0 or 1. 0 is the external keypair chain, and is used for generating new public addresses. 1 is the internal keychain and is used for things like change addresses - the addresses you don't give out to people (hence 'internal').
Finally the k is obviously used to generate the k-th keypair for account and keychain you've picked.


How to cheaply melt many micro UTXOs? I know this was probably brought up before but I cannot find any good resources on some potential, at least theoretical way of achieving this.

So basically I have a lot of UTXOs whose value is between lets say 1k sats and 5k sats and I want to transfer them all into a single UTXO.

With current fee rates of 15sats/byte I would barely break even in the best case scenario.

Is there any strategy or algorithm that could help with this kind of issue?

There's no free lunch.  You can spend all the UTXOs in one transaction to spread the output bytes across many inputs, but each input still needs a certain number of bytes.  To my knowledge, there isn't any more efficient way of spending them than the standard transaction types.  (If there were, it would be the standard.)

You can of course attach a fee below the current prevailing rate, and hope that the transaction gets picked up during some period of low transaction demand (when fees drop), or wait until such a time to broadcast your transaction.  Certain times of day or days of the week may be somewhat better; you could look back at historical transaction fees to get a sense.  But there's no guarantee that such a low-fee transaction will get confirmed.


Anonymity while sending payment Bitcoin wallet has the option of creating a new wallet address for receiving payment. What about for sending? Isn't my "From" address always going to be the same?

I think you have misunderstood something.

The point of generating a new address for receiving a payment is that this address is not connected to any other address, and when it is eventually used to make a payment - that is where the trail ends. ie a new receiving address becomes a sending address.

If you do this systematically, and never send coins to the same address (either through change, or by consolidating your holding into one address) then you have pretty good anonymity.


Question about transactions added to mempool When bitcoin transactions are made, I know that they are put into the mempool. After certain transactions are added to a block and that block gets verified, what happens to all the other transactions that did not meet that threshold? Do they just get rejected?

Do they just get rejected?

No, they will just wait for another block to be included in.

Note that transactions have a time to live in the mempool of 336 hours (configurable using the maxmempoolexpiry startup option).


Protect against falling bitcoin and bitcoin cash prices What alternatives do I have for insuring bitcoin and bitcoin cash payments (that I'll receive in the future) against falling prices? That's against the pound or euro. Obviously that's against an x% fee.

As of 2017, the CME and CBOE offer  Bitcoin futures (but not bitcoin cash futures). AFAIK, these are the only regulated future contracts that you'll get. More ways of hedging your exposure to future bitcoin price collapses might be available in the future.


Understanding speed vs. fees on various wallets, esp. Instawallet and original client The Bitcoin Wiki don't say much about fees, more precisely if you have a choice between speed vs. fees (pay more, deliver faster).

In fact, I don't yet even have a clue how fast are bitcoin transactions. Sometimes instant, sometimes it is structured by the wallet provide for lower fees but takes up to 24 hours?

A wallet provider might make it seem like the transaction is instant, but it will have to be included into a newly mined block (happens about every 10 minutes), for it to actually "go through". If you only pay a low transaction fee, it might take some time until a miner decides to include your transaction.

After that, it's up to the receiver of the transaction to decide how many blocks to wait until he books it as confirmed on his side.

The default client waits for six of these so-called confirmations to show the transaction with a checkmark.


Do multi-signature transactions make a 'bitcoin kickstarter' possible? And what state are the bitcoins in, in the meantime? This isn't a question about kickstarter really, just a way for me to phrase my question about the crypto in terms that I can understand.

My understanding, based on this article.. Stop Saying Bitcoin Transactions Aren’t Reversible is that multi-signature transactions would make something like a bitcoin KickStarter particularly easy.

That is the kickstarter-like bitcoin service would act as a third party to many contracts transferring btc to the second party?

Maybe this has already been done? Hmm @coinstarter.. Yay! Great to see but doesn't really answer my question about how the crypto works.

To make things easier I'll call the people that pledge to the campaign the 'first parties' and the recipients of the funds the 'second party'. Could multi-party signatures to ensure the second party only receives btc after the projects are funded? and at the same time be sure that the third party (eg coinstarter) technically can't abscond with the funds.

Also - and this is my real question - in such a case what state are the bitcoins in prior to the project being funded. That is, are they marked in the blockchain and thus impossible for first parties to 'double spend' btc they have pledged to a campaign or are they actually not in escrow so if a first party spends them on something else in the meantime (after pledging, before the project is funded) the transaction just fails?

Thanks so much in advance, hope this question makes sense, crypto wise.

While multi-signature transactions with a trusted party (e.g Kickstarter Inc.) would work, their disadvantage is requiring said trusted party...

The bitcoin wiki describes a different method that doesn't require any third party:

Each backer creates a transaction with the amount to be pledged (this is an immediate step and required since the method doesn't allow for change
That transaction is used as input signed with SIGHASH_ALL | SIGHASH_ANYONECANPAY, and the output is the to-be-funded address with the funding goal. Due to the input being less than the output, this transaction is invalid and shall not be published but instead transmitted to the recipient.
Once the recipient received enough transactions summing up to the funding goal, they can publish the assembled transaction

Unfortunately, this method has other drawbacks:

The funding goal must be exactly met (or a multiple of it), i.e. there cannot be stretch goals or overfunding
Since the input transactions are not spent until the funding is complete, the backers might accidentally spend that very transaction in another transaction

Ideally, script would provide means to determine whether a given bitcoin address (or in this case, the script itself) currently has at least a given amount of bitcoins available...


How do I generate the Bitcoin Cash hash preimage? I am attempting to manually generate a signed transaction which is to be sent from my address 1GiJZtN7wjUuL4V5i7ZYYDAvFtqi5AhCDr which is bitcoincash:qzk9nxh6qpd9yt3hvv6vvun78s834f3escdhu2vdjp in the new address format. I am using an uncompressed public key in this transaction.

I have the following unsigned Bitcoin Cash transaction. How do I find its hash preimage which is the hash used in the signing of this transaction?

  0100000001fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d770000000000ffffffff0100a00700000000001976a914a8e181e0847b495df439066ca8fb36ce093692be88ac00000000

Breaking it up, it looks like this:

01000000 - nVersion

01 - num of inputs

fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d77 - txid (little-endian)

00000000 - vout

00 - size of sigScript

ffffffff - sequence number

01 - num of outputs

00a0070000000000 - amount (hex, little-endian)

1976a914a8e181e0847b495df439066ca8fb36ce093692be88ac - scriptPubKey

00000000 - timeLock

I am attempting to consume output 0 from the transaction with txid: 776da96a8df767c519ca08330f49e7e34e1331f027e1fb321f31c57a5c8e4afb,
The scriptPubKey for that transaction's output 0 is:

1976a914ac599afa005a522e376334c6727e3c0f1aa6398688ac

The value of the received output is 0.005 BCH

The transaction I am attempting to consume can be found here:
https://bch.btc.com/776da96a8df767c519ca08330f49e7e34e1331f027e1fb321f31c57a5c8e4afb
And the rawtx for the transaction I want to consume is here:
https://bch.btc.com/776da96a8df767c519ca08330f49e7e34e1331f027e1fb321f31c57a5c8e4afb.rawhex

Can anybody help me?

Bitcoin Cash uses BIP 143 for signature hash creation.

From the BIP:

  Double SHA256 of the serialization of:
     1. nVersion of the transaction (4-byte little endian)
     2. hashPrevouts (32-byte hash)
     3. hashSequence (32-byte hash)
     4. outpoint (32-byte hash + 4-byte little endian)
     5. scriptCode of the input (serialized as scripts inside CTxOuts)
     6. value of the output spent by this input (8-byte little endian)
     7. nSequence of the input (4-byte little endian)
     8. hashOutputs (32-byte hash)
     9. nLocktime of the transaction (4-byte little endian)
    10. sighash type of the signature (4-byte little endian)

So the hash preimage will look like this:

01000000be16f25831b40c713fed6627e39aa7717170f5cdd62c765bd4882abbefdaa50e3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d77000000001976a914ac599afa005a522e376334c6727e3c0f1aa6398688ac20a1070000000000ffffffffc8e2e71fe663fc91d7aa109feffee0f1497862af35525f68f500cbd55f6ed6620000000041000000

And here is its breakdown:

nVersion: 01000000
hashPrevouts: be16f25831b40c713fed6627e39aa7717170f5cdd62c765bd4882abbefdaa50e
hashSequence: 3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044
outpoint: fb4a8e5c7ac5311f32fbe127f031134ee3e7490f3308ca19c567f78d6aa96d7700000000
scriptCode: 1976a914ac599afa005a522e376334c6727e3c0f1aa6398688ac
value: 20a1070000000000
nSequence: ffffffff
hashOutputs: c8e2e71fe663fc91d7aa109feffee0f1497862af35525f68f500cbd55f6ed662
nLocktime: 00000000
sighash: 41000000


Keeping my bitcoins safe: any flaws in my strategy? I'm looking for a very safe way to keep my bitcoins. I'm using a Trezor and used passphrase to hide additional wallets in case someone gets access to my Trezor or seed by physical coercion. I'm not interested in recommendations about keeping my seed safe. Hope this strategy can help someone in this forum and would like to get any feedback about some flaws.

My strategy needs to prevent a scenario where there is no Trezor hardware wallet (eg. Trezor is out of business). I checked for wallets that can recover my wallet using my seed and verify myself that it works. The wallets that worked at this moment (October 24th 2017) are Electrum (I used the OS X program), Mycelium (the Android app) and Wallet32 (the Android app).

I restored with Electrum by using the New/Restore -> Creating a wallet -> Standard Wallet -> I already have a seed and then provide the seed with the Extend this seed with custom words and BIP39 seed options checked. And finally provide the passphrase.

Mycelium and Wallet32 are super friendly with restoring your wallet.

Note I currently have only managed to recover my bitcoin wallet from the Legacy Account and not from the Segwit-ready Account. Looks like these wallets still haven't support this Segwit-ready accounts.

The segwit accounts in TREZOR Web Wallet are derived using BIP49.

So far, no software wallet I know support this, unfortunately. I have heard that Electrum is working on it.

However, if you already wrote your seed to your PC or phone to some of the wallets - Electrum, Mycelium, Wallet32 - you should consider it compromised and move your coins somewhere else. Seed is good only if you don't rewrite it to your PC or mobile phone.

Note that Wallet32 is no longer maintained; since it is a regular SPV wallet, it's possible it will stop working with Segwit2x fork. Mycelium should work; as should Electrum, or its Android clone.

Also, other hardware wallets support the same seeds as TREZOR - for example, there is Ledger wallet, that uses the same seeds and the same logic for accounts. So you can rewrite your seed there and you will have access to your coins.

Because I am an employee of TREZOR, I will tell you that it's more wasy to use than Ledger, but I am obviously biased :) but if you have the seed, you can also use Ledger with the same seed as TREZOR.


Can I store all the keys from a multisig account on Ledger devices? Say that I create a 2/3 multisig wallet using Copay.

Can I store all three keys on different Ledger devices?
Can I store all three keys on the same Ledger device?

I am searching for an answer to the same question. From what I have read so far, the Ledger Nano S does not support multiple BIP44 HD accounts, but I have contacted Ledger for confirmation of this.

This feature would be very useful to distribute the backups of your ledger device (no single backup would be able to steal your funds) but maintain the convenience of being able to sign your own transactions without the need for a 3rd party.

I will update this answer when I receive a response from Ledger.

Update

Still no response from Ledger, but I did find another solution to the problem I was originally trying to solve, so I thought I'd share.

Ian Coleman has developed an implementation of Shamir's Secret Sharing Scheme for BIP39, allowing you to split a single BIP39 mnemonic into a number of parts, which are able to be restored similar to an m-of-n multi-sig wallet - ie You could generate 4 parts to the backup, and allow the full backup to be restored with only 3 of the 4 parts.

More info can be found in the GitHub link: https://github.com/iancoleman/shamir39


Generating Ripple address I am trying to recreate the Ripple address from Account Family wiki page and I am having some problems.

I have the private generator of 7CFBA64F771E93E817E15039215430B53F7401C34931D111EAB3510B22DBB0D8, and the hex public generator of 0388E5BA87A000CB807240DF8C848EB0B5FFA5C8E5A521BC8E105C0F0A44217828.
I start generating the " the hash of (the 33-byte public generator + 32-bit sequence number in big-endian order + the 32-bit sub-sequence number in big-endian order".
I try 71ED064155FFADFA38782C5E0158CB260000000000000000, which generates 9F407F7EC35B9AB44831BF0D47CDDAEF7BC11107CE1D10A65368A12B9338F82E - this result is bigger than the generator, so I increment the sub-sequence
I try 71ED064155FFADFA38782C5E0158CB260000000000000001, which generates 3545C8FE25A89E83287B79D186018D8600A7D5249673FB6D44A77FB12062203B - which is good.
I add private generator 7CFBA64F771E93E817E15039215430B53F7401C34931D111EAB3510B22DBB0D8 to what I just generated 3545C8FE25A89E83287B79D186018D8600A7D5249673FB6D44A77FB12062203B, and I get the result B2416F4D9CC7326B405CCA0AA755BE3B401BD6E7DFA5CC7F2F5AD0BC433DD113
The compressed public key corresponding to that is 02FA95E05F5DA5A433F7B1EE4682DAB44AF28FBC04B485993EC2E516C1D3C30D73, but in the example the compressed public key is 03fa25b68da6ff6832e4462fdfb9a2aaa58888c0ed17285ffe92e4465e0c6e782a

Where did I make a mistake?

You can reference the test cases in my Go implementation of this
that I linked to in an answer to a similar question.

For the case given on the wiki page the values should be:

secret: shHM53KPZ87Gwdqarm1bAmPeXg8Tn ==
0x71ED064155FFADFA38782C5E0158CB26
private generator: 0x7CFBA64F771E93E817E15039215430B53F7401C34931D111EAB3510B22DBB0D8
public generator: fht5yrLWh3P8DrJgQuVNDPQVXGTMyPpgRHFKGQzFQ66o3ssesk3o
first private key: pwMPbuE25rnajigDPBEh9Pwv8bMV2ebN9gVPTWTh4c3DtB14iGL
first public key: aBRoQibi2jpDofohooFuzZi9nEzKw9Zdfc4ExVNmuXHaJpSPh8uJ
first Ripple address: rhcfR9Cg98qCxHpCcPBmMonbDBXo84wyTn

Many of those are in Ripple's base58 encoding. I can provide the hex equivalent if required but it's probably easier for people to get the above linked Go package and run the test cases themselves. It should be trivial for any programer (whether they know Go or not) to tweak the test code to show them whatever details they need.

Edit:
With the private/public generators you specify (0x7CFBA64F… and 0x0388E5BA…) you should be hashing 0x0388e5ba87a000cb807240df8c848eb0b5ffa5c8e5a521bc8e105c0f0a442178280000000000000000 into 0x28f3e125edb203022c7d22c486284706058c209dbf4a98c3923705a4e5347c7a which is good and doesn't requre incrementing the sub-sequence.
That is added to the private generator mod N to result in a private key of 0xa5ef877564d096ea445e72fda77c77bb45002261087c69d57cea56b008102d52.