The average interval between blocks is 10 minutes for BTC. There are twelve of intervals of ten minutes in two hours, so nine or ten blocks is a good estimate.


Watching and spending from a huge number of offline private keys

Direct answers to your questions:

I) Technically this is not too difficult. Looping through every new transaction on each received new block does not take too many resources and checking each transaction against 100,000 public keys is no problem at all. However, I do not know of a tool that would do exactly so. (For example, blockparser can output all the balances of all the addresses in the entire block chain in under a minute.)

II) No. You can not transfer all the received bitcoins in one transaction as the maximum size for a transaction is 1 megabyte. That would be able to spend the money on, say, 4000 different addresses at once, but no more. Of course, you can give all the private keys to somebody else "all at once", which enables them to spend the coins - but such a party would be unlikely to accept the sale as successful before transferring all the coins in to new addresses, just in case you kept the private keys as well.

III) No, if you keep the attacker from learning all the public keys. If, for example, the public key currently on the web server is easily viewable, the attacker can just poll your website, note down all the public keys seen and then check all the transactions for the keys. However, if you reveal the public keys only to legitimate buyers (or something) or do not reuse keys ever, the attacker has no way of knowing the full set of keys that belong to you. This also requires some care on the spending side of the coins - if you do a transaction that links the coins to your site somehow, this can be observed.

However, there are some more advanced methods of using bitcoin public keys that will achieve more than what you have asked here. You can see for example Hierarchical Deterministic Wallets. The choices are numerous and the best way to achieve your goals might not be the most obvious one.


How to send bitcoin from an address created at Coinb.in?

Fortunately you have many options.
The bitcoin core client allows key import with importprivkey
Adds a private key to your wallet. Requires a new wallet backup.
Hint: use importmulti to import more than one private key.
Note: This call can take over an hour to complete if rescan is true, during that time, other rpc calls may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.
Arguments:

privkey    (string, required) The private key (see dumpprivkey)
label      (string, optional, default=current label if address exists, otherwise "") An optional label
rescan     (boolean, optional, default=true) Rescan the wallet for transactions

Alternatively there are many wallets out there that allow importing or sweeping a private key. Some of these include Electrum, Mycelium and Samourai (these are examples, not recommendations).
Lastly, coinb.in, the site you used to create the key allows you to build a transaction and sign it as well https://coinb.in/#newTransaction. I wouldn't recommend this for a novice user as you can end up losing your funds to miners fees if you do not include a change address. If you don't know what a change address is don't attempt this approach. You can practice on testnet or with small amounts until you get comfortable you know what you are doing.


Will there be a problem if bdiff and pdiff are slightly different?

pdiff, the pool difficulty, is not just a different encoding of the same difficulty. Pools set a different (lower) difficulty so that miners can send them more blocks as shares, and calculate how much work they're doing. Valid blocks are still checked against the normal bdiff before submission to the network


Bitcoind lose the latest blocks when synchronize

My problem was I didn't configure nodes settings and use unhealthy default nodes. When I specified "addnode=closestnodesIP" my problem was solved.


Understand how transaction size and fees calculation works in caravan

The fee rate is pulled here:
export function fetchFeeEstimate(network, client) {
  if (client.type === BLOCK_EXPLORER) {
    return blockExplorerGetFeeEstimate(network);
  }
  return bitcoindEstimateSmartFee({
    ...bitcoindParams(client),
    ...{ numBlocks: 1 },
  });
}

(https://github.com/unchained-capital/caravan/blob/3514039983984e184e8babb6c61c21a46798fc70/src/blockchain.js#L97-L105)
It depends on if you are using a block explorer or a local bitcoind node.
If using bitcoind, it uses the estimatesmartfee rpi cal:
export async function bitcoindEstimateSmartFee({ url, auth, numBlocks = 2 }) {
  const resp = await callBitcoind(url, auth, "estimatesmartfee", [numBlocks]);
  const feeRate = resp.result.feerate;
  return Math.ceil(feeRate * 100000);
}

(https://github.com/unchained-capital/caravan/blob/3514039983984e184e8babb6c61c21a46798fc70/src/bitcoind.js#L111-L115)
As for the transaction size/ total fee calculation, caravan uses estimateMultisigTransactionFee from unchained-bitcoin
(https://github.com/unchained-capital/caravan/blob/fd214eb573c7185c01dfa2040aa914e87a0de359/src/actions/walletActions.js#L129)
Which depending on the transaction type (P2SH, P2WSH, P2SH-P2WSH) calls a transaction size estimator. The P2SH one is:
export function estimateMultisigP2SHTransactionVSize(config) {
  const baseSize = 41 * config.numInputs + 34 * config.numOutputs + 30;
  const signatureLength = 72 + 1; // approx including push byte
  const scriptOverhead = 4;
  const keylength = 33 + 1;  // push byte
  const sigSize = signatureLength*config.m*config.numInputs + keylength*config.n*config.numInputs + scriptOverhead*config.numInputs;
  const vsize = baseSize + sigSize;
  return vsize;
}

(https://github.com/unchained-capital/unchained-bitcoin/blob/e9177e7171c3bf11ad5c245c7d633dac484f409c/src/p2sh.js#L27-L35)
Regarding your other questions, I look forward to hearing more about this. When we wrote this, I wasn't aware of unspents. It would be nice if there was a standard, well-tested package for calculating transaction fees.
Regarding other projects: Lily uses unchained-bitcoin: (https://github.com/KayBeSee/lily-wallet/blob/5945175f9e25cc7a8ff29159de39c228b79ef205/src/pages/Send/utils.js#L48) so it's the same as Caravan. I don't know what Casa does. I would assume BitGo uses unspents that Murch linked to. I'm pretty sure Electrum has it's own thing, but I haven't looked, I'd assume the same for Specter.
Hope this helps, sorry we didn't get back to you on the caravan issue, infomational tickets like that are low-priority for us right now.


Would the primary/main owner of the Private Key be able to figure out what has happened to his/her money .

Yes, the wallet would show a transaction that spent/moved the coins

  find the real name of the person who stole it?

Most likely not, unless using some kind of tracing service (Chainalysis, CipherTrace, Coinfirm)

  Can the primary owner open a legal action against this?

Assuming you find out who did it and you can prove it, and your jurisdiction supports such legal actions, then yes.

  What's the best course of action for the primary owner to do if this happened to get their money back to find the person who stole their money?

Ask the internet for help, do some analysis yourself (using public facing tools), hire a company specializing in this type of work.


MtGox api - keeping track of bids/asks that get cancelled

Your link to the "old version of the API" is actually going to the streaming API which is still available.  Only the http version was updated and from there it looks difficult to obtain accurate  depth info reliably for precise time periods.

So I'd stick with streaming. Updated much more in real-time for your requirements.

Now they deprecated the depth:volume field but they still have volume_int, which is volume change * 1E8, so you could obtain volume from that:

//js for example
var volume = volume_int * Math.pow(10,-8);

Check out the github samples at the bottom of the wiki page to help get started.  For example, this one


Double spend transactions flag the node as "bad"?

Your current peers can ban (for some time, not forever) your IP-address.
Just connect to other nodes in case.
The network itself can not do anything with you because there is no such thing in protocol.
Your peers do not know - are you a double-spender or you just relaying somebody's else packets.

(Sorry, my English is also very poor)


Should the nodes of a channel have the same Time Lock Delta?

No it does not have to be the same value.
The timelock somewhat reflects the openness to risk. The lower the value the quicker a node has to engage into force close if there is an unsettled htlc and the partner does not respond to communication.
Thus the higher your partner's cltv delta the longer you can be offline before your partner might force close channels. AFAIK there is currently no real recommendation for the cltv delta. Though nodes seem to lower the default value over time. Remember that high values can lead to longer locked funds. This it is a tradeoff anyway


Can we estimate how many node has the Bitcoin network?

Not very accurately, because it depends on what you consider a node. A host is even more unclear.

Is it only full nodes?
Does it include light clients?
What minimum level of verification must it be doing?
Must it be listening for peers?

Websites such as bitnodes.io provide a number of listening nodes, but that doesn't necessarily guarantee that they are operating as such, or doing any transaction verification:

  Bitnodes is currently being developed to estimate the size of the
  Bitcoin network by finding all the reachable nodes in the network. The
  current methodology involves sending getaddr messages recursively to
  find all the reachable nodes in the network, starting from a set of
  seed nodes. Bitnodes uses Bitcoin protocol version 70001 (i.e. >=
  /Satoshi:0.8.x/), so nodes running an older protocol version will be
  skipped. The crawler implementation in Python is available from GitHub
  (ayeowch/bitnodes) and the crawler deployment is documented in
  Provisioning Bitcoin Network Crawler.


Does sending non-ripple-money through Ripple require two people to be connected through a web of trust?

You can't get money on the Ripple network unless you trust someone to owe it to you. To have $100 in the Ripple network, someone must owe you that $100. If you haven't chosen to trust anyone to owe you money, nobody can owe you $100 and thus you can't have any money.

So when you give money to a gateway, you must allow them to pay you in IOUs. And if someone is expecting you to pay them money, they must allow someone to owe them that money or it's impossible for you to pay them. Now if you've both chosen to trust the same gateway, it's simple -- you just hand them the IOUs you just bought.

If you trust different gateways, then a path between those two gateways must be found. With luck, there will be someone who holds IOUs from both gateways and doesn't particularly care which IOUs they hold. So you can use them to "move" your IOUs from one gateway to another.


You can specify where to store the blockchain by starting QT with the following command argument:

-datadir D:\BITCOIN


What will happen to my bitcoin if my Ledger or any bitcoin hardware wallet will damaged?

Assuming the Ledger Nano S implements BIP 39, your hardware wallet probably showed you a 12/24/36 word Mnemonic code. If you wrote these mnemonic code words down, then you can restore your corrupted hardware wallet with just these words. Also, you can use these words to restore any wallet that supports BIP 39. This includes many mobile phone wallets and other hardware wallets. If you did not write these code words down, then you are probably out of luck for recovering your wallet keys.


How can we use Blockchain for Land Registration Use Case?

Have some good old fashioned digital signatures from buyer/seller/registration officer on the documents and use opentimestamps.org to securely timestamp it. Let all parties involved keep a copy (encrypted or not) of the documents and you're done.

You don't need a blockchain.


Check how many blocks dogecoind downloaded

Using any cli-based daemon (dogecoind,bitcoind,etc.), you can use the cli getinfo command:

./dogecoin-cli getinfo

Will return something like:

{
"version" : 1080000,
"protocolversion" : 70003,
"walletversion" : 60000,
"balance" : 505658.00000000,
"blocks" : 399670,
"timeoffset" : -1,
"connections" : 7,
"proxy" : "",
"difficulty" : 9373.23745278,
"testnet" : false,
"keypoololdest" : 1404252263,
"keypoolsize" : 101,
"paytxfee" : 0.00000000,
"relayfee" : 1.00000000,
"errors" : ""
}


Can I use lightning for ERC-20 (Ethereum coins)

Short answer there is non.

The Ethereum people have tried to create the Raiden Network which is supposed to be their offchain solution. As far as I know (thought not 100% certain) They use ERC-20 tokens to create payment channels but the network cannot transfer ERC-20 tokens. The Lightning Network Protocol itself is currently only designed to transfer an amount of currency.

One of the reasons is that the onions of the transport layer are limited in size.

If you are interested in transfering smart contracts or tokens you might want to look at the RGB Project by BHB Networks. This group tries to create colored coins (which are basically tokens) on top of bitcoin in a way that this is compatible with the Lightning Network. However this is work in progress and will - according to one of the main developers - take probably years before it is ready to use.


Did I pay a fee to transfer from Coinbase to Blockchain?

Coinbase covered the fee. I believe they do this in order to simplify things for their users (so that if it says you have x BTC, you can transfer x BTC, not (x minus transaction fees) BTC).

Of course, they pass the cost along to their users in their buy/sell price and fees.


Monitor paper wallet balance without importing private key?

Try using BlockChain.info - you can add a watch only address and then receive email or SMS alerts every time it does anything - so you don't even have to consciously keep an eye on it.

Edit: I apologise, I didn't see that you wanted to use QT for it. I don't know of any way to do this, so propose blockchain as an alternative.


How can I assure my consumers they are actually paying the correct person? (prevent MITM attacks)

There is a lot of evidence that man in the middle attacks are common, and this is a good question for the Bitcoin community to review.

When publishing the Bitcoin address on a web page, either you will be using a static address (one address for many senders) or generating a new address for that particular user.

Regardless of the frequency of generating a new address, the bottom line is if you send your Bitcoin address over HTTP you need to secure the DNS infrastructure, SSL, and make sure your site is protected from HTTP based XSS, CSRF attacks.

Here are some links to get you started with securing HTTP:

Send all traffic over SSL, and set cookies to Secure and HTTP Only
Use a well known Public Key vendor and ask visitors to run Convergence.IO to prevent a stolen/hacked key from being used.
Disable compression on the webserver or load balancer and configure SSL correctly
Scan the client's machine for old plugins and ask them to upgrade
Have a dedicated domain for purchases with only one "dot" in the name

Ultra-modern DNS Security

Use DNSSec with a trusted root domain that supports DNSSEC at the root (.com, .org, etc)
Use TLSA RFC6698 to self-publish SSL keys into DNS

For ToR clients

Have a .onion address  (users at Exit nodes can modify your HTTP/S session)
Detect that the user is using ToR and redirect them to your .onion address


A bitcoin transaction can have 1 or more inputs and 1 or more outputs. Inputs are previous transaction outputs that sent bitcoins, and outputs are instructions on where to send the bitcoins from the inputs. The total value of the outputs cannot exceed the total value of the inputs, and any leftovers (output is less than input) will be taken as a transaction fee by the miner who created the block that verifies the transaction. Also, an output can only ever be used as an input once.

So, in your example, David's 30BTC transaction is the only input, and you need an output of 20BTC to Bob's address. That leaves 10BTC in change. Typically, you would create another output back to yourself. This is called 'change'. So there will be two outputs, 20BTC to Bob and 10BTC to Alice (or maybe slightly less, providing a fee for miners and encouraging them to verify the transaction quickly).

The actual verification is complex, but a simple explanation would be that a verify-er can traverse the entire blockchain from start to finish, picking up every output and discarding outputs as soon as they are used as an input. When he's done, he's got a list of unused outputs that could be used in future transactions. To verify transactions included in the next block, he just has to make sure the transaction has inputs that are on the list, and that there are no other transactions in the new block trying to use the same input.

So, if David's transaction was used as input in the past, it wont be on the list. If Alive tries to be sly and create multiple transactions at the same time that use David's transaction, the miners will only include one of them.

Meanwhile, once you have your list, you don't really need to traverse the blockchain from the beginning again, you just have to keep your list up to date by reading each new block and removing used outputs and adding new unused outputs. That way, you always have a list of valid inputs.


How many Dogecoin-satoshis will ever exist?

Dogecoin has no maximum, because it mints 10k dogecoins per block, forever.

But to answer the spirit of your question, there are 100 million indivisible parts to a dogecoin. You can see that here.

static const int64_t COIN = 100000000;

There are currently 97 billion dogecoins. This is a bit more than 2^63 satoshis.

  Is it larger than the maximum 64 bit unsigned integer?

No, but it wouldn't matter if it was. There isn't a limit of 2^64 satoshis on the total money in Bitcoin (or altcoins). However, there is a limit of 2^64 satoshis per output.


This answer needs an update. As of 2017, the following exchanges support trailing stop orders:

Kraken - fees up to 0.16% - 0.26%
Bitfinex - fess up to 0.10% - 0.20%
Bitstamp - fees up to 0.25%

However, there's an important warning to be heeded: by placing trailing stop orders with any exchange, you expose yourself to very short-lived price spikes that are not reflected anywhere else. Here is a screenshot from Kraken where the three red dots represent trades triggered by the price falling by 25% for a minute, only to shoot back up immediately afterwards. The trailing stop didn't offer any protection here; on the contrary, it caused a loss.


Blockchain wallet showing 0 however app showing balance

If Blockchain support are not able to help you and you have the 12-word "backup phrase" I believe the best course of action is to migrate to a new wallet.
By migrate wallets I mean use your backup phrase with wallet software written by a different organisation. The only important thing stored in a wallet is the private key generated from the backup phrase (also referred to as a seed phrase or recovery phrase). So any wallet that contains that key can be used to spend money that has been received at addresses created from that key.
If you are a frequent user of Blockchain's other services, such as buying and selling Bitcoin or other cryptocurrency trading, you might not want to do this. However there are alternative exchanges that you could use instead.
There are several wallets that have a much better reputation than the Blockchain wallets.
For example see ...

How can I migrate from blockchain wallet to Electrum?

As well as the backup phrase, you need to know the "derivation path" for your old wallet. The accepted answer to the linked question assumes a derivation path of m/44'/0'/0'/0.
Instead of importing the key to a new type of wallet, it can be safer to sweep the keys into a new type of wallet. Sweeping just means using the old key in a new wallet to create a Bitcoin transaction that transfers the money to the control of a new key in the new wallet. If you ever imported additional private-keys into the old wallet you'd also have to either repeat that and import those extra keys to the new wallet or instead sweep those keys into the new wallet. Given your situation I would not sweep any keys at all until certain of the derivation path of your old wallet, it would be safest to first try importing the keys using the backup phrase and, once everything is working, then move the money to new keys.
If all this seems too complicated, you might reasonably conclude that Bitcoin is not for you.


Create a non-changeable bitcoin address?

With the majority of wallets, you'll be presented with a new address for each payment. As you mentioned, this is important for your financial privacy, so it is a standard practise.

That said, you can re-use an old address, and your wallet should detect the additional transactions received at that address, updating your balance accordingly.

In short: your wallet is a collection of addresses, it is not just 'the address that is currently displayed'. So you can re-use old addresses from the wallet if you so desire.


What happens if a monopoly grows in Bitcoin mining and payment processing?

In that scenario, the corporation could:

Launch a 51% attack at a whim
Pretty much control the Bitcoin economy, driving the prices up or down how it sees fit (at least until it spends all of their Bitcoins)
Control which transactions get included in the block or not. This could require one to use their specific client and thus gain more control over the network
Have a big impact on the Difficulty, as it could turn its machines on and off
Control the rate at Blocks are mined (for example, holding onto a solved block for certain amount of time before broadcasting it)
Control who gets to see the most recent Blocks. With this, they could hold out a long chain of solved Blocks for their own client, and when a standard client would finally mine a block, they could just release a couple old blocks to invalidate that chain

All in all, if you own majority of the hashing power, you can pretty much dictate your own rules, up to what the Protocol allows.


Why does my wallet say that I have 0.00BTC and 8.91 unconfirmed, when I had done nothing with them?

Once your client finishes downloading the block chain then everything should show as confirmed.


How can a miner verify that a UTXOs is not spent elsewhere?

A miner does so by checking if the UTXOs that new transactions are trying to spend are in the UTXO set.

The UTXO set is the collection of UTXOs that are non-spent, and therefore, can be redeemed by new transactions.

To do so, a miner (as well as any other node) checks the LevelDB database found in .bitcoin/chainstate by default in unix systems.

UTXOs are identified by its txid (Little Endian representation) leaded by a c.

In the answer for this question you can find an extensive explanation of the format in which the UTXOs are stored, with some examples.


Decide Currency before buying mining hardware?

Yes, it is true that different coins can require entirely different mining hardware. Some coins use sha, scrypt or some other algorithm; others use a different protocol altogether; and some are privately mined and can only be purchased.

If you want to participate in mining, you need to settle on a coin first. One consideration is whether the hardware for that coin can easily be turned toward a different coin. A lot of coins use sha or scrypt, so you'll have a lot of choices if you choose one of those.

After that comes the difficult and highly speculative part: the profit analysis. Good luck and happy mining.


You're confusing transactions (the abstract object) and their serialization (the bytes on the wire in the P2P protocol or on disk).

Sure, SegWit introduces an extension to the P2P protocol (BIP144), which relays witnesses along with transactions, and old clients wouldn't understand such messages.

But old clients don't see them. Witnesses are only included when the requester asks for them, which old clients don't do. For them, new clients remove the witnesses before relay. Exactly because the witness of a transaction does not contribute to its txid, it is in fact possible to remove them before relay, without invalidating them. That is what makes it a soft fork.


In order to use Bitcoin Core 0.14.0+ with Armory, you need to have Armory 0.96. Since you are using Armory 0.93.3, you will need to use Bitcoin Core 0.13.2 or earlier. Also keep in mind the armoryd has not been maintained for the past couple of versions so it may not work if you use Armory 0.94+.


If in order to verify a block your hash just has to be lower than the hash in the block, then why won't 00000000000000000000000000001 work every time?

It's not that you need a hash that is lower than the target - that's trivial as you pointed out. Rather you need to have a block whose block header must hash to a hash that is lower than the target. That is much harder to do because to find it either requires SHA256d to not have preimage resistance (i.e. given a hash, you can find the data used to produce that hash) or via brute force. Proof of Work works via the latter.


How does a node forget about other nodes?

There is no need for a node to "forget" a node. This is not something that is required nor necessary. What Bitcoin Core does in response to a getaddr message (so it sends an addr message) is that it checks its list of nodes. It filters through that list for the things that it recently had a connection to and that it didn't have multiple failed connections to before. There is no checking that a node is actually live and it doesn't do it on a set timer either.


When you buy bitcoin do you get the private key mailed to you?

No

There are lots of ways to buy bitcoin but usually I'd expect they don't involve creating a private key at all. You should ideally already have one before buying Bitcoin.

If you buy Bitcoin on a service that keeps your Bitcoins in some kind of customer account then most likely you don't have any private keys and are not the owner of Bitcoin - just the possessor of a kind of IOU.

  I'm very confused about how you get your private key ..

It varies but perhaps the most common way is that you download and install a standalone wallet program and, the first time you run it, it generates a random private key and stores it in a wallet data file. Typically you never see it.

  ... and how u can transfer it

You rarely need to.

Many wallets have a function to create a backup. You then put that backup somewhere safe that is separate from your computer. That backup will contain the private key. If your wallet (or whole computer) is destroyed or lost, you can re-create your wallet from the backup.

Many wallets will give you a "recovery phrase", sometimes called a "seed phrase". Often of twelve or twenty-four words. You can save that recovery phrase somewhere safe (e.g. stamped onto a sheet of corrosion-resistant metal with a high melting point stored in a safe in another building). That recovery phrase can be used to re-create your private key in a new wallet on a new computer. Don't confuse the recovery phrase with a password or pass-phrase used to open a wallet.

Many wallets let you see the private-key in some form. There is a form called WIF. Again that can be stored somewhere safe and used to recreate a new wallet with the same private key.

If you don't like your current wallet and want to start using a new type of wallet, the safest process is to create a new wallet and, on the old wallet, create a Bitcoin transaction to transfer the money into the new wallet. Some wallets allow you to "sweep" keys into them which is the same process but uses only the new wallet to create the transaction.


You can use one of the merchant solution providers, such as:
coinbase, BitPay, for generating addresses per payment (as paypal does) redirects / serve the client with payment request at 3rd party .
or, you can handle payment process inhouse by generating address for each payment and saving the pk / HD wallet will take much longer and develop time to do.


What are the limitations to an outdated backup?

Bitcoin-Qt has a feature called "keypool." It pre-generates 100 keys and includes them in all of your backups. This way, if you make a backup, it will also include the keys you're going to use in the future.

In general, sending a payment consumes an address, and receiving a payment consumes an address.

If you make 1 transaction a month, 100 keys will last 8 years.

However, if you change your wallet password, you must make a new backup.


Why does Bitfinex allow shorting with BTC as collateral?

Shorting is normal trading transaction on real financial markets. Without shorting you would not be able to speculate and profit on price decline. Assume that btc price is 400 USD and you think that the price will go down. By shorting one bitcoin you simply borrow one bitcoin from some lender and sell the bitcoin for 400 USD. If your assumption is correct and price goes down, say to 100 USD, you buy that bitcoin back and return it to the lender. Your profit then is 400 - 100 = 300 USD.


What happens when I buy BTC with XRP from the Ripple client?

Ripple operates differently for ripples and other currencies. Ripples can be transmitted between person to person like Bitcoins, while all other currencies operate like IOUs through a web of trust. When your friend that you trust sends you BTC, your Ripple accounts will show you both that they owe you some amount of money. If you ever send bitcoins to them through Ripple, the debt might be lowered, extinguished, or even reversed based on the amount.

If you want to get bitcoins into your Bitcoin address, you will need to go through a Ripple Gateway. They accept Ripple IOUs and pay you with an appropriate currency, including BTC.


In HD Wallet recovery how does the wallets know which addresses to recover

Does it just try all possible addresses related to that seed's master key ? (This seems impractical imo).

No, this is actually impossible to do since there is effectively an infinite number of addresses that can be generated from a single master private key.

Instead wallets generate keys at standardized derivation paths and assume that other wallets follow the same standards. This is generally a safe assumption. Wallets that do not follow the standard derivation paths usually have documentation stating what derivation paths they use so that you can specify in another wallet what derivation paths to use.

Most wallets follow the BIP 44 specification for derivation paths.

  Are there standards on the max nth of address to generate from the wallet side ?

No. Typically wallets generate addresses until they have generated n unused addresses (known as the gap limit). The gap limit is not standardized and many wallets allow you to configure it. In many wallets, the gap limit is 20 keys, however this probably is not sufficient when restoring. In other wallets, it can be 100 keys, and others 1000.


Create master public key after HMAC-SHA512


Which code part in bitcoin-core project generates new bitcoin addresses?

See CWallet::GenerateNewKey in src/wallet.cpp.  It calls either DeriveNewChildKey or MakeNewKey depending on whether HD wallets are in use.


Let's start with the exchange rate. Any exchange, be it for stocks, real currencies or decentralized peer-to-peer virtual crypto currencies, naturally generates an exchange rate simply from its normal operation. After all, it allows customers to trade, and the price at which trades were last executed is then called the exchange rate on that exchange. So they don't get that data from anywhere, they generate it (not arbitrarily, of course, but according to how their customers place orders and how trades result from matching orders).

All the other quantities you mentioned (which, if I may, I'd like to explain and correct to difficulty of mining blocks, total number of already mined blocks, reward for mining a new block) are specific to each crypto currency. You have to extract them from a client for the specific crypto currency, and the typical approach is to run such a client and use its (local) API.

Your question is how to write your own API. I suppose that means you want to run a website that offers a public API for querying the kind of data you mentioned. A natural approach would be to simply translate the calls for the data inherent to each currency (difficulty, blocks, rewards in your list) to a client you run for that currency. You may want to cache the results for some brief time if you anticipate high usage of your public API.

The exchange rates on different exchanges are more tricky, because the only authoritative source for an exchange's exchange rate is the exchange itself. You will have to find their API and use that. Also, here it would be a bad idea to just forward queries made to your public API. Instead, you should record the exchange rates and answer queries to your public API from this stored data.

There is a chance that many exchanges can still be accessed using only one kind of API convention. Have a look at what API the site bitcoincharts.com requires exchanges to provide. Presumably at least all the exchanges listed there provide it, and probably accept queries from anybody, not just from bitcoincharts.com.


How to request a list of blocks using bitcoin-cli?

You cannot as there currently no way in Bitcoin Core's RPC to get multiple blocks with one command. You will have to issue multiple getblock commands. If you use a JSON-RPC client programmatically, you can use JSON-RPC's batched requests in order to have to only send one JSON-RPC request to execute multiple RPCs and get the results back in one response.

As for how to extract the information, you will need a JSON parser to extract the information. You can use verbosity level 2 in order to get the transactions decoded as well instead of just their txids.


The recommended practice is to use any address for only one input and one output. Once you've done that, don't use it again.

To illustrate with examples:

You receive 1 bitcoin to address A. You later send 1 bitcoin out. The next time you receive any bitcoin it should be with new address B.
You receive 1 bitcoin to address B. You later send .5 bitcoin out. Transaction input should be 1 bitcoin from address B. Output should be .5 bitcoin to other person's receiving address and .5 bitcoin to your address C.
Later, you receive 1 bitcoin. You should receive it with new address D. Your total wallet balance is 1.5 bitcoin, between addresses C and D.
You spend .25 bitcoin. The transaction input should be .25 from address C and output should be .25 to other person's address and .25 to your address E. Address C is favored because it is the least number of inputs required to make the transaction. You now have 1.25 bitcoin between addresses D and E.
You spend .15 bitcoin. Input is address E. Output is other's address and your address F. You now have 1.1 bitcoin between addresses D and F.
You spend 1.05 bitcoin. Inputs are addresses D and F. Outputs are other's address and your address G. You now have .05 bitcoin in only address G.


What is the exact formula for calculating transaction fees?

See GetMinFee() in main.h for the code which determines the minimum transaction fee.

The part you're describing is implemented as follows:

// Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
{
    if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
        return MAX_MONEY;
    nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);
}

where:

nBlockSize depends on who we are:

if we're a user making a new transaction, nBlockSize is 1
if we're a node deciding whether to relay an incoming transaction, nBlockSize is 1000
if we're a miner deciding which transactions to include in a new block, nBlockSize is the size of the block we're building before adding the new transaction

nNewBlockSize is the size of the block including the new transaction
MAX_BLOCK_SIZE_GEN is 500kB
MAX_MONEY is 21 million BTC (all the money in the world)

so it's saying:

if we're either deciding whether to relay or mine the transaction, and adding the transaction would make the block over 50% full:

never allow a transaction that makes the block 100% full
otherwise scale the fee up by a factor of 500kB / (500kB - nNewBlockSize)

Note: by rearranging the symbols, we get exactly what Meni wrote in his answer:

Fee = Normal fee / ((500kB - size) / 500kB)
         = Normal fee / (1 - size / 500kB)


What you are describing is a well documented problem with Proof of Stake called Nothing at Stake theory.

  In PoW they could check the hash, but they can't here.

That's incorrect. You could produce a valid hash and still have double spend transactions in PoW. That is because bitcoin blockchain is designed to accept the longest chain (technically, chain with the most proof of work). However, to launch such an attack in a PoW chain, the attacker must either control >50% of hashing power to mine faster than the rest of the network or split his computing power in half if he wants to mine on competing chains. That is not economically sound decision and hence cannot be achieved with PoW. However, in PoS the shortcoming arises because it costs a validator nothing to validate transactions on multiple forks.

  How to prevent Nothing at Stake Attack?

There have been proposed theories that involves penalizing validators if they simultaneously create blocks on multiple chains, by means of including proof of misbehavior. This means malicious validator's deposit is deducted if two conflicting signed block headers are found into the blockchain as a later point in time. This can be achieved because, to qualify as a validator, nodes will have to lock certain in the chain through a smart contract.


Does secp256k1 library provide API for generating uncompressed key?

Use secp256k1_ec_pubkey_parse and secp256k1_ec_pubkey_serialize:

secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);
secp256k1_pubkey pubkey;

const unsigned char input[33] = {0x02,0x8c,0x28,0xa9,0x7b,0xf8,0x29,0x8b,0xc0,0xd2,0x3d,0x8c,0x74,0x94,0x52,0xa3,0x2e,0x69,0x4b,0x65,0xe3,0x0a,0x94,0x72,0xa3,0x95,0x4a,0xb3,0x0f,0xe5,0x32,0x4c,0xaa};

if (secp256k1_ec_pubkey_parse(ctx, &pubkey, input, 33) != 1) {
    puts("Public key not on curve");
    secp256k1_context_destroy(ctx);
    return 1;
}

unsigned char outpubkey[65];
size_t written_bytes = 65;
secp256k1_ec_pubkey_serialize(ctx, outpubkey, &written_bytes, &pubkey, SECP256K1_EC_UNCOMPRESSED);

printf("Uncompress public key: ");

for (int i = 0; i < 65; i++) {
    printf("%.2x", (unsigned int) outpubkey[i]);
}

puts("");

secp256k1_context_destroy(ctx);


Get private-keys from wallet using bitcoinj

for address prv key

  void key(){
        ECKey key = new ECKey();
        Address pubAddress = new Address(NetworkParameters.prodNet(), key.getPubKeyHash());
        DumpedPrivateKey privKey = key.getPrivateKeyEncoded(NetworkParameters.prodNet());
        System.out.println("Public address: " + pubAddress.toBase58() + "; Private key: " + privKey.toBase58());
}

if you want master private key then do something like this

        NetworkParameters params = NetworkParameters.prodNet();
        Wallet wallet= new Wallet(params);

        DeterministicKey watchingKey = wallet.getWatchingKey();

        // Get the standardised base58 encoded serialization
        System.out.println("Watching key data: " + watchingKey.serializePubB58(params));
        System.out.println("Watching key birthday: " + watchingKey.getCreationTimeSeconds());


How to return change (utxo - inputs) to output address?

When you create a transaction, all inputs are used up completely.

You then have to specify the destination addresses of the input money. Any amount without destination becomes available as transaction fee. Hence, you have to define the recipient, and send back the change to yourself.

In other words, add one of your own addresses as a second destination and assign the remainder of your inputs there.

If you haven't been doing so, you should experiment with transaction creation on the testnet. There you can learn without cost, because it behaves like Bitcoin, but its tokens are worthless.


It is a command that you enter into the command prompt. This isn't a file or something that you have to add to a file, just type it (or copy and paste it) into the command prompt once the bash shell is running.


Chance of a word repeating THREE times in a BIP39 Mnemonic passphrase? And what about 2 words repeating 2 times each?

The probability of 11.7% is being calculated using the birthday paradox formula.

"The paradox of birthdays is a mathematical problem put forward by Von Mises, who looks for the value N in the problem: In a group of N people there is 50% chance that at least 2 people in the group share the same birthday (day + month). The answer is N = 23, which is quite counterintuitive, hence the paradox."

So for the calculations:
-Repetition (Twice): 2 (number of people sharing the same birthday)
-Number of words: 24 (number of people in a group)
-Number of all BIP39 words: 2048 (number of days in a year)

The result is 0.119 (11.9%).
But for THREE repetitions it's getting really low: 0.00043 (0,043%).

Answering the question about two words both repeated twice, would require reworking the formula. I used an online calculator to provide the values.


Running Bitcoind as a service on windows 10

I think you need to add -daemon to your command in order for this to work. Also, you have -regetest in your command which implies that you want to use the Regression Test network (regtest). Besides the fact that you have spelled it incorrectly (it should be -regtest), regtest is not the same as mainnet (the main Bitcoin network) and I don't think that is necessarily what you want to do. Because you have spelled it incorrectly, you will be using the mainnet.


You have two options.

Option 1:
The returned json includes a "pageTotal":'some number'.
You can create a for-loop to loop through all the pages with API calls.

Let assume there are two pages aka "pageTotal":2

To fetch the first page, append parameter [&pageNum=0] to the end
Example usage:

http://localhost:3001/insight-api/txs/?block=00000000000000004dff81aadf782cceb8a2d082f0f255472791c8bb2984e958&pageNum=0

To fetch the second page, add param [&pageNum=1]
Example usage:

http://localhost:3001/insight-api/txs/?block=00000000000000004dff81aadf782cceb8a2d082f0f255472791c8bb2984e958&pageNum=1

Option 2:
Modify transactions.js , 'var pageLength' on Line 253.
The default is 'var pageLength = 10;'
Unsure if there are consequences by doing this, but I assume it should be fine.


Is there a way to create coinbase transactions with an RPC command?

Yep, it is partially possible with the getblocktemplate RPC command.

This is what miners routinely use to obtain the information necessary to begin mining a block.
The exact parameters and response has been specified by BIP 22 and BIP 23 (an extension for pooled mining).

These output values will provide the information you need:

"coinbaseaux" : {                 (json object) data that should be included in the coinbase's scriptSig content
      "flags" : "xx"                  (string) key name is to be ignored, and value included in scriptSig
  },
  "coinbasevalue" : n,              (numeric) maximum allowable input to coinbase transaction, including the generation award and transaction fees (in satoshis)
  "coinbasetxn" : { ... },          (json object) information for coinbase transaction

Unfortunately, although specified, it does not appear that Bitcoin core provides the "coinbasetxn" JSON object for you, so you'll have to create it manually. However, this will at minimum give you the coinbase value and transactions to include in the block.

You can create the coinbase transactions just like any other transaction, however it MUST abide by the following rules:

BIP 34 which requires you to prefix the input script with the serialized height of the block.

For example, the input script of block 549,322 is:

------ Original ------
03CA6108FABE6D6D15B0663A60E46473FBA0C15DBEDCC466A5B71C741D9FFE721E38E9D161BCE45201000000000000000C65070100FB9B000013D7EC00082F736C7573682F

------ Decoded ------
03 -> Push 3 bytes
CA6108F -> 549,322 (height in littleEndian)
------ Remaining data is arbitrary ------
ABE6D6D15B0663A60E46473FBA0C15DBEDCC466A5B71C741D9FFE721E38E9D161BCE45201000000000000000C65070100FB9B000013D7EC00082F736C7573682F

Must have one TX input
Previous hash =  0x0000000000000000000000000000000000000000000000000000000000000000 (since coinbase is the first TX in a block)
Previous output n = 0xFFFFFFFF (-1 decimal since coinbase is the 0th transaction)
Output does not exceed (block reward + fees) or the coinbasevalue if you're using the RPC command with the provided transactions.

In our example block (549,332), the coinbase transaction's raw hexadecimal (the output found in createrawtransaction RPC command) is:

010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff4503ca6108fabe6d6d15b0663a60e46473fba0c15dbedcc466a5b71c741d9ffe721e38e9d161bce45201000000000000000c65070100fb9b000013d7ec00082f736c7573682f0000000003b33eee4a000000001976a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac00000000000000002c6a4c2952534b424c4f434b3a8cca119e75a4d70a57346f0fb9facc55f00f150265095a92ca27a9b1b1ac6e000000000000000000266a24aa21a9edb8c0253a8b72023513b3f8c08591fb009e1b89d1651ee044d183a4c627399a710120000000000000000000000000000000000000000000000000000000000000000000000000

which decodes to:

01000000 -> txVersion
00 -> SegWit marker
01 -> SegWit flag
01 -> Input count (important that it is 1 for coinbase transactions!)
0000000000000000000000000000000000000000000000000000000000000000 -> Previous hash
ffffffff -> Previous output #
45 -> input script length
  03 -> Push 3 bytes
  ca6108 -> block height (littleEndian)
  -- arbitrary data --
  fabe6d6d15b0663a60e46473fba0c15dbedcc466a5b71c741d9ffe721e38e9d161bce45201000000000000000c65070100fb9b000013d7ec00082f736c7573682f
00000000 -> sequence
03 -> output count
  b33eee4a00000000 -> output 1 value
  19 -> output 1 script length
  76a9147c154ed1dc59609e3d26abb2df2ea3d587cd8c4188ac -> Pay-to-Public-Key-Hash script

  0000000000000000 -> output 2 value
  2c -> output 2 script length
  6a4c2952534b424c4f434b3a8cca119e75a4d70a57346f0fb9facc55f00f150265095a92ca27a9b1b1ac6e00 -> provably unspendable

  0000000000000000 -> output 3 value (witness commitment)
  26 -> output 3 length
  6a24aa21a9edb8c0253a8b72023513b3f8c08591fb009e1b89d1651ee044d183a4c627399a71

01 -> number of witnesses
20 -> witness length
0000000000000000000000000000000000000000000000000000000000000000 -> witness
00000000 -> locktime

For more information on how to actually utilize createrawtransaction with these values, see this and this.


How to decode messages embedded with btcmsg?

Their FAQ links to a document that describes the protocol, and they provide an open source Python client to decode the messages. The server implementation is also open source.

I put the client files + protocol spec on a github gist, just in case.


Etsy merchants that accept bitcoin have been tagging their shop items with 'bitcoin' so that a simple search shows what is available:
http://www.etsy.com/search?q=bitcoin

An email to support@etsy.com got this response about being allowed to use bitcoin:

"If you would like and are able to support a third party payment system, you are welcome to use another payment service."

They also included instructions for how to setup your cart so that people can easily pay:

"To do that, click Your Shop > Shipping & Payment > Payment Methods. Select 'Other' as a method. Then, indicate which service you use in your Shop Announcement, listings and/or Policy Page. After the buyer has purchased an item using 'Other,' you can contact them with instructions and/or an invoice so they can pay through your preferred method."

Enable the 3rd party 'Other' checkout option, and when someone orders an item you can send them your bitcoin payment address.

You can also join the Etsy Team Bitcoin page, and there is Discussion threads for you to ask questions. The team page has information on the different bitcoin wallets you can use such as coinbase.com or downloading the reference bitcoin client from bitcoin.org.
http://www.etsy.com/teams/10366/bitcoin


First of all, you can use 1-of-1 msig for a redeem script:

OP_1 push(pubkey) OP_1 OP_CHECKMULTISIG

But this one is better:

push(pubkey) OP_CHECKSIG

And of course, you are welcome to use segwit form

OP_0 push(hash160)


Is there any intention by the respective author or by Bitcoin.org to edit, improve or re-write the white paper for absolute clarity?

The pseudonymous author (Satoshi Nakamoto) has not been present online for many years; I suspect we will not see Satoshi return for a whitepaper update.

You can learn more about the contributors of bitcoin.org on this page.

Updating the whitepaper is not a priority in any sense. It is a technical paper that lays out the fundamentals of the Bitcoin Network, and it does that job well. Further, I don't believe any person or party would be capable of doing so in a way that everyone can agree on. Bitcoin has no leader, and the whitepaper is an artifact of Bitcoin's history- which is not to say it is irrelevant, just that it had its place in time. It is a great resource and starting point to learning about the Bitcoin protocol, but the modern Bitcoin network has advanced beyond what is laid out in the whitepaper, and as such there are now many other additional resources available to learn from. This website is one such resource, if you search through the history of questions you'll find there is a lot of good information available here.

With so many other resources available online, there really isn't a need to rewrite the whitepaper, at least not in any 'official capacity', even if such a thing were to exist.

  Among others I do not understand the value of repetitive manipulation of the message, until a hard-to-find number can be added to the message, that then forces the digest into an arbitrary format to show a given number of starting zeros.

You may be interested to read the answer I wrote here, I think it may answer your question.


is bitcoin stability by securitization possible?

Yes, this is possible but like cracking a good hash, signature, or key it is improbable.

Assuming that the supply of a coin remains perfectly stable and is expected to do so, some massively overwhelming amount of derivatives could do this, but there would have to be no transaction costs to achieve this level of stability because any cost to trade will be passed onto to the holder as volatility since any cost would reduce the demand for those volatility-reducing derivatives.

A single entity would not be able to do this; furthermore, a large percentage of total world wealth would have to be dedicated to this purpose, all hedging and speculating in random harmony.

Those are the conditions for perfect price stability through relying on derivatives.

Determining liquidity levels is better when cryptocurrencies are compared to their fiat counterparts.  Bitcoin is 3x the spread for fiats, last I checked, so there is still plenty of transaction costs.  This is not to say that fiats and securities don't have transaction costs.  For one thing, locked markets are forbidden, so there will always be transaction costs in the amount of the bid-ask spread for the duration of that restriction.  This shows that for the level of price stability achieved by other fixed supply commodities, cryptos would have to be at approximately equal to such commodities respective ratios of notional to underlying.

Most cryptos have a wall on this potential in the form of confirmation times.  A dynamic trader cannot exist in a market with one hour delays on trade confirmations even at the periphery since they need to trade between exchanges and other assets.  The low confirmation cryptos have the best chance for stabilization by derivative.

However, this isn't to suggest that approaching the ideal isn't possible.  The more derivatives that are tied to an underlying coin will result in more price stability for that coin.


Do sigops count towards the block weight in SegWit?

No. The block weight is only calculated from the bytes themselves, not the sigops. Accounting for the sigops would need a hard fork, as explained by the section above the example:

  It is not possible to solve this problem without either a hardfork, or substantially decreasing the block size. Since segwit can’t fix the problem, it settles on not making it worse: in particular, rather than introducing an independent limit for the segregated witness data, instead a single limit is applied to the weighted sum of the UTXO data and the witness data, allowing both to be limited simultaneously as a combined entity.


How does blockchain technology handle the actual transaction data?

how are these files stored, encrypted and sent to B on the blockchain?

They aren't. Those files are not stored on the blockchain nor are they transmitted to B using the blockchain.

  Does blockchain technology handle the security of the actual digital merchandise?

It can, if you make one that does. Bitcoin's does not.


What is the difference between PPS+ and PPS?

PPS+ meaning that you receive payment per each share + block fee reward distributed using PPLNS.


Why do we call it a 51% attack instead of a 50% attack?

The distinction is of theoretical importance only.   But if the attacker controls exactly 50%, then it's true that the attacker will eventually catch up, but he won't stay caught up: the honest population will eventually overtake his chain, and we'll be in an unstable situation where control of the "best" chain will bounce back and forth between them forever.

If the attacker wants to eventually catch up and stay caught up, he needs to have strictly greater than half of the mining power.  In this case, they might bounce back and forth for a while, but eventually there will come a time when the attacker takes the lead and never again loses it.  We say "51%" informally to summarize this, though of course 50.1% or 50.000001% would also be sufficient.


Confused about LND derivation of node's payee pubkeys

Wrong cointype. I'm assuming mainnet = 0, and testnet = 1,  although I can't find any documentation on this.
m/1017'/1'/6'/0

gives the correct identity key.


Does bitcoin miner heat as much as a heater

A device that consumes N watts of power (and doesn't output electricity or some other form of energy) will eventually produce N joules of heat per second.
Thus, if your goal is converting electricity to heat, every piece of hardware that consumes electricity is 100% efficient. It's completely irrelevant what happens with that electricity before it becomes heat.
Of course, you need to take hardware depreciation/maintenance costs into account.
Also of note: as heating devices, heat pumps have over 100% efficiency, as they simultaneously consume electricity (which is turned into heat) and move additional heat from a colder area to a hotter one.


How do I recover/use an old wallet from 2011/2012

It just works fine with the modern versions of the software with no changes necessary. Sync will take anywhere from a few hours to a few days depending on your hardware and connection speed. Make more backups than you think are necessary.


When I make a transaction, how is it broadcasted to other clients?

They're found using a gossip protocol.
Transactions are sent using this structure: https://en.bitcoin.it/wiki/Transactions


Create P2SH redeemScript as OP_PUSH publicKeyHash:

  redeemScript: 0014d5e5d05edfe2ed61099bf3f0d53be2775bbc6d0d

It's actually `OP_0  but you have resulted in the right thing anyways.

  Generate scriptPubKey as OP_HASH160 hash160(redeemScript) OP_EQUAL

  scriptPubKey: a914a19949e546c2f4d410cbb061c986b9ff3099ae7087

  Generate RIPEMD160 hash of scriptPubKey:

  hash: dc62e525af22d1f0f17cc2a091cf2c9fb36bf553

These steps are incorrect. The thing that is hashed for a P2SH address is the redeemScript, not the scriptPubKey. Instead of doing step 3, you would skip directly to step 4 and hash the redeemScript instead of the scriptPubKey.


Where to find help understanding Bitcoin's source code in C++?

I am not aware of an extensively commented version of the Bitcoin sourcecode, but you could check out the Bitcoin Developer Reference and you can read online the book Mastering Bitcoin by Andreas M. Antonopoulos, which covers Bitcoin's technical aspects extensively. There is also Princeton's Free Online Bitcoin course, which goes into details on some technical aspects, which might in turn help you understand the sourcecode better.

Besides that, try searching Bitcoin.SE for specific questions, there are a few here that have been asked about already, if you can't find something, feel free to ask a new question here.


Adding watch-only addresses to Blockchain.info through an API?

It seems that Blockchain.info, among others, is compliant to the bitcoin JSON RPC API. That given, you can use the most common programming languages to access your wallet, last but not least the simple bitcoin-cli command, from the original bitcoin distribution:

$ bitcoin-cli -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword getinfo

-rpcconnect=rpc.blockchain.info will instruct bitcoin-cli to connect to blockchain.info's RPC interface; -rpcport=443 specifies the remote port; -rpcssl needs to require a SSL connection; -rpcuser and -rpcpassword speak for themselves.

The last word, getinfo, is the command itself.

In your case, it should be something like:

importaddress <bitcoinaddress> "" false

where importaddress is the command (or method) which instructs the wallet to include the <bitcoinaddress> in the wallet itself. Since you don't specify the private key of the address, but just the address itself, it will become a "watch address" inside your wallet: you will be able to track its status but not to broadcast transactions which involves it. The couple of double quotes "" can be replaced with the wallet's name, if you set one. false is a boolean value which instructs the bitcoin engine not to rescan the whole blockchain looking for transactions which involves the address you are adding. I am not a blockchain.info customer, so I don't know the effects of this particular flag. I believe that it is ok to set it true, since blockchain.info scans the blockchain in real time.


The work done when mining is not accumulated over time.  Each hash calculated is independent from the others.  Think of mining as repeatedly rolling a huge die and trying to get an extremely low number, instead of working towards a solution of a complex problem.

If a miner loses connection to the internet, it will be unable to submit work during this time period.  Work done during the outage may or may not be stale (too old to submit) when connectivity returns.  However, no previous work will be lost, as this work would have already been submitted immediately to a pool/the bitcoin network if it was useful.


If I use a multi-sig wallet for Bitcoin, and require a total of 2/3 keys to sign a transaction, does that mean that the total time would be limited to the time to confirm 2 signatures ie ~ 20 minutes if done simultaneously?

No, not at all. That is not what a confirmation means or how Bitcoin works at all.

A confirmation means that a transaction has been included in a valid block. It has nothing to do with the number of signatures. A multisig transaction just means that the transaction requires more signatures in order to be valid. The signatures are contained within the transaction itself.

The time to confirm a multisig transaction is the same as the time it takes to confirm a non-multisig transaction assuming everything else is the same (i.e. same fee rate).

  And would it cost the same as a regular Bitcoin transaction?

It costs more because the transaction contains more data. Thus the absolute fee will be higher, although the fee rate will still be the same.


Check out my ccxt library on GitHub: https://github.com/kroitor/ccxt

With it you can access market data and trade bitcoin, ether and altcoins with many crypto currency exchanges. It is used to connect and trade with crypto markets and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, trading strategy backtesting, bot programming, building trading algorithms on top of it, webshop integration and related software engineering.

The code is in JavaScript / Python (2 and 3) / PHP. You can deploy it from PyPI, with npm (for Node.js) or by cloning from GitHub repository.

The ccxt library is under heavy development right now, but already offers a quick-start for trading and technical analysis with many crypto exchange markets out of the box.


How can merchant be alerted of any double-spend attacks ?

Running their own daemon will achieve that.

  Procedures to consider in the time of the attack ? e.g Shutting down servers to avoid confusion and recheck balances to avoid dead ends on user withdrawals

Any backend services run by a merchant need to be able to handle block chain reorganisations anyway! They happen normally, randomly, and without malice. Shutting down is obviously not an option for an event which happens more than once a day. Not handling this behaviour will open the merchant up to rampant theft.

  How safe is it to run an out of the box Bitcoin Daemon?

Reasonably, the daemon is generally considered to be safe and is written in a language that is normally considered to be safe (C++). However, there have been potential code execution problems due to OpenSSL library and miniupnp. A good node would be at a minimum in a different user account, not not different hardware from production services.

  Will Bitcoin XT be alerting on any double spend transactions that occurred no matter how the attack succeeded ?

Bitcoin XT is irrelevant. The Bitcoin Core software does not handle alerting you to this, however the best canonical chain changing makes it fairly obvious through the RPC interface.

  Is it Okay to host a high bandwidth and Intensive website along with a bitcoin daemon?

No. Bitcoin Core is extremely intensive on CPU, IO and memory. It is an extremely harsh test of hardware and will frequently find underlying issues like disk and RAM failure better than any other test- at the cost of your stability. You don't want a vulnerable web server next to something storing money.

  How Unlikely is it to pull of an attack to a website that credit users on 6 confirmations?

Perhaps unlikely.


If you were smart enough to set up the system you describe, you'd have far easier ways to earn $100!

Such activity would show up in statistics as a significant drop in ad clicks or similar measurements. If the operator of the site is canny, they could start to make regular (even automated) changes to the site design to make it tougher to parse. It's a cat and mouse game I guess in a similar way to malware and anti-malware software.

If you dropped the profitability of the site too much, I'm sure it would close.

This question discusses the legality of fraud relating to Bitcoin:
Is performing a 51% attack / double spend on Bitcoin illegal?


How does the network know my current balance?

The network doesn't know your current balance.

The bitcoin network doesn't use the concept of "balances".  Instead the Bitcoin ledger tracks assignments of value.  So every bitcoin that exists was initially claimed by a miner, and then there have been assignments of value ever since.

Now a bitcoin client can show a "balance" for an address but that balance is simply the result of looking at all the transactions for an address and determining which payment assignments made to that address remain unspent.

An unspent transaction is referred to as an UTXO (unspent transaction output).

So a balance for an address is simply all the UTXOs for that address.   This can be determined from the blockchain.  This is a huge amount of transaction data but that's why the Bitcoin-Qt/bitcoind client uses LevelDB which is very efficient at retrieving from a dataset like the blockchain.


Input/Output size for various transaction types

This website (https://www.buybitcoinworldwide.com/fee-calculator/) shows the approx size of transactions according to the address type, number of inputs and number of outputs and the final fee (after you set how much sat/byte you want to pay)

As you play with it you will see that the most important if you are worried about fees is to reduce the number of inputs. The best practice is to consolidate your small inputs in native segwit addresses (bc1...) when fees are low.

This way when you need to transfer bitcoins when the network is congested you will have a smaller transaction size, paying less fees.

Be careful with your privacy while doing so.


Where can I direct download the NXT blockchain data instead of from the client?

Go to http://www.peerexplorer.com.
Click on the orange link at the bottom of the page: "Download Nxt Blockchain"
In the pop-up window, click on the "Mirror 1" link. This takes you to dropbox.com.
Click on "Download". You can skip registration.


Failed to build Bitcoin Core from source, Ubuntu 17.10

That error means that protoc was updated since paymentrequest.pb.h was generated (it is not part of the source distribution, protoc generates it). Do make clean and then make. That should fix this error.


How to get the time when a block is received at a node?

I don't believe this is exposed via the JSON-RPC API.

The easiest method would likely be to have a program monitoring debug.log and look for the best height update messages - they will be a few milliseconds off, since I believe those are only logged after block validation has succeeded, but it is likely the closest you can get to a per-node block receipt time, at least without monitoring the network traffic.


If bitcoincore.org goes down how can I access it? What can I do to help others access it?

Wladimir van der Laan answered this on Mastodon.

if you want to help, make mirrors (can we do something like "deterministic verifiable builds for websites"?), host the files, seed the torrents

Is there a more robust way to create a mirror exist now, other than wget -mkxKE -e robots=off https://bitcoincore.org?

Yes wget seems suboptimal. The robust way is to clone the website off github (git@github.com:bitcoin-core/bitcoincore.org.git), so that you have a copy of the source code as well, then you can build it yourself. That gets all releases and verifies them against their gitian.sigs hashes

However that's for the website—it won't give you a copy of the historical release binaries, i'm not sure of a good way to mirror those, maybe best would be to make a script based on https://github.com/bitcoin/bitcoin/blob/master/test/get_previous_releases.py and https://github.com/bitcoin-core/bitcoin-maintainer-tools/blob/master/gitian-verify.py

This one might actually be best, it downloads SHA256SUMS.asc for an arbitrary release, verifies the signature, and downloads all the files mentioned in it: https://github.com/bitcoin/bitcoin/tree/master/contrib/verifybinaries


Are There Abbreviations/Acronyms/Codes for Cryptocurrency Exchanges?

No, there are not such codes for Exchanges, like there aren't any codes for different websites. The codes for the different currencies are just for shortening I believe. It's easier anyhow for trading pairs (NMC/BTC instead of Namecoin/Bitcoin)


What you are asking about is the message covered by the signature. In Bitcoin, this message is defined by the consensus rules and is a modification of the transaction the signature is contained in.
The exact form of this message for non-segwit transactions is explained in How to redeem a basic Tx?


What should I do about the March 12th 2013 blockchain fork?

Gavin Andreson has tweeted this:
https://twitter.com/gavinandresen/status/311290936527298561

The bitcointalk post linked by Gavin is a post by Peter Wuille, which says this:

Hello everyone,

there is an emergency right now: the block chain has split between 0.7+earlier and 0.8 nodes. I'll explain the reasons in a minute, but this is what you need to know now:

After a discussion on #bitcoin-dev, it seems trying to get everyone on the old chain again is the least risky solution.
If you're a miner, please do not mine on 0.8 code. Stop, or switch back to 0.7. BTCGuild is switching to 0.7, so the old chain will get a majority hash rate soon.
If you're a merchant: please stop processing transactions until the chains converge.
If you're on 0.7 or older, the client will likely tell you that you need to upgrade. Do not follow this advise - the warning should go away as soon as the old chain catches up.
If you are not a merchant or a miner, don't worry.

An announcement has also been made at bitcoin.org.


Order list or trades history Btce via api

I know it's an old post, but I stumbled on it while asking myself the same question. The answer is to use the ActiveOrders method (which I don't think is implemented in the  c# BtceAPI)


How would I need to change ElectrumX to use FIFO selection of UTXOs?

By default, UTXOs are picked randomly.

You mean in Bitcoin Core's wallet? No, they're not picked randomly. There are a number of strategies, but in general the aim is to avoid change if possible, avoid transaction outputs with few confirms if possible, and otherwise create a match close to the amount intended to be sent.

  My want to change this behaviour and spend UTXOs on 'FIFO' basis. What changes do i need to make?

That's possible - the wallet already knows the timestamp when transaction outputs were created, so you don't need to make any changes besides changing the coin selection algorithm. In particular, you don't need to add timestamps to UTXOs.

However, FIFO isn't known to be a very good strategy. Mark Erhardt's thesis does a comparative study to analyse various coin selection strategies. There is ongoing work in Bitcoin Core to adopt some of the outcomes of this research, some of which is already completed. In particular, the master branch as of writing (April 2018) includes the Branch and Bound strategy for change avoidance.


Providing Liquidity in CryptoCurrency Exchange!

The liquidity would be dependant on the amount of available exchangeable cryptocurrencies or fiat currencies. And to answer your question all crypto currencies, ICOs, tokens, and etc. hold some value and they can be exchanged, and that's what solves the liquidity issue.

For example coinbase accepts xyz $ and allows u to change it into xyz crypto currency like ripple or something, the more available currencies higher the liquidity and the ease of transaction increases the liquidity of assets.

This question is to some extent unnecessary. But, hey all of us get confused at times!


Has anyone tried mining with visitors' computers

You should have a look at this question about web miners.

In general, web miners use JavaScript and WebCL in order to perform operations on the GPU.

However, it might not be as profitable as you think. Considering that most people have very poor GPUs. At the moment if you'd have someone with a decent 200MHash/s card on your website for 24h, you'd basically earn 3 cents. You can check how much you could earn by visiting my calculator. All in all, you're better with ads.


what is good starter for trading with bitcoin

Trading or day-trading BTC is not as easy as it seems. I'd recommend paper trading or trading with a small amount of money until you can develop a profitable strategy.

Use Whaleclub for demo trading and trading using BTC only (no dollars or banks).

If you need to buy BTC, look up an exchange in your country at Bitcoin.com's Buy Page.


Understanding getchaintips in terms of chain reorganisations

valid-fork means that the blocks were fully downloaded and validated. It is likely that they were part of the active chain but were reorganized after a better chain was received.

valid-headers means that the blocks were fully downloaded but not fully validated. Only the headers were validated to have a valid Proof of Work before the block was written to disk. Tips with this status could have been valid-fork, but they never had the chance to become part of the active chain and thus never actually fully validated.

headers-only means that the node only has the block headers but not the full blocks themselves. This could happen for a variety of reasons - maybe a node announced those headers but failed to provide the block itself.

One notable headers-only entry you may see is the Bitcoin Cash fork. This is listed as headers-only your node may have received the block headers for that fork (up until the PoW changed) but did not download the blocks for those headers after it found that the first block in that fork was invalid.


Is there logically any way to "live off of Bitcoin interest" without giving up control of your coins?

This is possible, but not exactly in the way you're expecting!
Consider what you really want here: is it just an increased number of dollars or BTC? Nope! What you want is an increase in your buying power. Stop to think about the difference here for a second - it is important!
The goal is an increase in buying power, which means you want the ability to buy more tomorrow, than you could today.
Banks pay interest on deposits because they will use those deposits to make investments of their own, and those investments will (hopefully) do well and make the bank some profits. The actual cash money itself doesn't just magically grow! It is the investments that provide the profits. With the money itself, the opposite is true: as the money supply grows (unpredictably!), each individual dollar will hold less buying power than it did before. So just keeping dollars stored under a mattress is actually a pretty bad idea: that money will have less buying power tomorrow, than it did today. If the goal is to increase buying power, then clearly just holding dollars is bad, and so the prudent individual will find investments that can increase in value over time. With enough money invested, they can 'live off the interest' of those investments.
Bitcoin, on the other hand, is a very different type of money, in that the supply of it cannot be inflated, so the act of just holding coins does not suffer from the same issue of unpredictable dilution that dollars do. If BTC maintains current adoption/use rates*, and society progresses and grows in GDP, then each BTC will accrue more buying power over time.
The difference should be obvious: dollars are a bad asset to hold, they lose purchasing power over time due to an (unpredictable) dilution of supply. Bitcoin does not suffer from this, so a holder might expect their purchasing power to increase over time. Many people call bitcoin a 'hard money', as in, 'it is hard to produce more of'.
So all of that is to say: just like dollars, if you hold enough BTC, you could maintain a certain amount of purchasing power over time, while still living off the nominal increase in purchasing power of your BTC. The actual number of BTC you own would slowly shrink, but this is somewhat inconsequential if your goal is to just live off the interest while maintaining your net purchasing power.

*of course, bitcoin is currently in a young stage of growth, so it is a fairly volatile asset in regards to purchasing power over short time frames. But consider what the situation would be if it were as widely adopted as dollars - that is the more interesting situation in regards to the idea I mean to put forth here. Of course, if bitcoin continues to grow in popularity and use, then we might expect the buying power of a coin to increase, and vice versa.


Query Blockchain: Reference previous transaction in "txin"

txin.prev_out contains the txid in internal byte order. This is the opposite of tx.hash

You need to reverse the bytes. Here's a short python program that will do that:

import binascii
hash = '32d7724fb0d244f50281a500f505818bb655bc029158fd59d477f4445a6ed64a'
def reverse_hash(hash):
    hash = binascii.unhexlify(hash)
    hash = hash[::-1]
    return binascii.hexlify(hash)

print reverse_hash(hash)


Bitcoin Pro API - How do you format start/end time for Historic Data?

This time format is known as Unix time. It is the number of seconds since 00:00 UTC, January 1st, 1970.


How many correct hashes are there giving a difficulty?

Yes, there are a lot of hashes with low enough values to be acceptable. Precisely, there are target + 1 hashes which are acceptable.

The target varies over time and is adjusted every 2016 blocks (called a "difficulty period") so that with the then-current hashing power of the network, the average block time of the next difficulty period would be 10 minutes.

About every block explorer should be able to show you the block hashes. The hash of the current block (block 453794) is

0x0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa

You can see this in the table of the block explorer of your choice:

https://blockexplorer.com/block/0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa
http://blockr.io/block/info/453794
https://blockchain.info/block/0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa
https://www.blocktrail.com/BTC/block/0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa

The difficulty cannot be shown by all block explorers, but by some. It currently is 440779902286.5892. The difficulty merely is an easier-to-read version of the target. You can learn more about it on https://en.bitcoin.it/wiki/Difficulty.

I haven't calculated the current target but it got to be at most

0x0000000000000000006ec06a9ae920278c462a565cd8f31ea87acaa05e5fbafa

because otherwise, the current top block wouldn't be a valid block.

Every hash smaller than that is also accepted. Note that the representation of the hash in in hexadecimal which is the most common way of representing hashes.

You can just ask WolframAlpha what that number is in decimal. It's this monster:

10607898375488084905905799981068947599790252823802788602

Because 0 is also valid, there are at least

10607898375488084905905799981068947599790252823802788603

acceptable hashes.

Or in a more sane notation:

1.06*10^55

For comparison: You're probably made up of somewhere around 7*10^27 atoms and Earth's circumference is about 8.01*10^11 times the width of a human hair. So, yeah ... quite a few options to choose from.


The public key is used in the script. Technically, it is the pubKeyHash, which is RIPEMD160(SHA256(publicKey)), which means the public key isn't revealed until the transaction gets spent.

The way that validators can ensure it is you who spends the money locked up with a specific public key is by digitally signing the transaction which spends it, with the private key matching the public key. A digital signature can be verified against the public key to ensure that only the corresponding private key could have possibly created the signature.

Assuming a P2PKH transaction having scriptPubKey of the form:

OP_DUP OP_HAS160 pubKeyHash OP_EQUALVERIFY OP_CHECKSIG

The input script to spend simply has the form

signature publicKey

When the output is spent, the signature of the spending transaction and the public key are pushed on the stack before the scriptPubKey is evaluated.

The script first duplicates the public key on the top of the stack with with OP_DUP, and performs the OP_HASH160 on the top item. (HASH160 performs the same RIPEM160 and SHA256 which created the original pubKeyHash). This removes the duplicated public key from the stack and replaces it with the public key hash.

The script then pushes the pubKeyHash which was embedded in the scriptPubKey onto the stack. The two items at the top of the stack are then compared for equality (OP_EQUALVERIFY), and popped off the stack. If equality test fails, the script fails early.

The remaining public key and signature at the top of the stack become the arguments to OP_CHECKSIG, which verifies that the signature of the entire transaction corresponds to the public key. The signature and public key are popped from the stack and replaced with either true or false, indicating the final result of the script evaluation.


I forgot which software I created my wallet with. How can I recover from a 12 word seed phrase?

I happened to write down the 12-word phrase.

You are in a very good situation. Much better than many new bitcoin owners who ask questions here. It is very likely that your bitcoin is safe and needs no urgent action.

  how can I find the wallet I created?

You don't need to, wallets are not important so long as you have the 12-word seed-phrase. Wallets don't contain your bitcoin, they are just a way of using the private-key (derived from the seed-phrase) which gives you control over your bitcoin.

Wallets are completely disposable. Just keep backups of your seed-phrase (or the private key itself) and guard them very closely.

The key things to do are

Don't panic, there is no urgency here.
Don't rush into things, you have time to work out the options that suit you best.
Don't let anyone else see your 12-word seed-phrase
Spend some time to understand

the different types of wallet available
the basics of

how wallets work,
what a private-key is,
what an address is,
the difference between a private-key and a seed-phrase.

choose a wallet that suits your needs, chytrik's answer contains a list.
I note that CoPay runs on Android and supports 12-word seed-phrases
but there are many choices available, take your time to choose one.

  How can I recover from a 12 word seed phrase?

Chytrik's answer give you some good advice. The exact steps depend on which wallet you decide is best for you.

If you want to hang on to your Bitcoin for five years, you need do nothing other than lock away in a very safe place your 12-word seed-phrase.

I understand you'll feel compelled to check the amount of bitcoin you control though, that involves at least using a wallet to derive the private key from the pass-phrase and to derive the receiving address from the private key. The wallet will do all this automatically when you import the seed-phrase into it. Once you have an address you can check the unspent bitcoin value associated with that address by using any of several blockchain explorer websites.

Useful references here

How can I safely store and trade Bitcoin and other crypto currencies?
Where can I find more resources that explain Bitcoin simply?
What are the advantages of running a full node in comparison with a lightweight client?


Is it possible to have complete cold storage in NXT?

I don't know if this is the recommended way, but I did this by using the Send Nxt API call on an offline computer, storing the transaction bytes, and broadcasting the transaction from an online computer by using the Broadcast Transaction API call.


How is Ethash a 'memory hard' algorithm if it utilizes peak GPU memory bandwidth?

"Memory hard" means the algorithm is designed to use a lot of memory; its purpose is to prevent an ASIC being developed that would overwhelm the existing CPU/GPU-based mining.

This site indicates the memory bandwidth for a GTX-1070 is in fact 256GB/sec, which fits your calculation.


Is it possible to get the full list of synced nodes ɪᴘ on the network?

Sites like bitnodes use a crawler to discover many nodes on the Bitcoin network. They start a node which connects to some nodes initially, and then requests for more nodes to connect to from those nodes. They connect to the nodes they received and repeat the process until they have queried every listening node that they can.

Note that this does not get every node. It can only scan listening nodes and only the nodes which have been up long enough for another node to return its IP address in a query for nodes to connect to.


How to deal with bitcoin/crypto volatility as an online casino?

Do players gamble in USD or in BTC?
If players gamble in BTC then it is not your problem to deal with. You just deal in BTC and take a cut of the BTC. If the player who wins BTC ends up losing USD, that's not your problem - just like if a player goes to a European casino and wins EUR but then loses money after converting to USD, it's not the casino's problem.
If players gamble in USD and use BTC only as a transfer mechanism, then you should have some sort of financial mechanism to hedge against price changes. For example, you could sell the BTC as soon as you get it, and buy more BTC when players withdraw.
I am not a lawyer and this is not legal advice.


bitcoin mining on a laptop gpu, nvidia GT 120m?

Laptop gpus are no good for mining bitcoins. Not anymore, at least.


Does segwit solve malleability of the witness part?

but can't the witness part be malleated, just like the scriptSig can in a non-segwit transaction?

Yes, absolutely.

But the witness does not contribute to the transaction id (txid), which is what subsequent transactions refer to. Because of this, malleating a witness in a given transaction does not invalidate follow-up transactions using this transaction as an input. This is important for any application where multiple parties rely on an unconfirmed transaction to keep a stable txid.


How do I accept bitcoin payments at a real world store?

Green address technique from Instawallet. System sends bitcoins from well known address called Green Address and if recipient trusts Instawallet or any other major organization that uses same technique, then he or she can accept payment without waiting for confirmations. This is what already implemented but it solves only the third problem.

Instant TX for established business relationships is in early development stage but it can solve all three of the problems, with an exception that only retailer needs to have internet access. For example, transaction could be printed by customer on a piece of paper, handed over and accepted instantly by retailer, and it still would be secure. The idea is very promising because such transaction could be sent over internet or by any other way directly from buyer to seller and won't use any of Bitcoin Network resources, and it would be economically fisible to make automatic payments for a service that costs several micro bitcoins.


It is not specified what to subscribe.

socket.connect("tcp://127.0.0.1:28332")

socket.subscribe("hashtx");
# if you need raw data or block data, to add->
socket.subscribe("hashblock");
socket.subscribe("rawblock");
socket.subscribe("rawtx");

see.
https://github.com/bitcoin/bitcoin/blob/master/contrib/zmq/zmq_sub.py


How to get Master Private key in electrum wallet

There are a few ways to do this:

If you're on linux or macosx you can do so via the command line:

electrum getmasterprivate

Alternatively run electrum and go to wallet menu > password to remove your password temporarily. Then go to view menu > show console and on the console tab use this command to view your xprv:

wallet.keystore.xprv

Then set a password again via wallet menu > password.

Note that there is another console command wallet.keystore.get_master_private_key('yourpasswordhere') that lets you do the same thing without having to remove the password first but the downside of that is that your password is saved in console history (specifically config file in electrum data directory) and can be scrolled through by pressing the up arrow while on the console tab.


Is it possible to retrieve bitcoins from a Bitcoin address and possibly a private key?

If you have a private key, you just need to import it into your client. After that you'll get access to your coins from the old wallet.


Blockchain.info keeps sending wallet backups

This is standard if you have backup wallet chosen in your settings. Alternatively, email backups will send a wallet.aes.json file to your specified email address. A few things to keep in mind:

The aes part means your wallet is encrypted using your Blockchain login (and secondary password). If your password is changed then your newer wallet files can only be decrypted using the new passwords
The json part means the decrypted aes is a readable json format which can be read by humans and imported by various programs
Changing your password will change your decryption mnemonic.

The backup wallet.aes.json files are good for recovering old wallets but if your BTC has been moved from those addresses it does not recover your money.


Running public nodes for others to consume the JSONRPC API is not something that is widespread in the Bitcoin community. For a number of reasons, but the main one is probably that it's very low effort to run your own (you can get away with 10G of disk space and a few days of bootstrap time on a mid-range laptop).
That said, this website (hosted by @janoside) exposes some RPC commands publicly.


Electrum (https://electrum.org) is a good choice if you wish to store your bitcoin locally on your PC.   Supports things like hardware wallets, multiple wallets, seed (longish string of words) to recover your wallet if it's lost, and you can later on export your keys and import them into another wallet if you prefer.


Child Pays for Parent transactions get stuck on testnet

The problem you're facing is that even with a high-paying child, the parent needs enough feerate on its own to get relayed on the network.

Staying below 1 sat/vB makes that hard.


Can I mine with both AMD gpu and AMD integrated graphics at the same time

Im running an A-10 and a gtx260 and i can use both to mine seperate/combined coins, shouldnt be any different for you? :)


How do I backup the Bitcoin Core data directory?

I found an answer: use TeraCopy and select Older Only when asked about replacing the destination files. And just to be certain that everything gets updated like it should, I tested the resulting backup folder by running the Bitcoin node on it, and everything was normal.


is there any API like blockchain.info and bitcore with tutorial?

Check out 21. There are some bitcoin tutorials as well as a developer community.


It creates a fork.  There's no way to "sever" an existing branch of the blockchain.  All valid branches remain valid forever, and a node will select whichever one is currently the longest (by total work) as the authoritative ledger.
Right.  If you just redo one block, you've created a branch, but it's not the longest one, so it won't be considered part of the authoritative ledger.
Yes, that's the right analogy.  "Double spending" doesn't duplicate money; rather, it rewrites history so that your payment is considered to have gone to someone else instead (typically back to you).  If someone else thought they had that money, and gave you some goods or services in exchange, then you've effectively stolen it back from them.  You effectively got to spend that money twice, but the blockchain thinks the first one never happened, so the official record only shows one spend.


Is it possible to know if the result of 2 point subtraction is before or after G

There is no such thing as negative numbers on the elliptic curve used by Bitcoin because it is an elliptic curve over a finite field. It is a cyclic group of points composed of positive-integers. You might want to learn about modulo arithmetic and cyclic groups


How to use the lightning network with Electrum multisig wallet?

On a principle / technical level I see no reason why it should not work as you propose. However I see engineering Challenges:

The workflow of funding channels and (more importantly swiping on chain data if everything is sent to multisig addresses and requires your multisig partner to sign) would require way more communication overhead and dataflow.
Note also that there is a statement in the lightning-rfc (i believe in BOLT 03) stating that all tx needs to be p2whitness transactions (meaning segwit) so having / maintaining different Address types in your wallet might increase the complexity to handle them.

Thus I assume it was easier for the electrum developers to restrict themselves to this particular wallet type to be compatible with lightning network.


How to change network on BitcoinJS-lib with Coininfo and generate Dogecoin address?

Theoretically, you would just replace the network argument in the bitcoinjs function calls to the one generated by coininfo. You'll have to figure out the message prefix (don't know if mine is correct) because it doesn't look like that's defined by coininfo.

const coininfo = require('coininfo')
const doge = coininfo.dogecoin.main
const dogeNetwork = doge.toBitcoinJS()
const bitcoin = require('bitcoinjs-lib')

dogeNetwork.messagePrefix = '\x18Dogecoin Signed Message:\n'
console.log('network: ' + JSON.stringify(dogeNetwork));

const keyPair = bitcoin.ECPair.makeRandom({ network: dogeNetwork })
const wif = keyPair.toWIF()
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: dogeNetwork })

console.log('address: ' + address)


First of all if you have not done it yet, I would encourage you to make a backup of the wallet.dat file (e.g. copy it a usb stick).

One solution would be to let bitcoin-qt show you the private key for the address for which you received bitcoins back in 2011. Then you could import (actually "sweep") them with Electrum. See the following help:
https://en.bitcoin.it/wiki/Transferring_coins_from_Bitcoin-Qt_to_Electrum

This should also work with version 0.8.5 and you don't need to wait for bitcoin-qt to have downloaded the blockchain or anything.


There's no Expert Mode anymore. The Gap Limit has been hidden from the UI as it was unnecessarily complicated for normal users, and it is not a good method for merchants.

If you need to change the gap limit, enter this in the Console tab and restart the client (Tested with Electrum 3.0):

wallet.change_gap_limit(10)
wallet.storage.write()

To view/verify the current gap limit, type the follwing in the console:
wallet.gap_limit


help can I recover ltc sent to a btc address

If you send some criptocurrency to an address that is of another criptocurrency that is a valid address in the first one too you have lost your money if you don't own that address in the criptocurrency you made the transaction from.

The only way I can think you could recover the money sent is to make another transaction to an address you own while the wrong transaction still have not been confirmed, maybe with an higher fee hoping to have it confirmed first.


Is there a lightningd equivalent to bitcoind's -walletnotify or -blocknotify?

You can trigger a shell script with them, and more.
This is related to the plugin functionalities provided by lightningd and not bitcoind.
lightningd allows you to run plugins to deeply modify its behaviour, or extend its possibilities. It idiomatically (small and robust core, customizable functionalities) relies a lot on them and therefore directed the event mechanisms toward them as well.
This is the reason why you don't see [*]notify= startup options for lightningd.
To use lightningd's notifications you have to write a plugin, but it can be a pretty simple script. For example, here is the handler of the invoice_payment notification in the HelloWorld showcase plugin:
@plugin.subscribe("invoice_payment")
def on_payment(plugin, invoice_payment, **kwargs):
    plugin.log("Received invoice_payment event for label {label}, preimage {preimage},"
               " and amount of {msat}".format(**invoice_payment))

The previous example used the Python library, but the communication is pretty straightforward (JSONRPC 2.0) so you can technically use a shell script :-).
For reference, there is an available and curated list of community plugins.


Would bitcoin be compromised if the officially distributed executable was?

No, Bitcoin would not be compromised, only individual users who downloaded the malware.

For Bitcoin itself to be compromised more than half of all its users needs to be affected, and that is virtually impossible (given it has no auto-update functionality).

So any tampering with the binaries/source will be discovered long before that it can become a problem.


Well, seems like a "gap" limitation problem !

As defined in BIP 44, wallet software will not scan past 20 unused addresses.

There is 2 solutions:

1 - do not show bitcoin address directly to user, generate 20 addresses, save them in into an database and once a user want to pay you using bitcoin, you fetch the address from your database.

2 - (solution provided by blockchain) You need to switch to a new xPub key after each 20 generated addresses (within the same wallet).