Does a segwit based side chain like the lightning network allow for fractional reserve?

A sidechain has its own blockchain which is coupled to the Bitcoin blockchain via a two-way peg. This allows tokens on the Bitcoin blockchain to be frozen in order to make new tokens available on the sidechain. In turn tokens on the sidechain can be either destroyed or frozen to move money back to the Bitcoin blockchain.

Lightning Network is not a sidechain. It's a second layer that builds on top of Bitcoin and uses the same tokens as Bitcoin.
Channels are created by sending money into native 2-of-2 multisig addresses on the Bitcoin blockchain. After a channel is created by sending money to the mutually controlled address, the current state of a Lightning channel is stored in a pair of unconfirmed Bitcoin transactions. When one of the participants wants to close the channel, they can unilaterally broadcast the latest state to the Bitcoin network. When the exit-transaction is added to a block, the final state of the channel is executed. Alternatively, they can collaborate with their partner to close it.

Since the full Bitcoin balance of the Lightning channel is stored in the multisig address that established the channel,  all bitcoins are fully accounted for. Therefore, there is no fractional reserve in Lightning Network.


Bitcoin raw transaction with manually created redeem script

You can't just give Bitcoin Core the redeemScript, it won't know what to do with it. The only valid thing to give it is an address, but you have not given it an address. You need to convert your redeemScript into a P2SH address first, then you give it that address.

You can use the decodescript command to get both the p2sh and p2wsh addresses for your redeemScript:

$ bitcoin-cli decodescript 63a820a967bf5e8ca09e059d6bb7a3efa8f62190284649d3eab773518827164ac481fb8876a914f5fb6147ff889a392211d0f0831a71137bedbff167064f505f323030064f505f4353567576a914cac5d03956494ffc17f78ea7b71189abf7f3593d6888ac
{
  "asm": "OP_IF OP_SHA256 a967bf5e8ca09e059d6bb7a3efa8f62190284649d3eab773518827164ac481fb OP_EQUALVERIFY OP_DUP OP_HASH160 f5fb6147ff889a392211d0f0831a71137bedbff1 OP_ELSE 4f505f323030 4f505f435356 OP_DROP OP_DUP OP_HASH160 cac5d03956494ffc17f78ea7b71189abf7f3593d OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG",
  "type": "nonstandard",
  "p2sh": "33bzAemHYJdN1XciQGqj4v48F5YFinQGcY",
  "segwit": {
    "asm": "0 6b2b3b1c6a0f8c15b5cdac185339555ec0d537304b367f73ab615d55c9719607",
    "hex": "00206b2b3b1c6a0f8c15b5cdac185339555ec0d537304b367f73ab615d55c9719607",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bc1qdv4nk8r2p7xptdwd4sv9xw24tmqd2desfvm87uatv9w4tjt3jcrs2a06tv"
    ],
    "p2sh-segwit": "3Erd7hDtmrGxvyEjcaqsARh8wfBfM9m4N5"
  }
}

As you can see, you can use the address 33bzAemHYJdN1XciQGqj4v48F5YFinQGcY in your transaction. If you would like to use segwit, you can use bc1qdv4nk8r2p7xptdwd4sv9xw24tmqd2desfvm87uatv9w4tjt3jcrs2a06tv.


There are several aspects to not sending to a public key directly. Here are a few I can name

RipeMD160 shortens the address from 256 bits to 160 bits
A checksum is introduced to the address
An address doesn't expose the pubkey, so if the ECDSA gets compromised, funds are still safe ["quantum PC attack resistant"]
Pay to script hash is possible with the same address format; in later iterations with e.g. taproot this can greatly enhance privacy and functionality at little or no extra on-chain cost


Checking/polling a balance of an address in Electrum via the command line/RPC

There are several ways depending on what you are using.  If you are wanting to query the daemon - one must assume you are running a Linux box or VPS

You do not want or need an " address balance " - you need YOUR wallet balance

This question has already been partially answered here =>  How would one monitor an address for a transaction and 1 confirmation in PHP?

The best way however is to use what the Electrum docs recommend - a curl call like this =>  curl --data-binary '{"id":"curltext","method":"getbalance","params":{"funded":true}}' http://127.0.0.1:7777

If you are using PHP - it would look something like this:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:7777");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"id\":\"curltext\",\"method\":\"getbalance\",\"params\":{\"funded\":true}}");
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);

You could make this inside a try-catch and trigger it by a cron job running at whatever interval you want to check

What comes back is a JSON-RPC file which you can decode into an array

$result =  json_decode($response, true);

and plug that into another variable for the single thing or things you want to work on from there

$wanted = $result["result"]["xxxxxxxxx"];

any of the parameters can be passed as a variable to the curl call

for instance to add a request it would go like this:

curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"id\":\"curltext\",\"method\":\"addrequest\",\"params\":{\"amount\":\"$how_much\",\"memo\":\"$your_memo->some_data_field\"}}");

You just need to run a  "getbalance " - or any - command see what it returns and adjust your code to pull the returned value from "result" - you just test for a greater than " 0 " and then empty the wallet by sending it to another wallet and wait for the next payment

You could then use that data to trigger a "do something" like the email example in the above link from the middle example there.


How are Bitcoin Core GUI nodes properly connected and disconnected in regtest mode?

I want to disconnect both nodes from each other.

  From Alice's Console, I use:

addnode 127.0.0.1:18445 remove

This is incorrect. This command will only remove Bob's node from the list of addnode'd peers. The correct command to actually disconnect Bob's node is

disconnectnode "127.0.0.1:18445"

  On Alice's node, the peer is:

  127.0.0.1:18445

  However, on Bob's node, the peer is

  127.0.0.1:57594

  but I expect it to be:

  127.0.0.1:18444

Outbound connections are not made from the P2P port. Rather a random high numbered port is chosen to bind to and the outbound connection is made from there. IIRC this is done by the kernel and not the software itself. This behavior is standard for most software that make outbound connections.

  I then try to disconnect Bob's node from Alice's node using the the Peers tab. Right click on peer (Bob) and choose disconnect.

  The node is disconnected for about 45 seconds, then reconnects.

A connection is still being made because you did not remove the other node from both nodes (i.e. one node still has the other one in its peers database).

The proper way to do this would be to use the onetry option as that means that the node is not actually added to the peers database but rather tried once. To disconnect, you should be using the disconnectnode command.


Question about running full node electrum wallet

1) How can you run a full node wallet with electrum? what do you need? Or please link me to an understandable guide for that

This probably should be a separate question.

  2) Do you have to be online always or can you set it up, fund your wallet, and leave it offline for months, and just from time to time use it for transactions?

You can use it only intermittently if you want, but the full node will need to synchronize with the chain. If you're offline for a long time this can take minutes or even hours, depending on your hardware.

  3) Is electrum the only software you need? Or do you also need bitcoin core?

Electrum is a wallet, not a node (and much less a full node). You need to run a full node (e.g. Bitcoin Core), an Electrum server that can serve Electrum clients with data from that full node (e.g. Electrum Private Server), and then connect your Electrum client to that server.


Is the checksum used in BIP39 mnemonic sentences too short?

Checksum in BIP-39 is mainly used for padding which may be the reason why smaller size checksums are used.
Each BIP-39 word represents 11-bits and in order to divide the entropy of an arbitrary size (which is normally a multiple of 8-bit such as 128, 160, 256,...) to 11-bit chunks it has to be padded first. For example in case of a 128-bit entropy 4-bits padding is needed (128+4=132%11=0) and that pad is the checksum.
BIP-39 authors may not have thought about recovery cases but if a bigger checksum were to be chosen it has to pad the total length to a multiple of 11. In case of 128 bits it needs to be 15-bits (128+15=143%11=0) or 26-bits, 37-bits,...


Can you mine more bitcoins on amazon aws than it would cost to operate the servers?

AWS is rental of server instances.  Servers without GPUs. Bitcoin is not cost effective when mining using CPUs, so nobody has done that analysis for nearly two years because its an obvious money loser and becomes a worse option with each passing day of rising difficulty.

Now EC2 (compute cluster) does use GPUs but NVidia GPUs which don't perform at a fraction of the level of AMD GPUs for the specific purpose of Bitcoin mining. Although it was not analyzed recently, a calculation from a while ago provides numbers in the right ballpark, if not better than they would be today.  In that study costs you more than twenty dollars of EC2 charges to earn one dollar of bitcoins.

Once ASICs ship that difference will increase possibly by an order of magnitude.


Unfortunately once you lose your wallet, there is no way of getting it back.

The wallet is so inportant because it contains your private key, this key is used to send money from your wallet to other people. Without it you can't do anything.

Next time consider writing down the private key and keep it locked up, or keep an offline version of your wallet.dat file. however be careful with keeping online versions, since anyone who has your private key can send money anywhere.

Just for clarity, you talk about your 'adress', is this your public or your private key? With other words, did you use it to send money? Or to recieve money?


Estimate of Net % of transaction fees in bitcoin transactions

I am curious to know whether any study has been done to calculate the net % that will be lost in transcation fees (paid directly or indirectly by the purchaser of the goods) as compared to that of credit cards (~2%)?

Credit cards don't support all types of transactions. For example, say you wanted to pay me to fix your computer. You can't do that with a credit card, because I don't have a merchant account, and it's not worth the trouble for me to get one. There are other ways to accomplish this (bank wire, mailed check, PayPal) but they have different fee structures. The economy doesn't run entirely on credit cards.
#1 will cost as much as the block reward plus the transaction fees - if miners spend more than that, they will lose money. #2 would cost $100 to $200 per person, for secure, tamperproof devices. #3 is likely to be the same amount spent to develop phone apps as is spent currently.
People won't have the same incentives in a Bitcoin world. Suppose that when everyone uses Bitcoin, it's harder to force someone to pay a court judgement. Because of this, a car manufacturer becomes slightly less careful about the safety of their cars, and an extra 40 people die in the US every year. How are we supposed to convert that into an equivalent transaction fee?

You mention credit monitoring services, which I don't think would exist in a Bitcoin economy; I don't think you'd be able to get any loans. How could you give someone a mortgage, if they could secretly start socking away money where you can't get at it?


Appeared to have lost funds after recovering Blockchain wallet

This happened to me yesterday as well but under slightly different circumstances.

I set up my account through the app, logged my seed and everything else I needed and continued with purchases etc. Couple of days later I decided to run this on my Mac and spent ages trying to figure out the pairing process, it wouldn't work at all seemed to only want to pair I'm the other direction. So I decided to delete the app reinstall it and pair how it asked. When I did this both online and app balances were zero. A bit worried, but happy knowing I had the seed I ran through the account recovery and when I came up the balance was still zero!

I logged into Coinify separate and the transaction is still there! So strange.


IBM Hyperledger Fabric Running Multiple Nodes on Multiple Datacenters & PCs

In the recent technical steering committee meeting of Hyperledger they discussed the planning for an initiative to connect across multiple cloud providers, to demonstrates that Fabric can be deployed to multiple cloud platforms and integrated into a highly distributed and heterogeneous consortia network.

This effort (as of the time of writing) is under way with a number of community members interested in contributing.

You can read about it more in the meeting minutes here.


How can I buy Bitcoin via a Credit Card or Paypal?

I noticed this question was posted a long time ago and perhaps things have changed so I took the liberty to dig in again and also aggregate most of the answers given here and here’s what I found:

It’s indeed impossible to buy Bitcoins with Paypal DIRECTLY even today and it's mainly because of Paypal’s TOS (Section 3.7 here) and the issues of chargeback.
Having said that there are still a few ways you can buy Bitcoin with Paypal

a. Use VirWox to buy SLL with Paypal and then transfer that SLL to BTC (has high comission, transaction can take between 1 hour to 2 days). The full process is explained here.

b. You can use Local Bitcoins and perhaps find someone in your area to sell you Bitcoins with cash or even someone not in your area to sell you Bitcoins with Paypal or a credit card.

c. If you’re only into trading Bitcoins for their volitility and not actaully keep them you can use platforms such as AvaTrade or Plus500 to trade CFDs. However CFDs are for more experience traders and your capital is at risk so take that into account.

d. If you have a Paypal Debit card you can actually connect it to your Circle account and use the funds on your card to get BTC. This is relevant to US residents only.
Same thing goes for credit cards. Because of chargeback issues there’s no direct way to buy Bitcoins with them. Currently some options for credit cards are CoinMama, Circle or Cubits.


Any exchange available for using virtual cards like Payoneer?

Have you tried Coinbase? They accept Visa/Mastercard of all forms, I believe. Also, they're MUCH cheaper than Coinmama.


Is there a limit to sending/ receiving from wallet to wallet?

You're only limited by the amount of bitcoins under your control. There is effectively no limit on transferred value on the side of the protocol, as you would in fact be able to spend all bitcoins that will ever exist in a single transaction. (Hat-tip to Andrew Chow.) The biggest transaction in bitcoins I'm aware of were 550,000 BTC (then approx. $1,345,000), and the largest amount of value transferred in one transaction was $149,000,000 (~195,000 BTC) in a Bitstamp audit.

It may be that some exchanges limit the amount of bitcoins that you may withdraw in a single withdrawal. For further information on that, please refer to the respective user guide.


I am unable to see the amount credited to this new address with the getreceivedbyaddress command.

There is no by-address index of the blockchain in Bitcoin core.

For bitcoin-core to track an address you must, for example, add an address to the wallet as a watch-only address.


How to view Bitcoin Cash (BCC) on Trezor Wallet

BCH (Bcash) as Trezor refer to it, is now available on https://beta-wallet.trezor.io after applying 1.5.1 firmware upgrade. Go to https://beta-wallet.trezor.io

You can also use tool to claim your BCC, read more on this blog page


Why is DiabloMiner using so much CPU now?

It almost certainly is related to the question you linked and it almost certainly has the same answer I'm sad to say. There is a lot of this going around and no one is really certain what exactly is causing it.

There have been reports that ATI's 11-7_vista64_win7_64_dd_ccc_ocl drivers often bring the problem about, and reverting back to an 11-6 version seems to fix it. Not sure if it will work for you or if it even applies to your situation but it's worth a shot.


Which API provides the logo for a cryptocurrency?

You can use their css class

http://coincap.io/css/spritesheet.css?v=1_6_1

attach it in your html file and call it like that for bitcoin logo:

But you have to contact them for copyright measures.


Can you send a Bitcoin transaction to a Bitcoin address that does not exist?

Can you send a bitcoin transaction to a bitcoin address that does not exist?

Absolutely, however, the address must be valid.

A completely arbitrary address (or a typo) will likely not be valid because addresses contain a checksum when they are Base58 encoded. There is no way for the network to know if someone owns a key corresponding to an address unless a transaction has occurred with that address. See Bitcoin Wiki - Address and BIP 13 which describes how a Pay-to-Script-Hash address is formed, as an example:

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


How does crypto exchange secure private keys?

Exchanges typically have a split storage setup. They have a hot wallet and a cold wallet. The hot wallet holds private keys on an online server that can quickly send and receive Bitcoin for when people deposit and withdraw Bitcoin to the exchange. The hot wallet usually contains a small amount of Bitcoin, whatever the exchange operator things will be necessary in typical usage.

The majority of an exchange's coins will be held in a cold wallet. The cold wallet is a machine that is not connected to the Internet and holds the cold wallet private keys. Typically exchanges will send funds from the hot wallet to the cold wallet when the hot wallet has too many coins and send from the cold wallet to the hot wallet when the hot wallet does not have enough coins.

Note that the private keys may not actually be held on general purpose servers. The private keys may be contained in Hardware Security Modules which are connected to the servers. These HSMs are designed to store private keys and hold them securely. So while they are connected to online machines, the private keys are unlikely to be leaked even if the server is compromised.


Can you really trust a non-open-source desktop wallet?

No

Shouldn't everyone be using exclusively open-sourced wallets for this reason?

Yes, everyone should use open source wallets. And still use small amounts in hot wallets or wallets that are relatively new and experimenting with new features.
More details: What stops a wallet from stealing bitcoins?


Bitcoin successfully deducted on sender wallet but did not reach receiver wallet

It's not completely clear what the situation is, but from what I gather it seems that you're the sender and the recipient is not acknowledging a payment you have sent.

I assume that you have verified that the credited address 1Gouzjo9Jav1k4AmRoUJJMzidVfnMoSieS matches the one that you were supposed to pay to, and that the amount matches the invoiced amount.

The address 1Gouzjo9Jav1k4AmRoUJJMzidVfnMoSieS has received 0.02661900 BTC in transaction b36157a7ca9630a88d98125fca91de81f488ef7d9a60f9e57af055d4d91f7a50. This transaction has been written to the blockchain more than a day ago and is confirmed. Given that this is the correct address, the receiver did get paid, whatever they may be claiming. Secondly, the money already got spent again which means that they must be fully aware the money arrived.

Assuming that you have paid the right address, the issue is on the receiver's end:
Either they gave you the wrong address which you paid correctly and someone else received the money (unlikely), they do not understand that they already got paid or incorrectly accounted for your payment (unlikely, since you already tried following up with them), or they're lying to you.

You should follow up with them and firmly assert that the requested address in question has been paid (after you have verified that it was the correct address) and ask them to check that their systems are working correctly. Perhaps that will prompt them to "suddenly find your payment".

Do not under any circumstances send them any more money, if they don't acknowledge that your payment has succeeded and deliver their side of your agreement. Often scammers will make up nonsense excuses to get you to pay even more money. If they do not acknowledge your payment, you may need to decide to write-off that money or sue them.


Is there a solution to paying high fees when opening and closing lightning channels once we hit a fee only market?

'Under the hood' of a lightning network channel open/close, a user will be sending a bitcoin transaction. In order to send a bitcoin transaction, a fee is paid to miners.

One advantage of having a lightning channel is that you can amortize the cost of the miners fee across a potentially enormous number of payments. All else equal, having the ability to transact on the lightning network thus lowers a users expected fees/payment, small blocks or not.

Channel factories are a technology that could allow for immense cost saving for lightning users. So this is potentially a 'solution', in the context of your question.

  Paying several hundred dollars to open and close a lightning channel seems uneconomical. This is a common argument against lightning by big blockers

'Uneconimcal' doesn't seem like the right word to use here. If in the future a bitcoin transaction costs hundreds of dollars in fees, that would mean that the ability to send a bitcoin transaction is in high demand. By many measures, being in high demand is a mark of success, though 'big-blockers' will argue that by increasing the block size the network can increase the 'supply', thus lowering transaction fees.

To illustrate this point, consider the absurdity of this sentence:

"That restaurant has become very popular! Nobody goes there anymore"

So you may ask "Why don't we just increase the size of the restaurant then?"

Well, the issue is that by increasing the size of the restaurant, the restaurant will lose the properties that made it popular in the first place!

So lets return to Bitcoin, to explain why increasing the block size ('making the restaurant larger') is a naïve solution that damages the network's desirable properties, while only providing a rather meagre linear scaling relief:

Implementing larger blocks means that running a full node on the network will be more resource intensive (bandwidth, computational cycles, storage, etc), and so naturally we should expect less nodes will exist due to the increased costs. This is damaging to the core properties of bitcoin (eg censorship resistance), which can only exist when the network is sufficiently decentralized. 'How decentralized is good enough?' is a question that is difficult (if not impossible) to answer, but this much is certain: increasing costs is a centralizing force, and the most conservative approach is to be 'better safe than sorry'. A blockchain network is a very expensive and inefficient way to implement a database, but the core properties mentioned above make these expenses 'worth it', at least according to the market.

In any case, there has never been a time where the average Bitcoin transaction fee is 'hundreds of dollars'... in fact transaction fees have been quite low for the majority of the history of the network. This isn't to say that fees can't or won't increase in the future, but making changes that sacrifice the most important properties of Bitcoin seems like an extremely misguided approach to scaling the network.


It doesn't look like he ever released any code.  I think StorJ was more a concept than anything else.  The whole autonomous self-replication thing is probably a long ways off, but it's a neat idea.


RAM usage increases until it is slightly less than the total RAM available. This is due to the design of the operating system which intentionally keeps as little RAM free as possible, using all excess RAM as a disk cache to reduce I/O.


What is the maximum number of signature check operations a transaction script can request?

The error for nonstandard transaction is simply because they are not yet supported by mainline client.  Remember as writing Bitcoin is only version 0.4 so significat portions of the protocol have not been implemented yet.

You will notice the error being thrown is "non standard transaction" which is indicating the client doesn't have support for creating or validating non-standard transactions.

Standard transactions are those with scriptPubKey of:

 OP_CHECKSIG  - transfer to IP Address OP_DUP OP_HASH160
 OP_EQUALVERIFY OP_CHECKSIG - transfer to Bitcoin Address
(hash of public key)

The only other transaction type supported is generation transaction which doesn't have a scriptPubKey to identify it.  It is easily identified because every valid block must always have one and only one coinbase transaction.

Contracts are non-standard transactions and not supported by the client yet.  The code snippet is simply to prevent client from attempting to process, broacast or validate non-standard transactions.


Could a futures market be included in the Bitcoin protocol?

Silk road's hedged escrow is a first step in this direction, and seems to work.  But all the "trades" are bilateral (SR is always one of the parties) and you can't "buy" the "contract" unless its to hedge a sale made through the SR website.


BlockChain.info Investments? Sounds like a scam

It seems obvious to me that this is a scam. No legitimate investment in the world can guarantee a rate of return of 20 percent per day. At that rate, with a 5 btc initial investment, you'd own all the bitcoins in existence after 81 days.  And after 15 months, you'd have this much.

But you may want to contact blockchain.info directly; there is a contact link at the bottom of their home page. They can confirm that this is a scam, and also announce it on their blog / Twitter feed to hopefully keep anyone from falling for it.


Is there any desktop notifier application for bitcoin prices?

If you're looking for a solution which will run on linux, then there's always a the wget command:

wget -q -O - https://mtgox.com/code/ticker.php

You can run it in a loop in a terminal :)

Under the xfce desktop environment you could use the genmon panel plugin and feed it Mt. Gox's last trade data. Speaking of which, I think I'll do that myself. :)


Storing wallet key for automatic transactions

It depends on the type of wallet you are using in the server.
you can write your own node to publish transactions (very hard)
you can use 3rd party services like blockchain info (easy)
you can use a wallet that has an api (like bitcoin-core has json rpc)
then you write a program that call this wallet to generate tx
it uses the build in security of the wallet


How to choose address in BlockChain Android Application?

i think you are missing something :)

Go to the address book and, by long tapping, choose "set as default address".
That address will be the one that generate the qr code.


Is there any address monitoring application with support for multiple cryptocurrencies?

The best option for monitoring your accounts without logging into your wallets is to use block explorers. Blockchain data is public and block explorers are made to explore this public data: blocks, transactions, accounts, account balances.
Here are a few:

Bitcoin, Litecoin, Dogecoin:
https://live.blockcypher.com/

Ether, ERC20 tokens:
https://etherscan.io/

WAVES, Waves assets:
https://wavesexplorer.com/

ZCash:
https://explorer.zcha.in/

Most of these block explorers also have API solutions.
I have created a playlist showing how to use the zChain ZCash block explorer API here: Zchain ZCash block explorer API - INTRO


To create a channel on the Lightning Network, do you have to execute an actual transaction?

Yes, a channel opening involves creating and signing 3 transactions, and broadcasting just one.

The transaction to be broadcast funds the channel, and spends to a multisig output. It is signed by whomever chooses to fund the channel. When this funding tx receives sufficient confirmation, the channel is considered open.

This multisig output is spent by two commitment transactions signed by both payment channel peers, but not broadcast. Each peer stores its own commitment transaction and only broadcasts it if it decides to unilaterally close the channel.


Why is the length of the transport messages on the lightning network encrypted?

TCP and other stream based protocols do not have a 1-to-1 correlation of application level messages and IP packets. If you call send() 3 times, it might result in sending a single IP packet over the wire (eg, due to Nagle's algorithm which is enabled by default), it might get sent individually as 3 packets, as you would expect from a packet oriented protocol like UDP, or the messages might end up being split into several packets each because the IP layer has an MTU.

It is generally out of your control at the application layer. You therefore, cannot rely on reading the length from the IP header to tell you about the length of messages. You need to encode the lengths into the data stream and reconstruct the data coming in from the stream into the individual messages as understood by your protocol.

The reason to encode the length separately in the BOLT#8 specification is that each message must be decrypted as a single operation, because each decryption must increase the counter used in the ChaChaPoly cipher. You need to know the exact length of the message before calling the decrypt function on the encrypted payload.

In the BOLT#8 protocol, you send the exact lengths of the encrypted message+MAC, with no padding added. The receiver should first explicitly call recv(buffer, 18, ...), decrypt the result to get msg_len, then call recv(buffer, msg_len, ...) to retrieve the encrypted message, which can then be decrypted in full. recv may also return fewer bytes than requested, so in both cases, the result of recv must be checked and if less than the expected length is read, recv should be called again with the remaining expected length.


How to broadcast transaction through Bitcoin-cli on public node

The 'wallet import format' (WIF) is a standardized way of encoding a private key so that other wallets can recognize it. You could use it to import the private key to your node's wallet, and then sign and send the transaction from there, but I think thats different than what you want to do: keep the private keys on the mobile, but broadcast signed transactions from your node.

The bitcoin-cli command you'll want is sendrawtransaction, but in order to make this work you'll need to get a signed raw transaction hex to use as input. So you'll need a mobile wallet that can provide you with the signed raw transaction, and do so without broadcasting it to the network.

Use bitcoin-cli help sendrawtransaction for more detail on the command.

As another option, you could use a mobile wallet which allows you to manually connect to the desired node. This would accomplish a similar result.


Merkle tree structure for 9 transactions

That's not exactly right. It's more like this:

                            ROOT
                            /  \
                         /        \
                      /              \
                   /                    \
               z1                            z2
             /  \                           / \
           /      \                       /     \
        /            \                /            \
      y1              y2             y3             y3
     /  \            /  \           / \
   /      \        /      \       /     \
  x1      x2      x3      x4     x5    x5
 / \     / \     / \     / \     / \
a   b   c   d   e   f   g   h   i   i

At each level of the tree, if it's odd, then you just copy the last element onto the back of the tree, and then you hash the pairs to produce a new list at about half the size. Then you do the same thing with that list, in a recursive algorithm, repeating until you have just one element left (Note that if you only have 1 transaction in the block, the merkle root is just the TXID of that transaction). The result is not always a binary tree, it just happens to be when the number of transactions is a power of 2.

It's also interesting to note that the fact that i is hashed with itself introduces a vulnerability (CVE-2012-2459). Basically, I could publish a block that actually listed the transaction with i as the TXID twice at the end of the block. Obviously that block would be invalid, as it has the same transaction twice in the block. But the merkle root would be the same as a block that had a valid list of transactions, with i listed only once. But since you think you have already seen the block with with that header and merkle root, you would deny it. This is fixed by marking all blocks that have duplicate values in the merkle tree structure as having invalid merkle roots.


How do I get my Bitcoin Cash from my Blockchain.info wallet?

Bitcoin cash is a cryptocurrency like bitcoin, but it exists on its own separate network. So moving the bch coins will not affect your btc balance, but there are some safety considerations. If Blockchain.info has an option to 'withdraw bch' now, then you can easily send your bch to an exchange like Shapeshift, and change them into btc.

If there is not an easy 'withdraw' option, then you will need to:

move your btc to a new wallet first
get your recovery seed phrase from the blockchain.info wallet
install some bch wallet software, and input your seed phrase into it
this will generate the bch wallet that holds your funds, you can now send them to an exchange, or whatever

If you search, there are some comprehensive guides available with more info on splitting your bch.


Is it possible to assign a single "from" and a single "to" address to Bitcoin transactions?

No, Bitcoin transactions cannot be cleanly projected on a single "from address" or a single "to address". Bitcoin can facilitate many payments in a single transaction and there may be multiple senders and usually are multiple receivers.
Even in a simple transaction where one user pays another user, the sender may use multiple inputs, and almost always will assign a change output to themselves. Thus, there is one sender (or more) and two receivers.
Nothing stops multiple users to create a transaction together. E.g. in a PayJoin transaction, the receiver contributes an input to a transaction that pays themselves, thus making it two senders, and one or two receivers (depending on whether there is change).
Two users may also join to make separate payments in one transaction. In a so-called CoinJoin transaction, they each are contributing their own inputs and assigning some funds to receivers and sending change back to themselves. So you might for example have two senders and four receivers.
The challenge gets a whole new dimension when you think about how custodial services work. When you e.g. send funds from an online wallet service or brokerage, the service will often batch dozens of payments/withdrawals together and pay them all from their omnibus wallet. The initiators of the payments and withdrawals do not control any of the addresses that fund the transaction, but are "senders" in the sense that they mandated the payments. The custodian is the actual sender, but may not know who any of the receivers are and is only executing payments on behalf of customers. E.g. sending to any of the "from" addresses of the transaction would likely credit some random user of the service which is neither the service or any of the senders.
There is no such thing as a "from" address in a bitcoin transaction, and you can usually not distinguish whether an output goes back to the sender or to a receiver.
I would suggest that you assume a general case of multiple senders and multiple receivers for each transaction in your model, and track account-based cryptocurrencies as the special case of a single sender and single receiver. Note that even for account-based currencies, a lot of smart contracts also allow sending to multiple recipients in one transaction.


Database error when installing Coinbase's Toshi with Docker

I think i had the same problem when running locally.
Forgot to do the initial DB migration.

bundle exec rake db:migrate

after this, it worked for me


I think that Tim S. may have the answer with his comment about endian-ness.

Your observations about the nonce having its lowest byte zero (being a multiple of 256), are with respect to the little-endian byte order of the block itself.  From the perspective of a big-endian machine, these are statements about the high byte of the nonce.

So consider a miner which is big-endian.  The natural algorithm is "start with nonce=0, compute scrypt, increment nonce, repeat", so your "even" nonces will be tried first.  However, when a new transaction (or a new block from another miner) arrives, a new block header has to be constructed, and it would be natural to restart the nonce at zero when this happens.  In order to get a nonce that is "not a multiple of 256", it has to complete 2^24 hashes before being restarted.

Of course, x86 is the most common desktop CPU, and it is little-endian, but most scrypt mining is done on GPUs.  I hypothesize that a majority of these GPUs are big-endian, or at least that some common mining software causes them to increment their nonce in a big-endian manner.  Does anyone know if this is the case?

From this chart, it looks like modern GPUs can run scrypt at roughly 1 Mhash/sec.  So 2^24 hashes would take 16 seconds.  Litecoin is currently averaging roughly 10K transactions per day, which is an average of one every 8 seconds or so.  So it would not be surprising that a miner would  usually not get into their high byte (which for you is the low byte) before restarting.

This hypothesis would also explain why we do not see such a pattern with Bitcoin.  Current SHA-256 ASIC miners run at many Ghash/sec, and so are very likely to go through all 2^32 possible nonces before being restarted by new transaction data.  (We might see patterns in the extraNonce, though.)


Two different blocks were mined at height 494676, i.e. two different blocks both naming the same previous block as their parent.  One of them has a hash starting 262f and the other is 6d0d.  Both of them included the 9c7b transaction.  This happens normally from time to time; for instance, it could be that 262f was mined first, but it wasn't relayed to the other miner fast enough, so they kept trying blocks with the previous parent and ended up mining 6d0d.  Or it could be that they were coincidentally mined very close to the same time.  The timestamp on 6d0d is 56 seconds later, but timestamps are not guaranteed to be accurate.

Only one of the two can be included into "the" eventual blockchain, so following this, miners creating new blocks had to make a decision as to which of the two to name as parent.  262f won, so 6d0d is now orphaned and is not part of the main blockchain; Bitcoin nodes won't consider it part of the authentic transaction ledger, and the miner who created it can't spend the block reward.


How can I import a private key into the Bitcoin client?

Importing could be done with Pywallet or hopefully soon-to-be-official wallet export/import bitcoin patch, but make sure to backup your wallet first.


Are bitcoin wallets money service businesses (MSB)?

If the business is based in the US, yes.

Edit: IANAL, but in my opinion a wallet service clearly falls into the category of money transmitter according to FinCEN's virtual currency regulations.


Does rootstock need segregated witness to work?

No, Rootstock does not need segregated witness.
Yes, Rootstock does need another Bitcoin improvement not currently available on mainnet.

Details below:

Rootstock & segregated witness

Segregated witness (segwit) eliminates all known third-party transaction malleability, which is an extremely useful feature but something that's only required in cases where a transaction has to be created before all of its parent transactions have confirmed.

For example, in a Spillman-style payment channel, the refund transaction is created and signed before the deposit transaction is broadcast---which is dangerous because if the deposit transaction is mutated (malleated), the refund transaction becomes invalid.

However, for a two-way pegged merged-mined sidechain like Rootstock is planning to use, the design makes the peg transactions robust against double spending (by waiting for many confirmations) in a way that also makes them robust against malleability.

Segwit also increases the maximum possible transaction size, which can make it more a bit more affordable to use sidechains, but not in any significant way and it isn't a requirement.

Rootstock & other Bitcoin improvements

Rootstock wants to use a two-way-peg merge-mined sidechain (also called a decentralized sidechain).  There is no current know way to do this with just the opcodes currently enabled on Bitcoin mainnet, so this is not possible today.

Broadly speaking, there are a few different proposed approaches to enable this:

Extend Script's flexibility: add one or more generic opcodes to the Bitcoin Script language to allow it to validate what are called SPV proofs or merkle proofs---the kind of data that SPV clients use today to determine if a transaction is part of a chain of block headers.
Add a special SPV proof opcode: give Bitcoin Script the ability to directly validate SPV proofs.  This would make the sidechain contracts simpler and cheaper, but to some engineers it feels a bit weird to add opcodes specialized for one purpose.
Add a special reverse peg opcode (drivechain): give Bitcoin Script a special opcode that says, "I trust miners".  Anyone who pays this opcode allows miners to spend those funds however they would like; then arrangements could be made with miners to only spend that money if they followed the sidechains rules.

At least one of the approaches above would need to be enabled for Rootstock to follow their plan; Rootstock's current preference is for #3, drivechains.

It's worth noting that if Rootstock wanted to use federated-pegged (fedpeg) sidechains, such as those implemented in the Elements Project, then no changes would be required to Bitcoin today.  However, fedpeg sidechains rely on trusted signers for every block and so are not decentralized.


Will old accepted blocks ever be removed?

Reaching consensus on which old blocks should be removed is very complicated. Bitcoin, being decentralized, requires you to check for yourself and add-up all the transactions from the very beginning.

If you keep a partial version of the blockchain, how do you verify that it is consistent with the entire blockchain? If you keep a partial blockchain someone could easily broadcast to you a blockchain with incorrect values, and there would be no way for you to understand whether those transactions are valid without checking the entire blockchain for yourself.

Fortunately however, the size of the blockchain isn't really an issue if you use a  Simplified Payment Verification (SPV) client such as MultiBit, as it's able to verify the integrity of the blockchain with just the block headers. This reduces drastically the size of the blockchain.

To answer your question, for bitcoin to work, old accepted blocks cannot be removed.


Why a flip a bin before hashing in this script?

Hashes are big endian by standard, and most computers use little endian, so it's probably just for convenience. See Why does the Bitcoin protocol use the little-endian notation?


How big is the input of a P2PKH transaction?

The first number does not include the prevout, sequence number, or the length byte for the scriptSig. It also uses 65 bytes for the public key (which is correct if it is uncompressed, but compressed keys of 33 bytes are more common now). Correcting it gives 139 + 36 + 4 + 1 + (33 or 65) = 148 or 180.

The developer in the third case forgot to include the sequence number, making the result 147 or 148 for compressed public keys and 179 or 180 for uncompressed public keys.

The guys at Princeton clearly know best.

So to summarize:

PREVOUT: hash (32 bytes)
         index (4 bytes)
SCRIPTSIG: length (1 byte)
           CONTENTS: push opcode (1 byte)
                     signature (71 or 72 bytes)
                     push opcode (1 byte)
                     pubkey (33 bytes for compressed, 65 for uncompressed)
sequence (4 bytes)


What do `minerd`s feedback messages (LONGPOLL, yay, boo) mean?

If I recall it correctly, the "boo"s mean: your answer's correct but somebody else had solved the problem before, so you wasted your electricity and time - sorry. And the "yay"s are: you did it first, congrats.

As for "LongPoll", it's a protocol that enables a miner to keep in touch with its pool's servers so that it's communicated as soon as possible when someone (within the pool or outside of it) discovers a solution for the current block - the miner can then stop working on that block immediately. All work up to that moment has been wasted, of course, but the waste's minimized this way - otherwise, your machine would just keep going, produce a result and deliver it... only to be informed then that it was way too late. Today, most pools support it - so you should see a lot of "longpoll" messages but relatively few (if any) "boo" :-)

Finally, as to the percentage: it tracks the number of solutions your machine has dispatched to your miner pool's servers, comparing the number of accepted ones versus the ones that got rejected. In an ideal world LongPoll would ensure your machine gets notified immediately upon someone else's discovery of a block's solution, and your machine would stop working on that block right away - so the percentage would always be 100%. In real world, lots of bad stuff can prevent this from happening.

What can you do to improve that percentage? Find out why you're having rejections! You might not be receiving the longpoll notifications, either due to your Internet connection being slow or the pool being under a DDoS attack - so change your Internet provider or go to another, smaller pool. You may have set up your ASIC or graphic cards to a too-aggressive configuration, try changing the settings of your miner. And some other things I can't remember right now - there are questions and answers about that on this site.


Clarification of lightning network example (putting funds into lightning)

So in the first step you make a regular transaction from your address A to our common 2-2 address C, and I make a regular transaction from my address B to our common 2-2 address C?

Yes, although in the current lightning spec and implementation, only one party funds the channel. However it could certainly be both parties that fund it.

I have one key of this 2-2 multisig address C and you have another?

Yes.

Address C now has 1BTC.
Now from this address C I return 0.5 of its 1 BTC to your address A and sign with my key, and you return remaining 0.5 to my address B and sign with your key?

Two transactions are formed at this point:

one that you make and sign and send to me that gives 0.5 BTC to you and 0.5 BTC to me,

one that I make and sign and send to you that also gives 0.5 BTC to you and 0.5 BTC to me.


g++ problem compiling litecoind on Ubuntu Server i386

The file ~/litecoin/doc/build-unix.txt contains build instructions.  The one you're missing is on line 61:

sudo apt-get install libboost-all-dev


how can I recover my private key from my passphrase and password

I am trying to find how I can recover my private key from my passphrase and password

In general you cannot recover a private key from a wallet password or wallet passphrase.

If what you are calling a "passphrase" is really a "recovery phrase" or "seed phrase", then you can recover private keys from that. A recovery phrase typically consists of twelve or twenty-four words, usually generated for you by the wallet before use, usually from a specific word-list.

AFAIK current Bitcoin Core does not support recovery phrases.

If the wallet is still working, make a backup (File -> Backup Wallet) or extract the wallet.dat file and recreate the wallet on a machine with more capacity -- or -- extract the private keys and import or sweep them into a wallet that supports SPV. Don't delete anything from your 250GB Mac until you have the new wallet working.


Bitcoin exchange where you can set your own wallet instead of using one provided by the exchange

You forget something. Who pays it then?

  I basically want to avoid the extra cost of transferring...

That means that the people of the exchange have to transfer it for you and that means that they have to pay the fees because it's a default blockchain transaction and the miners want to be paid. And the exchange's owner does generally not want to donate you 20-30$ (average fees at the moment)

I don't think that there is such a platform you are talking about. Exchanges don't work this way


How to get unspents for a specified bitcoin address?

listunspent only displays information about addresses which are currently part of your wallet. Bitcoin Core does not maintain indexes of unspent outputs for addresses you do not own, and will simply return a blank set if you attempt to query for them.


Why do some blocks not have Miner's name/identity?

Blockchain.info has an interesting pie-chart showing the origin of blocks.  On that page, they specifically note:

  A large portion of Unknown blocks does not mean an attack on the network, it simply means we have been unable to determine the origin.

Blocks do not need to contain any identifying factors.  The miner can choose to provide a script in the coinbase of a new block that can be used to identify the source of the block, however they are not required to do so.  Another method that can be used to identify the source of a new block would be the target address for outputs of the new coins included in the block; if the address is well-known, then you can be almost certain the owner of that address mined the block in question.

"Anonymous" blocks are simply that, anonymous, in that they have no identifying characteristics.

This question and the answers have some interesting details as a side-effect of trying to identify who mined a specific block.


Essentially no software supports the getwork call anymore due to the speed of modern miners (they would call it 25,000+ times a second). You’ll need to use a very old version of Bitcoin Core from before this was removed if you’d like your software to work, but the FPGA miner is inefficient enough to never make this worth the time investment. The specific error you’re seeing from the miner is due to endpoint being removed from bitminter, and it not knowing how to handle the non response.


transferring funds from bittrex to binance

I'm answering this question under the assumption that you are asking how to tell whether an address is a segwit address.
Judging from some Reddit threads I've found, Bittrex does not support withdrawing to native segwit addresses. Native segwit addresses start with the prefix bc1…. If the deposit address you got from Binance starts either with 1… or with 3… and Bittrex accepts it in their withdrawal request form, you should be fine. If it does start with bc1… look whether there is some option on Binance to switch the address format for the deposit address.


Which exchange rate should I use for calculating Bitcoin exchange rates?

Most people are interested in the last value or the 24 hour average, it depends on the purpose of the application and the intent of the developer.


Multisig addresses with keys from different wallets

Addmultisigaddress 2 [{"address/pubkey of Bitcoincore address", "pubkey of other wallet key"}] should return the P2SH address (3MWpeBDwJdk8F7fecZBZ6FHjDJVnGxpnRA) and also add 3MWpeBDwJdk8F7fecZBZ6FHjDJVnGxpnRA to the UTXOs
importaddress 3MWpeBDwJdk8F7fecZBZ6FHjDJVnGxpnRA will add the P2SH address to the wallet as WatchOnly

I'm assuming you're not running a full node, using the txindex=1 flag, so the addmultisigaddress command is what you're going to need to redeem 3MWpeBDwJdk8F7fecZBZ6FHjDJVnGxpnRA in Bitcoincore. FYI, createmultisig has the same parameters as addmultisigaddress (RPC reference) but it's returning the redeem script only; ie it is not adding the P2SH address to the UTXOs.

As mentioned already, for all multisig commands you'll need the full pubkey (hex version, starting with 0x04 or 0x02/03 for compressed). The only reason you can substitute the Base58Check address into Bitcoincore as a public key is because the software retrieves the pubkey from the wallet and substitutes it accordingly.

An alternative way to go about it is by using dumpprivkey/validateaddress to get the Bitcoincore keys required and then import the private key into the other wallet software and sign/redeem with that.

EDIT: I've tested out importing non-wallet.dat pubkeys for a multisig P2SH address and have successfully added the Tx to the UTXOs returned by listunspent, with the only difference being that the JSON return data will have spendable: false. I did it as follows:

addmultisigaddress 2 '["pubkey1", "pubkey2"]'
Take the returned P2SH address ...
importaddress 3MWpeBDwJdk8F7fecZBZ6FHjDJVnGxpnRA "TESTING" true
Wait for scan to complete
Funded 3MWpeBDwJdk8F7fecZBZ6FHjDJVnGxpnRA with createrawtransaction/signrawtransaction/sendrawtransaction (but I'm sure you can do it using the GUI
listunspent 0 will return JSON array (including 0 confirms) with an object showing redeemScript but with spendable: false
You'll need to redeem the Tx using createrawtransaction with the privatekeys passed as parameters to spend this, obviously


How to calculate bitcoin days destroyed percentage

The graph is a histogram showing the percentage of total Days Destroyed from the measured period for each block. Thus it is a distribution of dormancy over the period, since block numbers are ascending forward in time.

To arrive at the percentage in your example, you need to divide the Days Destroyed for that example block by the total of the Days Destroyed for the period being graphed.


After Segwit Activation, what is the largest block size possible?

The maximum block size is 4,000,000 bytes (4 MB). This is because the block weight calculation is base size (in MB) * 3 + total size (in MB) = block weight (see BIP 141). Since the only units are MB, the block weight's only units are also MB, thus the maximum block size is the same as the block weight.

The best possible size to weight ratio I can think of is a transaction which also spends a P2WSH output that has a ridiculous redeemscript. And then there's also the coinbase transaction and block header. The witness would be 4000000 - 240 * 3 - 240 = 3999040. So there is 3999040 bytes in the witness. The total block size is then 3999040 + 240 = 3999280 bytes.


I'm sorry to say this is a common scam, I'll give some more info below:

  A bitcoin trader opened a blockchain wallet for me and then sent me my profit but it is non-spendable.

That is called a 'watch-only' address in your wallet, meaning you can only watch it, but not spend the coins held by it. The Bitcoin blockchain is an open database, so anybody can watch any address they want to.

  I know they can no longer get into my account because I changed the password and I have two-step verification.

From this, it sounds like the scammer had access to your account in the past. If this is true, then your account is 100% compromised, there is no way to make it secure again. Make a new wallet, move all funds to it, and do no ever use that account again.

The reason you MUST abandon that wallet is that while logged in, the scammer likely copied down your wallet's mnemonic seed phrase (a series of 12 or 24 words). With that seed phrase, they can recreate your wallet on a different device, or using different software. The seed phrase is the current industry standard for making a wallet backup, it is used to derive your bitcoin private keys and addresses. The password/2FA are just used to unlock your 'blockchain.info' account (which has used that seed phrase to create your wallet), so if you put the same seed phrase into a different device, it will recreate your wallet, without needing a password (since blockchain.info isn't involved at all).

For this reason, it doesn't matter if you change the password, or the 2FA. Once the scammer has your seed phrase, any funds sent to that wallet will also be under their control.

  I don't have the private key. How can I get the private key?

You cannot. The only way, would be to find the person who does own that private key, and ask them for it (but they probably won't give it to you). The scammer is likely trying to 'sell you the private key', or 'unlock it', or some other nonsense. That is the scam, so please beware and do not send any more BTC to them.

In the future, do NOT EVER give your wallet details, login, passphrase, seed phrase, 2FA, private keys, etc, to anyone that you do not trust 100%. If you ignore this warning, you are much more likely to have your bitcoins stolen.


how to earn a transaction fee for transactions originating from my client

By definition, "transaction fee" is the difference between sum of inputs and sum of outputs. It always goes to the miner.

What you need is to add an output payable to your account.


How long does it take for a transaction to be included in a block?

Time between mining the blocks is around 10 minutes. Bitcoin protocol adjusts itself to keep that 10 minutes target.

But the transaction is not necessarily included in the next block. It depends on the number of transactions and fee you provide to incentivize the inclusion of your transaction. If the fee is too low transaction will never be mined (put in the block and added on blockchain). If the fee is reasonably high it will be included in the next block (so less than 10 minutes time).

The party receiving the money should not consider transaction valid up until it is "buried" under a number of other blocks (let's say 6 - so another 60 minutes after your transaction is added on the blockchain).


A non-malicious reason to deliberately destroy notable amounts of Bitcoins would be for a hypothetical alternative blockchain that recognizes Bitcoins sent to a special address as newly generated coins. One could for example try to establish a new "Altcoin" which is incompatible to Bitcoin, but every private key that signs a Bitcoin transaction to a special impossible Bitcoin address is eligible to also spend an according amount of Altcoins. This would enable a secure one-way conversion to a separate blockchain without the need for exchanges.


Is there a block chain bootstrap for Litecoin?

The site below has good information, including guides for different operating systems:

litecoin.info/Bootstrap.dat


How does an anonymous cryptocurrency encode coin values

Suppose Alice has an output with 1 unit of value we'll call AO1 (Alice output 1). And suppose Bob has an output with 2 units of value we'll call BO1 (Bob output 1).

Alice sends AO1 to Charlie, forming CI1 (Charlie input 1), with one unit of value. Bob sends BO1 to Charlie, forming CO2, with two units of value.

Charlie now pulls CI1 (an input of Charlie's that claims CO1) and CI2 (an input of Charlie's that claims CO2) into a single output, CO3, with three unites of value.

Charlie now sends CI3 (an input that claims CO3) to Dave, forming DO1.

If this system provides privacy, nobody can map CI1 to CO1, nor can they map CI2 to CO2, nor can they tell that CO3 belongs to the same person that CI1 and CI2 belong to.

So while everyone can see that CI1+CI2=CO3, this really doesn't do them any good. Even if they can tell that CI1 has 1 unit, CI2 has 2 units, and CO3 has 3 units, this does them no good. They can't map CO3 to CI3, so they can't tell how much was sent to Dave. They can't map AO1 to AI2, so they can't tell how much Alice sent to Bob. And so on.

Once you can't tell which output an input claims, the rest is pretty easy.


blockchain.info's pushtx feature will reject transactions with OP_RETURN in it.

You might want to try my tool https://github.com/kaykurokawa/pushtx


Does the percentage of fluctuation remain the same regardless of the value in all wallets?

if your bitcoin equivalent value of 10$ became 11.72$, then 100$ will be 10 times the value - at 117.20 (not 101.72 - I assume this was just a typo).


C#, How can I actively query the crypto-market?

If you're looking for more than just price data, Coinigy is another option. https://www.coinigy.com/

I found their API easy to implement and very reliable and they covered all the exchanges I was interested in.


No, you can't prevent people from paying any particular address even if you control that address.  This is a known problem: it would be very nice to have an address that can only be paid once.

Something like P2SH^2 could help with this, although it would not provide a perfect one-time-only property.


How can I find out if a transaction used a specific vout as its input?

You need a way of querying the unspent pool in order to do this. A workaround is to lookup the transaction that is being referenced via some public api, blockchain etc, and check the referenced output as they usually mark them as spent/unspent. You can do this programatically by querying for all unspents for the addresses referenced by the output in question and filtering it for the one you want.


Who can see my IP address while using Electrum

Your IP is exposed to the Electrum server(s) you communicate with. Since anyone can run an Electrum server, you should consider this to be public exposure. These servers could record your IP if they wish to, and use it for any purpose. This is more exposed than running an ordinary full client: in that case, your IP is exposed to your peers, but even your immediate peers don't know it was you who created a given transaction. In either case, someone could record the IP they first saw the transaction from, which would often be geographically near you (maybe even your IP).

This does not make it unsafe in the "people can digitally steal my coins" sense, but it does reduce anonymity. This might make it unsafe in the senses of: "people can more easily find me and beat me until I tell them my password so they can steal my coins" or "people can arrest me for my actions" (if you're doing something illegal).

If you're concerned about that, you could run through Tor to hide your IP.


Why are blocks serialized? and Is there any alternative way?

Everything that is sent to the network is serialized. This includes blocks and transactions. Serialization is explicitly mentioned in the developer guide so that it is explicitly clear about what is sent and in what format.


Will cryptocurrencies that have a finite supply (like 21m btc) cause deflation?

Yes, cryptocurrencies that have finite supply are bound to create deflation. This is because the same finite supply of coins will represent an increased economic output that results from technological innovations. Thus the value of a coin is worth more tomorrow than today thereby increasing its purchasing power. However, if this deflation is bad is highly debated in the economic circles and there seems to be no concrete consensus on it.

The critic about deflation being linked to deflationary spiral stems from the great depression of 1929. The deflation in the economy post the great depression increased the real value of debt thereby compounding the problems of economic recovery. Moreover, because of deflation people hoarded money rather than spending it exacerbating the effects of recession. If you look at deflation from this lens then it could be deemed as hurtful as it prevents actions that could potentially stimulate the economy.

However, this can also be viewed from a different angle. We have seen the effects of deflation only in times when our economy was in trouble and there was a complete collapse of demand. Deflationary characteristics of Bitcoin is not based on collapse of demand, but a very predictable supply.

You will also see that a lot depends on the type of money used in the economy. Fiat money is based on debt: government issues bonds and the central banks buy these bonds by printing money. However, Bitcoin has properties that makes it resilient to credit expansionary forces thereby delinking it from public debt. Thus comparing the deflationary aspects of fiat money to the deflationary aspects of Bitcoin is like comparing apples to oranges.

Some people point out that deflationary nature of Bitcoin will lead to hoarding practices and hence lead to fall off in demand. I think it's a fallacy, since purchases related to houses, food, cars etc. will continue to happen. They help you make investments that could produce a higher return than the appreciation in the value of Bitcoin over the same period. For example, using a car helps you get to your office faster and be more productive, there by increasing your year-end bonus. I believe, only investments in assets that people currently invest to protect them from inflation (second home, gold, arts etc.) will reduce. Demand related to consumable/depreciable goods will continue to remain steady.

I'll sign off with a food for thought. The price of electronics gets cheaper every year, still you do not postpone the purchase of your electronic gadget in anticipation of price reduction as it helps you achieve other important goals whose return is higher than the price decrease over the same period. This can be extrapolated to the spending characteristics in hyperbitcoinized world.


New To Mining - How Much US$ Am I Making / Day?

First of all, are you trying to mine bitcoin?

And if you are then I am very sorry to tell you but trying to mine with 386.21 MH/s with the current bitcoin difficulty, means that you will mine close to no bitcoin. The power cost will be much higher than the mined bitcoin and thus will be unprofitable.

Currently, I am not aware of any person still trying to mine bitcoin with GPU's, I might be wrong, but the difficulty has gone up so much that it is not profitable anymore.

You can use this site to check your profitability, but as I said if you're trying to mine bitcoin I don't think you will find it profitable.


Why can't bech32 addresses be mixed case?

Having only one case (which is really no case) makes bech32 less prone to handwriting errors. It makes it easier for people to write down a bech32 address as they don't need to be concerned about which casing to use and to distinguish cases. It makes it easier to type in an address as it doesn't matter whether something was accidentally the wrong case.

In general, it is easier to deal with a character set that does not have mixed case characters.

The BIP specifies that mixed case shouldn't be used so that parsers don't mistakenly treat random strings as valid bech32 strings. While it wouldn't matter if a parser normalized the strings to a particular case, doing so would increase the probability that something that is not bech32 is interpreted as bech32. This has some money losing risk so precaution is necessary.


How can I transfer a Bitcoin-qt wallet to Electrum?

According to this FAQ:

In Electrum 2.0, you cannot import private keys in a wallet that has a seed. You should sweep them instead.
If you want to import private keys and not sweep them you need to create a special wallet that does not have a seed. For this, create a new wallet, select “restore”, and instead of typing your seed, type a list of private keys, or a list of addresses if you want to create a watching-only wallet.

You can get the private keys from Bitcoin Core using dumpprivkey as described in Using dumpprivkey to make a paper backup.


How did Coinbase monitor BTC transactions?

Your understanding of Bitcoin is correct.  What you may not know is that the "advisable security practice" of using a unique address for each transaction is not followed by many block chain gambling sites, such as SatoshiDice.  Because these sites reuse addresses, transactions sent to those addresses can be flagged or blocked.

Even if this were not the case, block chain gambling may be easy to detect by analyzing transactions.  For example, I believe SatoshiDice always sends back a tiny transaction for each bet it receives, which is an obvious marker.  There may be more subtle indicators too, like the ratio of spends to receives being near the ratio of the amount spent and received.  Also, Coinbase could have access to non-block-chain info like people's Coinbase addressbooks where they write "dice, 1:100 odds" or "weed dealer".


What value should nonce be when mining bitcoin ?

This is essentially like asking: "When buying a lottery ticket is it better to have a zero or a random number in my lottery number?"

The reality is that it actually doesn't matter because it's an entirely random process, just like winning the lottery.


How to determine if a BTC payment has been done

blockchain.info does work to monitor the blockchain. Here's a couple of other ideas...

If the wallet server is connected to the internet, have it monitor the address (perhaps using the -walletnotify option) and then create a message queue (e.g. amazon sqs). When a wallet transaction happens PUSH the relevant info into the message queue. The web server then monitors the message queue, POPs the message and takes appropriate steps.
You can also look into the Watch Only pull request for bitcoind. This pull request has not been incorporated into the main bitcoind, but you could compile it into your own modified version. You then would need to add the public address to the Watch Only wallet. This modified version of bitcoind could then reside on your web server without the fear of compromising private keys.

Cheers!


How do I withdraw USD from Mt. Gox through SEPA?

Mt. Gox has a BTC/EUR market so you can sell your bitcoins for EUR and withdraw them.

But you mention that you already have a USD balance at Mt. Gox.  The cost to convert them to EUR within Mt. Gox will vary based on the ask price on the BTC/USD market and the bid price on the BTC/EUR market.  It is possible you can buy BTCs with your USDs, then sell them on the BTC/EUR market and even after fees still end up paying less than any other conversion method (based on the forex EUR/USD exchange rate).

However, if you simply want to do an international withdrawal, you can withdraw USDs to your bank and your bank will charge you a conversion fee to change those funds into EUR.  Wire fees from Mt. Gox apply.

For smaller amounts (e.g., less than $1K USD or so), you will likely find it more affordable to buy bitcoins and sell them for EUR then withdraw as an inexpensive SEPA transfer.


How much more energy efficient is PoS (proof of stake) than PoW (proof of work)? Are there any figures on this?

When providing an equivalent amount of security, I don't believe PoS can be more efficient than PoW. I do understand how it may appear this way on the surface, but I think deeper consideration shows that this is a fallacy.

The security of Bitcoin (PoW) is dependant on the economic incentives built into mining: it is the cost of attacking the system vs. the expected return that matters, not the total amount of energy spent on mining. Of course, energy has a cost, but it is important to note that it is the cost, not the energy, that is important when considering the security of the network.

Therefore, we can define a system's security relative to the cost of attacking it successfully. Less cost to attack = less secure, and vice versa.

Mining is a permission-less activity, anyone is free to join, and so the result is expected to reach a free market equilibrium: the cost of mining $1 worth of Bitcoin is expected to trend towards $1. If there is profit to be made, we would expect more miners to join the market. If costs outweigh returns, we would expect miners to leave the market.

In PoS systems, we should expect a similar result: participants will be willing to incur costs of up to ~$1, for every $1 worth of rewards they receive in return. Anything that deviates from this will result in lowered security- you wouldn't want to pay someone $1 to provide only $0.50 worth of security!

In PoW, a very large portion of a miner's cost is the energy used to perform computational cycles. There are additional costs to consider (hardware, overhead, employees, maintenance, etc), but the most efficient miners will be expected to minimize these costs, and spend as large a portion of their budget on energy as possible (thus maximizing their expected return).

PoS seems to be more efficient, due to an apparently minimal number of computational cycles (compared to PoW), but when considering the above, we can arrive at a more nuanced understanding:

If a PoW network and a PoS network had the same amount of security (denominated in your favourite currency), we should expect each network's participants to spend the same amount of money to create and maintain this security.

With this in mind I think it is interesting to reflect back upon the question at hand: does energy efficiency really matter? Shouldn't we really just be striving to maximize the security provided per dollar spent? In terms of creating a more efficient network, that is what will ultimately matter.

In that regard, I believe PoW is more efficient, as a PoW miner's costs come from an external free market mechanism, instead of an internal staking system. There is a cost to security, and so having as much of that cost tied to something universally accessible (energy) as possible seems like the most logical decision. If it is more difficult to participate in the 'validation market' (ie, act as a miner/staker), then we will expect more opportunity for validators to make profit, and thus the security of the network will be lower. This sort of 'red tape friction' creates a less efficiently secured network, dollar for dollar.

As humanity has progressed, there has been an undeniable trend of an increased capture and utilization of energy, to power our advancements. And yet still, we utilize such an incredibly tiny fraction of the sun's output, that we are nowhere near being about to 'run out of energy'. The variable that is obviously limited is our capital, and so we should strive to use that as efficiently as possible, in order to maximize our capabilities as a technological species.


Does my wallet.dat file contain all wallets?

A wallet contains many addresses. An address is not the same thing as a wallet.
When you create a new address with Bitcoin Core, it is stored in the wallet that you are actively using at that time. This means it is stored in the wallet.dat file.


GUIMiner not detecting my GPU (AMD Radeon HD 7600M Series)?

The code name 'Turks' is the Fabrication process and transistors name. This means it is the GPU. There are also name such as: Cedar, Caicos, Juniper, Barts and Cayman. Don't ask me why that named them this.


where is my bitcoin money, when downloading is failed.

Your money is in the Blockchain (loosely speaking). It is not affected by the state of your wallet. When your wallet finishes collecting its own copy of the public Blockchain (synchronisation), it will be able to show you the amount of money you control.

Some explanation:

A wallet does two things. Firstly it creates a local copy of the Blockchain and keeps it up to date. Secondly it stores a secret number that gives control over some money in the Blockchain.

Everyone with a traditional  "full-node" wallet has their own copy of the Blockchain. This is just a list of all the transactions. A transaction records changes in control over amounts of money.

Bitcoins are not really sent to wallets and are not stored in wallets. As long as you have a safe copy of the secret number (private key) or a wallet recovery phrase, it doesn't matter what happens to the wallet. If needed you can create a new wallet and regain control over your money.


How does the client know the number of keys and coins when recovering from a seed?

There is a so-called gap limit. In Electrum, it's 20 by default but can be changed. But if you changed it up, remember that! Preferably write it next to your wallet's seed.

This means that the HD wallet determines the first 20 addresses and checks on a server whether any of them have every been involved in a transaction. Let's say these addresses are numbered. Number 7 is the one with the highest number to ever have been involved in a transaction. Then, 7+20 = 27 is computed and all addresses up until and including 27 are checked. It's found that 21, 23, and 25 have been involved in transactions. Then, 25+20 = 45 is computed and all addresses up until and including 45 are checked. It's found that none of the addresses from 28 to 45 ever had activity on them. Therefore, the search is stopped because there is a cap of at least 20 addresses. If address 46 had a transaction on it, that's not discovered until the user uses the wallet enough such that that address is searched for activity or the gap limit is increased.


They don't have any money sitting in your wallet waiting for your withdrawal. They're just scamming you. Stop sending them money immediately.


Implications of transfering to different blockchain addresses that belongs to same person with same wallet

If you use any HD wallet on your computer, no one besides you knows that these addresses belong to the same person or even belong to the same wallet. Spying on your computer and analysis on the blockchain being excluded, of course.

Therefore, these transactions go through just like you were sending money to someone else.

If you use an online service, the service provider knows that these addresses belong to the same account. What they do in such a case is any service's decision but most will probably treat it like any other transaction. blockchain.info seems to be no exception: https://bitcointalk.org/index.php?topic=95809.0

Everyone else will just see that money has been moved from one address to another.

This, of course, doesn't always apply. There are exchanges (like bitcoin.de) which allow transfer from the exchange to an address chosen by the user but which are not meant for normal payments. They don't store the funds in addresses specific to a user. When funds are moved away from the exchange, the requests from different users to do so are accumulated for some time (which is why it takes more time to move funds away from such an exchange than would be desirable for payments) and then processed in a single transaction. Such services likely won't transfer any money through the blockchain if you make a transfer from your account to your account's deposit address.


Yes. It hasn't been created automatically, at least for as long as I remember.
But not in the folder whose screesnhot you've uploaded.


When you create a new wallet (in any recent software) a new seed is generated, from which all the private key / address pairs are generated (there cannot be an address without its specific private key); usually Bitcoin clients don't let you remove addresses from wallet, but even if you manually delete one or all of them, if you backed up your seed, you can re-generate all addresses you have used (and in the same order), since all modern wallet are hierarchical deterministic.

Here a more detailed description of how the HD wallet work: learnmeabitcoin.com/technical/hd-wallets


Reusing same address on same/different recipient on security compromise?

I'll try answering this question in a way that allows you to re-use the technique on other privacy related questions. Generally any question about privacy boils down to WHAT information is divulged to WHO. Answering questions like this requires creating a model and taking each perspective into account. I'll take a simple model, we have three parties:

You (Bob)
Alice/John (receiver)
Passive observer of the blockchain (someone analysing the blockchain)

  Scenario A: I did my 2nd transaction with Alice (again) using the same ABC address.

Alice already knows the ABC address, so there is no information leak there.

The passive observer however sees a repetition of the address, it can link the two transactions to a single identity.
This is terrible if they know the real name of that single identity, but even if they don't, it could someday become useful information.

Another issue arises, especially empirically, since address re-use is slowly becoming a thing of the past. The few services that do re-use addresses are also putting the finances of the senders at risk (Alice).

Generally only one sender belongs to all transactions going to ONE address.

This is because most services generate an address for each customer, which they re-use.

  Scenario B: I did my 2nd transaction with John using the same ABC address.

This would confuse the passive observer, as it could wrongly categorize the transaction from John and the one from Alice to come from the same sender.

However, the privacy leak to John is a lot larger and real. John can see how much Bob (you) received in the past. Re-using the address has exposed your transaction history and linked this address to you identity.

There are also situations where parties collude and share information, but that brings this question to the next level.

Scenario A is in most cases, the least worse of the two. In scenario B you divulged the real identity behind the address to two people, in scenario A only to one person.


I'm trying to compile bitcoind on Windows but build_unix for db-4.8.30.NC is empty. What do I need to do?

The build_unix directory contains just the .IGNORE_ME file in the distribution.  The directory is populated by the make command.

../dist/configure --disable-replication --enable-mingw --enable-cxx
make

You do not need to edit db.h in the latest distribution since they have already corrected the typedef.


What is the status of smart contracts in bitcoin?

Are contracts described here already available for use?

Yes.

Some of them are admittedly kind of arbitrary. For example, you can trustlessly sell someone a solution to a Sudoku. What does that mean? If you don't really have a solution, there is no chance that you will receive the money. If the other person doesn't give you the money, it's very unlikely that they will get the solution to the Sudoku. It's very interesting, but I can't think of a practical use for it.

  How are Ethereum style contracts different from contracts described in the first source?

Well, first, Ethereum script is a superset of Bitcoin script, so anything you can implement in Bitcoin script can also be implemented in Ethereum script.

Let's think of an example problem: suppose that you want to multiply six by seven, and send Bob some money if the result is bigger than 40.

There are two different approaches here:

The oracle approach would be that the oracle has access to a wallet with Bitcoins in it. The oracle multiplies six by seven, sees that the result is bigger than 40, and sends Bob some money. Nobody else on the network needs to know what was computed. They only check that the oracle's signature is correct.

The Ethereum approach would be to make a smart contract that has some money in it. Then, everyone on the Ethereum network multiplies six by seven, and everyone sees that it's bigger than 40. The smart contract sends Bob some money.

The weakness of the oracle approach is that the oracle could lie or cheat. The oracle could change the six to a five, and not send Bob any money. Or, the oracle could send the money to Eve instead.

The weakness of the Ethereum approach is that everyone on the network checks that six times seven is bigger than 40.


What parallel, distributed computational techniques can be used for Bitcoin mining?

The atomic operation of Bitcoin mining is determining if a block candidate resolves to a hash that fulfils the required difficulty. This operation is so simple, that it is being performed about 700 quadrillion times per second.

Since mining is a random process, there is no progress towards a block. It just succeeds whenever a block candidate turns out to be a valid block. Therefore, beyond making sure that every participant in a mining pool is checking different block candidates, there is no collaboration on mining.


Do you know any download site for full blockchain header data (6) in CSV ASCII format?

For your purposes may be this dataset is sufficient: http://headers.electrum.org/blockchain_headers

It spans from block 0 to 477636 (2017-07-26 09:03 (just 9 months ago)) and contains just the block headers.

It is binary, but can be easily converted to a csv ASCII file with this Python script:

#!/usr/bin/env python
# convert binary file http://headers.electrum.org/blockchain_headers
# to CSV ASCII

import binascii

STRUCT_OF_BLOCK = [ 4, 32, 32, 4, 4, 4 ] # blockchain_headers does not contain always "0x00" txn_count
BLOCK_SIZE = sum(STRUCT_OF_BLOCK)

FILE_OUT= open('blockchain_headers.csv','w')

FILE_OUT.write( "version,prev_block,merkle_root,timestamp,bits,nonce,txn_count\n" )

with open('blockchain_headers','rb') as FILE:
    block = FILE.read(BLOCK_SIZE)
    while block != b'':
        position = 0
        for i in STRUCT_OF_BLOCK:
            FILE_OUT.write( bytearray(binascii.hexlify( block[position:(position+i)][::-1] )).decode('ascii') + ',')
            position += i
            if position >= BLOCK_SIZE:
                FILE_OUT.write("00\n") # blockchain_headers does not contain always "0x00" txn_count
        block = FILE.read(BLOCK_SIZE)


It is very important to write down your seed phrase with pen and paper (or some other permanent, real-world method of recording it), it is a BIG security risk to store it digitally. Do not ever take a photo of your seed phrase again!

Unfortunately, if you reset your phone and your photos were deleted , and that was the only copy of the seed (I'm assuming no cloud backup), then you may have lost your bitcoins. Your only hope is to somehow recover the deleted photo from your phone, but this may be very difficult/impossible to do.

Best of luck


How private key is generated from password in Bitcoin-clients

It's not standard across all clients. You mentioned wallet.dat, which I associate with the Bitcoin Core client; that does not use a password to generate private keys; it generates each set of private keys randomly when a new supply of them is needed for transactions.

Some other kinds of wallets, however, are known as HD, or hierarchical deterministic, wallets. When they are initialized they generate a random master key that they use as a basis for generating all of the wallet's subsequent private keys in a deterministic (non-random) way. And many HD wallets, the very first time they're used, display a sequence of natural language words known as a recovery seed. You write down the recovery seed word list on paper and keep it securely secret. If the wallet is lost or destroyed you can input the words into another one of the same type of wallet to re-generate your private keys and hence your coin balance. If you're interested in the technical details, look at the specifications for BIP32 (HD wallets) and BIP39 (recovery seeds).

An HD wallet which uses a recovery seed may allow the user to specify a passphrase, typically intended to be memorized rather than written down, which is used along with the recovery seed to (re-)generate the private keys. For the ones that I've encountered a passphrase is optional.


which private key to export from electrum?

here is very detailed tutorial on how to salvage your bitcoin gold coins from 2FA electrum wallet.


Transfer from Bitcoin Core to Electrum expired before full synchronization. Where are the bitcoins?

If you broadcasted the transaction, it will appear on the other end, eventually.

I suggest you to first go to https://blockchain.info/ and look-up your electrum address or the transaction ID. There, you should see if the transaction is still unconfirmed or has already been confirmed.
In both cases, you should see it in electrum. If you don't see it, try exiting electrum, deleting blockchain_headers file in %appdata%\Electrum, and running it again. This will force it to re-scan everything.


Bitcoin Segwit was released in the summer of 2017 to reduce the blocksize congestion. Why is it still congested?

SegWit cannot, and was never designed to "resolve network congestion". It:

fixes the third-party malleability issue that Bitcoin has had since its creation, vastly simplifying many multi-transaction smart contract constructions (like Lightning).
fixes the O(N2) signature hashing problem.
adds amount commitments to signature hashing, simplifying design of hardware signing modules ("hardware wallets")
adds script versioning, making it significantly easier to add new features later as a soft fork
introduces a scripthash mode with 128-bit security (P2SH only has 80-bit security against certain attacks)
introduces a discount factor 4 for signatures w.r.t. block size accounting, partially rectifying the issue that creating an output is far cheaper than spending one.

All of the points above are improvements to Bitcoin in the long term w.r.t. scalability and security. In addition, the last point also indirectly provides a modest capacity increase - allowing a bit more throughput for those who choose to use new-style transactions. This is justified by the fact that simultaneously some of the worst-case costs to the network are removed (the O(N2) sighashing), and technological improvements for block relay (see BIP152). It is by no means a blanket "let's double capacity" - more an improvement in the accuracy in counting the cost of transactions, which happens to make things cheaper for the most common ones.

Regarding network congestion, that's just a fact of life if the network is operating sanely. It's both necessary for the system's survival (as the miner subsidy diminishes, fees more and more directly define the incentive for miners to secure the network), and a logical result of any restriction in capacity - whether that is 1MB or 2MB or 100MB blocks. If capacity in blocks isn't being used, the price of block space will drop, and new use cases will develop. For example, if the available space isn't being used for extended periods of time, I expect the feerate to go so low that people will start to try to put their backups in those blocks - burdening the whole world. Essentially, what you call network congestion is just a sign of a functioning fee market: if you don't limit the price, the demand will become infinite.

Disclaimer: I designed a significant part of SegWit.


There is not quite the method you are looking for, but you can use the getblock call which takes the block hash (not height, you can get the hash of a specific height using getblockhash method). That will give you the block, and you would then need to write a script to iterate through the transactions in the block and find ones which have an OP_RETURN output.


When you create a Bitcoin transaction, your client will broadcast that information to peer nodes and generally within seconds every node that is connected will know of that transaction.

That's likely why the recipient wallet's balance rose.

That transaction though must be included in a mined block before the client you are using will allow those funds to be spent.  Though technically the client could let you spend the funds before the transaction gets even one confirmation, that introduces more confusion and problems so the client has this restriction for these "unconfirmed" transaction.

So, the question remaining is why hasn't the transaction confirmed?  Whether or not to include a transaction is at the discretion of Bitcoin miners (solo miners) and mining pools.  If your transaction did not include a fee that is paid to the miners then sometimes it gets ignored for a while.  This delay can range from an hour or two to more than a day.

Knowing the appropriate fee to pay will depend on how much data the transaction consumes.  If you are a miner getting tiny payouts from your pool, your fee to send payment will be more expensive than most because each of those tiny payouts consumes data.  Another egregious violator are the tiny payouts from the losing transactions on SatoshiDICE.   Most everyone else can get by paying the minimum 0.0005 fee in scenarios where a fee is required or no fee at all when none needs to be paid.

So, the reason you can't spend the funds is likely because either no fee was paid or the fee that was paid wasn't large enough.  In the future, if there is the need to spend the funds from a payment quickly, consider including a fee payment that will help ensure it is included in block in a timely manner.


Why is the disappearance of Mt Gox a problem?

To actually try and answer your question, Mt Gox acted as a trusted middleman in btc trading, and thus had to have control over their users money.

Let's say dude A has a few btc he wants to sell, and dude B has a few dollars he wants to buy btc for. B doesn't want to pay until A sends him the btc, and A doesn't want to send his btc to B until B pays. Unless they trust each other, they can not do business.

By putting money and btc in the hands of a supposedly trustworthy middleman (Mt Gox), A and B can do business. As soon as they agree on the price, the middleman, who has access to both the btc wallet of dude A and the dollar wallet of B, can make sure that both transfers are made, so that each person gets what they agreed on.

So essentially, users had dollar accounts and a btc accounts at Mt Gox, and it is from these that things seem to have gone missing.

As has been pointed out below, it may be that accounts still show the right balance, but Mt Gox doesn't have that money anymore.


How does the Coin Selection in Bitcoin Wallet for Android work?

It appears that Bitcoin Wallet for Android uses the DefaultCoinSelector from bitcoinj.

The DefaultCoinSelector sorts the available UTXO by diminishing age and value:

value [satoshi] * age [confirmations]

Should two UTXO compare as equal, larger value is preferred.

The CoinSelection then picks from the front until the target is reached.

Still trying to figure out whether I understood this correctly:
If the resulting change is large enough to pay for the fee and remain above dust level, the transaction goes ahead.
Else, change will be increased by 0.01 BTC. If it satisfies neither option, the change will be added to the fee.


What is the algorithm that adjusts the difficulty of the proof of works in a proof of work based cryptocurrency?

The difficulty is a function of block creation speed.
The goal is to, on average, create blocks every 10 mins.
It is recalculated every two weeks (link)
You can look up the calculation of difficulty in the open source code of Bitcoin
https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/pow.cpp#L49


How to find details about very first block mined for any crypto?

If you have an altcoin's node software and that software is based off of Bitcoin Core, then you can use the following RPC commands to get information about the genesis block:

getblockhash 0

This will get you the hash of the genesis block. Take that hash and do

getblock <hash>

This will give you all of the information about the genesis block.


How to set a specific fee in satoshis per transaction?

How to set the absolute fee
The transaction fee is implicitly defined by the difference between the sum of input and the sum of output amounts.
fee = Σ(inputs) - Σ(outputs)

Since you are building your transactions explicitly, you can set the exact transaction fee by defining the corresponding specific amounts of the outputs for the recipient(s) and the change output. As the weight of inputs and outputs is predictable, you can calculate the appropriate fees by knowing the count and type of inputs and outputs in advance.
Why it's a bad idea
While your wallet can determine the input count during the transaction building, your users will not know in advance how many inputs it will take to fund their transaction. Since transactions get processed in order of their feerate rather than their absolute fee, the user will not be able to make an informed decision for an absolute fee without knowing the weight of the transaction. Per my experience, users get absolute fees wrong more often than not (most users even get feerates wrong), which leads to substantial support traffic with complaints about overpaying or underpaying. This is why withdrawal interfaces usually give predetermined choices (e.g. express, normal, thrifty) or take a feerate rather than an absolute fee.
If you want the recipient to pay the fee, you may want to consider using subtractfeefromamount.


Between which locations are transfers using Bitcoins cheaper than PayPal for 100$?

In the euro zone MtGox is not cheaper for small payments like $100. Depositing and withdrawing euros both include a fee of ~1.20 euro (10 PLN) + 0.60% for the transfer.

I don't know what deposit/withdrawal fees are for US dollars, neither if there are exchanges that do not require this fee. I know Intersango does as well.


Where, or how, can I get a complete history of difficulty?

You can get it for example on blockchain.info. Call up the Difficulty chart, switch the time-frame to "All Time", then use the link labelled "CSV", to download it.

Note that the difficulty only changes every 2016 blocks, which is re-targeted to be about 14 days, in case you wonder why there are so few data points.


How to send money to set of recipients using bitcoinj

Try this. You can add several outputs to a transaction

 SendRequest req;
 Transaction transaction = null;

transaction = new Transaction(this.activity.getNetWorkParameters());
        transaction.addOutput(coin1,address1);
        transaction.addOutput(coin2,address2);
        req = SendRequest.forTx(transaction);


Please help with my unconfirmed transaction (for two days already)

The only thing you can do is either wait or fee bump the transaction by using the replace by fee functionality to increase the transaction fee.

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

Unfortunately the bitcoin network in being spammed with transaction by crooks operating competing cryptocurrencies the mempool has a backlog at the moment