reversing wallet to wallet transactions(both wallets mine) I sent BTC from my coinb.in wallet to an electrum wallet on a tails drive, but I didn't realize it was the tails iso disk, and while waiting for confirmations, I noticed id' used the tails iso disk after the transfer but before I could get confirms and send BTC back to the coinb.in wallet, Tails froze.
So I had to reboot and that meant the tails iso disk went back to default, and the electrum wallet disappeared, so the BTC are stuck in blockchain because there weren't any confirms.
There's got to be a way to reverse so the coins go back to my coinb.in wallet. Both wallets are mine, so, it would seem like the transfer could be returned/reversed as there's no merchant and its not a refund. Thanks

The "owner" of a wallet is defined by whomever controls the private keys in that wallet.  If you have lost control of a wallet (the one on the ISO disk), then you are not the owner of that wallet anymore.  Nobody is.

If the transaction to the new wallet has not yet been confirmed and put into a block, you might have the option of replacing that transaction with one that goes back to your coinb.in wallet.  That depends on two things:

The transaction you want to replace has opted-in to Replace-by-fee
Your original wallet (coinb.in) allows you to use Replace-by-fee to broadcast a new transaction, replacing the original one

You can read more about it here:  https://en.bitcoin.it/wiki/Transaction_replacement


Can I monetize "crypto" using asset backed securities? A friend of mine wants to create "tokens" signifying the completion of certain corporate milestones, e.g., the acquisition of X customers, and then "monetize" these "crypto" tokens as "asset backed securities."

Is this possible, and if so, how, and with whom?

A friend of mine wants to create "tokens" signifying the completion of certain corporate milestones, e.g., the acquisition of X customers,

This is possible, Bitcoin (and some other cryptocurrencies) allow users to create 'non-fungible tokens', which can be individually tracked through the blockchain history.

  and then "monetize" these "crypto" tokens as "asset backed securities."

An 'asset backed security' generally refers to:

  a financial security collateralized by a pool of assets such as loans, leases, credit card debt, royalties or receivables.

So I'm not sure how a 'corporate milestone token' would satisfy this definition. If there were some monetary reward available for redeeming said tokens, perhaps that could loosely fit, but in that case this seems like a very contrived system to build. Why not just issue the reward directly to the recipient in the first place? If you have to trust the corporation to pay out your reward, why not just trust them to keep a version-controlled excel spreadsheet with all of the data stored in it? That would be a much cheaper and easier system to implement.


using rpccookiefile instead of username and password for antminers I mine using username and password at the moment but as bitcoin core is changing over to rpccookiefile. My question is, if i use rpccookiefile how do i point my antminers to my local bitcoind 'pool' as the fields on the antminers require username and password ?

The RPC cookie file is only for local authentication of bitcoin-cli.

For external applications, you should use rpcauth= lines in bitcoin.conf. A tool for generating these lines given a username and password is in the repository.


How do I build and review a Bitcoin Core GUI pull request? I am a designer and I would like to start reviewing pull requests (PRs) in the Bitcoin Core GUI repository.
How do I build the adjusted Bitcoin Core GUI in the pull request? I am used to just double clicking on an application icon to open the GUI.

It is difficult to answer this question as I don't know what your current skillset is. You will need some basic command line and Git experience and you will need a GitHub account. I will assume these as prerequisites for the sake of brevity.
(There is a great free introduction from Tracy Osborn to command line here. There is a free Codeacademy course on Git here.)
I will take an example PR from the Bitcoin Core GUI repo (PR 86) which was opened by hebasto, a Bitcoin Core contributor, adding a Tor icon to the GUI. At the time of writing (September 2020) it is open but it will hopefully be merged in the near future. Once it is merged hebasto may delete this branch (200902-tor) but this example will be illustrative regardless. You need to locate and build the branch that the PR author has been working on.

To build hebasto's PR branch (200902-tor) you can click on it and then you will be on hebasto's fork of the Bitcoin Core GUI repo. You will need to clone hebasto's fork. You do this by clicking the green Code button and then clicking on the link you need to clone. In this case it is https://github.com/hebasto/gui.git.

Once you have the link you need to clone go to your Terminal and use the git clone command. In this example it will be:
 git clone https://github.com/hebasto/gui.git

Before you clone it you can choose where to clone it. Using mkdir and cd commands you can make a new directory and change to that directory before you run the git clone command.
Once you have successfully cloned hebasto's fork you can checkout hebasto's PR branch (200902-tor) using:
git checkout 200902-tor

Now you are ready to follow the Bitcoin Core build instructions for your operating system e.g. (MacOS, Unix, Windows etc)
If you are building the GUI remember to use the --with-gui flag when you ./configure.
For more detailed guidance on reviewing Bitcoin Core PRs see this excellent post from Jon Atack.


How to search for an address in last block? I want to check in bitcoin-core and see if there is any of my watching addresses in last block.
So my question is how can I know a specific address is included in last block or not?
I can search with getblock <hash> 2 but it returns only addresses in vout and I need the ones are in vin too.

If you have txindex enabled and are using a Linux, debian-based machine, install jq: sudo apt install jq
and save this script somewhere as "any-name.sh":
#!/bin/bash

BLOCK_HASH=$(bitcoin-cli getbestblockhash)
BLOCK_TEMPFILE=bestblock.json
VIN_TXNS_TEMPFILE=vin_txns.temp
VIN_N_TEMPFILE=vin_n.temp

# Check if all temp files and addresses file exists, and delete them if they do before recreating them.
if [ -f "${VIN_TXNS_TEMPFILE}" ]; then
  rm ${VIN_TXNS_TEMPFILE}
fi

if [ -f "${VIN_N_TEMPFILE}" ]; then
  rm ${VIN_N_TEMPFILE}
fi

if [ -f "${BLOCK_TEMPFILE}" ]; then
  rm ${BLOCK_TEMPFILE}
fi

# Get the block information in JSON format
bitcoin-cli getblock ${BLOCK_HASH} 2 > ${BLOCK_TEMPFILE}

# Get the block height for use in address file name
BLOCK_HEIGHT=$(jq ".height" ${BLOCK_TEMPFILE})

# Check if the address file exists. If so, we do not need to run the script again.
ADDRESSES_FILE="Block_${BLOCK_HEIGHT}_Addresses.txt"
if [ -f "${ADDRESSES_FILE}" ]; then
  rm ${BLOCK_TEMPFILE}
  exit 0
fi
touch ${ADDRESSES_FILE}
touch ${VIN_TXNS_TEMPFILE}
touch ${VIN_N_TEMPFILE}
touch ${BLOCK_TEMPFILE}

# Get the block transaction ID's, excluding the first transaction (coinbase)
jq ".tx[].vin[].txid" ${BLOCK_TEMPFILE} > ${VIN_TXNS_TEMPFILE}
tail -n +2 "${VIN_TXNS_TEMPFILE}" > "${VIN_TXNS_TEMPFILE}.temp" && mv "${VIN_TXNS_TEMPFILE}.temp" "${VIN_TXNS_TEMPFILE}"
sed -i 's/"//g' ${VIN_TXNS_TEMPFILE}

# Get the block transaction n's, excluding the first transaction (coinbase)
jq ".tx[].vin[].vout" ${BLOCK_TEMPFILE} > ${VIN_N_TEMPFILE}
tail -n +2 "${VIN_N_TEMPFILE}" > "${VIN_N_TEMPFILE}.temp" && mv "${VIN_N_TEMPFILE}.temp" "${VIN_N_TEMPFILE}"
readarray -t n_vals < ${VIN_N_TEMPFILE}

# Delete the vin n tempfile
rm ${VIN_N_TEMPFILE}

# Get the block txout addresses
jq ".tx[].vout[].scriptPubKey.addresses | .[]?" ${BLOCK_TEMPFILE} > ${ADDRESSES_FILE}

# Delete the block tempfile
rm ${BLOCK_TEMPFILE}

# Get each transaction's vout addresses
i=0
while read line; do
  val=${n_vals[${i}]}
  echo $(bitcoin-cli getrawtransaction "$line" true) | jq ".vout[${val}].scriptPubKey.addresses | .[]?" >> ${ADDRESSES_FILE}
  let "i=i+1"
done < ${VIN_TXNS_TEMPFILE}

# Delete transaction IDs tempfile
rm ${VIN_TXNS_TEMPFILE}

sed -i 's/"//g' ${ADDRESSES_FILE}
awk '!a[$0]++' ${ADDRESSES_FILE} > "${ADDRESSES_FILE}.temp" && mv "${ADDRESSES_FILE}.temp" "${ADDRESSES_FILE}"

Make the script executable: chmod +x any-name.sh
then you can run the script with ./any-name.sh . Keep in mind that this script takes several minutes to complete. I run a node on a raspberry pi 3b, and this script takes ~4 minutes to complete.
Script explanation:
The vins from the most recent block contain a transaction ID as well as the vout index from that transaction that's being spent. We can use the command bitcoin-cli getrawtransaction <transactionhash> true to print JSON information from the transaction as long as we have txindex enabled. This information includes, most importantly for us, the address that is being spent (and "null" if the address being spent is not a standard address type). So for each vin in the block, we find the relevant transaction, and get the address at the specified vout index.


Researching Bitcoin Wallet clients to use? Which one provides the best peace of mind? So far I've just been using Bitcoin-Qt for win7 and the regular android bitcoin wallet from andreas. But now I want to store my bitcoins in a safe place and I'm not sure which wallet client I should go with as there seems to be a bunch on the market now. Electrum, Bitcoin-QT, Armory, Blockchain.info, Mycelium (android), Trezor, and others.

I just want to store my bitcoins in a safe place where even if *I never update the client app * I can still send/receive my bitcoins in the future even if the code changes or what not. Obviously there is always the worst case scenario if one day one of the client developers decided to be malicious and write code that sends everyone's bitcoins to their own address.

I think I'm going to just get a separate phone just to store the bitcoins instead of having to get an entire separate laptop to store it. Its just im afraid one day if the apps get outdated and the developer stops supporting it, would that affect the btc I have stored on there?

From this description, rather than choosing the best client to use, you should simply export your private keys to a wallet file. At any point in the future, you can load your wallet file into any almost any client and access your bitcoins.

Not all clients currently allow you to do this, notably the Bitcoin Wallet app on Android by Andreas Schildbach. In this case, you should send your coins to another address created with Electrum, Bitcoin-QT, Armory or Blockchain.info as all of these allow you to export your private keys. There are other apps/web apps that allow you to expot you wallet, these are just the ones that you mentioned that I know can do it.

Once you export you wallet containing your private keys, you can keep it on any device. You don't necessarily need to buy a new laptop or even a phone. A simple USB key could work and you could load the keys from it onto any computer any time you needed to spend your funds.

Alternatively, you don't even need a client application. It's possible to generate a public/private key pair outside of applications connected to the block chain. And any bitcoin sent to the public address will be available using the private key. But, I wouldn't recommend this unless you really know what you're doing. If you don't do this in a cryptographically secure manner, someone else could generate the same public/private key pair and access your bitcoin.

Update:  The Bitcoin Wallet app on Android by Andreas Schildbach does, in fact, have an export option.


Help understand multi-signature transactions I'm not a technical guy by any means, and I'm having alot of difficulty understanding Multi-signature Transactions.

Would an expert have time to try to "dumb down" the basics for me using some sort of analogy?

I'm really sorry if this has been addressed before but it is still escaping me.

I really appreciate any help.

A multi-sig address is created in a deterministic manner using the parameters and addresses which can spend funds from the account.

For example:

I would like to sell you a GPU, but we do not know each other
We find an escrow service (or common contact to serve as escrow) we both trust
We create a multisig address with parameters 2 signatures required < your address > < my address > < escrow address>, the address is deterministic so we will both get the same address
You send coins for the GPU to this address, I verify the coins are received and ship the GPU to you
You receive the GPU and create a transaction paying out to < my address > and sign it with the key for < your address >, I sign the transaction with < my address > and broadcast it to the network
If there is any dispute (e.g. you don't receive the GPU or it arrived not as described), you contact the escrow agent and if he agrees with your case, he creates a transaction sending the coins to < your address > and signs it with < escrow address >, you sign the transaction with < your address > and broadcast it to the network

Since 2 signatures are required any dispute must be settled by the escrow, and you get to choose your own escrow. If we both agree to on where the funds should end up then escrow is not needed.


Gridseed USB ASIC Won't Mine Bitcoins Okay so I have done my research, I have practically tried everything. It just frustrates me because mining LTC was a piece of cake but I can't seem to figure out how to mine bitcoins which this device says it can do bitcoins plus dual mining.

I have tried BFGminer but it seems not to detect my gridseed unless I am mining LTC. Then I tried CPUMiner and it works except it gets invalid all the time its like its using the wrong algorithm but I tried the -a sha256d and still produces the same issue. Can somebody help me I have the drivers installed and my usb Gridseed miner is on COM6. I have also tried CGMiner and it says cannot detect any USB devices.

I have tried every possible thing that comes up on the first few Google Results. I am not exactly new to mining as I have done Scrypt mining fine with this device.

Here is the product.

I found this link apparently cgminer doesn't like usb3 according to the forum post don't know why I thought usb3 is backwards compatiable. But I tried thinking this is bull but it worked.


Why lightweight nodes are less secure? as you know there is two main type of wallets:

full node and

light node

I've read in some advice that just using full node for more security stuff
and the next question is what is the type of blockchain.com wallet?
many thnx :kiss:

Why lightweight nodes are less secure?

A lightweight node is less secure because it doesn't store its own copy of the entire blockchain.

This means it cannot verify for itself the integrity of incoming blocks with complete certainty. It generally has to rely on the integrity of an external server for at least some starting block. This is the kind of trust of third parties that Satoshi Nakamoto was trying to avoid when creating Bitcoin.

  and the next question is

One question per question. Please use the "Ask Question" button at top right to ask a new question. You can include a link back to this question if it helps clarify your next question.


Why is the target truncated? Reading the docs on target:

  The maximum target used by SHA256 mining devices is:

  0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

  Because Bitcoin stores the target as a floating-point type, this is truncated:

  0x00000000FFFF0000000000000000000000000000000000000000000000000000

I know that the purpose is to force miners to generate hashes with a value lower than the target. But the docs are vague, why is this truncation required? And then, why truncate after the first four Fs?

Target is stored in block header (it's called Bits), and it takes only 4 bytes. We derive target 256-bit value from these 32 bits. That's why it is getting truncated.

There is no need to store all 256 bits, or even 224 bits (if we assume first 4 bytes are zero). We don't need such precision.

You can read in wiki, how target is getting calculated from Bits.

You can also check my answer here, with example:
How does difficulty is defined for block '55798'?


Imported bitcoin address A person I met online asked me to pay small miner fee to get big funds in bitcoin. After sending him the fee, he injected huge funds into my bitcoin wallet, which fell into a bitcoin address imported into my wallet. But now I cannot send these bitcoins, if I want to transfer it is asking private keys, but I don't have private keys, what shall I do to transfer imported bitcoin to my wallet?

imported bitcoin address which I can not transfer to anybody, if I want to transfer it is asking private keys, but I don't have private keys

It sounds like you have imported the address as a watch-only address, meaning your wallet watches for transactions involving it, but as you say, cannot spend any coins because it doesn't have the private key. This would have happened if you had used importaddress instead of importprivkey. Without the private key you do not own those bitcoins, you are simply looking at someone else's transactions.


Why do we need CCoins in addition to CTransactions? As per my understanding CTransactions represents the atomic unit in Bitcoin. It has the inputs CTxIn and outputs CTxOut.

Can any expert give the intuition of why we need CCoins in source code ? Why should we have a separate pruned class just for storing outputs ?

CCoins is an internal data structure, used to represented entries in the UTXO set while cached in memory (see CCoinsViewCache).

It is separate from CTransaction for efficiency and utility reasons. It lacks a vector for the output, saving space. It also has a much more efficient serialized form, allowing a more compact database on disk. Furthermore it has convenience methods that we wouldn't want in a base data type that's used everywhere. As CCoins is only used inside the consensus validation logic, it can be more specific.


Can an SMPPS (Shared Maximum Pay Per Share) pool be hopped? I've looked at the way SMPPS (Shared Maximum Pay Per Share) payout schemes work, and as far as I can tell, there is no significant way to hop such a pool to advantage. Yet I've seen several people claim that SMPPS pools should not be considered hopper-proof.

Is this true even if the pool owner seeds the pool with a decent starting reserve of funds and the reserve never hits zero? Or is this only true if the pool reaches the point where it cannot make full payments to miners?

In other words, is this a realistic fear, like it is with PPS (Pay Per Share) pools? Or is this just something that comes up in a very unlikely scenario with a very unlucky pool?

SMPPS and ESMPPS (Equalised SMPPS) are "hoppable" only in the sense that they don't explicitly punish hoppers. They are resilient against the prevalent style of hopping but they do nothing to lessen the gains of users who hop away. For this reason, SMPPS (and ESMPPS) are considered "fair" algorithms by hoppers and pools using E/SMPPS are often chosen as "backup pools" to be mined at when no other pools meet their specific criteria. Algorithms like PPLNS (Pay Per Last N Shares) punish anyone who isn't a 24/7 miner regardless of when or how they choose to hop in/out and so aren't even viable as backup pools.

In short, it's not realistic (to my knowledge) to say that SMPPS could be in any way gamed by pool hoppers. They are, however, fair to hoppers who choose to use them as a backup pool and so many who are staunchly anti-hopping still consider SMPPS to be bad/inadequate.


Convert public address to large integer I need single integer converted from public BTC address. Is it enough to Base58Check decode the address and I will get hex/binary format of that integer or do I need to do something more?
What will be the format of Base58Check decoded data? Will there be any checksums, additional bytes?
I can write a script in Bash/Perl/Python if I would have instructions.

NOTE: This applies only to LEGACY ADDRESSES that start with a "1". Addresses starting with "3" have 0x0014 appended to the beginning and are Base58Check encoded, while addresses starting with "bc1q" have 0x0014 appended to the beginning but are encoded with Bech32 Encoding.
You will get Hex/binary after decoding from Base58Check. There should be 20 bytes after decoding the Address to get the public key's hash. If whatever process or function you're using to Base58Check decode doesn't remove the version byte and checksum, you will have 25 bytes instead: The first byte will be 0x00 (the version), and the last 4 bytes (the chscksum) will be the first 4 bytes of the double SHA256 hash of the other 21 bytes.
What you'd be converting to a large integer is the HASH160 of the Public Key; aka, the result of taking the public key in compressed format (33 bytes) and running it through SHA256 then running that hash through RIPEMD-160.
More information about legacy addresses can be found here. Additionally, I've written a breakdown on how addresses are created here.


"bitaddress.org": It generates a BTC or BCH address? (1) Is the address generated by www.bitaddress.org a BTC address? Or BCH address (Bitcoin Cash) ?

(2) Is there a general method to recognize BTC address from BCH address?

1) A Bitcoin address/private key is the same as a Bitcoin Cash address/private key.

2) To prevent confusion, one year ago Bitcoin Cash started to use a new address format called CashAddr. They can be used interchangeably if the wallet/service doesn't support the CashAddr format, using the official address translator or mine. Today, most of the services accept both types of the BCH addresses.

To sum up, Bitaddress is compatible with Bitcoin and Bitcoin Cash, but you should convert it to CashAddr before receiving Bitcoin Cash so that they won't send you bitcoins by mistake. (Both 1 and CashAddr addresses are accepted by BCH services while BTC services don't recognize CashAddr, intentionally)

BTW, there's Bitaddress fork named cashaddress.org that generates CashAddr by default.


Remove address sub from blockchain websocket API According to the docs, Blockchain.info provides a websocket API that streams a few things:

All unconfirmed transactions using "op: unconfirmed_sub"
New blocks & the data they contain using "op: blocks_sub"
All new tx that are detected at a subscribed address using "op: addr_sub", "addr": the address you want notifications.

I'm mostly interested in #3. If I send the "op: addr_sub" command, my websocket client will show all new tx from the moment of that subscription until the socket connection is closed. That's all well and good, but......

Is there a way to UNSUBSCRIBE from an address in the addr_sub list?
There appears to be a socket command "op: unconfirmed_unsub" which will halt the subscription for all unconfirmed tx, but no analog for individual address.

Does anyone know the answer for this? How to unsubscribe from an individually watched address?  If my purposes have been satisfied for watching an address and I wish to free up those resources how do I go about doing that? Surely, I don't have to close the entire connection and re-subscribe to everything BUT that address?

I'd imagine there has to be some way to achieve this without requiring the subscription to be immortal.... The docs from their site https://blockchain.info/api/api_websocket are very sparse

There is now the addr_unsub command taking an addr parameter to unsubscribe address updates.


When did BIP66 switch from activation to enforcement? Recently, BIP66 switched from activation (miners enforce rules within block) to enforcement (network enforces rules on all blocks).

I'm having trouble figuring out when this happened, or on what block it happened.

From BIP66:

  The new rules are in effect for every block (at height H) with nVersion = 3 and at least 750 out of 1000 blocks preceding it (with heights H-1000..H-1) also have nVersion = 3. Furthermore, when 950 out of the 1000 blocks preceding a block do have nVersion = 3, nVersion = 2 blocks become invalid, and all further blocks enforce the new rules.

I wrote this script to monitor the number of the last 1000 blocks that have nVersion set to 3.

require_once 'jsonRPCClient.php';

$daemon = new jsonRPCClient('http://{my_user}:{my_password}@127.0.0.1:8332/');
$blkStart = 364136 - (24 * 14 * 6);

$ver3InLast1000 = 0;
for ($i = $blkStart;; $i++) {
    try {
        $blockHashOld = $daemon->getblockhash($i-1000);
        $blockHashNew = $daemon->getblockhash($i);
        $blockOld = $daemon->getblock($blockHashOld);
        $blockNew = $daemon->getblock($blockHashNew);
    } catch(Exception $e) {
        break;
    }

    // Don't want to start subtracting until have processed 1000 blocks
    if ($blockOld["version"] == 3 && ($i - $blkStart >= 1000)) {
        $ver3InLast1000--;
    }

    if ($blockNew["version"] == 3) {
        $ver3InLast1000++;
    }

    if ($i - $blkStart >= 1000) {
        echo "$i, $ver3InLast1000\n";
    }

}

The result can be found in this pastebin.

  Block number 363724 is the block that turned on nVersion=3 enforcement for all further blocks.


What is protecting the mempool from being DDOSd? The mempool currently seems to contain almost 60K unconfirmed transactions, and the number seems to be growing.
According to this question, it seems that unconfirmed transactions are eventually purged.

Other answers indicate that it is impractical to hamper the transactions of others to go through by trying to fill blocks with your own transactions. That question does however not mention problems that the nodes would face in having to deal with a too large number of transactions being passed around (without considering them being included in the block at all).

Would it be possible for a malicious user to send a lot of transactions (say from the same valid address) to the network, aiming to increase the size of the node mempools, and thus cause problems?
Has something like this happened?

Or does the purging happen fast enough, and are the unspent transactions small enough, for a growing mempool not to be a problem for the network nodes?
Are there any other common features implemented that protect against a bloating of the mempool?

First of all, there is no "The mempool". Every full node has an individual mempool, and as these contain no transactions that are already in blocks (confirmed transactions), by definition nodes cannot be guaranteed to have agreement about it. So, what you're looking at it blockchain.info's mempool, which may or may not be similar to that of other nodes.

What can cause differences between mempools? One obvious example is in the case of a double spend: no conflicting transactions are allowed in it, so if two distinct transactions which spend the same inputs are broadcast into different places of the network, some will accept one, others will accept the other, based on which they hear first. That's not the only difference, though. Nodes can also have different mempool acceptance policies.

A node's mempool is ultimately its expectation for what transactions may reasonably confirm in the short to medium term. Good mempool acceptance policies are trying to model that expectation. If a transaction's fee is very low, it may not be worth keeping around if there are plenty of higher fee transactions to mine first.

And that is the basis for the mempool DoS protection that was added in Bitcoin Core 0.12. Roughly, whenever the mempool's memory usage goes over a certain preconfigured size (the -maxmempool setting), we kick out the transactions with the lowest feerate, and (temporarily) increase the minimum feerate to get in in the future to that of the evicted ones. That solves the issue of unbounded memory usage.

But what about bandwidth? Things like BIP125 and this eviction described above essentially result in the ability to keep broadcasting transactions, and have them be accepted and replace other transactions, without really paying anything. I say paying here, because the fundamental rule we base mempool policy decisions on is that since we expect transactions in the mempool to confirm, and thus pay their fee. Thus, we'd want a rule that whenever something is evicted from the mempool (for whatever other reason than it confirming), something else pays "something" for that relay. In practice this is accomplished by having a separately configured relay feerate (which does not change when the mempool is full), that specifies the "price" for relay. In the case of mempool eviction, the new transaction(s) must pay at least that relay fee more than the fee of the replaced ones.


How to know a given file is a valid bitcoin wallet? If I have many files on my hard drive (possibly with different names/extension), how can I test which file is a valid bitcoin wallet.dat ?

Maybe there is some string that exists in every bitcoin wallet ?

I guess I am asking about the format of the data inside the wallet.
If wallets are different depending on the bitcoin client, then I want to know about bitcoin core.

Edit: I forgot to mention but these files WERE on a Linux OS. So there should be some solutions.

On Linux, you can use the file command. If the file is a Bitcoin wallet, you should see

wallet.dat: Berkeley DB (Btree, version 9, native byte-order)

(It will always say Berkley DB version 9, but the filename might be different.)

file is also availible on Windows: http://gnuwin32.sourceforge.net/packages/file.htm

How does file tell that it's a Berkley DB file? See How did file identify this wallet file?


Graph Interpretation on Slush Pool I understand that a dar red line on Slush pool hash rate means a block has been discovered by the pool.

What does the blue line mean around 5AM?

These are called Namecoin blocks and you can see your reward for all those blocks by checking out your reward section. You'll see a toggle above the rewards table on the right to switch between Bitcoin and Namecoin blocks. These blocks have a much lower value than normal Bitcoin blocks and so your reward is very small. The number of confirmations needed for these blocks is also very small compared to normal blocks. They are a by-product of Bitcoin mining and the pool uses a service to automatically exchange them for Bitcoins.


How Long Does Miner Wait To Receive Commission From Transaction Fee? I cannot find the answer so please cite a source if you have one: How long does it take when a miner successfully mines a block to receive the commissions from the transactions included in that block? I ask because it's my understanding that the Block Reward isn't offered until 100 blocks have been added on top of the mined block. I think I read that the Transaction Commissions aren't awarded until 6 more blocks are added, but now I can't confirm that. It stands to reason that there would be some sort of lag before commission are paid by the network in case the mined blocked ends up orphaned or stale. So what is the waiting period?

Transaction fees are part of the block reward, so miners will be able to spend those transaction fees at the same time that the block reward matures. The network does not distinguish between the block subsidy and the transaction fees when miners receive their reward for a block.


Bitcoind becomes non-responsive over JSON-RPC, have to manually restart all the time I run bitcoind on AWS on Ubuntu. The machine has 4Gb of memory and free shows some of it remains free. Enough disk space too.

Yet, I have to manually restart bitcoind quite often, because sending JSON-RPC requests returns a timeout error. That is, at first they do work, but then they don't. No matter what kind of request.

Has anyone ever come across this? Why does it happen? Does anybody have a plausible theory?

Upgrade to the very latest stable version. We saw alot less memory leakage with .10 on ubuntu
run a cron job to restart it every night around 4:00 am est when there are fewest ransactions. This will cut down on memory leakage
make sure your box has at least 4 gigs of ram and a 2 gig swap partition.
give us some more info here. like linux distro, machine stats and what kind of rpc calls u often do.


How does an SPV client forms a transaction which is then Broadcasted? As per my understanding, an SPV client only keeps a track of the block headers in its own database. So when a user tries to send bitcoins using that particular SPV client, how is the transaction constructed?

A user using that client will probably enter the amount he wants to send and the destination address. And he probably will be signed in using his private key.

So using these 3 data i.e. amount, destination and privateKey how will the SPV construct the whole transaction object.

Because I know that if I have to manually write a transaction by hand, I need:

Previous Transaction Hash (Funding Transaction).
Sequence Number of the UTXO I am trying to spend.
ScriptSig or the unlocking key, which is constructed using the privateKey and the hash of the entire transaction body.
Output Value.
ScriptPubKey which is constructed using the destination address.
SigHash Code.

So I am just supplying amount, destination and private key. How will the SPV client get the remaining values such as Prevout hash, sequence Number, how many UTXOs to be unlocked and how many new UTXOs should be formed?

It will be very helpful, if someone mentions a codebase where the implementation is given.

Generally speaking, the SPV wallet receives the transaction and a merkle-proof from a validating full-node when funds are sent to an address controlled by the wallet.

The merkle-proof guarantees that the transaction with the output spendable by the wallet is committed to the header of its local (strong) header-chain. Since the wallet controls the private keys to this output, it indexes this as a local UTXO, without any knowledge of the full UTXO set found on the validating node.

When spending funds to another address, the local wallet will solve for an optimal set of local UTXOs for this transaction. Prevout Points, spendable by the wallet are indexed as mentioned before. All other transaction fields you describe are independent of the UTXO, or can be inferred from the indexed previous transaction (e.g. timelocks enforced by CSV/CLTV output script operations). The destination address will tell the wallet what output to spend to, as is the case with all other wallet types (P2PKH, P2WPKH,P2SH, P2WSH etc).

The SPV wallet described above necessarily reveals the addresses it is interested in to receive merkle-proofs from the validating node. There are several techniques for the SPV client to improve privacy and leak less information, at a certain bandwidth cost.

Server side filters (e.g. Bloom filter (to be deprecated))
Client side filters (e.g. Neutrino)


Access my wallet using a 16 digit passphrase I had a wallet years ago on a PC I sold. I mined bitcoin on it and what not. Recently I found a 16 digit passphrase I wrote down for my wallet. That is all I have and probably all I needed. If I only wrote down the 16 digit passphrase that means that's all I probably needed to access it anytime. I'm 99 percent sure I was using bitcoin core but I'm not too sure. What I do know for sure is that I have my 16 digit passphrase. My question is how can I access my wallet with my 16 digit passphrase I got?

Unfortunately, that 16-digit passphrase is likely the password to decrypt your bitcoin core wallet.dat file. So you'll need to have that file in order to access your wallet.

It could also be a BIP-38 protected paper wallet, but it doesn't sound like you have one of those.

Your best bet may be to search every email inbox, dropbox account, backup hard drive, or whatever else you may have, for either a backup of your wallet.dat file, or evidence of an account with an online wallet service.


Why did this empty transaction block get awarded 25 bitcoins? I just saw a new block go by at height 238440 on Blockchain.info that has no transactions but awarded 25 bitcoins. How is this possible, and, why is it possible?

Here is the block information link: https://blockchain.info/block-index/386860/00000000000000db143554fa093eda1e7d608309f733170c4c7ea2777cfd5424

The block reward is the block subsidy plus the fees from transactions. The block subsidy is 25 BTC, and will be for 3 years.

While mining a block without transactions isn't in the spirit of Bitcoin, and doesn't have much point, it is allowed.


What is the bitcoind command to send all coins to another address? I'm running bitcoind and I want to send all my coins to another address. What is the command for this?

To be strict, OP asked to send all coins, which @mschuett didn't answer.

The key thing to do this is the last optional bool argument of the sendtoaddress RPC command called subtractfeefromamount. The way to use it is:

bitcoin-cli walletpassphrase <passphrase> <timeoutInSeconds>
bitcoin-cli sendtoaddress <bitcoinaddress> `bitcoin-cli getbalance` "" "" true


Permission to reproduce diagram I'd like to get permission to reproduce the diagram on how bitcoin works at What does a Bitcoin transaction consist of? for a book on money that I'm presently writing for Routledge Publishing. How would I do that or is the image free to be used?
Thanks!

As far as I understand the diagram was produced for IEEE Spectrum. They have a Reprints & Permissions page that might help to get in touch with them on this matter.


Unconfirmed in the blockchain I was sent a bitcoin transaction 18 hours ago  and it has still yet to be confirmed.  Any idea on what I can do or when it will go through?

https://blockchain.info/tx/da635a68d9db0448b1c10feee07a91cd6901f904d609b2f0a63b202e38d641f2?show_adv=true

Your transaction's fee was pretty low compared to the transactions that are currently happening on the network.

Your transaction was big with 2580 bytes, and that makes your fee work out to be only 22.3 satoshi per byte. Currently, transactions are confirming in the next block that are paying about 60 satoshi per byte.

There are about 35k transactions ahead of yours in line. (But new ones join the line, so it's going to be a while.) You might want to resend the transaction with a higher fee, if you know how to do that.

Otherwise check out Why is my transaction not getting confirmed and what can I do about it?


Bitcoin Core compiled "bad91-dirty" version After compiling Bitcoin Core following their guidelines I get a "dirty" version as seen in the screenshot below.

git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
sudo git checkout 0.15
sudo ./autogen.sh
sudo ./configure LDFLAGS="-L/root/bitcoin/db4/lib/" CPPFLAGS="-I/root/bitcoin/db4/include/"
sudo make -s -j5
sudo make install

I also am unable to get the node listed on https://bitnodes.21.co and I presume it's because of this? Using the normal Bitcoin Core node bitcoin.org has already compiled works fine in that regard.

Why is it doing this and how can I compile a normal version? It does the same if I compile 0.14

The "51bad91" may be a bit misleading here, it's just coincidence that it says "bad". It's actually just the most recent commit on the 0.15 branch, https://github.com/bitcoin/bitcoin/commit/51bad9195eb435200626beccbaf6b60774a4a894

The -dirty suffix is added during the build here:
https://github.com/bitcoin/bitcoin/blob/master/share/genbuild.sh#L38

I believe that just means that the most recent commit on the 0.15 branch (the 15bad91 commit) was not tagged (i.e. part of the actual 0.15 or 0.15.0.1 release, it is on that branch in preparation for 0.15.0.2).

Thus you should be able to avoid the -dirty suffix by checking out the version tag rather than the branch, i.e. checkout v0.15.0.1


How do I ask other nodes for their stale blocks? I want data on as many stale blocks as possible. Is there a way to ask peer nodes to run "getchaintips" and get their results?

Previously, I used Blockchain.info's API call for this, but it seems like they deleted their data on stale blocks (even when I directly search for a known stale block's hash, no results are found).

I've also heard of using merged mining data to find extra stale blocks, per Stifter et al 2019. This method was used to find many stale blocks that weren't propagated to nodes run by certain websites; the paper looks at stale blocks from Decker and Wattenhoffer 2013, Blockchain.info, Bitcoin.com, and ChainQuery.com. However, this method misses many stale blocks that those websites picked up.

My current best idea is to ask as many peers as possible for their "getchaintips", but I don't know how to do this. Can someone help, suggest an alternative method, and/or provide some of their own data?

You can’t. Nodes don’t respond to messages about stale blocks because this would be a fingerprinting vector.


Is it possible/feasible to send out large amounts of small transactions without paying fees? How long would it take to process 1000 transactions from the same wallet, with outputs ranging from 100 bits to 1000 bits and no transaction fees for any of them?

How about if 1000 of these transactions were sent out every hour? Would Bitcoin be able to handle this?

Individual miners have different standards for what fees they will accept. Most simply aren't going to process a transaction without fees, so you'll be waiting for somebody to generously record your transaction to the blockchain without compensation. I've never tried this, but I've seen people say that they've had to wait days. It will vary, of course. If you get impatient you could always propagate another transaction that spends the same exact funds, but allowing some of them to be used as a fee.

I've heard estimates of how many transactions the blockchain can handle that range from 3 to 7 per second. I'm really not sure what the average transaction size is, but they all have to fit in a 1 megabyte block. Even a miner who generously records transactions without a fee is almost certainly going to give priority to transactions with a fee attached, so some of your transactions might get recorded and the rest left to wait for another generous miner to get a block. Unless the inputs of one transaction require the outputs of another, you won't even be able to know which ones will get recorded first.


Why isn't the block hash used to calculate accumulated work? Why is this idea flawed? It doesn't seem to be a bad idea at first, because the miners should be incentivized to extend existing chain, instead of to "remine existing blocks", since such "remining" apparently requires more work to be done.

What's the actual reason? Because it would make double spending easier? Or it would enable miners to do selfish mining when they occasionally find a block with extra-small hash? Or it would cause more forks / require more confirmations?

I don't think this problem is duplicate with another question, because difficulty decides validity of a single block, while accumulated work decides best chain.

The answer is because among the set of acceptable hashes, every hash is equally likely. See https://bitcoin.stackexchange.com/a/939/60443

There really hasn't been more work done just because the value is greater, as long as it meets the current difficulty. Nickel and diming the work done by comparing block hashes would create many more forks, thus requiring more confirmations to be sure a transaction is final.


Are UTXOs signed with a private key? Are UTXOs signed by a private key?
I'm trying to understand exactly which parts of Bitcoin use public and private keys. You need a private key in order to generate transaction output, and to create a transaction that uses those outputs, but I'm not sure what happens in the middle.
My current guess is that they aren't signed. The transactions generating the UTXOs are signed, and the block containing the transactions can be validated and then traced back to the miner. It doesn't seem necessary to sign the UTXOs, and even if we wanted to, the only private key available would be the miner's.

That's correct.
UTXOs are just entries with the following fields:

txid of the transaction that created it
output position in that transaction that created this output
the output itself (consisting of scriptPubKey and amount)
the height of the block that created this output (needed for relative locktime checking, see BIP112)


Pending transactions 0/3 I sent bitcoin from my blockchain to my paxful and it says pending in my paxful history 0/3 confirm. Please what happened. And the bitcoin has left my blockchain wallet and it only showing unconfirmed in paxful history

This means you have to wait until the transaction has 3 confirmations before you can use it on Paxful.  The time needed for each confirmation is random, but averages about 10 minutes.

By the time you read this, your transaction probably will have 3 confirmations.

If after several hours it still says 0/3, then go and read Why is my transaction not getting confirmed and what can I do about it?.  You may have set a transaction fee that was too low.


transaction stays in status "0/unconfirmed, in memory pool" to say this upfront: I know these kind of questions have been asked before, but I already tried some things and I really don't have the knowledge what to do next.

I recently tried to send an amount of BTC from a Bitcoin Core wallet. After one whole day, the transaction still has the status "0/unconfirmed, in memory pool" in Bitcoin Core.
I've tried restarting with options (rescan; zapwallettxes), but it didn't work. I also used the dumpprivkey command and imported this key into a blockchain.info wallet. It says there's no money on it...

How can I get this money back?

Edit: Solved. Like Michael C Ippolito said, the transaction has been confirmed eventually. I thank you for your answers.

One cannot say for sure what is happening without seeing the transaction ID, but it's likely that this is being caused by the current transaction backlog of about 62,000 or so unconfirmed transactions.

If the transaction being discussed has a low fee (relative to the other 62,000 unconfirmed transactions) the transaction being discussed may not be confirmed until a large number of those other unconfirmed transactions have been confirmed.

Two possible outcomes are that the transaction is eventually confirmed or that the transaction will eventually get dropped from the network and you will still have control of those bitcoins.

EDIT: BIP 125 Opt-in Full Replace-by-Fee Signaling provides a flagging option for dealing with this, though I'm not sure if any Bitcoin clients currently provide userfriendly support for this.


Can someone explain the output from running Bitcoin Core unit tests on Mac OS please? When I build and run the unit tests on Mac OS using the make check command the output contains these two summaries (images uploaded below). Why does the testsuite summary initially summarize zero tests and then later only summarize a small number of the unit tests? I checked with another Bitcoin Core Mac OS user and they get similar outputs.

 and .

This is the output for all platforms at the moment, not just MacOS. To paraphrase from sipa on IRC:

The first summary is bitcoin's own summary: because of some hackery to run unit tests in parallel, it currently shows no tests (even though they are executed).
The second and third summary are the output from make check for the built-in dependencies, secp256k1 and univalue respectively.


How can be proven that a signature is valid with it's public key If someone wants to make a transaction, they need to sign the transaction data with their private key. For example Sign(transactionData, privateKey) creates the signature. What is exactly this Sign function and what happens inside this function? And how can be verified that a signature is valid with a public key? For example Verify(signature, publicKey), what happens inside this function?

When signing the transaction, a sha256 hash of the transaction data is taken, and a ECDSA signature of this hash is generated using the private key.
When validating the signature, we first generate the sha256 hash of the transaction data the same way, then we validate the signature using the ECDSA algorithm by passing in the signature, the public key, and the transaction hash.


Python implementation for LND path finding algorithm The most common Lightning nodes use GO, C or Scala for their implementation. Is there any publicly available Python implementation for the path finding algorithm any of the most known clients use (LND, C-Lightning, Eclair)?

These implementations use some form of the Dijkstra algorithm which is implemented in the open source networkx python lib https://networkx.github.io/documentation/stable/reference/algorithms/shortest_paths.html also electrum wallet is working on lightning. I think they followed pretty much the lnd code base so one could check their pathfing implementation at https://github.com/spesmilo/electrum/blob/master/electrum/lnrouter.py


What is Sentinel Chain? Is it a cryptocurrency scam? What is Sentinel Chain? Is it a cryptocurrency scam?
Can somebody help me? Thx!!!

It looks to me like any other of those exchange like sites. That does not necessarily make it a scam.


Is there a maximum fee per byte in satoshis? i have seen recent transactions with fees as low as 1.065 satoshis per byte.
and some transactions with fees as high as 500+ satoshis per byte.

so i would like to know is there maximum fee ? in satoshis per byte ?

can i do transaction of 100 btc with setting 99 btc as fee ? (with only 1 input and 1 output. )

Yes you can, there is no maximum limit for the fee. The fee is simply the difference between the sum of the input values and the sum of the output values, so if you wanted to donate 99 BTC to the miners there is nothing stopping you - no idea why you'd want to donate an entire house though ;)


Bitcoin millionaire pro Can someone earn bitcoins for free by using bitcoin millionaire pro platform really?
I have just come across this ad somewhere. And I thought of inquiring about it to have some clue about it.

In my opinion it is scam. Some explanations in link

  https://binarysignalsadvise.com/bitcoin-millionaire-pro-review-scam/


Can I spend a coin sent to myself before it confirms? If I spend the entire balance in my wallet to another address in my own wallet, do I need to wait until it gets one confirmation in order to spend it, or does the client know it is my own funds and that it can be spent?

This can be done via RPC, but this question is specifically referring to using the bitcoin-qt client for this.

Yes.  Unlike other transactions you don't need to wait for the confirmations.

From the code which selects which coins to use to fund a transaction in src/wallet.cpp:

bool CWallet::SelectCoins(int64 nTargetValue, [...])
{
    vector<COutput> vCoins;
    AvailableCoins(vCoins);

    return (SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet) ||
            SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) ||
            SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet));
}

where SelectCoinsMinConf's 2nd and 3rd arguments are "number of confirmations a coin needs if it's from me" and "number of confirmations a coin needs if it's from someone else" respectively:

bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfTheirs, [...])
{
    [...]
}

So what's happening is the code first tries to fund the transaction using only coins you sent to yourself which have at least 1 confirmation and coins from others with at least 6 confirmations.  If it can't find enough that way, it tries again but only requiring 1 confirmation on the coins no matter where they came from.  And if that also fails, it relaxes the requirement for confirmations on coins you sent to yourself.


Can't get the tx with gettransaction or getrawtransaction methods I am running bitcoin-d (probably downloading the prev blocks) in a shell.
In another shell i am trying to get the information of a transaction (0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2) with bitcoin-cli. I can see that tx on blockchain.info but when i tried it with gettransaction and getrawtransaction it didn't work out. Does anyone know why is that?
screenshot below.

gettransaction is a wallet RPC. It only works for transactions your wallet knows about. Presumably this is not the case for a transaction from 2013.

getrawtransaction is a node RPC. It works for all transactions, but needs help to find them. One possibility is to enable the transaction index (put txindex=1 in bitcoin.conf, or -txindex on the bitcoind command line). Another option is specifying which block the transaction is in.


block checksum mismatch? While trying to sync I got a "block checksum mismatch" in my debug.log file. Here is the last 30 lines. You can see that it happily downloading block, then it gets a network unreachable, then it has a fatal error:

2017-02-13 12:23:13 UpdateTip: new best=000000000000000005f83797c139814ac19f6df01ddb5a366ad0a8889eea9e4c  height=409620  log2_work=84.577937  tx=125928733  date=2016-04-30 20:50:36 progress=0.848096  cache=37.2MiB(19128tx)
2017-02-13 12:23:14 socket send error Socket operation on non-socket (88)
2017-02-13 12:23:14 connect() to [2a02:180:6:1::109]:8333 failed: Network is unreachable (101)
2017-02-13 12:23:19 UpdateTip: new best=0000000000000000020227bef01de871ccb17e3f6b9a86e9a2785001a71c6afe  height=409621  log2_work=84.577975  tx=125929755  date=2016-04-30 20:57:19 progress=0.848099  cache=64.3MiB(21625tx)
2017-02-13 12:23:23 Corruption: block checksum mismatch
2017-02-13 12:23:23 *** System error while flushing: Database corrupted
2017-02-13 12:23:23 Error: Error: A fatal internal error occurred, see debug.log for details
2017-02-13 12:23:23 ERROR: ProcessNewBlock: ActivateBestChain failed
2017-02-13 12:23:23 tor: Thread interrupt
2017-02-13 12:23:23 opencon thread interrupt
2017-02-13 12:23:23 addcon thread interrupt
2017-02-13 12:23:23 torcontrol thread exit
2017-02-13 12:23:23 scheduler thread interrupt
2017-02-13 12:23:23 net thread interrupt
2017-02-13 12:23:23 msghand thread interrupt
2017-02-13 12:23:23 Shutdown: In progress...
2017-02-13 12:23:23 StopNode()
2017-02-13 12:23:23 Corruption: block checksum mismatch
2017-02-13 12:23:23 *** System error while flushing: Database corrupted
2017-02-13 12:23:23 Error: Error: A fatal internal error occurred, see debug.log for details
2017-02-13 12:23:23 Shutdown: done

What is the problem?

*** System error while flushing: Database corrupted

This could most likely be attributed to faulty RAM or storage device. You will have to sync again. If corrupted again, consider testing/replacing your components.


How do Bitcoin clients know how many new bitcoins to mint when creating a block? I understand that lucky clients that create blocks get some transaction fees and are allowed to mint a few new bitcoins to keep for themselves.

How do clients know how many new bitcoins to mint for themselves when creating a block?

The mining reward is the sum of two parts: Transaction fees and block reward.

The transaction fees are the sum of the transaction fees of the transactions that the miner is trying to validate.

The block reward follows a predetermined schedule: It started with 50 BTC per block and halves every 210,000 blocks. According to the bitcoin.it-FAQ the last block to have a block reward will be block #6,929,999.

The protocol includes a check that will reject blocks which assign more than block reward + transaction fees in the coinbase transactions. Assigning less is valid, however, the difference will be lost.


How to calculate new "bits" value? Every 2016 blocks one needs to calculate new bits value. What is the formula to calculate it?

What does the bits field represent?

First of all, we need to understand what the 'bits' field means.

Bits is in 'compact' format.  This is kind of like a floating point format, but it represents big integers rather than arbitrary real numbers.  The first byte indicates the number of bytes the represented number takes up, and the next one to three bytes give the most significant digits of the number.  If the 2nd byte has a value greater than 127 then the number is interpreted as being negative.

To convert a positive integer to 'compact' format, we:

convert the integer into base 256.
if the first (most significant) digit is greater than 127 (0x7f), prepend a zero digit
the first byte of the 'compact' format is the number of digits in the above base 256 representation, including the prepended zero if it's present
the following three bytes are the first three digits of the above representation.  If less than three digits are present, then one or more of the last bytes of the compact representation will be zero.

Example 1 - Convert 1000 to 'compact' format

For example, to represent 1000 in 'compact' format, we convert to base 256:

1000 = (0x03)*256 + (0xe8)*1

So we have a 2 digit base 256 number:

03 e8

The first digit is not greater than 0x7f, so we don't prepend a zero digit:

03 e8

Then the compact representation becomes:

02 03 e8 00

Example 2 - Convert max target to 'compact' format

The minimum difficulty has a target of 2^(256-32)-1.  Let's represent that in 'compact' format.  First we convert it to base 256:

ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

That's 28 0xff digits.  The first digit is greater than 0x7f, so we prepend a zero digit:

00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Now it's 29 digits long.  hex(29) = 0x1d.  So the 'compact' representation of this is:

1d 00 ff ff

Notice we've lost a lot of 'ff' digits there.  We've only kept 2 bytes of precision, what with the size byte and the prepended zero byte using up two of the four available bytes.  If we were to convert back from 'compact' format to see what number we've actually stored, we get:

ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

which is in fact the maximum target used by Bitcoin.  This is what a difficulty of 1 sets the block hash target to be.

How is the value of the bits field calculated?

Now that we know what the bits field means, we can look at how its value is decided.  In the official client, the bits value is calculated by function GetNextWorkRequired() in src/main.cpp, which does the following:

if we're working on a block that's a multiple of 2016 (every 2 weeks)

look at the timestamps on the last block, and the block 2015 blocks before it
calculate the difference in these two timestamps
if the difference is greater than 8 weeks, set it to 8 weeks; this prevents the difficulty decreasing by more than a factor of 4
if the difference is less than half a week, set it to half a week; this prevents the difficulty increasing by more than a factor of 4
multiply the difference by the current target (ie. the current bits converted from 'compact' representation to the target it represents)
divide the result by 2 weeks
if the result is greater than the maximum target (2^(256-32)-1), set it to the maximum target
convert the result to 'compact' form, and use that as the new bits value

otherwise (we're working on a block that's NOT a multiple of 2016

if we're on testnet and it's later than 15 Feb 2012

if it's been more than 20 minutes since the last block was found

set bits to its highest possible value, 0x1d00ffff, which represents a difficulty of 1; this is the 'special-min-difficulty rule'

otherwise

set bits to the same as in the last non-special-min-difficulty rule block

otherwise (we're not on testnet, or it's before 15 Feb 2012)

set bits to the same as in the last block


Solo mining in Sep 2017 Is solo mining still doable today?

What is needed to tackle a whole block under a month alone, 100x Antminer S9, 100THash/s?

Another question, does location play a role in this? Would it matter if the "farm" is in Southern Africa away from most Bitcoin users in EU, US, Asia, would another miner that is closer to the "requester" always get the block first? Please advise!

To achieve a whole block solo in a month you're going to need about 1500 TH/s

https://www.coinwarz.com/calculators/bitcoin-mining-calculator/?h=1500000.00&p=2600.00&pc=0.10&pf=0.00&d=922724699725.96300000&r=12.50000000&er=4486.23010000&hc=0.00

Just to double check that: https://blockchain.info/charts/hash-rate

Total hashrate: 7Million TH/s divided by 6*24*365/12 = 4380 blocks a month = 1598 TH/s

So you need about 115x AntMiner S9s which cost about US$ 1,288 each, so US$ 148,120.

But then the last block generated US$ 60,900 of bitcoin (14.4BTC).

  Would it matter if the farm is in Southern Africa away from anyone, would another miner that is closer always get the block first?

Closer to what? There is no centre. And as blocks take an average of 10 minutes to produce, and they are small (1MB), so while there are race conditions they are the same for everyone everywhere.


Why not hardened keys in addresses BIP44? Being aware of the one weakness of BIP32:

  One weakness that may not be immediately obvious, is that knowledge of a parent extended public key plus any non-hardened private key descending from it is equivalent to knowing the parent extended private key (and thus every private and public key descending from it). This means that extended public keys must be treated more carefully than regular public keys. It is also the reason for the existence of hardened keys, and why they are used for the account level in the tree. This way, a leak of account-specific (or below) private key never risks compromising the master or other accounts.

Why does BIP44 use non-hardened keys in the last 2 levels if it is still risky for the change/internal account? Wouldn't it be better to use always hardened keys?

m / purpose' / coin_type' / account' / change / address_index

Change in this case represent external/internal chain. Usually if that's external chain, you can share it with parties. Imagine having a client which is obliged to send you bitcoin very often. If you'd give him xpub for the whole external chain, he can generate addresses on his own and you don't have to be bothered. It's not heavily used, but sometimes happens.

If this derivation was hardened, the external party couldn't derive child keys (addresses) for this chain. Also watch-only wallets wouldn't be a thing.

BIP44:

  Constant 0 is used for external chain and constant 1 for internal
  chain (also known as change addresses). External chain is used for
  addresses that are meant to be visible outside of the wallet (e.g. for
  receiving payments). Internal chain is used for addresses which are
  not meant to be visible outside of the wallet and is used for return
  transaction change.

  Public derivation is used at this level.


Multiple outputs and different amounts on blockchain explorer when I sent BTC from Crypto.com to Coinbase So I sent BTC from my Crypto.com wallet to my Coinbase wallet.
I then went on the blockchain explorer to view the transaction and I am seeing an input that is not my address and various outputs which include my address as well as other addresses that do not belong to me.
The unknown addresses also have different amounts too.
why am I seeing various outputs with different addresses and amounts?
Thank you!

I then went on the blockchain explorer to view the transaction and I am seeing an input that is not my address

I am not familiar with this particular site, but this is not unexpected. When custodial services hold user funds, they don't necessarily keep the funds in a separate wallet per user. Instead, they have one giant wallet with all the user's funds, and a database to keep track of how much of it is owed to each user. For example, this could be a viable scenario:

User U wants to make a deposit, so the service creates address A, stores it in the database as "A is receive addr for U", and hands A to the user on the website.
User U deposits 1 BTC on A. These funds are now controlled by the service, but it credits U with 1 BTC.
User V does the same; the service creates address B, stores it in the database, and hands it to V on the site.
User V deposits 10 BTC on B. The service now controls 11 BTC. The service credits V with 10 BTC in its database.
Now V wants to withdraw 1 BTC to address C. The service looks at its entire wallets, which contains a UTXO worth 1 BTC and a UTXO worth 10 BTC. It decides that it is most economical to use the 1 BTC when withdrawing, and does so - despite the fact that this 1 BTC UTXO is actually the result of a payment crediting another user.

When V now looks at the blockchain, they will observe a transaction that seems to come "from" address A, which is unknown to V. This is misleading. The general advice is not to pay attention to "from" addresses, as they have very little meaning except to the wallet that actually creates the transaction. It is also none of V's concern - they get the funds, and that's what matters.

as well as various outputs which include my address as well as other addresses that do not belong to me.

This too, is expected. Transactions are cheaper when they batch multiple payments together. The website may have queued up your request for a withdrawal for a short period of time, during which other users also made withdrawals. It then constructed a single transaction that performs all these withdrawals in one go, saving fees and wallet fragmentation for the service. One of the outputs may also be "change" going back to a new address belonging to the service, if the input amounts do not exactly cover the total amount intended to be withdrawn.


LND errors after upgraded to v0.5.2 Recently upgraded to the latest lnd version (following the stadicus guide) but once i restarted the client i keep getting this error when i check the logs:

[ERR] LNWL: Failed to process consensus server notification (name: blockconnected, detail: `failed to store sync information 00000000000000000024cca7ae0fea5ae75fd1405a44e7fac08a94c03b19bbe4: failed to fetch block hash for height 563348: block not found

I have all my channels inactive at the moment but the upgrade seemed to be worked as expected since

  lncli getinfo

prints the correct and latest version... Any ideas how to fix this issue?

Generally your lightning node needs to scan blocks from bitcoind or btcd. It seems like due to the fact that your node was offline lnd did not catch up processing the blocks provided by your bitcoin node. So it seems like you just have to wait until lnd catches up.


Can two outputs from the same transaction be spent separately? I am reading the transaction part. I don't know how to get the transaction hash. Does the whole transaction (include its vins and vouts) get hashed?

If a transaction has two vouts (spent by different transaction tx2 and t3), when t2 and t3 spent the vout, they will get the same prevout hash. Is that correct?

For example:

tx1:  tx1_out1  --------> node_A ----tx2(using tx1_out1)--->
      tx1_out2  --------> node_B ----tx3(using tx1_out2)--->

Will tx2 and tx3 have conflicts, since tx1_out1 and tx1_out2 are spending the same hash?

Short answer
Your questions, in order: Yes. Yes. No.
Long answer
When spending the output of a transaction, it is not enough to know the txid. You also need to know the index of the output. (In other words, whether it is the first, second, third, etc. output.)
The hash of the transaction you're spending and the index of the output you're spending is collectively known as an outpoint.
Quoting the Bitcoin wiki:

The OutPoint structure consists of the following fields:

Field Size: 32
Description: hash
Data Type: char[32]
The hash of the referenced transaction.
Field Size: 4 bytes
Description: index
Data Type: uint32_t
The index of the specific output in the transaction. The first output is 0, etc.

See also the bitcoin.org docs.


CoinBase App limits Requests Coin base recently prohibited me from making a bitcoin request with a pop up saying I already made too many requests.  I had maybe 3 requests that day.  Any one else see this?  What is the purpose of limiting requests?

Take a look: https://developers.coinbase.com/api/v2#rate-limiting

The limit is quite high, it is really strange you received an error response. I suggest you to contact their support, and meanwhile changing your API key (if you're using one) could be a good idea.


Receiving payment in Lightning Network is a big problem? There are some requirements to receive Lightning funds. According to here,

  Nothing can be received immediately after creating a new payment channel, as ‘room’ for incoming funds has to be made by spending some funds first.

I would like to be able to receive LN payment on online shop. In order to do this and in my understanding, I have to either

wait until my customers fund channels to me, or
find a node that already has many channels and get it connect to me with an ample amount of cap.

The former way does not make sense because users have to open another channel to my node if they've already opened one. The latter way might work if a big cap node thinks my business would be great and users would come along. Receiving in LN is very difficult and a big problem for merchants. Thoughts on it? Or if my thought above is wrong, please educate me.

I would like to be able to receive LN payment on online shop. In order to do this and in my understanding, I have to either

wait until my customers fund channels to me, or

find a node that already has many channels and get it connect to me with an ample amount of cap.

This is correct, but there are other options as well. For example, you could open a channel of your own, and spend some funds on LN. Your customers would then be able to spend funds back to you, until your channel balance is pushed back to you entirely.

But to answer your question, I think it is more helpful to consider the situation in this way:
When a user is going to make a payment using BTC, they may consider these two options:

Send an on-chain transaction
Open a LN channel (likely, for an amount in excess of the payment requested).

For anyone that wants to transact on LN, there is a requirement to acquire control of a LN channel. So users will have to open channels, and thus I think assuming that opening a channel with your shop is an unnecessary burden isn't quite correct. The first user to interact with your shop will have to open a channel, but then they will reap the benefit of being connected to the LN, in that they will be able to send & receive subsequent payments on the network.
The network's utility should increase greatly as more users join and use it. The bootstrapping phase does present a bit of a 'chicken-and-egg' problem, but any user that is motivated enough to participate will be ready to pay the costs of opening a new channel, so I don't believe it will be a critical issue in the long term. I also see no reason to assumer that 1 LN user = 1 LN channel, in reality I think many users will have multiple channels, as defined by their usage habits.
Perhaps also worth mentioning: viewing all merchants as as 'receive only' entities is probably not perfectly correct either, as I see no reason merchants couldn't also utilize LN to make payments of their own. You're right that LN isn't perfectly suited to a situation of 'making payments to an endpoint, that cashes out to dollars', but I see no reason to assume that all merchants would participate in this way.


What are the advantages of using Secp256k1? Bitcoin uses secp256k1 as the specification for it's address system (https://en.bitcoin.it/wiki/Secp256k1). What are the advantages (and disadvantages) of using this over other specifications such as secp256r1?

Edit: I found this page (https://bitcointalk.org/index.php?topic=151120.0) which speculates on some possible differences, but I'm hoping to find something concrete.

I believe Satoshi was once asked this question, and answered that it was just some curve that existed and was presumed to be efficiently implemented.

I'll try to find a reference.


How is blockchain stored on disk? Hi how is blockchain actually stored on disk?

I noticed bitcoin uses key store database level DB but what is the structure?

https://github.com/bitcoin-core/leveldb-old/blob/bitcoin-fork/doc/table_format.txt

Here I don't get it... Does anyone has simple overview how it is stored?

I have also read this... but don't get it.
What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?

You may mix up block data with the UTXO set (unspent transaction outputs).
Bitcoin Core uses LevelDB for the later (the UTXO set).

Quick lookups for unspent transaction is important for performance.

The block data is a different things. If you have a non-pruned peer (normal full node mode), Core stores all block files so it can serve those blocks to other peers bootstrapping (and for chain reorganisations).

Those block files are not an API, use it with care. If you interested in parsing blocks, consider using the RPC or REST API.

The .blk files contain a bunch of blocks (raw network serialisation format). There is also a block index (a levelDB database) that contains the file offsets and the headers.

Learn more about the blocks format here (or google).


Why can you mine so much more of other cryptocurrencies with a lower hash rate? I have been researching bitcoin mining and one thing has stumped me. Why is it that you can you mine so much more of other cryptocurrencies with a lower hash rate? I've looked on cryptocurrency calculators and it says that 1 TH/s for Ethereum makes a profit of about $2M per month, but only $53 per month with bitcoin. If your hardware is capable of producing a high hashrate, why not mine a smaller cryptocurrency and exchange it right away?

Comparing hashes per second for Bitcoin and Ethereum mining is comparing apples and oranges. You can only compare hashes per second, if coins in question use the same hash functions for proof-or-work. Bitcoin uses double SHA256, which is a general purpose hash function and can be massively parallelized and optimized in hardware (ASICs). Ethereum uses Ethash, which is more memory-hard and mostly mined on GPUs. Zcash uses Equihash, Litecoin uses scrypt, and so on.

Miners who have SHA256-specific equipment can only choose between SHA256 coins (Bitcoin, Bitcoin Cash, Namecoin (?)). Miners with GPUs have more options, as many memory-hard hash functions are more or less GPU mineable.


Migrate lightning node daemon software Is there a way to migrate from c-lightning to LND without having to close and reopen all channels?

As the lightning network is a specified protocol and as both implementations are open source and spec compliant it should theoretically be possible to migrate from one implementation to another.

However practically spoken you will need a software tool that transforms all the internal data formats of lnd to the ones used in c-lightning without messing the nodes state. I am not aware of any tool that converts the internal data formats. That being said either you go out and create such a tool or you will have to install a new node (even with a new nodeid)


I need а private key I generated a BTC address in "Bitcoin Core" before 2 years ago, but my HDD is burnet and I lost everything.

Unfortunately I don't saved file "wallet.dat" and I don't have "private key", but I have "passphrase".
I install diferent versins on "Bitcoin Core", but I can only add BTC address and don't can make transaction.
I added my wallet address in "blockchain.com", but to make a transaction I need a "private key"
How can I get a "private key"?

You cannot. You need the wallet.dat file, unfortunately. Without a backup there is way to recover the funds.


Personal details disclosure when buying bitcoin What personal information do you have to provide to buy bitcoins in the UK via a bank transfer?

I recently created a wallet on bitbargain.co.uk with the intention of buying my first bitcoins. I verified my phone number and entered my address details, however after this the website asked me to upload a photo of my passport or drivers license, a photo of me with my passport or drivers license, and a copy of a bank statement or utility bill with my address on it.

Is it usual for a website to ask for this information to buy bitcoins? Are there any other sites where you buy bitcoins via a UK bank transfer or credit card payment without having to disclose this information?

Policies will depend upon the exchange itself and setting up an account can take a good long while.

Some exchanges ask for less information, but I'd recommend being careful with using them. There have been some scams that have cost people large amounts of money.

Usually, exchanges want all of the information so they can increase security. As Bitcoins that are lost or stolen are nearly impossible to recover, exchanges want your personal contact information incase any legal problems come up. IE, you decide to run a scam yourself.

I'm pretty sure Mt. Gox has changed its policies. You now have to provide government issued ID to set up an account on Mt. Gox


Ubuntu Bitcoin-cli fee problem I have installed full node on ubuntu server to make a bitcoin payment processor like Bitpay.

I have generated new address for each invoice with $bitcoin->getnewaddress();

As a result, it created new addresses with different private keys.

Each address has around $5 - $20 in it like 50 - 70 different addresses.

When I want to transfer all balance to another bitcoin wallet, I get error -> This transaction requires at least 0.03 Miner fee.

Which is not fair because I already have 0.05 BTC in this wallet, paying 0.03 fee is not logical. Sending $750 is requirind $400 fee.

Any ideas to reduce fee?

The value of the transaction fee is not at all tied to the value being spent. It is entirely based upon the weight of a transaction as defined by BIP 141, which is based on the size of a transaction in bytes. To pay a lower fee, you need to make your transaction smaller by spending less inputs and creating less outputs. There is no way to spend fewer inputs except to not receive many low valued payments.

If you are receiving those payments by withdrawing from some service, then you should wait for your balance to be higher before withdrawing.


Is it secure to put a wallet address on one's business cards as a QR code? As a company, we're making business cards, and would like to put our bitcoin addresses on our business cards as QR codes. Yet, I know that it is a best practice for wallets to cycle addresses - I mean, after an address is used, then create another one. So, is it safe to put wallet address QR codes on multiple business cards and distribute them, and are there best practices for doing so? What security benefits does one lose by distributing the same receiving address to all clients and associates, or would it be wiser to pre-generate a few dozen each time we generate our QR codes to print business cards, so that they can all be unique? Would that even be possible, without using each one once before the next is generated?

that's not a bad idea in regards of doing business and distributing it to people. however, as far as I know, a single address is fine because the address itself is secured. the security flaw of a single address distributed will be - people can check the addresses on how good your business is doing. hehe. correct me if I'm wrong. Wishing you all the luck with your business.


How do new nodes learn the topology of Lightning network? Lightning nodes store a full network snapshots to calculate routes for outgoing payments. Nodes listen to announcements of new (public) channel openings and constantly update their local snapshots.

But where do new nodes (or nodes which return after being offline) get the information about the currently existing channels?

This is done via the peer 2 peer network that comes along with lightning and is specified in BOLT 07 - routing-gossip. If you read the details you will see that you have to peer to a node in order to maintain a channel. But you could also establish peer2peer connections with other peers without the necessity to maintain a channel.

The peer protocol supports channel announcement messages that are being forwarded via the gossip protocol and query messages to ask for messages if a node connects for the first time to the network or was offline as asked.


Why have my funds in Bitcoin Block Explorer's online wallet decreased in value? I feel I may have been cheated by Bitcoin Block Explorer whose URL is http://blockchain.info

Here's the background:

I am using the online wallet provided by Bitcoin Block Explorer. It contains 1.5 BTC.

According to the website http://blockchain.info/stats, the weighted average price is 134.19 USD for 1 BTC on September 11. It means that my 1.5 BTC  is worth 201.29 USD.

However after logging in to my wallet, on the top right-hand corner, the USD equivalent shows 186.18 USD. It means the weighted average price is 124.12 USD.

Could some experienced guy explain to me the discrepancy?

Added a second question

After going through the comments posted here, a second question comes to mind.

An online merchant gives his customers the option of paying using one of the following methods: Visa, PayPal or Bitcoins.

The price of the product is 50 Euros if the buyer uses Visa or PayPal to pay but 0.52 BTC if he chooses the Bitcoin payment system.

According to some posters here, Bitcoin/USD rates vary across exchanges.

My question is: if I am the customer, how can I be sure that I am not overcharged if I use Bitcoins to pay? (0.52 BTC may worth more than 50 Euros)

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


Can I start a Bitcoin Private Node using bitcoin-qt? Currently I am starting a private node using:
bitcoind -regtest -port=11111 -datadir=.\data -rpcport=11112

I can't find the -regtest option in qt.

bitcoin-qt -regtest -port=11111 -datadir=.\data -rpcport=11112


Does Bitcoin Core still use "Bitcoin seed" in addition to a seed like stated in BIP 32? In BIP 32 it's stated that a Master Private key is generated by hashing the concatenation of a random seed and the string "Bitcoin seed". And is like so in the example implementations.

But I couldn't find such string on Bitcoin Core's codebase. Is the seed just hashed directly to form the Master Key and Master chain code?

After much searching, I found the bit of code that uses "Bitcoin seed". So yes, Bitcoin Core uses the string "Bitcoin seed" in tandem with a random seed.

https://github.com/bitcoin/bitcoin/blob/d0f81a96d9c158a9226dc946bdd61d48c4d42959/src/key.cpp#L302


View recovered wallet.dat contents without sync? After recovering a wallet.dat file, and replacing the default wallet.dat file Bitcoin-Core created after a fresh install, should I be seeing the amount of BTC in the wallet even before a full sync?

Can I view wallet contents in an offline environment, without an online blockchain sync?

1.) no, you need to have at least the transactions up to the point in time, where you stored the wallet.dat file. Without sync there is no blockchain, then there is no data, from which core can read the amount.

2.) no. without blockchain data, there is no "database" to collect the amounts for the address.

There might be a work around for you: try to extract the bitcoin address from the wallet (or the bitcoin app shows you the address), and enter it into blockchain.info. They have a blockchain and the web-api, and can show all amounts, that were collected on a bitcoin address.


What will happen to bitcoins stored at segwit outputs pre-BCH-fork? If I understand correctly, P2SH-P2WPKH outputs are simply anyone can spend outputs in BCH.

What would have happened to BTC stored in such SegWit outputs BEFORE the fork, assuming that those addresses had sent several transactions also BEFORE the fork.

In this case, anyone can scan the blockchain and "steal" the bitcoins, despite there being no fault of the person who had those bitcoins.

According to BIP 141, talking about the Bitcoin chain, it'd still trigger "Witness program" and the funds would be stored safely in the SegWit address -after the fork.

Talking about the Bitcoin Cash chain, the miners can redeem SegWit outputs, (both Bitcoin Cash sent to SegWit addresses and Bitcoins in SegWit addresses pre-hardfork.) However those addresses need to have exposed their Witness program, or the outputs can't be redeemed.


Is BTC Robot working or is it a scam? Does anyone have an experience in using BTC Robot? Can it make some money or is it just a scam?

Yes the BTC Robot is a scam. I bought 10 bitcoins when the price was $140 a coin. I used the robot and it brought my bitcoin number down to 2.774 as it made more losing trades than winning trades. I turned it off when I realized what was happening. Despite of this I didn't lose money as the bitcoin price kept rising. If I had simply held my coins and not traded with this stupid robot I would now have almost $10,000 in my account instead of the $2200 that I now have.

When you read the testimonials you can see that if they would have done the math they would have seen what I did and realized how they were tricked, but because they still have more in their account than they initially invested they think the robot is working in their favor.


how to use multiple time specific address in input scripts with difference balances? look at to the following transaction (withdraw transaction from binance)
https://blockchain.info/tx/404fd22d3d88d129975d03fe2993f0126db8f066b3d8126d6cca676747439515?show_adv=true

How in input scripts section same address reuse again and again with different balances?!

Those are the transaction inputs.

Simple example:

In your pocket, you have 100$ and 50$ and 10$ and if you want to pay for something that cost 160$ you will give the seller 100$, 50$ and 10$ in total 160$.

The same thing in here:

1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s (34.3721168 BTC - Output)
1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s (10.03140713 BTC - Output)
1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s (3.91377693 BTC - Output)
1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s (14.88232237 BTC - Output)
1NDyJtNTjmwk5xPNhjgAMu4HDHigtobu1s (8.29127328 BTC - Output)

in total 71 bitcoin


Full animated order book I have been using this Clark Moody webpage to track the price of Bitcoin on MtGox. A nice animated order book is provided, along with a good chart.

Are there similar pages but for other exchanges (because MtGox...)?

What about http://bitcoinwisdom.com/? It visualizes data from 14 different exchanges.


Total amount of nodes and avarage active peer number I have 2 questions:

Does anyone know where to find a reliable source for finding out a total amount of active bitcoin nodes?
How many peers does each active node have in avarage? Is there a limit to how many peers one node can have?

Does anyone know where to find a reliable source for finding out a total amount of active bitcoin nodes?

http://getaddr.bitnodes.io/ tracks listening peers on IPv4 and IPv6 only. The number is subject to gaming if people desire, there's no assurance that any of the nodes there are actually useful to connect to. At least some of the nodes listed will be duplicate due to them having both an IPv4 and IPv6 socket open at the same time and thus appearing as "two" nodes.

  How many peers does each active node have in average?

Bitcoin nodes will only attempt outgoing connections which are in ranges of IP addresses that are not close together, specifically for IPv4 it won't connect to any two nodes that are in the same /16 block. This means that any node running on a popular area such as a VPS host or EC2 node will likely see substantially less incoming activity than one running in a less densely populated area. This is an attempt to raise the cost of a large scale sybil attack against the network by increasing the diversity of IP addresses needed to gain an extremely large number of connections.

As a result you have to be very careful how you gain statistics about the number of incoming connections, because not all listening sockets are equal in the eyes of a client attempting to find peers. As far as I am aware nobody does this sort of data collection on a wide scale and publishes the results, but it is probably in the high tens of connections inbound on most nodes judging by my own experience.

  Is there a limit to how many peers one node can have?

The default is 125 maximum, 8 outgoing and 117 incoming.

Absent this the number is bounded by the constraints of the system it is running on.


Whom am I buying bitcoin futures from? Since Bitcoin futures are a thing since this week I took a closer look at futures and could not find out who I am buying these from. Since this future is "virtual" there is now "farmer" who I am giving my money and get a product back after the contract expires. Who takes over this role?
Considering that in this future there are limited resources how does the seller select a price?

Chak is not entirely correct. The exchange is the matching engine, but there will be someone else on the other side of the trade. The exchange does not have its own position in futures.

That said, legally each party to the future has the exchange as the counterparty (i.e. there are two separate contracts). This all but eliminates counterparty risk. Compare this with a forward, which is effectively a future struck direct between two parties, with no exchange.

Most exchanges have what are called market makers, which in return for being spared some or all exchange fees, commit to providing a buy and sell price for all (or a high proportion) of the time the exchange is running. So most people in practice are trading with a market maker who is bearing the risk of being on the wrong end of the trade. But you could be trading with anyone, either an individual or an institution who wants the opposite exposure to you.

Update As Max Vernon says, the Bitcoin futures on CBOE are cash-settled, not physically-settled. Physically-settled would be a poor choice for Bitcoin, because there could end up a situation where not all futures can be settled given the liquidity available. And as the price rocketed as (some) futures sellers had to buy bitcoin, everyone else would hang on to it.


How to get the time when a block is received at a node? Is there any variable in the bitcoind code that records the timestamp when a block is received for the first time by a particular node? To be more precise, for transactions, transaction information returned by Bitcoind JSON RPC API contains timereceived. Is there similar field for blocks in the API?

There happens to be similar existing questions in stackexchange but none of them has been appropriately answered.

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

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


Can a closed source wallet ever be completely trust-less? Open source Bitcoin wallets are clearly in demand for obvious reasons. Users want to know what the code is intended to do and what may be possible.

Is it even possible for closed source wallets to be completely trustless (meaning I do not need to trust anyone other than myself to keep my Bitcoin secure)? How can this be verified without seeing the source code of the hardware or software wallet?

The term trustless is often misunderstood. I suspect you mean not needing to trust anyone, but if a program being open source helps for that, aren't you implicitly relying on the people who are capable of reviewing the source code to have actually done so? Isn't that also a form of trust? Of course it is. Every production system needs to trust various aspects of the infrastructure: the hardware it's running on, the compiler that was used, the operating system, and last but not least the human operating it.

The trust we're talking about in "trustless" is an abstract technical term. A distributed system is called trustless when it does not require any trusted parties to function correctly. In that sense, a "trustless wallet" does not make sense: wallets are an implementation aspect of a cryptocurrency, the design of which may or may not rely on trusted parties. The wallet software being open or closed source doesn't change this.

Does that mean you should use a closed-source wallet? Hell no. Not because it's "trustless" or not, but because there is no chance it'll have been sufficiently reviewed (unless, perhaps, you have access to the source code under NDA and paid for thorough review yourself).


how bitcoin reject invalid transaction? (with createrawtransaction) i'm studying 'Mastering Bitcoin' and have a questions,

in this book, we can send coin to other wallet by createrawtransaction but there is no enough secure method.

we can find other's wallet addresses at https://www.blockchain.com. and unused coin value too.

for example - https://www.blockchain.com/en/btc/address/34bN2MQcqA4JpbEVRU9KBsvhXgSEHQrqBz

  718ae88f0eb13d2f2d3bc74cbf18721a82739b80f1bfc0658ed699263fca76fd(Fee:
  0.00002057 BTC - 3.11 sat/WU - 8.33 sat/B - Size: 247 bytes) 2019-01-14 04:57:04 34bN2MQcqA4JpbEVRU9KBsvhXgSEHQrqBz (1.13215222 BTC
  - Output) 32T5urH6uN4jhKenhW4LWM66WouzSCERbA - (Spent) 0.03213165 BTC 3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw - (Unspent) 1.1 BTC

than we can make fake transaction such as

  $bitcoin-cli createrawtransaction '[{"txid" :
  "718ae88f0eb13d2f2d3bc74cbf18721a82739b80f1bfc0658ed699263fca76fd","vout":0}]'
  ' {"MY WALLET ADDRESS": 1.0, "3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw":
  fee}'

in conclusion, it doesn't works but i want know why this code not working

in conclusion, it doesn't works but i want know why this code not working

This part {"MY WALLET ADDRESS": 1.0, "3LnZGyRAeCA3LAMBU2RSQn6dAkHw8rWquw": fee} will throw an error, but the more general answer about security is:

You can only generate a valid transaction if the wallet file you have open contains the private keys that can sign the transaction you've made. If you can't produce a valid signature, then it will not be a valid transaction, and the network will not relay or confirm it.


Does Coinbase have the ability to create a "Business" Account? Wanted to see if anyone here knew if you are able to work with Coinbase to create a "Business/Corporate" level Accounts?

Meaning that when signing up and linking a bank account to your Coinbase account you could choose to use your Business bank account, and verify using an EIN instead of a personal SSN?

Thank you for your help in advance.

I'm with Coinbase (proof), better late than never with this answer.

We do have a way of doing this now, though it requires some extra verification steps to properly link your account to the business entity.

Email us at support@coinbase.com


If I abandon a slow to verify transaction is my wallet recredited? Just tried to transfer some bitcoins to my new trading account online to get some cash out. But as luck would have it the transactions were all massively backlogged and I apparently did not use enough fee to get enough miner's attention to push it out. Was stuck in the limbo of non-verified so tried to see if I could cancel or bump the fees. Since it was not yet verified I did restarted my bitcoin Core with the wallet option to wipe unconfirmed transactions so I could get the client to ungray the "abandon" button. That worked. But now I am unsure if the bitcoin was recredited to my wallet since I forgot to write down the pre/post balances.

When this transaction falls out of mempool (I presume it will) does the wallet get recredited or did that happen automatically when I abandoned the transaction? Just want to make sure I have not just lost some bitcoins in limbo forever...

To understand the situation fully, let me clarify what happens when you publish a transaction.

Upon publishing a transaction, the bitcoins do not "leave your wallet". At any given moment, a "bitcoin" exists as an address in the blockchain that has an "unspent output". Publishing a transaction simply broadcasts your intent to spend that output to a new bitcoin address, but until the transaction is confirmed (mined into a new block), your bitcoins still reside at their old address.

So, after publishing a transaction, the network's nodes will understand that someone is trying to spend an unspent output, so your wallet will not give you the ability to spend those coins more than once (there are some special cases, but for normal transactions this is the case). So it appears your coins are unspendable, locked 'in limbo', but they in fact still reside in your address, until the transaction confirms.

You can make your wallet forget about its previous unconfirmed transaction, but you will never be able to guarantee every node in the network will also forget it. If your transactoin does not confirm after a long while, enough nodes will likely forgot the transaction that you will be able to publish a new transaction to re-spend the coins.

So bitcoins cannot become 'lost in limbo', there just might be times where the network ignores a more recent transaction, in favour of another older one that that spends the same coins, and that they saw first.