What is the "unit of account" in terms of Bitcoin?

The "unit of account" is "what all your numbers are denominated in".

For instance you might work day-to-day in dollars/ pounds and yen but your unit of account may be dollars. Everything would get totalled up in terms of "dollar equivalents" and you would typically report in dollars.

You can choose whatever unit of account is convenient to you.
The obvious one to use is simply bitcoin. You have all your accounts in bitcoin and report in bitcoin.

However you may have to report yearly accounts to (in the UK) Companies House who want to see reports denominated in pounds. Say because of this you decide to have your unit of account to be pounds.

Thus you need a rule for converting your bitcoin to your unit of account, pounds. Perhaps you choose a daily conversion rate and convert all bitcoin received that day to pounds. (Or you might use another conversion algorithm).

Your unit of account is what you measure your money in.
It is a bit like measuring distance in centimetres or inches or light years. Choose the unit of account to be the easiest for what you are trying to achieve.


How should I invest $10,000 in crypto-currency?

I'm going to assume Bitcoin since that is by far the most common cryptocurrency by mindshare for people who are new to the space.

Since you have $10k to invest, you could buy around 5 to 7 bitcoin mining rigs with a capacity of 13 to 16 tera-hashes per second each.  Investing in these mining rigs will give you about 1 year of mining time before the rigs cost more money to run than they can make.  You could make approximately $10,000 to $30,000 profit during that time assuming you have cheap electricity, and buy 5 x 15 TH/sec bitminers.  This path requires far more technical knowledge than a simple purchase of  bitcoin.  To get 5 mining rigs for $10k, you'll need to buy direct from a manufacturer.  Bitcoin mining rig manufacturers typically require a wait of 3 or 4 months until delivery.

If you buy bitcoin, you might lose the entire investment if bitcoin goes to zero; on the other hand you might make 10 times your investment if bitcoin repeats the past 12 months of performance.  If you stay invested for a longer timeframe that risk/return is extended.

There is no simple answer to your question since it depends on your technical knowledge, risk appetite, and timeline.


It is important to understand that the spent flag you are talking about, is not a field of an output that is stored in the blockchain. It is rather created internally by the client interacting with the blockchain. The only fields of information of an output that is permanently stored on the blockchain are:

The Amount
The Locking-Script Size
The Locking-Script

All the full nodes on the bitcoin network checks if an output is spent or not by checking if the output is part of a structure called the UTXO set. In this structures all nodes keep all outputs which has not yet been spent at the last block of the blockchain the nodes have validated. If an output is part of the UTXO set, it means that the output is unspent.

For every new block in the blockchain, the nodes validates the block and removes any previous outputs in the UTXO set, that has been used as inputs in the new block.

Since a new node validates the blockchain by starting from the first block ever, called the genesis block, and updates UTXO set for every block in the blockchain, the UTXO set will contain all current unspent outputs once the node is synced with the rest of the network.


Can mining with lots of laptops make money?

To mine most crypto-currencies you'd need a good graphics card, preferably AMD than nVidia. Graphics chips integrated with the mother-board are typically bad for this, if they can be used at all.

There are some cryptocurrencies you do can mine with CPU only, like Protoshares, Quarkcoin, Primecoin and a few others. To avoid affecting the normal usage of a computer, mining program can run with a very low priority so it's only running when computer's not really used.

However, mining on a laptop is strongly discouraged for they're typically not designed to be run with their processors at 100% the whole time, so you're going to wear down the components earlier due to overheating - capacitors, battery, even hard-drive or microprocessor could die earlier because of that (e.g. Apple Airs wear down very fast if you put them to mine, a friend of mine experienced it).

If you can somehow ensure they'll have VERY good ventilation, or if you limit the mining to 4 or 5 hours a day, with several "rest" hours between each, you might make some money off them. But then, you ought to measure carefully the cost of the extra power they eat (plus the extra refrigeration's consumption) vs. what they would take if idle, vs. what you earn after a while - it might be profitable, or it might not.


How can I pick the data directory of Bitcoin Core on Windows 10?

You'll want to set the option -datadir=<path-to-your-drive> either when starting bitcoind, or in your bitcoin.conf file. If you add it to bitcoin.conf, you'll need to restart your node for the change to take effect.


Would it be worth it to start mining bitcoins at this point?

Is it even worth it for beginners without tons of money to invest in
  it now?

Short answer

No.

Longer answer

I spent over $2400 in ASIC mining equipment from butterfly labs. I started out churning an impressive 120GH/s. I've been running 24x7 and am a little over a month in... I've mined ฿0.78

Last night my rig crashed. When it came back on I was down to 100 GH/s. I can only assume that one of the on board chips failed. There is apparently no recourse to this loss.

Couple things to note... The difficulty rate is increasing exponentially, at the start I was earning ฿0.03 ($33) per day today I'm done to ฿0.02 ($19) for the same rig and the same approximate contribution to the mining pool. In March, the new 600 GH/s miners come out, at the same price range as the rig I'm running now. I expect that my earnings with the current rig will tank, and at that point be less than the electricity I'm burning to stay hashing.

My expectations / hope is to recover the ฿2.5 necessary to break even before the rig's mining rate becomes a negative investment... it's unlikely.

Note that In my recovery cost calculation, I'm considering the 700w of power used to operate the ASIC chips only... my 'computer' is a raspberry pi and has a negligible power consumption rate.

So to answer your question directly... No, even with a large budget, the hamster wheel will keep you in the roughly same spot. It's likely a better investment to simply buy the btc on speculation through coinbase or mtgox than to waste your time setting up a rig that requires you to be a relatively competent system admin just to get started. What I mean by that, is that I had to 'flash' a unix system onto the pi and download / compile bfg miner just to get started. Additionally it makes ALLOT of noise, and finding a place to keep it from bugging the family was hard (and I have a large 2800 sqft house).


Does getreceivedbyaddress or listreceivedbyaddress or listunspent shows pay to pubkey and bare mutlisig transactions?

In the Bitcoin Core wallet, it depends:

For P2PK outputs to a public key that's in your wallet, yes for current wallet versions, but this won't be the case for the new "descriptor" wallets (unless explicitly imported).
For bare multisig, only when explicitly imported. Before PR 13002, bare N-of-N multisig was automatically treated as incoming payment (in case you had all N private keys). Since that PR you need to explicitly import these scripts to watch them.

For other wallet software, things may be different.
In general, you cannot assume that anyone will ever treat an incoming transaction as a valid payment, unless it was sent to an exact address they gave you (or you have some other explicit arrangement). Which scripts/addresses a user considers "theirs" is up to them, depends heavily on the software they use, and not something you can infer.


Encryption isn't part of Bitcoin at all. Nothing on the blockchain is encrypted. There is no encryption in consensus or the P2P network.
Only wallets have encryption for protecting private keys. Bitcoin Core specifically uses AES-256-CBC because it is not known to be insecure and is widely used. Other wallets may choose to use other encryption schemes.


Why does Armory rescan the block chain every time it opens?

We just release version 0.90-beta, which finally solves this issue.  Armory does not need to rescan the blockchain anymore unless you import new private keys, or Armory experiences an unclean shutdown.

With the exception of the first-time startup (to build the new databases), Armory should get into online mode within 10 seconds of Bitcoin-Qt/bitcoind finishing synchronization.


How many different destinations can a single transaction have?

There isn't a maximum number of outputs but instead a maximum size of data in a block.  So if there was just one transaction with a lot of outputs, the combined size would need to be below the block maximum of 500K.

I don't know the size of each transaction but you are talking thousands or tens of thousands of outputs before hitting these per-block limits.


Trezor Simple recovery vs advanced recovery

The simple recovery leaks the seed words to a keylogger but not their order.  The advanced recovery is completely safe against keyloggers (as long as there is no camera pointing to the Trezor screen).

The simple recovery asks for the words in random order.  Since the words need to be entered on the computer, a keylogger can see them.  An attacker could then try the words in all orders to recover the seed.  For the usual seed length of 24 words this is still too computation intensive to be profitable, but for seeds with only 12 words it is possible to find the right order in a day on a normal computer.

The advanced recovery uses a similar method to the PIN matrix entry.  It asks for each word (in correct order) by giving nine choices where it is in the alphabet, see this blog post with screenshots.  The computer displays nine unlabelled buttons and the Trezor screen shows the meaning of the button.  When the user presses a button, the position of the button is sent to the Trezor.  A keylogger can only know which button was pressed but since the randomization is done completely inside the Trezor, the keylogger can't know which choice the button corresponds to.  Since every word is chosen by exactly the same four questions (three times a 3x3 matrix and then a 2x3 matrix with the remaining candidate words), there is no information about the seed leaked to the computer.  The only disadvantage is that it takes more time and is more difficult to use.


The Ripple server has SNTP support to tolerate system clocks that are inaccurate.

The consensus process also builds a consensus network time. Each validator pulls the consensus network time a bit closer to their local time. This consensus network time becomes the close times included in ledgers that support features like expiring cross-currency offers.


Options for a Client Only C# application

Have you guys see this recent GitHub? I too have been poking around looking for a standalone library.

https://github.com/TangibleCryptography/BitSharper

I have it downloaded, just trying to fix dependencies so I can compile.
Looks promising.


What actions trigger the need to obtain a new backup with Blockchain.info/wallet?

A new backup is required after every Custom transaction in which the change is set to go to a New Address.

If you have configured your account with an e-mail address and have marked the checkbox for Automatic Email Backups a backup will be sent automatically via e-mail for each occurrence where a new backup is required.


A transaction consumes all of the coins for the connected transaction outputs.  But a bitcoin address can have multiple transactions.  So even though one transaction is consumed, that doesn't mean the address doesn't have any other coins.

Your general idea, though, is correct.  You can remove a transaction once all of its outputs have been spent (a transaction can have more than one output, so you have to track each output).  This has been discussed and even implemented in alternate bitcoin clients.  I don't know if or when it might be implemented in the reference client (bitcoind/bitcoin-qt).

I have an implementation that I have been working on which uses a SQL database.  So far, it has processed the block chain up to August 2013 and there are 2,000,000 transactions with unspent outputs.  The database itself is around 1.2GB at the moment, so it is a significant saving over the full blockchain (15.1 GB on my system).  The drawback is you cannot supply the full blockchain to other nodes (I keep just the last 30 days).  So you would still need full nodes to provide the blockchain or download sites/torrents to allow a new node to get up to speed.


Question on interpreter.cpp in Bitcoin core - set_success method

The enum ScriptError is defined in https://github.com/bitcoin/bitcoin/blob/master/src/script/script_error.h, and the * means that set_success requires you to pass a pointer to an enum value rather than the enum value itself.

I have to tell you, however, that if you are asking questions like "What does the "*" mean?", then you are going to have a hard time understanding C++ code.  I highly recommend doing some tutorials on C++ programming before going any further.


How is a Transaction ID generated & when does it change? (with a new sequence ID?)

TxID is just a SHA256 hash of binary transation data, so it changes upon any modification of transaction.
Therefore, one cannot include verification of TxID in the script in same transaction (if I correctly understood what you want to achieve).


How do Bitcoin clients/miners verify balances quickly?

Balances
Bitcoin doesn't care about balances. Miners also don't.
Your wallet may keep track of your balance but it doesn't need to know about anyone else's. No one else cares about your balance. It is irrelevant.
Bitcoin only keeps track of unspent transaction outputs (UTXOs) - If you like metaphors and understand their limits, you can think of UTXOs as "coins" whose "current ownership" is indirectly kept track of in an almost anonymous way. When you give someone a coin in payment, they don't care how many other coins you have in your pocket, they only care whether the coin you gave them is genuine (really yours).
Fast verification
Bitcoin is designed so that creating new pages in the replicated journal of transactions is expensive and slow (i.e. constructing blocks that can be added to the blockchain). However, transactions can be verified quickly.
In the database world you speed up retrieval by adding appropriate indexes. You can have separate tables for live vs dead data, you can hold important data in memory, etc etc. That is how software finds UTXO's fast.


How do I submit hashes to a stratum URL?

If you are mining with bitcoind then you are your own pool. If you find a valid block then you have to submit it to bitcoind. You got the block template with bitcoind's "getblocktemplate" and now you submit the complete block with bitcoind's "submitblock".
If you want to mine in someone else's pool then you use the stratum protocol to get the work and then you submit the work results back with the stratum protocol. You don't need bitcoind when you are mining in someone else's pool.
You can't mix the two. You can't work in your own pool and send the block to some other pools to get paid there. They will not pay you for working on your own blocks in your own pool.


Litecoin transaction never reached my adress

If they can't give you a transaction ID that you can find in a block explorer, then there is no evidence to support their claim that they completed the transaction.


If you saved a copy of your wallet, I don't think you have lost your bitcoins. The bitcoin core client makes 100 addresses ahead of time (you don't have just 1 address!), and they are all stored in the wallet.dat file.

Just wait until you client has finished downloading the blockchain, or follow the steps here to get them out without waiting!


-dbcache: bitcoin is doing heavy disk I/O, you can reduce disk I/Os with increasing this parameter and thus increase memory usage

-par: if your system is so slow, you can't use it anymore, limit the number of threads or CPU/cores that are used

-pid: this is usually the process ID on your unixoide system. if you start a single instance, there is nothing to play with...

-bind: if you have several network cards in your system, you can bind the process to one of the many IP addresses in your system

-discover: discover IP addresses in the network. Set to 1, else set to 0, e.g. if you are using connections over TOR.

-upgradewallet: - someone else please :-)

-rpcbind: if your system is multihomed, and you want to talk from several networks to your machine, you can tell the bitcoin daemon, to listen to only a specific address for remote procedure calls

-rpcthreads:

  how many connections can a thread afford?

good question, I don't know. Experts please. I was of the opinion, that one thread can handle one connection...

  and how the connections counted?

not sure what you mean by this - if you have 4 clients, that connect to your system, then you have 4 connections. Or 5... or 6 ... and you can have 4 different systems talk to your bitcoind.

  is it per IP address or command?

per IP address.

I know my answer is not 100%, so I am asking for additional help as well.


In a way, all bitcoins were issued with the genesis block: The total number was fixed and the distribution schedule defined with the rules put in place then. However, distributing them over a longer period of time allows for the bitcoins to be spread out more, creates incentives for miners to contribute work to the Bitcoin network and probably also helped fewer of them getting lost during the emergence of Bitcoin when many people just tried it briefly and likely didn't properly store their coins.


bitcoin rpc api createrawtransaction with python returns -3: Expected type array, got object

You are providing it an Object in JSON, not an array just as the error states.

 return {"txid": sourcetransaction['txid'] ,"vout":sourcetransaction['vout']}

I would try creating it from a dictionary and then adding it to a list instead of building it from a string, something like:

>>> inputs = {}   #create the dictionary
>>> inputs["txid"]=sourcetransaction['txid']  #add the value to the dictionary key 'txid'
>>> inputs["vout"]=sourcetransaction['vout']  #add nout value to key 'vout'

>>> inputs
{'txid': 'a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c', 'vout': 0}

>>> inputsList=[inputs] #add dictionary input to list
>>> inputsList
[{'txid': 'a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c', 'vout': 0}]

Also noted in the example from the source:

def createrawtransaction(self, inputs, outputs):
    """
    Creates a raw transaction spending given inputs
    (a list of dictionaries, each containing a transaction id and an output number),
    sending to given address(es).
    Returns hex-encoded raw transaction.
    Example usage:
    >>> conn.createrawtransaction(
            [{"txid": "a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c",
              "vout": 0}],
            {"mkZBYBiq6DNoQEKakpMJegyDbw2YiNQnHT":50})
    Arguments:
    - *inputs* -- A list of {"txid": txid, "vout": n} dictionaries.
    - *outputs* -- A dictionary mapping (public) addresses to the amount
                   they are to be paid.
    """
    return self.proxy.createrawtransaction(inputs, outputs)


Is there a service to withdraw dollars by wire transfer with small fees?

Take out to Dwolla (FREE Account), then move to bank account for a flat fee of  $0.25.  I use to use them all the time like that.

Fee list from Dwolla:
https://www.dwolla.com/fees

MtGox doesn't charge anything to send to Dwolla, they just charge you to transfer from BTC to Dollar's. But it's cheaper than what it was for ACH transfer.


How many days the verification could take?

Because you have paid a lower fee than others, so your transaction is put last. Your coins will return to your wallet, but can take up to 4-6 days before that happens. Hope it helps you.


Bitcoin core - Listtransactions doesn't show fee of received transactions

To find the fee of the transaction, you need to know the value of the inputs and outputs and find the difference between those two values.

Unfortunately this is much more difficult for receiving transactions, because by default bitcoin core only holds the information for transactions which are related to your wallet, not all transactions (this can be enabled with txindex=1 argument).

What this means is that, to find the fee for a receive transaction, you can call getrawtransaction "txid" true with the txid you obtain from listtransactions. The last argument, true is set to make the output "verbose" so that it includes more information about the transaction than just the hex encoded transaction itself. It will return a JSON object with vin and vout arrays which you can iterate over. You can simply sum the output values. The trouble is finding the input values. Input values are not given in transactions, so you must look them up individually. This is a problem for receiving transactions because the transactions they spend from are usually unrelated to your wallet and thus cannot be looked up without txindex=1.


Blockchain parser for transaction level details

I guess you're looking for a blockchain explorer. Insight, by BitPay, works pretty well and is open-source: https://github.com/bitpay/insight


How does the GreenAddress refill (relock) work when its nLockTime expires?

For every bitcoin transaction you make or receive in a 2of2 wallet the platform sends you an email with an encrypted zip file containing all relevant transactions (spending all your utxo, unspent transaction output) with nlocktime set and partially signed (by GreenAddress).

When you normally spend on the platform, you will make some of these presigned transactions invalid by  virtue of spending those utxo (this is because when you spend you spend the entire amount and if there's any change left this is sent back to yourself, in our specific case to a new address) and when this happens you get a new zip with an nlocktime starting from when the zip was generated for the new transactions.


After taking a quick look over the Tonal Book (free PDF) and the Wikipedia article it appears to be an early attempt at constructing a number system in base 16.

Programmers will immediately recognise this as hexadecimal. For non-programmers hexadecimal uses the following representations: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. Note that decimal 10 to 15 are represented by the single letters A to F, such that FF is decimal 255 or (16 * 15)+(1 * 15). To differentiate a decimal number from a hexadecimal number the conventions 0x10 (decimal 16) or 10h are widely recognised.

The Tonal bitcoin representation attempts to offer an alternative representation of BTC known as TBC (Tonal Bitcoin) and uses the various Tonal letters to represent them. The Tonal alphabet is more complex than the hexadecimal system and requires special fonts to be available on the systems using it.

It is unlikely that this archaic approach to base 16 is ever likely to gain traction when much more widespread approaches are available.

Units covering powers of 2 in computing

It should be noted that in 1998 the International Electrotechnical Commission (IEC), Institute of Electrical and Electronics Engineers (IEEE) and the International Committee for Weights and Measures (CIPM) adopted a purely "powers of 2" approach for some use cases. Notably the representation of computer storage and data transmission rates.

This gives rise to 2 unit systems - one base 10, the other base 2:

The primary power of 10 notation we're all familiar with:

1 kilo byte (kB) = 10 ^ 3 bytes
1 mega byte (MB)= 10 ^ 6 bytes (historically 1000 * 1024 for some storage cases)
1 giga byte (GB) = 10 ^ 9 bytes

The alternative power of 2 notation:

1 kibi byte = 2 ^ 10 bytes
1 mebi byte = 2 ^ 20 bytes
1 gibi byte = 2 ^ 30 bytes

Thus there is even less reason to use the Tonal system since a widespread alternative with well-defined prefixes has already been ratified for some time.


Are transactions still tamper-proof if blocks are hashed without nonces?

Ripple is an example that works without proof of work nor proof of stake (so no nonce needed). This mechanism is more vulnerable to sybil attacks, so it needs strong peer identity knowledge (but not trust!) to be secure. See https://ripple.com/wiki/Consensus.


No, due to different reasons.

First, the network is always in flux, nodes are appearing and disappearing, and connections are even more dynamic, so even if there were an API you could use to ask a node for its connections, that information would be outdated quickly.

Second, privacy is part of the reason why crypto currencies exist. Divulging the list of peers of every node would run counter to this goal, so node software would be ill-designed if it provided such an interface.


What is Sentinel Chain? Is it a cryptocurrency scam?

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


What happens when moving BTC from one wallet to another on blockchain.info with 0 fee?

You moved 0.8 BTC from 1DbYDYkehPSFrg9zwHY93ZcqmwFLQggw81 back to 1DbYDYkehPSFrg9zwHY93ZcqmwFLQggw81. So in essence, you didn't really move anything.


How do I set 'txindex = 1' in bitcoincore?

If you installed Bitcoin Core on linux, the config file is most likely found in ~/.bitcoin/bitcoin.conf

Edit bitcoin.conf file and just add txindex=1 anywhere you like on a new line, just make sure it's not commented out.


Why was ECDSA chosen over Schnorr Signatures in the inital design?

You'll need to ask Satoshi to know for sure, but my guess is simply because ECDSA was well standardized at the time, while no Elliptic Curve Schnorr based schemes were.

One of the reasons why an ECDSA standard existed but no EC-Schnorr ones may be patents. DSA was designed as a variant of Schnorr specifically to avoid Schnorr's patent on his signature scheme. By the time Bitcoin was created that patent had expired, but it was already too late - it was already much more appealing to use a well-known standardized scheme over designing your own cryptography (which would have been necessary to design a Schnorr based scheme).


You might want to take a look at Blockchain.com api, they are free and fairly good to start sending Cryptos and creating wallets.
But if your business grows you will need either create your own blockchain provider alongside with your own full node or pay for a service like block.io


In ListReceivedByAddress, what is the meaning of Confirmations if the address is reused?

If the address is reused for more than one transaction, what is the expected value of "confirmations"?

Quote from bitcoin wiki:

"confirmations" : number of confirmations of the most recent transaction included

Also, I think you might want to change the value of minconf that you pass to listrecievedbyaddress if you're concerned about knowing how many confirmations a transaction has.

  Should there be an entry listing how many transactions were sent to that address?

Why would you use that though?


Largest Bitcoin transaction fee ever paid?

This transaction (2016-04-26) has even higher fees (291.2409 BTC).

This plot shows transaction fees higher than 1000USD from the past 3 years. From the plot, the April 2016 transaction seems to be the one paying the highest fee.

BitClub offered to refund the transaction, but the whole episode was a bit controversial.


Simple explanation of how a hash timelock function works with an atomic trade of bitcoin / litecoin trade without a 3rd party?

I am leaving out a few details here, but this will get you thinking on the right path...

Alice and Bob have accounts on both the Bitcoin and Litecoin networks. Bob has Bitcoin, but wants Litecoin. Alice has Litecoin and wants Bitcoin. They do not trust each other.

Both agree to trade Bob's 1 Bitcoin for 2.5 of Alice's Litecoin.

Alice starts the transaction with a contract on the Litecoin network. The contract states that she will deposit 2.5 Litecoin into Bob's Litecoin account, if Bob can provide a password (called a "Preimage") that produces a certain hash. If Bob does not provide the preimage within 21 hours, the Litecoin goes back into Alice's account.

So, the contract has Alice's account, Bob's account, 2.5 Litecoin, the hash of the preimage, and 21 hour expiry.

Bob can examine the contract by browsing the blockchain. He can see if he likes the terms. If he does, he can build a contract on the Bitcoin blockchain. That contract is very similar. It has:

Bob's account, Alice's account, 1 Bitcoin, the same hash that appeared in the contract on the Litecoin network, and a 10 hour expiry.

Alice can examine the contract on the Bitcoin network. If she likes the terms, she can use her preimage to "unlock" the 1 bitcoin. When she does, that preimage is published on the Bitcoin blockchain, and Bob can see it. He uses that preimage to "unlock" his 2.5 Litecoin on the Litecoin network.


What's the easiest/fastest way to experiment with bitcoin-cli?

Yes, you can run bitcoind with the -testnet option.  This starts a separate process that runs independently of the mainnet bitcoind.  You can control it with bitcoin-cli -testnet.

Note that you will have to download and verify the testnet blockchain before being able to do very much.  This also takes some time / bandwidth / disk space / CPU, though much less than for mainnet.  Depending on the speed of your CPU and Internet connection, it might also make the mainnet download take longer if they have to share resources.


For maximum mining performance, is it better to minimize latency from the mining rigs to the p2pool server, or from the p2pool server to the Internet?

Are you aware that there is no 2nd option in your post? :)

Despite that, your second 1. option is better. If connection to the miner is one of the poor quality ones, p2pool will just adjust the share diff accordingly, decreasing the theoretical penalty.

However, if connection from your pool to the Internet is poor, it doesn't matter if you find block or not - it can be orphaned anyway, especially with altcoins with wrong low block time.


How do I get the address that received a payment?

I found out in the end how to do it, here you can see:

    wallet.addEventListener(new AbstractWalletEventListener(){
        @Override
        public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
            String hash = tx.getHashAsString();
            long received = newBalance.value-prevBalance.value;
            String address = null;
            for (TransactionOutput txop : tx.getOutputs()){
                if (txop.isMine(wallet)){
                    address = txop.getScriptPubKey().getToAddress(params).toString();
                }
            }
            int UserID = MySQL.getUserIDbyAddress(address);
            // Code...
        }
    });


How does Bitcoin read from/write to LevelDB

In the specific example you asked, it does so by querying the LevelDB located in ./bitcoin/chainstate (there is where the UTXO set is stored).
UTXOs are identified by its txid (Little Endian representation) leaded by a c.
Example
Transaction
246c5a81b6ad0dfc0dbc0b2ff5bde65ee1913f75a47d409b8ff8074a27ec1000
is identified in the LevelDB by:
c0010ec274a07f88f9b407da4753f91e15ee6bdf52f0bbc0dfc0dadb6815a6c24
or what is the same:
630010ec274a07f88f9b407da4753f91e15ee6bdf52f0bbc0dfc0dadb6815a6c24
since the hex representation of the lowercase ASCII character 'c' is 63. Notice that when you query the database you should not do it using the string representation of the value, but the byte array one.
Each entry in the LevelDB contains two values, the identifier (explained avobe and used to query the data), and the value.
The value of each entry (the UTXO) is encoded in the LevelDB following the structure that follows (extracted from this comment from the source code):

Serialized format

VARINT(nVersion)
VARINT(nCode)
unspentness bitvector, for vout[2] and further; least significant byte first
the non-spent CTxOuts (via CTxOutCompressor)
VARINT(nHeight)

The nCode value consists of:

bit 1: IsCoinBase()
bit 2: vout[0] is not spent
bit 4: vout[1] is not spent
The higher bits encode N, the number of non-zero bytes in the following bitvector.
In case both bit 2 and bit 4 are unset, they encode N-1, as there must be at least one non-spent output).

You can find a better formated explanation and examples in the source code from the provided link.
Notice that, since chainstate database used to trigger anti-virus software, as you can check in this issue and in this question, the first lines of the chainstate contains the obfuscation key, a 64-bit value identified by 0e00obfuscation_key that should be XORed with each data value from the database. To do so, the key is concatenated with itself until it reaches the length of the obfuscated value.
Example
Lets o_k = '27c78118b7316105' be our obfuscation key, and
{"key": "63000002f414665fb03389dd19776732bf90883bcb399d23323747596e98dd1801", "value": "26c326d7353661dc7005d274976f458691f24f0f05d141335f4ad5927e41"}
be one entry from the database. As you can see, value does not follow the above introduced format, since it is obfuscated. value is 60 characters long, so if we extend the obsfuscation key since it reaches the same length, we get:
27c78118b731610527c78118b731610527c78118b731610527c78118b731

Now, if we perform the XOR between the value and the key:
26c326d7353661dc7005d274976f458691f24f0f05d141335f4ad5927e41 XOR 27c78118b731610527c78118b731610527c78118b731610527c78118b731

We obtain:
0104a7cf820700d957c2536c205e2483b635ce17b2e02036788d548ac970

That matches with the previous stated format, and it's indeed the UTXO value identified by 63000002f414665fb03389dd19776732bf90883bcb399d23323747596e98dd1801.


Does FIPS 140-2 crypto certification matter for Bitcoin?

You should basically never choose FIPS-140 unless you have no choice. FIPS-140 compliance is provided primarily for people who must comply with FIPS-140 for regulatory or policy reasons.

Note that that's not to say FIPS-140 validation is bad. It's great. If it finds bugs or problems, that's a pure win. If you have a choice between an implementation that has been FIPS validated and one that has not, the former is the better choice. But that has nothing to do with whether you enable FIPS-140 modes.

Your implementation has been FIPS validated. Don't brain damage it.


Why do non-SegWit clients send witness data in the first place?

Non-segwit clients do not send witness data. They do not know what witness data is and would not know how to interpret it.

However, I think you are asking about the scriptSigs, which contain largely the same data as witnesses. ScriptSigs are actually scripts, but since the only standard scriptSigs push data to the stack, the same behavior can be done by segwit with the witness data. Non-segwit clients must transmit scriptSigs (and the scriptSigs of segwit output spends are empty) because they are part of the data that is hashed for the transaction id. Furthermore, non-segwit clients must be able to verify non-segwit transactions; they shouldn't just blindly trust that the transaction is valid. So the scriptSigs provide the information necessary for them to verify those transactions.


Is there something about Bitcoin that prevents us from implementing the same privacy protocols of Monero and Zcash?

I'm curious as to why Bitcoin has not perused a similar path to privacy.

I want to start by commenting on the phrasing of this question. Bitcoin is defined by the consensus of its users, and isn't a central entity that can set a development goal or priority of what to work on. Individual people - including developers like me - have priorities on what to work on, but those might not be shared by everyone in the ecosystem, or even be opposed by some. Since invasive changes like the ones you're talking about need to be adopted by ~everyone to be successful, it's very hard to answer a question of the form "why does/doesn't Bitcoin do this?". A better way of phrasing is whether there is active research in some direction, or what challenges exist.

making them completely anonymous.

Privacy in cryptocurrencies is a complex topic, and isn't restricted to on-chain transaction linkage (which seems to be what you're talking about here). To give a few other examples:

P2P network privacy: network-level attackers can monitor how transactions propagate through the network, allowing correlation between transactions, even if no on-chain trace remains of this. Partial solutions against this exist (Tor, encrypted private channels, Dandelion, mixnet routing, ...), but things very much depend on how they are used.
Wallet infrastructure: the way people actually interact with the system isn't immune from privacy leaks. Lots of wallet software uses central servers (trusted to greater or lesser extent), and this isn't even restricted to blockchain access: have you considered how wallets get exchange rate information? This reveals "Bitcoin user on this IP!" to the service where they are getting it from. Additional layers of payment infrastructure add another dimension to this, with their own challenges.
Spending policy privacy (aka "smart contracts"). Any time someone does less than trivial things on-chain, it stands out. If tomorrow AwesomeCorp brings a new fancy secure wallet, and it's in practice the only thing out there that uses 5-of-7 multisig, then anyone can infer that any 5-of-7 scripts on chain are due to users of AwesomeCorp Wallet. This too is a privacy leak. A less far fetched example: you can trivially distinguish Lightning usage from normal payment activity on chain today. This is orthogonal to on-chain transaction linkage privacy (though some solutions apply to both). This is something that the Taproot (BIP 341) proposal aims to partially address (disclaimer: I'm a co-author).
Amount privacy: Bitcoin transactions today reveal information about the amounts being transferred (even if not always completely obvious due to change outputs). Both Monero and Zcash cover this as well with their respective approaches, but it can be treated as distinct from transaction linkage privacy, and hypothetical solutions exist that address one but not the other.

All of this to say: privacy is multi-faceted, and all aspects of it are important. And it turns out, some of them are much easier to improve upon than others.

I'm curious as to why Bitcoin has not perused a similar path to privacy.
Is there something about the Bitcoin Core code

Bitcoin Core has nothing directly to do with this. If the ecosystem demanded a particular change, it would get implemented, and people would switch to it - whether that's in the Bitcoin Core implementation or in something else. Of course, several people who participate in these discussions also contribute to Bitcoin Core, and it is a focal point for development - but doesn't necessarily have to remain that way (disclaimer: I'm a contributor to and maintainer for Bitcoin Core).

or the way Bitcoin functions at present that prevents it from pursuing this path in the future?

Specifically comparing with the approaches that Monero and Zcash have taken, I can give a few reasons that I personally think pose challenges. These aren't necessarily "Bitcoin cannot/will not do this because..." arguments; they're reasons why they could cause controversy, might not be acceptable, and indirectly may be reasons why people prefer to not work on them (or at least, work on other things first):

Necessity of "opt-in" approach: even if a system is proposed that enables better transaction-linkage privacy, it appears very hard to do in a way that doesn't either leave it optional (risking "why did you choose to use Private Mode for this transaction?" questions), or forces everyone to upgrade their wallet infrastructure (something that has historically been extremely rare) and may break systems built on top. This is even worse if the more private mode is more expensive, slower, or puts more load on the network.

ZCash's approach requires the introduction of new (and relatively new) cryptographic security assumptions (at least elliptic curve pairing-based constructions). This means that it's possible that with such an approach, future breakthroughs in cryptanalysis make it possible to steal coins, or violate other properties the system is supposed to protect. A similar risk exists of course for the assumptions Bitcoin relies on today for security, but these are older and more conservative (elliptic curve discrete logarithm), and perhaps also important: already accepted by the current users of the system. And even in case this new private mode is optional, if you're not personally comfortable with pairing-based cryptography and choose not to use it, you wouldn't be too happy if a significant portion of BTC in circulation move into it: if the assumption breaks, your own coins that aren't under such a system wouldn't retain any value if a sizable portion of the supply becomes perceived to be at risk for theft. Thus, you may see opposition to the introduction of such a system by those who aren't going to use it. Monero's approach has very similar security assumptions to Bitcoin's.

Both Zcash and Monero replace the UTXO set (whose size scales proportional to usage, and can and does shrink from time to time) with a different data structure that grows forever (proportional to how often coins have been moved). This is a major scalability concern, but only manifests itself under actual load. I believe both Zcash and Monero see far fewer transactions per unit of time than Bitcoin, so they may not suffer very much under this (yet). This makes it a fundamental trade-off: better scalability, or better on-chain privacy, and it's unclear if all users would be happy with changing that.

Auditability of supply: approaches that introduce better amount privacy (like Zcash and Monero, but also Confidential Transactions as mentioned in Prayank's answer - which doesn't directly affect transaction linking privacy) mean you don't have a simple database you can go over and sum up all UTXO amounts anymore to see what the total supply is. It gets replaced with a cryptographic construction, and trust that supply hasn't been inflated becomes entirely dependent on the security of the cryptography used. Alternative approaches exist that still have amount privacy, and don't make inflation protection dependent on security assumptions; only amount privacy itself. These are less efficient, and still make it hard to audit supply. Given the prominence of Bitcoin's supply schedule, it may be expected that many users aren't comfortable with giving up the auditability it has without very good alternative assurances.

So, yes, I believe there are specific challenges to pursuing the approaches those other systems used. But that's okay, there is lots of interesting research (partially due to the existence of these systems), and given enough time, I do expect that some of that will lead to improvements that Bitcoin can adopt. Furthermore, on-chain privacy doesn't exist in a vacuum, and liquidity matters: a system that is harder to use and/or sees less use for whatever reason inherently has a smaller anonymity set: the users of that system. Bitcoin sees actual use in the real world, and there are approaches to improve actual privacy that do not rely on on-chain cryptographic techniques, see this excellent article for example. The voluntary nature and actual usage also complicate fundamental improvements, but we'll get there.

Or is it related to extrinsic concerns that governments around the world might forcibly shut down the network if extreme privacy measures are employed?

As far as I am concerned, hell no.


MultiSig address transaction high fee with no change

Fees for multisig addresses (or P2SH in general) work exactly the same way as they do for P2PKH addresses. The fee is simply the difference between the inputs and the outputs.

In  your transaction, you only have one output, so by definition any left over amount is converted to fees. If you want to spend less, you simply need to add in a change output to another address you control, such that total input - total output = fee you want to pay.

There is no difference based on what type of address you use in how fees are calculated. Try setting your wallet/code to send the balance to a change output (I don't know of any wallet that doesn't do this)


Can we get any default address before running getnewaddress?

No.

The wallet actually always pregenerates keys (not addresses) and puts them in the keypool. A keys is fetched from the keypool and converted to an address only when an address is explicitly requested (via getnewaddress or from the GUI). An address is not pre-fetched by default.


Does Bitfinex support B2X? Will BTC holders at the moment of the fork be credited B2X on a 1:1 ratio?

There's no 2X fork anymore now, since it has been called off


From trying to design my own ASIC---I got as far as having a simulated but not completely debugged Verilog implementation---I can tell you how mine would have worked. Whilst I have not checked, the design choices seem so obvious to me that I doubt anyone would do it differently.

The inner loop of the mining process is a double SHA-256 hash of data where only one 32-bit word, essentially a counter or "nonce", changes. It looks for a specific result where there are enough zeros in the right place after the second SHA-256 and only needs to output that counter value for which this is the case (if it is for any).

This inner loop is perfect for implementation in hardware: The SHA-256 is of reasonably low complexity, is itself a loop that can easily be unrolled and pipelined (there are 64 identical steps in each of the two applications after an optimization I'll describe later), and if the counter-loop is included in the hardware, then the required IO is very low, both in terms of actual data transmitted and in the sense that it can be very slow with negligible impact on overall performance.

In the source code you reference, the loop I am talking about constitutes the entire function FindShare (lines 85 through 107). However, let me explain that of the actual work, implemented in FindShare as Sha256(Sha256(Current)) in line 90, due to an easy and very common optimization, only half of the initial function call is executed. The first half can easily be moved outside the loop.

If you really want to know the details, then I should add that part of the first of the two SHA-256 runs that should be done for each counter value is identical for all counter values. Naturally that should be optimized, and removing it reduces the hardware complexity significantly. It is even removed from many software mining implementations (one protocol used for mining pools actually lets the pool solve that bit, passing only the intermediary SHA-256 data to the miners). So what remains for the ASIC is some I/O logic to get that intermediate SHA-256 data and then finish 2 applications of the SHA-256 hash algorithms on the resulting data, check the output (and output a signal if it corresponds to finding a block or solving a share in a mining pool), and iterate 2^32 times with the next counter value.

Because an ASIC is a really custom-made chip, and because SHA-256 is such a hardware-implementation-friendly algorithm, it is reasonable to generate one new double-SHA-256-hash every clock cycle from a much smaller area of silicon than it takes to make a general purpose CPU, which takes many hundred clock cycles for the same computation. Whilst in principle the same is true for FPGAs, the fact that their structure isn't quite what one would wish for to do fully unrolled, pipelined SHA-256 (the area-intensive more efficient method of choice for Bitcoin mining, but not typical for other applications and pre-mining ASIC cores for SHA-256) means that in many cost-effective FPGAs one struggles to fit a single fully unrolled double SHA-256, whilst an ASIC can easily accomodate many.


How can I import the Mini Private Key of a physical coin?

You must convert the mini-private-keys to regular private-key format before being able to import them in wallets such as Litecoin-core. If your keys are based on "Casascius" then you could use liteaddress.org (fork of bitaddress.org) to do the conversion. Follow these steps:

In order to be safe download the source code from https://github.com/litecoin-project/liteaddress.org and run it on an offline and clean computer. That way you can be sure that the code you are running is actually what was shown on GitHub and running offline helps to keep your private keys safe from malwares, keyloggers,...
Run the file called bitaddress.org.html (it is not renamed to liteaddress!)
Move your mouse around (you have to, then you can ignore the result)
Click on the tab called "Wallet Details" and paste your minikey in the first box can click "View Details" button.
Depending on which address has balance (compressed or uncompressed) copy the respective private key at the bottom and import that in litecoin-core


The figure of 21 Million is completely arbitrary. It could have been any other number and it would make absolutely no difference, as long as the inflation schedule remains the same.

However, the inflation schedule is universally agreed to be one thing that can never be changed with Bitcoin. Any new code that extends the inflation will no longer be "Bitcoin" and will not be accepted by users of Bitcoin.

To make any change, it is not enough for the majority of nodes to modify, all nodes must eventually change. Usually it is enough for the economic majority to accept the change to trigger this, but with a change like this the worst that could happen is a fork to two different networks.


Is 3D acceleration needed for GPU mining

First of all, let's make costs clear. If power is extremely cheap for you (perhaps you make your own or have surplus from self-generated solar/wind), and you properly cool your GPU so that it does not burn itself out, then you MIGHT get a tiny amount of BTC from mining with a rig.
Nice Hash gives you about $1.78 per day for renting out an Nvidia 1080 Ti, so you would get $1.78 per day if your electricity costs are zero. A 1080 Ti is about $1125 and uses 250W. (2190 kWh per year, if ran 24h/day). IF you have free electricity, and given that the Bitcoin difficulty does not go up, this means you get about a 57% yearly RoI, and from this you must pay the 22MWh of electricity.
Now that the return rate is clear, the vast majority of GPU miners use a GPGPU language such as CUDA or OpenCL. You do not need 3D acceleration, "only" GPGPU.
But GPGPUs allow accelerating more general computation than 3D, so chances are it's a more difficult challenge to implement as free software. If you don't have drivers for 3D acceleration, it's even harder to have GPGPU drivers.
Here is the Nouveau feature matrix for reverse-engineered nVidia drivers. Note the "WIP" in the last row - the "Compute" one. That is GPGPU support.
I share your frustration, I wish to sometime use GPUs as neural network accelerators, but I refuse to use nVidia's proprietary drivers which offer me little control. I could not even get the temperature of the GPU from the proprietary driver, let alone throttle the card to prevent it from melting itself.


What are the privacy implications of filtered blockchain downloads?

It inevitably leaks information, but Bloom filters have a (controllable) false-positive rate. So a wallet client that is very concerned with privacy could make the false positive rate high enough so it becomes hard to distinguish which transactions the client was interested in.


Generating blocks in regtest: "hash doesn't match nBits"

The regtest difficulty is not 0. It is around 0.0000000005 initially (corresponding to 1 hash in 2 being valid), and retargets the same way that the main network does, every 2016 blocks.

The fact that you see this error is a bug though, which will probably be fixed in Bitcoin Core 0.11.


How wallets/ miners differentiate bitcoin and bitcoin cash (forks of cryptos)? (technical IT question)

The protocol administers it.
Usually, one coin's blockchain will not be compatible with another's: for example, Bitcoin supports Segwit transactions, and Bitcoin Cash does not; whereas Bitcoin Cash has a high block size limit and Bitcoin does not. The point at which the two diverged is the point at which Bitcoin started mining Segwit blocks (which Bitcoin Cash clients will not accept as valid blocks, because they contain Segwit transactions), and where Bitcoin Cash started mining large blocks (which Bitcoin clients will not accept as valid). However, if there was a transaction that was valid on both blockchains (as may have been the case around the time of the fork), then that transaction can indeed be "replayed" on both blockchains, with both accepting the transaction.


Can I use same WIF/privkey to make myself a segwit address?

Yes.
If the P2SH-P2WPKH is implied (which is segwit reflection of plain old P2PKH like in your case), you still use one private key to derive a segwit address, and you still can reuse this private key to create a redeem script.

In fact, segwit address is derived from a redeem script.

But, there is a restriction, that unlike P2PKH, where you can use uncompressed and compressed public keys to create two separate addresses, in P2SH-P2WPKH, only compressed one must be used.

So, it is technically possible, given that you fully control address and transaction generation. Otherwise, it is on your wallet to give you such functionality.


Create a transaction from a wallet coins (UTXOs) with the bcoin library

createTX() doesn't sign the transaction. That is performed by sign() in wallet.js. If your private keys are offline anyway, what kind of unexpected behavior are you getting from createTX()? It wouldn't be able to sign without the keys...?

New functionality was also recently merged to return the MTX before the input scripts are templated (when the public keys are serialized and added to the witness): https://github.com/bcoin-org/bcoin/pull/557 I'm not sure if this helps out your use-case though.

You also might be interested in our own multisig wallet, bmultisig: https://github.com/bcoin-org/bmultisig

This application "plugs in" to the standard bcoin wallet (and full node) and offers hardware support like signing transactions from a Ledger device. Each counterparty of course can sign with their own hardware device at their own convenience.


Bitcoin uses cryptography to create digital signatures and cryptographic hash functions for various purposes such as transaction ids, block ids, and to commit to specific transactions in blocks. The Bitcoin protocol itself does not use encryption anywhere, but many wallets use encryption to secure private key material. There is also a Bitcoin Improvement Proposal (BIP) that aims to introduce encrypted peer-to-peer communication between Bitcoin nodes.

To follow-up on the question in the comments:

  "You have a bit-stream and you use a means called 'private key' to generate a bit-stream based on the original and then you use a 'public key' to uncover the original bit-stream - you use encryption."

The signatures in Bitcoin are created by means of the Elliptic Curve Digital Signature Algorithm (ECDSA). ECDSA uses two functions:

sign(privkey, message) which returns a signature
verify(pubkey, message, signature) which returns true or false

ECDSA does not qualify as an encryption algorithm, because the signature does not transport the message and there is no way to "recover the original bit-stream" from the signature. The verification of the signature validates that the correct key committed to the given message. This happens by means of evaluating an equation testing a mathematical relationship the triplet of pubkey,message,signature must fulfill for a valid signature.

H/T Pieter Wuille, David Schwartz, and John Newbery for the helpful comments.


What are the advantages and disadvantages of keeping bitcoins in an exchange versus a private wallet?

From what I understand it comes down to how you feel about security, to have a wallet stored privately means that you run the risk of equipment damage where you'll have to spend time on the recovery.

On the other hand you have the risk on network security, at least 2 exchanges have had high profile thefts occur in past years which have effected the market, exchanges make for big money targets and there's no real way to recover the funds.

Personally I think there is likely room for a hybrid solution between the two but I haven't seen anything yet.


Sure:

A leaf (transaction) can be pruned when all of its outputs have been spent.
A node can be pruned when both of its children have been pruned.

However, Bitcoin Core doesn't implement this kind of pruning. It was built on the assumption that you download and validate all blocks. Because of this, it operates in one of two modes:

No pruning (the default)
Don't keep old blocks or old merkle trees at all, and only track unspent outputs and their scriptPubKeys. This mode doesn't allow you to help new nodes synchronize.


Buy alt coin with bitcoin and both go up 300%, so did I even make any money?

Of course you profited, because your market value just increased by 300%.

In your case:
You had 1BTC (worth $5000) on Monday.
You sell 1 BTC and buy 50 XYZ( 50 * $100 = $5000).
Then comes Tuesday, both XYZ and BTC goes up 300%.
Now your 50 XYZ is worth $15000, you exchange 50 XYZ for 1 BTC.
You see, your total market value increased from $5000 to $15000.


Are there any hosted online store solutions (a la Shopify.com) that are compatible with bitcoins?

AFAIK there are no publicly available out of the box solutions for setting up a store that uses Bitcoin. Although; there are many viable solutions using Bit-pay, their system integrates well with most platforms. If there is a platform you want to use their system for, their sales team can surely help you do that.

I have no affiliation to Bit-pay but spoke with one of their founders in length at the Bitcoin conference.

I would recommend looking into setting up a wordpress site (hosted, not wordpress.com), using ecwid shopping cart, and asking bit-pay to integrate the store into ecwid for you.

This setup is a 99% one size fits all, and you would be pioneering the way for others to follow. Bit-Pay may have an alternative solution, but I have developed several online stores (10+) for clients - and use wordpress/ecwid for both of my personal stores (after trying many others).


Standard CLI tool to calculate a public key out of a private key

To the best of my knowledge there is no standard CLI utility.
However, there are some tools which seem to be generally accepted, like bitcoin-bash-tools

Alternatively, you can use some script library, such as pycoin (written in Python), or bitcoinjs.

Personally I like Bitcore libraries (Bitcore is not Bitcoin Core, despite their names are similar). They are also written in Javascript.
I wrote a simple library for handling keys/addresses that can be used from the command line with the NodeJS interpreter: https://github.com/frz-dev/btcutils/blob/master/bitcore-keys-utils.js. In your case you can use the getPubKey function, passing the private key object.

Hope this helps


In Bitcoin scripting, can you have an IF within an IF?

Firstly, I'd like to note that you could change your script to OP_1 OP_1 OP_BOOLAND OP_IF OP_RETURN OP_ENDIF and it would be the same.

I'm reading the bitcoin source code, and I can't see a check for nested OP_IF's. These are the IF related checks I've found:

No IF/NOTIF without a value on the stack
No ELSE/ENDIF without an IF/NOTIF
No IF/NOTIF without an ENDIF

So it would let you nest IF's. In fact, it appears that allowing people to nest IF's is intended. Take this variable, which is used to figure out whether a branch of an IF is executing:

vector<bool> vfExec;

If they didn't want nested IF's, they could have made that a single bool variable.

Amusing fact that I figured out while researching this: The script OP_1 OP_IF OP_ELSE OP_ELSE OP_ENDIF is entirely valid.


Bitcoin check if the transaction is valid

The Bitcoin Network does not keep track of 'account balances', instead it uses an 'unspent transaction output' model. Each node will keep an updated list of all unspent transaction outputs (UTXOs), so that when it hears about a new transaction, it can verify that the transaction is only spending valid UTXOs. This check is done quite simply: the UTXOs used in the transaction must be present in the node's UTXO set. If the transaction attempts to spend a UTXO that does not exist (ie, 'insufficient balance'), then the transaction will be rejected as invalid.

See these questions for more information:

How is a wallet's balance computed?

Where is the UTXO data stored?

How big is the UTXO database?

How can a miner verify that a UTXOs is not spent elsewhere?

Why does Bitcoin store all transaction inputs and outputs, instead of just an "account/balance" ledger?


How's the blockchain connected to a Bitcoin Wallet

Blockchain is the state of the bitcoin network. It is unanimously accepted as the correct state.

Each bitcoin full node stores its own copy of the blockchain. These copies can rarely differ in couple of last blocks, so bitcoin full nodes can have slightly different view of the same blockchain (only of couple of last blocks though). By adding new blocks on the end of the blockchain (this happens every 10 minutes) any possible differences in blockchain copies resolve (full nodes come to consensus about the state of the blockchain). Bitcoin full nodes are connected in a network and exchange their copies regularly.

The wallet is either implemented as part of the bitcoin full node application or as a separate small application that is then connected via Internet to some bitcoin full node.

Bitcoin wallet must be able to:

a) Generate public address and respective private key.

b) Calculate the balance of public addresses you control. To do this bitcoin wallet must read one small part of the blockchain, the one that holds unspent transactions (and possibly a pool of unconfirmed transactions - the transactions that are broadcasted but not yet added on the blockchain).

c) make a transacion using coins from your public addresses, sign those coins with private keys related to public addresses used, and broadcast this transaction to the bitcoin node that will spread this transaction to other full nodes in bitcoin network. This transaction will eventually end on the blockchain.

So b) requires reading data stored on the blockchain, and c) requires sending new data on the blockchain. Remember that the blockchain is a copy in a bitcoin full node. So the wallet reads from and writes to the blockchain by either communicating internally when being part of the full node application or communicating through Internet with some full node.

Full nodes communicate between themselves to spread and gather blockchain changes.


Bitcoind functionality w/o running a full node

I guess you could use some API that provides the same functionality.

See https://chainquery.com/bitcoin-api/decoderawtransaction

  bitcoin-cli decoderawtransaction

And much more calls/commands are listed there.

Does this fit your needs?


How to validate raw transactions using bitcoind and/or bitcoin-cli (preferably offline)?

You can validate transactions in an offline instance of bitcoind that has absolutely none of the block chain!

Launch it like this:

$ bitcoind -datadir=some-datadir -server -connect=localhost:9999

The "connect" parameter gives it the remote connect to. If you point it at a non-listening port, it will never gather any blocks. This is fine for validating transactions.

It will tell you that you need to create a bitcoin.conf, and where, and what to put into it (rpcuser=bitcoinrpc and rpcpassword=some_long_string).

Then your bitcoind RPC url will be

http://bitcoinrpc:password@localhost:8332/

You use the JSON API signrawtransaction documented in section 7.2 of https://en.bitcoin.it/wiki/Raw_Transactions. You will need to pass in the inputs, since they will not be known to the bitcoin daemon.

I'm the author of the Python library pycoin https://github.com/richardkiss/pycoin/ and I use bitcoind to verify that transactions created by pycoin are valid (or in some cases, invalid). See bitcoind_agrees_on_transaction_validity in https://github.com/richardkiss/pycoin/blob/offline_tx/pycoin/services/bitcoind.py for an example usage.

(You could also use pycoin to validate transactions. It works, but it's not quite there yet documentation-wise. It also hasn't been extensively tested on non-standard transactions, so its VM implementation is hardly authoritative.)


Is Bitcoin network truly distributed without central authority?

You can get your pre-installed lists from anyone you choose by any method you choose. There is absolutely no requirement to you get these lists in any particular way or from any particular authority.

If you wish, you can make your own list of bitcoin nodes you consider "valid". You can publish this list by a web page, by DNS, or by any other method you choose. Anyone who wants to can use your list, or not use your list, however they want. And Bitcoin will work just the same.

When someone follows an "authority" because that authority is convenient, I do not consider that centralization. As long as people are free to choose to follow a different authority, or just do it themselves, if at any time they no longer like what that authority is doing, that's not centralization in my view.

And, of course, none of this is relevant once you find a few bitcoin nodes to talk to. It only affects the initial bootstrapping process. You have the same issue with getting the bitcoin software in the first place. Is bitcoin not decentralized unless everyone writes their own implementation of the protocol? Or is it decentralized so long as people are free to if they wish?


What is a step by step way to insert data in OP_RETURN?

I wrote a little demo program which puts a snippet of data into an OP_RETURN script. It requires a bitcoin instance that accepts RPC connections, though it could be implemented without that. You can find it on github here. It's been tested, but only on testnet. I'm going to go through the code and explain what it's doing.
Start
[...]
logging.basicConfig()
logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG)

This makes logging more verbose. It's handy because it shows what RPC calls are being made.
Connect to bitcoind
rpc_user = "bitcoinrpc"
rpc_password = "87Y9A2gs25E9HDPGc9axqSqzxMR2MyTtrMkYc5KiZk2Z"

rpc = AuthServiceProxy("http://%s:%s@127.0.0.1:18332/" % (rpc_user, rpc_password))

Note that your password will be different, and that you use port 8332 for mainnet instead of port 18332.
List unspent outputs
first_unspent = rpc.listunspent()[0]
txid = first_unspent['txid']
vout = first_unspent['vout']
input_amount = first_unspent['amount']
SATOSHI = Decimal("0.00000001")
change_amount = input_amount - Decimal("0.005") - SATOSHI

The - Decimal("0.005") part is so that we pay a transaction fee.
Create transaction
# Marker address we're going to replace
# Produces a pattern that's easy to search for
mainnet = 0
if mainnet:
    dummy_address = "1111111111111111111114oLvT2"
else:
    dummy_address = "mfWxJ45yp2SFn7UciZyNpvDKrzbhyfKrY8"

These are two different encodings of a Pay to Public Key Hash of all zeros. The top one is the mainnet representation, and the bottom is the testnet representation.
# My change address
change_address = "mhZuYnuMCZLjZKeDMnY48xsR5qkjq7bAr9"

Remember, this is my change address. If you don't change it, you'll be sending money to me.
tx = rpc.createrawtransaction([{"txid": txid, "vout": vout}], \
                              {change_address: change_amount, \
                               dummy_address: SATOSHI})

And now we have an actual transaction. It doesn't contain any of our own data though, so we'll have to fix that.
Replace dummy output with our own output
# Pattern to replace
# Represents length of script, then OP_DUP OP_HASH160,
# then length of hash, then 20 bytes of zeros, OP_EQUALVERIFY OP_CHECKSIG
oldScriptPubKey = "1976a914000000000000000000000000000000000000000088ac"

This is a bit of a hack. Instead of creating our own output, we create a dummy output, then search for the pattern it makes and replace it. There's probably a better way to do this, but this seems easiest.
# Data to insert
data = "Melons."
if len(data) > 75:
    raise Exception("Can't contain this much data-use OP_PUSHDATA1")

newScriptPubKey = "6a" + hexlify(chr(len(data))) + hexlify(data)

Next we create the data we want to put into the blockchain. I'm using the string Melons., but you could use anything. (Above 40 bytes is nonstandard, though.) I covered most of this in my other answer.
This code will break if the data is longer than 75 bytes. If you need it for more than that, you could use OP_PUSHDATA1 instead of the single-byte pushdata that I'm using here.
#Append int of length to start
newScriptPubKey = hexlify(chr(len(unhexlify(newScriptPubKey)))) + newScriptPubKey

This part is a little different than my other answer, because we need to include the length of the scriptPubKey also. This code will break with data longer than 251 bytes. If you want it to work on data longer than that, encode a varint correctly.
if oldScriptPubKey not in tx:
    raise Exception("Something broke!")

Error checking for this very rickety method.
tx = tx.replace(oldScriptPubKey, newScriptPubKey)

Finally, a string replace swaps the new script for the old one.
Sign it
tx = rpc.signrawtransaction(tx)['hex']

Bitcoin handles the heaving lifting here.
Broadcast it to the network.
rpc.sendrawtransaction(tx)

Done! Now just wait for your transaction to get into a block.
I ran the code (output), and I produced a transaction, which you can see in Block Explorer here. If you copy the string next to OP_RETURN, and paste it into a Hex to ASCII converter, you get...
Melons.

Done!
Other resources
I found this webpage helpful while writing this.


Can I regenerate blkindex.dat from blk0001.dat?

This is possible in git HEAD, and will be in 0.7.0. You can move the existing blk0001.dat elsewhere, delete blkindex.dat, and then start the client using ./bitcoind -loadblock=blk0001.dat.bak


What are the most secure-yet-convenient ways of creating a wallet, that require just remembering a password?

Take a password.
Hash it with SHA.
Use the hash as a private address.
Generate your public address from that private address.

Guess this would be the easiest algorithm for having a deterministic wallet. One could easily make a web service or a program to generate those addresses, but people generally don't trust third party services like this.

EDIT:
StrongCoin allows one to generate a private key from any sentence, and given that they encrypt the private key before your browser sends it out, one can trust them not to know it. Then, you can decrypt the private key (as far as I know, also on your machine), and import it wherever one needs (provided you don't want to keep your coins online). It is a small workaround, but seems to fulfil your friends' needs.


Help verifying bitcoind "full node" installation on Debian box

autogen.sh located in bitcoin source root. To use it you should have  pkg-config libtool installed.


How do I monitor and track the legal proceedings of Silk Road founder Ross Ulbricht?

As a partial answer, let me point you to the three places of which I happen to know that they had more than one detailed report on the subject, starting the count with the arrest of Ulbricht. Please note that this list is probably a better reflection of my personal browsing habits than than any objective standard about being particularly fast or complete sources. All of these are deep links to local search results for "silk road":

Popehat
Tech Dirt
Ars Technica

Even better might be a news aggregator, such as Slashdot (again a deep link to search results for "silk road"). You won't find too much original content beyond a summary and one or more links, but it is fairly likely that major developments reported anywhere will find their way onto Slashdot.


I'm not sure if you're trolling or not, but 200 bitcoins is currently worth ~2,357,000$. ( Which seems to pretty aligned with the number you are giving.)

There's no virus/scam or bug, the price simply increased. Congratulations.

I'd advise you to make a backup of the private key of the adress you're currently storing the 200 bitcoins on, and either memorize it, or hide it, in case your old PC / ( the harddrive of your old pc) breaks.

Or even better, buy a hardware wallet (such as a trezor or Ledger Nano S) Or a secure new PC/Laptop, and store the bitcoins on there.


How is the difficulty of bitcoin mining propagated?

The difficulty is stored in the block in the Bits field. When any server receives a block, one of the things it does is check if the value in this field is correct. If it's not a block where the difficulty changes, it must have the same difficulty as the previous block. If it's a block where the difficulty changes, then it must have the correct difficulty according to the well known Bitcoin difficulty adjusting algorithm.

There is no "central bitcoin server".

Forks are resolved as follows:

Blocks that are invalid are ignored. Only block chains consisting entirely of valid blocks are considered.
The blockchain that would likely have taken the most effort to create (highest total difficulty) wins.


Your python scripts generate uncompressed public keys, and they seem to calculate correctly.
When I use my own scripts, the results are:
Private key: ---------------------------------------
5598c164e8bcec667589267cdaf0f14a6b9399ae0b2a6b10972602a6feaf682d
Private WIF: ---------------------------------------
Kz66jawQ5eb7pQYJx3tTNmFQBS46x1rg92To2js3bY1SKrPxVWvL
Public key: ----------------------------------------
04cbeefab6ecfa84f5f120503de4574952f2d1fa5b11b8f6c80a13df02e6512090e6fede6dde3e65256c484162e3839cf599c3d08a236432e8e307784b741ffca5
pubkeyhash: ----------------------------------------
50cdf408e049ddab4bd8ebda8a6500e93831a633
BTC Address: ---------------------------------------
18NFnELB9YpRiEbLMmRLKymYpvxC9yzkC2

No difference to your results.
But there seems to be a bug in walletgenerator.net's calculation:
They claim that the uncompressed address was the same as the compressed address, which cannot be correct. Which tab did you use on their site, was it Wallet Details?
As a compressed bitcoin address, I get 1KJKsAzDeH1127x6w8e2xZyzRdvFkiLhme when I use my own scripts, and my Electrum client confirms that result (when I use the private key import feature).
All that does not match the results of walletgenerator.net, so my conclusion is that their site is buggy.


separating proof of work from mining possible?

All nodes verify transactions in Bitcoin. This helps propagate transactions in the network fast and given a majority of honest nodes you propagate valid transactions faster.

Given that anyone can verify transactions it will not be difficult to have some dishonest nodes to verify 2 of my transactions spending the same bitcoins (double-spend). We do not want that, so we need to make it difficult to publish (verified) transactions to the network. Thus we have proof-of-work/mining** and some of the above nodes also mine.

So the introduction of PoW was so that publishing*** (verified) transactions is safe from double-spends. And to incentivize the process bitcoins are rewarded.

Your example with the car (I assume that it could work although I see several issues :)) could work as PoW since it requires effort. But you need to prove your effort for something. In Bitcoin it is for adding (and verifying) new transactions to the blockchain. What will it do in your example? And how would you safeguard from double-spending a car-coin?

** Also works as an anti-spam measure.

*** The reward is for publishing a block (set of transactions) in the blockchain not just for verifying. Even though many others will verify only the nodes that prove their work are allowed to add a new block in the blockchain.


Transfer different currencies between wallets

You can send one kind of cryptocurrency to another cryptocurrency's wallet. The transaction will complete but the coin will be lost.


How can get balance for btc/bch address and block?

A BTC/BCH node does not supply aggregate information on addresses.
You could consult one of the block explorers out there, most of them do provide balances for addresses.


How can I calculate the profitability of this dash cloud mining contract?

Don't make cloud mining contracts! A lot of cloud mining providers are just scammers.

The network's cumulative hash rate of Dash varies a lot but tends to go up and below 3 TH/s a lot. Currently, the block reward is at (converted) 261.96 USD. It goes down by 7.1% per year. Dash's block time is 3.5 minutes.

Think about it: We can approximate the total money miners make under the assumption that the total hashing power and Dash's value stay about the same as the integral of 261.96 USD * 525600/3.5 * e^(-x*0.0736465) over x from 0 to r where r is the time in years we regard Note that this isn't exact but using this integral I don't have to calculate weird sums. This means that you'll make about 100 MH/s / (3 TH/s) of that.

Plug those numbers in and you get that you should make 2438.59 USD during those 2 years.

Now ask yourself this question: Would you sell that for 500 USD or try to keep the 2438.59 USD to you when your operational costs (allegedly) obviously are below 500 USD for that time? And why would the cloud storage provider?

In case you're still interested in the break even point: Just determine r for that integral times your share being equal to 500 USD. The result is r = 0.386758. So after 4 months and 19.23 days.


How to secure one's Bitcoin Client from packet sniffing?

A hacker that has physical access to your network and computers can always find a way to abuse that access but SSL is a very good deterrent and is supported by bitcoind.  Click here to see a guide on enabling SSL for bitcoind.

For securing the communication between nodes you might want to try tor.  It basically makes sure that all traffic on your network is encrypted but still allows you to connect to an encryption-less service.


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


Can I limit the back-up data in wallet.dat?

No, this is not possible without custom software or a lot of extra work. The wallet.dat file contains all the private keys, and the reference client doesn't have a way to split it up.


Why the same confirmed transaction in the Testnet has different block hash and other fields?

That's pretty common. What happens is that the chain forks for whatever reason and some miners are on each side of the fork. They will both have your transaction in their transaction pool and so eventually include it in a block. So your transaction ends up on each fork.

Ultimately it doesn't matter though as the network will eventually agree on which fork is correct.

Note that recently, testnet has been pretty unmanageable, with regular difficulty resets creating situations where 100s of blocks get created per minute. This creates a lot of chain forks and some can be really long, like in your case. Also due to the high number of forks, some nodes may not have learned about a given block/fork at all if it ended up "losing".

On the mainnet, forks are somewhat infrequent (couple daily) and much shorter (very rarerly more than a block).


Bitcoin client from command line without blockchain

Bitcoin transactions do not move funds from one address to another.

Bitcoin's core concept is coins. Coins are created by transactions, and can have have arbitrary value. Coins are consumed by another transaction by explicitly referring to the transaction that created them. So, in a way, transactions melt some input coins together (destroying them), and forge new ones from it (with a total value that can't exceed the value of the melted ones).

When creating a coin, you can assign it to an address (in fact a script, but let's simplify). This is just an authentication mechanism on top: in order to consume a coin assigned to address A, you have to sign the transaction with the private key corresponding to A.

So to answer your question: this is not possible. To create a transaction, you need to know the exact transactions that assigned coins to addresses of yours, and their value.


most profitable scrypt mining machine per dollar with unlimited budget and free power?

There are a few other GPUs that do a bit better according to this list:

https://litecoin.info/Mining_hardware_comparison

I think this is just based on user feedback to the Wiki.  The ones with a lot more khash/s are multi-card setups.

Really if you have free power you should mine with whatever you can afford, then add more cards after you have coins and have sold them.  There are instructions on a cheap multi-card system here:

http://www.coinminingrigs.com/

Unfortunately many of the parts referenced are difficult to find - they sell like hot cakes!  The R9 280X is equivalent to the 7950 and is usually cheaper.

Don't forget that there are dozens of scrypt based currencies and mining the most profitable one over LTC can net you a lot more income.  I can't post any more links here but google multipool or check www.multipool.in for a start.

Also don't forget that if you put in a nice 4 or 6 core processor you can also do CPU mining for PrimeCoin, QuarkCoin or ProtoShares.

Good luck!


As an Ardor bundler, can you filter out which transactions you wish to bundle based on a specific criteria?

You can specify a bundler filter using the nxt.bundlingFilter property.  This is a Java class that is loaded by the bundler and will be called for each transaction to be processed.  The filter returns 'true' if the transaction should be bundled and 'false' otherwise.  Note that the filter executes as part of the server and thus can use any of the internal public methods to decide whether a transaction should be included.

Update: Ardor 2.0.13 now provides a custom bundler filter that allows you to select transactions based on an account property. See https://nxtforum.org/nrs-releases/ardor-v2-0-13/ for more information.


Can transaction id be used to verify a transaction?

Indeed malleability means that the tx_id can change as long as the transaction is not in the blockchain yet. That means you can NOT rely on the tx_id. But:

Once the transaction is in a block that is part of the blockchain, the tx_id does uniquely identify it and can be reliably used forever in the future to refer to it.
Basically all other coins ever forked from Bitcoin have the same (and many more) problems.
In Bitcoin it's already fixed by SegWit. The tx_id for SegWit transactions can not be malleated anymore (except by the person who has the private keys).


Native P2WPKH Unspent outputs save 22 bytes as their ScriptSigs are empty instead of 0x0014{20-byte-key-hash}.
2)
Yes, there's already a checksum of the same length.
The newer checksum algorithm is

Faster.

Very high probability of detection guaranteed..

Can find where the errors are: http://bitcoin.sipa.be/bech32/demo/demo.html (Press "address with errors")

Also, you might be interested in the list of Bech32 Advantages.


Can multiple people create one multisignature address, while keeping their private keys private?

You need the public addresses of all persons involved in order to create the multi-sig address. So if you are creating a 3 of 5 multi-sig address you need all 5 public address.  In order to retrieve funds from that address you need signatures from 3 of the 5 people (or however many signatures you require). Check out this example here, which was a huge help for me.

bitrated.com and https://coinb.in/multisig/ have open source implementations of this as well.


Lightning network Fraudulent Channel Close

No, a channel’s closing affects that channel only.

When routing payments, a channel’s state will be updated to account for that payment. When closing the channel, both participants will make sure that the most recent state is published.

This process does not involve any external channels/participants. Closing a channel will not affect the balance of any other channel, as each individual channel’s participants will have their own account of what that channel’s most recent state is. The closure of another channel does not affect this state, even if it is closed fraudulently.


I believe mining Bitcoin with overt (version-rolling) ASICBoost is currently (may 2018) supported by Slushpool, Ckpool, F2pool and my own pool Bitminter.

I would expect this list to keep growing, although adoption has been very slow for some reason.


Zcash the currency requires the generation of parameters that must then be securely destroyed. If this data is not securely destroyed by Zcash the company they could undermine the currency, by being able to create new money. For a more thorough discussion, see also the Zcash blog post on the problem and one by Greg Slepak discussing the potential risks.

The process for securely generating these parameters has been described, and for the security assumptions to hold requires at least one of the parties involved to be honest. More information is provided in the Q&A section of a recent talk by Eran Trommer.

However, in the event that the parameter generation process was compromised this will be hard to detect, since the design of the network pretty much ensures that this would be kept secret as long as the currency is not sufficiently devalued to make it obvious that actually it was devalued. Such an attack can still not compromise the privacy of the users, but can create currency at will.


Accidentally sent Bitcoin Cash to Bitcoin address held by a third party

You'll have to negotiate with your service provider whether they can help you.

Whoever holds the private keys for your Bitcoin wallet should be theoretically able to generate a transaction that sends the BCH from the Bitcoin address to wherever you wanted them to go.

In practice this may be difficult or infeasible: To keep large quantities of Bitcoin secure, the private keys are often stored in hardware devices or otherwise hard to access. The service provider will likely at least need to manually intervene to help you.

If the Bitcoin address was SegWit (which I wouldn't expect in this case), it might be even more difficult to recover, as you'd need the help of a miner, additionally.

It is unfortunate, that the Bitcoin Cash developers used the same address format as Bitcoin, even after this problem was well-known and in the media recently with Litecoin switching to a new unique P2SH address format for this very reason. However, I've read that they are working on a new unique address format, so at least this should stop happening in the future.


How to unset fee rate after setting with RPC `settxfee`

Looking at the source code suggests that settxfee 0 should return you to the automatic fee setting.  However this behavior is undocumented and there is a TODO suggesting that it might go away in the future.  Otherwise, you can restart bitcoind.


Am I Being Prodded By A Bitcoin Mining Scammer?

This is most certainly a scam, the scammer's messages explaining  how Bitcoin works are pretty much nonsensical. Disregard all the jibberish he wrote to you, if you'd like to learn about Bitcoin, this is a great question to start with: I am new to Bitcoin, how can I get started?.

DO NOT use the wallet you created with his help. Just forget you ever created it, if you want to learn to use Bitcoin, you must create a new wallet in the future.

There is a known scam where the scammer will 'assist' when setting up a wallet, and they will copy down a wallet 'seed phrase' that will let them re-create your wallet on a different computer later. It doesn't matter if you change your password, once they have the seed phrase they can have access to your coins.


In an input spending a P2PKH output, if you were to only check that the signature is a valid signature with the public key in the input, then an attacker could use their own public key and produce a valid signature and thus a valid transaction under this model. The public key is not retrieved from the output script nor is it provided by the output; rather it is provided in the input. Thus you must ensure that the provided public key is indeed the correct public key, hence the check that it's hash matches the hash provided in the output.

In multisig, the public keys are provided in the input, in addition to the signatures. They are in the redeemScript. To avoid the same issues (of the attacker providing their own public keys), the redeemScript is hashed and the hash is in the output script. There is a comparison there to ensure that the redeemScript is the correct script.

There is an output type where you do just provide a signature. This output type is a script where the public key is in the output so there is no need to provide the public key in the input. Only the signature is needed. This is known as a Pay to Pubkey (P2PK) output. These are not widely used because public keys are large and this makes it harder to give them out.


How do I use an issued API key in my python 3 script to bypass the request limiter?

You need to get an "api_code", then use that when making calls.

You can use their official python client.


Most likely the fee was very low and it is therefore not being selected by miners for a block. Bitcoin-Qt 0.8.6 is from Dec 2013 and you should consider upgrading to a newer version of the software. The recent versions have vastly improved fee estimation.

You should probably try to doublespend the transaction with a bigger fee. You can find more information and detailed instructions on Why is my transaction not getting confirmed and what can I do about it?.


No bitcoins in my multibit wallet, but I have some when I look in the blockchain

I just deleted my original answer now because I realised it was wrong.

If you have a wallet.dat file, then multibit classic is not the Bitcoin wallet you would have used. Chances are, you used the original Bitcoin software.

First you will need Python 2.7:
64 bit version
https://www.python.org/ftp/python/2.7/python-2.7.amd64.msi

Download this private key extraction utility which will display the private keys for your wallet.dat

https://github.com/dlitz/pywallet

Download the zip and unzip.

Open the command line (windows key + r) type cmd then press enter. Change directory to the folder you downloaded ie:

cd c:\Downloads\pywallet-master

Or c:\users\mike\downloads\pywallet-master

then type:

python pywallet.py --dumpwallet

press enter and you should hopefully see a list of bitcoin addresses and private keys (which start with the number 5).

Once you have these private keys, open a wallet with blockchain.info

and once you're in, click on the Import/Export button and click 'Yes I know what I'm doing'.

Click on Import wallet in the left side column.

You can then add the private keys by copying and pasting the output from the command line.


How was South Korean Bitcoin exchange Bithumb hacked?

The security of Bitcoin is unrelated to someone's Bitcoin wallet being hacked. The network provides the guarantee that given just the data on the blockchain, no one can get your private keys (assuming you haven't exposed them in some way on the blockchain). It does not secure anything related to the environment on which your private keys are stored on. If you were to store your private keys unencrypted on your computer, so long as no one can access your private keys, you would be fine. However your Bitcoin is not safe as if you were to get malware which finds your unencrypted wallet file and sends it to the malware authors, then your coins will be stolen. Your coins being stolen there is related to poor security practices on your computer, not with the Bitcoin network's security.

The same can happen to an exchange. If hackers were to get a backdoor onto the exchange's systems, they could steal the private keys and anything else necessary to access them (e.g. passwords or encryption keys). That the private keys were stolen has nothing to do with the Bitcoin network and everything to do with the exchange poorly securing their private keys.


Most likely you have not enabled JSON-RPC server in your bitcoin.conf.

You need to have:

# Enable JSON-RPC
server=1

# Username and password
rpcuser=foo
rpcpassword=bar

# This must be enabled for gettransaction() to work
txindex=1

For more information see

http://cryptoassetscore.readthedocs.org/en/latest/backends.html#module-cryptoassets.core.backend.bitcoind


Exchanges' order books are usually public.  See for instance https://www.gdax.com/trade/BTC-USD.  The graph in the middle is a helpful visualization of depth.

I'm not going to quote any specific numbers here because they would be instantly obsolete.

Of course, there are lots of exchanges, so to get the "big picture" you'd have to aggregate their data.


How do I withdraw my bitcoins and spend them?

Trade them for USD, GBP or EUR on a trading site such as https://mtgox.com and transfer it to your bank account.

Or you can spend them directly at any other business that accepts bitcoins as payment.


It is the same link protocol as http: or ftp: or mailto: or tel: or magnet:, although very less recognised. Official Bitcoin github MediaWiki Link

Localbitcoins.com offer its registered users to associate itself(site) to bitcoin: protocol, when user is signed in, and thus he clicks a link with bitcoin protocol, localbitcoins.com will automatically fill in the receiving address and amount text boxes with the values from link.

Yes, it just sends what it displays, address(required), amount and/or message (both optional)

On webpages, anytime it is marked down in html as <a href...> tag, it will be a clickable link.

There is no other use of it when it is not clickable, other than that you could see receiving address and amount, same as if you see http://www.example.com or mailto:example@example.com and you could just deduce the website address or email address.


The bolt 11 which specifies invoices does not give a rational for this design choice therefor - unless one of the people who build it come along - I can only give an educated guess:

So first of all if invoices were valid for an arbitrary time the recipient would have to keep an arbitrary amount of preimages running eventually into memory / Harddisk issues. I guess this is the single most important reason.

As another one lightning payments and routing with htlcs is an Atomic process it either works or it doesn't. Giving a constrained timebound you can decide afterwords for sure what the result was. If the expiry is arbitrary it could always be the case that the payment has just not been initiated yet.

Last I can imagine that sending nodes would eat up htlcs and the recipient might have already deleted the preimage (without expiry time) In this case the network also has unnecessary load.

Excited to see if other reasons pop up and excellent question


What is the largest company that has ceased accepting fiat payments in favor of Bitcoin?

The largest company that accepts Bitcoin, and no longer accepts fiat, is BackPage. However they didn't stop accepting fiat of their own choice, but because Visa and MasterCard blocked them from accepting fiat.


How to specify PrivateKey search range in HEX?

Use random.
Using your low and high values:

import random
def generate_private_key():
    low  = 0x18909BDE11F67C97A53C62F45E632EAB58EA0D73A5FAC9EB50295FAD40A57EB5
    high = 0xDD10559E1285B3EE0303B159B8D6D8D0B88E6168D1C1D6000000000000000000
    return str( hex( random.randrange( low, high ) ) )

And then just:

print(generate_private_key())

Note that you'll probably need to convert this hex address to wif, or extract a public key or bitcoin public address from it... If you need more easy Python code for doing this, you can check these little pieces of code.


Estimatefee value not corresponding to actual fee

estimatefee 1 will return the approx. fee per kilobyte.

Because sendtoaddress could use multiple of your unspent coins, the size of your transaction is not know until it is created (until the coin selection ran).

Example: Fresh wallet. You did receive 10 times 1 BTC. Now you create a transaction with sendtoaddress <ard> 9.5. This will produce a transaction with 10 inputs (your received 10 x 1BTC). Therefor the transaction size is bigger than if you would have received 1 x 10BTC.

At the moment there is no easy way of getting the transaction fee before sending the tx (on RPC level). You could use Bitcoin-Qt (there you will see the fee before sending within the confirmation dialog).

There is a pull request for bitcoin-core that would allow fee calculation before sending the tx: https://github.com/bitcoin/bitcoin/pull/6088


How do faucets/micropayment-based services avoid/minimize transaction fees?

You have two questions here, so I'll answer them separately.  As far as how do faucets they avoid transaction fees, the answer is that they don't.

Most of the faucet sites I've used use a service called Coinbox.me which collects requests for payments and bundles them up into one large chunk of payments.  This is how they minimize transaction fees - they don't send all the microtransactions at once, they wait until they have quite a few and then send them out.  I've looked at these transactions before when they're going through and they do have transaction fees that are being paid that is, as you said, larger than the amount being sent out.  But I have had transactions where it is being sent to at least a hundred addresses, so while one small amount may far less than the transaction fee, the total amount being sent out is significant enough that the service can pay a transaction fee while still paying out these microtransctions.


In a bitcoin multi-sig wallet, can i determine which of the m of n keys were used to send bitcoin?

The signatures and public keys have to be supplied to spend the coins so yes you can tell by looking at the spending transaction on the blockchain.