How can I recover a blockchain.info wallet from a 17 word phrase? I have a wallet at blockchain.info which I've opened about 4 years ago.
Right now I cannot access it. It looks like the site is sending me a verification email, but sadly I don't know which address it uses.
If I use the "I've lost my 2FA Device" option, I have to enter my mail, but it keep telling me that the mail address is not correct (I've tried my main mail and 3 other mail addresses that I've used to use).
If I use the "I've lost my Wallet Password" option (although I have the password), I have to enter a 12 word phrase. I have a 17 word phrase and I've tried to use the first 12 words and the last 12 words, but no luck - I cannot even press the "continue" button.
I've contacted the site's support a few times but haven't got any answer at all.

Is there a way for me to recover my wallet directly from the 17 word phrase?

Blockchain.info's legacy wallet phrase decryption is here:

https://blockchain.info/wallet/forgot-password


How does the lightning network solve double spending? This is probably obvious to some of you on here, but I'm a beginner. I recently read the lightning network whitepaper and its very unclear to me how the lightning network addresses the double spend problem without broadcasting transactions to the public blockchain. Can someone explain this to me?

To use the example in the white paper, if Alice and Bob are sending BTC back and forth to each other through a secure payments channel, I agree this provides Byzantine fault tolerance in a two-person economy of just Alice and Bob. Moreover, I agree this solves for scaling issues currently present in Bitcoin. My understanding here is that the net result of Alice and Bob's transactions are posted to the network at some later date, which is what solves the bitcoin scaling issue. That said, if the transactions of Alice and Bob are not immediately broadcasted to the network, then why can't either of Alice and Bob double spend with another party, Cindy? Provided that either of Alice and Bob transact with Cindy before the wallet states of Alice and Bob are broadcast via the blockchain, then there is no way for Cindy's wallet to be "aware" of whether Alice / Bob's wallet state has sufficient bitcoin for a transaction with Cindy. For this reason, I don't understand how double spending is avoided and why Cindy can be sure that Alice / Bob aren't cheating Cindy in a transaction.

To open a channel you have to lock funds in a multisig address. This is with an on-chain transaction. So those funds can't be used to pay Cindy on-chain. They can't be used to pay Cindy on LN either without both Alice and Bob's approval since it's a multisig address that requires both Alice's and Bob's signature.


Explain blockexplorer UTXO Bitcoin testnet

I used the following code to obtain info about unspent outputs:

const blockchainInfo = require('blockchain.info')

const blockexplorer = blockchainInfo.blockexplorer.usingNetwork(3)
blockexplorer.getUnspentOutputs(address).then((resp) => {
  console.log(resp.unspent_outputs);
})

Response:

   [ { tx_hash: '9c5a...f31b',
       tx_hash_big_endian: '1bf3....5a9c',
       tx_index: 249487365,
       tx_output_n: 0,
       script: '76a9...88ac',
       value: 200000000,
       value_hex: '0bebc200',
       confirmations: 2262 },
     { tx_hash: '708e...ec103',
       tx_hash_big_endian: '03c1...8e70',
       tx_index: 250637325,
       tx_output_n: 0,
       script: '76a9...88ac',
       value: 20000,
       value_hex: '4e20',
       confirmations: 1845 },
     { tx_hash: '803a...901d',
       tx_hash_big_endian: '1d90...3a80',
       tx_index: 256201920,
       tx_output_n: 0,
       script: '76a9...88ac',
       value: 20000,
       value_hex: '4e20',
       confirmations: 262 },
     { tx_hash: '255d...cfde',
       tx_hash_big_endian: 'decf...5d25',
       tx_index: 256264533,
       tx_output_n: 0,
       script: '76a9....88ac',
       value: 20000,
       value_hex: '4e20',
       confirmations: 252 } ]

And I got some questions.

Why do we have both tx_hash and tx_hash_big_endian? Because some wallets prefer big-endian and others little-endian hash?
What is the tx_index? Index of a transaction in entire blockchain?
What is the tx_output_n?
What is the script?

tx_hash and tx_hash_big_endian are the little endian and big endian representations of the transactions hash. Bitcoin uses little endian hashes internally, but explorers normally show such information in big endian, you can read more about such topic here.

Regarding tx_index, that field is an internal id for blockchain.info database. It has nothing to do with the Bitcoin blockchain.

tx_output_n is the index of the output in the transaction. utxos are identified by tx_id and tx_index.

Finally, the script is the scriptPubKey or outputScript defined in the utxo. Basically it sets the conditions to be met in order to claim such an output in a new transaction.


Here is the example
of the transaction from the question

the redeem script is: 514104398184a2cef0d7b73ed7a3a1d4ad16296c3c6986bed0bd72775060aae9891979eaea1efb28d7eb1da3304ec38a98b42086e3be2ceba82b0e932128ec422a6fc2210250504b2d4245544120506565722d506565722d6e6574776f726b2062657461212102553432353135362e31323234202020202020202020202020202020202020202053ae

to derive the P2SH address we do the following:
sha256(redeemScript)
using PHP:

$sha256= hash('sha256',hexStringToByteString($redeemScript));
SHA256: 8b1c6ece53385d6ae3cf3c40fc6239389a7006d9f46047d5d67c3fa78dd2afcc

ripemd160 the resulting hash

$ripemd160=hash('ripemd160',hexStringToByteString($sha256));
RIPEMD160: c25497b8a9bcc393f47abd19a435d1af440916ac

prepend "05" and hash twice

$hashTwice = hash('sha256',hexStringToByteString (hash('sha256',hexStringToByteString ("05" .  $ripemd160))));
double hash: 479ce4efc25c4195ef3cc015d74c45034a2c72f21e322ba30f5c26d872e58b38

first 4 bytes is the chscksum

$checksum=substr($hashTwice,0,8);
checksum: 479ce4ef

compose the address as:

  base58-encode: [one-byte version][20-byte hash][4-byte checksum]

$addr= "05" . $ripemd160 . $checksum;
address: 05c25497b8a9bcc393f47abd19a435d1af440916ac479ce4ef

base58 encode

$p2sh=base58_encode($to_encode);
base58: 3KQYMMqMBTv8254UqwmaLzW5NDT879KzK8

and we get the correct P2SH address: 3KQYMMqMBTv8254UqwmaLzW5NDT879KzK8


What mistakes do first time contributors to Bitcoin Core often make? What mistakes do first time contributors to Bitcoin Core often make with their first pull request?

The most common mistakes I have seen first time contributors make (and this includes me) is:

Not opening the PR from a topic branch of the forked Bitcoin Core repo and instead opening it from the master branch of the forked Bitcoin Core repo

Not adding the correct label at the start of the title of the PR
e.g. doc: Address typo in file X

Not squashing commits when there is no need for multiple commits

Opening a PR for individual typos without running the linter and finding additional typos
e.g. ./test/lint/lint-spelling.sh

Opening a PR for individual typos but not updating test/lint/lint-spelling.ignore-words.txt to ignore false positives identified from running the linter.


bitcoind not using correct directory inspite of datadir argument I configured a non-pruned bitcoin full node on a RaspberryPi 3 using this tutorial - http://raspnode.com/diyBitcoin.html

I am using a 1TB external HDD to store the blockchain. I synced the full blockchain on my laptop and transferred it to this external HDD.

I am able to mount this external HDD as per the instructions in the above tutorial under the folder ~/bitcoinData and have also setup the automount.

However, even when I run bitcoind using the arguments bitcoind -datadir=/home/pi/bitcoinData -daemon, it still is using the default ~/.bitcoin (on the RPi SD Card) to download the blockchain from scratch even though the full blockchain is available in the mounted drive.

I tried to mount bind the two directories in /etc/fstab/ using /home/pi/bitcoinData    /home/pi/.bitcoin       none    bind    0       0
but still the same issue occurs. Any idea why bitcoind is not using the mounted drive to download the blockchain inspite of the argument datadir=/home/pi/bitcoinData?

That tutorial sucks.

Better seek generic instructions on how to mount external HDD to user's home directory.

Say you're Joe, you'd use sudo to add a user called bitcoin.

Then mount /dev/hda1 (or whatever it is) to /home/bitcoin, configure /etc/fstab, reboot, log in as Joe and make sure it works (df).

Then login as bitcoin user, make sure you're in /home/bitcoin (where you should be), download (or just install) Bitcoin Core, and start it. You don't need any config files (but you can add rpcusername and rpcpassword), as by default everything will be stored under /home/bitcoin/.bitcoin/.

Joe now can use a wallet that connects to Bitcoin Core (executed by bitcoin user).


Transaction fees with Dogecoin or Ripple for small amounts We are a company which sells low priced items online ($0.05 - $0.50). Due to the crypto currency hype, we also would like to accept payments through at least one crypto currency.

I have analyzed a couple of crypto currencies by their average transaction fees, market cap, avg. transaction confirmation, etc.

I found out that Dogecoin and Ripple have currently cheap fees, less than $0.01 cents average.

Question: Can we hire the company that integrates this in our E-Commerce backend or is there anything else important to know beside the exchange fees? Are our transactions too small?

So far I have taken following into account

Transaction fees are not fixed, but as of writing this question the fees are acceptable for my case
Exchange fees (mostly a bit higher since traded through BTC from USD/EUR)
Average fees are less than $0.01, but theoretically they can be higher (if not average)

For most transactions I would assume the fees are <= $0.02. This would be okay for us, but which crypto currency should we choose?

Fully understanding where you come from, IHMO you should choose the crypto currency which most of your potential customers keep in their wallets anyway. Especially when it comes to small amounts (as you say) hardly anyone will be willing to go to an exchange first and trade 0.0005 BTC into a different coin only to pay you.

I would suggest to take a look at the Lightning Network (https://en.wikipedia.org/wiki/Lightning_Network).


Which Bitcoin exchanges publish proof of reserves? I am tired of fractional reserve exchanges continuing to run with account holders eventually holding the bag.

Which exchanges publish proof of reserves.

Real time proof with blockchain addresses would be best, but audited reports from a tech savvy accounting firm would be better than the status quo for most exchanges where no transparency is provided at all.

Several exchanges have published reports (OKCoim, Kraken) but Bitfinex is the only one I am aware of to offer real time proof of reserves with individual BitGo wallets.

"The era of commingling customer Bitcoin and all of the associated security exposures is over"

http://www.businesswire.com/news/home/20150603005462/en/Bitfinex-BitGo-Partner-Create-World%E2%80%99s-Real-Time-Proof

Implementation plans exist so maybe more exchanges will follow:
https://iwilcox.me.uk/2014/proving-bitcoin-reserves

Proof of Solvency appears to be a similar term used by the industry


When you make a Bitcoin transaction, can the receiving person (and the world?) really see how much coins you have in the entire wallet? I really hope that I've got this horribly wrong, but I have to ask...
I have this idea, which I base on comments and explanations I've heard over the years, that when you make a Bitcoin transaction, for example 0.001 BTC, your wallet (let's assume Bitcoin Core) actually sends your entire funds of your wallet, let's say 1.5 BTC, but also includes a "gimme back" signal for 1.5 minus 0.001 BTC, ie 1,499 BTC, in the same "atomic action", meaning you never actually risk losing all that money, but it is advertised to the person receiving it, and maybe the entire world.
I don't understand why it would do this, and it seems extremely bad for privacy, and I'm not at all sure that it's done. Maybe it only happens sometimes? If so, when? Or maybe it doesn't mean "the full funds of the wallet", but something else?
I hope that somebody can clear this up once and for all. It's pretty telling that somebody who knew about Bitcoin in 2009 is actually asking this question in 2021, after using it for highly sensitive tasks for over a decade... I'm not wild about random people knowing how many Bitcoins I have simply by sending them money, and hope that this is not how it works.

No, you will not disclose the entire amount of your wallet when you make a payment, but effectively you can disclose some info on your bitcoin.
Your wallet has several addresses and each one can have received one or more payment, once you receive a payment this amount will become an UTXO (unspent transaction output) which you can use to make a payment later;  so you will have some UTXOs in your wallet and when you pay you must spend a full UTXO (the amount you received in a earlier payment) not the whole wallet.
For example, if you have received four payment to four different addresses (0.3, 0.04, 0.61, 0.05 - wallet total balance 1 btc)  and you must pay 0.2 btc, you will use an UTXO that is greater than requested amount, in our example 0.3 btc UTXO (but you can pick also 0.61). So you will make a transaction with one input (0.3 btc) and two output: 0.2 btc for the payment and 0.1 as change that you receive on a new address.
In this case you will disclose to your counterpart (the only one who know that this address is your) that you have at least other 0.1 btc but not the wallet balance.
Any other that see this transaction on blockchain can't know that this address is your and maybe can't even distinguish payment from the change, depending on how the transaction is made.
This is the most simple situation and the one in which you reveal less info, there are other factor that can reveal part of your holdings (i.e. if you use the same address to receive multiple payments, when you spend from that address, you will disclose the whole amount on it,  not only the UTXO you pick) but Bitcoin privacy is not so simple that can fully explained here.
You can read more here:
https://bitcoin.org/en/protect-your-privacy
https://en.bitcoin.it/Privacy


What advantages does Armory have over Bitcoin-Qt? What advantages does Armory have over Bitcoin-Qt? Just better multisig support? Armory runs bitcoind.

Some obvious reasons:

Deterministic wallet (only need to store the seed, bitcoind's wallet uses a random number per address).
Multisig support with lockboxes.
Paper backups with SecurePrint.
Fragmented backups (you need m of n pieces to get back your wallet)
Offline signing for additional security

There's also a lot more features that are on the way that we'll be announcing (Disclosure: I work for Armory)


How bitcoin transaction fromat design can be explained? Can someone clarify?

Why is there bitcoin address in the transaction, when the bitcoin script already contains the pubkey hash?
Why isn't the amount a part of the script?
Why does bitcoin script allow to sign only parts of the transaction?

Why is there bitcoin address in the transaction, when the bitcoin script already contains the pubkey hash?

Contrary to popular belief, this is not true. Addresses are not part of transactions at all, nor are they part of the protocol. The address is only used to encode the pubkey hash or script hash which is then used to create the output script.

  Why isn't the amount a part of the script?

It does not need to be. The script is a program, it does not care about the amount.

  Why does bitcoin script allow to sign only parts of the transaction?

To allow for special transactions where only part of the transaction needs to be signed. This allows people to do things like anyone-can-pay transactions or for people to sign only for specific outputs created by the transaction.


Anonymity through paying by bitcoin I am considering the VPN service Privateinternetaccess. One of it's payment methods is bitcoins. As described on this page paying with bitcoins strengthens anonymity. In contradiction, this page claims bitcoin is not normally anonymous. To what degree is bitcoin anonymous? How does this anonymity differ compared to paying by other means such as credit card, Paypal or through Amazon?

Since the steps described in the second link are only for the U.S. I would have to find an alternative way to exchange my dollar to bitcoins. I'm wondering is it worth the effort? Is the worse privacy compromise if I didn't use bitcoin that it could be known I am a user of Privateinternetaccess? Any advice is greatly appreciated.

Anonymity:

Every transaction ever made in Bitcoin is public. You can see the most recent here:
https://blockexplorer.com/

What makes it anonymous, is that you may not know who owns which account number (Bitcoin address). If Privateinternetaccess picks a new receiving address for every transaction, it's very difficult for an outside person to see who is receiving your bitcoins.

Also, there are 'mixer' services which will send on the correct amount to an address, but maybe not use the same coins, so there's no visible link. blockchain.info has such a 'mixer' service.

Buying Bitcoin outside of US:

This question pops up a lot, so I'm making a site right now to show how to buy bitcoins from each country:
http://howtobuybitcoins.info/

Feel free to throw me any questions you have.


Why does the Bitcoin client require at least one confirmation before I can spend? If I accept bitcoin for payment, provide a new address for each payment and make it clear to payers that I consider payment complete only after waiting the ~10 minutes for a confirmation, is there a technical reason why I can't immediately spend the bitcoin without waiting for the confirmation? Is it impossible to spend it because the address has no transactions in the block chain?

There is no technical reason you can't spend it immediately. A transaction that is dependent on an unconfirmed transaction should be accepted by the network and should eventually make it into a block.

You will almost certainly have to include a transaction fee with the second transaction in order to get it accepted into a block immediately. Otherwise, you will be waiting some time before the second transaction gets committed into a block.


How much is ripple decentralised and p2p I don't understand this

  Even if Opencoin should close, the ripple network will continue. Because the ripple is a P2P >network, it is not operated by Opencoin but by the combined efforts of all the computers >running the ripple server software. The ripple network can not be shut down without shutting >down the entire Internet.

so what is there are still ripple users but no ripple servers?
Will all XRP and all stored money vanish?
is all ripple clients also a server so that they can process transactions.

Also, I would like to ask do all people that use ripple form a p2p network,
or only the ripple servers form a p2p network, and users connect into it?

Thank you :)

Ripple is an internet protocol. It's ledger is kept on servers all over. In fact, I am in the process of installing RippleD and connecting my server to the broader network.

Watch these short youtube videos:

Here's an overview of Ripple ...

Here is an explanation of Ripple in 60 seconds ...

Here are two more videos:

Here is a video to help you understand how a Gateway works ...  http://www.youtube.com/watch?v=M16ZatXbmLg

Here is a video to help you understand how the consensus ledger works ... http://www.youtube.com/watch?v=pj1QVb1vlC0

Then you should do a search on the Ripple Wiki and give it a read. (I'd send a link, but again, they're limiting me to two :-S )

Cheers!


Are there two versions of the armory webpage? I'm seeing https://btcarmory.com/ and http://bitcoinarmory.com are both sites. Are they both legit? what is the reason for the duplicate? They seem to be slightly different.

https://bitcoinarmory.com is Armory's original webpage when it was maintained by Armory Technologies Inc. (ATI) They still control that webpage but it is currently unmaintained.

After ATI stopped maintaining Armory, the open source community picked it up with one of ATI's former employees taking the lead maintainer role. The website for the open source community fork of Armory is https://btcarmory.com.

You should be using https://btcarmory.com because that website is still maintained and the software that is listed there is also maintained.


Confused on using SHA256 code from Bitcoin Core I was looking at Bitcoin Core code to use its SHA256 code but am confused on where I should be looking at.

In bitcoin/src/crypto/sha256.h there is CSHA256

and in bitcoin/src/crypto/sha256.cpp there are namespaces named sha256_sse4, sha256_shani.

And then there is bitcoin/src/hash.h

Explanations and guidance would be greatly appreciated.

sha256.h has the exported (visible from outside) methods and functions. To compute SHA256, you should #include that.

sha256_sse4.cpp
sha256_sse41.cpp
sha256_avx2.cpp
sha256_shani.cpp

contain SHA256 transform functions (used in SHA256.Write), each specialized for different processors with different instruction sets. Above is the list in order, most of the computers support SSE4, but only a few support SHA-NI instruction set, which is the fastest way a new processor can calculate SHA256.

sha256.cpp contains other methods that aren't a bottleneck, functions that check which instruction sets are supported, tests, as well as a pure-C++ transform function for older and non-x86 computers.

hash.h favors polymorphism via C++ templates.

Examples:

hash std::vector<something> vch to std::vector<something> vchHash
hash std::vector<something> in to std::vector<something> WitnessV0ScriptHash
hash uint8_t * nonce.begin(), uint8_t *  hash.begin(), unsigned char pubkey[], std::vector<unsigned char> vchSig to std::vector<unsigned char> entry
hash op_true to witness_program


GREP help: Bitcoin address/key buried as text somewhere on hdd So in a drunken moment of genius I had forgotten about, I bought some bitcoin way back.  And I buried the address and key in some file... I was being tricky lol. That likely also led me to abandon a wallet.dat completely.

I'm learning to use grep to hunt it down, but the one time I know I got it to work, it returned TONS of files.

I know the address starts with 1F or.. f .. or D.. or d, maybe E/e lol.  But one of those.  The original parameters from stackoverflow for finding the address are:

[^13][a-km-zA-HJ-NP-Z1-9]{25,34}$.

I've attempted to adjust it to remove the 3 and have been attempting to add the first letter, but I'm trying a grep search with each and as I see no results after 20-30 minutes, I just ctrl-c the thing.

I'm trying

I removed the ^ and $ from the ends after when I realized that there is no reason to think it's at the beginning or end of a line (if I properly understand what that even means).

The search area is for where I've recovered the files from these drives to, I'm hoping my "genius" drunken drive mapping attempts and subconscious file preservation impulse kept the file(s) from being overwritten.

Any help would be very appreciated, thank you.

[^13][a-km-zA-HJ-NP-Z1-9]{25,34}$.

...

  I removed the ^ and $ from the ends after when I realized that there is no reason to think it's at the beginning or end of a line ...

As you noted, the trailing dollar sign ($) anchors the search expression to an end-of-line (e.g. LF on Linux) - you probably do not want to do that.

However the [^13] does not anchor the search to start of line, inside square-brackets, the caret ^ means not. So [^13] means look for a string whose first 8-bit character is not a 1 nor a 3. It would match strings that begin with any other character - that is probably not what you want. If you want a string that begins with a 1 or a 3 just use [13]. If you wanted to anchor that to the start of a line you'd use ^[13] not [^13].

  ... (if I properly understand what that even means).

The expression ^[13][a-zA-Z0-9]{25,34} matches these lines:

1234567890123456789012345 is my secret code
3aklsdjlajkjvcnbxuxcjvhhkjhgtresds

where the 1 or 3 immediately follow a prior LF character (or are the first character in a file).

but does not match either of

my secret code is 1234567890123456789012345
    3aklsdjlajkjvcnbxuxcjvhhkjhgtresds


"mandatory-script-verify-flag-failed (signature must be zero for failed check(multi)sig operation)" I forked the openwallet-android so that I could add my coin - (placeholders) placeh.io.

The openwallet-android connects to electrumx server. I am able to get my chain to load correctly in electrumx server. The openwallet correctly reads the balance from the address / inputs and you can see your balance through the wallet.

However, when I try to broadcast a transaction I am getting the message:

"mandatory-script-verify-flag-failed (signature must be zero for failed check(multi)sig operation)"

From placehd/placeh network.

Here is some additional information, this is the rawtransaction that is being published. If I try to send the raw transaction in the placeh-cli client, it will not succeed and produces the same error when done manually

Raw Transaction:

placeh-cli decoderawtransaction

01000000017477f59250a8d8a7d94ba5dcc196222c0b6c92849cad210735b4380b24c03b13010000006a473044022053b17723e8a90846fc341006f5f63d5776df619f33cec82d8065e836508672c6022036298087c2f37c3002c4897b74e7de6af8c608c89cbcef07ada9c5551c85f2810121031dc78b8c254649e204b81641f70497980ca6b5574f837001c962930580d1372dffffffff02c00e1602000000001976a914a117ed0f4e2afe1e1b8d2b0253408a7830f2b55688ac0093e651020000001976a914c472af380586ed1638686731cc1eda3c60363ec788ac00000000
{
  "txid": "de045f2220d0b9f34060336c9ed3badc7c22741fec3aa1d87ff24264c3c1fb5e",
  "hash": "de045f2220d0b9f34060336c9ed3badc7c22741fec3aa1d87ff24264c3c1fb5e",
  "version": 1,
  "size": 225,
  "vsize": 225,
  "locktime": 0,
  "vin": [
    {
      "txid": "133bc0240b38b4350721ad9c84926c0b2c2296c1dca54bd9a7d8a85092f57774",
      "vout": 1,
      "scriptSig": {
        "asm": "3044022053b17723e8a90846fc341006f5f63d5776df619f33cec82d8065e836508672c6022036298087c2f37c3002c4897b74e7de6af8c608c89cbcef07ada9c5551c85f281[ALL] 031dc78b8c254649e204b81641f70497980ca6b5574f837001c962930580d1372d",
        "hex": "473044022053b17723e8a90846fc341006f5f63d5776df619f33cec82d8065e836508672c6022036298087c2f37c3002c4897b74e7de6af8c608c89cbcef07ada9c5551c85f2810121031dc78b8c254649e204b81641f70497980ca6b5574f837001c962930580d1372d"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.35000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 a117ed0f4e2afe1e1b8d2b0253408a7830f2b556 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914a117ed0f4e2afe1e1b8d2b0253408a7830f2b55688ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "FLWtv6SuocTFMozTZvdZAhroJLehVjLKhs"
        ]
      }
    },
    {
      "value": 99.64000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 c472af380586ed1638686731cc1eda3c60363ec7 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914c472af380586ed1638686731cc1eda3c60363ec788ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "FPjqHpEzdYAbxVG2acxz8GWGAPmJsWj6oP"
        ]
      }
    }
  ]
}

I believe this may have something to do with the way that the openwallet is constructing the raw transaction. I would like to update the libraries so that it will be able to broadcast the transaction correctly.

After some additional research and helpful information found here, I was able to conclude the following:

Transactions encoded on 0.12.X bitcoin and then broadcast on 0.15 bitcoin may encounter "mandatory-script-verify-flag-failed (signature must be zero for failed check(multi)sig operation)"

This problem can be solved by doing the following:
Signing your 0.12.X raw transaction with a 0.15 signature. I cannot pinpoint the exact issue, however I was able to encode the raw transaction on 0.12.X and the sign it on 0.15 and successfully broadcast it. This information may be useful if someone is trying to figure out what parts of their signing process need to be refactored / updated.


Integrating bitcoin with php to accept donations i have a blog and now i want to integrate bitcoin using php so that i'm able to accept donations or charity.

But i don't want any 3rd party processing like for creating qr code or invoices or content like that.
Is this possible or if not can someone point me in the direction of a proper integration method even if its 3rd party.

https://en.bitcoin.it/wiki/PHP_developer_intro

This site shows all you need to get going. You'll need to run a dedicated bitcoind wallet on a server, which can accept JSON-RPC to call the various functions of bitcoind, which will respond back with a JSON object.


What is the "unit of account" in terms of Bitcoin? Traditional economics depend on a "unit of account".  Can anyone explain how a "unit of account" would be manifested in Bitcoin if so desired?

The "unit of account" is "what all your numbers are denominated in".

For instance you might work day-to-day in dollars/ pounds and yen but your unit of account may be dollars. Everything would get totalled up in terms of "dollar equivalents" and you would typically report in dollars.

You can choose whatever unit of account is convenient to you.
The obvious one to use is simply bitcoin. You have all your accounts in bitcoin and report in bitcoin.

However you may have to report yearly accounts to (in the UK) Companies House who want to see reports denominated in pounds. Say because of this you decide to have your unit of account to be pounds.

Thus you need a rule for converting your bitcoin to your unit of account, pounds. Perhaps you choose a daily conversion rate and convert all bitcoin received that day to pounds. (Or you might use another conversion algorithm).

Your unit of account is what you measure your money in.
It is a bit like measuring distance in centimetres or inches or light years. Choose the unit of account to be the easiest for what you are trying to achieve.


Does encoding Namecoin/messages into the blockchain bloat it? I read today twice concerns about inflating the blockchain:

NameCoin
Bitcoin Message Service

So, does using these services "over inflate" the blockchain? The way I see it, if another protocl rides on top of Bitcoin but obeys by its rules and pay all the proper transaction fees / mining time, then it's "legit". My question is how can such a "legit" protocol inflate the blockchain more than a regular miner would?

Does it introduce spurious transactions? If this actually became a problem, wouldn't increasing the minimal transaction fee solve it?

NameCoin merged mining adds no more than 49 bytes to the size of the block.  Namecoin messages aren't stored in the bitcoin block chain, instead the hash of the most recent namecoin block is stored in the Bitcoin block providing continuity between a potential hash and the Namecoin block chain.

So yes it technically does "bloat" the Bitcoin blockchain but it current is ~4% and that percentage will decline as transaction volume increases, as that fixed 49 bytes is measured against increasingly larger blocks.

As for "how" can it be done.  The coinbase transaction (which transfers rewards and fees to miner's address) contains a field called coinbase.  Without merged mining this field is used to generate entropy for hashing process (extra nonce) which alters the block header each time it is changed.  Allowing a miner to try nearly infinite number of hashes.

This field is not used by the blockchain for anything other than entropy so adding namecoin hash to the field doesn't collide with any Bitcoin transaction.  Once a block is signed the field is never used for anything other than verifying the block valid (by verifying the hash is correct and is smaller than required target).


Bitcoin protocol / algorithm scalability I have been looking into the Bitcoin protocol / algorithm a bit. I have the basics down, I think, but there are a lot of questions about how the whole thing is supposed to scale. For example,

Each client currently downloads the entire block chain, right? How is this scalable? They are supposed to be able to prune the Merkel trees, but I haven't gotten a good insight into how this works in P2P.
What was the thought process behind tracking transactions the way they are? You kind of have to traverse a lot of that tree to validate new transactions? Right?
Because of how a transaction ALWAYS needs to be confirmed (at least 6 times?) over P2P, the transfers are effectively far from instantaneous. There is a built in delay. Isn't this a problem? There is some delay already because of the nature of the algorithm that accepts the transaction into a block (solving the reverse hash).

1) It's not clear why you think every client having to download the entire block chain is a scalability problem. Pruning currently doesn't take place but it should eventually be possible in theory. Storage space is growing at a much faster rate than Bitcoin is.

2) To validate a new transaction, the only transactions you have to look at are the inputs to make sure it validly claims them. Presumably, you already know every currently-valid transaction output already. You have to check a block in order to accept it anyway.

3) This is the nature of the way Bitcoin prevents double-spending attacks. It's because Bitcoin has adopted a "no central authority at all" approach. Nobody, as far as I know, knows a way to do instantaneous transactions without a central authority. (Consider, for example, if a natural disaster splits the Bitcoin network into two halves and each half sees a conflicting transaction. How would you know?)


How to make more than 1 nodes of mine connect each other? Lets say i have 5 nodes running.

each node is on its dedicated server and is upto date. and its connected to available peers on the network.

How can i make them to connect each other and not to BAN them, and connect them again in case of bitcoind restarts ?

so in case i plan to make star topology of nodes and use central node for RPC connections.

You can add them to each other nodes bitcoin config file. If you want to connect to a specific node among others, use addnode=IP:PORT in your config. If you'd like to only connect to your own nodes and not other nodes on the network, you can use connect instead of addnode, but of course you should have at least one outgoing connection to get blocks, etc :)


P2Pool Payout Addresses vs Worker Addresses I initially did a setup of 3 Antminer D3's following DIRECTIONS AT THIS LINK.

I used a payout address for my P2Pool command line that I created in my Dash Core wallet. I did NOT initially use wallet receipt addresses for each of my miner's worker names, but instead called them DASH01, DASH02, DASH03.

As I continued to research, seeking to find ways to optimize my mining and my miners on my P2Pool, I learned to set the difficulty using address+diffnumber. That led me to realize that the REASON I was NOT seeing complete stats for my miners on my P2Pool monitoring web pages, was because I was not using wallet reception addresses generated by my wallet/node for my worker names.

Now that each worker has a separate wallet/node receiving address, I can see all the stats.

Herein lies my question. Should none of my worker addresses use the same address as my payout address? I am confused about this particular point. Thanks for clearing up any conceptual errors too.

Through trial and experience, I can now answer this question myself. I decided to NOT use a payout address for my p2pool command line, and only used dash core wallet reception addresses for my worker names, but each worker address is address+difficultNumber. It's working fine and reporting well in the p2pool web page, whereas it wasn't reporting things before using the above initial scheme. It looks like this arrangement will be more profitable than the previous one too.


Are there any hosted online store solutions (a la Shopify.com) that are compatible with bitcoins? Are there any hosted online stores that can be set-up easily to take bitcoins?

AFAIK there are no publicly available out of the box solutions for setting up a store that uses Bitcoin. Although; there are many viable solutions using Bit-pay, their system integrates well with most platforms. If there is a platform you want to use their system for, their sales team can surely help you do that.

I have no affiliation to Bit-pay but spoke with one of their founders in length at the Bitcoin conference.

I would recommend looking into setting up a wordpress site (hosted, not wordpress.com), using ecwid shopping cart, and asking bit-pay to integrate the store into ecwid for you.

This setup is a 99% one size fits all, and you would be pioneering the way for others to follow. Bit-Pay may have an alternative solution, but I have developed several online stores (10+) for clients - and use wordpress/ecwid for both of my personal stores (after trying many others).


How do you create a planet-specific cryptocurrency that will ignore longer block chains from other planets? I'm sure that cryptocurrencies will play a huge part of the economy across the solar system, when we have colonized many different planets, moons, and asteroids. But there are problems with using a single coin for the entire solar system. Let's just start with the example of a Mars colony. Long distances mean long delays in communication so it would take a very long time to get confirmations of Bitcoin transactions that originate on Mars. That could be problematic. Additionally, people on Mars could never hope to mine bitcoins because the average communications delay between Earth and Mars is 20 minutes one way, which is twice as long as the ten-minute blocks of Bitcoin. So I believe that a different coin would be best for each planet. But here's the crazy part. Even if Mars had its own coin (let's call it Marscoin), Earth would most likely have more computer processing power, so miners on Earth could download Marscoin's block chain and extend it faster than the miners on Mars. Then the miners on Mars would no longer be able to mine Marscoin. Then we would be back to the same problem of using Bitcoin on Mars. So, I think someone would have to create a coin that can somehow be planet-specific, so that longer block chains from other planets will always be rejected.

Simply limit the block target (i.e. 10 minutes) to the speed of light (300,000 km/s).

Unless there is some wormhole or other unknown to reduce this limit, Bitcoin is safe from honest mining from any planet outside of 180,000,000 kilometers away (300000km/s * 60 sec * 10 minutes) since any miner can't keep up with the blockchain and would get any block at about the time the next block comes out.

Someone with more advanced technology / more hashing power could create a 51% attack and submit it to disrupt the Bitcoin economy even outside of this radius.


How will multisig addresses work? How will multisig addresses work? Will they consist of multiple traditional addresses, or will they have some different structure? Will one be able to specify whether they will require 2 out of 2, 2 out of 3 or M out of N signatures? Where can I find out more about their specification?

I know this question is old, but I stumbled upon it looking how to teach myself how multisig addresses work, and I imagine others will to. So I’m going to try to explain the typical flow for creating, adding bitcoins to, and eventually spending a multisig address. This explanation is aimed at beginners, so please excuse my lack of brevity. First off, some terminology we should get out of the way.

Bitcoin Address: A bitcoin address is a string of (usually) 33 or 34 digits which we give to people when we want them to send us bitcoins. Here is an example of public address

19evXeJDDLNeRS4st4bGUJNGk8eBgVCCg4

Public Key: A public key is used to derive a bitcoin address, although knowing a bitcoin address WILL NOT allow you to find that address’s corresponding public key. For more information on the public key / bitcoin address relationship go to https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses. Here’s what the public key for the bitcoin address pasted above looks like

035739f07de25c205525d81b126ed87bc30377e688705072d186e4f5c88908ce3a

Note that I only know that public key because it’s stored along with my private key in my wallet, I’m posting this usually confidential information here because it is easier to understand bitcoin when you have examples.

Multisig transaction/address: A multisig transaction is just a transaction that has as one of its inputs a multisig address. Multisig addresses are used to make it so multiple keys owned by separate entities are needed to move the bitcoins in an address.

OK great! Now, here are the steps and background for making a multisig address. I’m going to explain things in plain English first, and then follow up with the bash/Terminal commands you will use to create/add money to/spend the multisig address. I’m using the standard bash delimiter “$>” to indicate that whatever comes after the “$>” is what you should enter into your terminal. Lines that come after the line containing “$>” are the output of that command. If you ever have any questions about a command your entering, you can type the following into the Terminal to show what arguments should be passed to the command

$> bitcoind help <nameofcommandhere>

This explanation assumes you have an update to date and functioning bitcoind server running that can accept RPC commands.

i. Create the public keys that will comprise the multisig address. You are going to use these public keys and one other piece of information to create your multisig address.  The most common distribution of the addresses in a 3-address multisig address (it’s possible to have a multisig address comprised of more than three addresses, but they’re not supported by all miners so for this explanation we’ll deal with the most common 3-address multisig address) are as follows. PubKey#1 is typically owned by you and stored on a device you have easy access to (like your mobile phone). PubKey#2 is typically also owned by you but stored somewhere secure (like cold storage or in a paper wallet). PubKey#3 is often the public key of some third party, like your brother or a company offering bitcoin-related services like Coinbase. Let’s call each of these owners of a public key an entity. Recall that Bitcoin uses private/public key cryptography, so whomever creates a public key also keeps the corresponding private key to themselves. This private key will be important later in the explanation. So let’s create 3 new public addresses which we’ll end up using to create a multisig address! Note that as I explained above, if you were using a multisig address in a real world situation you’d probably get one of the three public keys from some third party, but for this explanation here we’re just going to create all three ourselves. Here are the relevant RPC commands for creating public keys:

Enter this command to see all your accounts. Assuming you’re starting fresh, you’ll only have the account with the name empty string and no bitcoins in it

$> bitcoind listaccounts
{
    "" : 0.00000000
}

Enter the following command three times to create three new addresses in this account

$> bitcoind getnewaddress “"

Enter this command to view your newly created addresses

$> bitcoind getaddressesbyaccount “”
[
    "1CtfcziAhqx83CtSPdufgZDGmL8ohTFTdd",
    "1JeK7TZR85BL8WvtHgCiTSYtPJupdYYXgR",
    "1MP3BzdhzoBmGoBiVfLmhv7B4Czxm3MbrU"
]

You’re not done though. So far you’ve only seen the public addresses. You need to get the public keys of these addresses. Luckily you can do that simply by typing the following command three times, each time substituting  for one of the addresses you created

$> bitcoind validateaddress <btcaddress>
{
    "isvalid" : true,
    "address" : "19evXeJDDLNeRS4st4bGUJNGk8eBgVCCg4",
    "ismine" : true,
    "isscript" : false,
    "pubkey" : "035739f07de25c205525d81b126ed87bc30377e688705072d186e4f5c88908ce3a",
    "iscompressed" : true,
    "account" : ""
}

The value to the right of “pubkey” is that address’s public key.

ii. You then use these three keys to create the multisig address. In the previous paragraph I mentioned how you needed the public keys plus one other piece of information to create the multisig wallet. That piece of information is the number of signatures needed to spend the bitcoins in a multisig address. One of the useful things about a multisig address is that, in order to send the money in the address, it takes multiple private keys (I told you we’d come back to these!) signing the transaction to make it valid. So for this example we’re going to use the number 2; two out of the three entities will need to sign the transaction in order for bitcoins to move anywhere. When we create the multisig address, bitcoind will return the multisig 34 digit address, as well as a bunch of hex data called the “redeemScript”. Note that the first digit in the address is a “3”. Most addresses your used to probably begin with a “1”, but all multisig begin with “3”. Copy, paste, and save the address and redeemScript values somewhere as we’ll need them in a bit. So, we create the multisig address by entering the following command. Be sure to type the apostrophes and quotes exactly as I have, and substitute  for the public keys you got from validateaddress.

$> bitcoind createmultisig 2 ‘[“<pubkey>", "<pubkey>", "<pubkey>”]'

{
    "address" : "3DS7Y6bdePdnFCoXqddkevovh4s5M8NhgM",
    "redeemScript" :     "5221027ca87e1aa2595ec7771afee8fdc6efdbc301b8370c4386731b4bd82247dc74a321022cc9874ba092095dd    a47a4e4edb1781c43c35b3ec0429ac005df37b9d6eec94b21035739f07de25c205525d81b126ed87bc30377e6887    05072d186e4f5c88908ce3a53ae"
}

Copy the output that you get somewhere, we will need it soon.

iii. Send some bitcoins from one of your wallets to the multisig address. I was surprised to learn Coinbase doesn’t think that multisig addresses are valid, so if you’re using Coinbase you can’t send directly from your Coinbase wallet to the multisig address. As a workaround, you can use Coinbase to send a small amount of bitcoins (I sent 1 dollar’s worth) to one of the three addresses you originally created, wait for that transaction to get confirmed, and then use the following command to send bitcoins from that regular address to the multisig address. Replace  with the multisig address and  with some amount of bitcoins worth less than the amount you sent to the regular address. Remember that you’ll have to pay transaction fees! If the command works it will return the transaction’s transaction hash. You can look at this transaction by entering the transaction hash into the search field at blockchain.info.

$> bitcoind sendtoaddress <bitcoindaddress> <amount>
0ac29fc675909eb565a0984fe13a47dae16ca53fb477b9e03446c898b925ab6b

iv. Finally, we’re going to spend the bitcoins we just received in the multisig address. We will use the private keys of the first two addresses we created in step 1. In order to obtain the private keys, we enter the following command twice into the Terminal, each time replacing  with one of the bitcoin addresses you created:

$> bitcoind dumpprivkey <btcaddress>
KyiRjmZYPH7cfyKf1WNb3BZFz1ySurWEYKxLngkH6VmTcSCirBPG

(As a side note, the worst possible thing you can do in the bitcoin community is to paste the private key of one of your addresses onto a public forum. NEVER DO THIS! I am only doing this because I want to make sure readers can follow along with my explanation, and there's only a couple dollars in these addresses)

v. Now that you have two public/private key pairs, we can finally spend the bitcoins we sent to the multisig address. To do so, we first need to gather some information about that transaction where we sent bitcoins to the multisig address, because we need to choose the correct output from that transaction to use as the input in the raw transaction we’re about to create. Type the following into the terminal, replacing  with the transaction hash that was returned earlier.

$> bitcoind getrawtransaction <txid> 1
{
    "hex" : "010000000175783b2ca3381efb15ee7f5f44632a2c699171a924185386460b91d0f211d3bb000000006a47304402207707875d5c29ed0d97cd72087c67c17c57e2ef34d0b6208a054fffece8704477022045aec0ea57830f53fa0e52094400dd4fb654d7712f2ac3341a762d0f46c02d370121027ca87e1aa2595ec7771afee8fdc6efdbc301b8370c4386731b4bd82247dc74a3ffffffff0210270000000000001976a91431e71089318d7b1ea51a1add0dd6525423f713c488ac702402000000000017a91480cff499983050ec4268d749a1f898bec53e9fc28700000000",
    "txid" : "0ac29fc675909eb565a0984fe13a47dae16ca53fb477b9e03446c898b925ab6b",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "bbd311f2d0910b4686531824a97191692c2a63445f7fee15fb1e38a32c3b7875",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "304402207707875d5c29ed0d97cd72087c67c17c57e2ef34d0b6208a054fffece8704477022045aec0ea57830f53fa0e52094400dd4fb654d7712f2ac3341a762d0f46c02d3701 027ca87e1aa2595ec7771afee8fdc6efdbc301b8370c4386731b4bd82247dc74a3",
                "hex" : "47304402207707875d5c29ed0d97cd72087c67c17c57e2ef34d0b6208a054fffece8704477022045aec0ea57830f53fa0e52094400dd4fb654d7712f2ac3341a762d0f46c02d370121027ca87e1aa2595ec7771afee8fdc6efdbc301b8370c4386731b4bd82247dc74a3"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00010000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 31e71089318d7b1ea51a1add0dd6525423f713c4 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a91431e71089318d7b1ea51a1add0dd6525423f713c488ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "15Yrv3rAVxYTTGePM3ZZwumSnMfS9St9uD"
                ]
            }
        },
        {
            "value" : 0.00140400,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 80cff499983050ec4268d749a1f898bec53e9fc2 OP_EQUAL",
                "hex" : "a91480cff499983050ec4268d749a1f898bec53e9fc287",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "3DS7Y6bdePdnFCoXqddkevovh4s5M8NhgM"
                ]
            }
        }
    ],
    "blockhash" : "00000000000000002ab5cb0ee400200b8575fe393fef57d41b41a5d533a414a3",
    "confirmations" : 5,
    "time" : 1404775273,
    "blocktime" : 1404775273
}

Look for the key “vout”, which should have a JSON array as its value. We need two values here; the index of the output in vout which has the largest value, and the value of the “hex” key within that same output. When I originally sent this transaction I had sent 0.00160400 bitcoins. 0.0001 of that went to paying miner fees, and the remaining 0.0010000 went to a change address that my client software created for me. We’ll want to use the output with the largest value (here 0.00140400) as the input in our transaction when we create our raw transaction. So here the index is equal to 1. In this same transaction we’ll need the value for the key “hex” within “scriptPubKey. It’s too much to go into detail here as to what this value represents, if you’re interested in learning about one of the more fascinating parts of the bitcoin protocol start reading here https://bitcointalk.org/index.php?topic=377604.0. At a high level, the scriptPubKey “hex” value is a hexadecimal encoding of the script that gets run as part of a transaction input in order to verify that the transaction is valid. Anyways, the value for “hex” we want is thus a91480cff499983050ec4268d749a1f898bec53e9fc287

Remember when we created the multisig address one of the values that was returned was something called the “redeemScript”? Hopefully you copied and pasted that somewhere because we’ll need that to create our raw transaction as well. This also is used to verify that the transaction is valid and can thus be passed around by nodes when it is broadcasted to the network.

OK, here comes the most confusing part coding-wise; we’re going to do some relatively low-level bitcoin operations that are what is actually going on when you send coins from one address to another, though with the added complication of using a multisig address. We’re going to use the transaction hash, the index in the vout array we just found, the scriptPubKey, the redeemScript, as well as a bitcoin address which will receive a certain amount of coins we specify. Enter the following into the Terminal exactly as I have written, replacing  with the transaction hash,  with 1,  with the scriptPubKey,  with the redeemScript,  with the address you want to send these bitcoins to (I used one of the three I created at the start), and (you guessed it)  with the amount you want to send. Don't forget to account for a roughly 0.0001 transaction fee. Be warned that the warnings you’ll get are not very descriptive, so make sure you follow this layout exactly.

$> bitcoind createrawtransaction '[{"txid”:”<txid>","vout”:<vindex>,"scriptPubKey”:”<scriptPubKey","redeemScript”:”<redeemScript>"}]' ‘{“<sentToAddress”:<amount>}'’

01000000016bab25b998c84634e0b977b43fa56ce1da473ae14f98a065b59e9075c69fc20a0100000000ffffffff0160fd0100000000001976a9145eed147e77af70c64c31c056c3b3474c79c65da088ac00000000

That command just returned a raw hex-encoded transaction, this is the collection of bytes that bitcoin clients broadcast to the network, and which contain the information necessary to verify that the outputs being used as input in the transaction are valid. But right now this transaction is NOT valid, because it has not been signed by at least two of the private keys that are associated with this multisig address. Let’s do that now. We’re going to take this raw hex transaction, most of the information we just entered in the previous command, and the private key of the first address we created and sign the transaction. The command looks like this, where you’ll replace  with the output of the previous command, and  with the private key of the first address we created (remember, the one we obtained by running “bitcoind dumprivkey ”?)

$> bitcoind signrawtransaction ‘<rawhextransaction>' '[{"txid”:”<txid>","vout”:<vindex>,"scriptPubKey”:”<scriptPubKey","redeemScript”:”<redeemScript>"}]' ‘[“<privkeyone>”]'

{
    "hex" :     "01000000016bab25b998c84634e0b977b43fa56ce1da473ae14f98a065b59e9075c69fc20a01000000b500483045022100f98068a026e2fc75cfeffe84bbac4223ed172df42bca01fd748a14bd960b1695022062c61a7f4f2a63a65d96b0feaf2a048bc2ca93e5de13013978a187395f880b6d014c695221027ca87e1aa2595ec7771afee8fdc6efdbc301b8370c4386731b4bd82247dc74a321022cc9874ba092095dda47a4e4edb1781c43c35b3ec0429ac005df37b9d6eec94b21035739f07de25c205525d81b126ed87bc30377e688705072d186e4f5c88908ce3a53aeffffffff0160fd0100000000001976a9145eed147e77af70c64c31c056c3b3474c79c65da088ac00000000",
    "complete" : false
}

You’ll note that the “complete” key is false. That’s because we’ve only provided one of the two signatures we need to make this a valid transaction. The value for “hex” is hexadecimal representation of the raw transaction we created, but with one signature included. Next we’re going to take the transaction with one signature and sign it with the private key of the second address we created. The Terminal command is very similar:

$> bitcoind signrawtransaction ‘<onesigrawtransaction>' '[{"txid”:”<txid>","vout”:<vindex>,"scriptPubKey”:”<scriptPubKey","redeemScript”:”<redeemScript>"}]' ‘[“<privkeytwo>”]'

{
    "hex" : "01000000016bab25b998c84634e0b977b43fa56ce1da473ae14f98a065b59e9075c69fc20a01000000fdfd0000483045022100f98068a026e2fc75cfeffe84bbac4223ed172df42bca01fd748a14bd960b1695022062c61a7f4f2a63a65d96b0feaf2a048bc2ca93e5de13013978a187395f880b6d0147304402201ce986e3fd780f4fe81f40ceb271a8ff34c3845e385b8424f8b20d1b91f1282102205dc71831baf5606f59d06b1d115bda3ec28817cdb4bf9df06643d550c30ef193014c695221027ca87e1aa2595ec7771afee8fdc6efdbc301b8370c4386731b4bd82247dc74a321022cc9874ba092095dda47a4e4edb1781c43c35b3ec0429ac005df37b9d6eec94b21035739f07de25c205525d81b126ed87bc30377e688705072d186e4f5c88908ce3a53aeffffffff0160fd0100000000001976a9145eed147e77af70c64c31c056c3b3474c79c65da088ac00000000",
    "complete" : true
}

You’re probably happy to note that “complete” is now true. We now have only one more step! We’re going to take the output of this last command, which is a valid and fully signed transaction sending bitcoins from a multisig address to an address you specifying, and send it off using the “sendrawtransaction” command, like this

$> bitcoind sendrawtransaction <fullysignedtransaction>

bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d

And finally, this will return the transaction hash for the transaction you just sent out.

That’s it! You can use blockchain.info to see that transaction on the network. Now you know how multisig addresses are created, how to send money to multisig addresses, and most importantly how to spend those bitcoins. Now please, go out and help make wallet software that implements multisig transactions in a user friendly way.


How many rounds of HMAC-SHA256 needed to generate the master key in BIP32 In the BIP32, it does not define the round of HMAC-SHA256.

In http://bip32.org/, it use 50,000 rounds.

In "mastering Bitcoin", it use 2048 rounds.

Is there any explicit standard, or what we suppose to follow?

Book "Mastering Bitcoin":

http://bip32.org

BIP 32 only uses one round of HMAC-SHA512 to go from the seed to the master private key.

Neither of the two sources you listed are going from a seed (or passphrase) to the master private key. They are going from a mnemonic or passphrase to the seed.

What Mastering Bitcoin is describing is the BIP 39 conversion from mnemonic to BIP 32 seed. From there, that seed will be put though HMAC-SHA512 one more time to get the final master private key.

bip32.org is using HMAC-SHA256 (which is not HMAC-SHA512) 50,000 times in order to convert the passphrase you enter into a BIP 32 seed. Again, the resulting value will be hashed one more time using HMAC-SHA512 to get the master private key.


How likely are key pair collision attacks? Is it possible to be profitable by developing a collision application that continually and automatically generate a key pair, check for the existence of the public address in the block chain, and then extract any funds that are found on matching key pairs?

I am not asking because I want to do this, rather I want to understand what mitigates this threat vector.  I understand the total number of key pairs is massive, but it seems like someone could build a collision farm to hammer out key pairs.

I am not asking because I want to do this, rather I want to understand what mitigates this threat vector. I understand the total number of key pairs is massive, but it seems like someone could build a collision farm to hammer out key pairs.

Someone could, but because the total number of key pairs is massive, there would be no point. They could instead build a mining farm or put their money in interest bearing securities and have a probability of making a profit several trillion times higher.

Let's look at the probability of them making at least a single Bitcoin. At most, 21 million accounts can contain one Bitcoin or more. So they have to find one of 21 million key hashes out of 2^160 possible hashes. Let's assume their farm includes a billion cores, each of which can try 2 billion keys per second. In one hundred years, their probability of success would be approximately one in a ten billion billion.

So for a one in ten billion billion chance of making one bitcoin in a hundred years, they'd need a billion cores, each of which is trying two billion keys per second. Seems like they'd find something else to do with their time, doesn't it?


btc transaction stuck from last 3 days on blockchain I've sent a transaction on bittrex wallet, but accidentally included too little fee. What can I do to cancel the transaction or speed up the transaction's confirmation?

transaction id:

https://live.blockcypher.com/btc/tx/007f4527695f69eac30d6431f50a7b3b5befc92b99c7d8a217e0ebc37c999961/

https://live.blockcypher.com/btc/tx/9e6973cf77e7148e81c0edfca0b25a6463c80d2248c31f9b43ee0027f52d1092/

Looks like you put a very small fee for the transaction. As the mempool is pretty cluttered your transaction may take quite some time to pass through. Did you send your BTC from a platform?

Check the mempool here:
https://jochen-hoenicke.de/queue/#all


BLS signature verification? Is it possible to perform BLS signature verification with upcoming Taproot/Tapscript proposal?

No, only Schnorr signatures are supported.


Are there time-series of Bitcoins in circulation? For a study on Bitcoin, I would like to find (or construct) a timeseries of the total value of all Bitcoins in circulation (market capitalization). At least for the last two or so years. This could be quoted in e.g. US Dollar.

Is there such a time series? If not, is there a timeseries with the total amount of unlocked bitcoins, which could then be multiplied with an exchange rate?

Historical time-series of exchange rate:

https://docs.google.com/spreadsheet/ccc?key=0AmcTCtjBoRWUdHJuUE1mUkFxa3A0eHBDQkxZLVVFZmc

Source of the data is the "Raw Data" from BitcoinCharts.com.

The raw data of daily "market cap" is available in json

http://blockchain.info/charts/market-cap?timespan=all
http://blockchain.info/charts/market-cap?timespan=all&format=json <-- Thanks to Ben's comment below.


How would an artist be able to sell their own music for Bitcoin? What options are there for artists to market their Music in exchange for Bitcoin? How would an artist be able to directly sell his work to his fans?

Regarding this question, its probably worthwhile to check out Bittunes. The company was started in May 2013 with the mission to enable the monetization of file sharing with Bitcoin. The significance of this is that it is not about just using Bitcoin as a way to buy music, but actually incentivising buys (fans) to serve as a new kind of distribution channel for music. ~ In other words, its an 'earning platform' for both artists and fans. It is early days for the system, with many aspects still to roll out. see:  www.bittunes.com and www.bittunes.org for more detail.


What is the mechanism by which the 'system' adjusts the difficulty of finding blocks so one is found on average every 10 minutes? Here we read:

In the Bitcoin network, only blocks with certain hashes get accepted and included in the official list. The criteria for which blocks "count" is that their hash has to be below a certain number called the target. The network adjusts this number up and down according to how frequently blocks are passing the test--this is how it's able to keep the rate of block production at an average of 10 minutes per block.

This calculation is expanded on here:

The Bitcoin difficulty started at 1 (and can never go below that). Then for every 2016 blocks that are found, the timestamps of the blocks are compared to find out how much time it took to find 2016 blocks, call it T. We want 2016 blocks to take 2 weeks, so if T is different, we multiply the difficulty by (2 weeks / T) - this way, if the hashrate continues the way it was, it will now take 2 weeks to find 2016 blocks.
For example, if it took only 10 days it means difficulty is too low and thus will be increased by 40%

But who does this? Is it a collective property of the cluster? Is it the server? What gives the server the authority to determine this?
My question is: What is the mechanism by which the 'system' adjusts the difficulty of finding blocks so one is found on average every 10 minutes?
EDIT:
I don't believe the question ("How is the difficulty of bitcoin mining propagated?") is a duplicate - because it doesn't explain the implementation issue - which is the essence of my question.

It's enforced by the fact that every miner and every Bitcoin user is running software which implements the adjustment algorithm you described.  So everyone is able to compute, and agree, what the current difficulty is supposed to be.  This is the notion of "consensus" which Bitcoin relies on.

If some miner created a block with a difficulty lower than the "correct" current value, the rest of the network would reject it.  The coins created by that block would not be accepted as payment by anybody else, making them effectively worthless, and the transactions contained in that block would not be considered as confirmed by anyone else (though they could still be added later to another valid block).  Other miners would not use that block as the "previous" for their own blocks, and so it would not be incorporated into the block chain.


how to see my private key bye decrypted wallet.dat How to decrypted my wallet.dat (Yes, I know the password) so i can see my private key? if anyone can help there is 1 LTC for them

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


What exactly is the "vout" field? This is driving me nuts. Through trial-and-error, asking numerous people and attempting to read endless articles and manuals, I've come to the conclusion that the "transactions" listed by listsinceblock are quite misleading.
They are not transactions at all?
The "txid" field is not unique, for example. It is only unique when coupled with the mysterious "vout" field, which can apparently be 0 or 1.
This, coupled with the multiple different "categories" (besides receive and send) really make me confused and worried that my Bitcoin Core-based payment system is somehow fundamentally broken.
Can somebody please explain to me once and for all why vout exists and why txid is not unique? And what does this mean in practice? Is this because a "Bitcoin payment" can be made in multiple different "sub-transactions"? I never was able to understand the purpose of that, and it's making me beyond confused.
Would love to get this straightened out now that I'm actually close to actually launching a Bitcoin service!

vout is the 0 based output index. It can be more than just 0 or 1, but those tend to be the most common because people don't make transactions with lots of outputs.
To understand vout, you must understand how Bitcoin transactions actually work. A Bitcoin transaction consumes transaction outputs as inputs, and creates transaction outputs. It can consume multiple transaction outputs, and create multiple transaction outputs. Furthermore, these transaction outputs can be consumed by different transactions, so each one needs to be able to be uniquely identified. So a unique identifier contains two items: the transaction id to identify the transaction an output belongs to, and an index to point to the position in the list of outputs in that particular transaction.
That index is what the vout is. As with many things in computer science, it is a 0 based counter so the first item is at index 0, the second at 1, and so on.
listsinceblock, listtransactions, and some other RPCs in Bitcoin Core don't actually list Bitcoin transactions. Rather they list the logical transaction - the one that humans tend to think of. This is because a single Bitcoin transaction can both send Bitcoin away from you, and allow you to receive Bitcoin.
In a single Bitcoin transaction, you can be consuming your own transaction outputs, so the transaction is sending your Bitcoin away. However not all transactions contain inputs from the same person. This transaction could involve another person who has their own transaction outputs as inputs to this transaction. And perhaps they are creating an output that you would be able to spend. So this transaction is also sending Bitcoin to you. This single Bitcoin transaction would then consist of two logical transactions - one where you are sending, and one where you are receiving.
This can often occur with change outputs, but the software should not be showing you those as it is smart enough to hide them and not consider them as a distinct logical transaction. Change outputs are when a transaction output is created by you that sends the Bitcoin back to yourself. They exist because a transaction output must be spent in full, but often the amount you are actually sending does not exactly match the exact amount of the output your are spending. So you must create an output that sends the remainder back to yourself.


How does Coinbase / GDAX calculate volume in historical candles? How does Coinbase/GDAX calculate the "Volume" in candle data?

I'm pulling data from the GDAX API in 2 ways; 1, by requesting candles similar to this endpoint, and 2, by tallying up raw tick data from the GDAX WebSocket.

My problem is that when I try to create candle data from tick data, my volumes are very different than what GDAX reports for the same/similar periods. (See the blue and red outlines below...)

In my hand-made candles (shown below, highlighted red), I'm simply taking the sum of all the BTC transacted during that interval, but the numbers are much higher than what GDAX is reporting in similar periods.

What am I doing wrong?

Here's the format I'm using to make my candles:

While researching this, I found this post saying that Coinbase uses the # of transactions to calculate volume, but I tried that, and the numbers are still way off. I even tried dividing and multiplying the # of transactions with my calculated volume, but they're still way off.

I can't answer for the discrepancy that you're seeing, but the "right" way to calculate volume would be to add the "total" column from each trade that occurred during the period. That is, assuming that candle charts are based on stock market candle charts.

It doesn't surprise me that you're seeing this discrepancy, however. I've noticed a few different cryptocurrency APIs that have no idea how to calculate OHLCV data the right way. If your candle data isn't correct, then none of the traditional TA-Lib functions will mean anything!


Is there an API to create a Dogecoin Wallet? Identical to this, but for dogecoin? https://blockchain.info/api/create_wallet

The block.io service offers DOGE coin wallets and an API.


Calculating the mining profitability of Novacoin I've been researching altcoins and keep coming across some staggering figures. I think it's just too early to do math, but if I were to farm novacoins for example calculator here and I have pretty much no cost (0 power and 0 hardware), my rig can run 500-600 Mhash/s (aka 500,000-600,000khash/s since that's what the calc uses), lets ignore difficulty increase. The calculator says I can make ~$100 PER DAY. This can't be right, can someone figure out what I'm doing wrong here?

If you already have the hardware and do not pay for your power consumption, then it follows that you would always have 100% profit. If you pay for your own power consumption, you need to be aware that performing mining calculations all day will significantly increase your computer's power usage in comparison to being idle.

I haven't checked the validity of the calculator, but you can calculate your potential mining yield from your mining power and the current difficulty.

Check out this answer on How much Bitcoin will I mine right now with hardware X? for a formula.

Then, it depends on whether it is actually possible to sell the coins that you gained (whether there is a market for it), and whether the above information is acurate, otherwise, it might well be possible to make a good amount of money mining altcoins.


Maximum number of transactions in wallet.dat for Bitcoin Core I know that a large number of key pairs in wallet.dat is not a concern. But is having too many transactions in wallet.dat an issue?

Can Bitcoin Core start crashing after it reaches a certain number of transactions? Say over 100K?

Large wallets take significantly longer to initialize and eventually bog down the client to the point of making it completely unusable (calls that attempt to sort usable outputs to spend for example get slower). Bitcoin Core's wallet really isn't designed for commercial scale use, but many people have found it usable with half gigabyte wallets (hundreds of thousands of addresses and transactions) or more in this sort of setting.

Once you get beyond the scaling of Bitcoin Core the only other realistic option is moving into a completely custom wallet system, though this has significant risk and cost involved.


Combining a Bitcoin transaction with one address holding USDT, but no BTC and using another address with BTC to pay for the fees? I have a Bitcoin address that contains USDT, but NO BTC in it. So I cannot even send the USDT out. But I have another bitcoin address that does have BTC. Can I somehow combine these 2 addresses where I can pay the btc from one address that also pays to send out my USDT? If this doesn't work, that means I have to send BTC to the USDT account in order to send it back out?

What application supports the Omni layer with batching to make this work?

You don't need to do anything special to make this work. The omni protocol allows you to have a second input to the transaction to pay for fees.

When you received the USDT, your first address should have at least a little bit of BTC in it. If you have already spent that, you will need to transfer a little more.

If not, you can consume that tiny input, and an input from a different address, and make a regular omni output + change to any address.

Unfortunately, to my knowledge, no omni wallet supports this kind of transaction, so you will have to build the rawtx using Bitcoin Core or Omni Core and sign it appropriately.


where do the timestamps on blocks come from? A stork brings them... or...

One of the basic principles on a dist. system is lack of a global clock.

So how are the timestamps assigned to blocks, by the machine that mines it? Couldn't it just insert a fake one?

On page 7 of the Ethereum whitepaper Vitalik says that the algorithm for checking that a block is valid contains the following check:

Check that the timestamp of the block is greater than that of the [median of the 11 previous blocks] and less than 2 hours into the future

So then this notion of time in BTC is quite fuzzy isn't it?

Is there anything I can read that will tell me the exact time bounds of the BTC system?

A miner applies their own timestamp to a block.

Nodes add the first block they receive to the top their chain. They will not replace the current tip of their chain with a newly received block just because it has an earlier timestamp.

Therefore, you can think timestamp is a rough indicator of when the block was formed by the miner.

From bitcoin.it/wiki/Block_timestamp:

  A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours.

So I suppose a miner can insert a "fake" timestamp, insomuch that it is between these two bounds. Nonetheless, a "fake" timestamp will not influence its position in the blockchain.


How does scrypt pow work? Bitcoin's pow is sha256, the hash of header is taken and check against a given target to see whether it is smaller than the target, this can be easy seen as block hash starts with zeros. But how does litecoin's scrypt works, from the block explorer, its block hashes are just arbitrary, not starting with zeros. What is scrypt mining actually trying to find?

It's the same: the proof-of-work is that the scrypt hash of the block header must start with a certain number of zeros (or, more precisely, be numerically less than a certain target value).  However, the scrypt hash is not what's used as the block ID; rather, the sha256d hash (double sha256) is used instead.  The sha256d hash doesn't have to follow any particular pattern.

For instance, the previous block field of a header contains the sha256d hash of the previous block's header, not its scrypt hash.    The scrypt hash of the header isn't contained anywhere in the block chain, and the block explorers I checked don't seem to show it, though it would be nice if they did.

I don't know exactly why this choice was made.  It could be for efficiency: there might be places in the code where we need to find the ID from the block header, but don't need to verify the proof-of-work.  Since sha256d is much faster than scrypt, it would save time to be able to use sha256d in such cases.  Or it might have been for convenience, so that there was less code to change from the original Bitcoin source.


how to know if a webpage has mining code? Until recently I have heard that lot of webpages are infected with the javascript which uses your computer's power to mine bitcoins.

Whats the correct method to identify if the website i am browsing is infected by this?

Typically when you browse to a website that is mining with your computer, you will notice that CPU usage increases dramatically. However, if the mining code is tuned to prevent noticeable CPU usage increases, it will be basically impossible to detect if a website is mining through your browser. The only way to know would be to examine each and every website's source code yourself.

However to avoid this problem, you can just prevent JavaScript from running at all. Using a plugin like NoScript, you can prevent JavaScript from executing when you visit any website which will thus prevent JavaScript miners from using your computer to mine cryptocurrencies. You can then enable JavaScript for specific websites and enable certain scripts for each website so that you know are not mining with your computer while still making websites that use JavaScript usable.


Bitcoin-qt taking forever to acquire the blockchain I thought that this was the old days when it took forever for bitcoin core to acquire the bootstrap but it looks like it's still the case. I basically ran the program for 2 hours and I'm still under 10h. Any idea on how to fix the problem or download the blk files elsewhere ? Why can't I find the equivalent of the bootstrap as a torrent ?

I don't think you have a problem, but are seeing expected behavior.
Bitcoin Core is downloading and verifying about 80 GiB of data. Even with all the improvements that have been added, this will take several hours to days depending on your hardware.

Bitcoin Core is a full node. It mirrors all the information of the blockchain, and checks it first hand. By running Bitcoin Core, you become part of the users that verify and provide the network's data for others.
You could take a shortcut and acquire an already verified set of data, but then you'd be trusting a third party that they didn't add incorrect information to trick others in the network. However, that's exactly the point of why you'd run a full node in the first place: When you do, you can be certain that you have a correct copy of the blockchain.

If you don't require full node security or feel that it is too much hassle to synchronize with the network, you might find it more comfortable to run a user oriented wallet. You can find a comparison at Choose your wallet.


What to do about "stuck" transactions? (Copied from reddit)

Hey. I recently made a bitcoin transaction for the first time in a while. The transaction fees have gone through the roof (!!) since the last time I used it, and I figured it would be no issue to use the default fee on my electrum wallet (104 sat/byte).

I now realize this was a big mistake. My transaction is stuck in mempool and I don't know what to do about it.

What should I do? How long do transactions stay in mempool before they are not considered "sent" anymore and I can spend the bitcoins in another transaction? Is there a way to retroactively attach a higher transaction fee to my transaction?

I'd really appreciate any help with this. Having your money stuck in digital limbo sucks.

Already answered here on Stackexchange

You can find some additional information in the article

PS. Right now stuck about 0.07 BTC thanks to blockchain.info fee calculator. Just waiting, I'm not in a rush


What is Namecoin's blocksize limit? Bitcoin's blocksize limit is currently 1MB. It seems as if Namecoin would have to be bigger due to it proving 512 bytes of storage with a name update, but it also has slower average block times (about 20 minutes according to BitInfoCharts).

Does Namecoin also have block size limit? What size is it?

Namecoin has not strayed from Bitcoin in this parameter, it is still set at a 1 MB block size limit. You can find it in main.h:

/** The maximum allowed size for a serialized block, in bytes (network rule) */
static const unsigned int MAX_BLOCK_SIZE = 1000000;


RE: Article on Brain Wallet I apologize upfront since I am not a seasoned c-currency investor (yet) unlike my years of experience with securities, currencies and commodities. I have some queries for you:
1) Brainwallet.org does not exist I could only locate Brainwallet.io
2) It will only create and accept a key for BTC I have 18 coins I need to securely (very relative) store.
Any tips/suggestions would be much appreciated.

Most reputable wallets nowadays create a seed, meaning, a word list you can memorize (brainwallet). My approach would be to install Electrum on an offline PC, create the seed and when I'm sure I won't forget it, I'd wipe the device clean.

I would consider this approach risky, even if I was willing to commit to refreshing my memory of the seed.

I would still buy a hardware wallet such as a Trezor.
I would memorise its seed and the keys would still be accessible through the device, just in case.

Hardware wallet security:

Typically, hardware wallets have a pin.
Some, also have an extra password with magical powers: It acts as an extra seed word, so you can actually have many accounts. There is no wrong password. Depending on the password you type, it (re)creates the account. If someone ever forces you to unlock it, you can tell them the pin and that other password you have with 0.1 BTC in it.
Such wallet is the Trezor but I read recently that Nano ledger will have a similar feature soon.


How does Ripple decide on the exchange rate between different currencies? When A pays in USD but B receives EUR, how exactly does Ripple decide on the EUR/USD exchange rate?

Since Ripple has an integrated exchange, I guess it simply places market orders in its order book, trying to get the best overall price.

You find the order book in Advanced/Trade, if you want to try manually.


Will mining significantly increase the power consumption of my PC? I have a PC that is always on 24/7. I use it as an SSH and backup server, and it has a modest, not-too-great GPU that sits idle most of the time.

I hear a lot of talk about mining not being cost-effective for most people because electricity isn't free. However I'm already paying the electricity bill for my PC. I might as well let it sit and mine all day while it's on, right? Maybe help pay the electric bill?

Or will mining increase my PC's power consumption so much that it's still not worth it?

Yes it will. The component you're likely to use for mining is your video card (GPU) which consumes very little power when idle but can consume a great deal under load. Check this list of common cards and consult the Watts (W) column for how many watts your card is likely to draw. Any card worth mining on will probably draw at least 100 Watts under full load. Depending on the electricity costs in your area, it may cost you more in electricity than your coins produced are worth. There is at least one good calculator to estimate your proceeds but you'll need to find out how much your local utility company charges per kilowatt-hour for electricity to determine if it's profitable. For reference Kilowatt-hours per day = Watts * 24 / 1000.


Sequence of Mining and Collecting Transactions I asked myself about the procedure of "Mining" and "collecting transactions".
The way I understand it both processes are always active running parallel. So I assume a node has somehow two queues: one with the transactions of a block which they are currently mining and another one active collecting the transaction which will be part of the next block. So once a node found the nonce to a block it broadcasts the whole block. All nodes immediately start to mine a block containing the hash of the new (previous) block and the transactions (or a part) they were collecting while mining the previous block.

I already read When does a miner decide to stop collecting transactions and start calculating hashes to try to win?
but like to have a confirmation of my understanding.

Thanks in advance

There's a 'mempool' of unconfirmed transactions maintained uniquely by every node, ordered by fee-rate. Miners select a template based on these transactions that is most profitable for them. If they solve a block, or someone else solves a block, those confirmed transactions contained in the newly seen block are stubbed out of the mempool and a new template is formed from what's left.


I made a $60 transaction to my BTC wallet and I’ve only received half of it ands it’s been 4days Can someone pls help or explain to me what’s going on.

I put $60 in the Bitcoin atm so I can covert the $60 into bitcoin but only half of my money is in my wallet

Bitcoin ATMs charge fees for currency exchange. Sometimes they use jaw-dropping spreads on exchange rates. They are usually very expensive. Possibly more so for small amounts. Check your receipt.

If you think the machine made a mistake, contact the operator (don't contact the owner of the floorspace, they mostly just rent the floorspace they don't own the machine).

  and it’s been 4 days

Waiting longer won't make any more BTC turn up. The transaction is done.

Footnote/Digression:

Bitcoin ATMs are not Automated Teller Machines (ATMs) they are automated currency exchanges, a different thing. Calling them BTMs is marginally better.


How are keys for lightning channels currently created? Keys for creating lightning channels seem to be derived differently than in usual bitcoin wallets. Lightning node data corruption, despite backup of master seed phrase, seems to prevent recovery of channel keys. How are channel keys currently derived, and why is recovering these keys with a corrupted node extremely difficult?

This question is in response to #3 of the following video (timestamped) https://www.youtube.com/watch?v=5fMv8MpzLgQ&feature=youtu.be&t=143

While I have experienced the same situation as the person described in the video the information is only partially true.

It is very well described in BOLT 03 how keys are being derived. The general derivation of the keys you are looking fore is described in this formula:

  privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)

so what you can see is that your secret is added with a per_commitment_point which contains information about the channel state. This is done to increase your privacy and is the reason why lightning nodes need the channel state in order to derive the keys from your seed.


Where on the web can I find out the current total blockchain size? This question partially asked the same thing, but only got a response for viewing the size when you have the client installed.

I want to know the total blockchain size without having to install the client and download the blockchain.

Blockchain.info has many useful stats.

http://blockchain.info/charts/blocks-size


How do I calculate the witness commitment hash for a given block? From my understanding, every SegWit enabled block has an added output script which is used as a place to store the "Witness commitment" specified in BIP 141.
One issue I've stumbled upon was calculating the commitment hash value only given the raw block/transaction data.
For example, I've chosen Block #542213 as it only has 4 total transactions (including the coinbase generation)
Coinbase witness commitment script:
OP_RETURN OP_PUSHDATA(36) [aa21a9ed4a657fcaa2149342376247e2e283a55a6b92dcc35d4d89e4ac7b74488cb63be2]

BIP141 states that the pushed data can be broken down to the following:
0xaa21a9ed - Commitment header (seemingly random)
0x4a657fcaa2149342376247e2e283a55a6b92dcc35d4d89e4ac7b74488cb63be2 - SHA256(SHA256(witness root hash|witness reserved value))

The documentation mentions that the witness root hash can be derived similarly to the merkle root in a block header, where each wtxid acts as the txid would in a traditional header merkle root.
To test this, I'm using this PHP script kindly provided on a different thread. This generates the merkle root used in the block header perfectly (that is not what I am trying to do, but what I have done to verify the code actually works).
Our example block has 4 transactions. Only two of which have witness data (coinbase and this tx).
The commitment structure states that the wtxid of the coinbase transaction is always:
0x0000000000000000000000000000000000000000000000000000000000000000

and every other wtxid act as a leaf.
My first question:

How are transactions that do not have witness data effected in the witness hash? Are they entirely omitted?

Assuming that the non-witness transactions are just omitted entirely from the merkle tree, I simply add the coinbase and the one transaction with witness data's  wtxid into the array like so:
$txids = array(
    '0000000000000000000000000000000000000000000000000000000000000000',
    '6c6e3849acf1b570db352dc08f7776e99c344a56fbb2f019e1865d1b6e044889',
);

The result being: 3a84e2f2f1bcd42141b58f2acd9497296c9f2d710cc2164669ef6d7e3870dfe9
My second question:

Where does the (concatenated?) witness reserved value come from?

Here it states:

The witness reserved value currently has no consensus meaning, but in the future allows new commitment values for future softforks

But it is still unclear to me what this value actually is before the hash is computed.
Please feel free to correct any inconsistencies or problems with my train of thought so I can improve my understanding for this part of segregated witness.

How are transactions that do not have witness data effected in the
  witness hash? Are they entirely omitted?

It will still include transactions that are not witness, it will just compute the normal hash to use as a leaf in the tree. See BlockWitnessMerkleRoot() in src/consensus/merkle.cpp and ComputeWitnessHash() in src/primitives/transaction.cpp:

uint256 CTransaction::ComputeWitnessHash() const
{
    if (!HasWitness()) {
        return hash;
    }
    return SerializeHash(*this, SER_GETHASH, 0);
}

Also, you are forgetting to reverse endianess, and hash the witness reserved value 0000000000000000000000000000000000000000000000000000000000000000 (from the last 32 bytes of the coinbase input witness). So step by step:

$ reverse_endian 66beaceb4be99da1e9824448231ab4fd37bacaee912381e779b37cf0e1dadad7
d7dadae1f07cb379e7812391eecaba37fdb41a23484482e9a19de94bebacbe66

$ reverse_endian aecb37e25954e15489e25548eb663ffdfd8a1362cac757ad62e9614453d2a577
77a5d2534461e962ad57c7ca62138afdfd3f66eb4855e28954e15459e237cbae

$ reverse_endian 5b211bc589cbdf5ad86cab1e2fe91f01c8ab934d21536b35864d30a3ff778456
568477ffa3304d86356b53214d93abc8011fe92f1eab6cd85adfcb89c51b215b

$ hash256 0000000000000000000000000000000000000000000000000000000000000000d7dadae1f07cb379e7812391eecaba37fdb41a23484482e9a19de94bebacbe66
d822d7717f284b89ea6a97874af567e9887a26a9f7db449ce02377d8fae4643f

$ hash256 77a5d2534461e962ad57c7ca62138afdfd3f66eb4855e28954e15459e237cbae568477ffa3304d86356b53214d93abc8011fe92f1eab6cd85adfcb89c51b215b
c182a158773ea7fc7a252fa725fc726de2a171088b40528ca00de0569fe53afe

$ hash256 d822d7717f284b89ea6a97874af567e9887a26a9f7db449ce02377d8fae4643fc182a158773ea7fc7a252fa725fc726de2a171088b40528ca00de0569fe53afe
30d002641e0eb81b11c3d14f4b120e80b4c06bcb3d34d90a5a606ca85e90c841

$ hash256 30d002641e0eb81b11c3d14f4b120e80b4c06bcb3d34d90a5a606ca85e90c8410000000000000000000000000000000000000000000000000000000000000000
4a657fcaa2149342376247e2e283a55a6b92dcc35d4d89e4ac7b74488cb63be2

Which matches the op_return data in the second coinbase output: RETURN PUSHDATA(36)[<aa21a9ed> <4a657fcaa2149342376247e2e283a55a6b92dcc35d4d89e4ac7b74488cb63be2>]

  Where does the (concatenated?) witness reserved value come from?

I alluded to this before, but it is in the witness field of the coinbase input:

  the coinbase's input's witness must consist of a single 32-byte array
  for the witness reserved value - BIP 141


Is bitcoin subjected to DOS attack? Possible Duplicate:
  What protection does Bitcoin have against Denial of Service (DoS) attacks?

Assume I am a malicious user, and my goal is to make bitcoin unusable.
I can simply make millions or even billions small transactions between a few of my accounts. (This for sure can be automated, and these transactions are for sure legit?)
Since bitcoin tracks every single transactions, is it subjected to DOS attack?
The size of the transaction table on each client will eventually get huge and impossible to query or performance more tasks???

The Bitcoin client requires a transaction fee to be paid for low-priority transactions. Transactions of the kind you describe are low-priority, thus the cost of such an attack will be prohibitive.


Where can I find code that allows me to calculate Z1 and Z2 from an ECDSA signature? By following Recovering Bitcoin private keys using weak signatures from the blockchain, I am able to do other calculations, but I have no idea how to calculate Z1 or Z2. There was a public code available by Sean Bradley:

http://2coin.org/tx.asmx?op=GetTXExtended

But it does not seems to work now. Is there some other public code to calculate Z1 and Z2 in any language. I can convert it to the language of my preference. Any help is appreciated.

According to Nils's post, the z values are the hashes that get signed in the ECDSA formula.  Background on what data goes into these hashes can be found on the OP_CHECKSIG wiki page and Krzysztof Okupski's excellent developer reference PDF.

Bitcoin Core's code for generating the hashes is here.  Any other Bitcoin application that signs transactions (or verifies signatures) must have a compatible function (at least for the default SIGHASH_ALL), so you should be able to find an implementation in pretty much any popular programming language.


Where to find my bitcoin cash (BCH) Prior to the split I moved my bitcoins offline from Coinbase to my local Electrum wallet (Original wallet) since at the time Coinbase said they were not going to support bitcoin cash..

After the split I then created a new wallet with a new seed and moved my bitcoins to that new wallet (BTC wallet). I then created a new wallet with the original seed and moved my bitcoins from my Original Wallet to this new wallet (BCH Wallet.) Each of these new wallets showed the correct amount of bitcoins. Presumably one was the old bitcoins and the other was bitcoin cash, although the only way to tell was by how I named the wallets.)

My understanding from all the online procedures was that I should have ended up with my bitcoins in the BTC wallet and bitcoin cash in the BCH Wallet.

I later moved the coins from my Electrum BTC wallet back up to Coinbase. Since Coinbase doesn’t yet support BCH I then tried sending my BCH to Kraken, but I get an insufficient funds message. All my offline wallets show a zero balance. Did I in fact never have two separate bitcoin amounts, original as well as cash? Have I in fact lost my bitcoin cash, or did I ever really even have it?

If my bitcoin cash does in fact exist, where would I go to find it?

Any help appreciated.

I downloaded Electron for Linux which I then executed.  It picked up my keys from the original Electrum that was on my desktop.  It automatically showed the correct number of Bitcoin cash tokens, presumably having taken this data from the Bitcoins that I had originally downloaded from Coinbase into Electrum before the fork.  I then uploaded this Bitcoin cash into a Kraken online wallet so that it would be available for trading.


BTC-E API (Retrieve error) Is it normal to infrequently see errors retrieving trade/depth history by API from BTC-E? Or should I never see them.

I seem to be seeing at least one such error each day, I am running my script on an Amazon EC2.

Thanks,
Jon.

Yes, most exchange APIs fail at times. Add a sleep-and-retry to your code.


Where can I find a step by step tutorial on how to setup primeminer and join a pool? I'm new to Primeminer and couldn't find a tutorial on how to set it up. I have downloaded the Primeminer software and it seems to consist of only two files:

a .bat file
an .exe file.

Is that all there is?

Is primeminer universal for all cpu mining coins?

If you run primeminer and it connects to some pool, would the pool then send data back to your miner app, in order to crunch the data and send it back?

Probably, you are looking for this: http://www.peercointalk.org/index.php?topic=798.0

www.peercointalk.org - is a official forum of ppcoin and primecoin.

Short instruction for Ubuntu 13.10 Saucy Salamander x64:

# Update & upgrade repositories and install build tools
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install build-essential git

# Install xolominer dependencies
sudo apt-get install libssl-dev libgmp-dev libboost-chrono1.54-dev libboost-filesystem1.54-dev libboost-system1.54-dev libboost-program-options1.54-dev libboost-thread1.54-dev

# Get db4.8 source, compile and install
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
../dist/configure --enable-cxx
make
sudo make install

# Tell your system where to find db4.8
export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
sudo ln -s /usr/local/BerkeleyDB.4.8/lib/libdb_cxx-4.8.so /usr/lib/libdb_cxx-4.8.so

# Pull the xolominer source from github
cd
git clone https://github.com/thbaumbach/primecoin.git xolominer

# Go to source and compile the code
cd xolominer/src
make -f makefile.unix
# Start mining
./primeminer -pooluser=[xpm-payout-address] -poolip=[choose-your-server] -poolport=1337 -genproclimit=[threads-to-use] -poolpassword=[some-random-password-for-protection]