How to install Hard Fork of Bitcoin, such as Bitcoin Cash and Bitcoin Gold?

I agree with you, that from a marketing standpoint, the different names used by the various implementations of the Bitcoin Cash fork are confusing.

First, let's understand what a fork is. The rules about what constitutes a valid block, to be added to a blockchain, are set in the program code which miners follow. They compete to be the next to validate a transaction block and add it to the blockchain.     A fork occurs when these rules are changed by some, in a way which is incompatible with the old rules. A subset of miners starts following the new rules, and the rest of the miners keep following the old rules.  The result is that each group of miners starts building distinct chains which fork from a common ancestor chain.     So, if someone holds coins the original common ancestor chain, those coins are now valid on both forks, and can be spent once in each fork. This is because as far as one chain is concerned, spends on the other chain are not visible - they don't exist.

The main difference between original Bitcoin and Bitcoin Cash is that the Bitcoin Cash chain allows transaction blocks to be up to 8 MiB in size, instead of being limited to 1 MiB.

To install the Bitcoin Cash fork, one way is with Bitcoin ABC, "a full node implementation of the Bitcoin Cash protocol". In other words, Bitcoin ABC follows the rules of the Bitcoin Cash fork. In the Ubuntu 16 "Xenial Xerus" command line:

# git clone https://github.com/Bitcoin-ABC/bitcoin-abc.git

This clones the official Bitcoin-ABC repository into your machine. Instructions for installing all the pre-requisite pacakges needed to compile the programs will be in ~/bitcoin-abc/doc/build-unix.md; read this file and make sure your machine is ready for compilation:

# ./autogen.sh
# ./configure
# make

Note: on a mult-core CPU machine, you may use 1.5x the number of cores to speed up compilation. For example, on a 4-core machine:

# make -j 6

Now, in the ~/bitcoin-abc/src directory, after compilation, you will have the server binary: bitcoind, the client: bitcoin-cli and another binary to create, parse, or modify transactions: bitcoin-xt. For convenience, you can copy these to a folder visible to all users, such as /usr/local/bin

sudo cp ~/bitcoin-abc/src/bitcoind /usr/local/bin
sudo cp ~/bitcoin-abc/src/bitcoin-cli /usr/local/bin
sudo cp ~/bitcoin-abc/src/bitcoin-tx /usr/local/bin

Then, as a regular user, create the .bitcoin folder

mkdir ~/.bitcoin

and create a bitcoin.conf file

vim ~/.bitcoin/bitcoin.conf

#------------------------------
server=1
daemon=1
listen=1
maxconnections=16

rpcuser=bitcoin.rpc
rpcpassword=<some-secret-password>
rpcport=12345
keypool=256
#-------------------------------

Then you can run the bitcoind binary.

#bitcoind

and start using it via the command line client

#bitcoin-cli getinfo

{
  "version": 160200,
  "protocolversion": 70015,
  "walletversion": 60000,
  "balance": 1.61803398,
  "blocks": 504043,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 136961411965.4142,
  "testnet": false,
  "keypoololdest": 1376702008,
  "keypoolsize": 4096,
  "unlocked_until": 0,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}


Where is my bitcoin balance stored in the blockchain?

The blockchain defines your balance, but it doesn't have a specific field in which your balance is stored.

Yes, it needs to be analyzed to find your balance. However, it doesn't have to be analyzed all over again, just to check for the balance of a new address. Instead, checking the UTXO set (which only has to be created once and then to be updated every time new blocks are received) is sufficient. Furthermore, not the entire UTXO set has to be traversed. There are things like hash maps which make this a lot easier.


ELI5: What's the difference between a child-key and a hardened child-key in BIP32

Essentially, a hardened child key is is computed with hash(parent private key + index), whereas a non-hardened child key is computed with hash(parent public key + index).

So what practical consequences does this have?

With an extended public key, you can derive non-hardened child public keys. This is useful in situations where you want to accept payments without immediately being able to spend them. For example, if you had a website selling alpaca socks, your server could use an extended public key to accept payments without losing all of your money if it got hacked. So that's a reason why you might use non-hardened derivation.

With an extended private key, you can also derive hardened keys.

However, non-hardened public keys are weaker when an attacker has 1) the extended public key and 2) one of the non-hardened private keys that was derived from it. In that circumstance, the attacker can work out the private key of the extended public key, and therefore get every key that can be derived from that, hardened and non-hardened.

So what should your app use by default?

You should use non-hardened keys, and disable the ability to export private keys when that would allow an attacker to compromise other keys in the wallet. Even if an attacker gets ahold of one of the private keys, in situations where the attacker doesn't have access to the extended public key, non-hardened is equivalent to hardened security. In my mind, the features of non-hardened keys outweigh the added security of hardened keys.

However, if you don't need the features of non-hardened keys, then you should use hardened keys, because they're more secure.


How to import a 64-byte long private key

Taking into account that 64bytes keys are probably seed keys in bip32 format you might need to derive the key first. I modified the code to reflect that

npm install coinstring hdkey
node
var HDKey = require('hdkey')
var cs = require('coinstring')

// This is your base64 key
var seed = 'oMQqnDrGq/K6aplGroOvGPUb8cn6fazEySUTzE3QFYNDQcd13NTA+sc1R8VmLYGp6TYaCqxgSnOjIb2RA7zorw=='
var hdkey = HDKey.fromMasterSeed(new Buffer(seed, 'base64'))

var hex = hdkey.privateKey
var version = 0x80; //Bitcoin private key
console.log(cs.encode(hex, version))

It should give you the familiar WIF format private key.

5HyfJgfUm7WVgUrLuo9uwtJR6ME7MYfGRhK2aeckZRooSKYGXP8


How can I use Bitcoin Core with the anonymous network protocol I2P?

Jon Atack answered this on Twitter. First install and start I2P (version 2.35 or above).
$ apt install i2pd
$ systemctl enable i2pd.service
$ systemctl start i2pd.service

In your bitcoin.conf file add (I will assume you run Bitcoin Core v22+ and want to use both Tor and I2P but remove debug=tor and onlynet=onion if not interested in Tor):
debug=tor
debug=i2p
onlynet=onion
onlynet=i2p
i2psam=127.0.0.1:7656

There are 2 config options for I2P. Only the second one is required to be set for I2P to work.
  -i2pacceptincoming
       If set and -i2psam is also set then incoming I2P connections are
       accepted via the SAM proxy. If this is not set but -i2psam is set
       then only outgoing connections will be made to the I2P network.
       Ignored if -i2psam is not set. Listening for incoming I2P
       connections is done through the SAM proxy, not by binding to a
       local address and port (default: 1)

  -i2psam=<ip:port>
       I2P SAM proxy to reach I2P peers and accept I2P connections (default:
       none)

Then to view your I2P peers:
watch -t ./src/bitcoin-cli -netinfo 4
(For more information on -netinfo see the help documentation using bitcoin-cli -netinfo help or this StackExchange question)

This was enabled by Vasil Dimov's Bitcoin Core PR 20685 merged in March 2021 and BIP 155 for addrv2 messages
Historical discussion of supporting I2P back in 2012 is here. (Thanks to Adam Jonas for finding this)


Sending funds via routing number from bank

Not without an intermediary. Banks deal with traditional currencies like Euros or US Dollars, whereas Bitcoin is completely based on transactions involving bitcoins.

The only reason bitcoins have a value denominated in USD or Euros is that there are people willing to buy them for that value. Other than that bitcoins and traditional currencies are completely detached from each other.

So either your bank accepts bitcoins and allows you to trade them or, more likely, you'll have to find someone who buys bitcoins and then you transfer the money you received in exchange to your bank account.


How to know if cgminer is really mining?

CGMiner no longer has support for GPU or CPU mining at all. You are currently not mining anything. In order to do GPU mining, you will need to either compile it yourself to support GPU mining or get an ASIC or get an older version of CGMiner that supports GPU mining or find a fork of it that supports GPU mining.


Which part of my wallet should I NOT lose? .wallet file or private/public key?

In the original Satoshi wallet (BitcoinQt), your private keys are stored in the wallet.dat file. SO essentially, you may not lose either.

You private keys are the data that grant you access to your coins, so those are the ones you should keep safe at any time. Most wallet clients call the file they store your keys in your "wallet". Various wallet apps will save the file under a different name, but mostly you can export it using the app itself or find it in their data directory.


Selling btc but avoiding bank payment reversals

however payment reversals are a problem with bank wire transfers.

"Different wire transfer systems and operators provide a variety of options relative to the immediacy and finality of settlement and the cost, value, and volume of transactions. Central bank wire transfer systems, such as the Federal Reserve's FedWire system in the United States, are more likely to be real-time gross settlement (RTGS) systems. RTGS systems provide the quickest availability of funds because they provide immediate "real-time" and final "irrevocable" settlement by posting the gross (complete) entry against electronic accounts of the wire transfer system operator."

Source: https://en.wikipedia.org/wiki/Wire_transfer

So you are probably not referring to a FedWire or SWIFT wire transfer (which are not reversible) but instead to something like ACH (U.S.), or other domestic national bank transfer method.  When a seller's advertisement specifies "wire transfer", the seller is not referring to these non-RTGS electronic funds transfer networks.

One property of most P2P Trading exchanges is that they provide a trust history/reputation of your counterparty.  While that doesn't guarantee that you won't be defrauded from a reversed payment, it is a tool in which you can use to significantly reduce the risk of fraud by not accepting a reversible payment method unless the counterparty has a great trust history.

One approach to lessen risk is to do several, smaller trades with multiple counterparties rather than a single large trade with one counterparty.

Additionally, having the buyer deposit cash into your account is a method with less risk (but not zero risk).

Otherwise, local, in-person cash trading is a safer method.


Educational sample of minimal working mining code

I think that these articles are great for educational purpose:
Bitcoin mining the hard way: the algorithms, protocols, and bytes
This article explains Bitcoin mining in details, right down to the hex data and network traffic. If you've ever wondered what really happens in Bitcoin mining, you've come to the right place.
http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html

Mining Bitcoin with pencil and paper: 0.67 hashes per day
I decided to see how practical it would be to mine Bitcoin with pencil and paper. It turns out that the SHA-256 algorithm used for mining is pretty simple and can in fact be done by hand. Not surprisingly, the process is extremely slow compared to hardware mining and is entirely impractical. But performing the algorithm manually is a good way to understand exactly how it works.
http://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html

The first one include also small programs in python that mines a block and connect to a mining pool stratum server.


Is there an alternative to Bloom filters?

I assume you are talking about BIP 37 which uses bloom filters for SPV wallets.

Currently there are no alternatives to BIP 37 for SPV wallets. However roasbeef is working on a proposal for client side filtering, which you can read about here: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-June/014474.html. Client side filtering is an alternative to using BIP 37 and should work much better than BIP 37 does.


How do I get the public bitcoin address from a given private key in wallet import format offline?

I'd check out the python library PyBitcoin (https://github.com/blockstack/pybitcoin or "pip install pybitcoin").

It's pretty simple to get the address from the wif private key:

>>> from pybitcoin import BitcoinPrivateKey
>>> private_key = BitcoinPrivateKey()
>>> private_key.public_key().address()
'1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T'

You can also derive a private key object from it's raw hex representation:

>>> private_key_2 = BitcoinPrivateKey('91149ee24f1ee9a6f42c3dd64c2287781c8c57a6e8e929c80976e586d5322a3d')

P.S. This library also works with Litecoin, Namecoin and a bunch of other coins.

Disclosure: I'm one of the creators.


This wasn't a double spend, I'm sorry to say, but it looks like your bitcoin was stolen.

The reason the transaction out says '1 BTC' is that your bitcoin was combined with bitcoin from a bunch of other addresses, and sent all together to that new address.

You'll have to carefully think about how this might have happened. If your wallet was backed up by email, it may simply be that your email account was compromised.

Again, sorry for your losses :(


Spying on a bitcoin user after knowing all of their addresses

If you know all the addresses the person has, you automatically know their bitcoin balance. Generally, it's not easy to know all the addresses associated with a person because creating an address costs almost nothing. Proposals like BIP47 create them on the fly based on the wallets of the two parties, so yes, there is a way to stay anonymous at least on the blockchain.

The thing you have to worry much more about isn't the bitcoin aspect, it's actually everything around it. If you ever order something from NewEgg using bitcoin, that associates the addresses to you right away. If you have an account at Coinbase, that associates you to your address. It only takes one slip before a determined adversary can associate you and your bitcoins.


Does it Cost Money to Issue Digital Certificates on the Bitcoin Blockchain?

(I'm a Blockcerts developer)

Andrew is right -- that is simply the transaction fee. That fee is the same no matter the number of certificates in the batch for Blockcerts issuing.

I note that the documentation you're referring to is out of date, so I updated it just now to add more current fee information and to clarify how to determine the transaction fee.

Updates:

Ensure you've transferred sufficient funds to your issuing address to cover the transaction fee.

The transaction fee is the same no matter the number of certificates in the batch.
The default transaction fee used by cert-issuer is 60,000 satoshis (~$1.50 USD, 7/3/2017).
Because the transaction fee is a factor in confirmation time, you may decide to increase or decrease this value in the config file (read more about current transaction fee/latency estimates: https://bitcoinfees.21.co/).


How to extract all the bitcoin addresses with bitcoin-cli?

Answering this question requires first defining what an address means.

Historically (before BIP16 activated in 2012) an address was a synonym with a "public key identifier", as there were no addresses for multisig constructions or anything like that. Under this interpretation, pay-to-pubkey or pay-to-pubkey-hash outputs would be seen as having the same address - after all, the key is the same. This is problematic, because sending to the "address" corresponding to a pay-to-pubkey script would not actually send to that script, but to its corresponding pay-to-pubkey-hash script. Sufficiently old software, and some newer software (including some block explorers) use this interpretation, leading to confusion.

Most software now treats an address to be a human-readable notation for encoding specific scripts (corresponding to the script that would be constructed if a wallet were to be instructed to pay to said address). Under this interpretation, pay-to-pubkey outputs simply don't have an address (as there is no way to make wallet produce such outputs), and certainly not the same address as for the pay-to-pubkey-hash output with the same key.

The software you're using follows interpretation (2), so the question makes little sense. It is showing you all addresses observed, but in this case, there just isn't any address involved. Transaction outputs in Bitcoin are freeform scripts, and only some of those have a corresponding address notation. Others are just scripts.


Keeping consistent market depth using Mt.Gox API

In my experience requesting the full market depth from MtGox, often results in flat out incorrect information. To deal with this I've resorted to constructing my own, in a similar manner as you described above.

What I do is, using the websocket api, I look at all incoming depth events. I then keep two ordered arrays of bids and asks. On depth events if the volume is positive I add the order to the respective array based on the type_str property. If the volume is negative I remove the object from the array.

Make sure to combine objects of the same price, but with different volume. Likewise when removing objects if the negative volume is less then the volume of the same prices object then only deduct from the volume instead of removing. This is how it is done on MtGox's server and it will lead to errors if done differently.

After letting this run for a little while, though not deep, the order book is quite accurate and representative of what the MtGox order book should be.


Problem solved. The error is caused by too many decimal places in the rate parameter. It would be good if the API returned a more informative error message though.

There is an API call to find the correct maximum number of places, as well as the minimum order for each currency pair. https://btc-e.com/api/3/info returns a list of currencies and information. The documentation is in Russian but translates easily with Google Translate.


How does the reference bitcoin wallet/client handle rejected transactions? (in the API)

With Bitcoin-Qt/bitcoind there there is no callback or other real-time notification that a transaction that had previously been a valid 0/unconfirmed is not a transaction that will not confirm due to there being another confirmed transaction for the same unspent transaction output (UTXO).

When a new block is found, each transaction can be inspected (using Raw transactions) to determine the INPUT(s).   If the input was already used by a previously seen transaction, then the spend from the block would cause the earlier transaction to be an invalid double spend and it can be purged.

The Bitcoin-Qt/bitcoind client will no longer display the 0/unconfirmed transaction for a payment received that becomes invalid after a double spend from a new block arrives.


Storing private keys in cloud providers enviroment variables

If the private keys are visible to you on your AWS account, then they'd be visible to anyone who has your session tokens (i.e. if a hacker would simply need to take your cookies to view the keys). So it's not only the cloud provider you'd need to worry about.
Always best to sign transactions on your own node which has no connection to your online accounts. You can build the transaction on your app, and send it off to be signed on your own server.
BitGo has some cool functionality that allows admin-approved transactions and multisig.


Perhaps this is due to the "malleability attack" that was going on; it can be that the transaction has gone through with a different transaction ID.  It would be easier if you disclose the input and/or output address.


Are there any bitcoin banks (online services) and what are the benefits and pitfalls of using them?

There are such services. But there's a good reason not to use them -- if one day the service is gone, so are all your Bitcoins. This has already happened once and will almost certainly happen again. As of yet, there are no companies I would consider sufficiently reputable in this business.

You can, however, keep both Bitcoins and other currencies in a TradeHill or Mt. Gox account. You can fairly easily transfer Bitcoins into and out of those accounts and they're run by well-financed companies that can reasonably be trusted. And both TradeHill and Mt. Gox have made noises about making their accounts more like online wallets.


Can a full node provide a bogus block bloomfilter to a Neutrino node?

They can lie to you about the filters, yes. However due to the filters being deterministic you can query other nodes for the hashes of their filters to gauge relative correctness. You can also use a watchtower like service to give a trusted set of the filters in some cases.

The original design document includes an extension for committing to these filters as a consensus rule. It is designed and presented as “levels” which can improve the reliability and security of using client side filtering in this manner.

  The security model of the oracle bloom filter can be vastly improved
  by instead committing a hash of the BFD inside every block as a soft-
  fork consensus rule change. After this, every node in the network would
  build the filter and validate that the hash in the block is correct,
  then make a conscious choice discard it for space savings or cache the
  data to disk.

https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-May/012636.html


Unknown Address Format Parsing Bitcoin Addresses from Blockchair Data

Having investigated this following @MCCCS answer, the following is information about the addresses provided by Blockhair support:

In fact, there are no addresses on the Bitcoin blockchain. There are
only scripts, some of them are standard and can be converted to a
Bitcoin address, some of them can’t — like nulldata (OP_RETURN)
outputs, nonstandard, and bare multisig. We use the d- prefix for
nulldata, m- for bare multisig, and s- for everything else.
This is briefly mentioned in this API documentation section:
https://blockchair.com/api/docs#link_300

Therefore, these addresses (for want of a better word) are valid transactions on the Bitcoin blockchain.
The prefixes used are:

d- nulldata
m- bare multisig
s- everything else

In conclusion, the data is valid but the outputs are not addresses in the normal sense of the word.
A link to the issue I raised on the Blockchair GitHub is here.


Here's a snapshot of the listchannels output on c-lightning as of Feb 19 2018 https://gist.github.com/coinables/4f29d85c3902b3d8b0d929cd318af3f9

And same time as above but the output is for listnodes https://gist.github.com/coinables/19223b8bf09a24a3a6e8240433df04bf

With these two data sets you should be able to create a simple nodes & edges relationship chart. Here's a very rough example using sigma.js, but the performance is quite poor. https://gist.github.com/coinables/034003b80148e88f68c641950ff08956


How can wallet software implement automatic channel management for Lightning Network?

I strongly advice against a fixed list of nodes. This might eventually become outdated. A better solution might be that you run the autopilot on a server and deliver the results to the user via an api. This of course would be a trusted solution. But the lib_autopilot.py which empowers the clightning autopilot plugin is a standalone library that can easily be wrapped into a small webserver (or any server sided application) instead of being used as a clightning plugin on the client side. Also it allows much more configuration and fine tuning than the clightning plugin.

Running it as a server might actually make sense as the computations that are necessary to prepare the autopilot are quite heavy and memory intensive and might not be so great with a bigger lightning network on a client's machine. Also once those computations are done the results can be used to run the autopilot several times at rather low cost making it the perfect candidate for a server side application.

That being said the autopilots are experimental features. Being the author of lib_autopilot.py I am happy you agree that the c Lightning solution might be more mature than the lnd version. But I also want to stress with my increased knowledge about pathfinding and routing that I now have in comparison to one year ago I would create a much different autopilot these days.

Edit: sorry you asked how the c Lightning autopilot works. There is a presentation comparing it with lnd https://youtu.be/N7rlHCnaBf8 and explaining some of the challanges. Again it is one year old - so a bit has changed about what should be said about autopilots but it is a good start anyway


Is it possible to separate blockchain and wallet functions?

Is it possible to use bitcoin-core in this way?

No. bitcoin-qt is a completely standalone software that includes all of bitcoind's functionality. It does not start bitcoind in the background nor does it connect to a background daemon.


What does the Bitcoin client do when it receives conflicting transactions?

I can't speak for what it does every time but I just tested Mr. Schwartz's comment, so I can speak for what it did this one time. I remote controlled a geographically distant machine running an identical copy of Bitcoin on it and my local PC (with identical wallets). I sent identical conflicting transactions for my entire balance within a few milliseconds of each other (atomic clock sync & timers - don't ask) and just as expected, both transactions showed in both clients at 0/unconfirmed and only one made it into a block. The other disappeared after a -rescan

Curiously, after the -rescan the second transaction doesn't even show in a bitcoind listtransactions dump which seems odd to me. It seems like such erroneous transactions should be recorded and marked with a special status, similar to how orphaned block rewards are - this is an accounting system after all and under certain circumstances this could be "destroying evidence." I'll make a comment next time I'm on GitHub and see if someone bites.


I can see a recent blockchain.info "confirmed" transaction in a shared wallet, but I do not have a balance?

I don't know if you asked this question before or after transaction ae751e14246b4287e44196ec6db01e656872dd7dc3cfb68b44e931a27c431f95 happened. In that transaction, the 1 BTC associated with 15wGmQqaYHhBqB6bEFvrXz4CJGNeBhQkmv is spent, thus there are now no coins associated with it. The balance shouldn't be reflected anywhere because it is zero.


Can I increase or decrease the block reward an year after launching my altcoin?

You can do whatever you want, so long as the people who mine it agree to mine on top of your change.

In Bitcoin, the block reward goes down on a set schedule.  Everyone knows this, and it's baked into the protocol.  Any mining nodes producing blocks that don't conform to this (or any other part of the protocol) are wasting their effort since nobody will accept their blocks.  The rest of the network will continue as if nothing happened.

You can create a coin that says "on Sep 18 2018, the block reward will half", and have that rule baked into the protocol.  Maybe people will mine it...maybe they won't.  If they do, they do so knowing that the block reward will change on that day, and will reject blocks from nodes that don't follow that rule.

You could also create a coin that says "the block reward will never change", and then have some mining nodes change it anyways a year from now.  This would create a hard fork, and again, maybe people will mine on top of the fork...maybe they won't.


Is it a bad idea to use a bitcoin wallet address in a domain name or URL?

If you mean as part of a URL or domain name, then yes, I think it's a bad idea. If your private key is somehow compromised (eg through a stolen or hacked PC) you may no longer want to use that address, but your users may have it in their bookmarks for years afterwards.

However, as long as it didn't have any particular meaning (such as being accompanied by an instruction to donate to that address), it may not cause any harm. Secondly, it's easy to redirect a user's browser to a new page if you need to.

Usually URLs are best kept short unless it's a sub-section of a site used for sharing or bookmarking. Keeping them looking like words (as much as possible) helps with usability, so unless your vanity address is the longest ever generated and you want to show off, I can't see a good reason to include it there.


Have all hashes of unlocked difficulty levels of cryptocurrencies been mined?

No, and this will not happen in the foreseeable future.

Any given hash calculation will result in any one of 2^256 possible numbers. That means, the odds of finding any one exact number is 1/2^256.

Even at today's hashrate of ~47000000 TH/s, it would take you 7.812×10^49 years to find a preimage for every one of those 2^256 numbers, assuming each hash you find is unique (no collisions).


You can do getnewaddress as many times as you want. The keypool parameter just sets how many extra keys the client creates when it needs to create keys. With keypool set to 1, the client will create one extra key every time it needs to create a key.

Setting keypool low will keep your wallet smaller. But it will mean you have to backup your wallet more often to avoid losing the keys to newly-created addresses.


How are segwit block transactions verified?

This is not correct.
All segwit blocks do differently is having the witnesses (which include the signature) in a separately-hashed area. They're still an integral part of the block, and full validation cannot proceed without the witness data. Removing or altering the witness data will invalidate a block.
What this does permit is stripping the witness data without affecting validity according to pre-segwit validation rules. This is the basis for using segwit as a blocksize increase (the old 1 MB block size limit thus only applies to the non-witness part, as old nodes don't see the witness data). However, nodes that implement the segwit rules need the full witness.


If you are running bitcoind on a VPS it will expect the blockchain to be stored on the local disk.  You could setup a remote file system using NFS or SMB but this will probably slow down the node and make it less responsive.  Amazon already has one of the cheapest cost's for storage why not just increase the size of the drive?  If you are talking about moving the blockchain from disk and storing it in a database that cannot be done without modifying the bitcoin source code.


Very Slow Mining on CPU with 8 Core Xeon E5-2660

You have no hardware that is suitable for mining, so your mining rate is going to be atrocious. You'll never make enough to compensate for the extra wear and tear on your expensive, general purpose hardware.


Why can't I get over 8 connections on my client?

Typically connection counts of 10 or lower usually indicate that you are behind a router or firewall that is not configured properly. Try enabling UPnP from within the Bitcoin client's options dialog. If that doesn't work, try manually forwarding port 8333 to the computer which is running the Bitcoin client/daemon.


Why is target stored in the block at all?

You're presenting it as a choice between either allowing miners to choose the difficulty, or having it be implied by previous history.

In fact, neither is true. The target is determined by history (for the reasons you bring up), and the target stored inside the block header has to match the value determined by history.

At this point, there is no good reason for this anymore, and a design from scratch could IMO drop the nBits value from the header.

I don't know the original reason, but my guess is that it allowed for stronger contextless validation of block headers. Before version 0.10, Bitcoin Core did not use headers-first synchronization, and thus often did not have all parent headers available when a particular block was being received. Being able to verify that the block has valid PoW (even though the difficulty might be wrong) was a very valuable mechanism for preventing DoS attacks.


Is there a risk of double-spending when making a face-to-face transaction?

I proffer that it would depend on the tools used to make the transaction and broadcast it.

Assuming use of something like Bitcoin Wallet for Android or even a laptop running Bitcoin-Qt, the chances are very unlikely.

A malicious user would have to connect to the network with two devices simultaneously and broadcast the real transaction (the one being "sent" to the vendor) milliseconds after the malicious transaction. The vendor's client would have to see the real transaction before the malicious transaction, give the item to the malicious buyer, and depart company before realizing he's been had.

Simply put, a malicious user would have to be connected to more nodes in the network than the vendor and NOT be connected to any of the nodes to which the vendor is connected when broadcasting the malicious transaction, probably out at least one or two degrees of separation. This would ensure enough latency to ensure the vendor sees the real transaction first and surrenders the goods before the vendor's client says that other nodes think another transaction is of higher priority.

All of this can be avoided by waiting for a confirmation, but in real commerce, that may not feasible.


I have wrongly transferred 0.00184426 BTC, request please help to return it back to my wallet

Did you possibly convert your BTC to something called BTCTRON?  I don't know what this is (apparently some type of wrapped Bitcoin token on the TRON blockchain), but you can supposedly convert it back to BTC again with no fees.  See  https://support.poloniex.com/hc/en-us/articles/360054846854-Using-Bitcoin-on-TRON-FAQ
The  reason I think this is what happened is that the receiving address you gave looks like it's the one that you would have used to swap your BTC for BTCTRON.


Change -mempoolexpiry in BitcoinCore 0.20.1

I have accidentally made a transaction with a very low fee (5 sat/byte) and I doubt that it will be confirmed any time

It may get confirmed in few hours/days based on the fee distribution of mempool I see at https://btc.bitaps.com

How can I change the -mempoolexpiry setting in my BitcoinCore (0.20.1), which I run on Windows 10, so that I don't need to wait for 2 weeks for the transaction to be automatically dropped out of the mempool?

It can be changed in bitcoin.conf file however if the transaction is already relayed to other nodes I don't think it will affect anything.


Coinbase unlike Mt.Gox is not a bitcoin exchange, it is a bitcoin wallet with the option of buying or selling bitcoins using a US bank account. You can store bitcoins on the site but not USD.

This is primarily done for legal reasons. When you allow people to trade currency with each other instead of just being a currency dealer you open yourself up to a whole world of regulatory problems. Namely people would have to be extensively verified and new anti money laundering systems would have to be put in place to comply with FinCEN.


This feature is no longer present in Bitcoin Core.  It was removed in 2011.

You can get the same effect by adding multiple addnode= lines to your bitcoin.conf.


Trying to import from from blockchain.info to multibit, getting error "There were missing dates. Have to go back to genesis block."

The format of the blockchain.info wallet isn't ideal for importing into MultiBit. It works but MultiBit has to go back to the genesis block to make sure it gets all the transactions.

That is what the "There were missing dates. Have to go back to genesis block." message is for. It's basically saying - "Hey, this is going to take a while".

When you do the import it is best just to let MultiBit work away through the blockchain. On a reasonable spec PC with WiFi it takes about 30 minutes to chug through the blockchain.

This functionality is mainly in MultiBit so that is something happens to the blockchain.info server, users can still access their bitcoin.


How do I find a "Bitcoin address" for buying Bitcoin?

You have to download a Bitcoin wallet first. I suggest you to download Electrum, it's a lightweight wallet with easy UI. It will generate an address for you.


I've inherited BTC, how do I recover and sell it?

I'm sorry to hear of your loss. Recovering the funds will require some careful work, but go slowly and make sure you understand what you're doing, and you'll find it isn't that hard!
Importantly: Be very wary going forward - lots of scammers will likely attempt to prey upon you and steal your funds! DO NOT share the 12 words or 34 letter string with anybody online! DO NOT input those words into any online website or service. You do not need to trust or depend on anyone else to recover the funds. There is no 'official' anything in Bitcoin - it is a decentralized network without any admin. You (the user) are in full control, you can accomplish all the required actions without any dependance on a third party (except for the sale of BTC -> fiat currency, perhaps).

Those words are the 'key' that will allow you to spend the bitcoin, so to speak. To use the key, you will need to find some secure wallet software. I would suggest starting by looking at bitcoin.org, and selecting a wallet from the list they have there.
Once you have some wallet software running, you will want to select an option to 'recover'/'import'/etc your wallet, at which time you will be prompted to enter the 12-word mnemonic seed phrase. Once you do so, you should hopefully see the wallet load properly, showing the funds and all past transactions.
If an empty wallet with no transaction history loads, then you will likely need to select a different 'derivation path' for the wallet to follow. Some wallets (eg Electrum) allow the user to define a derivation path, while others do not. You may need to find software that allows you this more fine-grained contro.(Under the hood, the wallet is using the 12-word phrase to derive the cryptographic keys that allow you to spend the wallet's funds. There are different standards for which keys the wallet will derive, selecting the correct path is important!). It is helpful to know which wallet software was originally used to create the wallet, but if you don't have that information then all hope is not lost, it might just take some extra work. You could take a look at WalletsRecovery.org for some help/info.
With the wallet recovered, you will need to find somewhere to sell the coins for your local currency. Do your research to find a reputable service in your area, as you'll need to trust them completely with your funds. Once you've made a choice, send a transaction by copying the deposit address from the exchange service to your wallet's 'send' field. You can then make the trade for your local currency, and withdraw to your bank account by whatever methods the exchange service offers.

Keep in mind that you will want to make sure the device you load the wallet onto is secure. For example, a brand new iphone is going to be a more secure device than a 10-year old windows PC that hasn't been updated regularly.
You may want to consider how much BTC is at play here - if it is a huge sum then it may be worth first acquiring a small amount of BTC yourself first, to familiarize yourself with the tools and procedure of sending/receiving/recovering funds. That way, if you make any mistakes, you will just lose a small amount of funds, instead of the inheritance.


How do I relocate my bitcoin data in bitcoin-qt to save space?

I recommend reading about the Bitcoin Data Directory.  You should also take a look at this answer:  How do I specify in which directory Bitcoin blocks and other data should be stored?

Basically, all your Bitcoin data is stored in ~/.bitcoin on Linux.  Not only can you specify a different location for this directory using -datadir=/some/other/directory, but you could also symlink ~/.bitcoin to some other directory on a secondary disk or network share, like this:

ln -s /some/other/directory ~/.bitcoin

However, from personal experience, I would suggest not using a network share.


What does verifying a fake transaction mean?

The tweet seems very confused. Most likely, they meant "60% of the hashrate" rather than supply. It's not clear from the tweet what they mean with "verify a fake transaction". Charitably, one might interpret that they could execute a Finney attack, or execute a doublespend attack by reorganizing the chaintip in a form of majority attack. As written, it rather does sound as if the author of the tweet thought that miners could include invalid data in their blocks and the network would go along with it, which would imply that the tweet's author did not understand that all full nodes on the network independently verify blocks and reject invalid data.


The easiest way would be doing a snapshot, but this method depends mainly on OS or Hardware support.

Another option is creating a bootstrap.dat file, which is basically a concatenation of all blocks in a single file. When the node finds this file in its data dir it loads all blocks from it before connecting to the network, so the initial load can be much faster (again, depending highly on your IO and processing capacity...).

You can create a bootstrap.dat file using the tools here. To restore, see https://bitcointalk.org/index.php?topic=145386.0


How to debug bitcoin core in "real time"

There is no "makefile" command.

If you don't build the project, there is no way for you to debug it. The released binaries do not contain any debugging symbols so it will be very difficult for you to set breakpoints and see what is going on. So in order to do that, you will need to build the project from the source code that you downloaded. There are instructions for how to do this in the docs folder of the downloaded source code.


Electrum personal server rescan-script.py

Make sure that the wallet is enabled in Bitcoin Core. Electrum Personal Server relies on the wallet. Check that you are not starting Bitcoin Core with -disablewallet or that disablewallet=1 is not in your bitcoin.conf file.


Just received $50 worth of Bitcoin from someone?

It's impossible to deny BTC payments, you have probably provided your btc adress somewhere. It's extremely improbable that they typed in your adress randomly.

Only reason why you should worry is if published your private information and an that btc adress. But in this case it's just $50 and you can keep it unless you would like to return it to the sender.


How can I import an address or public key into my wallet.dat file?

A wallet.dat file will contain many, many bitcoin keypairs/addresses. So there is no reason to delete an older address, and in fact this is probably a bad idea. If you or anyone else ever mistakenly sends bitcoins to that address, it will be impossible to recover them once you've deleted those keys.

If you do not have the private key for an address, you will not be able to spend any bitcoin stored at it. That said, you can still import the address as a 'watch-only' address, meaning your wallet will keep track of the address' balance, but not be able to spend the coins (because you don't have the private key).

You can use the following commands:

bitcoin-cli importaddress for a bitcoin address

bitcoin-cli importpubkey for a bitcoin public key

Note that in order for your wallet to learn about transactions sent to the imported address/pubkey in the past, your wallet will need to rescan the blockchain (rescan=true by default when calling importaddress or importpubkey). If you happen to know which blocks the relevant transactions were included in, you can set rescan=false and then run rescanblockchain ("start_height") ("stop_height") and it will complete the rescan much faster.

And if you do have the private key, you can import it using:

bitcoin-cli importprivkey


What is the auhoritative source for providing hash of previous block?
  or do miners keep listening to latest blocks?

There's no authoritative source, that's the whole point of Bitcoin. Miners keep listening for latest blocks, yes. They decide for themselves which block to accept. And since all miners (and clients) are programmed to accept only valid blocks (where its header hash is equal or below than the current target) they soon reach consensus upon which blocks are valid.

  One more question: nonce size is only 4 bytes(32 bits). Given version,
  previousBlockHash, hashMerkleRoot, bits are constant, would not it be
  very easy to iterate through all possible nonces? 2^32 = 4 gigs = 4
  gig hash machine can finish this task in one second.

More often than not, just that 4 byte nonce is not enough randomness to find a block. Miners constantly add new transactions - therefore the hashMerkleRoot isn't really constant.

Also I think there's an extranonce field which adds more space.


who is sending all the 120-140 satoshi/byte transactions?

I noticed that blockchain.info wallets recommend fees in the 120-140 s/B range. I've been manually increasing my fee to ensure my transaction gets confirmed by checking https://bitcoinfees.21.co/ when I send money anywhere.

I would assume there is simply an error in how blockchain.info and potentially other wallets are calculating the appropriate fee.


Deterministic - BIP32 Derivation Gap Limit

The BIP44 gap limit approach is a weak or even broken concept for recovering BIP32 based wallets.
It makes an assumption about the use case of a BIP44/BIP32 based wallet.
The default limit of 20 (some even use 5) will quickly lead to lost funds in recovery if the wallet was used in non-super-trivial use cases.
The missing metadata in a BIP39 mnemonic or in BIP32 xprivs tend to make recovery complex and has a moderate risk of missing funds.
The ultra-safe(est) way to recover a BIP32 seed without metadata is to derive all possible keys (impossible) and all possible scripts, then, rescan the blockchain. But yes, your guess is right,... this is infeasible.
So how to recover?
If you develop a wallet or rescan tool, use a very large gap limit. Maybe 1'000 or 10'000.
If you are just a novice user?

Well, just make sure you keep your old backup in case you detected lost funds.
Don't purely trust a BIP32/39 recovery, make sure all your funds are there
If not, consult an expert (watch out for fraud, use a trusted person), or research how to extend the gap limit and how to derive multiple script types
If you are using Electrum, read here about the gap limits and ways to extend it


Using bitcoin-qt. Address with my funds does not show up. Can I import it?

You're probably safe. If you were using an old version of Bitcoin Core, it used to keep a key pool of 100 unused addresses around. When you request a new receiving address, one from that pool gets used. So, unless you received numerous transactions between the backup and the last transaction, your last transaction should be covered by the backup containing these 100 unused addresses.

If you're using a new version of Bitcoin Core, its wallet uses a hierarchical determistic key derivation where a single backup will always be enough to regenerate any later generated addresses.

Therefore, you should see our transactions appear when your Bitcoin wallet has synchronized with the current state of the network.


Is it safe to uninstall an old version of Bitcoin-qt after having installed the latest one?

Since you don't mention the operating system, but talk about "clicking the uninstall icon" I am assuming that you are using Windows.

Making a backup of your wallet.dat before updates and at regular intervals is sensible. If you installed bitcoin-qt 0.8.5 into the same directory as bitcoin-qt 0.8.1, uninstalling the older bitcoin-qt 0.8.1 might break your new install. If they are in separate install directories I would expect it to be alright (just based on what I would consider expected behaviour, I don't have intimate knowledge of the behaviour of the Bitcoin-QT-Windows client).

If you added any new addresses in since you imported the wallet to bitcoin-qt 0.8.5 you might have generated them after the last backup, so it would be prudent to create an additional backup of the newest wallet.dat.

Usually, I'd consider the following the correct order for an update (unless the software has its own update function):

backup
uninstall old
install new
import backup (by keeping the backup alive!)


Why must generated coins mature 120 blocks before they can be spent?

This rule is to prevent people from unintentionally spending Bitcoins that they wind up not owning.

For any Bitcoins other than the block reward, unless you intentionally double spend, a reorganization leaves your transactions valid. So they can just be included in the new blocks. (Assuming they don't spend the proceeds of a double spend.)

However, if there's a chain reorganization, there's no way to recover block rewards. Whoever mined the blocks in the other chain gets that reward. That would make your transaction invalid since it would spend funds you don't actually have.


Is withdrawal of BTC in cash possible on Bitcoin Wallet App

But I see no option there for withdrawal

Because withdrawal is not the appropriate action, the money is not in a bank account. The money is already in the form of cash - digital cash.

If you want to exchange one currency (BTC) for another (EUR), use a currency exchange.


Recovery from theft - Tracing money to exchanges

In brief:

You are not going to get your money back
If you try, you will lose more money
The money has by now probably passed through many exchanges and mixers in many corrupt foreign countries. And through the hands of other tricked victims.
As a victim of one crime, you are especially attractive to other confidence tricksters for further crime.  Be on guard.
Report the theft to the police
Ask your police commissioner and/or political representative to act
Accept the loss, move on.

Longer answer:

can anything be done?

No
I would contact local police. Though they won't be able to recover any money.
You will now be contacted by scammers using private messaging. They will tell you they can get your money back. Once they have your trust, they will tell you about a small release fee or a transaction fee or that you need to put money in to meet a refund threshold. In short they will make up lies to trick you into giving more money to criminals. Ignore all messages that are not on a public place, like this website, where many people can read the advice you get and correct any bad advice.

I lost my life savings

I'm sorry to hear that.
In retrospect you made some mistakes which I would suggest anyone else reading this should take care to avoid repeating:

Don't put all your savings into one place.
With volatile high-risk assets like Bitcoin, don't invest money you can't afford to lose completely.
Never use online paper wallet generators (some are relatively safe to use offline, but best advice is avoid all).
Always do as much checking as possible before sending money to online businesses.

Is it possible to determine which exchange were the coins sent to, looking at the transaction ID or wallet ID?

The transaction ID does not identify people or businesses.
There is no  Wallet-ID but there are "addresses" which people sometimes call a wallet ID - although a wallet can have hundred or thousands of different addresses. Nowadays, wallets generate a new address each time they are used to receive money. Bitcoin addresses are not like real-world addresses - they don't identify a person, business or place, Bitcoin addresses are random-looking numbers that are generated from other secret random-looking numbers.
Sometimes you can guess that an address was generated by an exchange because it is subsequently used in a bulk transaction with hundreds of other addresses - either consolidating funds or dispersing them en-masse. This doesn't tell you which exchange was used. A diligent forensic analyst may be able to eventually identify an exchange by use of test transactions and long-term data analysis.

Maybe I could write to exchange to block it?

The problems are:

The money won't stay at an exchange long. The exchange probably no longer has the money.
The exchange won't disrupt their customers business at the say so of a random stranger
The exchange has data-protection responsibilities. The have to protect the identity of their customers. It may take a court order to get them to act.
Criminals don't use their own name and KYC details at an exchange, they trick other victims into opening accounts in the other victim's name and giving the criminal the password (see numerous "sugar daddy" and fake-job scams reported here).
You may be dealing with exchanges, or a trail of different exchanges in far- away places like Russia, China, Nigeria, Switzerland and other tax-havens or countries with corrupt or semi-functional law enforcement. Getting their cooperation will be hard.

You have to involve law enforcement.
Recovering the money may cost tens or hundreds of thousands of dollars and take years. Most likely it will prove impossible. You were duped once, if you go down this path you will almost certainly be duped again. Several times.
I hate giving this sort of advice because making people give up aids the bad guys. But I don't like to think of people throwing good money after bad and making their situation even worse. The best thing you can do is probably work with local law enforcement, try to get your local political representative to appreciate the impact this type of crime has on their electorate - you are not the only one affected.


Did the new nodes accept the old blocks in hard fork?


What is the average amount of electrical power required to complete one Bitcoin transaction?

Once a bitcoin has been mined, if I want to use it to pay for
  something, what is the average amount of electrical power required to
  process that payment or bitcoin transfer?

That a transaction is processed could mean it has gone all the way from its generation up to its addition on the blockchain within a mined block confirmed by all nodes.

The only significant consumption in the process is the guessing of the correct hash of the block that includes this transaction along with cca 2000 (meaning around 500 byte transaction size on average) other transactions included in it. This guessing (lottery) difficulty varies with time thus the energy consumption varies. Current guessing difficulty is 1,452,839,779,146 (https://bitcoinwisdom.com/bitcoin/difficulty), and the average number of guesses to make is 2^32 * difficulty (2^32 * 1,452,839,779,146 = awfully high).

Now you can find the energy consumption for example by examining some high end mining device like AntMiner S9 and checking its hashing rate (for this example 14,000,000  Mhash/s, https://en.bitcoin.it/wiki/Mining_hardware_comparison) and its power consumption (1,375 W).

Average_number_of_guesses / hashing_rate = Guessing_time
Guessing_time * power_consumption = Energy_spent_for_mining_a_block
Energy_spent_for_mining_a_block / number_of_transactions_in_block = Energy_spent_per_transaction

If I've done calculation correctly this should be around 85 kWh per average transaction. (Note that not every mining device on the network is AntMiner S9 so this figure should be used with reserve).

  Does this vary with the value of the transaction, and if so in what
  manner?

It does not vary with transaction value but the size of transaction in bytes and this varies by the number of inputs and outputs of transaction. If has more inputs and outputs it will be bigger in size thus allowing less transactions in a block and the last equation will change accordingly. For example if transaction is 1000 bytes big instead of average 500 used in last equation it will use around 170 kWh


resilience to sybil attack - public vs private

Definate yes.

The Sybil attack in computer security is an attack wherein a reputation system is subverted by forging identities in peer-to-peer networks.

If nodes are required to proove their identity before they can join the network, just like in permissioned or private blockchains, then they will not be able to forge the identities.


A specified locktime indicates that the transaction is only valid after a given blockheight.
Since the locktime field indicated is 419382 and currently the latest blockheight as of 12th July 2016 1108 (AEST) is 420352 the transaction is now valid and can be included in a block by any miner that chooses to do so.


How can a lightweight client make sure output has not been spent yet?

There are currently 115 or so nodes which will answer the getutxos message.  This is as good a source of this information as calling a 3rd party API.  The problem with both of these sources is that they do not provide cryptographic proof.

It's not actually possible to prove an output unspent, for the simple reason that it may have been spent in a block found an instant after the proof was produced.

The idea of UTXO commitments would have miners publish a digest of the entire UTXO set in every block, which could be referenced to prove that a specific UTXO was unspent as of the lastest one, but you're probably also interested in any unconfirmed spends that are floating around out there.

It may be a better idea to ask your peers to try to prove that an output is already spent.  Only confirmation should build your confidence in an incoming payment, but a spend proof in the form of a conflicting transaction (+ merkle branch, if found in the chain) can instantly lower your confidence to zero.


c# BitcoinLib: GetRawTransaction verbose=1 does not work

RPC decoderawtransaction doesn't return a confirmations field so yes, you should use getrawtransaction in its verbose mode instead.

I called BitcoinLib's GetRawTransaction for the tx in question and I got a proper response, as expected:

Please make sure you have BitcoinLib's latest version and that your wallet is synched and indexed.


Yes, BTC and BCC share the same addresses and the same private keys.


I once created a bitcoin account

This implies you created an account with an online business through a website. Perhaps they managed your money for you in their wallet. This is arguably the most insecure way for you to hold Bitcoin.

  and obtained an address

You don't mention a private-key. If you don't have sole control of your private-key from its creation until now, then you don't really own any bitcoin yourself.

  What happens to my transfer?

If you have an account (or two) with some online business, you have to contact them to find out what happened to any money you gave them.

If so, this isn't really a question about Bitcoin itself - which was designed to work without the need for any online business to hold your Bitcoins for you.

Bitcoin transactions cannot be reversed or cancelled. The Bitcoins are owned by anyone who knows the private-key for the address you sent Bitcoins to.

  how do I use the address to locate the bitcoin wallet so my money wont be lost?

You can't use an address to find a wallet.

You can look inside wallets to see which addresses they contain. If a wallet contains an address that matches the address you originally obtained - then you have found one of possibly several wallets that can spend the Bitcoins associated with that address.

20-30% of all Bitcoins are lost forever and can never be spent by anyone at all.


Are there any Scala libraries/implementations/projects on bitcoin?

I really don't think it's needed. Bitcoin is a complicated project, it's better to have one canonical JVM-based library than a library in each JVM language.

AFAIK there is currently no Scala library, and I'm betting there won't be for some time (unless perhaps as a wrapper to bitcoinj?)


What does it mean that fork is required?

Fork means in this context that devs are about to change some fundamental hardcoded rule. This may mean that the part of network which didn't upgraded client to new version will run on one set of rules and another upgraded part of network will run on other set of rules. In general, network fork means inconsistency of whole network.


The hsm_secret is used to derive keys for both onchain and offchain (channels commitments) transactions.
On chain
To retrieve on chain funds you can rescan the block chain for your utxos by using the --rescan startup option of lightningd.
Off chain
You can not re create the whole state of your channels just from the hsm_secret, which are stored in the database. Moreover it's very discouraged to restore from a backed up database (penalty transactions...).
Fortunately, with the option_static_remotekey now enabled by default you can now claim your funds onchain after your peer force closed the channel (if the channel was opened when both peers signaled this option).
The process is detailed here as part of the C-lightning FAQ draft.
How do i backup, in practice ?
The different backup solutions currently available are detailed here.


What is the oldest Bitcoin Core Client that can in theory sync to the chain tip?

The oldest version that can sync is 0.8.6. This is the version that first used LevelDB instead of BDB. Both the IRC node discovery and the protocol message changes occurred several versions prior.


Buying bitcoins with credit card or Paypal is possible, but usually very expensive because the seller has to cover for the risk of chargeback. Bitcoin transactions are not reversible, so if you dispute the charge the seller is in a very weak position.

Cex.io is an exchange that offers credit card purchases to its clients, but you have to go through several id verification process that will probably make you uncomfortable. After buying you would just need to make a withdrawal to the desired Bitcoin address.

If you are open to using your bank account instead of a credit card, you have more options, but which are available to you will depend on where you are. A couple well known ones are:

Litebit.eu. They accept SEPA bank transfers and a few other lesser known payment methods (iDeal, GiroPay and a few others). You just make the payment and give them the address.
Coinbase.com. They are one the biggest exchanges out there and many people use them as a wallet (they are not wallet because they keep custody, not you, but that is another discussion). You can link their account to your back account and make Bitcoin purchases. You then can send your bitcoins to whoever you want. However, they have closed customer accounts in the past if they detect that you send funds to services they don't consider legal, like gambling sites, so if that is your intention I would not use them.

There are many more if you make a couple Google searches, but I have mentioned only services that I know have worked well for people I trust.


How to build a p2sh who's scriptsig contains a Signature

You might want to review BIP16 (pay to script hash)
https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki

The signature is not included in the redeem script, typically just the public key. (Your script could be anything, all I know is it has a CHECKSIGVERIFY in it, so I'm answering broadly...)

The INPUT SCRIPT aka scriptSig of the transaction SPENDING from the P2SH output would then need to contain the signature and the entire serialized redeem script (the preimage to the script hash in the output).


Since van der Woerdt's answer in first question you link to indicates you can simply concatenate the blk files, you can open a DOS window (if your using windows), then type

CD C:\Users\<my_user>\AppData\Roaming\DogeCoin

(if you're on Win7+)

And then

COPY /b blk0001.dat+blk0002.dat bootstrap.dat

And that would be it!


Are stale blocks retained forever or are they "pruned" automatically at some depth in the chain?

In Bitcoin Core (as of 0.19.1) they are not pruned unless pruning is enabled in general (in which case they're pruned along with all other blocks).

They are indeed superfluous, but they're also cheap to keep. Stale blocks are assumed to be rare (if they're not, the network has bigger problems), and if disk space is an issue in general, pruning should already be enabled.

Note that only blocks with verified PoW and a chance to be part of the best chain are actually downloaded and stored. This means that exploiting stale block storage as a DoS attack is incredibly expensive.


Selecting a computer for the OFFLINE Electrum Wallet

It seems possible but a bit of a hassle to install python (required for Electrum).

According to this
question
you can enable Developer Mode to get a shell.

Alternatively there seems to be a Chrome plugin to get a shell.

Thus, if you already have the Chromebook it is a viable choice. Otherwise I would suggest a cheap system which allows more freedom out of the box.


How can I set the port of bitcoind to run Armory through Tor?

Having never tried this myself, I can't answer it with my own personal experience.  But there is a thread with input from several people on a question pretty similar to this in Bitcointalk: https://bitcointalk.org/index.php?topic=155717.0  That thread may answer your question, and if not, feel free to ask followup questions there.  (There used to be a requirement to be in the newbie forum for a while, but this requirement has since been removed, so all you need to do is create an account on bitcointalk to post questions.)


Bitcoin Energy Consumption and Carbon Footprint a good long term investment?

I have read somewhere that every Bitcoin transaction is "equivalent to the power consumption of an average U.S. household over 22.86 days.". Is that true? Isn't that horrible?
tl;dr: Most people don't value Bitcoin as a payment mechanism, and even if they
were, most payments are not recorded on-chain. So calculating the energy cost of
a transaction is as impossible and nonsensical as it would be for gold.
It's true in a similar way that the lack of pirates is causing global
warming.
Yes, this is a valid estimation of Bitcoin mining's energy use divided by a
valid estimation of on-chain transactions, compared to a probably valid
estimation of household electricity use.
However, connecting these three figures in this way doesn't yield any insight
beyond shock and awe. That's because Bitcoin's primary value is not as a payment
network, so the number of on-chain transactions is not an interesting metric for
it. This can be seen easily: On one hand the number of onchain
transactions
has always been limited — and that limit has been pretty much hit constantly
since at least 2019. On the other hand, the value of Bitcoin, as well as the
estimated number of its users, has been rising over many orders of magnitude
since 2009. How can this be possible?

In recent years, long term store of value has become Bitcoin's main use case. That is, people use it more for storing their savings than for paying for goods and services.

Its current usage is thus more comparable to gold, which is also rarely used in transactions. I have never seen anybody calculate the energy cost of gold mining plus handling divided by the number of physical gold shipments. Probably because that's as misleading a number as the equivalent in Bitcoin.

Just as with gold, there are ways to make even small transactions quickly and cheaply with Bitcoin. Most real-world transactions use one of these off-chain methods. Probably the most popular today are custodial services like exchanges. Sending bitcoin from one customer to another on a service like this just requires changing two numbers in their database and is the equivalent of gold in a bank changing owners. It's hard to say how many such transactions there are, since there are many "bitcoin banks" and their numbers are proprietary, but it's safe to say they dwarf on-chain transactions by orders of magnitude.

Unlike gold, there are methods of transacting Bitcoin off-chain that require less trust in intermediaries, such as the Lightning Network or Blockstream's Liquid federation. With a growing demand in transactions, such alternatives are refined and gain popularity, without this being reflected in the above numbers. With the Lightning Network, it's even difficult to estimate how many transactions are being performed, since there is no central ledger recording them all.

But I have read that Visa transactions are much more economical!
That's because these are very different things. Visa transactions are just a few
companies changing a few numbers in their databases. It's basically just a fancy
way of signalling an intent to spend something. It's not final. There might not
be a real transfer of value happening at all (all the "money" is still debt in
the same bank, just on another account).
On the other hand, a Bitcoin onchain transaction is a real transfer of a bearer
instrument, comparable to a gold shipment from one central bank to another.
Those are also quite expensive, I imagine. It's total overkill if you want to
buy a coffee. For that, it might be enough to just update some numbers in a
(Bitcoin) bank. Or use the Lightning Network.
If you have a little time, Nic Carter has explained it much better than me.
If you have more questions regarding Bitcoin's carbon footprint, I recommend the FAQ at netpositive.money


No, only Schnorr signatures are supported.


Do I need both bitcoin client and guiminer to do mining?

If you are mining at a pool, you don't need a client to be running - the pool will provide you with all necessary information.

If you are mining by yourself, you need to run the client to know what you need to put in a new block.


What piece of code would allow me to check if a block has been found then run an operation?

You could simply record the value of bitcoind getblockcount somewhere and see when that changes by calling getblockcount repeatedly.


How to identify the owner of a Bitcoin address?

First off, I'm glad you didn't send money as that often does not help in these situations. As for tracking the attacker through their bitcoin address, I'm sorry to say but most likely that is not possible. It's impossible to determine the location of a bitcoin address without some sort of identification tied in. They also most likely would tumble the bitcoins before sending them to any address actually tied to their identity.

You could give all the information you possess to your local police but most likely there is not much more they can do. These type of scams are pretty safe to commit sadly.


Check https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#serialization-format
((sequence & 0x80000000)==0) means it's not a hardened key. The key is hardened (public key derivation not possible) for child keys with index higher then 0x80000000 (== 2147483648 == 2^31).
From the BIP
4 byte: version bytes (mainnet: 0x0488B21E public, 0x0488ADE4 private; testnet: 0x043587CF public, 0x04358394 private)
1 byte: depth: 0x00 for master nodes, 0x01 for level-1 derived keys, ....
4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
4 bytes: child number. This is ser32(i) for i in xi = xpar/i, with xi the key being serialized. (0x00000000 if master key)
32 bytes: the chain code
33 bytes: the public key or private key data (serP(K) for public keys, 0x00 || ser256(k) for private keys)


When we receive a transaction or BitCoin payment, do we need to verify the message?

There are two distinct concepts here, confirmation and message verification.

Confirmation is a process by which transactions are confirmed as authentic and permanent by miners on the Bitcoin network.  Once a transaction is made, it will automatically accumulate confirmations over time without any further action on your part (and the the number you see when you hover over the transaction will increase).  The time required for each confirmation is random, but designed to average about 10 minutes.  6 confirmations is considered to be sufficient to essentially eliminate the risk that the transaction could be invalidated by a so-called double-spend attack.

Message verification is a more specialized feature of Bitcoin, whereby a user can sign a message proving that she is the owner of a particular address, and other users can verify this.  It is useful for certain specific applications, but isn't needed to send and receive ordinary transactions.

A good source for information about all these concepts is https://bitcoin.it.


16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element), code=-26)

Your raw transaction is just completely wrong. Just pushing OP_TRUE to the stack does not make any output spendable; you still need to execute the output script. The combined script (input script and output script together) results in a failure/OP_FALSE so the input is invalid. Thus the transaction is invalid.

Looking at the output you are trying to spend from, it looks like it is a 3 of 5 multisig, so unless you have 3 of the 5 keys, you can't spend from that output.


With vanilla Bitcoin Core, there is no efficient way to do this.

I see two options:

a) Slow and very inefficient RPC loop (not recommended)

Get the genesis block hash (RPC getblockhash 0)
Get the block with all transaction (RPC getblock <hash> 2, 2 stands for verbosity with transaction)
Loop through all transactions and all its outputs, call gettxout <txid> <n> (where n is the outputs index)
If gettxout returns an object, the output is unspent (UTXO), dump it to a text file

This may take a couple of hours or days (depending on your machine).

b) Fast way by patching Core (0.17.1)

Change the code of the function call GetUTXOStats(), apply a text file dump in the utxo set loop (while (pcursor->Valid()) {)
Compile
Call RPC gettxoutsetinfo and let your added code dump data per UTXO to a file (or similar)


How to force bitcoind to include a specific transaction as an input of another transaction?

This will be possible using the 'raw transaction interface' that was added recently and scheduled to be part of the 0.7.0 release.

With listunspent you can request a list of available coins sent to a particular (wallet) address, and with createrawtransaction you can build a transaction that consumes specified coins. Finally, sendrawtransaction can be used to broadcast a prepared raw transaction to the network.


The second case is a P2SH address. You must supply the version number/magic byte for the address, which is 5 for P2SH.

>>> bitcoin.b58check_to_hex('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
'6ad55439d8faab476bbc0f89183ce689f8f6985b'
>>> bitcoin.hex_to_b58check('6ad55439d8faab476bbc0f89183ce689f8f6985b', magicbyte=5)
'3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f'

To figure out what the magic byte of an address is, use this:

>>> bitcoin.get_version_byte('3BRu7EhouApLkW1EZ64T9o9yMuX5Rexz6f')
5


My balance says 100. mBTC. How many bitcoins is this, and what is the value in British pounds?

mBTC stands for the SI unit Millibit which is 1 thousandth of a bitcoin, or 0.001. So you have 100 mBTC * 0.001 BTC, or 0.1 BTC. The price of 1 BTC at the time of this writing on Coinbase in GBP is £5,485.21 to 1 BTC. Your 100 mBTC would then be valued around £548.


Someone else created a wallet for me to use. Is this a scam?

I was told once I login to change my password

It is important you understand why this is a trick intended to deceive you.
Wallets don't contain bitcoin.
Wallets contain a "private key" - it is this private key that gives you control over an amount of bitcoin.
The person who creates a wallet can copy this private key and use it to make a new wallet that has control over the bitcoin. Including control over bitcoin added by you days months or years later.
You changing the password on a wallet does not keep the private key secret and safe if someone else has previously already seen the contents of the wallet.
If it helps, think of the wallet as one of those keysafes with a user-changeable combination to unlock it. If someone has previously  copied the keys inside, changing the combination that opens the keysafe doesn't keep you safe at all.

Keysafe with resettable combination - like a bitcoin wallet. It doesn't contain money. It contains keys that maybe someone already has copies of. Changing the combination on the keysafe (wallet) doesn't make those copies of the keys disappear.

See also
Mining deceptions

I've been asked to share wallet credentials to participate in mining. Is that a scam?
Am I Being Prodded By A Bitcoin Mining Scammer?
Mining in the wallet
Blockchain Wallet
How can I get a private key for this address

Wallet deceptions

I NEED YOUR HELP URGENTLY Bitcoins


You can use MinerGate app Benchmark feature to estimate how fast your PC is.
IMHO it's not possible to generate MH/s on a regular desktop PC. You need a rig to reach that speed. You can have some two-digit hashes, maybe 1 kH/s but no MH/s.


If I were executing a 51% attack, would I be broadcasting my state of the network to nodes?

Yes, both scenarios are possible.  The validity of a block is determined solely by its contents, not by when it is broadcast or received, so the attacker's longer chain is equally valid whether they broadcast it as they go, or all at once.

(There is an exception to this principle on testnet because of the 20-minute rule, but that's not relevant here.)


ways to improve bitcoin tx finalization time

According to the Bitcoin wiki who refers to this Analysis of hashrate-based double-spending:

No amount of confirmations will reduce the success rate to 0.

If the attacker controls more hashrate than the honest network, no
amount of confirmations will reduce the success rate below 100%.

There is nothing special about the default, often-cited figure of 6
confirmations. It was chosen based on the assumption that an attacker
is unlikely to amass more than 10% of the hashrate, and that a
negligible risk of less than 0.1% is acceptable. Both these figures
are arbitrary, however; 6 confirmations are overkill for casual
attackers, and at the same time powerless against more dedicated
attackers with much more than 10% hashrate.

So as you stated, it is nothing more than a trade-off.


Confirmed transactions lost in my synchronised node

There could be a few possible reasons for this:

The most likely problem is that you don't have -txindex=1 enabled. By default, the core client doesn't keep track of all full transaction details unless you tell it to with -txindex=1 when starting it. If you want to maintain the full index, shut down and restart with that flag. It will give you a message about needing to reindex everything, that could take a little while.
It may also be possible that one of the daemons was actually in testnet, unintentionally. Make sure they are both on the same network.

The daemon will keep an index of full transaction data for all of your own wallet transactions. That might be why one of your nodes knew about it and the other didn't.


Is it safe to store mnemonic seed in the email if I change random 2 words?

It would be trivially brute forceable.
There are 2048 BIP 39 words. If you change two words AND the position is known, it's simply a matter of computing all possible combinations of what those two words can be replaced with - 2048*2048. That's only 4194304 - A smartwatch could do that in a few minutes without breaking a sweat. It would take you longer to write a script to run through all of those than it would take for the script to run.
If the positions of the changed words aren't known, it is slightly harder, but not extensively so - the first words can be placed in any one of 12 slots, and the second in any one of 11 - that gives you 2048 * 2048 * 12 * 11, or 553648128 possible combinations - slightly better - the attacker might now have time to make some coffee while he steals your coins.
If you genuinely want to security your mnemonic, you should consider one or more of:

Encrypt it with AES, store the encrypted version and the password in two separate places
Split it into M parts using Shamir Secret Key sharing, store each part in a different, secure location
Write it down and store it in a secure vault or deposit box.

You can combine the above to protect against various threat models.


Dumping private keys from wallet.dat from command line (pywallet.py alternatives)

This is an old question but just to say that the dumpwallet command has been added to bitcoin core. This will give you all the private keys in a text format.


Which miners support generating their own midstate?

You can see which miners support what features here:

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

"midstate" is the feature you are looking for in this case.


I formated my hard drive with bitcoin core on it

Addresses are not magically tied to the hardware you use. If you delete the file that contains the private keys for your addresses, you will lose them and thus lose access to your Bitcoin.

Since it seems that you formatted your hard drive without making a backup of your wallet file, your private keys and thus your Bitcoin are lost. You may be able to recover the file using file recovery software such as Recuva.


Use the -datadir option to specify a new location for the bitcoin data directory.  Copy the existing bitcoin data directory to the new location and then restart bitcoin-qt.  Check here for information on locating the default data directory.


Mining Theory: GPU/ASIC Computation vs Co-processor Computation

This and a followup were going around recently.

"Last week I posted on my latest toy, a rig that used eight Xeon Phi 7220 cards in a single 4u-server to achieve a total of roughly 24kH/s for cryptonote coins"


You should not be tampering with any code that has anything to do with determining block validity if you don't thoroughly understand the security model that proof of work coins use.

i = getrandint(iMin, iMax);
int64 nSubsidy = nBlockRewardStartCoin * i ;

You can't use any randomness in any code that involves block validation! The entire security model of the blockchain absolutely requires that servers agree on whether blocks are valid or not. Whatever it is you are trying to do, this is not how you do it.


Can I mix P2PKH and P2WPKH inputs in the same transaction?

Is it acceptable to mix P2PKH and P2WPKH inputs in the same transaction as described above?

Yes, absolutely. In the same way that you can mix multisig and P2SH and P2PK inputs in the same transaction.

  When would I encounter a situation where "all txins in a transaction are not associated with any witness data"

When you're not spending any SegWit outputs.

  But even in the case where the inputs came exclusively from P2PKH (not P2WPKH) UTXOs, wouldn't I still have witness data (i.e. the signatures) that need to be "segregated" at in the 'witness' portion of the transaction?

No, those signatures would be "witness data" (in an abstract sense), but they're not segregated. Spends of P2PKH outputs require a pubkey and signature in the scriptSig of the inputs - not in the separate witness section.

  Or is it saying that if all inputs are non-segwit, it means the transaction itself is non-segwit, and I should therefore use format (a) -- despite having segwit output(s)?

Exactly. When you're using P2SH, nobody even knows the outputs are SegWit outputs, so it clearly can't matter. All that matters is whether any witnesses are needed for spending.


You wouldn't need to do something specific for USDT.

Your best bet would be to sign a message proving ownership of each address you hold USDT in. Once you prove you control the addresses, you can prove that you control the USDT balance at any given block height for those addresses using the signed messages and a node that can calculate the balances.


Bitcoin has a scripting language built into it, which allows the creation of many kinds of smart contracts. Examples are atomic swaps, Lightning payment channels and zero-knowledge contingent payments (ZKCPs). This later paper by Banasik, Dziembowski and Malinowski (BDM16) improves the efficiency of these greatly. Threshold multisignatures are also easy to do, interestingly much more easily than in Ethereum.

ZKCPs are extremely general and can execute any contract in which the counterparties and terms of the contract are known at setup time, though it does require they use some new and slow crypto (done off-chain, Bitcoin is never exposed to it).

A more whimsical example is Peter Todd's bounty for anyone who can collide SHA1, SHA256 or RIPEMD160. The SHA1 collision bounty has been taken.

My guess is that the only thing Ethereum can do that Bitcoin actually can't do, is extrospect on the outputs being spent. This would be sufficient to implement covenants, which would be something of a mixed blessing.
Andrew Miller has argued that Ethereum's account model lets it do contracts in a more transaction-efficient way than Bitcoin's UTXO model, which may be true, but the examples I've seen of this (a) lose privacy by storing lots of unrelated state in one account and (b) exploit Ethereum's global key-value store, which is significantly more expensive to maintain than a UTXO set. Extrospection may be efficiently (efficient for verifiers, not for the transacting parties :)) attainable by creative use of ZKCP's, much how the BDM16 paper does atomic swaps with them, but I haven't worked out the details.

As a final note, it is easier, by design, to implement and deploy Ethereum contracts. However, I think the hard part of smart contracting is analyzing the contracts and proving correct behaviour under all inputs. (Both Ethereum's and Bitcoin's script languages fall short on this count, being difficult in general to efficiently reason about.)


A) While downloading entire blockchain, Bitcoin Core sets indexes and scans the transactions which belong to your wallet so no, it does it automatically. This functions exist to allow you to check the balance after importing private keys from outside manually (as default, it rescans after each private key is imported but you allowed to do a rescan after importing multiple private keys). reindex basically refreshes the table which contains transaction positions in the disk to search a transaction fastly with a given TXID. rescan scans entire blockchain to find transactions which belong to your wallet.

B) Sorry, there is no proper answer for this part. After creating backup, did you receive any amount of money into new addresses generated after the backup? Or, did you send any amount of money to anyone (new change addresses might be generated)? What was the keypool value? Its default value is 100. If you didn't change it and if you did not send or not receive any amount of bitcoin more than 100 times after backup, you must be able to have all the balance. Did you check all addresses you have in the wallet on blockchain.info? Also, are you sure your wallet has not been compromised? If you are not sure, check the transactions of your addresses in blockchain.info and try to remember your last transactions then compare them. If you see any transaction which you did not perform, then your wallet backups (or your private keys) have might be stolen.


Do I need to be synced with the network to make remote RPC calls?

Yes it is possible.

Using the rpcwait flag will prevent calls from failing while bitcoind is starting up.

Aslo, make sure you have configured your bitcoin.conf file correctly.

rpcuser, rpcpassword, and rpcallowip need to be set and these params need to be passed to bitcoin-cli during an api call.


What are the major reasons for various Bitcoin-related projects' downfall?

One factor is that people's enthusiasm for Bitcoin drives them to step well outside their comfort zones and do projects they wouldn't otherwise. Bitcoin is a new startup economy and the plethora of opportunities is tempting. But the lack of experience or skill can lead them to mistakes which bring about the end of the project. Bitomat.pl is a great example - the owner tried to make use of AWS without having a clear idea how they work.

Another factor - especially with business ventures - is overestimation of the Bitcoin market size. The market is very small, and I have the feeling that people's general excitement about Bitcoin isn't matched by their willingness to actually use it. If it's a niche service the target market is the intersection of people in this niche with people who are using Bitcoin, which is tiny, and for more mainstream services, those that are founded just to offer the service in Bitcoin are often inferior to established mainstream offerings (see above point). It comes down to the revenue not justifying the overhead costs, so the project is abandoned.

Creating a successful alt currency is an immense undertaking, and so far has mostly been tried by people who seem to think that changing a few parameters is all it takes.

I don't have any specific suggestions how to avoid this, other than trying to be realistic about the viability of the project and the personal ability to carry it through. This shouldn't, of course, come at the expense of being a bit bold and daring.


As I see it, the techniques you are referring to are two possible but different ways of doing mixing. The first one, explained in Bitcoin and Cryptocurrency Technologies book is referring to a kind of mixing technique like CoinJoin.

CoinJoin is a mixing technique in which several users create a transaction by joining their inputs. In order to maintain their privacy, all inputs should share the same value, since in that way once the transaction is created there is no way of telling which input correspond to each output, whereas if the inputs hold different value it will be way more straight-forward. There are to ways of implementing a CoinJoin scheme, the first and more simple one relays in a third party receiving all inputs, outputs and signatures, and building the transaction from the participants. The other one, more elaborated, does not need any third party, since every user acts as a blind-signing server.

On the other hand, the technique referred in the Bitcoin and Beyond paper uses a mixing server, which acts as a trusted third party, where users will send funds and eventually receive them back in a different address (after applying a certain mixing fee). In order to avoid linkability between received and sent transactions, this kind of mixing technique uses randomized delays to redistribute transactions. blockchain.info's Send Shared, and bitmixer.io used to be examples of such a mixing technique.

Finally, regarding examples of such transactions, unfortunately I don´t have any particular CoinJoin transaction identified to let you know, maybe someone else can help you with that.


Most mining software will have that number available for you.  Or you can join a pool for a day or two and most of the bigger ones (eg slush, 50btc) make these stats available for your miner(s).

If you are trying to programmatically calculate this for software you are writing probably best to take an average every minute or so. As in most cases, the formula is built right into the unit -- num of hashes per (ie divided by) num of seconds.

Actually it's Mh/s (1,000,000 hash/sec) usually now so more like (Num hashes / 1,000,000) / sec


I need to find a pool that supports cpuminer

None exist. CPU mining had been impossible for years now. You better stop wasting energy and the life time of your computer.


Where can I get a list of places I can use my Bitcoins?

You can try CoinMap. It's the largest database of physical locations that accept Bitcoin.


How to sign a transaction using only an offline computer?

You're correct that the offline node needs to how to claim its funds, so it can't be totally isolated.

Currently, the most mature offline wallet solution is through a client called Bitcoin Armory. Here's what your workflow looks like with offline wallets:

  Online node creates transaction -> USB key -> Offline computer signs transaction -> USB key -> Online node broadcasts transaction

You can use Windows, Linux, or Mac for your offline wallet, but I'd recommend Linux, as it's difficult to disable AutoRun/AutoPlay on Windows.

Download:

Windows/Linux
Mac - Beta

This page explains offline transactions in greater detail.


You can use the command bitcoin-cli getblockheader "hash" ( verbose ) to return a specific block header. For more info: bitcoin-cli help getblockheader

but I can't know where should I change get block to get headers: https://bitcoin.org/en/developer-reference#getheaders
I want to get all headers instead of total blocks to have a SVP node.

The getheaders message referenced in that link is part of the peer-to-peer gossip protocol between nodes, not the command line interface. From that link:

The getheaders message requests a headers message that provides block headers starting from a particular point in the block chain. It allows a peer which has been disconnected or started for the first time to get the headers it hasn’t seen yet.


In Litecoin every single block is mined every 2.5 minutes, double spending?

The probability is not dependent on the block time alone, it is dependent on the block time, and how many blocks you wait before considering a transaction complete.

For Bitcoin, generally 6 blocks is considered to be the point after which a chain reorganization that changes the block the tx is in is considered to be impractically due to the cost involved with gaining enough hashpower to roll back 6 blocks.

Due to this, most exchanges and merchants will require 6 confirmations before crediting your account (although, Bitcoin is by far the largest network in terms of mining power, so for certain use cases, even 2-3 confirmations can be considered enough).

Litecoin has a lower block time, and to guarantee the same security, receivers should wait for a greater number of confirmations before considering the deposit complete.

Ethereum, with a block time of 15 seconds, is even faster. Thus, many exchanges will wait for even more confirmations (I've seen up to 50 for ETH and token deposits).

The block time alone does not guarantee safety against double spends. Even a 10 minute block-time chain can be double spent if you only wait for a single confirmation.  To prevent double spends, you simply need to find the tradeoff point after which it is impractical for someone to roll back the chain.

In most cases, the actual confirmation count used is often less than this impracticality point, since for smaller chains it may require too many confirmations, leading to a usability issue. Thus, exchanges may settle for a lower number of confirmations than required for absolute safety, but still good enough to guarantee it in the vast, vast majority of cases.


You can compare the block count from Blockexplorer with your local block count. Something like this:

$ wget -q -O- https://blockchain.info/q/getblockcount; echo
359721
$ bitcoin-cli -conf=/u0/bitcoin/bitcoin.conf getblockcount
359721

As you can see above my node is synched since the counter is equal.


What are best practices around toggling between multiple wallets in bitcoind?

For future reference, thought I'd respond to my original question with what I've found out to this point. Haven't fully answered the original question yet but the approach I'm using at the moment to toggle between wallets is:

bitcoin-cli -rpcwallet="filename" [command]

Any other thoughts on best practices would be great!


The RPC interface has a command getpeerinfo which will give a breakdown of upload and download metrics per connected peer.

  {
    ..
    "bytessent": 67619177,
    "bytesrecv": 47229533,
    "conntime": 1446238156,
    ..
  }

Totals for the session for all peers are available with getnettotals.

{
  "totalbytesrecv": 3664310320,
  "totalbytessent": 619085268,
  "timemillis": 1446521403149
}

vnstatis an external tool which will do system-wide monitoring and statistics collection over extremely long time periods. There is no per process breakdown, but it's a good thing to have around for a global view anyway.

eth0:
       Oct '15     70.88 GiB  /    2.65 GiB  /   73.53 GiB
       Nov '15     19.61 GiB  /  976.31 MiB  /   20.57 GiB  /  288.12 GiB
     yesterday      9.40 GiB  /  471.48 MiB  /    9.86 GiB
         today      1.13 GiB  /   66.35 MiB  /    1.20 GiB  /    8.49 GiB


Is it possible to generate a complete public address with vanitygen?

It's so unlikely to succeed that it is not being offered. One could be tempted to say it's not possible:

Your chances are along the lines of 1 to 2^160. That is 1 to 4.666587*10^172, or very roughly rounded, 1 to 5 followed by 172 zeroes.

To put that in perspective, if you could create a billion addresses per second, the expected time to find a collision would still be longer than the age of the universe.


What's "asm" in transaction input's ScriptSig

The asm strands for assembly, which is the symbolic representation of the Bitcoin's Script language op-codes.

In this particular case we have 2 pieces of data that go to the execution stack.

The transaction signature:

304502201fd8abb11443f8b1b9a04e0495e0543d05611473a790c8939f089d073f90509a022100f4677825136605d732e2126d09a2d38c20c75946cd9fc239c0497e84c634e3dd01

And the public key of the input's address:

03301a8259a12e35694cc22ebc45fee635f4993064190f6ce96e7fb19a03bb6be2

Notice that the hex and the asm are almost the same except the 48 in the beginning and 21 towards the end. These are op-codes that tell the interpreter to put a  specific amount of bytes to the stack. So in the case of the signature it tells to put 72 bytes (0x48) to the stack and 33 bytes (0x21) for the public key. Check here for more info https://en.bitcoin.it/wiki/Script#Constants


Import newly generated address to bitcoin core

why do I need to rescan if the address doesn't have any history?

It does not know it has no history until it completes the rescan.

You can either pass a false as extra argument (look up the importaddress documentation), or use the more powerful importmulti command with a recent birth time.


How to recover corrupted Electrum wallet.dat

If the file is corrupt, it will require manual editing to be able to open it with electrum.
Depending on how corrupt the file is, it might be possible to recover and and it also might not.
Say, for example, a single bit is flipped. Then a brute-force approach might work where every bit is flipped in the file and then check which result can be opened and decrypted with electrum..
Check with electrum developers who are most familiar with how a non-corrupt file should look.
If I were in this situation myself, what I would also do is generate a few new wallet.dat files using the same electrum version you used in 2015, open them in hex viewers / text editors next to each other, and try to see the patterns. Compare to your corrupt file.
Good luck.