How can I create HTLCs below dust_limit_satoshi in Lightning Network?

The dust limit is an externality to lightning wich the protocol has to respect. In fact if a commitment transaction would encode an htlc below the dustlimit you could not force close the channel as the Bitcoin network would not accept that particular transaction.

When it comes to htlcs below the dustlevel we work with a little trust in the payment channel. This means that offering an htlc means that we remove some bslance from our side of the channel. Instead of making it an htlc output we just add it to the fees of the commitment transaction. Technically our channel partner could harm us by force closing now and our htlc amount would be lost forever if we don't find the preimage. Only upon delivery of the preimage a new commitment tx is negotiated in which the fee is reduced by the htlc amount and added to your channel partners balance.

That being said. For fee calculations of small payments we even allow subsatoshi amounts which again are not enforceable and will be added to the fees by rounding down the actual balance in the commitment tx. Any routing nodes could implement (actually just configure) a rule like the one you suggested. This would enforce the effect that the channel can be operated fully trustless.

I can't tell you why this is not encoded to the protocol. I think because people wanted to allow micro transactions


Litecoin litecore-lib receive UTXO and current balance

I used the request library to manually retrieve information from the insight API. I also used the litecore-lib library to create the transaction.

var Litecoin = require("litecore-lib");
var request = require("request");

//manually hit an insight api to retrieve utxos of address
function getUTXOs(address) {
  return new Promise((resolve, reject) => {
    request({
      uri: 'https://insight.litecore.io/api/addr/' + address + '/utxo',
      json: true
    },
      (error, response, body) => {
        if(error) reject(error);
        resolve(body)
      }
    )
  })
}

//manually hit an insight api to broadcast your tx
function broadcastTX(rawtx) {
  return new Promise((resolve, reject) => {
    request({
      uri: 'https://insight.litecore.io/tx/send',
      method: 'POST',
      json: {
        rawtx
      }
    },
      (error, response, body) => {
        if(error) reject(error);
        resolve(body.txid)
      }
    )
  })
}

//your private key and address here
var privateKey = PrivateKey.fromWIF('YOUR_PRIVATE_KEY_HERE');
var address = privateKey.toPublicKey().toAddress();

getUTXOs(address)
  .then((utxos) => {

    let balance = 0;
    for (var i = 0; i < utxos.length; i++) {
      balance +=utxos[i]['satoshis'];
    } //add up the balance in satoshi format from all utxos

    var fee = 1500; //fee for the tx
    var tx = new Litecoin.Transaction() //use litecore-lib to create a transaction
      .from(utxos)
      .to('TO_ADDRESS', balance - fee) //note: you are sending all your balance AKA sweeping
      .fee(fee)
      .sign(privateKey)
      .serialize();

    return broadcastTX(tx) //broadcast the serialized tx
  })
  .then((result) => {
    console.log(result) // txid
  })
  .catch((error) => {
    throw error;
  })

Cheers!


Got it: the last byte 01 stands for compression and has to be dropped


Transfer BTC from Coinbase to Bittrex: fee static or percentage

The transaction fee is neither static nor a percentage of the amount you transfer. It is based entirely on the size of the transaction in bytes (because a transaction is just data). Since you have no control over the transaction except for one of the outputs, you cannot determine the fee that will be paid.

It is better to send it all as one transaction rather than multiple. This is because there is some overhead bytes in a transaction that are saved by making one transaction instead of two. Furthermore, there is a cost to create a change output (as that would likely need to happen, although it will probably happen anyways) and a cost to spending that change output again when you make the second transaction. Since sending as multiple transactions will incur an extra cost, you should make just one transaction.


Should a JSON-RPC user be required to use a password when backing up the wallet?

The JSON-RPC was never intended to be open to the public, hence the required rpcuser and rpcpassword. For added security it should also be configured to either listen only to the loopback interface or the allowed IPs limited to a few trusted sources.

The wallet password is used to access the encrypted private keys, that's the reason everything involving either adding new private keys or signing with the private keys requires the wallet to be unlocked.

backupwallet exports the keys in their encrypted form and therefore does not require the passphrase.

If you have to allow JSON-RPC access to untrusted users, put a filter in front of it.


I was using Ninki as my wallet, however, the service got discontinued

Yikes, sorry mate.

  I cant access it how would I go to recover my bitcoin or is it completely lost?

Well, it depends. If you have a backup of the wallet, or a mnemoic seed phrase, you might be good to get your Bitcoins back. If Ninki does not let you do this, or you do not have one of these, your screwed.

You are not the only person facing this. Many wallets and exchanges close, taking their customers Bitcoins with them.


How do I transfer funds from India to an exchange?

If you can send an International wire transfer (USD) there will be fees charged by your own bank to convert from INR to USD, as well as a wire transfer fee.  Then some fees charged by Mt. Gox exchange to receive the funds I believe, but a relatively small amount.

The conversion from INR to USD is probably the part that will be the most expensive as banks don't always give competitive rates.

This problem isn't unique to India, but those in many other nations have more options.  For instance, in many countries the P2P market CurrencyFair can be used to get a good rate converting to some other currency like USDs.

Since neither CurrencyFair nor Transferwise work in INR funds yet, that will not yet be an option for you.

So an international wire of USDs is probably your best and least expensive method, especially for a little larger amount of $1K USD worth or so.

You might also look at ECurrencyZone, which allows Rupees to be deposited into an account at any of the following: ICICI Bank, IDBI Bank, HDFC Bank, AXIS Bank, PNB Bank, State Bank of India, or Bank Of Baroda.  Bitcoins are then delivered for those funds.

The only exchange located within India is Buy Sell Bitcoin.  They support Cheque and NEFT (Net banking) transactions.  See the comments for this answer for more specifics.


How to set up Lightning Network conf file. RPC user / password? and zmqpubraw?

So in Bitcoind you can define authentication via an rpc interface (remote procedure call). In the config file of Bitcoind which is usually located in ~/.bitcoin/bitcoin.conf you can set the values for

rpcuser=bitcoind_rpc_user_string
rpcpass=bitcoind_rpc_password_string

Obviously you should select other values than the ones in this answer / question. You could also pass those values as command line arguments to Bitcoind.

As for the other two values. Bitcoind uses zero message queue (zmq) to share raw block data and raw transactionsdata. I guess raw means binary (but I am not sure). These two values are the zmq sockets for both interfaces I guess they are pub / sub sockets to which your lnd node will subscribe.


Why do people apparently "look up Bitcoin addresses on websites"?

@Prince M's answer is great, I have just a couple things to add:
Wallet software will generally only show you transactions relevant to the wallet, so if you ever want to explore transactions beyond your own, you might want to use a block explorer to do so.
If you are running a full node, then you can look up transactions using bitcoin-cli, but a full node does not index the blockchain according to addresses, and so the intuitive way to explore transactions that most block explorer services provide does not really exist when using software like bitcoin-core. Likewise 'address balances' are not explicitly retrievable from a full node, though there do exist some open-source self-hosted blockchain explorers that you can run on top of a node, that will compute and display such things for you. But in any case, simply running a full node does not lay open the blockchain for you in a human-digestible format, getting to that point requires additional work and software.
On another note, some wallets don't have very informative user interfaces. For example, I've seen wallets which do not display the fee-rate your transaction includes, and so if you're waiting for confirmation, just looking at your wallet will not provide any information about where in the mempool your transaction resides. Looking up the transaction using a block explorer may be helpful to the user in this case.
Of course, this can be tragic, as using such an online block explorer service can be detrimental to your privacy. For this reason, I would recommend using a block explorer that offers a .onion domain, so that you can view it over the tor network, to help preserve your privacy.


listreceivedbyaddress returns empty list

The default is to only return addresses that have already received coins, so use bitcoind listreceivedbyaddress 0 true.  The true indicates that you want to include "empty" addresses.

Source: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list


How does the network decide the appropriate rate at which to create bitcoins?

The answer for @jtorba is not strictly correct.

Difficulty is the main control mechanism used to determine the amount of Bitcoins released over time. The amount of bitcoins released is according to the bitcoin era as defined here

Currently the system tries to maintain a release of bitcoins every 10 minutes - which is part of the config settings that all miners adhere to. To do this the code takes into account the average block completion time every 2016 blocks.

It is important to note that this is NOT affected by the number of miners, but instead affected by the computing power.

A block is discovered by a process of hashing - which is a repetitive computing process -  until a result is found that matches a rule. Obviously the FASTER you can repeat this process the better chance you have of finding the answer that fits the rule before anyone else. It is specifically designed not to matter how many computers you have doing this task.

The rule becomes increasingly difficult - hence the use of the word difficulty - and therefore more computing effort is required to cycle through the possibilities becomes harder.

This self adjusting process is the main mechanism that maintains the release of bitcoins to the schedule in the link above.


There's no such thing as a Bitcoin account.
If you mean an account on a Bitcoin exchange, then I'd check your emails and maybe old bank statements from that time to see if you can find which exchange it is, then try and recover your account.
If you mean a Bitcoin wallet, and you have completely lost the wallet file and have no backup of its keys, then it is probably gone for good. You can try looking through your old computer backups if you have any; if you used the Bitcoin Core client you're looking for a file called wallet.dat.


can I create addresses based on what I want to look like?

Not really, a Bitcoin address is the result of applying multiple hash functions to a public key. Since you can't decide how the result of a hash function will look like depending on the input, you won't be able to do so with a Bitcoin address.

You can find the Bitcoin address creation process explained in the Bitcoin wiki.

However, as commented by @m1xolyd1an and @pieter-wuille, VanityGen can be used to create a more personalised address, instead of a purely random one. Since VanityGen is based on a probabilistic search, the pattern that you will be able to include in your address will be quite short. Trying to include long patters requires a lot of time, becoming infeasible.


Doesn't creating a masterkey password on Kraken void the protection of 2FA?

Yes. Your right.

A lot of 2FA/U2F enabled websites/webservices have such "recovery" methods.
2FA/U2F only works in the right way when you can't recover your login credentials if your second factor has been lost/not-available.


What is the "confirmation" field in a block?

Blocks in Bitcoin, as they exist in the blockchain, don't actually contain a confirmation field. When you query for a block in bitcoin-rpc or similar, additional information is added to the block based on your client's knowledge of the current state of the blockchain.

A pure block contains only five fields (some of which have sub-fields):

Magic number (to identify that the following info is a block)
Blocksize (how many bytes to read until the end of the block)
Block header (important for block ordering/verification)

Version (the "rules" that this block adheres to)
Previous Block Hash (a fingerprint of the block this block builds on)
Transaction Merkle Root (a fingerprint of all of the block transactions)
Timestamp (UNIX epoch)
"nBits" or a compact expression of the block's PoW target
Nonce (a number the block miner used to find a valid PoW solution)

Transaction count (number of transactions in block)
Transaction list

Back to your question, the "block confirmation" count of a block is simply how many other blocks build on top of that block. Take for example the following three-block-long blockchain:

The blue block (which starts the blockchain, so it's also called the genesis block) has three confirmations (it confirms itself, plus the two blocks that build on it further reinforce it as legitimate). The green block has two confirmations (it confirms itself, plus the one block that builds on it further reinforces it as legitimate). The orange block only confirms itself, giving it one confirmation.

If another block were added to the blockchain:

All of the blocks from the previous image (blue, green, orange) would receive one additional confirmation, since they've been further "buried" in the blockchain.

As soon as a block exists (so it confirms itself automatically, giving it one confirmation) it can be included into the blockchain. In the event of a network fork, however, this isn't always the case. The number of confirmations of a block indicates how difficult that block would be to overwrite.

In the length-4 blockchain shown immediately above, attempting to overwrite the red block would only require introducing a block which competes with red as a child of orange:

Note that introducing the black block into the blockchain wouldn't necessarily overwrite the red block. If miners choose to mine on top of the black block instead of the red block, making the blockchain [blue-green-orange-black-...] the "longest" (really "heaviest," see bottom of post) chain, then the black block will replace the red block. If miners instead choose to mine on top of the red block, making the blockchain [blue-green-orange-red-...] the longest chain, then the red block won't be replaced. To ensure (assuming network miners don't explicitly favor the red block for some reason, and mine on top of it even when it isn't the latest block in the blockchain) that the red block gets forked, an attacker would need to introduce two blocks which fork off of orange:

To fork the green block off of the network, however, an attacker would need to introduce at least three blocks which build an alternative blockchain off of the blue block:

And for a much higher chance of a successful attack, would need to introduce four blocks which build an alternative blockchain off of the blue block:

Note that this attack would have (possibly-intended) side-effect of also removing the orange and red blocks from the blockchain.

Earlier, I used the term "longer" when referring to competing blockchain forks. While in reality the chain with the longest length measured in blocks is almost always the best blockchain, it isn't necessarily. Rather than count the number of blocks on the blockchain, bitcoin nodes choose the blockchain which is the "heaviest" or has the highest cumulative difficulty. Bitcoin mining involves "brute-forcing" a solution to a problem by repeatedly performing double-SHA256 calculations on a potential block header (described briefly above) searching for a resultant hash with certain properties (which can be incorrectly but essentially summarized as "a lot of leading zeroes"). A higher difficulty means that, on average, miners will have to perform more work for each valid PoW solution. The "best" or "heaviest" chain is the chain which has the highest total difficulty (which is calculated by adding up the difficulty of each block).

To summarize, a block can be accepted to the blockchain as soon as it exists, and it has one confirmation by simply existing. However, blocks of arbitrary depth can be removed from the blockchain by a blockchain fork.


Is PPS or DGM better for pooled mining when difficulty has a high "beta"

Mining, by construction, is a stochastic process. A Poisson Process to be precise. This means that even at a constant difficulty the time between a miner finding a block and the next is randomly distributed. As difficulty rose, this meant that you could go months without finding a block and then have a single afternoon where you found 2 in a row. This variance in the time between finding blocks is intrinsic to how mining works and is independent from any change in the difficulty. It's this variance PPS reduces, it is therefore independent from the difficulty changing.

Mining pools basically gather the computational power of multiple users, and should a single user be lucky, everybody gets their share. The way this share is distributed however is different between the two models you cite. The PPS model has the pool operator take on a certain risk, because he pays you for every share you submit. This means that you as a miner get payouts frequently even if the pools as a whole did not find a block. The other model waits for a block to be found and then distribute the reward among the users that participated.

Basically, if you are mining and are not directly reliant on a regular stream of bitcoins coming in, DGM is the way to go. If you are living on a knifes edge, reliant on a regular flow of bitcoins to keep you going PPS might be for you.

As a personal opinion: if you are serious about mining, go for non-PPS as you don't have to pay for the risk of the operator.


How does bitcoin prevent this network splitting attack?

How are malicious nodes prevented from, after getting the nonce of a
  new block found by someone else, broadcast it to the other nodes
  claiming it to be its?

The nonce is found against a block which contains the coinbase transaction which claims the reward to the address of the person who found that nonce. So you can't claim it to be yours. You're incentivized to broadcast it to as many peers as possible to help it spread more quickly, but that nonce only works for the block which contains that specific coinbase transaction. Changing the coinbase transaction to claim the coins yourself would result in a different hash of the block and therefore you'd need to find a new nonce.

  Also, how does the bitcoin system solve the situation of an evil miner
  who has found the nonce of a block and then sends it with 2 different
  nodes, each one reaching 50% of the network, therefore having a
  problem of ownership of this work?

Not sure I understand this question but if there's a node with more than 50% of the hashing power of the entire network combined, we're in for larger problems.

  Finally, if all nodes have to check a broadcasted nonce to prove it's
  legit, how does the network defend against attacks in which thousands
  of ip adresses (e.g. botnet) start sending wrong nonces, causing a cpu
  DDoS because of all the peers hashing and checking these nonces.

Again, nonces work with the hash of a block. All you have to do to check the validity of the nonce is see whether the resulting hash is smaller than a specific value. If it is, you've found a valid block! So there's no problem in checking or DDoSing the nonces. In fact that's what mining is: a race for finding a valid nonce for the next block.


How to get the first block of bitcoin?

take blk0000.dat
skip first 8 bytes
take 285 bytes

that's all, folks!


How can I detect which network I'm connected to?

getblockchaininfo should tell you which chain you're on. For instance, on the main chain, you should get something like:

{
    "result": {
        "chain": "main",   <======= This is what you want
        "blocks": 519338,
        "headers": 519338,
        "bestblockhash": "0000000000000000001822f09f1821deb6b3b74e36ea1de4e232e5c60fa30ed9",
        "difficulty": 3839316899029.672,
        "mediantime": 1524358671,
        "verificationprogress": 0.9999957624003699,
        "chainwork": "0000000000000000000000000000000000000000018fa8011b05ef506160c4ff",
        "pruned": false,
        "softforks": [
            {
                "id": "bip34",
                "version": 2,
                "reject": {
                    "status": true
                }
            },
            {
                "id": "bip66",
                "version": 3,
                "reject": {
                    "status": true
                }
            },
            {
                "id": "bip65",
                "version": 4,
                "reject": {
                    "status": true
                }
            }
        ],
        "bip9_softforks": {
            "csv": {
                "status": "active",
                "startTime": 1462060800,
                "timeout": 1493596800,
                "since": 419328
            },
            "segwit": {
                "status": "active",
                "startTime": 1479168000,
                "timeout": 1510704000,
                "since": 481824
            }
        }
    },
    "error": null,
    "id": null
}


Why would a Tx's inputs not be assumed to be owned by a single service?

Because it's possible to only partially sign a transaction (for example only one input) and then give that unfinished transaction to another party, who can then finish the transaction with their signature (for another input). Parties do not need to reveal their private keys to each other at all.

Only after all parties signed can the transaction be sent to the bitcoin network. A partially signed transaction would always be refused.


Coloured coins work by making use of OP_RETURN.

I'll discuss the Omni Layer, which is currently the primary coloured coin implementation on Bitcoin.

Omni works by encoding additional data within an OP_RETURN.

Let's say I have a BTC address A, and hold 100 USDT in that address. Now, I want to transfer this USDT to B.

I will make a transaction from A to B with the following format:

Inputs:

Any BTC utxo for my address A

Outputs:

A small dust output to B <- This is used to identify the recipient of the coloured coin
An OP_RETURN that encodes the asset ID and amount <- This will identify that I am moving USDT, and 100 units of it
An optional change output that is larger than the dust limit <- any left over from my utxo.

If we look at this sample tx, the OP_RETURN value is 6f6d6e69000000000000001f00000000000003e8. In this, 6f6d6e69 is Hex for omni, identifying it as an omni layer tx. 1f is the asset ID for USDT, 31 in decimal. Finally, 03e8 is the amount, 0.00001 USDT.

Looking at the same tx on a regular explorer shows us the dust and change outputs as well.

Lastly, it is not important for omni layer transactions to spend a utxo from the same output that deposited the coloured coins to the address (i.e., you do not need to spend the dust when spending the USDT in the above tx). Omni uses a secondary accounting system maintained by the omni nodes, which simply tracks OP_RETURNs for balance calculations.

To prevent double spends, Omni will simply credit or debit accounts in the order transactions appear on the Bitcoin chain. If I attempt to transfer the 100 USDT from the first example to C in addition to B, it will get transferred to B or C depending on which tx appears first in the Bitcoin chain. The second tx, although successfully mined as it does not violate and bitcoin rules, will fail at an omni layer, and no coins will be transferred.


How does the 'queryroutes' function in lightning's LND calculate the route fees?

To answer your question two things have to be known:

Routing fees are always charged from the recipient to the sender as the fee rate of later packages impacts earlier routing decisions.
Nodes get paid a routing fee to forward a package on an outgoing channel.

The first remark is not of importance for your case as the path only includes 1 routing node. The second remark means that only the fee police for channel c2 are relevant. Node A does not charge itself a routing fee on channel c1 to forward to B and node B would only charge a fee on channel c1 if a paymant was to be forwarded to node A

So let us look at the payment amount and the policy of channel c2
the policy says:

 "fee_base_msat": "10000",
 "fee_rate_milli_msat": "100",

where the payment_amount is 4999 that means that you have to send an onion to B that has the following amount of msat

payment_amount * 1000 + fee_base_msat + payment_amount * fee_rate_milli_msat / 1'000

pluging in your numbers this means:

4999000 + 10000 + 4999 * 100 / 1000 = 5009000 + int(499.9) = 5009000 + 499 = 5009499

That is exactly the amount your node sends on its way to complete the onion. Also note that if your node would have been forwarding that payment from anouther node E the other node would have to use that result as the payment_amount with the above formula and your channel police from c1 to forward the payment. That is what I meant in the first remark that the amounts are calculated from the receiver to the sender.


Why are mining pools not removing the 250 kb block size soft cap?

Some pools may still use the 250 KB cap for faster block propagation and reduced chance of orphaned blocks. If one block is orphaned you probably have to mine for 10 years to recover that loss with the extra transaction fees from mining larger blocks.

However I think many pools use a max size above 250 KB. The reason most of the blocks are smaller, even when there are more transactions available, is that they set a max size for how many KB of free or minimum-fee transactions they will include. There aren't enough above-minimum-fee transactions to fill up the blocks.


How is the UTXOs of each partially-spent TxIn determined?

a transaction (Tx) can have multiple inputs (which are previous unspent transactions = UTXOs), let's call them the TxIn

More accurate would be to say "unspent outputs from previous transactions".

a Tx can have multiple outputs (which thus become UTXOs before they will themselves become spent by being used as TxIn), let's call them
the TxOut
the TxOut have a specific order N in the transaction: TxOut[0], TxOut[1], etc.
each TxIn references the number N which corresponds to the index of the TxOut referred to in point 3 above, so this makes the link between
a specific TxIn and a specific TxOut

Correct, we call the compound of transaction id and output index txid:vout the "outpoint" of a UTXO. As you describe, each input spends exactly one specific UTXO.

each TxOut specifies a specific bitcoin amount (which represents the UTXO amount that can be later spent)
each TxOut references one or multiple (in the case of MultiSig) bitcoin addresses (public keys) that can spend the amount

It's a bit easier if you think of each output as being locked to a set of conditions that need to be fulfilled for spending. In single-sig the spending condition is "pay-to-(witness-)public-key-hash". This lock is satisfied by a signature of the private key corresponding to the specified address. (The address in turn is derived from the hash of a public key which forms an asymmetric key pair with said private key.) In multisig the spending condition is "pay-to-(witness-)script-hash". The funds are locked to the fullfilment of a specific script. The address in this case is derived from the hash of the script. Spending such a UTXO requires 1) revealing the script that hashed to the address, 2) fulfilling the conditions specified in the script. In the case where that script is a multisig construction, it would specify a set of public keys some subset of which is sufficient to unlock the funds. However, these scripts can take various other forms as well. I'd nit that "each TxOut references one or multiple bitcoin addresses that can spend the amount" is both an overgeneralization (because not all scripts must be multisig) and an inaccuracy (because the funds are locked to the script, not to multiple addresses).

however, and this is what I don't understand, the TxIn does NOT specify the amount of bitcoins that are used

If the TxIn does not specify the amount that is used, how do we
determine the spent amount for each TxIn, and thus the UTXO of the
part of the TxIn that remains unspent?

There is no way to partially spend a UTXO. Spending UTXO is binary, either they are unspent or they are spent. Since UTXO can only be spent in full, any remainder from a payment gets collected into one or multiple outputs in which the sender pays themselves (see e.g. How does change work in a bitcoin transaction?).

Example, a transaction with 2 inputs and one output (assuming no
fees):

TxIn[0] whose UTXO before spending is 1 BTC
TxIn[1] whose UTXO before spending is 1 BTC
TxOut[0] whose value is 1.5 BTC

How do we know which TxIn, and how much of which, was spent?

was it TxIn[0] for 0.75 and TxIn[1] for 0.75?
was it TxIn[0] for 0.5 and TxIn[1] for 1?

What am I missing? Because given the above, it is not possible to
determine the spent proportion of each input.

The answer is that both TxIn[0] and TxIn[1] get spent completely and the transaction is created with two outputs: TxOut[0]: 1.5 BTC to recipient and TxOut[1]: 0.5 BTC to sender.


Malicious full nodes causing denial of service attacks

There are significantly more than 10k full nodes on the network. The 10k figure is simply the number of reachable nodes which listen publicly for new connections. There are many more times that amount which do not have open ports. Luke-jr publishes information about nodes his own knows about[1], suggesting there are in the order of 100k nodes.

It only takes one honest connection to make any dishonest connections become apparent. The default setting in the bitcoin core software is that a node will make 8 outgoing connections to other peers. By default, the software will also accept up to 125 incoming connections, but miners in particular will increase this figure. (Miners also use separate p2p networks such as fibre).

If a malicious party controls 90% of nodes in the global network, then the probability that any single outgoing connection will reach them, assuming chosen at random, would be 0.9. The probability that all 8 outgoing connections will connect to the malicious nodes then, would be 0.9^8. 10x the nodes wouldn't be sufficient.

There is a paper, Eclipse Attacks on Bitcoin’s Peer-to-Peer Network which addresses the issue and also presents several countermeasures which can limit the chance that an attacker could pull this off, even if they were to manage to spin up the vast numbers of nodes required.


How is IOTA's Tangle different than classical blockchains?

Bitcoin is based on a Blockchain approach, meaning we build a chain of blocks, each referencing the previous block. For the creation of each block, a Proof of Work (PoW) needs to be done by miners. These blocks are a means to reach consensus which transactions have taken place and can be considered safe (e.g. 6 blocks)

IOTA is based on a Distributed Acyclical Graph (DAG) approach, which they call the "Tangle". No more blocks, no more mining, instead when you broadcast a transaction, you first need to do PoW validating two previous transactions. You "attach" your transaction to those two previous transactions (see image)

The consensus about a valid transaction is not reached by number of blocks, but applying the socalled Random Walk Monte Carlo Algorithm. More details can be found here: https://forum.iota.org/t/iota-consensus-masterclass/1193
In short: your transaction is considered valid (green in the image) if you can reach it from every unconfirmed transaction (grey).

Since there is no necessity for blocks, there is no issue with the block size (see scaling debate). The theory - which remains to be practically proven - is that a DAG can hypothetically scale infinitely and that a greated number of transactions actually makes the network faster, since a transaction means confirmations.

For more info, I recommend the following videos:
https://www.youtube.com/watch?v=UwEp5cexTJE&t=251s
https://www.youtube.com/watch?v=MsaPA3U4ung&t=3s


The .gpg file extension is often used to indicate a GnuPG encrypted file. Somebody, or something, at some time, probably made an encrypted copy of your wallet.dat file and named it wallet.dat.gpg.


What is the recommended lowest fee for a segwit transaction when sending coins from a bc1 address?

1000 satoshi for 1000 bytes

sorry, your question has no sence. the fee depends on network utilization.


Why were miners still mining BTC at times when BCH was 2-4x more profitable to mine?

Some miners may be ideologically opposed to BCH and thus will not mine it or help it in any way. Others may be too lazy to switch their hash rate to BCH or do not trust any BCH mining pools so they do not switch. Yet others may simply have been unaware of these profitability spikes and were not available to switch their mining hardware to BCH. Given that the change in profitability was only for a very short period of time, some miners may not have had the time in order to switch their hardware, or the effort was not necessarily worth it.

Additionally, mining on BCH means that they would be mining a much less liquid currency. BCH does not have nearly the same trading volume as Bitcoin and mining BCH means that the miners may be stuck with a coin which they do not want and may even lose value compared to what they would earn with Bitcoin.

It is important to note that even if not all miners switch, some still did which you can see in the hashrate charts. This did happen fairly frequently as the EDA could be gamed so that mining on BCH briefly was more profitable than Bitcoin, and several miners did do this.


I just watched a video which stated 51% attacks can't steal bitcoins from people's wallets. Is this true?

Yes, 51% attack cannot steal coins controlled by other people's keys. When you sign a transaction with your private key, you include the entire transaction data as a message in the signature hashing algorithm. Thus changing any data within the transaction (output value, address of the receiver etc.) will render the signature invalid and hence the transaction as invalid. An attacker can only make cosmetic changes like signature malleability (S component of signature can be replaced with -S) which can also be done by any other miner or an intermediate node in between that is relaying your transaction.

  My understanding is if someone successfully implemented a 51% attack then they would most likely have manipulated one or more of the transactions which had been confirmed in the original true bitcoin chain.

An attacker cannot manipulate transactions as I have stated above. What the attacker can definitely do is exclude the transaction from their version of the chain thus bringing in a censorship attack.

When you read news articles like "attackers stole coins from 51% attack" it does not mean they changed the transaction data. This is how the attack happens: An attacker sends some coins to an exchange. This gets recognized on the Bitcoin blockchain and after that gets reflected in your exchange account. Now on the exchange portal the attacker exchanges BTC for any other coin like say ETH and withdraw the ETH coins from the exchange account to their personal wallet. Now, they launch a 51% attack and create a different version of the Bitcoin blockchain that has excluded that transaction in which they sent the coins to the exchange. After your chain becomes the longest it will be accepted as the main chain. Thus you end up in BTC and the ETH that you got from the exchange. Although I have given the example of Bitcoin, do note that BTC has never experienced a 51% attack.

  This would then mean Sarah no longer has the 1 bitcoin in her wallet effectively stealing that 1 bitcoin from her.

Yes, this is the same example I have mentioned above. However, as confirmations on the transactions increases, the more difficult it is for an attacker to exclude transactions.  If there are tens of confirmations on the transaction, then reorging with just over 50% hash rate will take days if not weeks. Thus most recent transactions are more vulnerable to the attack than previous ones.

I think rest of your questions follow the similar tone. It is a best practice to wait for 6 confirmations, but if the amount sent is really large enough, it will be prudent to wait for tens if not hundreds of confirmations.


How do we know how many BTC have not been spent since being mined? Any tool to see this information?

I don't think your question quite makes sense. Bitcoins aren't "transmitted", they simply sit in the block chain until someone chooses to spend them. There's no way to tell if a particular Bitcoin is lost or not because that depends on whether anyone knows they key needed to claim it. That key could be written on a piece of paper for all we know.

When your client tells you that you have 50 Bitcoins, it is doing that in a purely passive way. Nobody can tell that your wallet contains the keys needed to claim those Bitcoins, and this is by intentional design.

You could fairly easily measure how many coins hadn't been spent since they were mined. But that wouldn't really tell you anything. Some of those coins may have lost keys and some may not. And some coins may have been spent once and then lost.


Set bitcoin fee lower than minimum estimatesmartfee value

Regarding your first question, a new fee_rate argument has been added to the sendtoaddress command in the upcoming release (v0.21.0, currently at the third release candidate) of Bitcoin-Core.
In addition, a new send RPC was integrated which allows you to set a specific feerate too.
Regarding your second question (meaning of CONSERVATIVE and ECONOMICAL), see How does Bitcoin Core estimate the transaction fee? .


Bitcoin core setup how to prune without downloading?

Yes you can run in prune mode, set prune=550 (or a number >=550, which is a size in MB). As blocks are downloaded others will be pruned to free up space as needed so you'll be fine with 17GB.

You can set the prune values in bitcoin.conf or as a startup parameter.

More details here https://coinguides.org/bitcoin-blockchain-pruning/


I have used both Debian and Arch Linux on an rPi to run Butterfly Labs mining equipment; the rPi was able to handle up to 9 SC Singles with CPU to spare using recent versions of both bfgminer and cgminer. So I suspect that it would not have any difficulty driving eight Block Erupters.

Be sure to take some care in choosing your USB hub (it will need to be powered) and you may find MinePeon to be a useful package for getting things set up.


How to withdraw all funds from a Ripple account?

You can't withdraw the deposit, just leave it as it is.

Remove all trust and all offers to lower the minimum deposit.


How much space does armory and the latest version of Bitcoin-Qt take up, together?

In total, it's about 61GB for me right now. In general, it should be about twice the size of the blockchain (which is always growing).

There can be some intermediate files (e.g. bootstrap.dat, 21GB currently; or Armory's similar torrent) involved that increase how much space you need during initial setup.

These can be deleted when you're done using them. (In the case of bootstrap.dat, that's when Bitcoin Core finishes loading data from disk; it's not deleted automatically, you'd delete it manually.)


Yes. This chart from blockchain.info is one. There are probably many more.


Did Satoshi transfer several bitcoin domains before disappearing?

I believe it was just bitcoin.org and bitcointalk.org.

He's the 3rd user on bitcointalk.org. It was transfer to theymos.

Edit: Correction, bitcointalk.org was not a domain transfer according to Pieter Wuille.


Why is bitcoin better than other electronic banking, like Dwolla or Paypal?

You don't need anyone's permission to use it. Nobody can freeze your account or charge back a payment after you received it. It's accessible to anyone with Internet access regardless of what country they're in. No single company can dictate its policy. It is almost free to use with no proportional fees.


Is Mt.Gox currently accepting Dwolla deposits or withdrawals?

As of this writing, Dwolla is not sending money to MtGox

This is verified by accessing their deposit link here


Can I easily use Bitcoin as a inexpensive way to transfer my money into another currency?

I have done this successfully in the past, just like you for USD to EUR.
You'll pay probably pay around 0.5% to move USD into Bitcoin, then another 0.5% to move them to Euro. In any case, you should probably be able to stay below $80 on $1000. ;)

You might need a bank account denominated in Euros though, and it will take a few days. (For me it was something like 20 minutes for the exchange to confirm that the bank transfer to my account was on the way and two days until it was in my account.) Depending on the price movement of Bitcoin you might win or lose additional points.

I did this almost three years ago, so maybe it's not quite as easy anymore with the increased AML and KYC going on.


Obtaining Bitcoin Cash generated at the fork in August 2017

It sounds like ANX will not give out the private key to your wallet, at least not now.

ANX terms 16.5:

  16.5 In the event of a Fork, the value, function, and/or even the name of the Digital Asset you store on the Exchange may be materially
  affected. In any such event, you agree that ANX may temporarily
  suspend the service (with or without advance notice to you) in its
  sole discretion and ANX may decide based on commercially reasonable
  efforts either (a) configure or reconfigure its systems or (b) not to
  support (or cease supporting) the branch derived from the forked
  protocol. In the instance of any private keys held and managed by ANX,
  ANX does not convey ownership or any related rights associated with
  the Users. You acknowledge and agree that ANX assumes absolutely no
  responsibilities whatsoever in respect of an unsupported branch of a
  forked protocol.

Bitcoin Cash fork happened August 1st, 2017, only way for you to claim Bitcoin Cash is if you manage to persuade ANX to give it to you, or give you the private key.

However, you may be eligible for Bitcoin Gold if you had Bitcoin in your Blockchain.info's wallet 2017-10-24,if so then follow this procedure.


Blockchain validation process is linear?

Block validation is linear, transaction validation is not (for unconfirmed transactions).

Block N can only be validated if N-1 has been validated, since each block links back to the previous block, and the updates made to the UTXO set by it.

Transaction validation, for unconfirmed transactions, can be done in any order. However, nodes can only validate transactions if they receive them. Before any given node forwards a transaction to other nodes, it will validate it itself to ensure it is a valid transaction. If it is, it is sent further to its peers, who then repeat the same process before broadcasting it again.

That said, if you perform an out-of-band broadcast to multiple peers, they will all validate the transaction independently of what any other node says.


What's the best practice for creating and maintaining an address index?

I'm not sure that your question matches your title, but anyway:

Regarding polling the blockchain, you should take a look at the '-blocknotify' option available in the 0.8.2 daemon.  This will send you a block hash every time that the latest block changes.  You will need to handle the situation where the valid chain changes for any reason within whatever script you write (check block height and go from there).

Unconfirmed transactions are another matter; there's nothing right now in the official daemon which will help you here so if you do want these you don't have much choice other than to poll or to patch the official daemon to send you details of unconfirmed transactions.  What you do with them is very much dependent on what you are trying to achieve, however.


How to know how many bitcoins does my offline generated address hold?

Whether an address was generated online or offline is irrelevant.

Any transaction that sends bitcoin to the address will be included in a block once it gets mined.

You can check the address balance by searching for that address in a block explorer such as https://blockexplorer.com/


What is the reason to pay miners "monetary rewards" for mining process?

To elaborate on my comment,

I think that any type of 'reward' will have a monetary value, whether that be indirect or not. Proposing to reward miners with something like 'faster transaction confirmation' (the example in your comment) would only add friction to their ability to reap financial reward. A savvy miner could expand their mining infrastructure, to gain a ton of quick confirmation credits. With that done, they could then sell faster confirmations to other users, and presumably profit in doing so.

I think that adding friction in this way is bad, it introduces external factors (the ability of a miner to network and sell their fast confirmation) that will affect the profitability of individual miners differently. Having an explicit monetary reward (ie the bitcoin block reward) keeps friction low: all miners that find a block will are equally capable of claiming its reward.

As I wrote above, If the reward is something to be sought after, then it will have value, even if indirectly.

There is no known way to create a secure cryptocurrency network without cost. POW requires energy expenditure, POS requires users to lock up their funds (opportunity costs), etc. Relying on users to pay these costs without reward makes for broken game theory, and a broken/insecure network.


It is possible to run Lightning (both LND and c-lightning) with bitcoind pruned mode.

There are already packages turning the pruned mode on when disk space is limited: Lightning Power Node Launcher (works with LND) and BTCPayServer docker (works with c-lightnig).

There is a lot of conflicting information online, because it became possible only after Bitcoin Core 0.16.0 was released.

Update from the official lnd documentation:

  We don't require --txindex when running with bitcoind but
  activating the txindex will generally make lnd run faster.

  NOTE: WE DO NOT FULLY SUPPORT PRUNED OPERATING MODES FOR FULL NODES.
  It's possible to run a node in a pruned mode and have it serve lnd,
  however one must take care to ensure that lnd has all blocks on disk
  since the birth of the wallet, and the age of the earliest channels
  (which were created around March 2018).


Trouble with mtgox's withdraw bitcoins api call

The problem I was having had to do with formatting. In the api documentation there is an amount_int param which needs to be passed with the http request. I had forgotten that mtgox requires anything with _int postfixing to be in the form amount * 10 ^ 8

so for example if you were trying to send 0.01 bitcoins for the amount_int field you would put

0.01 * 10 ^ 8 = 1000000


What is the largest number of blocks that have ever occurred in 1 hour?

Most likely, you'll have to download all the block headers. The easiest way is to get them here. Note each block is 80 bytes so it's roughly a 30 MB download.

Next, what you're going to need to parse these block headers and make an array of timestamps. You can then write a program to parse these block headers and find the 3600-second interval that produced the most blocks.

Here's some sample code (Python 2):

data = open('blockchain_headers').read()
timestamps = []
for i in range(len(data//80)):
   timestamps.append(int(data[i*80+68:i*80+72][::-1].encode('hex'), 16))
max_height = len(timestamps)
best = 0
for i in xrange(max_height):
    for j in xrange(i+1, max_height):
        if timestamps[j] - timestamps[i] > 3600:
            if j - i > best:
                best = j - i
                print("%s: %s", (i, best))
            break

According to the program the most number of mined blocks in one hour is 61 blocks which started at block 65710 and ended at 65770 all within an hour on July 12, 2010.


Look at it this way:

Everyone trying to solve a Bitcoin block is actually competing
against everyone else (I win you lose.)
Pools in general are essentially a pack of miners who collectively
agree not to compete with each other, but agree to collectively
compete against everyone else who is not in the pool.  Pools grew in
popularity as the difficulty grew and theoretically it has some advantages.
p2pool, of course, follows this same model, except now that the difficulty of obtaining a p2pool share is so difficult, small hash rates have become obsolete in the p2pool model
The p2pool model is a great idea and is still viable for anyone with at least 1 ths, but the model needs an update:
The share chains needs to be larger, the share rate needs to increase making the difficulty go down.  This will allow even the small miner to chip in.  Every hash counts.


Bitcoin Script: mandatory-script-verify-flag-failed Script failed an OP_EQUALVERIFY operation

The failure is happening because hash160(30450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb) is not 023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a9.

Hash160s are 160 bits long, ending up as 40 hex chars. 023fb... above is 66 chars, so no hash160 would match it. Investigate where it's coming from?

I find btcdeb https://github.com/kallewoof/btcdeb incredibly useful for these sorts of problems: it's a command line tool to allow single-stepping of bitcoin scripts. OP's script is:

30450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa... |
02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27... |
<<< scriptPubKey >>>                                               |
OP_HASH160                                                         |
ef3c5e4ee866b692245de650b178d83ca3d0fdbd                           |
OP_EQUAL                                                           |
<<< P2SH script >>>                                                |
c800                                                               |
OP_CHECKSEQUENCEVERIFY                                             |
OP_DROP                                                            |
OP_DUP                                                             |
OP_HASH160                                                         |
023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a9 |
OP_EQUALVERIFY                                                     |
OP_CHECKSIG                                                        |
#0000

And his question here can be replicated by calling:

btcdeb --txin 02000000107c60fb7c4de7528b0693f189483996f62d04527a693b86ffd940fe21c2efe65a00000000484730440220521eae742c5587ea8d0947879de20f6ff07c30a3e6fc37f3472374d94d1c57b102207cdf2e65e9812adebe37f28279ac23c7f316c5cdd00104aa92396d2768724e0201feffffff15aeb7dae6d514d833e3f25ffc1a992cb2dbc633b30c09f314e726d22ab34c2f000000004847304402206669b4a43e22272d18dcdd99527fcbfbf97bb024ea808bd9ae1ee492da5ab361022045625e98f6f8ddfb3427d4d43f66722d799fbce338f1dd8cbf2ba8c4082756d901feffffffdb2b200941d79838f30139ffc8b1b23bae1cb298a5642a4b3242c74e3614308c0000000048473044022043cb6c47831ad4903c4f657031671fe5b3e8c3e8b4c12de3bc62af6cbda60b32022052c41f1a6e767ebe663b10a4e7350ad12555b4524c0d51ceb50a929466bef89101feffffffc676855c7880b9672531cf3b5bdf170e683ecf43881cb69ded2f469e1725de370000000048473044022057f71e9d946525338e4a504f9cf55065154de09a5f85a8c68d586648246bd99f02202322de86499f035a99d90861bda53d72eb5b8bbeb0349e472290e25db8d5843601feffffff34cdc4315cee2f6c754ac9d6aff58ce87d24d2ea9f1a7427274ecec7f33acc650000000048473044022039444c85f778fd8a95cfdf4afef47ba804425d2ca97907e86393af56406f472a022029de7c2617d2e7d8c1958bd84b775e1b8d4d1e22591529dc13ae050b0b96999001feffffffd6a7bf9cd512e454b7b1b33f2484a16cf5237d8a9e6ecf49294dd7931a5e88d600000000484730440220492bbaa48ca4ea7424412d6421e87f95f0f1b5beefc4c1c818bd2a94b9b5a00402207ef391cdc9f84e88d1ff2cc7d68edb5afacd7ad0be3a478df0911b1bb1973cf401feffffff89e1344e9d47932c19b24a88062ee6166cc9704d26820690c903e3a63924b924000000004847304402207fcd1b6818c875abe2148b1dfe1553c73c2eca561ec3ce1e99c6bbab3b6543830220562dfa7391a5823563fbecf3e41361e6b7a4b3f541b39f667ad0137c726c9de801feffffffe7092dda245a178b4e50dcda70cbc9fedef3fadfef94c6dbe5dc349d105cb94e0000000048473044022002fdc279d955d8d0e60c4705b170b700d934fbf5efa1d7c8b2443ab1587d80b9022000c8d135e6f81c664487ca8431c7e6eb89a3eb618f646b2bce28b5517dbff72a01feffffff8bf3c8734ee9682ffbce41e520a2e8a466c5d46654d98cbcd4ebfcf64a73939700000000484730440220629988e915cb34552abeef352b7a1a0ebd6792d0a0c91d8d906dd6065ee68a4902207646cc98da887dd19b3d26185d5bcae423fcba036c8c1082985ac8a260e7f54001feffffff4a3b666ad423ba3a2b7a14edef7d826cf7587a2774b9f3937e75aade5698d09c000000004847304402205644ed173a99869018434ea4a1a580a1a1815431f294f134dda6cb259613962f02201d6fe1aae7fe07a88c686bf31348b07927b5088bb321af9169ddf1b232b421e601feffffff75dd734653ba95042205708b007b448aaef21cf972e8e25d76485b66a8f6c5a0000000004847304402200b4301e24066c184a4014cddec046fb9990c08caf73130e780ff9b3959e510a402206e947ea7a81cdd2ed67ae88bca5ccad5db2b29cd86cb3f57755cae19121e74d801feffffff7c704726f11711d0b75f399272c697ee49bb10aeaf170372dd50480b2fe194d9000000004847304402202bd26868009c2fc5d94525eabb1197cef6aac5b235d1623c3a762fe61295c1ba022024b9c7ecb2c28a01ba8976bd4ab9779915d37b788dc6dcdec335f89e457a99d101feffffff0a6b94c0ded59df2a0ec996581af027e4116d915e5264fb14a6555f266bec285000000004847304402203997a2d145c8cef3879c5d5dccf7758081b95d3be05443c07053d9d352d4fc2802204f66e8ceadf3147118f430404cbfa8f3b4b99d3a410d69d2a831646c1a5c2f3b01feffffff2f04521db3ecbefd9cd14ef6a594572508cbb2d9c9f544700bde46363f573926000000004847304402200fa171a3d8e4c5105504b498d039d3c386e8325b672c558e97c2751aba8ab0ba022026ba230078fac40413b0d3abc43546d3b9a779eb7af0d08544ac39355475dd4301feffffffdad37c38f84fc6fddee6510ee88705719128b1b5b2dadbc4df7e2e61164e6989000000004847304402202e8751498d9bf91cba9935100dda9cb27f404c91b1531b5dc8904278bb25b0730220537b9a18d368466680fff9c2434788f616b6d99ed46ec04c775cd041d64fc14701feffffff519a0366daed0321fcb1cbb78dd6d5d65febd7e7ea2b100c73396a98a09c2ef50000000048473044022048e89845d80f216f291001fee37e8c7178e40b97af051d57679fc46707a426bf02203ae8c2e132b4c5dbbcd97c59584a0ea9cec6a78294fe7fbfdb86d6ebe13ffc7101feffffff01809698000000000017a914ef3c5e4ee866b692245de650b178d83ca3d0fdbd8782170000 --tx 02000000013db72755b71d95be7f6785448b5387b6273ca26fd5e42204390899154b111a5300000000754830450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb012b02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a988acc800007f0100127a00000000001976a914fd337ad3bf81e086d96a68e1f8d6a0a510f8c24a88ac00000000


Why can't a user import keys to the keypool for a blank wallet?

When you create the wallet that you are importing your keys into, presumably with something like bitcoin-cli -rpcwallet='mywallet' importmulti, it needs to be created in watchonly mode, meaning with private keys disabled. To do that, create the wallet with bitcoin-cli createwallet 'mywallet' true, where true is the argument for disable_private_keys, creating a wallet for watch-only (public) keys.


I solved it somehow, even though I am not sure why this solved it.
I added the following line to the config:

rpcallowip=0.0.0.0


One could extract the Blockchain and import it to your own database for analysis.  For example, see project: bitcoin-to-neo4j.


When did Litecoin become "GPU-friendly"?

Nothing in the litecoin protocol changed, only a tool to mine litecoins using GPU was independently developed: the Reaper and caused difficulty to improve to make CPU mining much less efficient (compared to electricity price). Still, the rise of diffculty is not so dramatic as was the case for bitcoin and scrypt algorithm has proved its worth. CPUs can still mine 1-3 LTC/day at the moment.


What incentive is there for a miner to not include a bad transaction?

Any block that contains an invalid transaction will be considered invalid as a whole, and every other peer/miner will reject it. A miner must check that every transaction included in a block is valid, otherwise there is a high risk that all the hard work required to solve the block is just being wasted.

Any miner who disobeys the validity requirements (by considering some invalid block as valid, or some valid block as invalid) will be completely disregarded by the rest of the network, defeating the point of any mining activity.

Note: Sending 1BTC with a fee of 1BTC is a perfectly valid transaction (even though it might be a mistake by A). Of course, doing that, A must own 2BTC and give them away, or the transaction can't possibly be valid.


What should I say when I "sign" a message, to prove that I own an address?

The problem stated here is that the message signed was only four uppercase letters: "DJFC." Apparently this is the person's Reddit username, but it's also a very tiny amount of data which can often be problematic. Mathematically speaking, the more entropy in your signed message the greater confidence it inspires. Simply signing your username is also not typically enough to reasonably prove that the poster and the signer are the same person.

I would personally take a hint from the sorts of cryptographic handshakes that automated systems use. Typically these involve a server-side nonce and a client-side nonce. Each of you should choose a large chunk of random data from a good entropy source (random.org, etc), publish those nonces publicly and then sign a message which includes both nonces as well as your intended message.

Having another entity provide a nonce for you to sign is known as a "challenge" and ensures the validity of the signature by providing a large amount of input entropy that the signer can have no prior knowledge of. Including your own nonce and publishing it publicly alongside the signed message proves that the person signing the message also controls the posting account. For example:

The challenge:

twentyseventy: DJFC, please sign the following nonce in addition to a nonce of your choosing:
ff 44 45 1a 5d 78 3a 19 a8 45 cf 83 05 cf 86 a1
64 1b 1e cf 8e ad 69 3a f2 5f 6e 12 12 2e af 76

The response:

TheDJFC: I have chosen the following nonce:
96 c4 41 1a 5e 27 22 0c 64 15 6d 3e 02 ea bd e4
99 dc 47 82 ba 30 2c db 49 e2 7a bb 87 c4 5f 32

---- BEGIN SIGNED TEXT ----
ff 44 45 1a 5d 78 3a 19 a8 45 cf 83 05 cf 86 a1
64 1b 1e cf 8e ad 69 3a f2 5f 6e 12 12 2e af 76
96 c4 41 1a 5e 27 22 0c 64 15 6d 3e 02 ea bd e4
99 dc 47 82 ba 30 2c db 49 e2 7a bb 87 c4 5f 32
---- END SIGNED TEXT ----
<insert signature here>

If security is less paramount, one could perhaps forego the complexities of a nonce-based system and simply sign a much more detailed message. For example, instead of:

Message: DJFC

One could sign a message like:

Message: 2014-06-02 11:43AM PST. I, TheDJFC, in response to a request to be found at the
specified URL, sign this message as proof of ownership of the specified Bitcoin address.
Address: 1P6iT6SJe4fZkKdzZBvMGoNj4KLnpSgNSp
URL: http://www.reddit.com/r/Bitcoin/comments/273vi2/if_you_just_received_800_bitcoin_out_of_the_blue/chx4wjc

Why all this drama? Well, I can think of a half-dozen ways off the top of my head to trick someone else into signing an arbitrary message with their Bitcoin address. Without the context of a Reddit user named "TheDJFC" that four letter "DJFC" string just looks like random letters, easily confusable with a nonce. It's also worth noting that the message was only signed with one of the input addresses, while the transaction in question references multiple addresses. In such cases, signatures from all addresses used would be preferable, especially where such large amounts of money are involved.


The site that you reference itself allows you to create Testnet addresses: https://www.bitaddress.org/?testnet=true (Hat tip to Nick ODell)

On the other hand, you could simply use a wallet that supports testnet, see e.g. Running Bitcoin Core in testnet mode.


Does each block contain all the Bitcoin transactions for that time period?

The process of a transaction being created and included in the blockchain is as follows:

The sender creates, signs, and broadcasts the transaction
All Bitcoin full nodes, including miners and regular users, receive the transaction and validate it by making sure it follows the Bitcoin protocol rules
Nodes temporarily store the unconfirmed/yet-to-be-mined transaction in a database called the "mempool" (each node has its own copy of the mempool)
Miners combine many transactions from their mempool into a single block. They will put as many transactions as they can fit into a single block (based on the Bitcoin protocol rules)
Miners begin hashing the block until they come up with an acceptable hash (this is proof-of-work mining)
Once they have successfully "mined" the block by getting an acceptable hash, they broadcast the block to the network
All full nodes receive the block and check to make sure the block and the transactions within it are all valid with regard to the Bitcoin protocol
If the block is valid, nodes add it to their copy of the blockchain. They also remove the transactions within the block from their version of the mempool
Non-mining nodes sit and wait for more transactions/blocks to come in for them to validate. Mining nodes go back to step 4, bundle more transactions into a new block, and repeat the mining process


how to get the whole balance of a privatekey or publickey BTC

next to the answer from MeshCollider, I would like to outline a bit more, what can/cannot be done...

  How can I get the whole balance of the privatekey or publickey?

a priv/pubkey pair can generate several addresses. A privkey is the most standard used for P2PKH addresses (beginning with "1" on bitcoin network). They can be derived from a compressed or an uncompressed pubkey. A good playground is here. Then you can create P2SH addresses, of all kind with this key. They would start with a "3". And yes, multisig addresses would just be one of the possibilities. There are many combinations possible (1-of-1, 1-of-2, 1-of-3, 2-of-3, 2-of-4 ...), each resulting in a different "type 3" address. So if you have created the addresses within bitcoin client, you can use the command "getbalance". This command is linked to accounts, and once the addresses are grouped in accounts, one can display total balance in wallet or particular accounts. Addresses used in accounts can be seen with "getaddressesbyaccount", and then the addresses can be evaluated with "listunspent", gripping for the address you need. There is also the command to see the total amount received per address (getreceivedbyaddress).

In summary: you may want to create some coding logic to use the API calls. The API calls list is available in the source code, or in the wiki.

  How can list all the address from one privatekey or publickey?

as MeshCollider explained, this needs some manual setup, nothing in bitcoin client that fits the request.

  What's more how to process multisig address which generated from not
  the same privatekey of publickey?

When you created the multisig address with bitcoin core client ("addmultisigaddress"), then the client should display the values on this address. When the multisig was created "outsides" of the client, it will not display values for the account, even if you add the address as a "watch only" address (setaccount is now deprecated, and impogrtaddress is obviously the way to go). Anyhow I couldn't make my wallet see a balance on these imported addresses (though I am on regtest, and used txindex=1 in bitcoin.conf).
Even more, if the address is "only" known, and hasn't been used on the blockchain, then the P2SH multisig addresses are covered behind a hash, which is a one-way function. So you never know the details of keys or logic used inside...


How can you distinguish the source of Bitcoins?

Whenever a payment is sent to an address, it is received as a distinct transaction output. It should be a trivial task for the FBI to label the output or outputs accordingly to know which were created in the confiscation of Silk-Road's funds.

On the other hand, there is no such thing as the "actual coins". Whenever bitcoins are transferred, the outputs that feed the transaction are destroyed and new transaction outputs are created.


How to calculate the average worker hashrate on a pool?

This seems correct, as far as I understand.


Building a Bitcoin IPN. Need unique identifier

TXIDs cannot change. TXIDs are simply hashes of the transaction. It is possible for two different transactions to have the same TXID - that's called a hash collision. However, the chances of that happening are so low and I believe you will actually win prize money if you find a collision.


When increase transaction fee three times in few minutes - transaction had an attempted double-spent?

The double spend attempt is your fee increase. It is impossible to modify a transaction after it has been broadcast. So to increase the fee, your wallet intentionally creates a double spend of it that has a higher transaction fee.
However it isn't just a pure double spend; there are additional conditions the original transaction and its double spend must meet before nodes will replace the original. When you increase the transaction fee, the wallet checks that the original transaction met certain rules, then it creates the double spend to meet the replacement rules.
The wallet should recognize that the original transaction has been replaced, but if it does not, you should be able to force it to. Because the replacement confirmed, you should be able to right click on the original transaction entry and choose the "abandon transaction" option to keep it out of balance calculations other things. It will remain in your transaction history, but have no effect on anything.


NBitcoin get signature, use spending P2SH transaction with non-standard script

It seems the first question can be accomplished with something like:

//after creating newtx and specifying input and outputs
newtx.Inputs[0].ScriptSig = privatekey.ScriptPubKey;
newtx.Sign(privatekey, false);  //puts signature and pubkey in ScriptSig
//use those plus additional parameters in script
newtx.Inputs[0].ScriptSig = new Script(
   newtx.Inputs[0].ScriptSig + " " +
   //leave signature and pubkey as first parameters pushed onto stack
   //then add additional parameter (type PubKey)
   Op.GetPushOp(additionalParameter.ToBytes()) + " " +
   //then add script whose hash was in original P2SH trans
   Op.GetPushOp(scriptIn.ToBytes()));

The scriptIn is the same as the usual P2KH script preceded by a check for the hash of another parameter

scriptIn = new Script(
        "OP_HASH160 "
        + Op.GetPushOp(additionalParameter.Hash.ToBytes())
        + " OP_EQUALVERIFY"
        + " OP_DUP"
        + " OP_HASH160 "
        + Op.GetPushOp(pubkeyhash.ToBytes())
        + " OP_EQUALVERIFY"
        + " OP_CHECKSIG"
        );

But when the transaction is sent it gets the following error:
    16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)

Not sure why it's failing.


In Ardor, can you send a message with ZERO ignis balance on a brand new account that has never made a transaction before?

From riker in slack:

The ability to submit a transaction with 0 fee from a new account is currently blocked by several layers of protection inherited from NXT:

The wallet does not allow it.
The API layer requires that the transaction passphrase belongs to an account which is registered on the blockchain.
The node logic requires an existing account to check the account balance.

It is enough to send a message or set an Account Property to a new account in order to allow it to send 0 fee transactions.


Bitcoin full database is not equal on each node

No, they are not identical. There are various reasons for this:

Different nodes may see blocks in a different order. Whenever a fork occurs, by definition some nodes on the network will have seen one block first, and others saw the other first. If they all saw the same blocks first, there wouldn't be any fork. As Bitcoin Core stores blocks in append-only block files, the order on disk reflects the order in which those blocks were seen in the network. Branches in forks that are reorganized out are kept on disk.
Different nodes may not even see all blocks another block sees. If there is a fork between block A and B, and A eventually is built upon further, the nodes that saw A first, and are not connected to any peers that saw B first, will likely never see B at all. This is true in particular for newly synchronized nodes, which typically don't hear about historical forks, and only downloaded the branch that won.
Different versions of Bitcoin Core manage the block files differently. Earlier versions would leave partially written blocks in the files when a crash occurred while writing a new block. Newer versions will reuse that space.

However, despite all this, the active branch of the blockchain (which is the most-work chain that is valid according to the consensus rules) will converge over time across different nodes. This does not happen instantly (as forks may need resolving, which can take minutes or even hours), and does not imply that the files on disk are identical for the reasons above.


Here is a very detailed list of known mining hardware and it's mining-specific specifications:

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


I have successfully used Electrum wallet with cold storage. I found this one of the most novice friendly options, though getting money out from the cold storage is still quite a complex task.

Specifically, here is a tutorial how to create a two wallet: online and offline. Then you can transfer bitcoins from online wallet to offline wallet.

http://docs.electrum.org/en/latest/coldstorage.html

When you transfer bitcoins back to online wallet, you create a raw transaction on online wallet, then go to the offline wallet to sign it, bring the transaction file back to online wallet on USB stick and broadcast it to bitcoin network.


How do I detect a DDOS attack on my node?

The generic way to detect a DoS or DDoS attack against your node would be to connect to your node from an outside network.  For example, if you run a home node, you could use a remote Virtual Private Server (VPS) to connect to your node:

bitcoind -connect=<your_home_nodes_ip_address>

If that works, then you're not being attacked at the moment.  However, note that it could fail for legitimate reasons such as your home node not being configured to accept incoming connections or all of your node's incoming connection slots being legitimately filled.

Other ways of detecting an attack are more specific to the type of attack.  Some suggestions are provided below, but it's not an exhaustive list.

Bandwidth exhaustion

This is an attack against your entire network connection, not just your node.  It's one of the easiest attacks to notice because all of your normal traffic either ceases or slows to a crawl.  If you have bandwidth monitoring on your network (such as often provided by VPS services), you'll see the traffic spike.  If you don't, you can detect it easy by high latency and failure rates through ping:

ping example.com

This is the hardest attack to block, but it's can also be somewhat expensive for the attacker (not necessarily because they pay for the bandwidth---many of these attacks are performed with stolen resources---but because access to comprised networks for use in attacks is in high demand).

Connection slot exhaustion

By default Bitcoin Core and derived full nodes only allow a maximum of 117 incoming connections (another 8 connections are reserved for outgoing, bringing the total to 125).  Attackers have been known to attempt the fill all of these slots in order to prevent legitimate connections.

You can get information about your connections and peers from the Bitcoin daemon using the following commands:

bitcoin-cli getnetworkinfo
bitcoin-cli getpeerinfo

In the Bitcoin Core GUI, you can get much of the same information in a nice display by opening the Help menu and then clicking Debug.  The Information and Peers tab provide information, and you can right-click on a peer in the Peer tab to perform some actions:

Screenshot from my Bitcoin Core GUI wallet.  Not the best image since I connect solely to my border node, but hopefully you get the idea.

Keep in mind that your connection slots can also fill up with legitimate clients and other nodes.  Bitcoin Core has been getting better over the last few releases at dealing with people who attempt to attack this way and there are some nifty long-term ideas for making these attacks expensive for some classes of attackers but still affordable for regular users.

CPU and I/O exhaustion

BIP37 specifies Bloom filters for the Bitcoin peer-to-peer (P2P) protocol.  This may have originally worked fairly well, but as blocks have become larger and transactions have become more complex, full nodes are increasingly taxed by lightweight clients requesting filtered blocks.

Attackers can exploit this: for a very small amount of bandwidth on their part, they can ask full nodes to perform a modest amount of I/O retrieving old blocks from disk and a large amount of CPU filtering those blocks through a Bloom filter.

Detecting this attack is simple: your bitcoind will begin using a large amount of CPU for an extended period of time even though it is fully caught up to the best block chain.

If you find yourself under this type of attack (or wish to prevent it in the first place), you can start bitcoind or bitcoin-qt with the following option:

bitcoind -peerbloomfilters=0

Or add it to your bitcoin.conf file:

peerbloomfilters=0

Note that this means most P2P lightweight (SPV) clients will no longer connect to you if you disable bloom filters using the above option.

There has been discussion of disabling Bloom filtering by default in the past and encouraging SPV clients to use other methods of synchronization, such as downloading full blocks (high bandwidth but very good for privacy) or using committed Bloom filters (better privacy than BIP37 Bloom filters and probably reasonable bandwidth).


Abrupt increase in difficulty of proof-of-work

The network difficulty is equal to the maximum allowed (least difficult) target divided by the current target; if you set your minimum target to x and it's still at x, then that would also be a relative difficulty of 1.

An easy way to confirm this is to look at the calculated difficulty for your genesis block (or block 1 if you got your genesis block from somewhere else).

bitcoin-cli getblockhash 0
bitcoin-cli getblock <hash_from_above>

If it also says difficulty is one, then you know difficulty hasn't changed since you started mining.

As an interesting side note, as of (I think) Bitcoin Core 0.11.0, Bitcoin's regtest supports "instant" block generation even though its official maximum target is much lower (more difficult).  This means that it has difficulties far below 1:

$ bitcoin-cli -regtest getmininginfo
{
  "blocks": 0,
  "currentblocksize": 0,
  "currentblocktx": 0,
  "difficulty": 4.656542373906925e-10,
  "errors": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications",
  "genproclimit": -1,
  "networkhashps": 0,
  "pooledtx": 0,
  "testnet": false,
  "chain": "regtest",
  "generate": false
}


Why do I see a Bitcoin address prefix starting with 4?

I see it as multisig script on OXT

Blockchair shows it as multisig address: m-99d8dc4aa2b7f5b105fe442f651d73e6

blockstream.info shows UNKNOWN


Does my wallet need to be unlocked to mine?

No, it doesn't have to be. Mining doesn't require private keys, only (part of) the public one. Having only the address of the destination is enough, so the wallet can be locked.


Is there a Blockchain per bitcoin wallet?

"The blockchain" is the universal list of all Bitcoin transactions that have ever been confirmed.

A new wallet doesn't "create" a new blockchain.  Rather, it downloads a copy of the existing universal blockchain.  It does create some new files on its own computer to store the data it downloaded, but the data itself isn't new.

(This assumes it is a "full node" wallet.  "Thin" or SPV wallets don't download it; they rely on other nodes to tell them what transactions already exist.)


Transaction verification for bitcoin transaction

A Bitcoin transaction is validated against the consensus rules. This includes that any inputs in the transaction have not already been spent (they are valid utxo's used as the inputs) and several other things.

The contents of transactions can be seen but the transaction outputs cannot be unlocked to be spent without the correct key to sign for the receiving address.

You can have a look on blockchain.info if you are interested and look up transactions, addresses or, blocks.

You can find a very good Bitcoin primer in this video:
https://www.youtube.com/watch?v=Lx9zgZCMqXE


Any need for coinbase field in coinbase transaction?

The coinbase field is crucial for pooled mining. All workers in a pool will be working to produce a block with the same list of transactions and the same block reward recipient address (that belongs to the pool owner/admin). The "nonce" field in the block header is only 32 bits long. The only way each worker can independently avoid wasting cycles on duplicate work is for the each worker to be assigned a different piece of coinbase data.


This is the usual procedure:

Meet in a public place with wifi
Person buying bitcoins gives you the cash.
Person selling bitcoins counts the cash.
Person selling bitcoins transfers bitcoins to person buying bitcoins.
Both people wait for 1 confirmation.

If you use localbitcoins, you can skip step 5.


Is mining an instant process or it generates fraction of coins constantly?

You are correct, bitcoin mining is a very binary thing. Either you find the hash and you get rewarded bitcoins (currently 25 BTC) or somebody else finds it and you get nothing and have to try your luck on the next block. But because solo mining is such a crapshoot, people tend to join their miners together into what is known as a "mining pool". In this way, because a pool of miners has much more processing power than a solo machine, there is a much better chance that it will find a block and get the reward. When this happens, the reward is split amongst everyone who contributed to the pool based on the amount of processing power they contributed. You get much less BTC than if you had found the block yourself, but the rewards are more consistent. Those hashing calculators are never exact because bitcoin mining is, by design, meant to be random. All they can do is make an assumption, probabilistically, of the average amount of BTC you might make based on your hashrate.


Such amounts will not be bought in a single transaction. Instead buying them will be spread out across different exchanges and different periods of time. If this is not done such a transaction would buy up the whole sell order book of an exchange and would run up the price through the roof.

A total of 34k bitcoins is about 3.6% of the volume of the bitcoin market in the last 24 hours. Your Russian friend is a whale by any definition for sure, but 34k bitcoin is not an impossible amount to buy.


You can try to "auto-manually" add your GPUs to bfgminer by pressing M then + and then typing auto, or you can use the -S opencl:auto option when launching bfgminer.

NOTE: Not all graphics cards are compatible; various software is required (e.g., AMD APP sdk); it is not recommended to use GPUs for bitcoin mining with bfgminer.

According to README.GPU, the official documentation for bfgminer on github:

  By default, BFGMiner will NOT mine on any GPUs unless in scrypt mode. If you
  wish to use your GPU to mine SHA256d (generally not a good idea), you can
  explicitly enable it with the -S opencl:auto option.

To start scrypt mining with bfgminer and GPUs, use the --scrypt and -S opencl:auto options, but keep in mind that there are several other parameters to consider. See README.scrypt for additional details about scrypt mining configuration and optimization with GPUs.


Bitcoin.org In Inaccessible at My University

I can't say for sure, but creating a ticket on the github repo for bitcoin.org is probably reasonable:  https://github.com/bitcoin-dot-org/bitcoin.org

This is the code repository for the website, and not support for the server.  However, I'm guessing someone there can point you in the right direction, if not help you outright.

But what do I know?  I'm a UNI alum ;)


Here and in the following articles I explain how to build and sign a Bitcoin transaction from scratch. There are also C code examples attached:
https://davidederosa.com/basic-blockchain-programming/inside-transactions/


Why does Base58 WIF-format of PK have '5' prefix (the standpoint of mathematics)

Mathematically, the thing to understand here is that base58 is similar to any other counting system, base 10 for example. They are both just a way of representing arbitrarily high numbers. The difference is just the characters used.

With counting in base ten, for example, when you get to 9, you start using the next available place holder, and you get 10. In base 58, when you get to z (57), you start using the next available place holder, and you get 21 (weird, I know, it's because 2 in base 58 is like 1 in base 10, and 1 in base 58 is like 0 in base 10).

The point here is that as you count up with the bytes that you are encoding, the base58 value counts up as well. Take this for example:

0x2220 -> 3bd base 58
0x2221 -> 3be base 58
0x2222 -> 3bf base 58
...

Now let's look at the actual data we're encoding with the private key. It consists of 1 version byte (0x80), 32 private key bytes, and 4 checksum bytes, which comes to a total of 37 bytes. Now take the smallest possible 37 byte bit string (which begins with 80):

80000000000000000000000000000000000000000000000000000000000000000000000000

When that is base 58 encoded, you get:

5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAbmahZy

And take the largest possible 37 bit string (which begins with 80):

80ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

Which base 58 encodes to:

5Km2kuu7vtFDPpxywn4u3NLu8iSdrqhxWT8tUKjeEXs2fDqZ9iN

And since all private key encodings will fall in the range between 80000000000000000000000000000000000000000000000000000000000000000000000000 and 80ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, all private key encodings will end up with a 5 at their beginning, just based on how counting in base 58 works!


OK - now I understand. The fee comes from the second txn. I sent 1.000 but when it's spent I need another fee.


Are there any tools to check values in tx validation?

For the hash of the tx to sign, I am not aware, but you can easily remove signatures, place the output script, adopt the length field(s), and hash yourself?

For script execution, there are several debuggers: here and here and here :-)


Earliest bitcoin forex & product purchases

The same way gold or any commodity did, the person buying bitcoins valued the idea or thought it had potential and payed someone money for their bitcoins. Price is what people are willing to pay anyways. Mining is the same concept, miners are paying with their hashing power (it isn't worthless!) to the bitcoin network.

It was as shabby and undocumented as possible I'd assume, see the infamous btc pizza, some guy posted a thread on bitcointalk (you can get records of this transaction and others by going through histories) saying he wanted to pay for pizza with btc. A guy in England agreed and paid with CC for the pizza to be delivered while the other guy sent btc in exchange.


What happens if I force quit a bitcoin wallet application before it finishes synchronizing?

The QT client at least should gracefully resume from where it left off.

I have done this many times with no issue (running a reasonably recent copy of the client in Windows 7).

I'm not sure whether the MultiBit or Armory clients work the same way though; can anyone vouch for them?


Which coins offer a 2 factor authentication feature built into the blockchain without a centralize authority?

Have a look at byteball (http://byteball.org). It supports n-of-m wallets out of the box which can be used to implement a basic 2FA mechanism (2-of-2 with your desktop and your smartphone, for example.)

It also has a chat mechanism built in, which can be used to communicate between the devices and which would probably enable you to do what you intend.

There are a number of other interesting features listed at the web site.


Jeff Garzik received an Avalon miner on january 30th, 2013 and posted pictures at http://garzikrants.blogspot.com/2013/01/once-upon-time-in-china-package-shipped.html and http://garzikrants.blogspot.com/2013/01/avalon-modular-room-to-expand.html

The next day he posted a review at http://garzikrants.blogspot.com/2013/01/avalon-asic-miner-review.html

For many this was a milestone that you might call the beginning of the ASIC era. Of course the manufacturer had the first bitcoin ASIC chip operative long before this. Also, this did not mean that you could just order an ASIC miner and receive it within a reasonable timeframe. But it did mean that the first bitcoin ASIC machine had shipped. For better or worse, it had begun.


What made the old versions of the bitcoin wallet insecure?

The source code for old versions is available in the Bitcoin-Qt Git repository. Click on the "branch: master" button and then select "Tags", and you can go all the way back to v0.1.5.


Generate keys/addresses for all altcoins

Here is my "quite big answer":
I've successfully used http://cryptolife.net/upwg/ which is stated to be "Open Source JavaScript Client-Side Universal Paper Wallet Generator".

It doesn't generate wallet addresses by coinname, but instead by the leading character within the wallet address.  I get these from the block explorer for the coin, looking at top address.

http://www.universalwalletgenerator.net/ lets you do it by coin name.


How can I identify the coin type from its address?

There is a list here, and a more detailed one here. 3 is indeed for a Bitcoin script hash.


Why are change addresses not associated with an account in your wallet?

Bitcoin Core's wallet interprets Bitcoin transactions as payments. A payment is sending money from one entity to another, and is independent from what exact coins were sent and how much change was given back.

When you have a transaction which spends a coin of yours A, and sends it to addresses X and Y, with X being an address of yours, the payment is assumed to have amount A - (value of coin sent to X), and to be going to Y.

X is not associated with an account because the software does not expect payments to it, only a single transaction output which is a low-level detail of how one particular payment occurred.

That said, because of this, and various other confusing parts of the accounts system and their inability to be used in a best practices way, they are deprecated and will be reduced to just address labels in a future version.


development of bitcoin-abe like software

output is spent (e.g. if appear in "vin" to some other transaction), I store an indicator.
Now single block is processed for 1-2 sec.
Implication of this is,
if you want to check address balance, you will need to check each "input" and to compile list of unspent inputs.
Still unsure if this is best way to go.
Update 1
I finally upload the software in github here:
https://github.com/nmmmnu/BlockchainWalker
Update 2
Here are how keys looks like if we want to find the balance for address "1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6":
127.0.0.1:2000> HGETALL a:1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6
 1) "a:1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6:28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0.0"
 2) "0.01270199"

This is funding transaction:

28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0, output 0

This is value:

0.01270199

Then we need to check if this is spent, so we check each input as follows:
127.0.0.1:2000> get t:28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0.0:s
"055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8"

Transaction 055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8, is the transaction where this output is spent.
As each output is spent this means the address 1EoMoJK3FJPHg4EwrP31zPVu4iLqmCtQ6 have balance of zero.

In case we want to check / list a transaction "055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8", we can do:
127.0.0.1:2000> HGETALL t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8
 1) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.-:i:28c76c9d89f23c1b1f5435d8f4bb5cc66e6cb9d0798f1f0f4293faaac88fb7d0.0"
 2) "1"
 3) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.-:i:39edb8741b701b6da2dbc4e02290e8e78cba244bdbad96da203e41ee2704c525.0"
 4) "1"
 5) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.0:o"
 6) "1Kj76Sxe8c3UK85RAQwwdqScAxaBwAY2eb:0.00500000"
 7) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.0:s"
 8) "49f8bd582439a3b2351f92e0fdb5fcb1032acd42e3ab469c16d805627889ce14"
 9) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.1:o"
10) "14yAJga4ZkULbaMz4LUW5vj8GhQYyzCPoW:0.01118727"
11) "t:055bd8148143c5b05bc2808ccafe54be43b292381449d41cc23462d02d3f85d8.1:s"
12) "edf55ace1396229c7a91a4b21cd63293c631ae2ddcc5987402b04ed540b9e5d8"

Those "t:xxxxx.-:i:xxxx" are inputs.
Those "t:xxxxx.N:o" are outputs
Those "t:xxxxx.N:s" are indicators, if output is spent or not.

Please note this is not Redis, it is database I developing that have Redis interface. You can check it here:
https://github.com/nmmmnu/HM4


Installation troubles... Compiling from source code on a mac book pro

I ran the ./configure without the -with-gui=qt5 option and the installation went through fine.

btw, this was on MAC OS X Yosemite (Version 10.10.5).


Callback not working in program using the blockchain api

SOLUTION:

It started to work, after removing .htaccess file from /public_html on my webpage..  so simple solution..

i think it can be done with some reconfiguration too, but i am not using .htaccess, so it was the simpliest solution for me :)


Bought a used ledger nano s from Amazon / Ebay. How do you factory reset the Ledger Nano S?

From the Nano S Configuration Guide:

How to erase or reset your Ledger Nano S?
If you acquired a second-hand Ledger Nano S, or if you want to create
a second wallet, follow this tutorial to learn how to reset your
device first.

Connect your Ledger Nano S
Enter a wrong PIN code and validate by
pressing both buttons
Repeat the 2nd step two more times
Once your Nano S displays the message "Your device has been reset", press both buttons until the "Welcome" message is displayed, or disconnect and reconnect your device.

Then you will be able to restore a wallet or create a new one.

Also keep in mind that your device may have been tampered with and does not contain genuine hardware. You will want to read this guide to ensure that your hardware is genuine.


How does a miner create a transaction input to spend tx fees?

The transaction fees in a block are included in the coinbase transaction, which is a special type of transaction in that it does not have any inputs.

The value of the coinbase transaction’s output can be up to:

Current block reward + (sum of all inputs in the block - sum of all outputs in the block)

Claiming more than this will result in the block being invalid, but claiming less than this is allowed (though probably not in the miner’s best interests!)


Yes. The blockchain is stored completely on a full node (unless running in pruned mode) , there are mechanisms to prune and only keep relevant data, however pruning also requires you first get the complete blockchain. The size is approx 120 GB as of now. The blockchain is growing every day (rather every 10 mins).

Miners most probably have custom solutions to compute next block , so each pool node may or may not require the full chain.


Is there a way to get the node's local time when a block was received?

When your bitcoin node connects to another node it requests the current timestamp from the node.  It stores this value to calculate the offset from your PC's clock.  As you may be aware the bitcoin network calculates the network time based upon the average offset of the peers that it is connected to.  This will never alter the systems clock more than 70 minutes in regards to network time calculations.

References:
Block timestamp


A multi-signature address is an address that is associated with more than one ECDSA private key. The simplest type is an m-of-n address - it is associated with n private keys, and sending bitcoins from this address requires signatures from at least m keys. A multi-signature transaction is one that sends funds from a multi-signature address.

The primary use case is to greatly increase the difficulty of stealing the coins. With a 2-of-2 address, you can keep the two keys on separate machines, and then theft will require compromising both, which is very difficult - especially if the machines are as different as possible (e.g., one pc and one dedicated device, or two hosted machines with a different host and OS).

It can also be used for redundancy to protect against loss - with a 2-of-3 address, not only does theft require obtaining 2 different keys, but you can still use the coins if you forget any single key. This allows for more flexible options than just backups.

It can also be used for more advanced scenarios such as an address shared by multiple people, where a majority vote is required to use the funds.

Multi-signature transactions are often conflated with BIP 16 and 17. In fact they are not directly related. Multi-signature transactions have been supported by the protocol for a long time; but implementing them would require a special output script.

What BIP 16/17 do is offer a standard way to encapsulate a script within an address; this makes it easier to use advanced scripts, with the most prominent example being multi-signature transactions.


Can we look at how long it took to solve for the most recent block in the blockchain? (and how?)

Blocks have timestamps, but they are not very accurate. The protocol rules only (roughly) require them to not be more than 1 hour in the past and not more than 2 hours in the future. At least historically, miners have used this flexibility, effectively turning part of the timestamp as an additional nonce field. I don't know if this is still common practice.
Still, this means you can't rely on block timestamps to determine when they were actually created. It is possible to run a Bitcoin node yourself, and just observe when your node learns about every block - if you have decent connectivity, it will generally be within seconds of the block being found. There are also block explorer websites that generally keep track of this information.


It stands for "Partially Signed Bitcoin Transaction".
Bitcoin Core's documentation describes it as:

PSBT is an interchange format for Bitcoin transactions that are not fully signed yet, together with relevant metadata to help entities work towards signing it. It is intended to simplify workflows where multiple parties need to cooperate to produce a transaction. Examples include hardware wallets, multisig setups, and CoinJoin transactions.


Blockchain API Bitcoin transaction list to a wallet

Transaction has inputs and outputs. "value" is Satoshi count:

  "inputs":[
  {
...
         "prev_out":{
...
            "value":461323,
...
         },
...
      }
   ],
...
   "out":[
      {
...
         "value":295902,
...
      },
      {
...
         "value":124987,
...
      }
   ],
...

To calculate fee you should calculate the difference between all inputs and outputs.


What money transmission licences are relevant to Bitcoin?

Tradehill got shutdown because it went bankrupt when Dwolla started reversing money transfers made to them despite their terms of service stating that no chargebacks could occur (at the time). There is currently a lawsuit pending.

The required licenses will vary depending on the legal context and the interpretation of the business, made by the relevant legal authorities.

There is a lot of legal uncertainty surrounding Bitcoin, but there is one thing that is pretty certain : in all jursidictions you need a license to maintain fiat-denominated balances on behalf of third-parties.


Is there any way to tell if an address has been created on an exchange? (e.g., Coinbase)

No, it's not possible at all. read more How does Bitcoin work


Can a transaction have a single 0-value OP_RETURN as its only output?

Yes. Such transactions are valid and standard.


sent bitcoin with a low fee to an address i cant access anymore

If the fee was so low it may get rejected back to the address that sent the BTC. But you will have to wait a day or two more to see if that happens. Unless it confirms first, in which case, you'll need to get access to the RX address.


Which exchanges still support USD account-to-account (A2A) transfers?

Due to AML regulations, few exchanges offer this service which is typically considered a banking function.

http://en.bitcoin.it/wiki/A2A_Transfer_Methods

This functionality can be emulated at exchanges that have integrated a Ripple gateway.  BITSTAMP is one such exchange.