Why does the halving event take place every 4 years?

as the popularity of bitcoin keeps on increasing, wouldn't more transactions take place daily?

Yes, scaling of Bitcoin is a recognised issue. For people who use Bitcoin as a currency, as its creators intended, the solution is mostly off-chain payment systems such as the Lightning network. For speculators and day traders who treat Bitcoin as nothing other than a speculative asset, the solution is off-chain trading on exchanges. It seems one likely outcome is that use of the blockchain will gradually shift to being mostly closing settlement of off-chain systems.

more and more blocks would be mined every day

Bitcoin code attempts to keep the rate of new blocks at a constant rate of one every 10 minutes. It does this by periodically adjusting the mining difficulty.
In practice the interval can vary greatly from block to block but over a long period the average is close to 10 minutes. Usually it is somewhat less and in some years significantly less. I think in 2010 it may have averaged around 7-8 minutes from memory. Nevertheless, the rate is moderated and doesn't increase in an unbounded way.
See What keeps the average block time at 10 minutes?

You seem likely to have some follow-up questions. Before writing them in comments, you will probably find answers by using this site's search facility, there is a lot of good information here already.


What happens when a transaction script for mining is used for fund transfer?

One is a pay-to-pubkey-hash script (the typical script represented by normal addresses), the other is a pay-to-pubkey script. Both are perfectly valid and standard.

The reason for using direct pay-to-pubkey in coinbases is because they are older. For most purposes pay-to-pubkey-hash is superior (you don't need to know the full public key of the recipient, there is a standard address type for them, there is a marginal security benefit, and they require less space in the validation database). However, direct pay-to-pubkey is just as valid, and the mining code was never adapted to use pubkey hashes instead.


Is bitcoin egalitarian or is there a hierarchy of owners of the cryptocurrency?

The exchange of Bitcoin is carried out under the laws of a free market (supply and demand). The  mechanics of the blockchain and Bitcoin do not intervine in the buy/sell of the cryptocurrency. The only aspect that the code of Bitcoin affects the cryptocurrency in the economic field is by its programmed scarcity which makes the currency a deflationary one, and therefore creates an upward pressure for the price (makes the price go higher).
Exchanges simply serve as a means through which people can buy or sell Bitcoins for other currencies (fiat or cryptos) and it is performed outside the blockchain. Only the transfer of the funds takes place in the blockchain.


Do I have access to the private key for an Instawallet?

No, Instawallet is a hosted (shared) EWallet.

They do not provide to you the private key for the deposit addresses associated with your Instawallet.

When you request a withdrawal, Instawallet processes that request and makes the transaction.  There is no way for you to create a withdrawal transaction yourself for any funds in an Instawallet.


How do nodes verify backwards incompatible blocks?

Old blocks in the chain are still valid under the current consensus rules.
In a broad sense, this is because the code will be written to enact rule changes at specific block heights, and thus older blocks will not be subject to said new rules.
To put it differently: the consensus ruleset doesn't just cover what new blocks are supposed to look like, they also cover what the historical valid chain looks like!
Sometimes, specific exceptions are written in, such as is the case with BIP 30.


How does the wallet know which outputs are available with LevelDB

The wallet is to a large extent separate from the rest of the node software. One of the reasons for this is because of the (slow) progress towards a working SPV mode. This means the wallet cannot depend on access to the UTXO set, as it won't be available in non-validating nodes.

However, it isn't needed. The wallet maintains an index of all input prevouts inside the wallet. Every output that is seen in a block, is to a wallet address, and which is not in this index as the input for another wallet transaction, is spendable.


Does the 100+ GB blockchain database contain every transaction?

Blockchain contains every confirmed transaction since the beginning. There are some tricks to save disk space of course.


How to make a homomorphic preimage/payment hash with current lightning network / Bitcoin implementations?

with the current system, it seems impossible to do so. The most probable protocol change/update will be after activating BIP Schnorr, when we have the chance to move away from payment_hash/preimage and can go to payment_point/secret_scalar.
Once we achieved this htlc's can be exchanged by adoptor signatures as described in this tutorial.
Those would obviously be additative since going from the group order to the group element is obviously a homemorphism so that we have (r1 + r2)*G = r1*G + r2*G where ri = preimage or secret_scalar and ri*G1 = payment_point


What is the proper way to authenticate to Bitcoind for multiple users?

You should implement it as a separate layer.

Bitcoind doesn't really support multiple users.  It lets you set a single username/password to connect to the RPC server, as well as encrypting the (single) wallet with a passphrase.  But there's no way within bitcoind to have individual authentication credentials that will allow one to spend some of the coins in the wallet but not others.

So a typical way to do this would be to have bitcoind store all the coins of all the users, pooled in a single wallet.  Then your software has to track how many coins belong to each user, authenticating the users, and ensuring that they can only spend those coins which are credited to them.  (The accounts feature might have helped with the first of these, but not the others.)

Alternatively, you can run a separate bitcoind instance for each user, but this will require more resources.


What does this Blockchain info mean? Clueless

No it’s not greek :-)
You’re first step in understanding might be to have a look at the book „Mastering Bitcoin“ by Andreas M. Antonopoulos. And if you need a translation, you might want to look here: https://www.transifex.com/bitcoinbook/public/.
The second resource is „www.bitcoin.org“, where you can find a description of the whole eco system, also in many languages.

The picture displays info about a wallet address, and it’s transactions, followed by  corresponding data to handle such a transaction in the bitcoin network. At the top left you can see the bitcoin address (1CYQ…), and it’s hash representation (look into the references I gave, why you would have hash representations). In the top middle section you see the amount of transactions for this address, and to the right a graphical representation of the address („QR code“). With QR codes you can e.g. transfer information between mobile devices via their integrated cameras. So if someone wants to send you money, he just scans the picture, instead of typing the address.
And the bottom section shows the previous transactions for this address, how values got „transferred“ from source addresses to target addresses.


How much money would it take to bribe the majority of miners to attack the system?

In a parallel thread on "https://bitcointalk.org/index.php?topic=2512771.0" I didn't do the exact math, but a rough calculation shows this:

Currently there is a hashing power of the equivalent to roughly 800.000 mining boxes type "AntMiner S9". For a 51% attack you'd need to buy 400.000 + 1, and bring them on the network (their power cosumption is 1200W, so you'd need a coal or gas power plant, industrial grade level). If you want to "buy" the miners (bribe), then it requires a lot of communication to them, and a financial incentive. Would the miners follow the fork (bribe), if they can see, that they will loose the value of the bitcoins to be mined? I mean, after such an attack would have worked out, the value of bitcoin would run against zero (quickly). What is the remaining incentive for a miner?
Your one-time bribe would maybe need to be equivalent to maybe a 1 year income of a miner, and this for 51% of the miners. Currently a 12,5BTC reward is ~10.000 EURO/CHF/USD, 6 per hour, 21 per day is 18mio a day. And you need 51% of miners. Big gee ...


Bitcoin.org developer reference outdated?

"As of Bitcoin Core 0.9.3 (October 2014), all transactions use the version 1 format described below. (Note: transactions in the block chain are allowed to list a higher version number to permit soft forks, but they are treated as version 1 transactions by current software.)" it's right or it's an old reality?

Both. It is talking about the state of affairs in October 2014, which is old. However it also states that the information dates from back then, so it is technically correct.

Since the activation of BIP 68 in July 2016, transactions with version 2 are relevant to the network rules, so the information could clearly be updated.

  or here (https://bitcoin.org/en/developer-reference#serialized-blocks) we can read on the first 2 line that blocks must be serialized under 1MB size or less but i know on the current version blocks can be up to 2MB so i can't understand which one is the right answer.

That information is clearly outdated since the introduction of Segregated Witness (SegWit) in August 2017. The concept of size of a block is no longer relevant, and replaced with block weight (which counts some bytes in a block more than others) limited to 4000000. In theory this means the total serialized size of specially constructed blocks can be up to 3.9 MB, but for blocks limited to common transactions it's closer to 2 MB.

  i just can't understand if bitcoin.org developer reference is outdated or not.

Some parts are, others aren't. It's a resource maintained by a community, so I'm sure they would appreciate help to keep things up to date: https://github.com/bitcoin-dot-org/bitcoin.org


From the bitcoin wiki:

  The stacks hold byte vectors. When used as numbers, byte vectors are interpreted as little-endian variable-length integers with the most significant bit determining the sign of the integer. Thus 0x81 represents -1. 0x80 is another representation of zero (so called negative 0). Positive 0 is represented by a null-length vector. Byte vectors are interpreted as Booleans where False is represented by any representation of zero, and True is represented by any representation of non-zero.

What this doesn't say is how more than one byte is combined into an integer. For example, to represent the integer 278, the stack would have:

0x02 0x1601

And to represent the integer -278:

0x02 0x1681

The most significant byte (0x01) was just XORed with (0x80) to change the sign to negative.

Now that we know how script integers are encoded, we just have to understand how they are interpreted. This is shown in the BIP65 code:

// There are two types of nLockTime: lock-by-blockheight
// and lock-by-blocktime, distinguished by whether
// nLockTime < LOCKTIME_THRESHOLD.
//
// We want to compare apples to apples, so fail the script
// unless the type of nLockTime being tested is the same as
// the nLockTime in the transaction.
if (!(
      (txTo.nLockTime <  LOCKTIME_THRESHOLD && nLockTime <  LOCKTIME_THRESHOLD) ||
      (txTo.nLockTime >= LOCKTIME_THRESHOLD && nLockTime >= LOCKTIME_THRESHOLD)
     ))
    return false;

Where LOCKTIME_THRESHOLD is the UTC time:

LOCKTIME_THRESHOLD = 500000000; // Tue Nov  5 00:53:20 1985 UTC

So, basically, you can set the time that OP_CLTV will verify against in the scriptPubKey. If it is below LOCKTIME_THRESHOLD, then it is compared based on block number of the block containing the transaction. If it is above LOCKTIME_THRESHOLD, then it is compared based on block time of the block containing the transaction. Note that this relies on the consensus rule that transactions cannot be included into a block with a lock-time (nLockTime) in the future.


What's a unique identifier in listsinceblock output?

Each transaction has a unique identifier which is the txid. It is the hash of the transaction and each transaction's hash is unique.


I have a merchant that only takes bitcoins can I just put the correct amount in the wallet and then pay them?

Create a wallet, and pay the merchant their Bitcoin price.

It would be much easier to clarify if you link to the merchant, so that we can actually see where you need to send it.


Anti-Virus Software Found Trojan from Electrum?

Many antivirus software mark Bitcoin wallets as being malware because they look for wallet files. When an antivirus sees a particular software looking for a wallet file, it may flag that software as a virus. This is because coin stealing malware and your Bitcoin wallet software both do very similar things. Both will look for a wallet file, open the file, read the private keys, and send Bitcoin. The only difference is that a coin stealing malware will either send the Bitcoin automatically to the attacker's address but your wallet software will let you choose who to send your Bitcoin to and only when you want it to do that.

Coin stealing malware may also look for your wallet file and send that to the attacker.

So because coin stealing malware and wallet software behave similarly (especially with the looking for wallet files part), many antivirus software will mistakenly flag a wallet software as being a virus.


Where is the spec of HashCash so that I can implement it in Java from scratch?

Not necessarily answering your question, but I found a HashCash implementation in Java already here: https://github.com/ryancwilliams/JHashCash Perhaps you can contribute or fork it?


What are Channel Factories and how do they work?

What are Channel Factories?

In short, Channel Factories are payment channels that can be used to create more payment channels.  That sounds weird, but it's really pretty simple:

In a regular payment channel, you always have a transaction signed by all participating parties that's ready to commit the current channel balances to the block chain.  For example, in a channel between Alice and Bob, this transaction might have two outputs, one paying Alice 0.25 BTC and one paying Bob 0.75 BTC.  If this example transaction were broadcast, it would close the payment channel between Alice and Bob.

However, it's possible to format the ready-to-commit transaction as a transaction that not only closes the existing payment channel but which also opens a new payment channel.  In that case, the same security that allows the initial payment channel to have zero-conf security also extends its security to the second payment channel.

The key feature of a regular payment channel is the ability to securely update the state (balance) of the channel many times without creating extra on-chain transactions, so the key feature of a Channel Factory is the ability to securely create and destroy new payment channels without creating extra on-chain transactions.

  How do they work?

At least two people and preferably ten or more get together to create a payment channel (channel factory) deposit transaction.  This has the regular payment channel logic that allows all of the participants to spend the money if they all agree, or for a dissatisfied participant to individually withdraw his funds if the other participants become uncooperative.

When the deposit transaction has enough confirmations to satisfy all the participants, they update the state of the initial payment channel (channel factory) to create a bunch of non-broadcast payment channel opens between themselves.  (The channels need to be between themselves because they each need to ensure none of the bitcoins used to open the channel are spent twice, i.e. double spent.)

Since the initial payment channel (channel factory) already has sufficient confirmations, opening the secondary payment channels is instant.  The second payment channels can then be used like normal payment channels (e.g. for routable payments Lightning Network) except that when it comes time to close them, the participants have the option of either committing the final state to the block chain or simply updating their balances in the channel factory in order to start a new channel.

  How does that help scale the Lightning Network?

Let's assume we have a bunch of users who all want to open payment channels to each other.  For n users, they need to open m channels where m = n(n-1)/2.  For current-generation Lightning Network channel open, they'll probably spend at least two inputs and generate at least three outputs (about 240 vbytes times m channels).  For a channel factory, they'll have about n inputs (at 70 vbytes) and n + 1 outputs (at about 25 vbytes) plus 10 vbytes overhead.  Here's the savings accounting:

This doesn't count channel closing costs, which are harder to calculate since channels may remain open for variable lengths of time.  Also not included is the additional savings available from Schnorr signature aggregation---if that should be activated on Bitcoin, it will increase Channel Factory efficiency moderately by decreasing the amount of space used by the inputs.  Please note, numbers used here are a rough approximation.

Note that although channel factories provide significantly lower costs even for small numbers of participants, where they really excel is at making it cheap to build a dense web of payment channels between users.  This will likely significantly improve the quality of service of a widely-distributed Lightning Network by ensuring most paths from spender to recipient stay short, which helps the widely-distributed network further effectively compete with a more centralized network that has short paths between large hub-like entities.


Bitcoin future mass usage for payments - how feasible is it without real privacy

Bitcoins themselves are fungible, and addresses are designed to be for one-time-use only. It really comes down to how you use it, and it is entirely possible to transact using Bitcoin in a private manner.

If the user is naive and has poor practices, then it is possible to track their financial history.

But if the user is smart and uses best practices (no address reuse, coinjoin/payjoin transactions, lightning network, etc), then they can enjoy a very high degree of privacy, and sovereignty (you don't get this with traditional banking).

This article is a great writeup about privacy while using Bitcoin.


Bitcoin Core doesn’t use unhardened keys, so attempting to get a master public key will never work no matter what.


How does an exchange cover a "run on the bank"?

An exchange isn't a bank, and, in theory, isn't subject to a "run".

Banks are typically "fractional reserve" institutions.  The money deposited by the customers doesn't all reside within the bank; some fraction of it is loaned out or otherwise invested, so that the bank can earn profits and pass some of it back to depositors as interest.  So if all the depositors want to withdraw their money, it isn't there, and some will be left out in the cold (unless there is deposit insurance to make them whole).

Exchanges don't work like that.  Conceptually, all funds deposited by customers, both fiat and cryptocurrency, stays within the exchange.  The exchange doesn't attempt to make profits by investing or loaning out those funds, and they don't pay interest on their customers' deposits.    Instead, they make money by charging commissions on the trades which their customers make with each other.  So in principle, if all the customers of an exchange want to withdraw simultaneously, there's no problem; the money is right there and they can all have what is theirs.

Of course, the exchange might encounter some technical issues processing such a high volume of transactions in a timely manner.  Also, in practice the exchange probably doesn't keep all the fiat money on site; they deposit it in their own bank account, where it stays (although their bank may in turn lend out some portion, as banks normally do).  So if the bank doesn't have many customers other than the exchange, then when the exchange tries to withdraw all their funds to pay out to their customers, it may effectively be a run on the exchange's bank.  But this is unlikely if the exchange chooses a large enough bank to work with, or has insurance.

It's also possible that any given exchange is cheating and not actually behaving like a theoretical exchange should; there aren't too many laws that would ensure that they are doing so.  But conceptually, there is a fundamental difference in the ways that exchanges and banks operate, and the former aren't subject to this kind of problem if they operate as they should.

You might be conflating this with a different issue.  "The price" of a coin is usually understood to be the price at which people are trading the coin right now.  It doesn't imply that an unlimited amount of coin can be bought or sold at that price, and nobody should assume that it does.  If "the price" hits one billion dollars and "everyone" tries to sell, there probably won't be buyers for all of the coin at that price.  The price will fall, probably a lot, until it reaches a level where there actually are buyers and sellers.  This is normal supply and demand stuff, same as for any other asset.


Can I claim my BCH if my BTC is held with Coinbase?

If you didn't move out your BTC before the fork, then your BitCoin Cash tokens remain with CoinBase. They are not really lost, but they might remain in their system for a while. Here is the explanation directly from CoinBase Support:

  We are planning to have support for bitcoin cash by January 1, 2018, assuming no additional risks emerge during that time.

  Once supported, customers will be able to withdraw bitcoin cash. We'll make a determination at a later date about adding trading support. In the meantime, customer bitcoin cash will remain safely stored on Coinbase.

  Thank you,

  Coinbase Team


What factors determine how long confirmation takes?

How many miners are currently mining, how fast they are mining, how much of a fee you paid, and whether you're a well connected node or not (only matters for first confirmation).


Fun puzzle: How to generate keypair without anyone seeing the private key?

You are attempting to answer the question you are asking in the question. Let me get to the root of what you are asking.

From what I understand, you would like to create a 2 party escrow - buyer sends money in a way that can't be retrieved unless both parties are satisfied.

This can be done in two ways in Bitcoin - one through the use of multisignature transactions, other - through split-key addresses.

The first approach is to send the money to 2-of-2 multisignature combination of addresses - one held by the buyer, and another - by the seller. When they reach consensus, they create a transaction, each signs it and money is transferred. The disadvantage of this approach is that if they don't reach consensus, there is no way to settle the money dispute. If you would introduce some third party acting like an escrow and create 2-of-3 multisignature address, then you would need a consensus of any 2 involved parties. If the buyer and seller agree on a consensus, escrow service does not get involved and everyone is satisfied. If they can't reach consensus, escrow steps in and mediates the solution with the parties forcing a compromise - it can always break a stalemate by cooperating with one party.

The second approach is for both parties to settle on a public key each by themselves, and then combine it through multiplication or addition, creating a split-key address. They both know the public key and associated address, but none of them know the private key. If they agree on an output, the buyer sends the seller their private key and the seller can create a transaction crediting themselves, or if the seller wishes to return the money to the buyer, they can give them their private key. This approach has a few problems:

One can't be using the same private keys in multiple transactions, as they get shared with third parties
The person that will receive the second private key can dictate any division of money - nothing can stop them
There is no possibility of creating a 2-of-3 escrow

So all in all, use multisignature transactions.


"[...] is it possible for this third party to lend my bitcoins [...]"

If the bitcoins are in your address and only you know the private key of your address, then nobody else can move your bitcoins away from your address.
However, if you deposit your bitcoins into a third party, theoretically they could do fractional reserve like normal banks do. This would cause an expansion of the currency issued by those third party, but not in the amount of bitcoins available in the blockchain.

  "If so, is there any regulation or fractional reserve requirement for these institutions?"

The bitcoin territory is still very much unregulated. The judicial system is debating much broader issues than fractional reserve requirements. For example: there is still an on going debate about whether bitcoin should be consider money or not.

  "And finally, can this expansion of the money supply affect the price of bitcoin?"

Although the bitcoin supply in the blockchain is limited to 21Mi, third parties can issue their own currency backed by bitcoins. In a free market, supply and demand would regulate the exchange rate among such currencies and bitcoin.
Depending on how this expansion of third parties currency take place, this could increase or decrease the bitcoin price.


What can be changed in signed bitcoin transaction?

Here is the list of known sources of malleability from BIP62 (which has been withdrawn, and is no longer up to date, but does give some insight):

DER encoded ECDSA signatures Right now, the Bitcoin reference client uses OpenSSL to validate signatures. As OpenSSL accepts more than serializations that strictly adhere to the DER standard, this is a source of malleability. Since v0.8.0, non-DER signatures are no longer relayed already.
Non-push operations in scriptSig Any sequence of script operations in scriptSig that results in the intended data pushes, but is not just a push of that data, results in an alternative transaction with the same validity.
Push operations in scriptSig of non-standard size type The Bitcoin scripting language has several push operators (OP_0, single-byte pushes, data pushes of up to 75 bytes, OP_PUSHDATA1, OP_PUSHDATA2, OP_PUSHDATA4). As the later ones have the same result as the former ones, they result in additional possibilities.
Zero-padded number pushes In cases where scriptPubKey opcodes use inputs that are interpreted as numbers, they can be zero padded.
Inherent ECDSA signature malleability ECDSA signatures themselves are already malleable: taking the negative of the number S inside (modulo the curve order) does not invalidate it.
Superfluous scriptSig operations Adding extra data pushes at the start of scripts, which are not consumed by the corresponding scriptPubKey, is also a source of malleability.
Inputs ignored by scripts If a scriptPubKey starts with an OP_DROP, for example, the last data push of the corresponding scriptSig will always be ignored.
Sighash flags based masking Sighash flags can be used to ignore certain parts of a script when signing.

(1) has been fixed for all transactions by BIP66, and (2)-(6) are prevented by standardness rules in recent Bitcoin Core releases. A specific case of (7) is proposed to be fixed by BIP147.

Segregated Witness (BIP141) proposes fix all of them, but only for transactions that spend  solely from segwit outputs. It does this by moving the scriptSig data to a new field (the witness) which does not influence the txid.


How to get all potential routes in c-lightning?

if you invest some programming time you can use the listchannels command to retrieve all channels of the lightning network from the gossip store. No you could store them in the networkx lib

import networkx as nx
network = ln.listchannels()
nx.Graph()
for channel in network:
    G.add_edge(channel["source"],
               channel["destination"],
               **channel)

and then you could use this algorithm from the networkx library to get a generator for all paths between a source and a destination rout. Since the lightning network will most likely have cycles you need to define a cutoff. While 20 is to long from a computational point of view it is also the the maximum path length an onion packet supports according to BOLT 04.

  Length: the maximum route length is limited to 20 hops.


LND doesnt create macaroons or directories

What version of lnd is this? I had the same problem on git master, it vanished when I changed it to 0.11.0-beta. Seems to be a new bug. I already passed it on to a dev, but you might want to open a formal issue as well.


Displaying the bitcoin wallet on the internet

First, do not mix up the words "wallet" and "address".  A wallet is a file or computer program which stores the private keys corresponding to one or more Bitcoin addresses.  Sharing the address is very different from sharing the private keys.

Sharing the address is not a security risk, in the sense that knowing the address does not give anyone the ability to spend your bitcoins.  They would have to know the private key.  Indeed, since Bitcoin uses a public transaction register, you can assume everyone in the world already knows the address 123abc exists, and knows how many bitcoins are credited to that address.

However, sharing the address can be a privacy risk.  Everybody knows that the address 123abc exists; what they don't know is who it belongs to.  If you post the address on your personal website, or from an account that can be connected to you, now they do know that.

For instance, suppose you made a transaction from that address to an address that's known to belong to EmbarrassingSexToys.com.  The transaction is public, so everyone can see that it was made.  If you hadn't posted your address on the Internet, then everybody knows that somebody bought an embarrassing sex toy, but nobody knows who it was.  If you did post your address, then everyone knows that Adnan bought an embarrassing sex toy.


Isracoin: What hashrate should I be getting with intel core i5?

Assuming that IsraCoin uses the Scrypt-Hashing algorithm as suggested in the comments on the question, I found this hardware overview table on Litecoin (which also uses Scrypt).

The table lists a number of Intel Core i5 processors ranging in hashrate from 12 to 55 kHash/s.
I.e. depending on what processor you have exactly and whether IsraCoin uses the same hashing scheme as LiteCoin, it is within the expected performance.


Value of cryptocurrencies: Why does noone make Bitcoin2, 3, 4,...?

Why does noone use the exact same technology of the Bitcoin and create Bitcoin 2?

They have, there are hundreds of copies of bitcoin known as "altcoins", one prime example is bcash.

  If they did, why would a Bitcoin2 be worth less than a Bitcoin?

Because there is no demand for a bitcoin2. No one wants one because its not a real bitcoin. The only value bitcoin has is in the demand people have for it - how much someone is willing to pay for it.


Why seed from BIP39 mnemonic phrase is much longer than entropy?

This is specified in BIP 39 itself:

  To create a binary seed from the mnemonic, we use the PBKDF2 function with a mnemonic sentence (in UTF-8 NFKD) used as the password and the string "mnemonic" + passphrase (again in UTF-8 NFKD) used as the salt. The iteration count is set to 2048 and HMAC-SHA512 is used as the pseudo-random function. The length of the derived key is 512 bits (= 64 bytes).

So the seed that's used is essentially a 512-bit hash of the mnemonic, which explains why it's 512 bits long (= 128 nibbles).

The BIP doesn't explain why they do this, but I would assume that it's convenient to know that the seed will always be a certain size, regardless of how much entropy is actually used to generate it.  This means, for instance, that key generation code can be written to always work on 512 bit seeds.


Is my Tor bitcoind node seen by new normal nodes?

Are new nodes able to see me right from the bat even if my 8333 port is only open using a .onion ip address?
  Unfortunately I can't open port 8333 because I'm behind a firewall and my ISP charges for a public IP address.

No... Onion sees onion, clearnet sees clearnet.  Your firewall is keeping you off of clearnet.

  If I want to set up an electrum server (electrumx) using .onion address will it be easy for normal electrum wallets to connect to my machine?

Yes, just tell your users to follow this:

Using Electrum Through Tor


I would suspect that most Bitcoin advocates would disagree with you. The simplest counter-argument is this -- wouldn't that mean inflation discourages people from selling things? And you can't spend if nobody wants to sell to you, can you?

Another way to make the same counter-argument is this: Actually, no, deflation encourages people to spend the bitcoins they have. A deflationary currency should be very desirable to hold. So, if I have a deflationary currency, sellers should go out of the way to encourage me to give that currency to them (with low prices, easy transaction, stronger guarantees, whatever it takes). That will make me more likely to buy things.

Of course, all of these arguments are nonsense. The characteristics of the money affect the buyer and seller equally. So while they may change the price, they won't change the likelihood the transaction will occur.

But it won't even matter. Long-term predictable monetary deflation is impossible (for a low friction, demurrage-free currency) because it entails a direct contraction. If you assume long-term, predictable monetary deflation, you get the following paradox:

One unit of currency today must be worth less than one unit of currency tomorrow. Otherwise, you don't have long-term, predictable deflation.
One unit of currency today must be worth more than one unit of currency tomorrow. This is because one of the things you can do with a unit of currency today is hold it until tomorrow. But you can also spend it today if you want. So it has to be worth at least as much.

These two arguments directly contradict each other.

Yes, you have been lied to by economists who want to convince you that the economy will explode if the government doesn't enrich itself and favored bankers at the expense of everyone else. That's not to say deflation can't cause real problems, just not this kind of deflation and these kinds of problems.


How to test if a transaction is standard without spending real money?

You can use Bitcoin Core's testmempoolaccept RPC. It will tell you whether the transaction you give it would be accepted into your node's mempool at that time but won't actually add it to the mempool or broadcast it.


Is the NotHaus conviction (Liberty Dollar) relevant as legal precedent?

There are many complementary currencies in use around the United States quite openly and without government interference, including BerkShares, Ithaca Dollars and similar hyper-local currencies, various bartering or time swapping systems like LETS or Time Dollars, etc. The case you are referring to revolved around minting coins that could easily be confused with US money and allegedly circulating (and encouraging others to do so) to local businesses while passing them off as US money (by a lie of omission, if nothing else).

It may well be that Bitcoin faces legal challenges in various countries, including the US, but this particular case will have set no precedent in that regard.


You should avoid reusing addresses. Bitcoin works on a UTXO model where each payment is one UTXO. 100 payments to 100 different addresses produces 100 UTXOs, as does 100 payments to 1 address. There is no different in UTXO consolidation with reusing the same address.

Using different addresses provides more privacy, and potentially, more security. You should not be reusing addresses and instead generating a new one for each and every payment that you receive. Modern wallets will give you a new address when you click "receive" in whatever wallet (there's usually a receive button) so just use the addresses it gives you instead of reusing the same one.


Is there a single point generator G for every elliptic curve?

There often are multiple points which could be generators. In fact, for prime order curves, every point on the curve is a generator.

For practical use, a specific point is picked based on some constraints.

May curves use rules such as lowest abs(x) value or use some deterministic generator with a random seed.

I can't seem to find the login behind the G selection for secp256k1, however, but the point itself is defined in the curve specification.


is it possible to deposit bitcoin into an address without making the address public?

I thought one safe way to keep a bitcoin "cold" and safe is to not show its address ever to the public.

Cold storage = Private keys offline

So somehow, that new address has to be "public" because it is in the blockchain and anybody can see it? So how would it be possible to have an address and be able to deposit some bitcoin into it without showing the address to the public?

Yes blockchain will have all transactions and UTXOs. It is possible to avoid being associated with the addresses on blockchain. So even if I see an address with 0.1 BTC unspent and some transaction, I don't know who owns it and who was involved in the transaction.


Bitcoin P2PKH transaction - two questions

The signature is mathematically generated using the private key and the message, but is not the message itself (it uses the hash of the message during the signing process, the message is not recoverable from just the signature). It's just a value (specifically, it is 2 numbers, called r and s) which can be verified against the public key and the message to see if it's a valid signature. In this case the message is the transaction data, which also protects the transaction from being modified because if it was modified, the signature would become invalid. If you're interested, you can read about the Elliptic Curve Digital Signature Algorithm (ECDSA) here.

Indeed it would be possible to use just the public key without the hashing steps, this is known as Pay to Public Key, P2PK and is also an acceptable output type. Please note, though, that a bitcoin address is not the public key itself. To create this type of output, the sender would have to know the public key, to put it in the output. It is not possible to obtain the public key from a bitcoin address because the address is a hash of that public key, to make it shorter and easier for common use, and is thus a non-injective trapdoor function.


Why I can't do a transaction by use sendtoaddress?

I think it did work, but the getbalance function does not work as you expect. The ./bitcoin-cli -regtest help getbalance reveals that getbalance returns

  "The available balance is what the wallet considers currently
  spendable."

The address you generated with ./bitcoin-cli -regtest getnewaddress is probably just a script that routes the funds back into your main account, so it's address is different, but can be spent using the private key in the main account. You can verify this by ./bitcoin-cli -regtest listaccounts and seeing if it returns something like:

{
  "": 10.00000000,
  ...
}

The "" account is the default account, and you can get it's address using: ./bitcoin-cli -regtest getaccountaddress "".

It might be more convenient to generate an address as a new bitcoind wallet account. Try using:

./bitcoin-cli -regtest getaccountaddress "<optional_name>"

Then send the coins to that address and check it's balance using ./bitcoin-cli -regtest listaccounts


Lightning Node Daemon hangs at "Initializing btcd backed fee estimator"

I also run btcd/lnd. First you need to confirm your btcd port is up in address mentioned.

netstat -an | grep port

On the lnd node see if you can connect to the port
telnet xxx.xxx.xxx.xxx xxxx

Change your btcd to debug mode in btcd.conf. You will see in btcd log if lnd is able to reach and what are the errors. Make sure also this is not a firewall issue, you would need to create a rule for that port.


How would one audit that the mgwBTC - Multigateway assets are backed by 100% Bitcoins?

I'm no user, and just discovered multigateway, I've read their docs, using my understanding, it seems that when you deposit Bitcoins (or anyother coin) to them, they create a new Bitcoin (or anyother coin) address for you only for which they hold the private key.

You [edit] would [/edit] therefore monitor, that your mgwBTC amount match exactly the coins at the public deposit address, at all times (just give it a little time for transactions to settle). If this is true for any anounts and at all times, they are not doing fractional reserve.

[edit] If they transfer the coins on the deposited address to another address (which is a better practice (see below)) you can't prove anything for sure, as you have no vision on the total of mgwBTC in circulation (and issuance process), nor can you know for sure that they really own the public address, and not for example rent some payment services from an address which has lot of bitcoin to inspire confidence (unless their whole book is public (and proven so), you then aggregate all transactions, see where the funds are coming and check it started at 0 and everything adds up the way it should)[/edit]

But a word of caution here, them not doing fractional reserve is not an all risk guarantee. It may even be considered bad practice. Their keys may get stolen at any time. All coins are 'live' (because of the no fractional reserve guarantee), this means if they get (self?) hacked, 100% is gone almost instantly. Whereas exchange usually have most of the cash on frozen addresses, whose private keys are not stored on a device connected to internet.

If there is a bug in their system, and for example their transactions are not really 'transactional' which is kind of hard to do in a distributed system and some mgwBTC got double spent, their transaction algorithm will automatically adjust your BTC deposit to match the mgwBTC. Which means if someone can steal some mgwBTC they can steal your deposited BTC.

An other word of caution: they seem to only release binaries of their software, which is not good for inspiring trust (but they are still beta).


Is the keypool erased when changing wallet password?

No, because the encrypted keys don't change in that case.

When you encrypt a wallet.dat file, a random master key is generated, the master key is encrypted using your passphrase, and the actual address keys are encrypted using the master key.

When you change the passphrase, only the encrypted master key is changed.


When manually creating a raw bitcoin tx, how does one determine whether the r or s values require more zeros?

If the first byte is greater than or equal to 0x80 (128), then you need to add a leading zero byte. You can do 0x80 & first_byte. If the result is zero, no padding is needed.


Relation between multi-sig and single-sig addresses (in BCCAPI library)?

The call to receiver.getTypeSpecificBytes() strips off the version byte (the '3'), and ScriptOutputStandard() always creates a P2PKH script from this raw (with no version byte) 20-byte hash. The bitcoin that was sent to the P2PKH address is probably irretrievable.

You probably meant to do this to create a P2SH script:

val so = new com.bccapi.bitlib.model.ScriptOutputMultisig(receiver.getTypeSpecificBytes())

Also, just FYI I don't think BCCAPI is being supported any longer. I don't see any updates to it since late 2012, and the then maintainer has since moved on to create Mycelium. You may want to consider an alternative Java Bitcoin library such as bitcoinj.


Is it possible to use xpub address to monitor balance from previously generated addresses?

Certainly. If you use the master public key (the xpub that you have), you can enter it into a site like blockchain.info to get the balances of many of the addresses derived from that key. Generally software that do this sort of monitoring (including your wallet software), only search a few addresses (all of the ones that have been used in a transaction and then some number ahead of those) so it may miss some of your transactions.

You can also setup a desktop wallet software like Electrum to work with your Ledger Nano S. This allows you to get new addresses and monitor your balance without having the device connected and still be able to connect your Ledger to spend from it when you want to.


What is the maximum number of multisigaddresses you can create?

I realized what happened, the wallet was a massive size and the Write() function was failing.


Where can I find a list of reliable Bitcoin full nodes?

Best place is https://getaddr.bitnodes.io/nodes/leaderboard/

Nodes are rank according to various parameters


Access my account only to the previous Bitcoin URI number

Sorry to inform you, but you cannot. If you've lost the data of the previous installation without a backup, the money is gone. You need access to the private keys stored in wallet.dat to spend money received to those addresses.


How is the ExtraNonce calculated in Bitcoin Core

The extra nonce is just like the normal nonce in a block header. It is "calculated" by using a counter which increments every time all of the possible nonces for the block header nonce field are exhausted. This process of incrementing the nonce and then the extra nonce is repeated until a valid block hash is found.


PSBT encoding : what's the aim of convertBytes function?

PSBT uses Base64 encoding. As every Base64 character has 64 = 26 possibilities, they can store 6 bits of information. The ConvertBits function you link to takes input bytes (which consist of 8 bits each), and rearranges them into groups of 6 bits, which are then mapped to the Base64 character set.
ConvertBits<A,B> is not converting from base-A to base-B; it is converting from base-2A to base-2B.


Will Lightning be implemented on Bitcoin network?

Lightning nodes can function in a light client mode by connecting to full nodes who support the new BIP157&158 light client mode. This is supported by LND (the lightning network daemon), and is known as neutrino. On testnet, the lightning faucet operates a neutrino-compatible full node but support will spread and it will eventually become as easy as using SPV currently, with many added benefits over SPV.


What happened to the original Ripple Project?

Why does the current Ripple protocol require a global consensus?
  Can someone use the old Ripple design to make money between people actually work in a local community without a global singleton ledger?
  Wait a sec! WHY DOES RIPPLE EVEN NEED A GLOBAL LEDGER AND CONSENSUS? Each person extends a credit line to their friends, whom they trust. All you need is two sides to sign every transaction, and a routing algorithm. You don't need a global ledger to hold every transaction!

Short answer: That wouldn't be Ripple; it would be Open Transactions.

Longer answer: Imagine Alice wants to make a payment to Eve. She opens Ripple, and it finds a path from Alice -> Bob -> Charlie -> David -> Eve. She starts exchanging IOU's until her payment reaches Eve. However, David's node goes down partway through this, leaving Alice with an IOU from Charlie, which is worthless to her.

(There are ways of dealing with this without a consensus sytem by making transactions that are contingent upon knowing a preimage that only Alice knows, but there's not enough space in this answer to elaborate on that. Alternately, you can send the payment through in tiny chunks, so that only a small amount of money is trapped if the payment fails.)

In contrast, if you have a global consensus system, you can make this entire process atomic and uninterruptable.

  Was this abandoned, or is the current Ripple source code able to implement this on a local level?

Don't know; haven't been following Ripple lately.

  which we built to allow any community to host their own social network the same way Wordpress hosts blogs

It doesn't sound like you need global consensus. That's a good thing, because implementing something like that is almost always a huge pain in the ass.


bitcoin-0.9.3 won't syncup on TESTNET stuck at height 26859

I'm not totally sure why it failed on height 26859, but I upgraded to 0.9.4 (from 0.9.3) using:

apt-get install --only-upgrade bitcoind

then I deleted the testnet3 folder and fired up bitcoind and now it's working and has passed height 26859.


How to pre-generate 100M bitcoin addresses?

I ran vanitygen -k 1, which will keep creating addresses matching the pattern 1* until stopped, for approximately five seconds and it generated more than 3,000 addresses. No GPU assistance here.

So, do this:

In one Terminal tab, run vanitygen or oclvanitygen:

vanitygen -k -o addrs 1

In another Terminal tab, run this:

watch 'echo "`wc -l addrs | egrep -o "[0-9]+"` / 3" | bc'

When the number in the second terminal tab is greater than 100M, you're done! The divisor is three because the output file will contain addresses in three line sets: Pattern, Address, Private Key.

Now, find a way to automate that and you'll be golden. You can also just shuffle bits around with another program that just gets the first 100M addresses from the file you generated.


How to store arbitrary data in the bitcoin blockchain and how can I differentiate between a transaction an those data?

Have a look to these data sources:

https://bitcointalk.org/index.php?topic=1023190
https://github.com/petertodd/python-bitcoinlib/blob/master/examples/publish-text.py

And of course the "modern" (and cheapest) way is storing arbitrary data in segwit part of transactions. I do not know is there ready tool for it, but it is not very difficult to write it.

  Is there a newer website/service that supports me putting data into the blockchain?

https://cryptograffiti.info/ (based on bitcoin cash blockchain)


Can a blockchain be created that forgets transactions whose outputs have been spent?

This is not possible with current blocks and transactions, although future improvements may allow us to prune some space from future blocks and transactions.

Let's think through the idea of deleting a transaction for a moment.  Let's say we have two particular transaction in the blockchain:

  Alice mines 50 bitcoins
  Alice pays Bob 50 bitcoins

Now we delete Alice's coinbase (mining) transaction:

  [PURGED]
  Alice pays Bob 50 bitcoins

Wow!  That looks like 50 bitcoins appeared out of nowhere!

What if that transaction has lots of proof of work?

Could you trust the Alice-pays-Bob transaction if it had 50,000 confirmations even though you can't see where those bitcoins came from?  Sure, that like that might be a reasonable trade off of reduced security for increased convenience.

But in order to validate future transactions, nodes don't just need to know who has bitcoins—they also need to know who doesn't have bitcoins.  For example, imagine Bob hasn't spent his 50 bitcoins, so that transaction should be part of the blockchain; yet, when you download the blockchain from Mallory's node, this is what you get:

  [PURGED]
  [PURGED]

At some point in the future, Bob goes to spend his 50 bitcoins.  Other nodes who didn't sync from Mallory know Bob has 50 bitcoins, so they accept blocks with that transaction. Your node rejects blocks with that transaction because it doesn't think Bob has 50 bitcoins, permanently forking you off of the consensus blockchain.  This is called consensus failure and it's one of the things we try really hard to avoid in Bitcoin.

Why not just keep track of amounts and purge the rest?

One way around this dilemma would be if we could split transactions into different parts:

The parts we needed to build the Unspent Transaction Output (UTXO) set that full nodes use to prove whether or not Bob has 50 bitcoins.
Everything else, such as the large public keys and signatures we use to prove Alice was authorized to spend those 50 bitcoins.

Here we encounter an additional problem with transaction pruning, a limitation of the way Nakamoto designed Transaction Identifiers (txids).  Nakamoto's design simply hashes the entire transaction and uses that to form the leaf nodes of the merkle tree whose root node gets included in the block header and secured with proof of work.

(Image from 21.co, CC-By-SA license)

Because of this design, in order to verify the UTXO-required data, you also need to download the entire transaction, including its public keys and signatures which constitute about 1/3 to 2/3 of a transaction.

This makes Nakamoto's whitepaper-style pruning in Bitcoin right now pretty much impossible.  Happily, some smart people have been working on improving the situation.

Segregated Witness

...which sounds like some weird law-enforcement term...

Blockstream's testnet sidechain, Elements Alpha, includes a nifty feature called segregated witness.  First, some background on witnesses in cryptography:

A witness is the data needed to prove some other data's validity.  This probably derives from contract law, where you often get other people to witness your signature on important documents.  In the case of Bitcoin, the witness to a particular spend being valid is the scriptPubKey of the output being spent and scriptSig of the input that references it in the spending transaction.

In Elements Alpha and the new Liquid mainnet Sidechain, the witness is "segregated" into a different part of the block and is not covered by the txid hash.  That means that nodes who want to reduce their download requirements can skip downloading witnesses for transactions with more than (say) 50,000 confirmations. However, now they can still use the block header merkle root to verify that all of the non-witness data (including the amounts transferred) are correct, and use that to build a correct UTXO set.

I can't find a source right now, but I think I've heard Wuille and Maxwell say that for typical Bitcoin mainnet transactions, this would mean about 1/3 of the transaction data doesn't have to be downloaded by nodes that don't want to validate old signatures.  On Elements Alpha where the witness is larger for transactions that use value blinding, this would mean 2/3 of the data doesn't have to be downloaded.

As a bonus, segregated witness also "completely eliminates all known forms of transaction malleability" (Wuille's description).

When will this appear in Bitcoin?

You're in luck: just a few days ago, Luke Dashjr presented an idea for how segregated witness can be soft forked onto Bitcoin mainnet.  (Previously, it had been thought that a hard fork would be necessary.)

The payer pays to a scriptPubKey that always returns true but which contains the hash of a redeem script like P2SH does:

<hash_of_redeem_script> OP_TRUE

(I just made that up; I don't know what the real construction will look like.)

When the person paid later goes to spend, they provide an empty scriptSig in the transaction itself.  This is valid to old nodes, but upgraded nodes know to look somewhere else in the block for the actual scriptSig.  The witness has been segregated.

For both old nodes and new nodes, they calculate the txid using the empty scriptSig, so the data covered by the merkle root still covers the important value amounts and references.

I don't know exactly how well this compares to the segregated witness in Elements Alpha (does that cover the scriptPubKey as well?), but it does most of the work in a convenient soft forkable construction.

Since this is week-old engineering, it may change a lot or even be found to be unworkable in the coming months, so don't expect to see it in the immediate future—but, long term, do expect to start seeing some new pre-download pruning options appear.


The number of satoshi per bitcoin is 1e8 or 100,000,000, so if you have a fiat value per bitcoin such as $7000/BTC, the calculation is:

$/satoshi = $7000/1e8 = $0.00007 per satoshi

Of course, there is no fixed fiat to satoshi value because the fiat value of Bitcoin is determined by the market, i.e. exchange value.


To collectively trust what happens online - what does that mean?

So, the author is trying to say, with blockchain, we can collectively trust what happens online. But what on earth does "to collectively trust what happens online" mean?

There are multiple meanings that you could attach to that, but here's the one I think is the most true/useful/obvious.

To track what happens online, we use computer programs and databases. What happens when those programs disagree about what the state of the system is or ought to be?

For example, an online auction receives a bid moments before it closes. The bidder who sent the bid claims it was timely. The bidder who would lose the auction if the highest bid was accepted claims it was a second too late. The seller doesn't know, because ze was offline when the auction closed.

The typical solution to this is to pick some trusted computer, and let it decide. In this example, that would be eBay's database server. (Or, in some systems, a quorum of eBay's database servers.)

Blockchains are a search for a better solution.

  Does it mean everyone can trust whatever is recorded on the blockchain as the underlying technology makes whatever that is recorded on the blockchain trustworthy?

No.

For example, if you recorded a claim to be King of the United Kingdom on the blockchain, that would not mean that you were the King.


How can one verify the address you are sending BTC to

No, this isn't something that can be accomplished within Bitcoin itself.

Normally you get this kind of verification from having the address presented to you by a secure website (HTTPS) which you know belongs to the intended recipient, via an SSL certificate signed by a trusted authority (signified by a padlock icon in your browser or something similar). But if either the recipient's server or your computer have been hacked, this address could be modified by an attacker to be his address instead.  (SSL only guarantees that he can't do it simply by modifying the data traveling over the Internet between the two of you.)  So in principle, you could verify the address by contacting the recipient some other way, e.g. a support phone number or something.  But this depends on the recipient giving you a way to do this, and it doesn't happen via the blockchain or anything unique to Bitcoin.

Bitcoin does provide a mechanism for message signing, but it doesn't really help here.  With this system, the owner of an address can sign a message, and others can verify the signature.  So you could get a signed message saying "Yes we are the XYZ exchange", and verify that the address owner signed it.  But in case of the attack mentioned above, you have been given an address that really belongs to the attacker, and the attacker can therefore sign a message saying "Yes we are the XYZ exchange", which will properly verify.  A digital signature doesn't prove that the content of the message is truthful.


How to save the bitcoin core (bitcoin-qt) database for later?

Ok, I think I got it.
Here is a short guide based on this bitcoin wiki article.

Notes:

This does not concern backing up your keys. If you lost your wallet, or your keys, and you made the backup discussed here beforehand, this backup will not help you recover your lost coins. This will only save you some bandwidth/time/storage.
Don't load a database to your node unless you absolutely 100% trust the integrity of that database copy:

  when you copy someone's database in this way, you are trusting them
  absolutely. Bitcoin Core treats its block database files as 100%
  accurate and trustworthy, whereas during the normal initial sync it
  treats each block offered by a peer as invalid until proven otherwise.
  If an attacker is able to modify your block database files, then they
  can do all sorts of evil things which could cause you to lose
  bitcoins. Therefore, you should only copy block databases from Bitcoin
  installations under your personal control, and only over a secure
  connection.

Answers to the questions in the post

The directories that need to be (fully) copied are:

.bitcoin/blocks/
.bitcoin/chainstate/

No extra steps needed to be done in order to just back-up the database. (This does not cover backing up your own bitcoin and keys, also there are extra steps in order to also load the database to another installation, read on to the next point)
In order to load a saved database to another installation, first delete the database of the target installation, than copy the backed up blockchain database files in their place.

Detailed guide

I'm going to assume that you're in your target installation's folder (probably ~/.bitcoin) so this is the time to do

cd /path/to/your/target/installation/folder/.bitcoin/

Back up your database:

first, make sure this node is shut off. than make the backup:

tar cfz /path/to/your/backup/blockchain_database.tar.gz blocks/ chainstate/

Now you have a backup of the database. You are probably going to take this backup to some other computer, or just keep it somewhere and than do the next steps when you want to load the database to some other node.

now again, make sure that the relevant node is shut off.

Delete the target installation's database

rm -r blocks/ chainstate/
Extract the database from backup to target installation:

tar xfz /path/to/your/backup/blockchain_database.tar.gz


Why does this non-coinbase transaction not have a sender address?

the transaction 6b1c57d98a557b5f578c02f6c386ef049df5890ebddd01d286bf345f47c5cecc spends multisignature output.

blockchain.info does not resolve such kind of inputs to addresses


If you don't have the private key, there is no way to access those coins.  Period.  The security of Bitcoin as a currency relies on that fact.

Either recover the private key somehow, or consider the coins gone.


Find message attached to Bitcoin transaction?

Transactions do not have comments attached to them. Any comments are local to a person's wallet only. They are not broadcast to the network nor are they actually attached to a transaction. So you cannot find the message or comment that a person assigned to a transaction in their wallet.


What is the meaning of the Bitcoin address version?

Last time I heard of it, the future of version bytes was still unsettled.
Currently, they are used to force incompatibilities between several base58-encoded data structures:

addresses / private keys
testnet / realnet
alternative-chains variants (namecoin etc…)

This way, you cannot misuse one for the other.

Someday, it might also be used as a real version number (the current SHA-256 + RIPEMD-160 + base58-encoding for keys could become obsolete).


what is best way to start bitcoin exchange @India

In a nutshell:

If I were setting up an exchange, I would look for a back-end that already exists, with a front-end that I could "white label".

Firstly, I am a developer that works with Bitshares, so my advice can be considered tainted. In my position, I know the code. I do not necessarily know the business. So take everything I say and place it in context.

Secondly, I know very little about the intricacies of laws in India, and I never encourage illegal activity. So make sure you what you do is legal within your jurisdiction.

Now, on with the show...

Bitshares: The Code

Bitshares-core is an open-source (MIT licensed) blockchain project that is based on DPoS (Distributed Proof of Stake).

Bitshares: The Network

Scattered around the world are "Witnesses". They take care of making sure the transactions coming through are legitimate. Think of them as "miners" in the Bitcoin world.

Where you may fit in:

What some have done is provide a "front-end" to the Bitshares blockchain. They provide the customer service, the wallet, the website, etc. Bitshares takes care of the network pieces.

I would strongly consider building it with Bitshares as the back-end. It provides "stablecoins" that allow fiat-like balances to sit there without exposing it to the volatility of crypto currency. It provides a trading platform with some existing trading pairs, and you can create your own. There are open-source front-ends that you can "white label"


Coins sent - visualise shows coins moved on - so I didn't send to another wallet of mine?

The transaction you posted has one output of 0.06193935 BTC to 1L6RYKMx4neDxVngWtsw59EteCxDfvADBk. The last time somebody spend an output from this address was today.

Based on what you describe, it's probably not your address.


There are several methods for a bitcoin client to find other nodes.
First of all they save a list of nodes from previous connections.
Of course this only works when they don't connect the first time.
If a client has no IPs stored it falls back to DNS-Seeds:

Bitcoin looks up the IP Addresses of several host names and adds those to the list of potential addresses. This is the default seeding mechanism, as of v0.6.x and later.

Once a client is connected to the network, it will ask for a list via the Addr-Message containing a list of IPs of known clients.
As you can see in the Bitcoin-Wiki there was another method, which is no longer used:

IRC
Bitcoin joins a random channel between #bitcoin00 and #bitcoin99 on irc.lfnet.org. Your nick is set to an encoded form of your IP address. By decoding all the nicks of all users on the channel, you get a list of all IP addresses currently connected to Bitcoin.


hash locked multisig, can one cosigner sign without the pre-image?

Can Alice just sign a transaction without revealing H, and just hand over the partially signed transaction off chain to Bob so he can reveal H + add his signature, make the transaction final and spend it?

Certainly. Of course the software will need to know how to handle that data, but it is not that hard to do.

The pre-image is not used in signing in any way; it is just additional data required by the script in order for the script to validate correctly.


Antminers - Can you monitor via SNMP, and set up configuration file Chron Jobs

The Antminer software doesn’t support anything for automation like this, though you can ssh in and make these modifications manually. There is no support for remote monitoring with SNMP, but there is an exposed cgminer API for remote configuration.


Two card services that I know of are xapo and e-coin (debit) cards. I know people that used them successfully and as far as I can tell are legit.


How did Ripple handle DoS/DDoS during the ripplescam.com days?

OK, since the comments section is starting to get unwieldy, I'll type a longer and slightly more elaborate answer, that incorporates some parts from the answer by @VinnieFalco.

According to Wikipedia, a DoS attack is defined as: "an attempt to make a machine or network resource unavailable to its intended users" and it commonly involves "saturating the target machine with external communications requests, so much so that it cannot respond to legitimate traffic, or responds so slowly as to be rendered essentially unavailable"

We all agree that a system that is connected to the Internet and is offering a service at some port cannot just magically prevent bad people from connecting to it, nor can it choose to accept only "good" traffic while avoiding receiving "bad" traffic.

There many "types" of DoS attacks, but they all boil down to one thing: they seek to consume resources:

As you know, resources come in many forms; sometimes attacks will consume bandwidth, other times they will consume RAM, disk space, IOPS, file descriptors, license slots/seats, or just about any finite resource that your service requires.

Fundamentally, you have two options: either increase available resources above the level of the attack, or ride it out.

Sometimes you can do a little better: you can attenuate an attack that seeks to consume bandwidth by using a content-delivery network. You can go from rotating hard drives to flash-based storage, and even to RAM based storage if the attack causes I/O performance to drop. You can limit the use of commands that require resource under attack.

Sometimes you can do better still: you can detect that the attack traffic comes only from a subset of hosts and filtering those data streams off at an upstream provider. If I/O is a bottleneck, you can attempt to rearchitect code to reduce the amount of I/O necessary. If commands are computationally expensive, you can attempt to optimize them or even reimplement them in a more efficient manner.

But, ultimately, all you can really do is blunt the force of a DoS attack. Generally speaking, you cannot prevent a DoS, and if it hits, you usually end up having to buckle down and waiting for it to pass.

So what about the Ripple servers?

As far as increasing the available resources, obviously that's outside the purview of the code: it can't magically provision more resources. That's the job of server operators who will typically ensure that their servers have sufficient excess capacity to provide servers even when demand for service spikes. So this isn't anything the code can do about something about.

What the servers can do something about, however, is to attempt to detect when they are under heavy load or attack and respond to that. In a sense, both those scenarios play out the same:

The servers will penalize connections which are forcing the server to do more work per unit of time than the server considers reasonable. Typically the penalty is to inform the user that the server is too busy and to ignore the command and to disconnect him if he persists in issuing commands at an unacceptably high rate.

Of course, the server has no real way to distinguish with perfect accuracy whether a user is abusive or not because it doesn't have a crystal ball. All it knows is the commands that it receives from a source and the rate at which the those commands are being sent and it bases its decision on that. So while this countermeasure will affect users who are, indeed, abusive, it can also affect legitimate users.

The server can also track load across all its connections and can decide to make some commands (which it knows are very expensive but not strictly necessary) temporarily unavailable, as load begins to climb. In that way, the server can conserve resources to use in processing the commands which are necessary.

Of course, this approach is more blunt and will affect legitimate users, as the server may refuse to execute an expensive command even from a legitimate user  who has not issued any other expensive commands nor caused undue load.

On top of that, there's what Vinnie Falco mentioned: the servers seek to protect themselves and the network from abuse by:

Imposing (miniscule and neglible) transaction fees that are payable in XRP and which scale dynamically in response to various factors, including network load; and
Imposing network-wide 'account' and 'action' reserves.

This means that someone seeking to attack the network in certain ways must, in essence, pay for the "privilege" of doing so and they harder they attack, they more they must pay.

Why is this helpful? Generally those who are orchestrating a (D)DoS attack don't really have to pay and their costs are minimal, making the attack not only  cheap to launch but cheap to maintain as well. This is a huge advantage

By imposing fees, which, for regular users are negligible, Ripple servers and the network take that advantage away: they "prevent" (D)DoS attempts because the cost of launching and sustaining an attack against Ripple quickly adds up.

There are a few other mechanisms which Ripple servers implement to protect against and mitigate the effects of (D)DoS attack. Combined, all these things work pretty well, but the bottom line is that we have come full circle to what I said earlier:

A system that is connected to the Internet and is offering a service cannot just magically prevent bad people from connecting to it, nor can it choose to accept only "good" traffic while avoiding receiving "bad" traffic.

One other thing I didn't touch upon: Optimizing the Ripple server code to improve performance. This is something that we at Ripple Labs spend a lot of time on and we still have things we want to do and ideas we want to implement. We also hope that the vibrant community of talented open-source developers will take a look and contribute their many great ideas as well.


1 MB Block Size as a Anti-DoS Attack Measure

The DoS the block size limitation is trying to prevent is a miner creating a huge block of garbage data that now every single Bitcoin miner must download, validate, and store the entirety of. Imagine if some miner decided to create block after block of 1GB of garbage, and now every single Bitcoin node in the world must store and validate all of this garbage. If it were possible, this would be in the best interests of larger miners to do: smaller miners, who don't have the ability to download and validate these giant blocks of garbage as efficiently, will not be able to keep up with mining.
Also, people do attempt to submit spam to the blockchain. Trying to do so to the point of blocking out legitimate transactions will be quite expensive, considering you would have to pay transaction fees for every "spam" transaction you want to send.


What encourages Bitcoin miners to relay blocks?

As long as the block reward is much higher than the transaction fees, this is totally not an issue: mining isn't an incremental process, it's a bruteforce probabilistic one.

I.e. in a single moment your chance of solving a block isn't higher if you have been mining that same block for some time: the chance is always the same.

Hence, once a block is relayed to you, you just add it to the blockchain and start immediately to search for a new block on top of that one.

Since the risk of your block being orphaned (currently you'd lose 25BTC ~= 3750€) is many orders of magnitude higher than the cost of relaying it (I'd estimate it a bunch of satoshis), it is always more convenient to relay it.


What advantage do Mt.Gox or Kraken have over Coinbase?

An important advantage they have over Coinbase is that they can offer a service to other people than U.S. inhabitants.

mtgoxUSD may be by far MtGox's largest market, but don't forget that mtgoxEUR and mtgoxJPY are still the 5th and 6th largest markets that exist. More trade volume means more robust and stable prices which is a good advantage as trader.

I'm not familiar with Kraken, so I can't speak for that.

Also, Coinbase does not support limit orders. This is very important. Read the link or search a little about limit order and you will understand.


Is it required to have an electrum account for electrum api usage?

It is an open-source software. There's no need for credentials or accounts.

There's multiple public electrum servers you can connect to through your electrum wallet. You could build an interface on top of the electrum wallet that connects to any of these servers.


BTC/USD price changes approximately the same way over many exchanges at the same time, how?

To be more specific about the "arbitrage strategies" in Tanmay's answer:

Suppose there were a difference in price between two exchanges: at A the price is $10,000 and at B it is $10,100.  Then, in principle, someone could turn a quick and risk-free(*) profit by buying coins on A, transferring them to B, and selling them for the higher price.  This is called arbitrage.  As they do so, it will tend to drive up prices on A: the people who were offering coins for sale at $10,000 on A are having their offers accepted.  Eventually those offers will all be gone, and people who want to buy will have to take the next-best offer, which will be at a higher price.  Similarly, this strategy will also tend to drive down prices on B.

Arbitrage thus tends to make prices on different exchanges converge towards equilibrium.  And it can happen very fast, so significant differences in price, even if they should occur, don't tend to last very long.  Most of the time you see prices that are close together.

I have left out some details: for instance, the arbitrage strategy will incur transaction and trading costs, and it is not completely risk-free since prices could change in between trades.  This is part of why you don't see prices looking exactly the same at all times.  But the principle applies, and it's a fundamental principle in the study of finance.


Bitcoin works in a way that you don't actually own any coins, but instead you have the key to unlock them and spend them - so that you can send them to someone else who can then unlock them and spend them.

Using that logic, anybody that holds your private key can unlock and spend the coins from any computer anywhere in the world with an internet connection.

In terms of wallet implementations, it's a bit tricker to use the same wallet on different computers as there will be synching issues between the various wallets. The "change" from a transaction will go into another address in your wallet, which might not be present in your other wallet. Please read Wallet on multiple computers

Again, this depends on your wallet implementation. If you're using just the raw private key to make transactions, it shouldn't matter how many copies there are or where you broadcast the transaction from.


What is the impact of Bitcoin XT fork on current Bitcoin holders?

Bitcoin has not been forked yet. Once XT nodes mine 75% of all bitcoin blocks, XT will support a larger block size that will be incompatible with current bitcoin client. At that time, the blockchain is forked and the bitcoin currency would be divided into two, Bitcoin and BitcoinXT.

  what is the impact on the current existing Bitcoin holders?

A transaction would be mined twice, XT miner puts this transaction on XT's fork; Core miner puts it on the core's fork. Then, you can run two clients, one of them spends Bitcoin, the other one spends BitcoinXT. Cool!An SPV client always follows the one with largest proof-of-work, which means it can only spend coins from stronger chain.

  Are they handled by Bitcoin Core or by both?

Both. You can double spend your coin now. One is bitcoin, the other one is bitcoinXT.


Can you register a .com domain with namecoin?

Namecoin was the first fork from Bitcoin, and is a blockchain based peer-to-peer network which maintains a decentral ledger of registered names.

It is the convention, that when you register a Namecoin name starting with d/ that appropriate DNS resolution software would translate this information to a .bit address. E.g. d/myself would be resolved to myself.bit.
On the other hand, the responsibility for managing regular top-level domains (TLD) is assigned by the Internet Corporation for Assigned Names and Numbers (ICANN) to specific organizations, with which a regular user can then register a domain directly or through intermediaries.

The ".bit" domain used by Namecoin didn't exist in the Domain Name System (DNS) before. As far as I am aware, there are no conventions for established top-level domains. That would be especially problematic in the case, when the two resources managing the same namespace would end up with conflicting information:
It would be somewhat detrimental to the user experience if domains were to resolve to different pages depending on whether you used the Namecoin extension or not.

Another example of Namecoin usage is the application OneName, which resolves names starting with u/ to point to Bitcoin addresses of their users.


Is it possible to use servers to mine bitcoins?

It is possible, but not profitable.  Even if you consider the server as already paid for you will not generate nearly enough of a hashrate to earn more than a few cents a month.


Does the private key have special mathematical properties?

In Bitcoin, a private key is just a random number between 1 and 0xFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141. This number is derived from the order of the elliptic curve that Bitcoin uses, secp256k1.

Note that you don't have to have the most significant bit 2^255 set to be a valid Bitcoin private key, any number greater than or equal than 1 will work. Indeed, knowing that the most significant bit is set actually lessens the security of that private key, because it reveals some information about the key. You don't have to use some special key generator, in fact there are even tutorials on how to generate a private key with coin flips. The only requirement of a private key (other than being in the range outlined above), is that it be random (hard to guess).


Building the merkle root from transactions in a template block

I'm much closer now I hope this helps someone else trying to do this!

REQUIREMENTS:

NPM bitcoin bitcoin-js merkle-lib

CODE:

client.getBlockTemplate( function(error, template) {
    if (error) return console.log(error);
    txhashes = template.transactions.map(function(tx){ return Buffer.from(tx.txid, 'hex').reverse() });
    merkleRoot = fastMerkleRoot(txhashes, bcrypto.hash256);
    console.log(merkleRoot);
)};

The result is in a Buffer and I'm having trouble converting it to hex.


Is there a way to reindex from disk but not start from blk0000.dat?

Unfortunately, I don't believe the -reindex option has the ability to be that smart.

If I were you, I would:

Shutdown Bitcoin-Qt
Start Bitcoin-QT with the -reindex flag

Reindexing doesn't take very long usually (maybe a few hours). 9 days is a long time to wait, it would probably be better to just start with a clean reindex. This won't delete the blkxxxxx.dat files, so you won't have to download all that data again at least.


"Reindexing" means that Bitcoin Core is repeating the synchronization for part of your blockchain data. Your transactions will show up once the blocks that contain them have been processed.


Do I need an app and internet on my smartphone to enable a Lamassu ATM to detect and scan my QR code?

You don't need internet or an app. Actually, the machine can either scan a paper QR code or a mobile phone.

The problem would either be that the QR code encodes different information than what you thought it does, or that the scanner of the ATM does not recognize the QR code on the screen. What you need to show is a Bitcoin address.

Try to set your screen to full brightness, be sure not to block any part of the screen when presenting it, and check whether the QR code actually contains a Bitcoin address, and not something else such as a private key or payment request.


How a stakeholder is chosen randomly in proof-of-stake?

There are various variables to consider.

Min Stake Age, Max Stake Age, Input Age, Input Size.
And then there is the version of PoS being use.

Min Stake Age determines an inputs eligibility, they must be older than this figure to stake.
Max Stake Age is the upper limit of input age used to determine Input Age.
Input Age is used a factor in PoSv1 to determine the input weight (note the code variable nCoinAge is the factor of Input Age * Input Size).
Input Size is the amount of coins in an input.

V1, which is PPC and descendants, uses Coin Age as a factor.
basically age * size,
whereas
V2 and V3 only uses size.

Under V1, if stakeholder_2 has less but older coins then they might have more chance.
Under V2 and V3 Input Age is removed form the equation, so the more eligible coins you have the greater your chances.


Is it possible that bitcoin community along with core developers introduce new bitcoins into the system for the good cause?

The reward schedule and therefore the amount of bitcoins in circulation are central rules of the Bitcoin system. Changing the rules to create additional bitcoins would be incompatible with the protocol and in contradiction to the social contract the Bitcoin community formed around. Breaching this social contract that is central to Bitcoin would destroy confidence in Bitcoin's value.

So, while it would be technically possible that more bitcoins are created, I am sure that the idea to change the protocol to bail out business ventures would not gain the overwhelming support necessary to implement it. It seems more likely that investors would use contracts or insurances that work on top of Bitcoin to hedge against the risk.


What information can an attacker gain from watching the users behavior in block chain?

If you use the same address for every transaction you receive, then anyone who knows that address is yours (and is watching the blockchain) will have record of your entire history of transactions. You will have zero financial privacy.

Address reuse is also indirectly bad for the users you transact with: anyone who knows the other user's address will now also know that they transacted with you. Approximate time, and the transaction amount will all be public knowledge.

Thankfully, by using a new address for each transaction, it becomes extremely difficult to make such assumptions, as doing so creates a very high level of plausible deniability and uncertainty when attempting blockchain analysis.

Bitcoin privacy is a highly nuanced topic, for a much more in depth explanation see: https://en.bitcoin.it/wiki/Privacy


You cant do basically nothing from your end, as you have lost the control of those bitcoins.

One thing that you can do is to ask the recipient of the transaction to refund. If he refunds you will get back the bitcoins.


can cryptocurrencies be energy efficient?

As the answer for this question, we have the Proof of Stake approach, firstly implemented by Peercoin (PPC). I think other coins as Ethereum have as well a proof of stake mining/minting approach

links: https://peercoin.net/minting and https://github.com/peercoin/peercoin/wiki/FAQ


CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.

If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.


Will I have the same amount of bitcoin on "bitcoin core" and "bitcoin unlimited"

If a hard fork activation of Bitcoin Unlimited were to occur, both the resulting chains share a common blockchain-history:

                     BTC : ← 6 ← 7
1 ← 2 ← 3 ← 4 ← 5 <split>
                     BTU : ← 6 ← 7

All the coins that were in your possession before the split now exist on both chains. Once you have moved them to separate addresses on the two chains in order to prevent replay attacks, you'll be able to move them independently by using two different Bitcoin wallets that each interpret one of the chains.

As to other results of the fork, I don't feel like it's appropriate to make predictions at this point, but I would expect significant volatility as some users would move to dump coins from the side that they don't wish to support.


mtgox failure... any implications for bitcoin/ecurrency protocol design?

Yes, finances can be analyzed, but there will be wide ranges for accuracy and precision if an institution remains anonymous which would be strange.

Most likely, standards will be built in the financial community around disclosures of BTC for confidence.  Institutions that prefer anonymity or suddenly start showing disparities will probably be shunned with the latter most likely experiencing solvency troubles, exacerbating a run if bailouts cannot be orchestrated.

Welcome to the NFL, cryptocurrencies.


Decodescript for a Testnet pubkey hash address

From bitcoin-cli help decodescript:

{
  "asm":"asm",          (string) Script public key
  "type":"type",        (string) The output type (e.g. nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_unknown)
  "reqSigs": n,         (numeric) The required signatures
  "addresses": [        (json array of string)
     "address"          (string) bitcoin address
     ,...
  ],
  "p2sh":"str"          (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).
  "segwit": {           (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness).
    "asm":"str",        (string) String representation of the script public key
    "hex":"hexstr",     (string) Hex string of the script public key
    "type":"str",       (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)
    "reqSigs": n,       (numeric) The required signatures (always 1)
    "addresses": [      (json array of string) (always length 1)
      "address"         (string) segwit address
       ,...
    ],
    "p2sh-segwit":"str" (string) address of the P2SH script wrapping this witness redeem script.
}

Additional explanation, using your example:

n35oDVMPNkHRzBKy7q9RDB7r5e8qbVa9SW: this is a "legacy" pay-to-pubkey-hash address. Coins sent to this address are locked with the asm script you see in the output. They can be unlocked with a scriptSig that contains the public key that matches the hash, followed by a signature matching the public key.

p2sh: 2NFyoZJJuWpvyiHFirFqsQnPXXna6mtf4Li: This one is a bit confusing. It is still a "legacy" (not segwit) address, and it is a pay-to-script-hash address. Coins sent to this address are locked with a hash of the entire script you see above in asm. They are spent by pushing a scriptSig with the entire serialized script (DUP/HASH/EQUAL/CHECKSIG) followed by the public key and finally the signature.

segwit: tb1qajgv52xqasczaxglk8ypwxl5nsxn6pd7307tfg:  Here is a segwit address. BIP141 defines a few segwit address types and this one, as you can see, is a pay-to-witness-pubkey-hash or witness_v0_keyhash or p2wpkh address. Coins sent to this address are locked with a hash of a public key only (along with a specific byte that indicates segregated witness). They are spent by pushing an EMPTY scriptSig and providing a witness stack that has the public key and signature.

p2sh-segwit: 2MwgL2byHmKdRvfGhufKpJkpAvtDLpo1REs: Another segwit address. This one, as you can see, is a NESTED pay-to-witness-pubkey-hash or p2wpkh-p2sh address. Coins sent to this address are locked with a hash of the witness program seen in the asm section of the segwit section. They are spent by providing the serialized witness program in a scriptSig and ALSO including a witness stack with public key and signature.

Summary

If you have one private key, you can spend coins sent to any of these four addresses.


I generated a Signet address on a Bitcoin Core PR branch and obtained some Signet from the faucet. How can I locate that private key?

As Pieter says in the comment the private key is in the wallet.dat file and you can use:
./src/bitcoin-cli -signet dumpprivkey insert_signet_address
to get the private key for that signet address.
There are separate wallet.dat files for each chain (mainnet, testnet, signet, regtest) that persist across the different PR branches and different versions of Bitcoin Core you run. These aren't ever replaced or written over. If you have signet Bitcoin on one PR branch, then you build and run another PR branch you will still have access to that same signet Bitcoin that you had on the previous branch in the usual way.
Pieter added below:

Every chain has its own distinct default datadir, and everything in
that datadir (including blocks, chainstate, peers.dat, onion
addresses/keys, ban data, fee estimates, mempool dumps, ...) is shared
between all codebases that use that chain.


Conflicting transaction info on Blockchain.info and Jaxx compared to other sources

Your transaction is fine, and she should have received 0.00128615 BTC.

There is likely some confusion since not only do you have multiple inputs, you also have three outputs going to her address. They add up to 0.00128615 BTC, but each individual output is around 0.00042 BTC. It is possible that Jaxx shows her these as three separate line-items, leading her to believe you only sent 0.0042.

The explorer is not going to be confused by multiple input/outputs, they are a common part of Bitcoin. The estimated BTC transacted about is blockchain.info's best guess at it, and should not be taken as a fact. It is often wrong.


How to accept payments via Ripple on a website

There are some existing sources of information for merchants wishing to use Ripple:

Brief introduction and overview of Ripple for merchants
Merchant's section/pages on the Ripple wiki

If you are looking for something pre-implemented and easy to add to an existing automated web commerce check-out page, there isn't much available along those lines at the moment. Ripple is still in beta and the server and client code still appear to be the focus of attention. However, there has been a recent small bounty offered for the community to develop shopping cart plug-ins that use Ripple.

It's easier for sites that have a manual check-out process as they can just add a Ripple URI for customers to use and the merchant can manually check for received payments with the existing Ripple client (or use a third party tool such as wasipaid).

The basic process for a merchant to use Ripple is:

Create a Ripple address to receive funds (one time setup).
Create payment paths in Ripple for the funds you wish to receive (e.g. trust a gateway for USD or EUR, etc) (one time setup).
Supply a Ripple URI, possibly with a nice "Pay via Ripple" button that customers can use to initiate Ripple payments with their Ripple client. This can use a unique "destination tag" and/or "invoice ID" to distinguish individual Ripple payments. The Ripple client will offer the customer payment options using whatever assets they have for which it can find a payment path.
Manually or automatically watch for updates to the Ripple ledger to detect when payments are made. Make sure to handle partial payments (e.g. update a balance payable field) and to handle over-payments (e.g. return the excess, since Ripple payments are non-reversible and a reverse path may not exist for the currency being used this can be non-trivial). This is the "big" step where automation or plug-ins would be helpful, especially in handling all the corner cases.
Release/ship the thing being sold.
Periodically extract the received funds via Ripple, e.g. withdraw your balance in Ripple through a gateway into a bank account. Alternative, use the funds within Ripple.


How do developing countries begin to adopt bitcoin?

It's quite simple to begin being part of the Bitcoin network. It's public and open to everybody.

If there is no Bitcoin infrastructure around your community, for example where you could buy bitcoins, you start telling people that you accept bitcoins as a payment.

You could sell a product and accept bitcoin.
Offer your services for bitcoins.

Eventually, someone will be the first one to pay you in bitcoins. Like a domino effect you will start tipping your friends and the bitcoins will move around.

In case you do have a credit card you could buy them on an exchange such as bitstamp, circle or bpesa to mention a few. You could then sell them in your community to help adoption. They pay you in local currency and you hand over bitcoin. What you do with the local currency is your choice. You can keep them, pay a bill or exchange them and purchase more bitcoins.

If it has utility people will start using them. Some sooner and some later. Same with countries.


How do exchange services provide forked coins to their customers for free?

Forked coins have nothing to do with ICOs.

You get forked coins by holding the coin that was forked from before the fork. After the fork, you will have the same amount of the original coin and the same amount of the forked coin. Exchanges who hold coins that then get forked will then also get the same amount of forked coins, as does anyone else. Whether they give you access to these forked coins is up to the exchange.

It may be technically difficult for them to do so so an exchange might not give you access to the forked coins. They may wish to keep the coins to themselves instead of giving free money to their customers. Without asking the exchange themselves, you cannot know why they didn't give you the forked coins.


Do testnet networks require the same main network fee?

I would say so. I can't find any code that make fees lower or optional for testnet users.

However, it's substantially easier to send a free transaction.

inline bool AllowFree(double dPriority)
{
    // Large (in bytes) low-priority (new, small-coin) transactions
    // need a fee.
    return dPriority > COIN * 144 / 250;
}

dPriority is higher for larger amounts. Testnet coins are worth much less, so you're more likely to send lots of them around. For example, if you sent 50 testnet coins half an hour after you got them, that would be eligible for a free transaction.


How is the balance checked by miners when new addresses are generated?

Bitcoin itself only needs to track the current set of spendable bitcoins.  It doesn't need to track bitcoins that have already been spent nor any information about who may receive bitcoins in the future (e.g. a new address).

When you create a new address, you don't have to register it anywhere (indeed, you can create the address completely offline), so there is no global tracking of new addresses.  By default, only your wallet tracks information related to a new address.  When someone spends money to that address, then Bitcoin full verification nodes begin to store the address, as it now controls spendable bitcoins.  When you spend those bitcoins, full nodes stop storing the address.  If you later receive more bitcoins to the same address, full nodes will start storing it again.

Some websites continue to store information about historic transactions so they can show every transaction that affected an address.  This is an interesting feature, but it's not directly related to what full nodes do.  Full nodes only store the information related to the current set of spendable bitcoins (plus some additional unindexed information necessary in case they need to recover from a problem).


What are concrete uses of Bitcoin script?

multisig transactions
blockchain-embedded escrow
time-bound transactions
proof-of-burn
bets based on some oracle, either trusted or decentralized

I suppose there are many more and that some if not all of the above can be, more or less efficiently, realized with P2PKH, possibly with some extra protocols required.


what is the source of bitcoin for trading site like koinexcoinbase/etc...?

No, simply they sell and buy bitcoins. I sell them my bitcoins and you buy from them these bitcoins.