What's the easiest way to create a backup node?

You can just create a backup of the datadir folder, which could be saved on another hard drive in case your node’s chain state becomes corrupted. In case of corruption, just copy the saved data into the appropriate folder, and your node will then sync from that point in history, rather than starting from scratch. The datadir can be specified in your bitcoin.conf file, but will otherwise be found in the default path.
NOTE: you’ll want to stop the node before starting to copy the files. The normal operation of a node includes a lot of ~random reads and writes to the data directory files, so you’ll want to stop the node first to eliminate the chance of corrupting the data during the copy.


What system should I implement to make use of accounts with Bitcoin Core 'accounts' now deprecated?

Accounts were replaced by labels, a more flexible tool which can probably be made to fit your requirement. Alternatively, if you have really been using the now-obsolete "accounts" feature to maintain separate wallets within a wallet, there is now an option to use separate wallets in separate wallet files


Can you delete / remove / update a decentralized asset in the NXT Asset Exchange?

Deleting, updating and delisting are not supported now.


Possible to estimate next difficulty based on terahashes?

Is it intended for there to only be a finite number of blocks solved
  in a certain timeframe?

Yes.  The intended rate is 1 block per 10 minutes, which is 144 blocks per day, which is 2016 blocks every 2 weeks.

To estimate the difficulty, flip around the "time to generate a block at a hash rate" equation

difficulty=((Time for a block to be found in seconds)*(hashes per second))/2^32

Where the time is 600 and the hashrate is whatever you want.


How should centralized wallets handle user accounts?

In this way, without associating a user account with the private key itself, we are able to allow the user to have exclusive access to any number of keys.

A very significant benefit that wallet services can offer is immediate and invisible transfer of coins between their accounts, by just updating their internal databases, without going through the block chain. This is how you can facilitate trades on MtGox for example, and it also provides increased anonymity, because you can now make transactions that are not visible on the block chain (and the transactions that are visible are withdrawal and deposits into the service as a whole, and those addresses are shared between many users, so also effectively anonymized). Obviously, this will not work unless the service can "redistribute" all the coins in all its addresses at will internally. (And obviously this also only works if every account holder trusts the wallet service to not take all the coins and make a run for it).

  Each account "owns" one or more public key hashes (the meat of a Bitcoin address).

Actually, for making deposits, this is how it already works with wallet services. There is a (or many) receiving address (sometimes for one-time use, sometimes stable and fit for publication) that is associated with every account holder. You deposit to the account using that address. However, the private key remains with the wallet service, and can be used by it for all kinds of unrelated payments.


Understanding a Bitcoin Double Spending Transaction by Performing one on yourself

How to Double Spend

You can double spend using Electrum quite easily. Even without duplicating your wallet, be it on the same or on 2 different machines. Btw.: Duplicating wallets is super easy with Electrum.

Just go to Tools → Preferences → Transactions and check View transaction before signing.

Close the settings, go to the "Send" tab, and enter the first address you want to pay to and the amount to want to send. Click "Send ...".

A window titled "Transaction" opens. Click the button "Sign". This will require you to enter your password to sign the transaction but doesn't already send it.

Note that on my screenshots, it says that the amount sent is 0. This is because Electrum noticed that I used addresses of that same wallet. It will still actually send the transactions out and one of them will (probably) happen but it tells you that you're not sending money to someone else. If you want this to be different, create a second Electrum wallet to send the money to. Don't double spend when paying others.

After pressing the button, the transaction ID is generated, the button "Sign" disappears, and the button "Broadcast" appears. Don't already click that button.

Instead, go back to the main window and enter the second address you want to send to. Leave the amount to send the same.

Because the coin selection (if you didn't change it in the mean time, of course ;-) ) and the amount remained the same, the same UTXOs are selected when you press "Send". You can verify this by making sure the inputs are the same. Sign this transaction, too.

You now have 2 transactions spending the same UTXOs:

Then, broadcast both transactions quickly after each other.

It doesn't matter whether the addresses you send to belong to the same or a different wallet.

Alternatively, you can duplicate your wallet by simply copying your wallet file (which by default is stored in ~/.electrum/wallets or restoring the wallet (even though you still have it) with your seed. Of course, using the same wallet on a different device is possible, too.

Do Double Spends Happen by Accident?

Wallets usually try to not spend the same UTXOs twice because when you're not playing with it, it only causes trouble.

If you're using the same wallet on your PC and your smartphone, of course, it can happen that you're spending the same UTXOs twice accidentally because the device you made the first transaction on didn't broadcast it immediately or the device you made the second transaction on didn't know about the first transaction when you made the second one.

How do Online Services Accepting Unconfirmed Transactions Stay in Business?

How do restaurants which serve food without the customers having paid that food first, stay in business would be a much better question.

If you buy something online, it's usually something that's delivered to your home or at least connected to an account of yours you plan on using. You have an interest of not defrauding the people or companies providing the services you use because you don't want to be sued for not paying for what you ordered or having an account of yours closed.

In the case of restaurants, it's merely that people usually feel a moral obligation to pay for what they consumed much more than fearing to get caught because the chance of the latter happening as rather small. Restaurants can't sue you because they don't know your name or your address and they can't close an account containing stuff that's valuable to you, either.

And besides, what's with all the online services accepting payments via direct debit? How do they know that you're even the owner of that account? They don't, they just hope for it. If there is an unconfirmed transactions to the address they asked you to pay to, they at least know that the payment was authorized by the person owning the funds it uses and can't get in trouble with other people and their banks.

Detecting Double Spending

Businesses can't avoid it because they don't have power over it happening. But they can detect it. They can simply not process an order if, within relatively short period of time, a second transaction spending the same funds as the one they received first appears, and only process the order when the transaction sending sufficient funds to them has 3 confirmations. If someone tried to defraud a business, letting them wait a bit more than they usually would is only fair. If it the double spending happened by accident, the consequences aren't bad anyways so no one is really harmed significantly.


How do I get Bitcoin block header data with nonce?

There is no need to buy any data, and if someone is offering to sell you block headers, then you are being scammed.

The Bitcoin network protocol supports transmitting just block headers. So you can just use or create a software which can speak the Bitcoin network protocol and download just the block headers. The getheaders message is what you need in order to request the headers from a node, in addition to the normal network protocol stuff. Since block headers are just 80 bytes, the entire download will be 80*506612 = 40528960 bytes = 40.528960 MB.

Instead of writing such a software, you can also use Electrum. Electrum is a SPV wallet, but it downloads all of the block headers. If you create an Electrum wallet and let it sync (syncs very quickly), you will find a file in the Electrum data directory named blockchain_headers. This file contains all of the block headers in raw form (so just as bytes). You can then parse that as per the block header format.


Create Raw Transaction in BitcoinJ offline starting from UTXO info

I'm fighting with the TransactionOutput constructors to build the input for my transaction. I don't know where to set UTXO hash and index

I think you can build the input based on a previous transaction output (outpoint) as follows:
byte[] scriptBytes = {};
Sha256Hash vinTxId = Sha256Hash.wrap(txId);
TransactionOutPoint outpoint = new TransactionOutPoint(params, index, vinTxId);
Coin value = null;
TransactionInput input = new TransactionInput(params, transaction, scriptBytes, outpoint, value);
transaction.addInput(input);

Not sure if this is the best ways to do it.
EDIT: This does the same as the code above.
transaction.addInput(Sha256Hash.wrap(txId), index, ScriptBuilder.createEmpty());


When do miners include low-fee-transactions?

They will never include low fees transactions before high fee transactions because they have an incentive to mine higher fee transactions before lower fee ones. If they mine higher fee transactions they will make more money. If you make a transaction and pay a $1 fee while the average is $50, it is likely to never be processed. The miner will only process your transaction once there's no more transactions with a fee above $1.


Do no-fee transaction represent a greater risk if the product is delivered instantly?

It should get picked up eventually, but yes, the user could double-spend before that.

That is exactly what confirmations are for. But it is probably unlikely that you would see massive amounts of "piracy" due to this. I'd just write that off as a cost of doing business. If it does get out of hand, you can go back to waiting for confirmations or accepting "green addresses".

Also keep in mind that if the users are not anonymous towards you (i.e. they maintain some kind of relationship with you, even just a user registration), you have recourse (you can refuse to continue offering them access until the scores are settled).

It is a trade-off between relying on trust (that the user pays) versus waiting for the amount of time it takes for the confirmations.


It is usually longer than 2 minutes...
Please look at the blockchain as a database storing addresses and balances.
If you have an address (privkey) from the very beginning, you search in the blockchain for records about your address.
But if you import address, which was unknown to this client, you have to go through blockchain once again, in order to search for records corresponding to this address. Elsewhere, how could you know balance of this address, if you didn't look at it before importing?
In my opinion, it doesn't prevent you from importing anything. If you want to skip rescan, use bitcoind importprivkey l12n3lj2nl2n3213lkj4n3lk4n false. You can import a lot of privkeys this way, and rescan at the end with the last address or via start switch bitcoind -rescan.
Please note that rescaning is not necessary when importing keys with 0 BTC.


At which point do blocks get validated in the mining process?

A block is checked in two places: First, it's checked before a miner starts working on it, and second, it's checked by every other node before accepting the block as valid.


As a miner can i mine my own transaction to speed up the confirmation?

No, you can only confirm a transaction if you found a new block, but this is very unlikely to happen when solo mining.


Why is sharding not possible with a distributed blockchain?

Your question is a little unclear as it only talks about storing, and not really about validating the entire blockchain. Storing is actually not the problem. Recent versions of Bitcoin Core support crude pruning and work is underway to make it more flexible.

However, to be truly trustless a full node still needs to download and validate the entire history of all blocks (even if deleting that history seconds later). This is what David Schwartz answer comes from: you need a complete history to know whether a transactions was NOT in it.

So in that regard pruning doesn't help mobile devices much.


How can a pruned node be classed a full node without the full blockchain?

Pruned nodes will verify new blocks and they are classified as full nodes

They keep the complete database of all UTXOs. This is enough to verify new blocks. What is required for validation is that the tx in the new blocks are spending only the current unspent transaction outputs
They store mempool and check blocks to make sure they comply with all bitcoin protocol rules, just like other nodes
Since, they don't keep older block data, only thing that they can't do is to return older block data to other nodes. They still keep latest block data for reogranization, which they can share with other nodes


Will I lose payments on a mining share in the time it takes to sync?

You will get that payment. Your wallet does not need to be online or synchronized to receive funds, only to do anything with them. (I'm assuming you're using Bitcoin-qt or something similar, I don't know what that vendor recommended or what you've done.)

However, the client shouldn't take months to sync, so this could indicate there is some problem.


How to import p2wsh-in-p2sh multisig as watch-only?

The issue here is that you've provided the p2wsh redeemscript as the script for the p2sh level of the nesting.  The redeemscript for the p2sh address is

0020dabea3445c14e4a08d6705db4373bef467d4c64e7c8ddf149be50670de6878ae

This can be seen by running

bitcoin-cli -testnet decodescript 5221029f531503facdac2496f50a446d9bd29846a06a04a45e3845b656bb471df422fc2102e30787703a990e4015a2cb9071fcfd1c7d4641fb294e4b4c3f5f6b450a1925132102da28088a8022651171c4f13429b98709dabe13bc6da526537fdd2d0730dd2dbb2103286c96ecaa850a6ba43cc45fbb539c1fb1d65c23cc0f3cd09fcf9765826ff9de54ae

With it, you can import the p2sh-p2wsh by setting the redeemscript for each level of the nesting :

$ bitcoin-cli -testnet importmulti '[{ "scriptPubKey": { "address": "2MzqiaZzpLT2SSBfsFqqo3FpZsP8g6WTvyC" }, "timestamp":"now", "redeemscript":"0020DABEA3445C14E4A08D6705DB4373BEF467D4C64E7C8DDF149BE50670DE6878AE", "label":"Glacier 2012-12-21" }, {"scriptPubKey": { "address": "2MzqiaZzpLT2SSBfsFqqo3FpZsP8g6WTvyC" }, "redeemscript": "5221029f531503facdac2496f50a446d9bd29846a06a04a45e3845b656bb471df422fc2102e30787703a990e4015a2cb9071fcfd1c7d4641fb294e4b4c3f5f6b450a1925132102da28088a8022651171c4f13429b98709dabe13bc6da526537fdd2d0730dd2dbb2103286c96ecaa850a6ba43cc45fbb539c1fb1d65c23cc0f3cd09fcf9765826ff9de54ae", "label":"Glacier 2012-12-21", "timestamp":"now"}]'
[
  {
    "success": true
  },
  {
    "success": true
  }
]

Then you'll see the expected result from getaddressinfo :

bitcoin-cli -testnet getaddressinfo 2MzqiaZzpLT2SSBfsFqqo3FpZsP8g6WTvyC
{
  "address": "2MzqiaZzpLT2SSBfsFqqo3FpZsP8g6WTvyC",
  "scriptPubKey": "a914534ee3ce21b8f805128f76b9d977e351bbbea20d87",
  "ismine": false,
  "iswatchonly": true,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_scripthash",
  "hex": "0020dabea3445c14e4a08d6705db4373bef467d4c64e7c8ddf149be50670de6878ae",
  "embedded": {
    "isscript": true,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "dabea3445c14e4a08d6705db4373bef467d4c64e7c8ddf149be50670de6878ae",
    "script": "multisig",
    "hex": "5221029f531503facdac2496f50a446d9bd29846a06a04a45e3845b656bb471df422fc2102e30787703a990e4015a2cb9071fcfd1c7d4641fb294e4b4c3f5f6b450a1925132102da28088a8022651171c4f13429b98709dabe13bc6da526537fdd2d0730dd2dbb2103286c96ecaa850a6ba43cc45fbb539c1fb1d65c23cc0f3cd09fcf9765826ff9de54ae",
    "sigsrequired": 2,
    "pubkeys": [
      "029f531503facdac2496f50a446d9bd29846a06a04a45e3845b656bb471df422fc",
      "02e30787703a990e4015a2cb9071fcfd1c7d4641fb294e4b4c3f5f6b450a192513",
      "02da28088a8022651171c4f13429b98709dabe13bc6da526537fdd2d0730dd2dbb",
      "03286c96ecaa850a6ba43cc45fbb539c1fb1d65c23cc0f3cd09fcf9765826ff9de"
    ],
    "address": "tb1qm2l2x3zuznj2prt8qhd5xua773naf3jw0jxa79ymu5r8phng0zhqrkkueu",
    "scriptPubKey": "0020dabea3445c14e4a08d6705db4373bef467d4c64e7c8ddf149be50670de6878ae"
  },
  "label": "Glacier 2012-12-21",
  "timestamp": 1296688602,
  "labels": [
    {
      "name": "Glacier 2012-12-21",
      "purpose": "receive"
    }
  ]
}

Note, ismine is never true for scripts\addresses for which you can't sign completely on your own.


In Bitcoin source, what is the UniValue objects purpose?

UniValue is a type that encapsulates a JSON value.

It is only used for communication with external utilities through the RPC interface.


Signmessagewithprivkey result is different than txinwitness

From Elliptic Curve Cryptography perspective everything you sign is a "message" but the term "message" in bitcoin context means a random string that user wants to sign with his key (usually used for proof of ownership or something similar).
This means when you use sign*message*withprivkey the code interprets the input as a string and signs it with a different method that generates and entirely different digest ("some_fixed_string" + UTF8.Decode("0200000001f...")). But when you use sign*rawtransaction*withkey the code interprets the given string as a transaction and signs it based on its input scripts with different methods ("Transaction.Decode("0200000001f...") then Serialize() based on BIP143 for SegWit).


How does the Kimoto Gravity Well regulate difficulty?

The explanations on the web are all very vague and mystical, on purpose maybe. Here is my take in simple words, just reading the megacoin source code from the above comment.

The goal is to have a more adaptive way of adjusting the difficulty instead of just averaging the last 2016 blocks like bitcoin. This is needed because of multipools which might switch the coin they are mining, and a sudden change in hashrate  can occur (both increasing or decreasing). Especially when a multipool switches away you get stuck too long with a too high difficulty.

The algo loops backwards through the blocks, starting from the current one. The PastBlocksMass is just the number of blocks, so it starts at one and increases in each loop.

In each loop an adjustment factor is computed, which is the target block time divided by the actual block time, in a cumulative fashion, so at loop 10 we would have the 25 minutes target time divided by the time it actually took to compute the last ten blocks. When the hashrate increases, we get shorter times and an adjustment factor greater than one and vice versa.

The loop ends whenever the average adjustment factor is larger than the kimoto-value, or smaller than 1/kimoto-value. To understand this look at this python script and an example plot:

from pylab import *

one_day = 1440 / 2.5   # how many 2.5 min blocks per day

nmin = one_day / 4     # PastBlocksMin
nmax = one_day * 7     # PastBlocksMax
x = arange(nmin, nmax)   # PastBlocksMass

# start with 2.5 minute blocktime + some noise
t0 = 2.5 + randn(nmax) / 4
t1 = 2.5 + randn(nmax) / 4

# t0 has 20% more hashrate, so shorter blocktime in the beginning
t0[:one_day] = 2.5 / 1.2 + randn(one_day) / 4
# t1 has higher blocktime in the beginning
t1[:one_day] = 2.5 / 0.9 + randn(one_day) / 4

s = arange(nmax)

adjust0 = (arange(1, nmax + 1) * 2.5 ) / cumsum(t0)
adjust1 = (arange(1, nmax + 1) * 2.5 ) / cumsum(t1)

# the magic function
def kimoto(x):
    return  1 + (0.7084 * pow((double(x)/double(144)), -1.228));

plot(x/one_day, kimoto(x))
plot(x/one_day, 1/kimoto(x))
plot(s/one_day, adjust0)
plot(s/one_day, adjust1)
legend(["kimoto","1/kimoto", "20% increase in hashrate", "10% drop in hashrate"])
xlabel("days")
ylabel("adjustment factor (target/actual blocktime)")
show()

The script produces a figure like this .

It shows two constructed examples when the hashrate increases and when it drops for one day. Best is to play with different settings for a while to get a feel for what is going on.

You see that the lines cross through the Kimoto formula at some point. This is when the algo exits and uses this adjustment factor to compute a new target/difficulty. For large adjustment factors this happens earlier than for the ones closer to one. This is to have a quick adaptation if the hashrate changes a lot, and a slower one if not - then we want a longer period to get a better average. The parameters of the Kimoto formula are adjusted in such a way that one roughly adjusts in one day to a 10% change and in seven days to a 1.2% change. A minimum of 144 blocks determine the new difficulty and at most 4032 (0.25 days or 7 days for a 2.5 minute blocktime).

Summary: the Kimoto gravity well algo has a fancy name and determines the number of blocks which contribute to the evaluation of the new difficulty. It gives fewer blocks for high hashrate changes and is therefore more adaptive.


Difference between Outpoint structure returned from Blockchain.info and what is in the Protocol Specification

Why is this different?

Blockchain.info has an API that provides the same data, but not necessarily formatted in the exact same way. When bitcoin nodes talk to each other, they must use the protocol as specified in the link you gave, but the Blockchain.info API is just a utility for getting some data about the contents of the block chain.

  Is blockchain.info not following the Bitcoin protocol for transactions on their json messages?

In their API, technically, no. I'm sure they have more than a few nodes running, though, which do follow the bitcoin protocol. Their API can call upon these nodes and a few database to return the JSON with the requested info.


How many api calls blocktrail allow per second

I believe it means you could do all 300 requests in 1 second if you really wanted to, and then wait 59 seconds for the next minute. Doesn't matter when you use them within that minute, just that no more than 300 are used per minute.


The most recent versions of Electrum use dynamic fees. It has been like this for several versions, although for some versions you needed to enable it in your preferences. Check your preferences and see if there is a dynamic fees option. You can also just upgrade to using the latest version of Electrum.


What are the Pros/Cons of investing in the Bitcoin ETF vs. bitcoins yourself?

When you say "I won't have to worry about the security of my coins"... I think you've got this backward.

There's nothing more secure than a paper wallet that has been generated offline. Bitcoin was created as a way to avoid the need to trust a third party. If you don't believe that's necessary, then you're just trading it hoping to make USDs, not because you believe in it's intrinsic value.

in other words,

Are you speculating on the price, short term, hoping to make USD?

Get the ETF.

Are you skeptical of the global financial system, and want to hold money outside the reach of any government?

Hold bitcoin.


You would have to ask your employer, but I have never seen that before.

For bitcoin debit cards read this:

http://www.engadget.com/2012/08/20/bitinstant-founder-says-bitcoin-debit-card-to-launch-within-next/


Do we have failed transactions in bitcoin?

No, a bitcoin script has to evaluate to true to be spendable.
https://en.bitcoin.it/wiki/Script


What is the network topology used at the physical layer of the Bitcoin network?

the performance of the Bitcoin Network under various network topology and for which it performs the best

Bitcoin must be secure, foremost, and if it isn't the 'performance' would be totally irrelevant.  To given an example, in a world without dishonest parties and failing components a minimal spanning tree rooted at each transaction and block source would be very efficient.. but in reality it would be totally useless since any such topology would be highly vulnerable to any malicious or faulty node.

In practice the Bitcoin P2P network creates a random topology with each peer connecting out to 8 listening nodes and each listening node accepting up to 125 connections. Outbound destinations are randomly selected with the constraint that no two connections will be made to the same /16 (IPv4, /32 for IPv6).  User sometimes overlay additional manually configured connections among their own nodes or to other known parties.

Blocks tend to flow along the fastest paths on top of this random topology.


How many change outputs are there in a Bitcoin transaction

So what I ask is, for transactions with more than one output, can we assume that one of the outputs is always change?

I think this is likely a safe assumption most of the time, but not always. For example, a transaction that pays two people, using an input that is exactly the sum of both payment (+ miner fee) would have two outputs, and no change address. Such a thing is probably rare, but possible.

As well, if you move coins around between two wallets you control, then the only real distinction between the ‘payment output’ and the ‘change output’ is in which wallet controls which key (since you own both).

  Wallets would not construct transactions where they split the change to multiple addresses of the sender, would they?

Sure they could, I’ve seen wallets that are focused on user privacy advertise all sorts of unconventional spending habits, with the goal of making it hard to figure out metrics like this. As an example, check out samurai wallet.

Again though, most wallets are designed to be fee-efficient, so in most cases there will not be more than one change output.

  Is the only concern then, whether the output is indeed change or it is value that is being sent over to another recipient?

That is definitely one issue with trying to estimate tx volume, but likely not the only one. Distinguishing payments between parties vs payments to oneself (eg moving you coins to a different wallet) is another. As you mentioned, off chain tx volume and coin mixers will also make it hard to figure out. Lightning network payments will similarly be difficult to quantify, since payments can be communicated off-band, and we will only see the channel opening/closing txs happen on chain.


What should I use as a login and password while connecting to the bitcoin daemon

Locate your bitcoin.conf file (https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File) and add these lines:

rpcuser = MyRpcUsername
rpcpassword = MyRpcPassword
server=1

These are the credentials you should be also using in your program.


You wait.

In the Bitcoin network, transactions are confirmed by including them into blocks, which are then permanently stored in the blockchain.

Blocks are mined, on average, every 10 minutes, but this is actually a random Poisson process, just as you can say a given piece of uranium will emit an alpha particle every 10 seconds on average. Sometimes, blocks will be found within the same minute, sometimes it may take an hour.

Blocks also have a maximum size, which is now pretty close to the transaction volume of Bitcoin at the moment. Rational miners who receive more transactions than will fit in their block, will mine higher fee transactions before lower fee transactions. If the transaction fee you paid was very small, your transaction will eventually confirm, it will just take much longer (up to a few hours).


Get notified of incoming Bitcoin transaction, as soon as it broadcasted

If using the wallet notify option in bitcoin.conf, you can get a notification any time a transaction occurs on the network that matches a bitcoin address in the wallet. To use this, of course, you'll have to keep Bitcoin-QT or bitcoind running at all times.

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

Once you have the transaction id, you'll have to look up the transaction, either at an online service like blockchain.io or use a bitcoind json-rpc command to learn more about the transaction and what action you would like to take.


Mastering Bitcoin is an amazing book that'll definitely get you started. It's freely available online here: http://chimera.labs.oreilly.com/books/1234000001802/index.html


Pending transaction shows as confirmed on blockchain explorer

How can I go about attempting to get my transaction finalized?

It seems the transaction is finalised. Its just that your wallet doesn't know about it.

  Checking the transaction on the ledger, however, shows that it's been confirmed and completed.

I assume this means you have checked the Transaction-ID against several different  Blockchain explorers and they all show the Transaction as having more than six confirmations.

In this case you need to do as Pieter Wuille suggested. Create a new wallet, using different software. Either import the private-key or sweep the private-key into the new wallet. There are important implications of these two approaches. People mostly recommend sweeping as safer for most folk.

Before it can show the correct balance, the new wallet may need to synchronise with the network (depending on whether you choose a full-node or lightweight wallet), if so this may take from a few days to a week or more.


Get uncompressed public key from compressed form

Yes, you can convert a 33-byte compressed public key into a 65-byte uncompressed public key in Java.

Here is the code to perform the operation. It is correct, robust, and only requires Java SE classes (no other libraries) - but I apologize for the implementation length.

import java.math.BigInteger;
import java.util.Arrays;

static final BigInteger MODULUS =
    new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 16);
static final BigInteger CURVE_A = new BigInteger("0");
static final BigInteger CURVE_B = new BigInteger("7");

// Given a 33-byte compressed public key, this returns a 65-byte uncompressed key.
byte[] decompressPubkey(byte[] compKey) {
    // Check array length and type indicator byte
    if (compKey.length != 33 || compKey[0] != 2 && compKey[0] != 3)
        throw new IllegalArgumentException();

    final byte[] xCoordBytes = Arrays.copyOfRange(compKey, 1, compKey.length);
    final BigInteger xCoord = new BigInteger(1, xCoordBytes);  // Range [0, 2^256)

    BigInteger temp = xCoord.pow(2).add(CURVE_A);
    temp = sqrtMod(temp.add(CURVE_B));
    boolean tempIsOdd = temp.testBit(0);
    boolean yShouldBeOdd = compKey[0] == 3;
    if (tempIsOdd != yShouldBeOdd)
        temp = temp.negate().mod(MODULUS);
    final BigInteger yCoord = temp;

    // Copy the x coordinate into the new
    // uncompressed key, and change the type byte
    byte[] result = Arrays.copyOf(compKey, 65);
    result[0] = 4;

    // Carefully copy the y coordinate into uncompressed key
    final byte[] yCoordBytes = yCoord.toByteArray();
    for (int i = 0; i < 32 && i < yCoordBytes.length; i++)
        result[result.length - 1 - i] = yCoordBytes[yCoordBytes.length - 1 - i];

    return result;
}

// Given x, this returns a value y such that y^2 % MODULUS == x.
BigInteger sqrtMod(BigInteger value) {
    assert (MODULUS.intValue() & 3) == 3;
    BigInteger pow = MODULUS.add(BigInteger.ONE).shiftRight(2);
    BigInteger result = value.modPow(pow, MODULUS);
    assert result.pow(2).mod(MODULUS).equals(value);
    return result;
}

My Bitcoin cryptography library does implement the modulo-prime field arithmetic, but it should add the functionality to decompress public keys as well...


Your value for "vout" is invalid. The source transaction only has three, not 90464000.

 "vout": 90463999,

The real output you are trying to spend is 0. You confused tx_index and tx_output_n.


getrawtransaction - find destination and "change" addresses

The getrawtransaction RPC will provide you with details about a particular transaction.  However, answering your question further is complicated by several issues:

Transactions are not required to have change addresses.  Good wallets will attempt to avoid using change addresses when change isn't necessary.
Transactions may have more than two outputs, so there's not necessarily a single payment address.
Transactions may pay a bare (non-P2SH) multisig output which comprises several public keys.  GetRawTransaction will display these as multiple addresses.
In a well-implemented wallet, change should be indistinguishable from a payment within a single transaction.  You would need to analyze multiple transactions or have information from the party that received payment in order to be able to determine which output is a change address.

In short, I don't think GetRawTransaction or any other RPC will provide you with the information you want for arbitrary block chain transactions.  However, if you're only interested in information about transactions in the local wallet, the gettransaction RPC is what you're looking for.


Derive next HD segwit address from xpub/ypub

There is https://iancoleman.io/bip39/ Enter your xpub into the BIP32 Root Key box and in the BIP141 tab select the derivation path and address type.


Does bitcoin mining power add up and how does this affect the difficulty?

Mining is a lottery, not a race.

Think of mining as digging for gold in your own piece of land. Everyone has an equally large piece of land, but some people can dig faster than others (=hash power).

One in every billion grains of sand contains gold. Despite that very low fraction, there are still plenty of gold grains out there. There are so many grains of sand out there that even just in your own piece of land, there are plenty of good ones.

However, the gold is randomly mixed with the pieces of sand, so every grain of sand you dug up has an equal chance of being good. Certainly those who dig through more sand faster stand a higher chance of winning, but even the very first grain you look at has a chance of being gold.

So how long does it take for a gold coin to be found? On average, as long is needed for all miners together to go through one billion grains. So does it matter if someone only adds 1% of the digging power to the total? Sure, he now has a 1% chance of finding the next gold grain. That isn't much, but on average that will absolutely reduce the time needed for a solution by 1%. And the difficulty (the ratio of sand to gold) will go up occordingly.


Legal status of Blockchain proof-of-existence TX (USA court)

I am not aware of any cases, but based on the long delay in relevant cases concerning the fax machine and email (proof of delivery, timestamps, etc) I would not expect such a blockchain specific case law decision anytime soon.

Technology advances far faster than the law.


Is it possible to have a single input or output with multiple addresses

The answer here is escrow outputs.

When one of the outputs is sent to escrow, the related addresses are listed in those arrays.

Here is an example: https://insight.bitpay.com/api/tx/09dd94f2c85262173da87a745a459007bb1eed6eeb6bfa238a0cd91a16cf7790

A single output will be displayed to have multiple addresses.

Blockcypher's API will show an address starting with 4 instead of multiple adresses. And output script type = pay-to-multi-pubkey-hash

{
      "value": 10860,
      "script": "5121032487c2a32f7c8d57d2a93906a6457afd00697925b0e6e145d89af6d3bca330162102308673d16987eaa010e540901cc6fe3695e758c19f46ce604e174dac315e685a52ae",
      "addresses": [
        "4bkHBecr4EQvVUa8Lsa2kH6rGtvsC9AZ5Y"
      ],
      "script_type": "pay-to-multi-pubkey-hash"
    },


Google Sheets Cryptofinance Add-on - is the company still operating?

I believe so, I've had a reply to my emails and telegram messages just few days ago. Maybe they are too busy with this (mini) bull market?


What is the probability of mining a block by a miner controlling a fraction of hashing power?

Probability
As  MCCCS comented:

Your hashrate divided by total hashrate is the probability of you finding the next block.

As of March 2021

Item
Hashrate MH/s

Typical desktop computer's i7 CPU
24

Antminer S19 Pro
110,000,000

Bitcoin network
156,000,000,000,000

So every ten minutes a CPU miner would have a 1 in 6,500,000,000,000 chance of earning 6.25 BTC. You have a 1 in 139,000,000 chance of winning the Euromillions lottery so lottery tickets will give you an overwhelmingly better return on investment in the longer term than does CPU mining. In both cases you are more likely to lose lots of money than see any profit.

"Expected earnings"
You can also key your hashrate into an online calculator to find your "expected earnings".

Setting
Value
Units

Difficulty Factor
1.54660989356e+13

Hash Rate
24.0
MH/s

Exchange Rate
50809.85
($/BTC) [user]

BTC / Block
6.25000000

This Difficulty

Coins
Dollars

per Day
0.00000000 BTC
$0.00

per Week
0.00000000 BTC
$0.00

per Month
0.00000001 BTC
$0.00

this diff (est)
0.00000008 BTC
$0.00

Next Difficulty [estimated]

Coins
Dollars

per Day
0.00000000 BTC
$0.00

\per Week
0.00000000 BTC
$0.00

per Month
0.00000001 BTC
$0.00

Of course, you might get lucky.

References

https://www.blockchain.com/charts/hash-rate
https://alloscomp.com/bitcoin/calculator


I did this, actually! In terms of disclosure, @eric allam is absolutely correct, above; you should let your users know that's going on, at a minimum, and ideally have some sort of "Start mining" button they can click to have an explicit opt-in type procedure. That said, it's wildly unlikely to generate a profit unless you have a huge base of users and are providing some sort of content (a game, streaming music, etc.) that they would want to stick around for.

I started (Let's) All Mine as a sort of experiment (to raise money for grad school) inspired by The Million Dollar Homepage, thinking that a site that is only about mining would be a curious thing users might want to be engaged with, similar to how that site was only a site of ads. I also thought it was a low bar for users to engage with, considering they can run it in the background on their browser while they're doing other stuff. The reality, though, is that I'm asking users to give up some fraction of their CPU, which, even though most users aren't using nearly all of it, is an ask. Also, it is very hard to get users to stay on a particular web page; given short attention spans and the habit of closing pages when we're done, it takes a special kind of user to stick around and mine for a while. And that's really what it takes: Coinhive's own site says with 10-20 "active users" (which I interpret to mean "users who are consistently mining 24 hours/day"), you can expect $30-40 per month. Maybe that covers your hosting and domain costs, maybe it doesn't, but you're not walking away with a whole lot. Finally, there are dedicated mining pools that reward users with some amount of currency depending on their contributions; what I'm asking for is a donation of time + resources, so it's not as palatable.

In any case, for my project in particular, it was exciting to make something in a weekend that was functional and get it out there. I've had a bunch of people stop by and mine for a minute or two, and the rare few miners that stay for a while, but I chalk it up to a learning experience. You have to get the incentives right to get users to come, and stay.


restore wallet using hd seed before 0.17.0

I cannot find hdseed in dumped wallet file, so I don't know hd seed to backup

It used to be called hdmaster rather than hdseed.

creating new wallets is done by starting bitcoind and passing -wallet option, but I don't see a way to specify hd seed when creating a new wallet

Is that even possible without upgrading?

No. sethdseed was added in 0.17. Before that, there was no way to restore a seed to a new wallet in Core.


Several Q's about consensus about the longest chain and when this chain be confirmed?

But what will happen if 2 (or more) nodes will solve the next block at the same time,and they will start to build their own chain ?

Nothing. Nodes will temporarily disagree on the longest chain, but only in the very last block.

  Which longest chain (if their chains has the same size) will be adopted ?

Whichever one happens to get a block mined after it first. That chain will then be definitively longer than the other one.

  When (and who) decide to confirm the longest chain ?

Every node all the time. Of course, for blocks very close to the tip of the chain, you can't be confident they'll remain in the longest chain. But once you go back three blocks, confidence reaches will in excess of 99.9%. For very high value transactions, you could wait as much as six blocks.


What exactly are Bitcoins?

bitcoins are the right and possiblility to write some data (transaction) to some database (blockchain) passing this right to another person.

  What can bitcoins be used for?

What can gold be used for? Trading/exchanging for all other things

  Where does one acquire bitcoins?

Where does one acquire gold? Either buy it, or mine it, or steal it, or find it

  When were they first created?

When gold was first created? Dumb question. Just think that it exists today


Can there be stale blocks in "header first" implementation?

Stale and orphan blocks are confusing terms with many meanings, depending on whom you ask.

If by stale blocks you mean "blocks that are on branches off the main chain, but are otherwise valid", yes, those still exist. They are inherent to proof-of-work chains, as you can't avoid the case where occasionally two miners produce a competing block. Necessarily, at most one of them can win, and the other one will become stale.

If by orphan blocks you mean "blocks whose parent header is unknown", those indeed don't exist anymore. They were an artefact of the synchronization implementation used until 0.9. Since 0.10, we only request blocks once we have validated all the headers in their ancestry, so blocks without headers known cannot occur anymore.


How can I use the USB block erupters to mine Namecoin?

In theory, you can mine any altcoin that uses double-SHA256 hashing algorithm as a proof of work with any ASIC device. The process should be similar to mining Bitcoin - you would most likely want to connect to a mining pool or solo mine in a configuration analogous to mining Bitcoin.

Also note that Namecoin supports merged mining, meaning that if you mine for a Bitcoin block through a pool that supports merged mining, your proof of work can still be used to create Namecoin blocks. This effectively makes you mine for both currencies with the same amount of hashing power, increasing your expected return rate by the amount of other coin mined (so instead of mining just Namecoin, you would be getting some extra BTC kickback as well for your submitted shares).


How to explain blockchain in terms of OSI 7-layer model? Is it based on service in the transport layer

The blockchain is a data structure that every node in the network independently builds, based on messages that are exchanged in a network.

Blockchains don't prescribe what this network protocol looks like. The OSI model is a way to describe layers in a network, not data structures.


What is the minimum investment for Bitcoin?

On the whole, there is no minimum investment for Bitcoin, as it is not a security such as an ETF or mutual fund purchased through a brokerage or management firm.

What minimum purchases exist on Bitcoin exchanges are merely requirements set by each individual exchange to reflect the minimum purchase/sale that they feel is necessary to cover their overhead for each transaction.

Purchasing from an individual trader, you'll find that there is generally no such minimum, aside from whatever minimum they set to make it worth the time and travel expense for a rendezvous.


Use https://taapi.io, there's a bunch of indicators (RSI, MACD, MA, EMA, TD Sequential, ATR, ADX, Bollinger Bands, Momentum, CMF etc...) that you can pull from their API. You can pull indicators from 20 different exchanges or so, including Binance.


if I've P2SH-P2WPKH address, does it mean that all outputs to this
  address (UTXOs) are by definition segwit UTXOs ?

Yes, Bitcoin sent to a P2SH-P2WPKH address will produce a segwit UTXO.

  Why they wrote this "For spending of non-segwit UTXO, the signature
  generation algorithm is unchanged" part, what case it covers? If
  you've P2SH-P2WPKH address but you are taking some foreign UTXOs to
  spend(that were directed not to your address)?

I think you're right, it sounds like it's just saying if you want to send to a segwit address, you don't need to sign a non-segwit input any differently than before.

Spending P2SH(P2WPKH)

Here is a good reference example: BIP 141: P2SH(P2WPKH). In order to spend Bitcoin sent to your address 3MxYPuvEcKDdaEG1xoGyddqir6C4b66MJi, you have to provide the following:

witness:      <signature> <pubkey>
scriptSig:    <0 <20-byte-key-hash>>
              (0x160014{389f26d8d616cb96df1cfd6d9989248a30b933b9})

Perhaps you are forgetting the push ops 0x16 and/or 0x14 in scriptSig?


Exactly the duplicate of copay does not work in iphone5 ios10

Don't worry, it has been reported: https://github.com/bitpay/copay/issues/8382

It's not only you, other people seem to have the same problem.

Just wait until they release a fix for it.

EDIT: It has been fixed. Please update the app!


I suppose the only right answer is "because that's how Satoshi implemented it". His reasons for doing may have included easy of implementation, easy to guarantee consistency among nodes, or little worry about instability of correction algorithms.


How can I reverse a Bitcoin transaction mistakenly sent to the wrong address?

Firstly, Bitcoin Cash is not Bitcoin. Secondly, neither Bitcoin nor Bitcoin Cash have any sort of central authority or way to reverse/refund transactions. This is completely intentional - all confirmed transactions are final. The only way you can get a "refund" is to ask the person that you sent the Bitcoin Cash to to send it back to you. If you don't know who you sent it to or how to contact them, then unfortunately your money is gone.

The whole point of cryptocurrencies like Bitcoin and Bitcoin Cash is that it is like digital cash - once you hand someone cash in person, there's no way to get your money back except by talking to that person and asking them (or forcing them) to give you your money back. If you have no way to contact that person, then your money is gone.


How can i print out my bitcoin address that resides on my android phone?

Here's a quick way to do it:

<img src="http://qrfree.kaywa.com/?l=1&s=8&d=$yourAddressHere" alt="QRCode"/>


What are the script size limitations according to consensus rules and are they enforced on TestNet?

Those consensus rules are indeed the same for testnet and mainnet.

However, they do only apply when scripts are executed. So you have to create an input trying to spend it to test this.


What are the best JavaScript libraries to accept Bitcoin payments?

A JavaScript library? JavaScript is client-side and accepting bitcoin payments is basically like creating a shopping cart system from scratch. So you're not going to get far with JavaScript alone unless you just want to accept donations by tossing up a QR code. People have tried to generate a thousand addresses on their wallet and then cycle through them using JavaScript (like this), but it's hopelessly insecure and allows for users to possibly pay to the same address.

To create a shopping cart you'll need to use a server-side language like PHP, NodeJS, Python, Perl, etc. The easiest way is using a 3rd party API or you can do everything from scratch with a library. My personal fav is nodejs and bitcore, but this is usually too much for the average user.

If you're looking for something much easier I suggest Mycelium Gear. They basically allow you to fill out a form with your product info and they'll give you a link to post on your site.

Also if you're a wordpress developer I have heard good things about Cryptowoo in conjunction with Woocommerce. I have not tried it myself though.


bitcoin soft-fork how are the older nodes going to the verify new transaction?

You're confusing what happens during a soft fork and a hard fork slightly.

A soft fork is backwards compatible, meaning old nodes will still accept the softfork transactions.

Hard forks are not backwards compatible, meaning old nodes will reject the new hardfork transactions.

Think of it like this: there is a list of consensus rules. If you want to change the rules, there are two fundamental ways to do this: make the rules more strict (no longer allow something that was allowed before), or make the rules less strict (allow something new).

If you make the rules more strict, then all of the old nodes will still accept everything you are doing. This would be a soft fork.

If you make the rules less strict, then all of the old nodes will reject the new things you are doing. This would be a hard fork.


How do you handle returned goods in e-shopping?

Questions like this are off-topic on this forum, however I'll take a stab at answering your question as you seem to have a lot of misunderstanding.

The bigger question you need to ask yourself if why you want to implement your e-commerce application on a 'blockchain'? It would be a gross neglect for basic engineering design principles as blockchain is nothing but a slow and expensive database. I mean I would understand if you wanted to create a Dapp if you are selling drugs and other illegal substances (like SilkRoad) since you wouldn't want a single point of failure and lack of attribution as an owner. However, if you are creating an e-commerce application that is perfectly legal you can create it on a normal database system.

Blockchain is one of the many components that make Bitcoin successful, not the only one. A blockchain is used in Bitcoin to prevent double spend attacks as transaction included in previous blocks get precedence over the latest transaction if they spend the same output, and achieving consensus on a global scale where all participants have the authority to accept changes.

Private blockchain is nothing but an old wine in a new bottle. There are plentiful example of distributed databases with multiple write access available today like Google Spanner or Paxos. So, coming back to the question you need to ask yourself, what are benefits that the "blockchain technology" is providing you that is not possible with existing 'traditional' solutions in the market?


is it necessary to stay connected to internet

You need to be online because mining is sort of like a mathematical race: whoever finds the hash of the next block (with value less than the current target) wins. And in order to prove that you found this value before anybody else, you need to be online in order to broadcast it to other users.


There's a maximum block size (in bytes). So growth is limited to a linear growth and pretty predictable.

Spamming the network is very expensive because the spammer would be paying a lot of fees.

The current blockchain size is not that bad: it fits on a simple SD card if you want. And storing it on a harddisk costs cents.

Pruning can be done in such a way that there is very (very!) little room for manipulation. Everything is cryptographically provable. And there will always be full nodes around that do keep the full history and can check everything. Others would probably be able to query those nodes to provably check the complete path of particular coins. If you can do that on a even a random subset of coins, you can be pretty darn sure there was no manipulation.

Your last paragraph indicates that you don't fully understand the block validation and mining process (like the maximum block size and only 1 block every ten minutes on average). Maybe you need to look into that some more.

Regarding scaling the network up: there's still quite a bit of room in the current block size configuration, but the developers can fairly easily increase that maximum.


How do Lightning Explorers like 1ML register closed channels?

Every Chanel that us public is announced on the gossip protocol and in the channel announcement message linked to a funding transaction. What you can do (and what 1ml most likely does) is to save spent funding TX as close channels. As the gossip protocol will only forward channel announcement messages for open channels (those where the funding TX was not spent) it will be impossible to query your lightning node for closed channels from the past. You will only be able to collect this data for the future. Or you could crawl 1ml if their robots.txt allows this.


Is normal ECDSA verification slower than a verification method based on Public Key Recovery?

Verification w/ Public key recovery is never going to be faster than normal verification however it is only marginally slower.  I benchmarked it a while back and PubKey recovery added about 5% overhead.

Changing the txn format would require a hard fork so it is unlikely that is going to happen but the advantage of pubkey recovery is that it trades storage for time.  This could be useful for Bitcoin as processor power is less of a bottleneck than WAN bandwidth especially in residential 'last mile' scenarios.

A typical 2in, 2out P2PkH transaction is 373 bytes with compressed keys and 437 bytes using uncompressed keys).  The same transaction without pubkeys would be 309 bytes resulting in a storage (bandwidth and memory) reduction of 17% to 29% in exchange for 5% increase in CPU time.

Hashing is extremely fast so performing 4 hashes vs 1 hash is negligible but a single byte can remove that overhead.  The protocol would require using a flag with the signature to indicate which form to use when recovering the PubKey.

0x02 = compressed even
0x03 = compressed odd
0x04 = uncompressed even
0x05 = uncompressed odd

This really only saves significant space in P2PkH transactions. For P2SH (i.e. multisig) the script is very likely to contain full pubkeys instead of keyhashes.

While using PubKey recovery initially would have made sense the cost in terms of needing a hardfork doesn't make that change very viable.  If putting a hardfork on the table there are a lot of more interesting things that could be done instead.  For example switching from ECDSA to Schnorr signatures would allow native thresholding signatures.  This would reduce the number of signatures from one (or more in the case of multisig) per input to just one per transaction.  As 64 bytes each that would really add up.


Is there any tool to check sum of all BTC based on transactions?

Sort of.

Bitcoin Core's gettxoutsetinfo RPC command iterates through the entire UTXO set (the set of outputs that haven't been spent yet by another transaction).

Currently, it reports:

"height": 539935
"total_amount": 17249017.33071828

This is the approach you're looking for as it is computed from the actual outputs and inputs, though with a few caveats:

It is not computed on-the-fly from the blockchain; instead, it uses a database with unspent outputs that is always maintained by the validation code.
It excludes provably unspendable outputs (OP_RETURN outputs or outputs with a script longer than 10000 characters).

Note the discrepancy with the expected amount in circulation at that height (17249200.00000000). There are various reasons for this. My answer https://bitcoin.stackexchange.com/a/38998/208 goes into the details.


There is the routes field in the invoice as a routing hint
   "routes": [
      [
         {
            "pubkey": "03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134",
            "short_channel_id": "1891311x61x0",
            "fee_base_msat": 1000,
            "fee_proportional_millionths": 100,
            "cltv_expiry_delta": 144
         }
      ]

This tells you the node ID which getroute can find:
03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
There are plugins that allow you to create custom routes along a given path. So I suggest to call getroute to the node from the routing hint extend that route with the private hope and use the following plugin to create a custom onion:
https://github.com/lightningd/plugins/pull/85


Why does Satoshi's public key have the uid "BuZz Spacedout"

This is what I see for a search on pgp.mit.eud, which points to this key:

That is a surprising result.  If we download the key purported to be Nakamoto's from Bitcoin.org, we get the following fingerprint:

pub   1024D/5EC948A1 2008-10-30
      Key fingerprint = DE4E FCA3 E1AB 9E41 CE96  CECB 18C0 9E86 5EC9 48A1
uid                  Satoshi Nakamoto <satoshin@gmx.com>
sub   2048g/D6AAA69F 2008-10-30

Downloading the key from pgp.mit.edu seems to provide a key with the same fingerprint (notice it says that the key is updated, not new:

$ gpg --keyserver pgp.mit.edu --recv-keys 5ec948a1
gpg: requesting key 5EC948A1 from hkp server pgp.mit.edu
gpg: key 5EC948A1: "Satoshi Nakamoto <satoshin@gmx.com>" not changed
gpg: Total number processed: 1
gpg:         new signatures: 36

However, when I list the updated key, it hasn't changed (as the previous message indicated, there are only new signatures):

$ gpg -k satoshi
pub   1024D/5EC948A1 2008-10-30
uid                  Satoshi Nakamoto <satoshin@gmx.com>
sub   2048g/D6AAA69F 2008-10-30

I've tried adding other options like -vv for verbose and --list-options=show-unusable-uids for possibly retired user identities but I've been unable to find the "BuZz Spacedout" identity.  I also tried running the ASCII-armored text through a base64 decoder, but that didn't give me usable results.

I don't know enough about GPG to investigate the actual key contents further.  What I suspect happened is:

Someone used a tool to brute-force enough of Nakamoto's key id that the MIT keyserver got confused.
The MIT keyserver was confused in another way.

Happily, local GPG (which is what's important) doesn't seem to be confused at all, so we can be pretty sure it's not the case that Nakamoto has the total lame stoner name of BuZz SpacedOut.


What are the safe ways to connect to bitcoin network using tor?

Recently read one blog post which highlights the issues involved in using tor bridges and I will summarize few things that I found interesting:

The author asks not to use unlisted or private bridges which is contrary to what Matt said in the above mentioned tweet in question.

Harvesting the unlisted bridges: http://hackerfactor.com/blog/index.php?/archives/892-Tor-0day-Finding-Bridges.html

Public bridges: Your Tor connection looks like thousands or millions of other users. This provides safety in numbers. In the worst case, an adversary can see that you are using Tor, but not what you are doing over the Tor network. Moreover, if you disconnect and then reconnect later from a different location, there is nothing linking your new connection to your previous connection; this mitigates the risk from tracking based on the connection method.

Using Tor places you at risk sometimes: China India

If Tor's use can be uniquely associated with you, then you are identifiable. Being identifiable means you may be monitored. How you connect to Tor allows you to be identified. In high-risk areas, using Tor makes you a suspect, and unlisted bridges make you easy to track. However, if you are arrested, then the official charge will probably on a non-Tor related topic (circumventing censorship, spreading unrest, etc.).

Unlisted and Private bridge users are also the most at-risk because they are in censored areas that forbid direct and public bridge connections

If they are blocking, then they are explicitly looking for Tor user.

Internet disruptions in Belarus Internet shutdowns in India

Unlisted bridge set is very distinct and effectively unique

If you configured the Tor Browser to use bridges, then during the startup, it immediately connects to all of the configured bridges. An observer on the network will see connection requests from your current real IP address to the "very distinct and effectively unique" set of bridges. This allows an adversary that is tracking you to know that the IP address making the connection is explicitly you. Combined with historical sightings, they can determine when you first requested the set of bridges, where you were each time you accessed Tor, and where you are currently located.

It doesn't disconnect from an established bridge connection until the browser shuts down. An adversary can see exactly which bridge set you had and to which set you switched.

If all of your bridges match a set of bridges that I collected, then I know exactly which Tor exit node you were using and a timeframe when you were using it. While you are not unique, you are very distinct. This allows me to associate your real IP address with traffic from a known Tor exit node.

Your set of unlisted (or private) bridges is stored to disk. If you use a system that never saves to disk, such as Tails, then you're fine. Just don't re-use bridge sets. But if you use the Tor Browser for the desktop or for mobile devices, then you are unique enough for tracking.

The adversary has placed users in a corner: use Tor with unique tracking attributes, or don't use Tor. (Why are they not blocking all unlisted bridges? Maybe they don't have a LUB yet. Or maybe it is better to track and identify internal dissidents than it is to stop their connectivity. They may be intentionally blocking the safe and anonymous ways to connect to the Tor network in order to flush you out.)

From a practical viewpoint, Tor users should consider the trade-off between discovery and connectivity. If you are in an environment that does not permit direct connections, and does not permit the public bridges, then it probably isn't safe enough to use the Tor network.

The blog post mentions usage of Tor browser which may not be the case when you are using Bitcoin full node with tor proxy on your machine. However lot of things mentioned are important if you are living in an area which has network censored by government regularly.
Source: http://hackerfactor.com/blog/index.php?/archives/893-Tor-0day-Tracking-Bridge-Users.html
Bridges can be configured using Tor browser in Windows or Ubuntu:

Tails OS and few other Linux distros may have different settings to configure bridges: https://tails.boum.org/doc/first_steps/welcome_screen/bridge_mode/index.en.html
If you want to use bridges with torproxy, will have to add few things in /etc/tor/torrc file and you can compare the changes with a torrc file for Tor browser bundle:

Orbot on Android has the option to configure bridges:

Setup docs related to TOR when using Bitcoin Core: https://github.com/bitcoin/bitcoin/blob/master/doc/tor.md


Bitcoind stuck: Lock table is out of available lock entries

Have you updated to the latest client in the 0.8.x series? At a wild guess, it sounds like you're on 0.7.x.


There’s functionally no distinction between an output which doesn’t exist, and one which hasn’t existed from the perspective of validation. The node never needs to consider this so by default it stores no information about it.


What if periodic redistribution of bitcoin had been built in the protocol/wallets?

For example, every month you and every other wallet would pay 20% of their bitcoin evenly to everybody else.

There is a technical issue with this, and a social issue:

Technical: How is it decided where the 20% gets paid to? How do we determine that each actual human being is being paid, and only being paid once? If you agree to centralize the control of this function, it isn't too tough: everyone just registers their identity with the central authority, so that the central authority is solely responsible for ensuring all payments are accurately made.

Of course, this is entirely antithetical to the design of bitcoin: there is no such hierarchy or position of authority in the network. Without the central authority, there is an obvious issue: a single human could just register many different address/devices/IP addresses/etc, to gain more than their 'fair share' of the redistribution**. This is a fundamental problem for decentalized systems, it is not trivial to solve.

Social: It will likely be difficult to convince people to opt into a system wherein they may lose up to 20% of their net worth every month. I think you can set this tax to whatever level and frequency you'd like, but it won't change the situation much.

The function of such a system would depend on the altruistic participation of the wealthy. This is not a stable proposition, we should expect that a wealthy and rational actor may not opt in to such a system, given the choice.

  Would it incentivize more transactions and economic activity?

It would incentivize moving your wealth into a different financial instrument/money.

These two ideas, bitcoin and wealth re-distribution, are inherently incompatible. Bitcoin is entirely opt-in, whereas for wealth redistribution to really work, you need a system which does not allow the users to opt-out.

**Interestingly, bitcoin mining is itself a solution to this problem: users that want to gain the reward must prove that they have spent energy securing the network to do so. There is no way to fake the energy, and spending more energy does not win you a disproportionate amount of the reward. Bitcoin mining is a probabilistic solution to this problem of sybil-attacking the network: the attacker can no longer fake being a large number of nodes on the network, they must spend real resources to participate.


How can a single funded channel become bidirectional?

The amount of inputs of the funding TX has nothing to do with the question if the channel is unidirectional or bi directional.

What is relevant to understand is how the commitment tx encodes the balance of the channel. (the difference between capacity and balance was discussed in this question

In the standard case the balance of the channel gives all the capacity to the party funding the channel. (currently only one party can fund a payment channel but this will change with dual funded channels which are supposed to come with the next protocol update aka BOLT 1.1). So in the beginning of the lifetime of the channel it seems unidirectional as only the funding party can send money by making a payment or routing a third party payment on this channel.

However once that has been done the commitment transaction is invalidated and a new one is negotiated which has a different distribution of the balance. Now the party funding the channel is able to receive Bitcoin on this Channel.

There is one tiny exception: every channel partner must keep 1% of the channel capacity as a reserve for the penalty if a channel brach happens. So if the party that funded the channel makes initially a payment of less than 1% of the channel capacity it still cannot receive on that channel.


Your question is a bit confusing but it sounds like you are asking how to get a currency amount worth of bitcoin.

  I want the user to be able to click the USD price and convert it to BTC instantly.

The answer is simple, division.

<?php
$url = "https://blockchain.info/stats?format=json";
$stats = json_decode(file_get_contents($url), true);
$btcValue = $stats['market_price_usd'];
$usdCost = 200;

$convertedCost = $usdCost / $btcValue;

echo $convertedCost;
?>

http://phpfiddle.org/lite/code/cxsk-b62m

  (If it helps, im a noob sorry)

That's okay. If you're looking to learn more beginner related Bitcoin coding stuff check out this mega-thread at bitcointalk https://bitcointalk.org/index.php?topic=990348.0  It's mostly PHP and JavaScript examples.


Is it possible to transfer Bitcoin from one wallet to another wallet?

Of course you can. You bitcoins are not stored in the the wallet which may be a web wallet, hardware wallet or paper wallet. They are stored on the bitcoin network (the blockchain). The wallet is just a reference.

You can transfer bitcoins from any wallet to any other wallet.


Understanding how validation of a transaction works

Alice creates her digital signature that contains transcation info like id etc.

The digital signature only applies to certain inputs and outputs within the transaction, depending on the SIGHASH type. The default is SIGHASH_ALL, in which case all inputs and outputs are signed by every participant in the transaction (where one participant equals the required keys for an input). It is possible that all participants are actually the same key (or set of keys for a multisig address).

  She encrypts the signature with her private key.

Nothing is encrypted. The signature is over plaintext data, and the signature is serialized into the tx as is. There is no encryption anywhere.

  She creates scriptPubKey and scriptSig, she has the Bitcoin-Adress of Bob.

The scriptPubKey is created prior to the signing, as it is part of the unsigned transaction in the vout. The scriptSig is created using the signature and the public key (when spending a pay-to-pubkey-hash input), or the redeem script (when spending a pay-to-script-hash input). For segwit addresses, the signature and witness program are not serialize within the input, but are added to a special witness field in the transaction.

  The node extracs Bob's Bitcoin Adress from Alice's signature

Bob's address is part of the vout set in the transaction. It is not included in the signature. In certain SIGHASH types, the output is signed and verified by the signature, but it is not included in it.

  a Miner picks this transcation from the mempool.

Every node maintains its own mempool. The correct flow would be:

The transaction makes its way across the p2p network to the miner's node
The miner's node verifies the transaction
If valid, the tx is added to that node's mempool
The tx may make its way into the block template being mined at some point, depending on the fee.

  he creates a Merkle-Tree of several transactions, puts it in a block. Uses SHA-256(Blockhash+nonce) and tries to mine.

Only the merkle tree root is added to the block header.

The hashing operations are performed on the block header, which contains the nonce.

The merkle tree is not stored anywhere. When needed, it is constructed from the list of transactions in the block.


Why is a "bad" locktime ok as long as all sequences are final? The tx won't be mineable anyway, right?

According to BIP 68, setting nSequence value to 0xFFFFFFFF for every input in the transaction disables nLocktime. So, whatever may be the value of nLocktime, it will have no effect on the transaction as far as nSequence value is 0xFFFFFFFF.

  What are the implications for replace-by-fee and Check Sequence Verify transactions (when a non-final nSequence value is used)? Does this mean that to use those features, nLockTime has to be set a certain way?

It considered a transaction has opted in to allow replacement of itself, if any of its inputs have an nSequence number LESS than 0xFFFFFFFE. To use CSV your nSequence value has to be <= 0xEFFFFFFF. If nSequence value > 0xEFFFFFFF, then there us no consensus meaning to the sequence number and it can be included in any block under all currently possible circumstances. So for using nLocktime along with Opt-in RBF, your nSequence value has to be between 0xF0000000 to 0xFFFFFFFD. Refer this for more info on nSequence and how it has evolved in the last few years.

  Or, maybe, because nLockTime has to be below the current time/height anyway, this is all just moot and really, nSequence doesn't really impact transaction finality at all..

nLocktime is a transaction level feature while nSequence is an input level feature. So, the program basically is optimized so that individual inputs are not checked if the transaction itself is invalid due to nLocktime. If you check the function below IsFinalTx, it checks the validity of each transaction inputs by verifying that the nSequence numbers are valid.


Importing private key for watched address in bitcoind, rescan necessary?

No additional rescan is required in that case.

Though there is a little bug in Bitcoin-Qt: the balance will not get properly updated if you import a private keys where you already have a watch-only script.

Bitcoind (listtransactions, getbalance, etc.) are not affected.


How to send bitcoins with commission extracted from payment in PHP or bitcoind

Here is the algorythm without the code:

createrawtransaction with amount that you want to send assuming that fees are 0
fundrawtransaction to let your bitcoind construct final transaction, put your change address (on where you get change from unspent transaction - very important!) AND to caclulate fees that will be taken of your account for this transaction.
Substract caclulated fees from initial amount
Repeat steps 1-2 with new lowered amount.
Profit.

And here is the PHP code.

We will need function to create and fund new transaction

function prepareRawTransaction($amountToSend, $addressToSendTo) {

    $bitcoin = new Bitcoin('bitcoinrpc', 'xxx');

    $collectedAmount = 0;
    $sendToArray = [];
    $sendToArray[$addressToSendTo] = $amountToSend;

    $unspentTransactions = $bitcoin->listunspent(); //First we find out all our unspent transactions from where we can withdraw
    $collectedTransactions = [];

    foreach ($unspentTransactions as $unspentTransaction) {

        if ($collectedAmount < $amountToSend) {
            $collectedTransactions[] = [
                'txid'  => $unspentTransaction['txid'],
                'vout'  => $unspentTransaction['vout'],
            ];

            $collectedAmount += $unspentTransaction['amount'];
        } else {

            break;
        }
    }

    //Now we create raw transactions
    $rawTransaction = $bitcoin->createrawtransaction($collectedTransactions, $sendToArray);

    //And fund it
    $newTransaction = $bitcoin->fundrawtransaction($rawTransaction);
    return $newTransaction;
}

Now we can use that function to go on algorythm

$bitcoin = new Bitcoin('bitcoinrpc', 'xxx');

$amountToSend = 0.09999556; //That's exact amount that we want to send INCLUDING commission
$addressToSendTo = '2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF';

//createrawtransaction with amount that you want to send assuming that fees are 0
$transactionWithoutCommission = prepareRawTransaction($amountToSend, $addressToSendTo);

$decoded = $bitcoin->decoderawtransaction($transactionWithoutCommission['hex']);
print_r($decoded); //You can see that fees now set up

//Substract caclulated fees from initial amount
$amountToSend =  $amountToSend - $transactionWithoutCommission['fee'];

//Repeat steps 1-2 with new lowered amount
$transactionWithCommission = prepareRawTransaction($amountToSend, $addressToSendTo);

$decoded = $bitcoin->decoderawtransaction($transactionWithCommission['hex']);
print_r($decoded); //Here you can see that total amount + commission equal needed amount

$signed = $bitcoin->signrawtransaction($transactionWithCommission['hex']);
print_r($signed); //should say complete:1 if everything was correctly put

$published = $bitcoin->sendrawtransaction($signed['hex']);
print_r($published); //will output you tx id

And profit: you have sent exactly the amount you wanted INCLUDING the commission


sendrawtransaction creates hash but does not propogate to the network

When using sendrawtransaction if the hash is generated but not propagated, then first I would assume that bitcoind retry mechanism will eventually send to the network.

On build 8.99 the transaction will go through, AcceptToMemoryPool. Which will validate the tx. So unless you see error TX rejected 22, which could be anything, as the validation is not yet reported. Then it's safe to assume you just need to wait.


Can a Bitcoin wallet be identified as belonging to an exchange?

Yes, in theory is possible to guess the ownership of an address to an Exchange.

Notice that I said in theory and I also mentioned that it's a guess. That's because per design each address is anonymous. However, since the blockchain is public, you can analyze the type and amount of transactions getting in and out a specific address and make assumptions based on patterns.

An exchange has generally a large amount of transactions. If they use a finite amount of addresses, eventually transactions will reuse existing addresses.

If you provide a tool or a way for people to publicly share/associate specific addresses with Exchanges, then eventually you will build an archive of matches. I believe this is what Etherscan does.


Chain.com offers OP_RETURN data for addresses, transactions and blocks.


Key exported from BitcoinJ is different from the key shown by bitcoind

Sorry I have found the solution. The dumped privkey is not comparable to the address. If I want to use the dumped format, I have to use the class DumpedPrivateKey.

Thanks for the help!

After  Aussie Cryptocurrency's request, I am pointing out the problem in the code.
What I was doing was trying to import the private key of the 'from' keypair using bitcoin-cli. However, it is important to know that such operations must be run using DumpedPrivateKey: this class can manage private keys in the format that bitcoin-cli likes, whereas in my previous tests I was trying to import the private key simply Base-58 encoding the private key. The odd thing is that if you do so, the key seems to be imported, but the private key is completely different to the expected one.

Hope this helps.


As of 2017 is it still possible to get a transaction confirmed without a fee?

The Bitcoin consensus rules do not require transactions to have a fee, so it's still theoretically possible for a free transaction to be confirm.

It is, however, unlikely that any miners today will confirm free transactions.  You can test this by sending yourself a free transaction to see if it confirms (but be sure you use a quality wallet, such as Bitcoin Core, that has features for handling transactions that never confirm).


What is the maximum anonimity set of a CoinJoin transaction?

Regardless of the maximum size of a single transaction, a CJ anonymity set can be made arbitrarily large (bounded, of course, by participants) by building a multi-stage switching network out of joins.

This was described in the original coinjoin post:

  In particular, if you can build transactions with m participants per transaction you can create a sequence of m*3 transactions which form a three-stage switching network that permits any of m^2 final outputs to have come from any of m^2 original inputs (e.g. using three stages of 32 transactions with 32 inputs each 1024 users can be joined with a total of 96 transactions).  This allows the anonymity set to be any size, limited only by participation.

There is no atomiticy required between these transactions-- other than if some users drop out the anonymity set will be less than expected.


Pregenerate multiple receiving addresses

Better use this software:

https://github.com/samr7/vanitygen

You can easy generate any amount of bitcoin's addresses:

# time for((i=0;i<250;i++));do ./vanitygen 125; done > 250_new_addressess.txt
real    0m9.437s
user    0m2.020s
sys     0m0.316s
# cat 250_new_addressess.txt
....
....
Address: 125r2fVnSXd6BtF66kTi83DuRzgzJmshPF
Privkey: 5JMqHqGccJjNz48izM6CEdDrTJ9P8DYRXQ96wcZhn86MWutECo1
Pattern: 125
Address: 125URJpbqr5eANYfLrhQVinQeexy2WfdhW
Privkey: 5Kh9eqyJQNzxCWMtfX1r6cPjAdmqJnZEceV8WmwRjYunHqTk7Hu
Pattern: 125
Address: 125wwU55kXQgDQYd8fQySNLQKS8AdRUote
Privkey: 5JZjn5sPnSqjbtBuXpuKcVDRa4bR5vxzWUZ9LCHsiscixBSyuGt
Pattern: 125
Address: 125N16rwWHgVWnAZYpz5XBvWptRhJ6iBKg
Privkey: 5KhX1Y1WjCu3dpHB2DPWt6f2mRFeMJCtkYZK66ApxTDM2iHMSM7
Pattern: 125
Address: 125HjL2QSCSUQHNExbMoSAUhHsz4GBuz3w
Privkey: 5JtMy31VbfK5xLtcwmALMjQj2WPMd6eLDe7tJR6T9bjwRwiimbW

Thereafter, import private keys one by one into the bitcoind:

# bitcoind importprivkey <bitcoinprivkey> [label] [rescan=true]

For example:

# cat 250_new_addressess.txt  | grep "^Privkey" | awk '{print $2}' | while read i;do bitcoind importprivkey $i "250 new addresses"; done

Additionally,

If you doesn't looking for "named" address, like 1uckyboyPT44PWgA5bu4NtxFMuCN or something or have no resources to generate cool named bitcoin address.

Then you can easy get any amount of address just by bitcoind the same way:

$ time for((i=0;i<250;i++));do bitcoind getnewaddress "250";done
real    1m48.950s
user    0m0.612s
sys     0m0.432s

Its pretty fast.


Interested to find a good resource with all active bitcoins exchanges

Cryptonator looks like a good start.
Find all exchanges for a particular trading pair.
https://api.cryptonator.com/api/full/eth-btc

Then swap out the eth with whatever currency you're looking for.

Cryptonator says this is all their supported currency pairs (https://www.cryptonator.com/api/currencies) but looks like it includes some dead coins. You could loop through that URL and for each record, input the symbol into the original https://api.cryptonator.com/api/full/eth-btc end-point.

https://api.cryptonator.com/api/full/ltc-btc
https://api.cryptonator.com/api/full/dash-btc
...and so on.

Once the loop is through you should have all pairs and all currencies, or at least all the ones cryptonator has.


Why are people creating so many coins and can all of them sustain?

Many other crypto currencies are inspired by bitcoin, but have a goal that differentiates them from bitcoin. For example, litecoin was design to combat the development of ASICs, so that people with regular computer hardware can mine them. Namecoins provide secure key-value pair storage, and devcoins are somehow used to fund open source endeavors. Others just want to piggy back on the success of bitcoin.

The success and sustainability of these other currencies (often called altcoins) depends on whether or not you can convince others that they are valuable. For example, Namecoins are gaining popularity because you can buy .bit domain names with them.

Many altcoins will likely remain worthless forever, but people will assign a value to some, and those may be sustainable.


Is there any way the Bitcoin network could resist a viral tainted-coin tagging system implemented by regulators?

I don't think the scenario is realistic because it would only punish innocent people. By the time coins could be marked as tainted, they would already be in the hands of innocent people. Governments don't do similar things with other currencies. For example, if you deposit dollar bills in a bank that turn out to have been stolen, the government could charge the bank a "fee" to clean the bills which the bank could pass on to you. But governments don't do that because they recognize that by the time the bills could get on a "hot list", they're already in the hands of innocent people.

There are also specific features of Bitcoin that make this difficult. Transactions put all the input Bitcoins into a big pile which they dole out as outputs. There's no concept of particular output Bitcoins corresponding to particular inputs. Bitcoins don't have a serial number that can be traced through the block chain. So any such tracking rules would be basically arbitrary.

It's just not something realistic. It's more realistic with physical currencies which have serial numbers and are widely used to facilitate crimes and buy contraband. And governments don't do it with physical currencies -- largely because they know it would only punish the innocent.


Given the current situation, what currently available Bitcoin clients are the most likely to follow the longest chain one month from now?

We don't know what will happen, therefore it is hard to say which client will be on "the longest chain".

Core is scool with bip141, so it will follow that.
Segwit2x hard fork will be using BTC1.
USAF could hard fork as well so that client will be for that chain.
BItmain's BitcoinABC will have their own client (I'm not sure what that client will be/is called).


What is the public key used to generate the Genesis block?

Second one is the latest usage before it being totally removed from the source code.

It wasn't removed. It just got moved:

static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

(Source.)

If you mean "Is it the key that he used to sign announcements and emails," no. That's the PGP key 5EC948A1. If you mean, "Is this the key that can broadcast alerts," no. That's defined here:

https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L90

The key is thought to belong to Satoshi Nakamoto, though.
It's useless. You don't actually need the private component of the key to generate or verify the genesis block. And, like you say, you can't even spend the associated Bitcoins. For all we know, it might just be a random point on the ECDSA curve, with no associated private key.
This appears to be a normal uncompressed key. It starts with 0x04, followed by 64 bytes. The difference in how it was expressed between 0.1.5 and 0.8.0 is just a result of endianness. As for how to generate it, just call getnewaddress followed by validateaddress on the result.
Nothing.


Signing a raw transaction with multiple inputs

and other input(s) should have "00" in place.

Keep in mind that you replace the "scriptsig" with "empty" and the 0x00 is the size of the empty script.

  non-mandatory-script-verify-flag (Non-canonical DER signature) (code 64)

The problem here is the DER encoding used in your signatures. r values in a signature are positive and since each r value that you have has its most significant bit set they need a preceding 0x00 to tell the DER-decoder that the numbers are positive:

0xE4 = 0b11100100
0xC4 = 0b11000100

Each signature should change to this: 483045022100E4A3...


Retrieve all Unspend Output given a priv key

generally speaking the answer is no: you should generate every public address to check it's balance and the possible addresses are too many to be checked all.
in your case, if you remember the wallets where you imported the keys, you can only check the derivation paths used by them.
even the addresses that can be generated from the first branch of the derivation path are too many to check them all, the wallets usually stop generating public keys to be checked when they find a certain number (which varies depending on the wallet, usually a few thousand) of unused addresses in a row.
so in case you have large blocks of unused addresses among the addresses used, you can't even trust the automatic wallet balance check for it's specific derivation path, but you should generate other addresses on your own to verify their balance.
this is a very rare case that hardly occurs in real life, but it is good to know anyway.


Paxful has withdrawal fees, as any other exchange or Bitcoin service that I am aware of: sending bitcoin is costly, so it will be very unlikely that some company will send you btc without charging a fee.
This is from Paxful Fees webpage:

So Paxful charge you with 0,0004 btc if you withdraw more than 20$, which is usually more than you have to pay to send a standard transaction with Electrum.
As a side note I tell you that in the last few days Bitcoin network fees went crazy, a sharp hashrate reduction has created a long queue of pending transactions and sent commissions to the highest level for 3 years now; so right now you can pay more than 0,0004 btc but it's a very rare case as you can see at this historical chart: https://jochen-hoenicke.de/queue/#BTC,all,count


Bcoiner wallet - balance is showing as zero?

Whats happening here

As others have commented, the money was received by the address in your wallet but was subsequently spent.
Since your wallet doesn't show the expected balance but also does not show the spends it seems there is some flaw in the app or in the service behind it. Whether this is a malicious flaw is impossible to say.
Since you didn't spend that money, someone else must have. That suggests the wallet has been compromised or the underlying account in the bcoiner service has been compromised.
Since bcoiner support have been unable to resolve this to your satisfaction, it might be prudent to avoid putting any more money into this wallet.

The bcoiner wallet is not an app I personally would use for the following reasons:

Unresolved woe - There are several stories similar to your own on this website. All wallets have some such stories associated with them but most also have some history of such problems being resolved or being found to have a more reasonable explanation than possible theft by app developers.

Suspicious review profile = Profile of reviews on Google Play seems suspicious to me. There are many 5-star reviews obscuring 1-star reviews (mostly similar experience to yours) and not much in between. Either this is a great wallet with some flaws or somebody is submitting fake 5-star reviews in a way that Google Play doesn't detect. The developers responses to the 1-star reviews are rather uniform and unhelpful. The evidence here is very weak, but I'm inclined to be cautious when choosing software that has control over money.

Custodial? - I have seen allegations that this is a custodial wallet. I would not want to use a custodial wallet.

Not open-source - It is proprietary closed-source not open-source, I prefer open-source wallets.

In the end I suggest you make a decision based on the quality of support you receive from bcoiner developers and from the community of bcoiner users.

It may be worth searching this site for other questions about bcoiner and using that information to help you to decide what action to take and whether to select a more popular and better supported wallet app.

Appendix - Google Play reviews:

Bcoiner - too good to be true? surprisingly polarised?

Mycelium

Blockchain (their non-custodial app, not their custodial wallet service)

Bitcoin Wallet (Schildbach)

Electrum - A formerly well-regarded wallet afflicted by a security flaw and a badly received recent update?

I found it revealing to actually read the reviews sorted by newest first and get a feel for the range of feelings expressed and the variety of subject matter and writing styles. Doing this for several wallets gives you an impression of what is normal and what is not.


Can a 2 of 3 multisig transaction signature be revoked before it gets confirmed by the miners?

The problem is that you can't broadcast just a signature. You can only broadcast a complete transaction with enough signatures to make it valid. Likewise, there is no way to revoke a signature. The only way to "cancel" a transaction is to broadcast another transaction which spends the same input as the original transaction. After that, there is a chance that the new transaction will be confirmed instead of the old one.

There is no point in having 2-of-3 address if there is one person who has 2 keys. That person can spend any money from such address, and the person who has the third key can't spend anything without the other person's assistance. In your scenario, Bob can double-spend his payment before it is confirmed by using both of his keys.

To solve the problem, you need to use such an address that Alice's signature is required to spend from it. For example, 2-of-2 address will work. To make sure that Bob can have his money back if the deal doesn't go through, you can use the approach described here.


Does the original Bitcoin client scale to contain millions of addresses?

I've ran tests before on .5 million addresses generated in one afternoon. It fired walletnotify within the milliseconds, no noticeable delay when I sent an amount to a random address. Only noticeable thing was that the client took 30 minutes to start up, which I guess is fine if you run a larger service. Only thing that may trouble you is slow transaction creation time, but someone on here advised me to just move the funds into a new address monthly.


How do Bitcoin transactions work, and what does one need in order to send or receive one?

You are using some Bitcoin vocabulary, but you are jumping to conclusions that aren't correct.

Quick vocab session:

Addresses can be used to receive payments.
Wallet is a term used for a collection of addresses.
The sender needs to sign a transaction using a private key

When you receive a Bitcoin transaction, you don't have to sign anything. In a transaction the recipient is passive, similarly to receiving a letter in the mail he doesn't have to do anything at all. Whenever he looks at his mailbox at a later point in time, the letter will wait for him; whenever you check the blockchain your address will have a balance associated with it.

The recipient of a Bitcoin transaction doesn't even have to be online at the time of the transaction. However, he does need to have a Bitcoin address, where the payment may be directed.

The identifier you are asking about seems to be such an address. The good news is, you can have as many addresses as you want.

Wallets are essentially an abstract construct to talk about a collection of addresses. It cannot be discerned from the addresses alone that they belong to the same wallet, so you don't necessarily give up a lot of information when you have several addresses in the same wallet.
However, by analysing interactions between addresses it is possible to guess that they are controlled by the same entity, e.g. guessing which transaction output is the change from a transaction, or funds being spend from different addresses in one transaction.

See What's the difference between a wallet and an address? for more information about that.

Concerning anonymity, I'd suggest having a look at How anonymous are Bitcoin transactions? and the tag anonymity.


Static receive address instead of dynamic?

You can certainly give out the same address to as many people as you want.  An address is really just a representation of the public part of a cryptographic key pair, and you will still have the corresponding private key.  That means, the address will still function, regardless of how many times you use it to receive money.

However, as the app tells you, this is not recommended.  The reason is privacy.  Remember that the blockchain is public, and your addresses are unique.  When you give out an address, you are telling that person that this address is associated with your identity.  They can then look up that address on the blockchain, and see how many other times someone has given you money through that address...and how much.

If you have given the same address out to a lot of people, then a lot of people can do this, and there's a lot more data for them to see.  This can then be used in conjunction with other blockchain analysis techniques, and you end up with a lot of people being able to gleam insights into where you get your money, how much money you have, and where you spend it.  In short, you are giving up a great deal of privacy.

On the other hand, when you use a new address every time, you are giving away very little information to people paying you.  If they look up the address, they will see that it is a completely new and never before used random number.  They will not be able to determine how many other people have been paying you, and far fewer people will know that this particular address is tied to your identity.  Blockchain analysis can still determine a few things, but with a lot less data to start with, the results won't be anywhere near as complete as they are when you reuse addresses.

Unless there is some important and unique benefit you get from reusing addresses, you really shouldn't.


Are there any math contests paid in Bitcoin?

There is a site where one can submit bounties for proofs of theorems in Coq formal proof management system, and get paid in bitcoin:

proofmarket.org

Additionally there are other sites that have done competitions in the past:

mathgate.info treasure hunt

Another project in development (but at the moment not specifically tied to bitcoin) is ProofPeer

Additional information about these proof markets can be found in this article:  http://blogchain.fr/programmarket-en/


Is there a way to set up proof-of-work systems so they would be even more useful?

I think the premise of the question is not correct. The work is not useless, it secures the transactions. The public hash chain ensures that Bitcoins can only be spent once. The mechanism piles computations on top of legitimate transactions so that the recipient knows that an attacker would need at least as much computing ability to "undo" the transaction.

There is currently no known way to make the work more useful. The problem is that the primary purpose of securing transactions imposes a number of requirements on the work done:

The work must be much, much easier to verify than to do. So it pretty much has to consist of searching for something rare, doing billions of searches to test if an input has a particular characteristic. That way the verification simply requires confirming that the input you found has that characteristic.
The work must in fact secure the transactions and not be severable from them. If I see that you sent me 10 Bitcoins and then billions of computations are piled on top of that, it must not be possible to remove that transaction and then pile those same computations on top of a conflicting transaction. So you can't use the result of an arbitrary chunk of work to prove work on the Bitcoin chain.

It's hard to imagine any additional useful work that could be accomplished while still meeting these requirements.


The coinbase mentioned in BIP34 is not the company; it is referring to the first transaction in a Bitcoin block (which is special as it is allowed to bring new currency into circulation).
Coinbase-the-company didn't even exist when BIP34 was written (or at least, wasn't known/public). The company was named after this special transaction.


what happens if a miner include a transaction already exists in another block?

It can only exist in one block.  That is why it is safer to wait for 2-6 confirmations before accepting a large transaction.

So to answer the title of your post - a miner can't include a transaction which exists on another block in the same chain since it would not be a valid block.