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.


BTC transaction is slow now. How come when buying at Exchange, it's immediate?

When you purchase bitcoin from an exchange, it does not require an "on-chain" transaction.  They have a ledger, but it is not a blockchain.  It's a simple database, like the one that banks use.

Remember that when using an exchange, there is always someone on the other side of your buy or sell.  When you buy, that bitcoin comes from someone who transferred bitcoin to the exchange with the intention to sell it.  That transaction did require an on-chain transaction, but it occurred before you showed up to buy.  If you were to withdraw your bitcoin, that also requires an on-chain transaction from addresses the exchange controls, to addresses you control.

You are correct to question how "legitimate" bitcoin stored on an exchange is.  Firstly, because bitcoin you leave on an exchange is not your bitcoin.  It is the exchange's bitcoin that they are holding on your behalf.  Think of any bitcoin you keep on an exchange as an IOU from the exchange to you.  Secondly, exchanges have become insolvent in the past, meaning that they have more IOUs issued than they have either bitcoin or fiat to back up.  As a best practice, only keep as much fiat or bitcoin on an exchange as you require for your trading.  All else should be stored elsewhere.


What happens to coins after Bitcoin Cash fork?

If you have 1 Bitcoin (BTC) before the hard fork, you will have 1 Bitcoin (BTC) and 1 Bitcoin Cash (BCC) after the hard fork.

Whether you can spend those BCC depends on who has control of your private keys.
If you currently keep your BTC on an exchange (Coinbase, GDAX, Poloniex, ...) you need to check their policy w.r.t. the fork, since they control your private keys for you.

Coinbase for example has expressed that they will not interact with the BCC blockchain. This means that you will not be able to spend/sell your BCC until they either interact with the BCC blockchain or release your private keys to you.

If you keep your BTC in a paper wallet, you have control over your private keys, and 1 BTC will indeed result in 1 BTC and 1 BCC after the fork.

Today the value of 1 BTC is roughly $2700. BCC futures were trading for $350 last time I checked.

What the value of 1 BTC + 1 BCC will be after the fork is hard to predict and is subject to demand and supply on the markets.


Merchant tool that will dynamically adjust the # of required confirmations based on network hashrate data

Pools can lie about their hashrate, and not claim to have solved blocks that were actually solved by them when. I would propose that this is the wrong method of dynamically choosing a confirm count.

Instead, my suggestion would be to dynamically set your threshold based on the value of the transaction. If someone buys a $1 digital good, you can send it to them immediately, because the loss of a double-spend is almost immeasurably small (it's a digital good anyway). If someone buys a $50 item that needs to physically be shipped, you can wait for 1 confirm before getting the item off the shelf and popping it in a box. And if someone buys a $100 000 sports car, well the paperwork will at least take a few hours to fill out and complete, maybe even a day or two, so you'll have worked through enough confirms to be reasonably sure of the safety of that transaction.

Right now I don't believe there is a merchant solution that does this, but it is somewhat trivial to build.


In Stratum protocol, whether the miners know the mining address?

Yes, it is possible. The coinbase outputs are embedded in coinbase2.

E.g. for a regular 1-output pay-to-pubkey-hash coinbase tx it contains the pubkey hash which can redeem the coins.

Check the stratum official documentation. It has a real-world example which generated raw block 000000002076870fe65a2b6eeed84fa892c0db924f1482243a6247d931dcab32.

The raw transaction output[0] looks like this:

{
  "value":"50.00000000",
  "scriptPubKey":"OP_DUP OP_HASH160 d23fcdf86f7e756a64a7a9688ef9903327048ed9 OP_EQUALVERIFY OP_CHECKSIG"
}

Or, in hex, 00f2052a010000001976a914d23fcdf86f7e756a64a7a9688ef9903327048ed988ac.

The miner gets this parameters from stratum:

"params": [
  /* job id    */ "bf",
  /* prevhash  */ "4d16b6f85af6e2198f44ae2a6de67f78487ae5611b77c6c0440b921e00000000",
  /* coinbase1 */ "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff20020862062f503253482f04b8864e5008",
  /* coinbase2 */ "072f736c7573682f000000000100f2052a010000001976a914d23fcdf86f7e756a64a7a9688ef9903327048ed988ac00000000",
  /* omitted, not relevant */
]

Notice coinbase2 contains the hex of the block output, including d23fcdf86f7e756a64a7a9688ef9903327048ed9, i.e. the pubkey hash (which you can derive the address from).


How do the nodes divide after a hard fork? Soft Fork?

After a hard fork, what happens to the full nodes? Say 11,000 BTC full nodes existed prior to the fork. Do all 11,000 end up supporting both BCH and BTC? Or does BCH start building it's own network of nodes. Not asking about miners, just about full nodes (although, it will help if you can address the mining nodes as well).

A hard fork means that a new set of consensus rules is being used which splits the blockchain into a blockchain following the old rules and a blockchain following the new rules. There is no "in between" for a node to follow both rules and nodes are not typically equipped to simultaneously support two blockchains.

In the event of a hard fork, the nodes which support the new rules and the hard fork's activation rules will separate from the nodes which do not support the new rules. They become their own network and have their own blockchain. This applies to all full nodes, which miners are a subset of.

So in your example, none of the nodes will support both BCH and BTC unless they were specifically designed to do so. The standard behavior (i.e. nodes using Bitcoin Core for BTC or Bitcoin ABC for BCH) is to only support one chain whose consensus rules are hard coded. Some of those 11,000 nodes will have the BCH rules so they will split from the other nodes which do not have the BCH nodes.

  Also, in the softfork scenario, I believe the 11,000 nodes are divided - say 7000 support the softfork (e.g. Segwit) and the remaining 4000 do not. In that case, how do transactions remain legit between the supporters and non supporters.

A soft fork is backwards compatible with old nodes. It must be designed in a way such that old nodes will not be kicked off of the network after the activation of the soft fork. So for soft forks, the soft fork was designed so that transactions under the new rules are also valid under the old rules. For segwit, this is done by stripping out the segwit specific components which are completely new so that non-segwit nodes are able to parse and validate the transactions.

In a soft fork, there is no chain split and all 11,000 nodes are still using BTC and following the same blockchain.


How do wallets know that address is not duplicated if I'm going to make one?

Are we just relying on big numbers(2^160)?

Yes

  or Does Bitcoin system has some function to prevent duplicate?

No


From #bitcoin IRC channel at freenode:
17:41 <fireduck> jasan: I don't understand the question.  In the bug you pointed it to, it seems that ghash got block X, and was in the processing of sending it for validation.  Then the bug poster got block X+1 based on that
17:42 <fireduck> but bitcoind hadn't processed/validated block X yet, so it rejected X+1
17:42 <fireduck> this is what I would expect.  The mining pool software should have waited and retried a few times.
17:42 <fireduck> The coinbase address has nothing to do with this
17:42 <jasan> fireduck: Thank you for thinking about it. Yes, my question is slightly off-topic from that issue itself.
17:42 <-- melande1 (~melande@gateway/tor-sasl/melande) has quit (Remote host closed the connection)
17:42 <fireduck> other than each block has one (or more)
17:43 <fireduck> ah, I think i understand your question
17:43 --> melande1 (~melande@gateway/tor-sasl/melande) has joined #bitcoin
17:43 <fireduck> Lets say you could observe all stratum calls and all work submits for all mining pools in existence ( a tall order)
17:44 <fireduck> would that help you solve blocks faster?
17:44 <jasan> Yes. Nicely rephrased.
17:44 <fireduck> (making sure I understand the question)
17:44 <fireduck> cool.  That would not help at all.
17:44 <jasan> OK. Thank you.
17:44 <fireduck> Each of those mining pools is using a differnet coinbase with different addresses, values, nonces, etc
17:45 <fireduck> So knowing the state of all that won't help you find a solution to your address
17:45 <jasan> Originally I thought the issue author is suggesting otherwise, but then I even re-read the issue and realized it says something else.
17:45 <fireduck> got it.  The issue is a little hard to parse.
17:46 <jasan> fireduck: Thank you! I really appreciate your answer!
17:46 <fireduck> no problem.  I've written mining pool software so this in the area I've worked in


Bitcoind Keypool Best Practices For Web App

Consider using hierarchical BIP32 wallets. You can generate the addresses with various tools (e.g. sx) or natively in your web app. Then you can import the keys to your bitcoind node in order to manage them. If needed, you can have multiple bitcoind nodes and load-balance the keys among them (e.g. having X customers per node).

The great advantage of BIP32 wallets is that you only need to perform the backup once - at the beginning, since all the keys are derived from the initial seed.


What motherboard should I use for alt coins mining?

I suggest you use this motherboard: http://www.asrock.com/mb/intel/h81%20pro%20btc/

Its one of the most used for mining rigs, since it can hold a lot of gpu's


The whole block header is hashed including:

Block version number
256-bit hash of the previous block header
256-bit hash based on all of the transactions in the block (hashMerkleRoot)
the current timestamp as seconds since 1970-01-01T00:00 UTC
Bits (updated when he difficulty is adjusted)
Nonce

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


Blockchain is showing 2 incoming addresses for a transaction?

It came from both.

Transactions can have multiple senders and multiple recipients.

Sometimes a single address can also be both a sender and a recipient.


Just installed armory + bitcoinQT synced. It takes a total of 40GB of space?

From the Armory web site, regarding Bitcoin-QT and/or Bitcoind:

  Regardless of which one you use, it will download the entire blockchain (12-20 GB at the time of this writing).  The latest version of Armory will effectively double that storage requirement ...


I think the least "intense" option here would be to look up each of the wallet addresses from your ckey items on a node (i.e. blockchain.info blockchair.com btc.com etc) to see which ones have any value in them.
Once you have a list of the wallet addresses that are "worth recovering," you will need to take those ckey items' encrypted private keys (possibly along with data from the mkey item) to attempt to manually decrypt/recover your private keys to those wallets.
If you're experienced with programming, you could read through the code from the version of bitcoin core you used in 2014/2015 to figure out how it was encoded. Otherwise, you may need to find an experienced programmer you can trust, to help here.
As a post-note:
Have you tried re-compiling a copy of that older version of bitcoin core on a sandbox system? It's just a try, but maybe the file just got caught by a reverse-compatibility issue!


How does exchanges, such as coinbase handle off-chain transaction?

Yes, exchanges tend to have huge cold wallet where they amass and send most of their bitcoins ( you can even follow those addresses by each exchange on the top 100 richest bitcoin addresses )

When a user want to withdraw fund they can use smaller hot wallet to send coins, some exchanges will use payment channel for the transfer but most have not adopted it, or choose not to.

For more detail about how they do that you can check this question How do cryptocurrency exchanges handle users' accounts?


how can i get rid of a zombie channel in LND?


Blockexplorer.com runs a testnet node all the time.


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.


What is the actual Bitcoin block size? 2mb or 1mb?

The cap on the block size excluding witness data is 1000000 bytes.

There is no cap on block size including witness data. Instead, there is a limit on the block weight at 4000000 weight units. Depending on the composition of the block, 4000000 WU can correspond to anything from 1000000 bytes to close to 4000000 bytes (including witness data).

But a block with 4000000 WU is "full" - regardless of whether it's 1 MB or 3.8 MB of data.


Wallet loading failed: Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex

I was able to solve the problem for the moment by reindexing the entire bitcoin core wallet, making sure that pruning was disabled in the settings. This allowed me to access my funds again. I'm not sure what caused the issue in the first place.


Basing on this set of data from XKCD, world's GDP is $62,900,000,000,000, If all of it was expressed in 21 million bitcoins, then each bitcoin would be worth $2,995,238.10, so roughly 3 million dollars.


How much will transaction fees eventually be?

I read that the market will find the equilibrium how much these transaction fees will be.

It will not.  This is perhaps the biggest flaw in Bitcoin at the moment: once mining rewards end there is no direct linkage between the amount of hashpower needed to secure the network and the incentive to mine.

True, there is a limit on the blocksize, so if the transaction volume in a block window (approximately 10 minutes) exceeds the block size you can expect a miniature "auction" where transactions fight for space in the block by bidding up the minimum transaction fee needed to get in.  However this isn't really a closed-loop adjustment: the maximum blocksize is an arbitrarily chosen number, and there's no reason to believe the maximum blocksize is small enough to ensure that transaction fees are high enough to incent enough miners to mine to keep the system secure.  Unlike the difficulty and the USD/BTC exchange rate it does not respond to market activity.  It also has the negative side effect of capping the worldwide Bitcoin transaction throughput since other parts of the protocol rely on the assumption that blocks are created -- in the long run -- no more than once every ten minutes.

Compare this to the current situation with mining rewards: the more valuable a bitcoin is the more incentive there is for somebody to try to overwhelm the "good guys" by gaining 50%+1 hashpower.  However, the more valuable a bitcoin is the more miners will mine!  It isn't perfect, but the important point is that the demand for security increases the incentive to mine.  Note that although the difficulty will go up, that simply ensures that the reward granted every ten minutes is an approximately constant number of BTC -- the number of terahashes/sec fighting over that amount of BTC is free to respond to changes in their changing value (as measured in terms of all other goods in the world, including other currencies).

As the mining reward is reduced this "direct coupling" between the network's need for security and the incentive to mine becomes progressively more diluted.

I worry a lot about what will happen to Bitcoin once we decouple those two forces.  I think the developers ought to at least come up with a story on how this will be solved so people can start testing it.


how can i get blockchain private key using just my wallet address

This is exactly what is supposed to not be possible and gives value to the blockchain. So, unless you have an advanced quantum computer at your disposal I'm afraid you will not be able to do it.


Who implemented BitcoinPayment at the Bitcoin wiki?

The history of the page suggests that Nanotube, MagicalTux and Rdymac were the last that edited the page.

The first two of them have contact instructions on their Wiki profile, only the latter does not.


Hypothetical situation: the Internet gets split in two, what happens with Bitcoin?

Any of the "pirates" with nodes on both networks and who have unspent coins in the blockchain before the split would be able to spend those on both networks, for as long as the network is split.

Upon joining again, the longest chain will always prevail. So anyone who mined any new coins after the split and those were mined on the shorter of the two chains will lose all those new coins -- they will become invalid.

Anyone who spent coins that existed before the split, but spent them only on the shorter chain, will have those coins returned to him/her after the join, because they were only spent on the shorter chain (which is discarded and invalidated)

In short, the bitcoin network will take it in stride :) but some people will lose, and some will benefit doubly.


What happens with the transactions a miner didn't include in a block?

Transactions A,B,C will be validated and added to the miners memory pool just like any other node does. If A and B are the only ones added to the next block then c will remain in the memory pool and will later be joined by D. So C and D will remain in the memory pool until they are added to a new block while A and B will form part of the new block. If the miner is successful in solving the proof of work then his block will be propagated to other nodes and if it is accepted it will added to a chain. When the miner receives a new block from the network, then the software does check if the new block has transactions that are in its memory pool and will remove any transactions from the memory pool if it is in the new block.


Handling negative "s" values for signatures?

Let us denote curve_order by q. When computing a signature (r,s) it is important to remember that r and s are meant to represent elements of Fq (the field of integers modulo q). The formula s = k^(-1)(e + rx) is an algebraic expression in Fq. So r an s are not really integers, they are integers modulo q (so for example two integers u and u + q represent the same elements of Fq). When implementing a function returning (r,s) there is nothing wrong with internally representing these quantities as integers. But when it comes to returning values, you have to decide how you wish to encode the values r and s. If s represents your implementation specific integer, do you simply want to return s? or s + q? or s - 3q? All these answers are the same (simply different encodings) but there is little chance you will match a test-vector unless you have a common encoding with it. When returning an integer s modulo q it is customary to encode s as the unique integer s' with 0 <= s' < q equal to s mod q.

So for example, when you say that test_s = my_s + curve_order, you effectively agree with the test, but have not enforced the usual encoding. When you say that test_s = my_s * -1, you genuinely disagree with the test but this is explained by 'standardization' (so make sure that you have 0 <= s < q and if s > q/2 replace it by -s, but make sure you encode -s as an integer within [0,q), which means s should in fact be replaced by q - s).


Notifications on low balance of a bitcoin address

blockonomics will mail / send you push notification whenever there is transaction on your address. Doesn't have a feature for low balance yet, but should be straightforward to implement.


bitcoind cannot keep up with the blockchain

OK, apparently, the problem was with the Ethereum daemon running on the same machine and that I had forgotten. top and free showed there was still CPU and RAM available but, when I stopped the Ethereum daemon, Bitcoin was able to get up to date. A bit strange.

% bitcoin-cli getblockcount
493316


What would be the value of Bitcoin if coin generation was complete and Bitcoin was strongly accepted today?

If it so happens that bitcoins are as widely accepted as USD are today, then yes that's a roughly reasonable estimate.

You might enjoy the following link for some more thoughts along these lines:
http://falkvinge.net/2013/03/06/the-target-value-for-bitcoin-is-not-some-50-or-100-it-is-100000-to-1000000/

(One side note: just because new bitcoins are slated to stop being created in 2140, that doesn't mean no more new blocks will be created. Blocks are essential to record transactions, and they'll continue being appended to the blockchain even after the bounty drops to 0.)


Can any Bitcoin client do local peer discovery and blockchain synchronization?

The Bitcoin.org client can be launched with the -connect= parameter.

Simply have it connect to another local node and no outside connectivity occurs.

But once it is caught up to the latest block, the amount of bandwidth is relatively trivial.  There's no reason to do this to save bandwidth once a node has been brought current.


Yes, if you're transacting with bitcoin, you will need vendors that accept bitcoin instead of cash. Furthermore, the clients and vendors will most likely need internet access in order to send bitcoins from one person to another.

It would probably help to know a little bit about how bitcoin works and how it's a global ledger system based on the blockchain. This answer should enlighten you a bit about the requirements.


What does the US government do with seized coins?

Property seized is held until a conviction, then sold at auction.   If there is no conviction, property may or may not be returned to the rightful owner.


Under what conditions could a change address immediately send the entire balance to a third-party address?

Generally, this should not happen. The situations this can happen should be limited to:

bugs in the software
malicious acts by the software

to resolve this you will need to look up the transaction on a block explorer and document all relevant information, including the block height, transaction id, inputs spent, target address, change address and possibly the miner that relayed the block.

armed with this information you then reconfirm in you wallet and doublecheck for deviations, and if necessary contact the developers of the wallet.

if they cannot help, you should at least be able to ask new and more precise questions here afterwards.


how to generate bitcoin adddres using seed?

Using bitcoinjs-lib and bip39. You can install those with npm install bitcoinjs-lib bip39 --save

const Bitcoin = require('bitcoinjs-lib');
const Bip39 = require('bip39');
const Bip32 = require('bip32');

function getAddress (node, network) {
  return Bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address
}

const mnemonic = `entire taste skull already invest view turtle surge razor key next \
buffalo venue canoe sheriff winner wash ten subject hamster scrap unit shield garden`;

const seed = Bip39.mnemonicToSeed(mnemonic);

const root = Bip32.fromSeed(seed, Bitcoin.networks.bitcoin);

const child1 = root.derivePath("m/44'/0'/0'/0/0");
const child2 = root.deriveHardened(44).deriveHardened(0).deriveHardened(0).derive(0).derive(0);

console.log(getAddress(child1)); //1ENQm8nEP7sd6dqXbAMYZ4AuqcP8Y7AtR
console.log(getAddress(child2)); //1Hb6Z1uZ1RuZ6GXTvedQ2ETYKYsMc5qynN

You can check the code is working using this website. You might also want to read up a little about BIP32, BIP39 and BIP44. An executive summary below:

The BIP32 describes how you can generate new child keys programmatically from a single key and a few other properties.
BIP39 defines a set of standard words used to mimic a key and how to transform them back to the original "seed" (the key from BIP32).
BIP44 specifies how you should compute the child keys from the parent one. You can see from my code that I used derivePath("m/44'/0'/0'/0/0"); in conformance of its specification.


Is it possible to rebalance channels by sending to yourself (from a channel to an other) in c-lightning? How?

Natively c-lightning does not support paying invoices to yourself. But I have provided a trick described in this video: https://www.youtube.com/watch?v=Dwl-0cY6KkU&t=1s:

The trick is to create an invoice and then use getroute to find a route to some node and then go back (possible over another route with another getroute call). once you have such a circle the sendpay command. While getroute does not find a route to yourself the sendpay does not care as long as the onions are great an the payment hash exists.

This trick can be used to do spontaneous payments (as described in my video) or to rebalance your channels. The full code for spontaneous payments can be found on my github lightning helpers repo. The python code would have to be adapted a little bit to your needes but that should be fairly straight forward. Ping me if you need help.

On a side note. I balance my channels be decreasing my routing fees because then people will do it for me and I still earn something instead of me paying fees for rebalancing.


How are eth transaction faster than btc?

Most simple and foreseen reason:

Bitcoin's blocktime is set at 10 minutes,
while Ethereum has a block every 10-20 seconds, making it much faster.

  See Ghost protocol, https://www.cryptocompare.com/coins/guides/what-is-the-ghost-protocol-for-ethereum/

So no, bitcoin will probably never be able to match Ethereum's speed. ( In it's current state)

(Unless they would implement something like the lightning network.)


How to reclaim unclaimed Bitcoins sent via Blockchain.info to Facebook/Email friends?

Under Receive Money, Archived, find the address in question ("username (Sent Via XX"). Click this button to bring it back to active addresses:

Under Send Money, Custom, send all the money from that address to another address in your wallet. You can now archive the address again.


How to get notification on bitcoin receive with bitcoin core

walletnotify executes once per every unconfirmed transaction creation (incoming/outgoing) and once more once the transaction is mined into a block (gets it's first confirmation).

I am not sure what are you developing, but as far as I see it both notifications are essential:
The first one to let the customer know that his transaction had been recorded, and the second to know that the value was indeed remitted, with enough fee, and will not be double spent.

For more info please review the official documentation.
https://en.bitcoin.it/wiki/Running_Bitcoin


May be your transaction was stuck in the mempool and only got confirmed after the fork happened .
There is nothing you can do now


I sent bitcoin to someone and did not get paid

Does Bitcoin have a function that would allow the BTC you sent to be returned, No.

The only way to get the BTC back is if the recipient makes a new transaction sending the Bitcoin to your receiving address. If the recipient will not do this, you may think about contacting a lawyer.


Abe does exactly what you want. I will walk the entire blockchain from bitcoin-qt/bitcoind and populate a local database. It supports several database backends including sqlite, Postgres, MySQL and Oracle.

It will take quite some time to walk the blockchain and populate the database, possibly a few days.

It has a web based interface that is very similar to blockchain.info and blockexplorer.


Standalone Java Bitcoin Miner - Does it Exist?

Does it Exist?

No

This is because a Java app that uses the CPU to attempt to mine Bitcoin will not be able to mine Bitcoin. There is no good incentive for anyone to create such a thing.


Stop send btc, only reciev

Bitcoin Core

So far as I know, there isn't really good support for this in Bitcoin core.

The safest way is to remove your private key(s) from the wallet.

You could archive your existing wallet (and test full recovery carefully) then set up a watch-only wallet using importaddress

However note that this does not generate new receiving addresses for you, If you use a new receiving address for each transaction (as you should) than you'll have to generate each address  externally and import it into the watch-only wallet.

Other wallets may have better support for this.

Offline Wallets

You don't actually need a wallet to receive payments, so long as you don't mind

the consequent loss of privacy from using a single receiving address.
the need to trust a third party blockchain explorer to monitor payments received.


Most of the exchanges divide their funds into hotwallets and coldwallets. Hotwallets usually are made of one bigger aggregate-address known publicly and a set of deposit addresses assigned to specific users.
When it comes to coldwallets the case is pretty easy, usually it's a hardware wallet or hardware wallet multisig scheme which exchange only uses manually or through some watch-only features.
When it comes to hotwallets, a lot of exchanges have multisig schemes or just API access to services of external vaults, like Bitgo, or Casa. Mostly because security of hotwallet isn't that trivial. Many exchanges decide to work with their own custody solutions and many times it doesn't work that well.
There are some solutions though, which are both fairly cheap and dosn't require external service fees, but fairly secure, like the multisig scheme with coldcard wallet (CKbunker) that aims to automatize spending rules.
It's important to notice that even that most of the cryptocurrency exchanges are under scrutinized regulations, these regulations aren't there to protect the users, but to enforce the possible exclusion of some parties from using the cryptocurrencies.


What are some proposed privacy features coming to the bitcoin lightning network?

I am not sure if I get your question right. Please tell me if not and I shall iterate on my answer.

First of all the lightning network indeed has a different privacy model only opening and closing of channels is stored to the redundant public ledger called blockchain. Once the channel is open even when routing is applied the payment itself is pretty private.

I have been told that people work on a truly decentralized marketplace on top of lightning. Obviously payment or exchanging of goods and currency seems like an obvious application.

In a similar direction I believe selling digital goods and file-sharing can be powered on top of lightning as it does not require the person who is shopping to register an account. Any digital good could be symmetrically encrypted with the preimage of the invoice as the key

I know that the people from bhb networks are trying to build the rgb protocol on top of lightning which would give colored coins and the ability to issue tokens which could also be transferred via lightning.

On a protocol level there is an ongoing effort to implement rendez vous routing which is an improvement over onion routing. With rendez vous the person getting paid will be able to hide the location of his/her private node it might maintain by proving the remainder of an onion with the issued invoice making a payment from some rendez vous point to the payee.

I personally suggested JIT routing which would produce less routing failures and thus keep channel balance private.

As mentioned I hope your question was meant to go in this direction.


Could an old, unconfirmed transaction fail to be processed because it is no longer deemed to have enough fees

If that does happen, all you need to do is spend your unconfirmed transaction's output with a sufficient fee. A "sufficiently greedy miner" will process both transactions just to get the fee of the latter.


Proof of Work (the proof that "maths puzzle" was solved) serves a variety of purposes.  The primary purpose being to determine the "first" miner whose block should rightfully be accepted as the next block in the chain.  If there was no cost to proposing the next block, there would be far too many candidate blocks and the network would split too often.

With Proof of Work, the network can determine which miner has earned the right to mine the next block by having expended the electricity to produce the hash that meets the difficulty level.


How to import BCH address into Exodus wallet?

Exodus co-founder here...

Take your Bitcoin private key, and move the funds via the Bitcoin Cash private key import/move. Note, this moves the Bitcoin Cash only from the private key into Exodus. Here's how this can be done: http://support.exodus.io/article/87-can-i-import-a-private-key

Note, you'll select Bitcoin Cash, unlike the article which shows Bitcoin.


Why does blockchain.info show the warning "Transaction rejected by our node. Reason: The transaction is not final"?

BTCJerk on reddit noticed that "Blockchain.info is having issues, the last block they show is 442341". Other block explorers were already on block 442349…

Since the transaction was timelocked until block 442345, and timelocked transactions are considered invalid until the appropriate blockchain height is reached, blockchain.info was still considering the transaction invalid due to its lagging behind.


Very slow sync on low end PC - what to upgrade?

Probably you are limited by slow hard drive. Even if you're pruning, the hard drive is still accessed. That means you should get a SSD hard drive.
There's a tool on Linux called iostat you can use to see where your computer is spending the most time.
iostat -y 1  # will repeat at 1 second intervals

If your operating system is installed on the non-SSD, then you probably will want to move that also, because operating systems read and write files while they work. For transferring the bitcoin sync progress you basically just need to copy the .bitcoin directory in your home folder, assuming you're on a Linux computer. Probably same for Windows but the directory location is going to be somewhat different.


Why is segwit support rising so smoothly?

because the number of supporting pools is a constant

and the percentage is calculated by last 2016 blocks after the start of signaling


How are nodes supposed to update their inclusion proofs with Utreexo?

Quick answer:

I don't see anywhere in the paper that describes how unused inclusion proofs are updated in this process

For a single block, a single batch proof is sent. There are no unused inclusion proofs since only one is sent. This "batch proof" proves the inclusion of all the UTXOs in the given block.
A "proof" that only proves the inclusion of a single utxo is only sent when for a transaction that would be going into the mempool.

how unused inclusion proofs are updated in this process

Since the proofs for a single utxo vary block to block, there isn't an "update" per say but a new proof is generated for every new block.
Longer answer:

I don't see anywhere in the paper that describes how unused inclusion proofs are updated in this process

To answer your question, we need to take a look at how accumulator proofs would differ when receiving a block vs receiving a transaction.
We recall that Utreexo is essentially a Merkle Tree. A Utreexo node is only required to keep the root of this tree. For a tree like so:
 14
 |---------------\
 12              13
 |-------\       |-------\
 08      09      10      11
 |---\   |---\   |---\   |---\
 00  01  02  03  04  05  06  07

A Utreexo node can only keep the root and still be a fully validating node. Such node's view of the tree may look like this:
 14
 |---------------\

 |-------\       |-------\

 |---\   |---\   |---\   |---\

A "proof" is all the utxos needed to hash up to the root. For the above tree tree, to prove the inclusion of 00, the proof would include the hashes of (01, 09, 13)
The verifying node would make a tree like this and hash up to the root. If the calculated 14 from the inclusion proof matches the 14 it stored, the 00 utxo is verified to exist.
 14
 |---------------\
                 13
 |-------\       |-------\
         09
 |---\   |---\   |---\   |---\
 00  01

To prove utxo 01, the proof would include the hashes of (00, 09, 13).
Notice the overlap in the proofs for 01 and 00. 09 and 13 are required by both 00 and 01. Furthermore, 01 is needed to prove 00 and 00 is needed to prove 01.
If given the above proof of 00, we can also verify 01:
 14
 |---------------\
                 13
 |-------\       |-------\
         09
 |---\   |---\   |---\   |---\
 00  01

Because a single block has a lot of these overlaps, we can just send one proof to verify all utxos being spent. There are no unused proofs to speak of.

how unused inclusion proofs are updated in this process

I find it helpful to not think of Utreexo as a black box that generates proofs but as a tree structure.
This tree is updated every block. So for every new block, the required proofs will change.
For the above tree of:
 14
 |---------------\
 12              13
 |-------\       |-------\
 08      09      10      11
 |---\   |---\   |---\   |---\
 00  01  02  03  04  05  06  07

If this tree is modified with the removal of node 07. The resulting tree will look like so:
  12
  |-------\
  08      09      10
  |---\   |---\   |---\
  00  01  02  03  04  05  06

Notice how the proof for 00 changed to (01, 09) from the previous proof of (01, 09, 13).
In the implementation, there aren't any "proofs" that are being kept and updated, but rather a single tree for a block in which the proofs are derived from.


These are indeed hard problems, but luckily already served by BTCPay Server, with extra features like lightning payments: https://github.com/btcpayserver/btcpayserver.

You can just run it via the included docker recipe (https://github.com/btcpayserver/btcpayserver-docker) and communicate with it via its API.

Or if you really want to reimplement the nitty gritty stuff yourself, look at its code or architecture documentation.


How do I send money from imported keys to my localbitcoin wallet?

First of all, there is no need for importing your private keys anywhere else if you want to keep them safe and inaccessible by third parties such as localbitcoins.info. You can simply create Output transaction from your desktop PC from MultiBit wallet to the public key that is presented in your account on localbitcoins.info.

For more information how to create transaction follow guide from Multibit - Send bitcoins


getrawtransaction asm returns with [ALL], should it be?

The representation of data is from site to site different. The hexcode "01" is a SIGHASH ALL Opcode, defined here.

I show here all the opcodes and their definition of your example. Basically sigscript of this example consists of . The signature is an ASN1 DER structure, followed by the public key as hex chars. Drilling deeper, it gets this:

49: OP_DATA_0x49:        push hex 49 (decimal 73) bytes on stack
30: OP_SEQUENCE_0x30:    type tag indicating SEQUENCE, begin sigscript
46: OP_LENGTH_0x46:      length of R + S
02: OP_INT_0x02:         type tag INTEGER indicating length
21: OP_LENGTH_0x21:      this is SIG R (33 Bytes)
02: OP_INT_0x02:         type tag INTEGER indicating length
21: OP_LENGTH_0x21:      this is SIG S (33 Bytes)
01: OP_SIGHASHALL:       this terminates the ECDSA signature (ASN1-DER structure)
21: OP_DATA_0x21:        length compressed Public Key (X9.63 form, 33 Bytes)

So [ALL] and "01" indicate the same. One format is showing the OpCodes (see also in the scriptPubKey section), one is plain hex representation, to make cut&paste easy. All opcodes are here.


Is there an efficient and secure way to transmit bitcoins over shortwave radio?

Although I am not qualified enough to suggest a protocol for over-the-air, I can still get some technical pointers. You may want to ask at the ham radio SE community.

Yes you can easily send Bitcoins over shortwave radio using encryption but radio encryption is not a topic of this community. It's also severely illegal in the U.S. for a HAM operator to use any kind of encryption when transmitting.

The Bitcoin network over-the-air

This is what I think you are asking, the Bitcoin protocol does not send private keys of bitcoins around as its main technique as this is risky and dangerous inherently. The Bitcoin protocol moves bitcoin without the need to exchange private keys of any bitcoin so it be better to just implement the network over radio.

Bitcoin can practically be agnostic to the protocol you are using, as long as communication is possible Bitcoin will work. There are many protocols for shortwave radio available that can move data from a transmitter to a receiver. As an interesting example, you could totally set up a node that communicated via Morse code as long as it has other nodes to talk to. You'd run into problems with bandwidth as some tx/rx modes are slow. You can possibly use a modified version of Bitcoin-qt and use the same handshakes and messaging it does over tcp/ip.

The HAM radio community has interesting an P2P by itself which you can look into. APRS is a packet-based network which relies on peers to rebroadcast messages, it's really cool and is readily documented and has many tutorials.


Is there a way to create a tx completely offline? Maybe with a script or cli commands?

assuming I know in advance how much bitcoin a UTXO has

createrawtransaction in Bitcoin Core requires tx id and vout, if you know it and the address which will be used for output then transaction can be created offline.

Then I also need to sign that tx, also offline

Signing will require private key or a wallet with private key depending on which of these RPC commands you prefer to use: signrawtransactionwithwallet or signrawtransactionwithkey

And finally I can pass the signed tx to someone via bluetooth, and then he can drive to an Internet connection, and broadcast the tx.

Sure. This is possible. I had even worked on a side project which can be used to send bitcoin with text messages (Internet not working but SMS works). You can even encode signed transaction hex in to words.
Related Q&A: Issues decoding the words to transaction hex

I'm pretty sure there isn't a wallet that does this, so this needs to be some special script or a sequence of cli commands

Cold storage (keeping private keys offline) is used by many people in which transaction signing is done offline. Transaction can be created on any device or wallet (online/offline) as long as you have information required to create transaction. For example: tx id and vout of UTXOs you are trying to spend.
RPC to create PSBT also requires same information. I am not sure about compatibility of different wallets so creating a transaction in one wallet and signing in other may have issues. However, I have tried creating a transaction and signing it in Electrum in this Q&A: Create unsigned tx (PSBT) in a watch-only wallet using bitcoin core, sign it in electrum and broadcast using bitcoin core
You can try one experiment:

Open Electrum Wallet. Copy one transaction id. Open it in explorer.

Disconnect Internet.

Open Bitcoin Core.

Create transaction with createrawtransaction

Convert to PSBT with converttopsbt

Copy the results and load transaction in Electrum Wallet. Sign it and copy the transaction hex.

Close all wallets. Open https://blockstream.info/tx/push in browser of any online machine.

Broadcast this transaction


Using Javascript, I want to generate a segwit private key (zprv) similarly to how I am generating my legacy base58 extended private key. How?

Key derivation for P2WPKH using the zpub/zprv version bytes is defined in BIP 84. So you can use bip84 library.
let bip84 = require('bip84');

const root = new bip84.fromSeed('rural catch say tooth tell soul road pilot fee board goose wedding')
const child0 = root.deriveAccount(0) // m/84'/0'/0'
console.log(child0)
// zprvAce8anvk7mGXLFgryEKx2b8tETAKuJRFXM1SRN4wuZDw2cwzxYuJ9PJdecA9MJAuAuchhh3cfLfN3SSL8agTL3tJARw6TmgvAKVgcfVcANm


It's certainly possible. I used to run a full bitcoind node on a 5 year old MacBook Air. I stopped (and moved it to a larger machine) because the size of the blockchain database was becoming annoying - it's currently 52 GB and always gets bigger. If you can spare the space, there's no problem with actually doing it.


How safe is sending out transactions using unconfirmed inputs for a service?

Safety is relative---large payment processors like Coinbase probably have non-block-chain anti-fraud measures.  However, a confirmation (and each additional confirmation after it) reduces the risk of a double spend fraud, so waiting for a certain number of confirmations is an easy and effective anti-fraud measure that doesn't cost you anything.

I don't know for sure what happened to MtGox, but it is true that an unconfirmed transaction can become effectively unspendable if any of its inputs become unavailable---which could happen because a block was created containing a transaction that already spent that input (a double spent) or because the transaction which created that input was added to a block in a mutated form (transaction malleability).


How do I make a profit buying cloud-hashing contracts?

I use this analogy for cloud mining:

  If you had a money printing machine would you rent it out or use it yourself?

Cloud mining -no matter how you consider it- makes no sense financially. If the company is making a loss, they'll be out of business, if they're making a profit, why aren't they making that profit directly?


What happens if I spend a bitcoin that has 1 confirmation?

When a transaction gets its first confirmation it is included in the blockchain. Barred unusual circumstances, the block that confirms it will become part of the longest valid chain and thus the transaction ever more reliably irreversible.

If you send a transaction to an exchange that waits for 20 confirmations, the previous transaction will have at least 21 confirmations when they accept the deposit. There is nothing you need to do with the first transaction.


Can I move my wallet.dat from Ubuntu to Mac OS?

If you are using release binaries, yes. You must make sure to shut down Bitcoin Core cleanly before moving the file over, though.

If you're using self-compiled versions, this is only possible if both versions are compiled against the same BDB library.


When a transaction happen, the miners compute a value called "prof of work". This value is calculated in order to get a 0 value (or something very closed to 0) for the hash of the value + the transaction + the last pow.

The miner does not perform the PoW on each transaction individually, but on a set of transactions, whose combined size is less than approximately 1MB when serialized (There is a 1MB limit for non-SegWit parts and 4MB limit for the entire structure including SegWit parts).

The set of transactions is placed into a structure called a block. The block has a header which contains, among other things, a timestamp, the target, a nonce, the hash of the previous block's header, and the merkle root of the set of transactions in this block. The actual representation of the transactions in the block structure is a simple serialized list.

Miners can choose which transactions they wish to include in a block and in what order. However, the usual method is to sort transactions by highest paying fee and select the first bunch of transactions which fit within the block size limit.

The merkle root is calculated by placing the transaction ids (the hash of the serialized transaction) into a binary tree where each parent's value is the hash of the concatenation of its two children's values. The value of the root of this tree is then placed into the block header, along with the other necessary information.

Proof-of-Work is then performed by taking a hash of this block header, and the proof of work is successful if the resulting hash is less than the value specified by the target, which determines the difficulty. The target indicates how many leading zeroes the hash must have - the more leading zeroes, the smaller the possible range of hashes becomes, making it more difficult to produce a matching hash. This difficulty is adjusted according to a consensus algorithm which attempts to make blocks created on average every 10 minutes - using historical data from the past 2016 blocks and their timestamps.

The Proof-of-Work is essentially brute-forcing the double-SHA256 of the block header by using different value for the nonce in the header until the resulting hash of the header is a value which is less than the target. The nonce can be randomly selected, but it is more sensible to simply cycle through all possible 32-bit integer values in order.

  But i have read the miner discover new bitcoins too. Is it another form of mining ? I do not see the link between the POW calculation and the new bitcoins)

Each block must contain at least one transaction in its set, which must appear first in the list. This is known as the coinbase transaction. Unlike other transactions, it has no UTXOs as inputs - but its virtual input is newly generated coins plus the aggregate of fees paid in all transactions in this block. Newly generated coins must be strictly less than or equal to 50 >> floor(block_height / 210000) bitcoin, which determines that the number of new bitcoins which may be generated is halved approximately every 4 years (210000 blocks).

The coinbase can also be used to include an extra nonce value because the nonce in the regular block header is too small (32-bits), and its entire range can be exhausted by modern miners more quickly than new transactions are added to the block. Mining pools also usually insert their name into the coinbase transaction so it can be public knowledge.


How to correctly implement the FEE increase using bitcoind?

You can use Opt-in Replace By Fee to do this. Bitcoin Core already implements support for signaling Opt-in RBF and for increasing the fee later (with some caveats).

When creating a transaction from the command line, the send* commands have an optional argument named replaceable. If you set that to true, then the transaction created will automatically signal that it can be replaced in the future. To increase your fee, you then use the bumpfee command. Note that the command currently only works if the transaction has a change output. The fee will be deducted from the change output.

Note that these commands and the arguments are not necessarily listed on the bitcoin wiki (it is frequently out of date). To actually get the full listing of RPC commands, their arguments, and how to use them, use the help and help <command> commands.


First time buyer, questions before I screw up

Yes, if you don't want the hassle of registering or giving your details to a website an ATM would be the better choice. Note that ATMs usually charge more than an online exchange.

They give you a bitcoin address and its QR code as well as a private key and its QR code.

The private key is all you need to have control and access of your coins on that address. The private key can be used to calculate the public key and the latter can be used to calculate the bitcoin address (which as I mentioned is given already for convenience).

Two very good mobile wallet apps are Mycelium and Airbitz. You can use the wallet app to scan the private key QR code and have complete access to that address (ie. send coins elsewhere). If you scan the address QR code you can check the balance of that address but not spend any coins from it.


If an attacker has write access to your database without you noticing immediately, it's pretty much Game Over.

Say you are actually able to secure the payout address field from tampering, then the attacker could still overwrite the password field with his own hash, log in as the user and change the payout address through the "allowed" way.

You should not worry too much about this scenario, but rather make sure no one will get direct access (read or write) to your database in the first place: Use prepared statements, grant minimum required access, harden your servers, etc.


Wallet balance showing as unconfirmed - SOLVED!

My problem was easily solved, I simply had to Repair Wallet - an option in the Manage Wallet sidebar choice. All fixed!


Is it yet possible to send a message to the wallet which receives Bitcoin when making a transaction?

No, it is not possible, and likely never will be possible.


Had you seen http://rootstock.io/ ?
Keep in mind that the bitcoin script language is not turing complete as the Ethereum VM


Which cryptocurrency server software supports the walletnotify feature?

Yeah, All bitcoin forks support walletnotfiy.

most digital-currencies have a walletnotfiy with some a few code changes.

that's a list of all Bitcoin forks


Bitcoinj only supports one user and one account per wallet. Because i think managing multiple accounts can make the API
unnecessary complex. Normally you would use one wallet per user and that's what happens
automatically if you use your OS to switch users.

Also

I would recommend taking a look at this if you're interested in using BitcoinJ with BIP44. You would have to have one instance of Wallet per "BIP44 account" but it can still work.


There is a site for that: http://blockchain.info/
Here you will find every balance for every address.


Actually, Litecoin-Qt/litecoind v0.8.5.2 and probably several v0.8 releases before do support these api calls.

The --help doesn't seem to have any entries on these commands but this is true of Bitcoin-Qt/bitcoind as well so if you want to submit a bug report or code it and submit a pull request, please do so at https://github.com/bitcoin/bitcoin.


I've sent a small low priority transaction with insufficient fee with blockchain.info wallet, what will happen next?

You can do two things

Wait until the transaction gets relayed. Transactions without fees usually get relayed as well, but often a later than those with a fee.
Send a new transaction spending the same outputs, with a fee. It's possible that some miner will accept it eventually. This can be tricky when you use blockchain.info's wallet. It's called double spending, you can probably find some information on that elsewhere, like on bitcointalk. That article suggest that you import the private key from the address you send from to Bitcoin-Qt and try to do the same transaction again from there.


How Can the Bitcoin Wallet Blockchain Size Be So Small?

Assuming you are talking about a full node,
It does indeed need to download the full blockchain, to verify it and build up a set of Unspent Transaction Outputs (UTXOs). But the thing is, once it's downloaded all those blocks, its not going to go back looking through them, it just uses the UTXO set to verify new transactions. All those old blocks are basically stored solely for sending to other nodes. So if we have a checkpoint at some block hash, we can say that all blocks before that are legitimate and stop storing them, just store the UTXOs, and then just keep the most recent blocks so we can still propagate them around the network. This greatly reduces the amount of disk space used.

Of course, there are also SPV nodes which just store block headers and rely on full nodes for specific transaction data, so they have blockchains in the megabytes rather than gigabytes.


How do atomic swaps work when blockchains operate at different rates?

Atomic swaps work with so-called hashed timelock contracts. These lock the value for a specific time except the other party can provide a secret which hashes to the given hash. In Bitcoin (and most clones) the timelock can be set either to be a specific block or a specific timestamp. After reaching this block or this time, the first party can claim back their funds.

When you know which chains you want to use for your atomic swap, you know how to set the locktimes to be sufficient for your purpose.

The locktimes can also be different on both chains.
And when you know, a chain reaches finality after a day, you can easily set the locktime to be in a week.


can sign derived wallet transactions with master seed phrase private key?

The master private key is derived from the seed and all child private keys are derived from the master private key. Knowledge of the child private keys lets you sign transaction spending coins sent to the corresponding addresses. So yes if you have the master private key you can derive the child private keys and use those to sign any transactions related to that wallet.


Does a blockchain.info My Wallet have a key pool?

It doesn't (or, at least, didn't).

Email backups will be sent to you every time you create a new address.


Sync of bitcoin main-net does not finished yet. Are there any ways to speed up it?

It's probably using 100% CPU? Maybe you can add some CPU temporarily? Which version are you running? 0.12 is currently in beta and is about 5x faster with signature checking, which is the biggest CPU user. https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes.md


Better fee estimation and fee/tx/mempool management in wallets

You are right, after about three years, we only achieved about 11% of native segwit usage, ~ 1000 BTC locked in public lightning channels, RBF/CPFP usage is about 15%/10%.
Unfortunately, most people don't care much whether they pay $0.02 or $0.2 in fees. They only start caring when fees are much higher than that. Since January 2018, we have only had that at a much lower level in April-June 2019 and at the end of October/start of November 2020. Which allows most users to just wait for the congestion period to resolve. In order to have a real change, I think we will need a real congestion period the likes of those in 2017 or even worse.
I am creating a service that will make it easy for wallets/custodians to optimize the fee of their transactions. The way it works is that users relay RBF pre-signed transactions that pay for different fees. The service then optimizes the fee by smartly broadcasting these transactions. It's already live, in beta: https://bitpost.co Anyone can try it out by following this tutorial: https://docs.bitpost.co/basic/quick-start There is a testnet version of the service too.


Chech this explanation..
OR
TL;DR version
Assuming you came accros this site bitcoin-mining-hard-way-algorithms.
I'll show you in C# and you can convert to VB, using the same logic.
Here is the deal:
All information in a bitcoin block is hexadecimal.
So the header you are formming is compounded by:
var header = $"{ver}{prev_block}{mrkl_root}{timestamp}{bits}{nonce}";

Let's calculate each:
ver = 2

Must be converted to a 8 byte hexadecimal, but afterwards must be reversed. ( when reversing a hex string you reverse the pairs so "00-00-02" become "02-00-00";
A simple function to reverse can be as:
string reverse(string hex)
{
   char[] reverted = new char[hex.Length];
   for (int i = hex.Length - 1, j = 0; i > 0; i -= 2, j += 2)
   {
       reverted[j] = hex[i - 1];
       reverted[j + 1] = hex[i];
   }
   return new string(reverted);
}

So:
var ver = 2.ToString("X8"); // Returns a hex representation: 00000002
ver = reverse(ver); //02000000

Then:
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"

Its the previous block hash of the chain, and must be reversed too.
var prev_block = reverse("000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717");

Then, the mrkl_root is calculated from 99 transaction hashes. The resulting Merkle root is (If you don't know MerkleRoot take a look in this repo: diegomary/bitcoin-merkle-root-netcore):
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"

And again you reverse it:
var mrkl_root = reverse("871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a")

Then the timestamp is a unixtimestamp to the date "2014-02-20 04:57:25", the timestamp value of that date is 1392872245, so you convert to hexadecimal value 53058B35, and REVERSE IT = "358b0553" (I wont put the code but you get the picture, ^^)
var timestamp= "358b0553";// # 2014-02-20 04:57:25

Then the number of bits as you can see here (https://blockchain.info/block-height/286819), is 419520339, convert to hexadecimal and you get 19015F53; And reverse it: 535f0119
var bits = "535f0119";

The nonce is a arbitrary value that you will iterate over until you get the desired final hash, in this examples was a integer value 856192328. You convert to 8 bytes hexadecimal and reverse it.
var nonce = reverse(856192328.ToString("X8"));

And that's it, if you apply the SHA256 two times over this header will give you the desired result:
var header = $"{ver}{prev_block}{mrkl_root}{timestamp}{bits}{nonce}";
byte[] a1 = Enumerable.Range(0, header.Length)
                     .Where(x => x % 2 == 0)
                     .Select(x => Convert.ToByte(header.Substring(x, 2), 16))
                     .ToArray();
var c = a1.ToArray();
SHA256 sha256 = SHA256.Create();
byte[] firstHash = sha256.ComputeHash(c);
byte[] hashOfHash = sha256.ComputeHash(firstHash);
Console.WriteLine(BitConverter.ToString(hashOfHash).Replace("-", "").ToLower()); //Output: 0000000000000000e067a478024addfecdc93628978aa52d91fabd4292982a50


If you used some python scripts to generate a new wallet file and want to use it with bitcoind or bitcoin-qt, you will probably need to rescan the whole blockchain via running bitcoind -rescan (it may take much time).

After that you can use bitcoind listaccounts to get balances of all your accounts (or bitcoind getbalance to get the total amount).

Not sure if it answers your question though, since not sure what you mean under 'account' and 'CWallet'.


Different exchanges will offer different rates at the same time because of variations in trading volume, markets, etc. This happens in real currency markets, as well. With enough money it is even possible to play the currency market, "buying" dollars with Euros, then buying yen with dollars, then buying euros with yen, and coming out ahead.


When is a Bitcoin Adress considered even and when odd?

A bitcoin address is considered odd when the Y value in the public key is odd. This is useful to know because public keys can be compressed by replacing a really long odd Y value such as 23324234324675756756742983749 with a small odd value such as 3, which accomplishes the same thing.


You should have your Trezor recovery card with 24 words you have written down. With these 24 words (the recovery seed) you can access your coins without a Trezor. Here is an explanation.

If this doesn't help you might want to contact Trezor support.


How can I start bitcoind without blockchain synchronization?

The recommended way is to use the -connect option. You can do -connect=0 or -noconnect (they mean the same thing) and Bitcoin Core will not try to automatically connect to any other node.


In bitcoin, the UTXO set is derived independently by every full node by processing and verifying transactions in blocks. It is then stored on disk until it is spent. When a UTXO gets spent, it gets removed from the UTXO set so the UTXO set is definitely modifiable. When full nodes verify transactions, they also use the UTXO set on disk to check the validity of each transaction. Full nodes have to make sure that UTXOs consumed as inputs in a transaction actually do exist in the UTXO set, otherwise a transaction will be invalid.


Why do some mining algorithms run "cooler" than others?

With any given algorithm and hardware, there's something that will be the bottleneck: this portion is taxed to its full 100% capacity, while the rest of the hardware is used at <=100% of its capacity. Different portions of the hardware take different amounts of power and heat to run to capacity. Creating an algorithm that taxes the lower-power portions, while leaving the high-power portions largely free, results in a cooler-running algorithm.

For example, let's say you have one algorithm that's heavily processor-bound, and one that's heavily memory-bound. It'd be perfectly reasonable to expect that the processor-bound one runs hotter than the memory-bound one, so if you want your algorithm to run cool, you choose the memory-bound one.

I should also note that some processes are complicated enough that there is no one bottleneck, but it shifts from time to time (e.g. if you read data from your hard drive, compress it, and transfer it over the network, you might have three completely separate bottlenecks at the different times: disk IO, CPU power, and then network IO). You can view this as a composite of algorithms that individually (should) follow the general rule I outlined above.


How to get public master key of a Ledger wallet?

Find the HD Public key for your wallets:

Open the Ledger Wallet Chrome bitcoin app
Click your account in the overview, it’s called “My account” by default
Click “Account Settings” in the top right corner, under the balance
Click “Export” next to “Extended public key”
And when you see the QR code pop, you’re ready to begin the next part.

You can test the address by going to:
https://blockchain.info/xpub/123XYZ where 123XYZ is your public key. You should see your transactions and balance.

Credit: https://keepingstock.net/storing-your-cryptocoins-in-a-bank-with-a-ledger-wallet-52d7895b9dd


Is it true that as long as you have the public and private key for a bitcoin address, you are safe?

There is a non-zero chance, that the communication protocol, blockchain.info or your computer have been compromised. (This chance is fairly low)

You don't have to show your private key to anybody until you want to withdraw/send money from this address. You can securely generate and print the key on an offline computer.

There is also chance, that someone will generate the same private key, this may be caused by faulty software or just a very bad fortune, but the probability is much lower than finding few blocks in a row.:)


What is the best Lightning implementation to obtain the network graph?

So in c-lightning you have the two api calls listnodes and listchannels

here are sample outputs from a mainnet c-lightning nodes:

"channels": [
    {
      "source": "0250373555232cec757ea141273e75381c84cc3ab22f1e3a3ca5a2dc55b1904c24",
      "destination": "02ef61a252f9504a42fc264a28476f44cea0711a44b2da0bd729ad52aaee9d86b7",
      "short_channel_id": "505149x622x0",
      "public": true,
      "satoshis": 300000,
      "amount_msat": "300000000msat",
      "message_flags": 1,
      "channel_flags": 0,
      "flags": 256,
      "active": true,
      "last_update": 1559441480,
      "base_fee_millisatoshi": 1000,
      "fee_per_millionth": 10,
      "delay": 14
    }

and

"nodes": [
    {
      "nodeid": "039f96b5dc60b60596dafc870ae104beb6cfaa40aa718b3e9dab9db6b1e52ed3b8",
      "alias": "DACSC",
      "color": "3399ff",
      "last_timestamp": 1559456735,
      "globalfeatures": "",
      "global_features": "",
      "addresses": [
        {
          "type": "ipv4",
          "address": "92.86.218.107",
          "port": 9735
        }
      ]
    }

on the other side if you use lnd there ist the listnetwork command which prints a large json blob which has two fields nodes and edges

for a random node the entrie looks like that:

"nodes": [
    {
      "last_update": 1559598407,
      "pub_key": "0200072fd301cb4a680f26d87c28b705ccd6a1d5b00f1b5efd7fe5f998f1bbb1f1",
      "alias": "OutaSpace ",
      "addresses": [
        {
          "network": "tcp",
          "addr": "46.163.78.93:9760"
        },
        {
          "network": "tcp",
          "addr": "[2a01:488:66:1000:2ea3:4e5d:0:1]:9760"
        },
        {
          "network": "tcp",
          "addr": "2dkobxxunnjatyph.onion:9760"
        },
        {
          "network": "tcp",
          "addr": "nzslu33ecbokyn32teza2peiiiuye43ftom7jvnuhsxdbg3vhw7w3aqd.onion:9760"
        }
      ],
      "color": "#123456"
    },

and for a random channel it looks like that:

{
    "channel_id": "564791635544965120",
    "chan_point": "4297b5fe9beeb701c67fd0f84861b22edbcafe5c25be67324ab11129226356a1:0",
    "last_update": 1552879381,
    "node1_pub": "028aa5a991a2acf33da91674fe062219b640e5e57d77a48de6df3c0d30be22b05b",
    "node2_pub": "03fab7f8655169ea77d9691d4bd359e97782cb6177a6f76383994ed9c262af97a5",
    "capacity": "50000",
    "node1_policy": {
      "time_lock_delta": 14,
      "min_htlc": "1000",
      "fee_base_msat": "1000",
      "fee_rate_milli_msat": "10",
      "disabled": false,
      "max_htlc_msat": "0"
    },
    "node2_policy": {
      "time_lock_delta": 144,
      "min_htlc": "0",
      "fee_base_msat": "1000",
      "fee_rate_milli_msat": "1",
      "disabled": true,
      "max_htlc_msat": "50000000"
    }
  },

so you see the information is in all cases eclair, lnd and c-lightning pretty much the one from bolt 07 and the gossip protocol. just the formatting is different. There are slight changes with also showing signatures of messages but the core info is the same.


I can't find my funds on my bitcoin wallet

what should i do

It depends whether you have a Blockchain.com account or a Blockchain.com wallet.

If you have a Blockchain.com account, contact Blockchain.com support.

If you have a Blockchain.com wallet, check the transaction history and find the Bitcoin addresses which held your money. You can then check those addresses in several different  blockchain explorers to see if money has been removed from those addresses. If not you may be able to regain control by  re-creating your wallet from your recovery phrase or wallet backups.


The blockchain begins with the genesis block. The genesis block was mined by Satoshi and it a hard coded value in all Bitcoin full nodes. All blocks in the blockchain must be a descendant of this block.

When you synchronize with the network, your node will perform peer discovery and connect to several other nodes. It then proceeds to request from those nodes the block headers for each node's best blockchain. Block headers are received in 2000 header chunks (i.e. Core requests for 2000 headers and receives 2000 headers at a time from a node). Core will build a block headers chain and verify that the proof of work is correct. At the same time, Core will download the blocks for those block headers (blocks are received and synced much more slowly than their headers) from all of its peers. The sync is finished when it receives less than the 2000 headers it last requested for.

As you can see, there is no canonical source. Core simply connects to several nodes and downloads blocks from them. Then it verifies that those blocks fit the consensus rules that it is following.


What happens to the overall value of Bitcoin when a huge amount of coin is lost?

Yes, pretty much the only way to know coins are lost is through someone making the information public by declaring they no longer have access to the private key. Otherwise they would just look like someone who hasn't moved their coins if viewed on the blockchain.
There's actually a limit at the current moment of 21 million bitcoins. So technically losing 1 billion bitcoins is not possible since it's larger than the limit. But taking on the spirit of the question, If someone was to lose a large amount of bitcoin theoretically it should make the rest of the coins more valuable. In practice though I'm not sure it always works this way since in your first question we brought up the notion that confirming lost bitcoin is not easy.


Can I use a single Hardware Ledger for multiple coins

Yes, you can use a single Ledger for multiple coins.

Here is the list of supported coins.


Will Bitcoin scaling affect the amount of hashing power required to keep the network secure?

This is a comment from page 199 of Mastering Bitcoin. I think its meaning is to be interpreted taking into account the two preceding sentences:

  Note that the target difficulty is independent of the number of transactions or the value of transactions. This means that the amount of hashing power and therefore electricity expended to secure bitcoin is also entirely independent of the number of transactions.

This means that the number of transactions and their value could increase (this is the broader adoption of the currency) while the target difficulty could  remain the same (as long as the total computing power of the mining nodes remains the same), thus the total hashing power (required to solve the mathematical problem) would also remain constant.

What really increases the total hashing  power of the network, is the entrance of new miners (market forces) seeking for the reward (thus the increase of the total computational power available to the network). This is then compensated by the regulation of the degree of difficulty (target difficulty) of the mathematical problem.

P.S.: To be more specific, the regulation is done by periodically adjusting the hash target value for blocks: Every 2,016 blocks

  ( on the mean this is every two weeks, given that each block is taking approximately 10 min to confirm:
  6 (10 min intervals per hour) x 24 (hours per day)x 14 (days per week) =2,016 )

Bitcoin nodes calculate a new difficulty accordingly, based on the time it took to mine the last 2,016 blocks. This is implemented by the following formula:

  New Difficulty = Old Difficulty x (20160 min) / (Actual time of last 2,016 blocks)

And the new degree of difficulty determines the total hashing required for the solution. This is the reason that, no matter the (computational not only physical) size of the network, the mean time for block-validation remains approximately constant (about 10 min on average). See also here for the relative graph.


The Bitcoin protocol requires transactions to appear in topological order in the blockchain. Given two transactions A and B where B spends an output of A:

Both A and B may be included in the same block.
A must precede B in the transaction list.

Colloquially, a miner will never include a transaction in a block template until the transaction's requirements are met. Since B spends an output of A, B is not valid until A has created said output. To satisfy this dependency, B can only be included after A was included.

Also see: Can multiple transactions transferring the same bitcoin be done in one block?


How to send/receive Bitcoins from cold wallet?

"Is there a way to do this (send / receive) without needing to use my private key on a computer connected to the internet?"

Yes, search for 'offline wallet'. The basic idea is the following:

download the 'offline wallet' webpage you liked
you must be online to fill blanks like addresses, amount and fee
sign the transaction while offline and copy it
go to a website that broadcast transactions
paste your raw transaction already signed and push it

In my opinion, this is the safest way for non-developers to do bitcoin transactions.


Which impacts has openssl's end of life [2019-12-31 (LTS)]

It's not consensus critical, because BIP 66 was accepted. It might matter for SSL encryption of an RPC connection. Ideally, your RPC calls aren't crossing the network anyway, though.


OP_CHECKLOCKTIMEVERIFY . Include / reject or will not included in block?

A transaction with a CLTV output can be created at any time, and can be accepted and confirmed immediately.

Spending such an output requires a transaction whose nLocktime field is at least the CLTV-specified time. That transaction will only be accepted and confirmed when its nLocktime field matches the real time.


What does a merchant need to do to reject RBF transactions

Replace-by-fee (RBF) transactions all have a sequence number that is below MAX - 1.  If the payment a merchant receives comes from a transaction that has such a sequence number, the merchant can either wait for the transaction to be included in a block, or ignore the payment altogether.  Ignoring the payment is fraught with other complications, however, since the bitcoin will still go to the merchant if included in a block.  The customer would have to replace the transaction, using RBF, before it is mined.  It's probably easier for most merchants to simply wait for the first confirmation.


How can I obtain a better understanding of the P2P messages between my full node and its peers?

Wireshark understands the Core protocol and it's one of the most popular packet capture tools.


How to verify that the recipient received a payment?

Just check the address of the recipient on a blockchain explorer (e.g. https://blockexplorer.com/). If the address shows your payment as confirmed, it must have arrived.

It may show, but still be marked as unconfirmed which would explain why the recipient states that they haven't received it yet.


Can I have a fee rate lower than the one suggested by estimatesmartfee economical

Is there anything I can do now?

Yes, if you want to lower the fee rate, you can set the fee you want to pay manually:
bitcoin-cli settxfee 0.00081

fee are in bitcoin/kB  so they correspond to 81 satoshi/vbyte
and then you can do your transaction with
bitcoin-cli sendtoaddress "address" "amount"

Can I somehow transfer money locally to 1 address?

From blockchain viewpoint all address are equal, it don't know which belong to the same wallet, so there can't be local and external transactions.


Accept Credit Card Online to Bitcoin Address Backend

This problem is not solvable unless you want to place yourself at great personal risk. The trouble is that bitcoin transfers are inherently non-reversible, meaning that once you've transfered bitcoins there is absolutely nothing you can do to guarantee the return of those bitcoins. Credit cards however are highly reversible and most banks reserve the right to take back funds with very little justification and will almost always side with their customers (aka the people who are paying you.)

This means that if someone buys bitcoins from you with a credit card, and then removes the bitcoins from your sites wallet, and then they default on their credit card payment, the bank will ask you for the money back, and you will be out some bitcoins.

There are a few partial solutions to this problem. You can accept credit card payments but require the user to not remove the bitcoins untill the payment has become non-reversible. This is usually a prohibitive amount of time, taking anywhere from a month+ to clear. The fastest way to possibly transfer money in a non-reversible fashion would be either to use the SEPA network if you live in Europe, or if you live in the USA then you can use something called Automated Clearing House protocol, which was developed by the federal reserve to allow debiting of bank accounts. Both of these are quite difficult and annoying to implement.

Its impossible to buy bitcoins from yourself, because it implies that you have the bitcoins in the first place, and you cant offer a service that accepts credit cards for the reasons stated above, and other companies dont for the same reasons.


What is the difference between mauling and transaction malleability?

They define what they mean by mauling in the referenced paper:

  As described in Section 2, the Bitcoin transactions are identified by their hashes, more precisely: TXid(T) = H(T) (where H is the SHA256 hash function). This can sometimes be a problem, since it turns out that often the adversary that knows T can compute T' that is semantically equivalent to T (i.e.: spends the same transaction, has the same value, and the same inputs and outputs), but is syntactically different from T. This is called mauling the transaction T. In a moment we will explain how mauling can be done, but let us first say what are the consequences of this attack. The problem comes from the fact that in such a case TXid(T) != TXid(T'). Note that this does not imply that the adversary can steal money (as the output of T is the same as the output of T'). Still, it is undesirable in many situations.

This is the same thing as transaction malleability.

Would segregated witness solve this? I believe so. If every input is a segwit spend, that solves every kind of transaction malleability, except when the attacker has a copy of every private key that signed the transaction.


Why does Bitcoin not have faster downward difficulty adjustments?

Peter Todd has an in-depth answer to this question here:

https://petertodd.org/assets/commitments/52ccc4802bd563076cbd25ec4c1ba88152098cb6aa356ba644c9e79a24182da5.txt

What attack does the difficulty drop rate limiter prevent?

The Bitcoin protocol limits the rate at which the difficulty can decrease to no
less than 1/4th of the prior period's difficulty per adjustment period.
Specifically, in the difficulty calculation the variable containing the actual
time it took to generate 2016 blocks is capped at 4x the expected time.

// Limit adjustment step
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
if (nActualTimespan > params.nPowTargetTimespan*4)
    nActualTimespan = params.nPowTargetTimespan*4;

So why did Satoshi do this? What attack does this rate limiter prevent?

Suppose I want to trick you into accepting a chain that I've mined with less
work than the valid chain with the most work in existence. If I can
successfully sybil attack you, I can prevent you from learning about the
most-work chain.

Let's suppose I start the sybil attack when you know of the existance of block
n=(k*2016 - 1), which happens to be one block prior to the end of the difficulty
adjustment period, and has timestamp t.

I now mine block n+1 with the largest timestamp you'll accept (your local clock
plus 2hrs). Without the rate limiter, the amount that the difficulty would drop
is limited only by the difference between time t and now - that may be very
large if your node has been off for awhile, you're in initial sync, or I manage
to get you to reset your chainstate (e.g. by social engineering, or with a
chainstate corruption exploit). For example, if I manage to roll you back a
year, the difficulty would drop to 1/26th of the last block you know about.

With the difficulty dropped, I can then mine blocks quite cheaply to make you
think the transaction you're accepting has a significant number of
confirmations.

By limiting the rate at which difficulty can drop we make this attack
significantly more expensive: my cost-per-block is now only 1/4th of what it
should be, a significant increase compared to the situation without the drop
rate limit.

Synchrony/Latency

Of course, all consensus systems have a network synchrony assumption of some
kind - if the participants can't communicate in a sufficiently timely manner
it's impossible to come to consensus; the infinite latency case being an
obvious example. But even if the system isn't functioning properly, we still
want to limit what an attacker can do: in combination with PoW, the difficulty
drop limit ensures that even if latency is infinite, attacks against
participants are still expensive, turning a potentially disastrous
double-spend attack into a much less harmful DoS attack.

PoW vs PoS

Finally, note how important PoW was here: PoW guarantees that this attack will
be expensive, by virtue of the fact that the attacker has no way of avoiding
the need to spend funds to destroy energy - or in the case of stolen hash
power, give up the opportunity to mine blocks extending the most-work chain.

Meanwhile in a PoS system this attack can be done for free: even in a "slasher"
style PoS system, since we've sybil attacked the target we can prevent the
slasher mechanism from working. The proof of our fraud will never reach the
outside world, and thus has no impact on the value of our staked coins.


Cashaddr (bech32) to legacy address format convertor for Bitcoin Cash

I've found this project:
https://github.com/oskyk/cashaddress , checked the accounts generated by it using validateaddress of my wallet, seems working fine!


Can mining rewards be based on real world data

This is not really possible: other participants can not provably verify the output of the electricity meter. What if it is malfunctioning or modified by a malicious entity? Proof-of-work has the key advantage of being independently verifiable. Anyone can compute the blockhash and see that it is smaller than the target without any additional information or having to trust anyone.


How do I check and design a transaction so that I can send 3 BTC to User 2?

You reference the 5 BTC unconfirmed UTXO for your next transaction and pay 3 BTCs to User 2 and 2 BTC back to yourself.

  Can I chain unconfirmed transactions?

Yes, you can.

  Setting this aside, would there be a possibility that the transactions aren't mined in the order they are broadcasted - or that a latter transaction is discarded because a former one does not exist in the chain yet?

Yes, there is a possibility. The latter transaction will not be discarded, it will be in another node's orphan tx set so as long as that limit has not been met. So there's also the possibility that some node's orphan tx set is full and your orphan tx will get rejected outright.

Tx1 (unconfirmed, accepted) <- Tx2 (unconfirmed, not yet visible) <- Tx3 (unconfirmed, accepted && orphaned)

The above transaction chain is a valid chain of unconfirmed transaction.

  Finally, is there a better way to do this?

Not quite. The recipient can use CPFP to bump the fees, so the transaction fee that pays for the entire transaction chain becomes greater. That increases the probability of immediate confirmation. Otherwise, you as the payer can use RBF to bump the fees.

  For an outgoing bitcoin account that only makes payments to users, what would be the best practice?

Only pay from confirmed transactions, otherwise pay sufficient transaction fees which results in probable immediate confirmation. You as the payer would still have the opportunity to bump the fees with RBF to provide better user experience. Or you may insist your users to use CPFP to accelerate their receipts.

  Would it be useful to split the account into multiple sending accounts - how is this done on existing systems like exchanges?

Exchanges don't really care about the speed at which recipient receives their fees, they usually pay a decent transaction fee so that you'd receive your transaction in "due course".


What is a good way for someone to purchase Mining Bonds?

You could use https://btct.co/ which is a virtual stock exchange similar to GLBSE.


Taking the sha256 hash of that hash gives

  3b a3 ed fd 7a 7b ..............

  But the real transaction hash according to blockexplorer.com is

  .............. 7b 7a fd ed a3 3b

The answer I was getting was correct, but bytewise reversed.  I need to get used to Bitcoin using little-endian storage.


Encoding my Bitcoin Address with Base58 encoding

Yes.

ECKey key = ...;
String addr = key.toAddress(MainNetParams.get()).toString();

https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/core/ECKey.html#toAddress-org.bitcoinj.core.NetworkParameters-


I recommend going on localbitcoin.net and sell your Bitcoins in person. You can also send them to a service such as Coinbase, but I highly recommend doing it in person as you won't pay for a cut.

Here are extra resources to help you throught your situation :

4 ways to convert Bitcoins to Dollars

A guide to selling Bitcoin in person


Why have my funds in Bitcoin Block Explorer's online wallet decreased in value?

Bitcoins are traded on many different exchanges.  The prices are varying  constantly just like any currency.  As an example:  at this time three rates are Mt.Gox - $143.0983; CampBX - $125.8000; and BTC-E - $124.0000 (all USD).  As I learn more, and become familiar with the exchanges, I may try some arbitrage.  I have a feeling there are problems, or people would be doing it now, and all the exchanges would be more in line with each other.


Feasibility of a "High horsepower" attack (based on difficulty -4x adjustments)

What realistic scenario would cause the difficulty to decrease by a factor of 4?

Most plausible I can think of would be a massive sustained power outage, like the 2003 Northeast blackout, covering an area with a heavy miner concentration.

  How much horsepower must be added and then lost for a 4x difficulty to be realized?

To quadruple the difficulty, you'd need to increase the network hashing rate by 4x, so you'd need to dump in 3x the current network hashing power.  But if someone has that much power to throw around, why bother with just a DOS when they could go for a 51% (or 75% in this case) attack and really screw with things?  This isn't really a relevant concern.

  How long will it take a transaction to be included in a block/confirmed (worst case)?

Worst case - never, same as currently.

Normal case - 1/4 hashing power would mean everything would run at approximately 1/4 speed, so you'd be looking at 40 minutes per block on average, but with potentially very large absolute variances.

  How long will it take for the chain to return itself to normal levels?

Until the hashing power comes back online or until the next 2016 block allows the difficulty to correct itself.  Assuming the 3/4s of the network got taken out right after an adjustment, it would be 2 months until correction.  Unless the taking-out was something outright cataclysmic, the hashing power will come back long before that.


allowed DER encoding format violations for signatures in bitcoin: implications for libraries?

It isn't clear to me from your question what your goal is.  If you want to accept all transactions and only transactions that Bitcoin would accept, libsecp256k1 alone is what you want. (You may need to use the signature normalize call if you want to match consensus acceptance instead of standardness acceptance).

If you want to validate historical signatures from the blockchain then either openssl or the code in contrib is sufficient. If you use either of these things on current transactions you will accept things that Bitcoin will reject.

We, the authors of libsecp256k1, are currently of the belief that no application should use a lax parser, except for historical compatibility. Unfortunately, no function is likely to be universally compatible with OpenSSL's parser except OpenSSL itself... but for cases where the set of signatures that you need to be compatible with is known a specific alternative lax parser might work, as is the case for Bitcoin's history and the lax parser in contrib.

The contrib lax parser isn't included in the library because it's only provably sufficient for Bitcoin's history. Someone trying to lax-parse a different set of signatures may need to modify that lax parser to accommodate the specific weird signatures that they're dealing with.  We also, in general, don't think anyone should be lax parsing unless its strictly needed since it can result in surprising vulnerabilities.

As an aside, in the current versions of OpenSSL the ECDSA validator attempts to validate signature encodings by checking that the serialization is unchanged under decode and encode and it rejects signatures that aren't.  This likely means they reject any signature that libsecp256k1 (with normalize) rejects.  [And annoyingly, OpenSSL made this breaking change in a security update.]


`bitcoind` must be different from `bitcoin -server` because one gives an error message the other doesnt

They're not exactly the same -- they're two different programs. The bitcoind program is a pure server (or pure RPC client), it contains no GUI at all. The bitcoin program contains a GUI and can also run in server mode. So being unable to operate as a server is fatal to the server-only version, because there's nothing else it can do.

When you ask the GUI client to run in server mode, it interprets this as an additional request. If it is not configured properly to run in server mode, it will still start up and run the GUI. So for bitcoind, an improperly configured server mode is fatal -- what else could it do? For bitcoin, an improperly configured server mode just makes server mode not work; it will still run as a GUI client.


How to recover blockchain wallet on iPhone with address & PIN?

It is impossible to spend coins (aka recover them in your case) without having the private keys. You do not have enough information to have the private keys (address is not enough, 4 digit PIN is only for unlocking the wallet). Thus your coins may be lost.

However, blockchain.info is an online wallet. You should be able to go to their website and access your Bitcoin that way. You will need to have the account identifier (or wallet identfier, whatever it is called) and your password.


Is eltoo more memory efficient for watchtowers?

Without eltoo (ie today) a watchtower needs to store a different justice transaction for every channel update in case the channel counterparty broadcasts (deliberately or accidentally) an expired channel state.
With eltoo (once/if we have SIGHASH_ANYPREVOUT enabled onchain) a watchtower will only need to store a single justice transaction in case the channel counterparty broadcasts an expired channel state. The watchtower can delete old justice transactions.
This presentation from Christian Decker at Chaincode Labs is a great resource on eltoo.


When Bitcoin Segwit fork will completely over?

August 3rd 12:45 CET:

    "segwit": {
      "status": "started",
      "bit": 1,
      "startTime": 1479168000,
      "timeout": 1510704000,
      "since": 439488,
      "statistics": {
        "period": 2016,
        "threshold": 1916,
        "elapsed": 1053,
        "count": 1053,
        "possible": true
      }
    }

Another 864 BIP141 segwit singling blocks are required to activate.
This will roughly take 864 * 10 minutes == ~6 days (IF each block signal BIP141/bit 1).

As you may see, there are certain variables you can't know for sure (singling, block times)


How can I create a new wallet on Bitcoin Core?

Bitcoin Core will create a new wallet if it cannot find the wallet.dat in the Bitcoin Core folder.

Close Bitcoin Core.
If the wallet still has a balance, or addresses from the wallet were given out, back the old wallet.dat up: Move it to a different directory or rename it. If you are sure that it was never used, you may delete it instead.
Restart Bitcoin Core. A new wallet will be created.

If you don't know where to find the wallet.dat, check here: Where is the data folder for bitcoin-qt?


How to sync litecoin blockchain (+ bootstrap) from the terminal?

litecoind will sync the blockchain the same way as litecoin-qt, and you can interact with it via RPC calls or with litecoin-cli, both from terminal. Also, bootstrap is not recommended generally for newer bitcoin codebases.


Wouldn't compromised crypto require entire block chain to be recomputed?

If one of the cryptographic building blocks of Bitcoin were to be broken

This is a difficult question to answer because Bitcoin uses so many.
SHA256d
This is Bitcoin's main hashing algorithm. It uses it for proof-of-work, building merkle trees, and lots of other stuff.
Collision resistance
If broken, you could create two blocks that hashed to the same thing. This would be bad because you could give both out, and nodes would think that they agreed, but they were actually talking about different blocks.
Preimage resistance
If broken, you'd have essentially infinite hashpower, and you could do the previous attack on blocks that had already been mined.
Mining faster than brute force
Currently, the fastest known way to get a hash that starts with lots of zeros is to just run through that hash lots of times. However, if you could figure out at the start that certain ranges of nonces weren't going to result in a block, you'd have a significant advantage over ASIC miners, who wouldn't be able to change the way they mined.
HASH160
Collision resistance
Irrelevant.
Preimage resistance
If broken, you could steal bitcoins.
ECDSA
If broken, you could steal bitcoins.
Final remarks
It's unlikely that every crypto primitive that bitcoin relies on would be broken. If they were, there are usually better primitives that could replace them.


What can make an unconfirmed transaction (0-conf) an invalid one other than Double-spend?

There are a lot of things that can make a transaction invalid. Note that an invalid transaction cannot be confirmed as the block that contains it would also be invalid, thus there is no such thing as a confirmed or unconfirmed invalid transaction.

Things that make a transaction invalid:

Spending an input spent by another transaction that is confirmed
Spending an input that does not exist
If signatures are required and must be valid, providing an invalid signature
If some data must hash to something provided (e.g. pubkey hash, scripthash), providing a piece of data that does not hash to the correct hash.
In general, any input script not validating to true
Negative output values
Sum of the output values is greater than the sum of the input values
A coinbase transaction outside of a block
A coinbase transaction that is not the first transaction of a block
A coinbase transaction where the sum of the output values exceeds the block reward

There's probably a few more that I missed, those are just a few that I can think of off of the top of my head.

  can the recipient be insured that even 0-conf tx will be eventually valid and processes?

No. There is no guarantee that an unconfirmed transaction will eventually confirm, even if it is valid. Note that transactions do not become valid; they are either valid or invalid upon creation.