Overview of solo mining with no GUI's and with GUI's, short explanation. So I recently have gotten into bitcoins and bitcoin mining am enthralled with the idea of the whole system. I even went out to buy a POS Evga 610 GT to start mining the day I found out about it. (currently at a blazing fast 12.7Mh/s)

I am using electrum, guiminer, under slush's pool and have made something like 3cents (.006 BTC ?) in the past week.

So I plan to, here in the near future, build my PC/mining rig and wanted to start my solo mining career. I am happy to be in a pool but I love the idea of the lottery.

So I was wondering if someone could give me a quick run down of the options for solo mining on a windows machine. Preferably with GUI's such as guiminer and without GUI's.

I have found this guide
http://www.newslobster.com/random/how-to-get-started-using-your-gpu-to-mine-for-bitcoins-on-windows

Which tells you how to get it running but not the methodology and logic behind it. Could someone explain the steps I would need to take pro-grammatically to write my own miner?
Such as

Create transaction
Build a block object
Hash till good hash found or someone else says they found a hash
Repeat

But obviously more indepth. Aslo please forgive me for my current lack of knowledge, still learning!

** I have a good knowledge of the BTC system, its logic, and how it works abstractly but have not gotten into how nodes communicate and keep the network running. Which is what I would like to know.

Here is me learning the calculation process abstractly
https://bitcointalk.org/index.php?topic=143329

There are a few approaches you can take as of 3/18/13

You can either be interested in the low-cost learning of the protocol and related technologies
You can invest in equipment related to mining
You can invest in BTC directly, exchanging cash for the few Bitcoins that are available.

Just be sure to expect that up front, any of the latter two choices are a gamble.  The knowledge you gain is something you can keep with you as the technology matures.

I'll touch on a few of your points:

I want to be a miner

"Mining" for coins is not always a profitable situation.  It depends on the hardware you use, and often time who you team up with in a pool.

ABOUT THE HARDWARE:  CPU's and GPUs have been replaced by FPGAs by normal miners.  If you want to achieve more than 0.000x BTC then you need to invest in an FPGA, and soon, an ASIC chip for mining.  Your new video card doesn't have to go to waste, you can partipate in the vanitygen pool, or the litcoin generation pool.  Note that litecoin is a way of diversifying your risk in cryptocurrency and doesn't mean it will achieve the greatness of Bitcoin production coins.

ABOUT THE POOL: Each pool will allow you to even out your earnings over time.  @Meni has written a very nice whitepaper on the subject.  If you're new to Bitcoin, read all his posts.

I want to make my own pool

This is an interesting subject since I also wanted to do the same thing.  It turns out that the math and "hackability" of a pool isn't straightforward and that it's entirely possible you can go bankrupt running one (or whatever you invest).  Make sure you protect yourself from PPS pools of you run one.  I think as of now the safest is "double geometric" for both the operator and the client.  Look up @Meni's whitepaper for more info

I want to just learn the technology

The very uninitiated can run "bitcoind" from their computer with the parameter gen=1 set so it uses CPU to hash.  This is only viable on the "test network" where coins have no value.  To learn this way, simply run Bitcoind with -gen=1 and -testnet set at the command line.

On the other hand if you want to programmatically do the steps you listed, I suggest you read the source code of some of the python or C++ clients available.  It may be a good idea to have your question list the languages that you're familiar with since the code your looking for may have already be written, or even optimized with low level optimizations in mind.

I want to invest

There are a few ways to purchase BTC. Namely MtGox and Coinlab are the top two leading trading sites.  I suggest looking at the purchase requirements there to buy coins at the best price.


Electrum wallet not restoring with the right address? I have the address and i can see my bitcoins in it. I have the 12 word seed, but when restoring my wallet with it in Electrum the address with my bitcoins isnt included in the ones generated.

I'm a noob at this please help :)

I wrote an FAQ about this here. It contains various things you can try.

Another possibility is that the address corresponds to an imported private key. In the past electrum used to allowed you to import private keys into HD wallets. These imported private keys are not restored when you restore from seed. So is this an address of an imported private key?


I have lost my wallet, what can I do? I used to be interested in Bitcoin a few years ago and have recently become aware of it again. I used to have a wallet back then. Given that many years have passed, what I remember is a bit fuzzy. What can I do if…

I don't remember which service I used
my wallet service shut down
I lost access to my wallet service account
I removed the wallet from my computer or phone and have no backup
I had a wallet, and still have the device that it was installed on

If your question is not covered here, please ask a new question, explaining how your situation differs from the topics collected here.

This is intended to form a canonical question to act as a lightning rod for the flood of lost wallet questions we have been receiving lately. Please contribute additional answers to help make it as useful as possible.

I had an account on a website, but don't remember which one
Search your email account for an account creation confirmation email. Helpful search terms may include "bitcoin", "wallet", "exchange", "btc", "blockchain", or "cryptocurrency". If you purchased bitcoins, you may want to look at your old bank statements as well. There is no global register of bitcoin users or services, so if you cannot find anything you may be out of luck—we cannot help you, because we don't know either.
I had a web wallet, but the service shut down since
If the service had custody of your bitcoin balance, it is likely lost. Research the name of the service to determine what happened to the service, in case it just rebranded and is still around.
My wallet service still exists, but I lost access
We don't have insight into your customer relationship with services, so we cannot help you. Contact the service and initiate an account recovery process.
I had a self-custodial wallet, have lost the wallet, and have no backup
Bitcoin balances are tracked via the blockchain, and a user's bitcoin wallet primary purpose is to secure the private keys which are used to establish ownership and to track any transactions related to those keys. The key space is enormous. If you have lost your wallet, the same keys will likely never be regenerated and no one will ever be able to spend the associated funds.
I had a self-custodial wallet, and still have the device that it was installed on
Looking over this selection of wallets may help you remember which one you used. If you still have the wallet files, you may be able to recover your funds. The name of the relevant files depends on the software that you used, but one of the most common file names is wallet.dat. If you find a wallet file, create a backup first before trying to recover the wallet.
I have a 12 or 24 word backup, what do I do?
This is called a mnemonic seed phrase. It is a standardized way to backup a wallet's private keys. Keep the words confidential, do not enter the words in a website or untrustworthy software. You should be able to recover your wallet from the phrase. You can find instructions how to recover the wallet from it on this site.


Automating service with income from VISA and expenses in Bitcoins Open-org.com is building an online service, which will have income coming from VISA cards, and will pay expenses in Bitcoins. We expect to make something like 100 transactions per day from credit cards to Bitcoins. I would like to know what the cheapest service would be for doing this fully automatically. What I mean is the cheapest service or combination of services with APIs so we can automate the whole process. I am particularly concerned with complexity (and delays) if we would need to transfer the money from the provider, which enables us to accept VISA payments, to my bank account. Then send the money to MtGox, get it exchanged and then get the Bitcoins sent off. The steps involved just in the last part, Bank Account to Bitcoins, would be quite work intensive if done on a daily basis. It would involve the following steps: 1) Access internet bank and transfer to exchange (5 minutes). 2) Access exchange and transfer and create several buy orders over some period of time to get a good price (5 minutes to 30 minutes). 3) Transfer Bitcoins to 100+ recipients (5 minutes to 30 minutes depending on interface). 4) Make accounting of transfers.

Btw. this is not a "buy bitcoins" service, so I do not believe I will get in the kind of trouble that "buy bitcoins" services got into with regards to fraud. Anyways, that is a different question.

I should mention, that I am not interested in services that take something like 5% for doing these things.

The service should accept international VISA cards.

Visa and Mastercard have been pressuring any merchant transaction processors to not support Bitcoin.

However, there is already at least one service that allows you to deposit Bitcoins and withdraw USD through a Visa debit card: OKPAY recently announced their support of Bitcoin, although I don't know how long they will last.


If block sizes go up, won't sigop limits have to change too? Gavin Andresen, one of the core developers, has discussed increasing the block size to 16.7 MB (and doubling that every two years).

The maximum number of signature operations per block is currently set to 20000:

  [...] About the scriptSig being an arbitrary byte array, there is one caveat: the checksig operations in it are counted towards the block sigop limit (20000), so you probably don't want to accidentally trigger this. Making it a list of just push operations (including of the extranonce) avoids that.

A back-of-the-envelope calculation tells me that there will be around 100K signature operations in a 16.7 MB block. Will the maximum number of signature operations per block also need to change?

Yes, the maximum number of signature operations per block also need to change. It may change dynamically with the block size limit. The code currently assumes a ratio of MAX_BLOCK_SIZE to MAX_BLOCK_SIGOPS:

From https://github.com/bitcoin/bitcoin/blob/v0.10.0rc3/src/main.h#L59-L60:

/** The maximum allowed number of signature check operations in a block (network rule) */
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;

If this ratio were kept constant, then when the max block size was increased, the max signature operations would increase to:

16.7 MB / 50 = 335,544 sig ops


Bitcoin regtest mode block versions I'm running a bitcoind instance in regtest mode, for automated testing purposes.

I'm having trouble with the fact that the blocks I mine are version 1 blocks, which lack the block height in the coinbase transaction (my code relied on that).

How do block versions work in regtest mode? Can I configure them? Do I need to mine a specific number of blocks?

BIP 34 (the BIP that specifies block version 2 and block heights in coinbases) is not activated on regtest and is never activated.

  How do block versions work in regtest mode?

Block versions are actually version 0x20000000, not version 1. This version allows for other soft forks like BIPs 65 and 66 be activated. Some other forks (BIP16, CSV, and Segwit) are activated by default, and BIP 34 is disabled.

  Can I configure them?

Yes, use the -blockversion command line option when starting bitcoind

  Do I need to mine a specific number of blocks?

For BIP 34, no, you can't activate it without changing the software.


how to transfer genesis block reward for blackcoin? So my genesis block has a reward setup but I want to send it to my wallet. can you please tell me how? I am using black coin

The reward of genesis block is unspendable.

see https://en.bitcoin.it/wiki/Genesis_block


This was just a problem of the terminal I used on a mac.

Adding | python -m json.tool to the command does the trick, as described here.

Output now is:

bitcoin@raspberrypi ~ $ curl https://blockchain.info/unspent?active=1Cdid9KFAaatwczBwBttQcwXYCpvK8h7FK | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3571    0  3571    0     0  10043      0 --:--:-- --:--:-- --:--:-- 10087
{
    "unspent_outputs": [
        {
            "confirmations": 314772,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "f2c245c38672a5d8fba5a5caa44dcef277a52e916a0603272f91286f2b052706",
            "tx_hash_big_endian": "0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2",
            "tx_index": 47854970,
            "tx_output_n": 1,
            "value": 8450000,
            "value_hex": "0080efd0"
        },
        {
            "confirmations": 259155,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "0365fdc169b964ea5ad3219e12747e9478418fdc8abed2f5fe6d0205c96def29",
            "tx_hash_big_endian": "29ef6dc905026dfef5d2be8adc8f4178947e74129e21d35aea64b969c1fd6503",
            "tx_index": 71083209,
            "tx_output_n": 0,
            "value": 100000,
            "value_hex": "0186a0"
        },
        {
            "confirmations": 251314,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "d9717f774daab8d3dd470853204394c82e3c01097479575d6d2ee97d7b3bdfa1",
            "tx_hash_big_endian": "a1df3b7b7de92e6d5d57797409013c2ec8944320530847ddd3b8aa4d777f71d9",
            "tx_index": 75974855,
            "tx_output_n": 0,
            "value": 1000000,
            "value_hex": "0f4240"
        },
        {
            "confirmations": 245427,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "3f1df69df90d097981ca9c97ad8b6a32daed345565a433f8c8e472b2dab2ac79",
            "tx_hash_big_endian": "79acb2dab272e4c8f833a4655534edda326a8bad979cca8179090df99df61d3f",
            "tx_index": 79887883,
            "tx_output_n": 1,
            "value": 719787,
            "value_hex": "0afbab"
        },
        {
            "confirmations": 165236,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "417bdb6f5db3e830407f94d1a82d1667e738b19da3679b7263ebfb913394efdd",
            "tx_hash_big_endian": "ddef943391fbeb63729b67a39db138e767162da8d1947f4030e8b35d6fdb7b41",
            "tx_index": 170905487,
            "tx_output_n": 0,
            "value": 10000,
            "value_hex": "2710"
        },
        {
            "confirmations": 162698,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "d049d6039f9d1cb2625bac294d7465b4b1077bd5bc0e30e01e02b184db524c1f",
            "tx_hash_big_endian": "1f4c52db84b1021ee0300ebcd57b07b1b465744d29ac5b62b21c9d9f03d649d0",
            "tx_index": 174630347,
            "tx_output_n": 0,
            "value": 11100,
            "value_hex": "2b5c"
        },
        {
            "confirmations": 161792,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "b8a6470c7a38d0983effed00a3f75c74ba371da1387352f35d1df155851ea8d1",
            "tx_hash_big_endian": "d1a81e8555f11d5df3527338a11d37ba745cf7a300edff3e98d0387a0c47a6b8",
            "tx_index": 175949432,
            "tx_output_n": 0,
            "value": 10000,
            "value_hex": "2710"
        },
        {
            "confirmations": 161783,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "a2b9570e26e3991fc999c42dc8c6eea7b06514b61814da1a71b56c6ba2ae651c",
            "tx_hash_big_endian": "1c65aea26b6cb5711ada1418b61465b0a7eec6c82dc499c91f99e3260e57b9a2",
            "tx_index": 175955161,
            "tx_output_n": 0,
            "value": 10000,
            "value_hex": "2710"
        },
        {
            "confirmations": 161783,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "05230cb8cd8c6a3788ed41433dfdd68a1a608cc8feb3bc1c29d97ce84bec070e",
            "tx_hash_big_endian": "0e07ec4be87cd9291cbcb3fec88c601a8ad6fd3d4341ed88376a8ccdb80c2305",
            "tx_index": 175955664,
            "tx_output_n": 0,
            "value": 10000,
            "value_hex": "2710"
        },
        {
            "confirmations": 76598,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "bd345c2bdbb8c17a0c66a8579ea701830e8248ba21b2d73a5dca21d8e9175fee",
            "tx_hash_big_endian": "ee5f17e9d821ca5d3ad7b221ba48820e8301a79e57a8660c7ac1b8db2b5c34bd",
            "tx_index": 338789479,
            "tx_output_n": 1,
            "value": 3020,
            "value_hex": "0bcc"
        },
        {
            "confirmations": 44566,
            "script": "76a9147f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a888ac",
            "tx_hash": "892275c430610334994cc5836436515057284cc4572775487c1b06a1b49c5ab4",
            "tx_hash_big_endian": "b45a9cb4a1061b7c48752757c44c28575051366483c54c9934036130c4752289",
            "tx_index": 384311717,
            "tx_output_n": 1,
            "value": 6236,
            "value_hex": "185c"
        }
    ]
}


Sending Bitcoin to a wallet but user has not received Good Afternoon,

I sent bitcoins to a user's wallet 2 days ago. Below is the transaction id:
9031b7d71ac55d2982b4451d3a0ec9ec1f80575a07afb5fe0d1a29eed5aa7841

And the wallet address:
1DDfbQNfm7UGWM4jp4CxJF631axDCafSD4

However, I was told that the bitcoin had not showed up in his wallet although the transaction has been confirmed.

May I know what may be the issue?

At time of writing, that transaction has 287 confirmations. That means it has been definitely incontrovertably irrevocably received. There can be no doubt about this. For large amounts, 6 confirmations are regarded as conclusive, for small amounts many people accept 1 confirmation. 287 is far far far beyond doubt.

The blockchain is the only truth. All data about location of Bitcoin money is in the blockchain and nowhere else†.

There is no moment in time when Bitcoin is in transit, it is always either considered by any node in the Bitcoin network to be in your wallet or in the recipient's wallet and nowhere else.

The recipient has received the money. If they say they have not, either ...

you sent the money to the wrong address, or
their wallet is not telling them the truth
(perhaps it isn't synchronised with the blockchain) or
they are mistaken or
they are lying to you.

† Use of Lightning network and other off-chain systems should almost certainly not be regarded as actual Bitcoin movements until recorded on the blockchain.


How do off-chain transactions get back on-chain? I've searched in vain, but not been able to find a detailed explanation of how off-chain transactions work.

If I have some BTC on the public blockchain and I want to transfer some of it to someone's wallet off-chain (e.g. we're both using Coinbase) what actually happens? Do I first need to transfer some BTC to a public bitcoin address owned by the wallet provider? This would be akin to Ripple's gateway model I think. If I didn't do this I could double spend (1 tx off-chain and another on-chain), right?
How do I get back on-chain? Is it simply that (assuming I'm correct above) the wallet provider knows my balance off-chain and will make a transfer to my address on-chain?

Coins don't really move "off-chain", in the described case you would send money to an address at Coinbase that is associated with your friend's account. As Coinbase manages their customers' accounts for them, he would see on his account page that his balance increased, but he wouldn't be in control of the private key associated with the address.

Now to "move coins off-chain", means that only the accounted values were updated, while no coins actually moved on the blockchain. Just as if a bank is wiring money from one of their own customers to another own customer, they wouldn't take the money from the vault then put it back, no they would just update the two accounts involved.

In the case of Coinbase it would work like this:

1) Coinbase internal accounting:
rageofreason: 1BTC
friend: 0.5BTC

2) rageofreason sends friend 0.4BTC

3) Coinbase internal accounting:
rageofreason: 0.6BTC
friend: 0.9BTC

They just update the accounts, no actual bitcoins were moved. Now, when friend closes his Coinbase account he will want them to send the 0.9BTC to an address directly under his control. That moment, bitcoins will move on the chain, as they actually need to be moved to that address instead of just updating balances in the internal accounting of Coinbase.


Are there any works of science fiction out there that relate to blockchain technology? It feels like science fiction is lagging behind Bitcoin and the blockchain technology that is powering it.  Are there any writers who have discussed similar technology in their stories? Even in the past 5 years?

See also the same question at the ethereum forum

Found one: Stephenson's Cryptonomicon.

See also Digital Currency: ten years before Bitcoin, Neal Stephenson's Cryptonomicon


What wallets can be used to double spend (low tx fee workaround)? I've got myself in a bit of a pickle. I withdrew some Bitcoin from a service last month, however they sent it with a really low fee (40 sat/byte), so it is still pending and is unconfirmed. I understand Child Pays for Parent, but the inputs of this transaction, around five levels deep, are also unconfirmed. I asked them to resend the transactions with a higher fee, but that might take a while.

Today I sent a transaction from Blockchain info. I used a reasonable fee for today (250 sat/byte), so normally it would be confirmed within a few hours. However the transaction used the unconfirmed transaction as an input, so that transaction would need to be confirmed first, which probably isn't going to happen.

As I understand if I send a new transaction, with a higher fee, I can reuse the (confirmed) inputs and that transaction will be accepted, then the transaction with the unconfirmed input will be abandoned. I've tried using Electrum to resent the transaction with a higher fee  (and making sure it doesn't use the unconfirmed inputs), however it just says an error saying my balance is too low, as it treats the unconfirmed transaction as spent.

Are there any wallets (preferably that don't require downloading the whole blockchain) that would allow me to create a transaction to work around this?

As I understand if I send a new transaction, with a higher fee, I can reuse the (confirmed) inputs and that transaction will be accepted, then the transaction with the unconfirmed input will be abandoned.

No. It seems to me you are trying to do Replace-by-Fee, which you need same input that is unconfirmed transaction.

I assume that there are two transactions that you want to get confirmations. Can you post these transaction id so that I might be able to help you.


How to add Bitcoins to my wallet I am new at this and I was given a bitcoin from a miner, how do I know what it is worth and how do I put it in my wallet?

I was given a bitcoin from a miner,

Are you sure you havent been tricked by a conman?

See

Bitcoin Mining as a Newbie (link wallet to another person's miner)
Reg: Watch only Address
How can I get a private key for this address
Unlocking a Private Key from watch status
Recovering the private key from a blockchain wallet address

  how do I put it in my wallet?

One fairly good way is

download a wallet such as "bitcoin core" from bitcoin.org. Some other wallets are also available. Never accept wallet software that is given or sent to you by someone over the Internet.
keep the private-key written on paper somewhere very very safe and never give the private key to anyone who asks for it.
ask the miner to send bitcoins to the address of your wallet.
wait for at least 6 confirmations of the transfer.

  how do I know what it is worth

If there is any mention of "testnet", it is worth nothing.

If you do not have the private keys, it is worth nothing to you.

If someone else also has the private keys, they can take the bitcoin and leave you nothing.

If its in a wallet that a miner created for you, its contents are probably worth nothing to you.

Note that "Bitcoin Cash" (BCH) is not Bitcoin (BTC) and may be worth less. The same applies to "Bitcoin Gold", "Bitcoin Diamond" and a huge number of other alternative cryptocurrencys (altcoins). Don't confuse them.

Otherwise you can find the exchange rate from BTC (bitcoin) to USD (or any other currency) using a search engine. For example google BTC USD exchange rate

  I am new at this

Be very very careful. Lots of conmen prey on people who are new to this.


How do I get the scriptPubKey type from the raw output script? I use zeroMQ to get the transactions from Bitcoin Core.
The output looks like this:

{ value: 200000,
  script: <Buffer 00 20 e3 30 7e 8e 0b 63 0e 53 c2 f1 f8 17 06 7b ce 01 c4 38 92 83 3e 02 2d ad f5 e9 5f 31 be 89 b1 22>
}

The same output looks like this in Bitcoin Core:

{
      "value": 0.00200000,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 e3307e8e0b630e53c2f1f817067bce01c43892833e022dadf5e95f31be89b122",
        "hex": "0020e3307e8e0b630e53c2f1f817067bce01c43892833e022dadf5e95f31be89b122",
        "reqSigs": 1,
        "type": "witness_v0_scripthash",
        "addresses": [
          "tb1quvc8arstvv898sh3lqtsv77wq8zr3y5r8cpzmt04a90nr05fky3qemqr3j"
        ]
      }
    }

Question: How do I get the scriptPubKey type from the script buffer ?

Internally, Bitcoin does not have the concept of scriptPubKey type. To the system, scriptPubKey is simply a mathematical equation into which some bitcoins have been locked (UTXO) and the spender must satisfy the unlocking conditions, which most of the times are the signature(s) and public key(s), in order to spend those bitcoins. These basic construct can be used to build higher level concepts like the scriptPubKey type that you are referring in your question.

Since Bitcoin is a programmable money, a user can lock their bitcoins in a number of different ways. The Bitcoin community has accepted certain output types as standard locking scripts. Below are some of the standard output scripts (scriptPubKey) that can be used to determine the script address type (main net address types have been used):

Pay to Public Key Hash (P2PKH): In this type of script, the bitcoins are locked in the hash of a public key. The output script will look like the following:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "OP_DUP OP_HASH160 243f1394f44554f4ce3fd68649c19adc483ce924 OP_EQUALVERIFY OP_CHECKSIG"
    "hex": "76a914243f1394f44554f4ce3fd68649c19adc483ce92488ac",
    "reqSigs": 1,
    "type": "pubkeyhash",
    "addresses": [
      "14JetYAhLevTRaePcAAX1vRMwaJt2QGRzp"
    ]
  }
}

Pay to Script Hash (P2SH): In this type of script, the bitcoins are locked in the hash of script. The script can be a multi-sig output, time-locked output, P2SH-P2WPKH (SegWit address in P2SH format) and others. The output script looks like the following:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "OP_HASH160 243f1394f44554f4ce3fd68649c19adc483ce924 OP_EQUAL"
    "hex": "a914243f1394f44554f4ce3fd68649c19adc483ce92487",
    "reqSigs": 1,
    "type": "scripthash",
    "addresses": [
      "34zfp5f8tZEqWkLpjFq7SYnJ66bbdaTmt"
    ]
  }
}

Pay to Witness Public Key Hash (P2WPKH): In this script, the bitcoins are locked in the hash of the public key, but follows SegWit. The leading 00 indicate that it is SegWit version 0. The output script looks like the following:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "0 eb308eb99tb8ff3797d2e5cfb33a9231700d6195"
    "hex": "0014eb308eb99tb8ff3797d2e5cfb33a9231700d6195",
    "reqSigs": 1,
    "type": "witness_v0_keyhash",
    "addresses": [
      "bc1qavcgawvmerln097juh8mxw5jx9cq6cv46xmzxk"
    ]
  }
}

Pay to Witness Script Hash (P2WSH): In this script, the bitcoins are locked in the hash of a script, but follows SegWit. Similar to P2SH, the redeemScript can be a multi-sig output, time-locked output, etc. The leading 00 byte indicate that it is SegWit version 0. Below is how the locking script looks like (your example in the question):

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "0 e3307e8e0b630e53c2f1f817067bce01c43892833e022dadf5e95f31be89b122"
    "hex": "0020e3307e8e0b630e53c2f1f817067bce01c43892833e022dadf5e95f31be89b122",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bc1quvc8arstvv898sh3lqtsv77wq8zr3y5r8cpzmt04a90nr05fky3qwnkvta"
    ]
  }
}

Pay to Public Key (P2PK): This type of output script pays the public key directly. Note: Although currently Bitcoin Core shows an address starting with 1 for P2PK, it is an error that will be rectified in the next release of Bitcoin-Core. Below is how the output script looks like:

{
  "value": 0.00200000,
  "n": 0,
  "scriptPubKey": {
    "asm": "02d2a6892c51741f83759088d9eed12c2c52eea9b999ecc36af1cb569b733b6ff1 OP_CHECKSIG"
    "hex": "2002d2a6892c51741f83759088d9eed12c2c52eea9b999ecc36af1cb569b733b6ff1ac",
    "reqSigs": 1,
    "type": "pubkey",
    "addresses": [
      "1FK1FmLuTY19JGdb9SsKHs68HxRD69jtc1"
    ]
  }
}

As I said earlier, bitcoins can be locked in any allowed operator operations. However, if the output script does not belong to the above five types, the output script will be non-standard and you will see the type as "nonstandard" in the scriptPubKey field.


How and where to establish a wallet When a create a wallet, lets say with blockchain, do I have to check my wallet always with blockchain, or can I also check my wallet with different providern of wallets, where I did not established my wallet. Some provider of wallets link directly to blockchain, and some not. Therefore I could a bit confused.

No, you can import your private key in another wallet software. Under the import/export option in Blockchain you can export the private key, and you'll be able to import elsewhere. It also works the other way around. If you create an address somewhere else, you can also import it on the blockchain website.

So no, you do not always have to check your wallet with blockchain.


Bitcoin Wiki mirror? Are there mirrors of the Bitcoin Wiki?

(https://en.bitcoin.it/ is down.)

There is now :)

http://welshcomputing.com/bitcoin/wiki/en/Main_Page

About/limitations: http://welshcomputing.com/bitcoin/


Awarding yourself more than 25 bitcoins If the reward is actually a made up transaction with no inputs,  what's blocking miners from awarding themselves more than 25 bitcoins?

Every client on the Bitcoin network validates incoming blocks, to check that they conform to all the requirements of the Bitcoin protocol.  One of the checks is that the block reward (coinbase transaction) is for an appropriate amount.  Blocks that fail this are rejected by the client, and conforming miners will not link their own blocks to  them, so such a block will not be incorporated into the block chain.

If you tried to make such a block, and then spend the coins you awarded yourself, those transactions would also be rejected as invalid.  Other participants on the Bitcoin network would not consider those transactions as valid payment, and would not give you goods or services in exchange for them.

It would be roughly as if you were to walk into a coffee shop and try to pay for coffee using a one-dollar bill, on which you had crossed out "One Dollar" with a crayon, and written "Five".  They wouldn't accept it, and they wouldn't give you any coffee for it.


Difficulty of brute-forcing a seed with missing words? Given a 12 or 24 word seed with one one or more missing words what would be the difficulty of brute-forcing the missing words? E.g. for:

one missing word
two missing words
three missing words

By difficulty I mean the number of permutations against a dictionary wordlist.

And the related question: how many words would have to be missing in order to make the attack reliably unfeasible?

Missing 3 words in known positions and there will be 8.577.355.766 permutations.
Based on the speed of an average PC, approximately 10 permutations/second. This would take close to 9927 years(if unlucky and have to try every permutations) Sorry, I forgot we are not dealing with wallet password encryption here.

Anyway, a computer will have to get the private key, calculate a public key and then check it for balance, this process will take time.
Missing 4 words(17.540.692.561.920 permutations) or more, and I don't think anyone will want to try their luck. So maybe 5 words or more and even the government will let it slide.


What are the Pros/Cons of investing in the Bitcoin ETF vs. bitcoins yourself? Hypothetically, the Winklevoss ETF is approved tomorrow, 3/10/17. The ETF price, which starts at $100/share, will correlate directly with the price of Bitcoin, I assume. What would be some pros/cons of investing in the ETF instead of buying bitcoins myself and storing them in my own wallet? The ETF would be easier to buy/sell than using an exchange plus I wouldn't have to worry about the security of my coins.

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

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

in other words,

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

Get the ETF.

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

Hold bitcoin.


When I make a transaction, how is it broadcasted to other clients? It's a really nooby question, and with no doubt asked before, but if someone could tell me

a)how are other clients found

b)how is the information send to them

(please explain in a simple way, because I haven't messed with the bitcoin protocol itself)

They're found using a gossip protocol.
Transactions are sent using this structure: https://en.bitcoin.it/wiki/Transactions


Can you Send Coins back from a Receive Address? We are setting up some merchant functions

If a customer sends too many coins in a transfer for an order

Can you send the change back to address you received the coins from .

i.e
1) Order 1234 12.5 BTC Merchant Recieve Address (1234abc)

2) Customer Sends 12.6 BTC to Merchant Address (1234abc) from his Address (4567def)

3) Merchant detects overpayment And sends the 0.1 btc back to customers (4567def) Address as change

Will this work in that the customer will get his change ??

This is not recommended.

If the customer uses a fully controlled wallet he will get the coins, but will be confused about their source because the address would carry the label of some other provider.

If the customer is using a shared eWallet, he might not get the coins at all because the address isn't his.


How to start working with blk*.dat data? I have the complete bitcoins block data (blk00000.dat, blk00001.dat.....). I want to convert it into some readable format like csv or json. Can it be done using python or any other software ?

You can use Bitcoin-ABE

https://github.com/bitcoin-abe/bitcoin-abe

There are various options, I used the sqlite export to get a local SQL database with blocks, tx, outputs etc.


Bitcoins disappeared? I have the Bitcoin Core client installed on my desktop, and I have encrypted it and backed up the wallet. I rarely, if ever, go into it. I just thought I would bring it up today and it now shows a 0 balance (instead of what was in there).

The last transaction was a series of small debits, that I didn't initiate, that appears to have wiped my account out. What happened? What can i do? Anything?

I have a transaction ID, but no mention in the program of where they went.

Assuming the transaction was really made and confirmed (try looking up the transaction id on a site like http://blockchain.info), and the destination address isn't one of yours, then it appears your coins have been stolen.  Unfortunately, there isn't anything you can do about it, from a technical point of view; one of the features of Bitcoin is that transactions cannot be reversed for any reason.  Of course, you can report the theft to the police, but it is probably not likely they will be able to catch the thief or recover your coins.

In order to steal the coins, the thief would have needed access to the private keys stored in your wallet.dat file.  From the information you gave, I can only speculate as to how this might have been done.  Some possibilities:

You have a virus or some other malicious software on your computer.  This software could have sent your encrypted wallet.dat to the thief, and also captured your keystrokes at some time  when you typed the passphrase to decrypt it.  Then the thief would be able to decrypt it as well.
The thief obtained your encrypted wallet.dat (via malicious software on your computer, or getting access to your backup, etc), and your passphrase was not very complex, so they were able to guess it with a brute-force attack (trying a very large number of possible passphrases until they found yours).
The thief is someone with physical access to your computer, and may have seen you type your passphrase.  They could then steal your coins simply by sitting at your computer, entering your passphrase, and sending your coins to their own address.


download testnet block chain? I suspect the router in my network prevents the block chain from being sucked into my machine, using the classic way, i.e. bitcoin-qt or bitcoind.

Is there a way of dowloading the testnet block chain?

I suspect the router in my network prevents the block chain from being sucked into my machine, using the classic way, i.e. bitcoin-qt or bitcoind.

You should check if you can open the 18333 and 18332 port on your router.

  Is there a way of dowloading the testnet block chain?

I havent find a direct link to download it but you could do it yourself:

Find a separate computer which share the same operating system and is able to download the blockchain.
download the whole blockchain repository which size is ~2GB
Copy the repository of the blockchain which location depend on your operating system mine is in /home/user/.bitcoin/testnet3 then put it on a usb drive for example.
Then go back to your first computer and put it on the same repository as your first computer.


Lost my old-Electrum 12-word mnemonic seed order I created my wallet some years ago, and wrote my seed phrase on paper, but unfortunately in a wrong order. Now I suddenly found my note and after some check I find it is in the old-Electrum wordlists. But still I couldn’t find the right order of it. So what can I do?

If you are certain that the 12 words are the correct words but merely in the wrong order, and you know the addresses from the wallet, it is possible to brute force: there are 479,001,600 possible combinations, which isn't too many.
Here is an example of a tool that can help you with this: https://github.com/3rdIteration/btcrecover/blob/master/docs/BIP39_descrambling_seedlists.md
https://github.com/3rdIteration/btcrecover/blob/master/docs/Seedrecover_Quick_Start_Guide.md


Is a bitcoin wallet address the same as your public key? The service CoSign shows that to create a multisig wallet you need to provide a Senders Address and Senders Public Key.

I thought that they were the same thing.

What am I missing here?

A public key in Bitcoin is a pair of 256-bit numbers used as part of the ECDSA scheme. A Bitcoin address is a Base58-encoding of the 160-bit hash of the public key (the hash function in question being RIPEMD160 of SHA256).

From the public key you can easily and deterministically compute the address, but from the address alone you cannot deduce the public key.


How to import entire Armory wallet into Electrum? I've managed to import a private key, but how to import an entire wallet?

In Armory:

Select "Wallet Properties".
Select "Backup This Wallet".
Select "See Other Backup Options".
Select "Export Key List".
Select "Omit spaces in key data".
The important string is the PrivBase58 for every bitcoin address. It is the private key of this address encoded in base58 (encoded not encrypted), which is the (only?) format Electrum accepts when importing.

In Electrum:

Select File → New Wallet
Enter the private keys you took from armory into the textbox


Testing `avoidpartialspends` option in Bitcoin Core I have lot of UTXOs in a test wallet (Bitcoin Core v0.21.1). Sent random amounts to same address in 9 transactions. So tb1qyqd9p9d2rc5a9v6cphucn999ljfcvdhymthypy has 9 UTXOs:

Saved avoidpartialspends=1 in bitcoin.conf
Tried sending 0.051 BTC to tb1q57fjyqp3qu9s83eyu4qvy7hzuncg4t0c58t8cm
Why does coin selection algorithm select 63 other inputs from wallet instead of using 9 from tb1qyqd9p9d2rc5a9v6cphucn999ljfcvdhymthypy in 13eda62acf58fdcb5a34565f993d7af856b54f69c9c73c83db97bf8111c46148? This selection was neither based on privacy nor fees. Using 9 inputs could have saved fees, join several outputs from the reused address and send change amount to a new address.

In this particular case, it is because Bitcoin Core prefers to make transactions which do not create change over anything else. Notice how this transaction does not have any change. If the Branch and Bound exact matching algorithm finds a solution, it is always used, regardless of other "optimality" as it considers "no change" to be an optimal solution.
Obviously this may not be actually be optimal, but there are planned changes to the way coin selection works to have different metrics for "optimal".


OpenSSL bitcoin addresses generation Using OpenSSL ver 1.1.0h on win 8.1 - 32 bit

Im trying to recreate this post using cmd: OpenSSL generate Bitcoin address

But on step 3:

openssl ec -in c:\keys\private.pem -outform DER|tail -c +8|head -c 32|xxd -p -c 32 > c:\keys\private.key

I got this error: ec: Unknown cipher c

Any idea what im doing going wrong?

I did the same exercise on my OSX system, and this is my result:

$ openssl version
OpenSSL 1.0.2j  26 Sep 2016

$ openssl ec -in privkey.pem -outform DER|tail -c +8|head -c 32|xxd -p -c 32
read EC key
writing EC key
18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725

I assume that the PEM key is not in correct format, PEM follows some specific rules. There are several discussions also here in bitcoin.SE

My privkey.pem looks like this:

$ cat privkey.pem
-----BEGIN EC PRIVATE KEY-----
MFQCAQEEIBjhSntqMH9CapT4EUcB58jndOf5pH4sIDXbKaIGMhcloAcGBSuBBAAK
oSQDIgACUIY61kqHroov6Dwa8ahAPLU/U+SG2FEdrYoEiH5bI1I=
-----END EC PRIVATE KEY-----

This is a "test" key, note the word "Risc" in the generated bitcoin address from this key. Don't use it for any value, the funds will get lost.
If you have a test key, and really it is a test key, you can share it, and we can have a look at it (and you will then never ever use it again).


BIP32 funds not appearing in wallet So I'm developing a system that generates addresses for users to send bitcoins too in order for them to deposit on the system.

I generate addresses using the following:

var derivedPubKey = config.BIP32_DERIVED;
if (!derivedPubKey)
    throw new Error('Must set env var BIP32_DERIVED_KEY');

var hdNode = bitcoinjs.HDNode.fromBase58(derivedPubKey);

exports.deriveAddress = function(index) {
    return hdNode.derive(index).keyPair.getAddress().toString();
};

An example address this generated was: 17fPG6yJujgzysrAozHM5FTEytBvWzF2gS

However, I checked my main wallet address 1CGM9zBt885ccKg6j1aqbBESsdPju4aj2m and I don't see the transaction that I sent to the address above?

How can I access these funds?

An address is not a wallet, and a HD wallet is only locally relevant to your storage and is not reflected at all in the public ledger.

Bitcoin works on a UTXO model where funds are paid to an output which can be spent by the owner of the private key for a given address. There is no direct links between any addresses and no hierarchical structure in the public ledger.

So if you pay to address 17fPG6yJujgzysrAozHM5FTEytBvWzF2gS, then the public ledger will only see the payment to that address, and nobody else will have any idea that address 1CGM9zBt885ccKg6j1aqbBESsdPju4aj2m is even part of the same wallet.

A wallet is simply a collection of key pairs, where each key pair has an address for its public part. BIP32 describes a method of deterministically generating addresses from a root seed, so that you may regenerate the addresses rather than have to store them individually.

To access the funds spent to 17fPG6yJujgzysrAozHM5FTEytBvWzF2gS, you need to regenerate the key pair for this address by using the same index you used to derive it in the first place.

Locally, a wallet software will be able to aggregate the funds from all of the addresses it generates, so it appears as though there is an aggregated total balance for the wallet, but in the public ledger, these UTXOs are scattered and uncorrelated. Only you will know your actual balance, and nobody can learn it from public information, although some of your addresses may become linked if you have to spend several of them in the same transaction.


Why is Bitcoin fair? According to the Wikipedia article on Bitcoin:

  The initial bitcoin distribution is advantageous towards early-adopters. [...] However, the amount of work that must be done for one bitcoin is currently over 500,000 times more than the amount of work at which the first bitcoins were being distributed. As more people join, and also because of a reward function that halves the number of rewarded bitcoins every so many blocks, it becomes harder to generate bitcoins over time, using the same computing power.

So how is this fair? Why should someone get money just for hearing about Bitcoin before I did?

It's a complete irrelevancy. It is still early, and Bitcoins are worth on the order of $3 each. If you want to be an early adopter, buy Bitcoins now.

If Bitcoins never become really valuable, what difference does it make whether it's fair or not? The sums involved will be modest.

If Bitcoins ever do become really valuable, what difference does it make whether it's fair or not? You can buy Bitcoins now for a pittance and get the same benefits as the early adopters.

This is just petty jealousy. It's no different from the folks who missed out on Google stock or Apple stock when it was cheap. It's not just about hearing about Bitcoins first, it's about investing first, and taking the risk of loss. That's how everything works. Maybe it's not fair, but that's how it is.


Have there been cases of traditional money theft from Bitcoin exchanges? There have been a number of cases of thefts or losses of Bitcoins from a few Bitocoin exchanges, but has there ever been a case of traditional currency being stolen or lost by an exchange?

This much less likely for a number of reasons:

Banks have advanced, robust and well-tested anti-fraud infrastructure, making such thefts much more likely to be detected.
Legally it is much much easier to prosecute for fraud cases in fiat than BTC (I do not know any prosecution over stolen Bitcoins)
Fiat transactions are reversible meaning the exchange could easily get its money back
Bitcoins are much easier to launder, so thieves are less likely to get caught


How does the network verify previous transactions when transferring BTC between two users? When transferring BTC between two users, the new transaction will consist of references to previous transactions.

For example, if I user A wishes to transfer 1 BTC to user B, he will need 'n' transactions totaling 1 BTC in order for the transaction to be valid.
If these 'n' transactions occur with large periods of time between them (say 1 year) and for some reason I felt the absolute necessity to verify that these 'n' transactions actually took place.

How would I find the relevant block?

Would I decrypt the block to read it? Is this ever done in actual practice and is it expensive and time consuming to do it?

I felt the absolute necessity to verify that these 'n' transactions actually took place. How would I find the relevant block?

A transaction consumes inputs, and creates outputs (new 'unspent transaction outputs' or UTXOs). For the transaction to be valid, each input must be a valid UTXO that exists on the network. Full nodes keep a continually updated index of all valid UTXOs, that they can check against incoming transactions.

A transaction input will reference the transaction which created it, via the transaction ID and the output index. So a full node will just look up that entry in the UTXO index, ensuring it exists and is being used validly.

  Would I decrypt the block to read it?

Blocks are not encrypted, but you will have to parse through the relevant blocks to obtain the relevant transaction data.

  Is this ever done in actual practice and is it expensive and time consuming to do it?

Yes, this is done by each and every node, for each and every transaction / block. Checking a single transaction is not a computationally expensive procedure, but there is consideration for the sum of verifications a full node must compute in order to synchronize with the network. In order to maintain a robust and decentralized network (which is integral to the network's properties), it is important that the total resource requirements to run a node remain relatively low, to ensure that a sufficient number of nodes are able to stay online.


Blockchain.info unconfirmed transaction I'm a newbie and was wondering what to do when there is an unconfirmed transaction on Blockchain.info. Can I reverse the transaction? Will my BTC reach the other side? Or are they lost?

If your transaction doesn't confirm, and the sender (blockchain.info/wallet, in this instance) doesn't re-broadcast the transaction then the transaction should disappear from your wallet, as if it had never been made.

This may take a day or so.

If the transaction is being re-broadcast by the sender then it can stay there as long as the re-broadcasts are occurring.


Why so many transaction send bitcoins to the sender? While browsing the blockchain I noticed that there are a lot of transactions that send bitcoins to the sender (most part of the transaction) and a tiny fraction to another address.

E.g. this transaction sends more than 99% to the sender and the rest to another address.

What is the purpose of those kind of transactions?

An output of a previous transaction can only be spent wholly. So if you have 3BTC and want to send 0.5 to someone, you make a transaction that sends the 0.5 and then 2.5 back to your own address. This is called "change", just like you get change when paying in the supermarket, except in this case you give the change to yourself so you don't need to worry about the other person running of with it.

Note that this change address is supposed to be a brand new address (owned by yourself) and NOT the same address. Address re-use is bad for privacy: as you've just discovered you can in those transactions easily determine which part of the transaction was change and which was actually sent to some other person.


Why must be the Merkle Tree a full binary? Bitcoin uses a Merkle tree with hash functions. I mean I do not get it why there must be a full binary tree? A complete could also be possible?

Bitcoin does work with full or complete binary trees. For complete trees, leaves without a partner are simply hashed with themselves instead. The attack that CodesInChaos links was solved by checking that every transaction is unique which is required for valid blocks anyway.

Image from Bitcoin Developer Guide


Can I use Blockchain records to verify a purchase I am new in the Bitcoin field, but I wondered, if I paid bitcoins to a store to buy something from the internet, then if the store did not send what I purchased, is there a way I could use the blockchain to verify the transaction, say to sue the store?

The transaction itself would be publicly visible, but you'd have to first prove that the address you sent the coins to is owned by the company, and that you were the one sending them, and also what the payment was for. If you had some proof that the transaction was for the item you bought, then yes, it would be easily verifiable that the transaction was legit. But bitcoin addresses are just random looking numbers and letters, so the company could claim that they didn't own the address you sent the payment to (and so they never received the money) or that the payment was for something else you purchased off them, not the item in question.


Bitcoin calculator based on my machine I tried to find an online tool that would allow me to calculate how many BTC (or portions of it) I might be able to mine with my computer, but I couldn't find an answer that is exhaustive.

Is there any such tool?

Even though the comments were pretty clear about, "don't even try this", you seem insistent.

Mining Power is measured in Gh/s, or Giga-Hashes per second, which means how many Billion hashes can a computer try every second.

The mainstream ASIC processor, AntMiner S9, can do about 13 Th/s (13 Terra-hashes, or 13,000 Gh/s).

A good graphics card GPU can do about 1 Gh/s.

So you would need on the order of 13,000 graphics cards to come close to a single ASIC processor.

Since the S9 has a breakeven point around 1 year, it would take your PCs about 13,000 years to make enough money to buy a single S9, and the PCs would be far more expensive upfront, and use far more electricity along the way.

Bluntly put, if you really really focused with PC mining, you'd be extremely lucky to make about $3 a year.

References:

Is Gpu mining still an option?

https://bitmain-alliance.com/product/antminer-s9/?gclid=Cj0KCQiAuZXQBRDKARIsAMwpUeTtoNrXLyaRXqeHuVyaoEj4jeGUrx4zyJGeVYQpTUcvHllr41MKvb8aAj1iEALw_wcB

https://www.cryptocompare.com/mining/calculator/btc?HashingPower=4730&HashingUnit=GH%2Fs&PowerConsumption=1293&CostPerkWh=0.12

https://99bitcoins.com/2016-bitcoin-mining-hardware-comparison/


if a coinbase reward isn't fully spent, can the coins ever be recovered? If a pool mines a block and is mistakenly rewarding miners with less coins than they should be given, is it possible for others to recover those coins somehow? Or are they lost forever?

For example, if the reward should be 50 BTC and the pool pays everyone a total of 5 (because the script has a bug and everyone's payout is divided by 10), is it possible for the other 45 BTC to be recovered?

No, the remainder of the reward is lost.

The bitcoin protocol includes a check which rejects a block that claims a bigger reward than 'current block reward + transaction fees'. Thus, inevitably follows that any rewards unclaimed in the coinbase transaction cannot be claimed at a later time.


curl returns empty output when json-rpc I am not able to get JSON-RPC response via curl. It seems like is not accepting requests.

My bitcoin.conf

rpcuser=USER
rpcpassword=PASS
server=1
rpcport=9332

Running daemon

$ bitcoind -conf=~/.bitcoin/bitcoin.conf -daemon
Bitcoin server starting

Checking cli

$ bitcoin-cli -conf=~/.bitcoin/bitcoin.conf getinfo
{
  "version": 140200,
  "protocolversion": 70015,
  "walletversion": 130000,
  "balance": 0.00000000,
  "blocks": 439348,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 254620187304.0614,
  "testnet": false,
  "keypoololdest": 1500029964,
  "keypoolsize": 100,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}

Testing curl

$ curl http://localhost:3333
curl: (7) Failed to connect to localhost port 3333: Connection refused

Of course, the port is wrong:

$ curl http://localhost:9332
JSONRPC server handles only POST requests

Making a post

$ curl http://localhost:8332 -H 'content-type:text/plain;' --data-binary ''

The output is always empty, doesn't matter if I add data or user,password. Is always empty:

$ curl http://localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://USER:PASS@localhost:9332 -H 'content-type:text/plain;' --data-binary ''
$ curl http://USER:PASS@localhost:9332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'
$ curl --user USER:PASS http://localhost:9332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'

Any ideas why is this happening? Don't know what else to try.

If you're on Amazon AWS try this:

setsebool -P httpd_can_network_connect 1

I had the same problem and it took me hours to figure out that the server was blocking connections. I thought it wasn't the problem because my AWS security group allowed it. But apparently the server was blocking it directly.


What caused CVE-2012-2459? How was it fixed? Gavin Andresen made an announcement about this denial of service issue in 2012 here, but it's light on technical details.

The full disclosure post is here: https://bitcointalk.org/?topic=102395

You can find it from the Bitcoin CVE list: https://en.bitcoin.it/wiki/CVEs


0/confirmation race attack double spend transactions I am developing a point of sale bitcoin app, which should accept "fast" transactions (~30 sec for merchant to accept). I researched double spending questions here already, but it is still unclear to me, what happens within the time frame before a transaction is actually included into a block.

Considering the case of a double spend attempt, where an attacker needs to pay to a merchant. The attacker creates and propagates a respective transaction A into the the bitcoin network. Transaction A is added to the main memory of mining nodes and is "waiting" for inclusion into one of the next blocks. The merchant is informed of the propagation of transaction A by the nodes he is connected to. Before transaction A is actually included in a block, the attacker creates and propagates another transaction B, which has the same inputs as A (double spend).

What happens if a miner (which has transaction A in his main memory) gets the conflicting transaction B?
Can a merchant be sure, that transaction A will be confirmed, if it is propagated successfully to let's say all or most miners?
Would a miner throw away transaction A and include B, if B has higher transaction fees, a smaller size in bytes, or of other attribute?

The bottom line is that there is no way for you to safely accept zero confirmation transactions.

  What happens if a miner (which has transaction A in his main memory) gets the conflicting transaction B?

Depends on what software the miner is running and how they have configured it.

Some nodes will reject it.
Some nodes will accept it.
Some nodes will accept it conditionally.

There's no knowing what people are running on mining nodes or what rules they have.

  Would a miner throw away transaction A and include B, if B has higher transaction fees, a smaller size in bytes, or of other attribute?

Ditto.

  Can a merchant be sure, that transaction A will be confirmed, if it is propagated successfully to let's say all or most miners?

Absolutely not.

An alternative can be mined at any time, invalidating the original. This attack has been used in the real world to defraud websites of their Bitcoin payments to the tune of millions of dollars. Successful double spends can even happen once the transaction has been included in a block, which is why a large number of confirmations is suggested for people accepting Bitcoin as payment for services.


Mathematical areas of research within the Bitcoin field? I'm doing my IB math SL internal assessment on bitcoins. We have to incorporate a lot of math into a 6-12 page essay on our topic. What parts of Bitcoin involve or can be modeled by mathematics, such as calculus/probability/statistics?

I'm hoping to find at least a few equations I can discuss in my writings. I'm fairly good with math, but I'm not a complete expert, so if you would take that in to consideration with your answers that would be great! :) Thanks!

You could approach bitcoin and maths under many and different aspects.
You could talk about cryptography (hash function, elliptic curve digital signature,...) or about the economy.
You could talk about probability (mining, solo vs pool,...).


Reversing network hashpower I'm reading this article by Vitalik Buterin on Problems in Cryptocurrency and don't quite understand what this means:

  Ideally, after some number of blocks (perhaps logarithmic in the total size of the network) every transaction should require 51% of network hashpower to reverse. However, solutions where transactions can pay very small fees for a lower "level" of security are acceptable, though one should take care to avoid situations where an attacker can profit by performing one attack to reverse very many small transactions at the same time

I understand that Sybil attack can happen if more than 51% of the network is under one person's control, but I don't understand what it means to reverse network hashpower, and why 51% of it should be reversed.

In theory, this attacker owns enough computing power that they could execute a "double spend" attack. They could spend coins in one place, allow the coins to enter the block chain as normal until the required confirmations are met, then fire up their 51% of the miners to craft a fraudulent fork of the block chain in which those coins were never spent, allowing them to re-spend the coins. This could theoretically be repeated for as long as the attacker maintained control of 51% or more of the hashrate.

Realistically, 51% is only the point at which this becomes possible not the point at which it becomes likely or easy. An attacker would probably need something like 65% to actually execute such an attack.

What can an attacker with 51% of hash power do?


Solving a Block with more than one miner connected to same daemon Well excuse me in advance if my question sounds funny. But I'm just curious perhaps someone can shed a light.

When in a pool of miners, let's say there are 100 miners connected to a single daemon node, do they solve every block together, concurrently computing, work is divided among miners? Or each miner solves the block individually, parallel?

To further elaborate, for example I got 100 machines, should I connect them all to a single daemon node to mine or it's better to let them mine with their own daemon node each?

Miners connect to a mining pool, which in turn connect to one or more bitcoin nodes. The miners get separate work from the pool and work in parallel.

Working in serial is not possible. There is no progress in mining. Your hash (lottery ticket) is either a winning ticket or not. Then you go on to the next hash. Mining is brute force. You go through billions of lottery tickets per second.

So two miners cannot find the winning ticket "together". They could both do the same work and find the same block, but that would be an awful waste. It is very important that the mining pool does not give out the same work twice. Two miners should never be checking the same lottery tickets (hashes).

Connecting miners directly to a bitcoin node is not possible. It used to work in the olden days when the ancient getwork protocol was used. bitcoind didn't have long polling in those days, though, so it really only worked in theory. These days miners speak stratum and bitcoin nodes speak getblocktemplate. The two protocols are not compatible, so there must be something in between, usually a mining pool.


Is there any benefit to increasing the maximum orphan tx in bitcoind? I'm still learning how all of this stuff works. I'm running a v0.15.1 full node. While I was watching the debug output, I noticed that orphan tx were being discarded because the maximum had been reached. To see what would happen, I restarted bitcoind with maxorphantx=1024.

Is there any benefit to the bitcoin community by preserving a larger number of orphan tx or am I just wasting memory?

Note: I forgot to mention that my copy of the blockchain is up to date. The orphans I'm seeing aren't because I'm missing blocks.

Is there any benefit to the bitcoin community by preserving a larger
  number of orphan tx

What kind of benefit/profit/etc can gain the community by the increased mempool for orphan transactions on one node? Literally, none.

  or am I just wasting memory?

This is your donation to the network.


How do I interact with Bitcoin Core from NodeJS? I am new to the Bitcoin world. I have installed Bitcoin Core on a Windows machine and am running the full node. I want to develop a nodejs app that would be running on the same machine interacting with the Bitcoin node for 'balance/transfer funds/create wallet/etc'. I will really appreciate any pointers or sample code to achieve that.

I highly recommend looking at Bcoin. It is a full node implementation used by Purse.io but also includes a rich API for interacting with the Node and wallets. All of it running in NodeJS. Documentation is sparse but getting better.

http://bcoin.io/

Otherwise, bitcoinjs https://github.com/bitcoinjs/bitcoinjs-lib is a Javascript library that lets you parse, create, and sign transactions. But it doesn't handle the hard part of querying the network, caching information about transactions and wallets, or picking inputs and calculating fees when you want to spend.


What are the limitations to an outdated backup? My backup private keys were made in Jan and my computer crashed in May. If I upload the keys on a new wallet, will it show my bitcoin balance from May or January?

Bitcoin-Qt has a feature called "keypool." It pre-generates 100 keys and includes them in all of your backups. This way, if you make a backup, it will also include the keys you're going to use in the future.

In general, sending a payment consumes an address, and receiving a payment consumes an address.

If you make 1 transaction a month, 100 keys will last 8 years.

However, if you change your wallet password, you must make a new backup.


Who controls the features added to the bitcoin network? I read an article on cryptocoinsnews about sidechains and they said bitcoin can implement new features but any bugs would be dangerous to the whole bitcoin network. What I don't understand is who would be adding new features? Are there some people that continue to update bitcoin and can add code to the network bitcoin runs on?

To change Bitcoin, you must change the behavior of Bitcoin Core (or some other full Bitcoin client) and then convince people to use your modified version. Different levels of network adoption are required for different types of changes:

If the change only disallows certain transactions or blocks that were previously allowed, then the change can be applied by the majority of mining power. Only miners need to use the updated version of Bitcoin. This is called a soft fork. For example, P2SH was a soft fork change. Miners updated over the course of several months. This went very smoothly and most people didn't even notice it happening.

Adding sidechains would be a soft fork change, as would most other feature enhancements. (It might not be obvious how disallowing certain transactions could be used to add new features, but it's usually possible if you're careful about it.)

If the change allows things that were previously disallowed, then each user individually decides whether to use the change or not. This is called a hard fork. Even if every other Bitcoin user and miner decided to increase the total BTC supply from 21 million to 50 million, you could continue using the old version of Bitcoin and you would be unaffected by this change. However, you would be unable to transact with people who use the modified version. As a result, this sort of change is likely to be widely accepted only if an "economic supermajority" accepts it. This means that the decisions of larger economic actors (exchanges, merchants, etc.) are more important than the decisions of regular Bitcoin users because more people will care about whether or not they can trade with them. In a hardfork, miners are not especially important.

There have been a few hardforks in the past, but most of them were in response to critical bugs that needed to be fixed immediately (such as the BDB lock limit bug). There's never been a hardfork that was controversial.

(Note that if a softfork is enforced by miners but not most users, then undoing it is not a hardfork change.)

Lightweight nodes like MultiBit or Electrum can't enforce the rules of Bitcoin properly, so they're at the mercy of some full nodes elsewhere. Exactly how this works depends on the client. This is why you really should use a full node if you can: it protects you and strengthens the economic power of the good network. Bitcoin Core is by far the most commonly-used full node client, so the Bitcoin Core developers will have a lot of influence over any proposal to do a hard/soft fork change. However, they still can't unilaterally change the network. Their changes need to be accepted by miners and/or users for the network to actually change. The network can also be changed by others if they can get people to use their modified Bitcoin client.

To clarify some common misconceptions:

Bitcoin is not a democracy of either miners or users. For the most important things, your Bitcoin client does what's right no matter what.
The Bitcoin Core developers do not have absolute power over Bitcoin.
The Bitcoin Core developers are separate from the Bitcoin Foundation, and the Bitcoin Foundation does not own bitcoin.org.


Is the native Bitcoin client intended for mining? I can't understand, a native bitcoin client for calculations - will he be able to take part in mining?
If not, what kind of native mining software should use? Does he even exist?
I only found third party products like cgminer, cudaminer, etc.

Is the native Bitcoin client intended for mining?

No.

Long long A decade or so ago, back in the mists of time, in prehistoric days when dinosaurs roamed the earth, early versions of the Bitcoin software did indeed include a mining capability that used the pitiful capabilities of CPUs. But this function has long been rendered defunct by the advance of mining hardware such that one small ASIC is now more powerful at mining than a billion 4.6 million† modern high-end decentish desktop computers even if each were crammed with dozens of overclocked multi-core CPUs and GPUs. So the vestigial and useless appendix was removed from Bitcoin-core's DNA mainnet phenotype.

Hardware
Hashrate Mh/s

Intel® Core™ i7-2600 / 8 / 3.40 GHz
23.9

Antminer S19 Pro
110,000,000.0

Your choice of mining hardware determines what specialised control software you use.
(Health warning: answer may contain microscopic traces of hyperbole)
† Roughly. Give or take an order of magnitude, or two.


Settxfee does not work in RPC I am using settxfee(0.00020) before sendtoaddress RPC call however after sending 0.042 in blockchain a fee of 0.000045 is showing.

How can I set the fee properly ?

Thanks

settxfee sets the transaction fee per kilobyte, as that is the relevant unit for prioritization on the network and in blocks.

With sendtoaddress the size (in bytes) is not known ahead of time, so you can't set the exact fee.


Bitcoin Value Calculation I'm trying to understand how a bitcoin is valued. In my mind, it seems like it can be broken down with some basic math. For instance, if there is $50 trillion worth of "money" in the world and 1% of that money is in bitcoin, and there are 12 million bitcoins in existance, that would make a bitcoin 'worth' $41,666.67 in the physical world.

Is that a correct approach to identifying its value if I wanted to convert to/from dollars? Or, am I missing something?

There is no mathematical way to determine the value of Bitcoins (or shares of real companies, currencies and similar). It's value is how much people that use it value it. The best indicator what the price is is its exchange rate on various exchanges on the internet like BTC-e, mtGox, Bitstamp and many more. Bitcoins can more or less be related to more traditional currencies when it comes to theoretical background, valuing and more, but take in account Bitcoins are not backed nor managed by anyone or anything. It's all virtual. To look at the price and maybe analyse it you can hop over to bitcoincharts and take a look.


Forced fork of older, low difficulty blocks Let’s assume main chain (A) height is 1000 and the difficulty adjustment is 50 blocks. At height 450, the difficulty is very small. By modifying timestamp of blocks 450-500, I mine a fork (B) such that at height 500 to 600 the chainWork is higher than A at the same height.
A new peer wants to sync with me. I send B. At height 500 to 600, the peer chooses B and saves A as a fork. Given a long enough forced forking of A, is it possible for the peer to give up on A?
If the client never gives up on a fork, does this open it to fork chain spam attacks?

ChainWork is not compared at each specific height. The Chainwork of Chain A in total (at height 1000) would be greater than the chainwork at height 600 if the two were equal at 600.
If the two chains had equal work at height 1000 (the tip), then you'd have a standard block race, as described in the whitepaper. The fork with the most hash rate (Satoshi calls it CPU power), will continue to produce more work and ultimately outpace other forks.


Bitcoin Testnet Trouble with bitcoin-ruby I am having trouble with the bitcoin-ruby gem. I get the following error when trying to send money to another address I have on the test network:

  /var/lib/gems/2.2.0/gems/bitcoin-ruby-0.0.7/lib/bitcoin/protocol/txout.rb:76:in
  pk_script=': undefined methodbytesize' for nil:NilClass
  (NoMethodError)

I am generating a private key with:

def new_address
 Bitcoin::generate_address
end

And getting details for the private key with:

def key_details(prikey, pubkey)
  #returns prikey, prikey_hash58, pubkey_hash58, pubkey_uncompressed, address as a hash
  my_key = Bitcoin::Key.new(prikey, pubkey)
  { prikey:prikey,
    prikey_base58:my_key.to_base58,
    pubkey_58:my_key.hash160,
    pubkey: my_key.pub_uncompressed,
    address:my_key.addr
  }
end

The code I have to send money to myself is as follows:

require 'bitcoin'
require_relative 'utilities.rb'
require 'open-uri'

Bitcoin.network = :testnet3

def build_transaction(prev_tx, prev_out_index, key, value, addr, message)
  include Bitcoin::Builder

  new_tx = build_tx do |t|
    t.input do |i|
      i.prev_out prev_tx
      i.prev_out_index prev_out_index
      i.signature_key key
    end
    t.output do |o|
      o.value value
      o.script {|s| s.type :address; s.recipient addr }
    end
  end
end

def prev_tx(prev_hash, network)
  if network == "testnet3"
    prev_tx = Bitcoin::P::Tx.from_json(open("http://test.webbtc.com/tx/#{prev_hash}.json"))
  else
    prev_tx = Bitcoin::P::Tx.from_json(open("http://webbtc.com/tx/#{prev_hash}.json"))
  end
end

def key(publ_key, priv_key)
  key = Bitcoin::Key.new(priv_key, publ_key)
end

def bin_to_hex(s)
  s.unpack('H*').first
end

#transaction inputs
priv_key = "private_key"
publ_key = "public_key_long_format"
address = "address"
previous_tx = "previous_tx_hash"

# generate tx info off inputs
key = Bitcoin::Key.new(priv_key, publ_key)
prev_tx = prev_tx(previous_tx, "testnet3")
prev_out_index = 1
tx_value = prev_tx.outputs[prev_out_index].value

# build new tx
tx = build_transaction(prev_tx, prev_out_index, key, tx_value, address, "hello")

#
# puts tx.to_json
puts bin_to_hex(tx.to_payload)

Due to a lack of responses here, I cross posted this question on the stackoverflow channel. Here is a link with the answer:

https://stackoverflow.com/questions/31409720/using-bitcoin-ruby-to-make-a-transaction/31420786#31420786


Pay to script hash address transaction not accepted by miners I have fixed my initial transactions and have been able to send coins to a p2sh address
Now I want to spend those coins but when I try to broadcast my transactions either the website (blockcypher) accept it and it is then later not accepted by miners or rejected (blockstream) with:

sendrawtransaction RPC error:
{"code":-26,"message":"non-mandatory-script-verify-flag (Extra items
left on stack after execution)"}

I think I have made the the correct ScriptSig for the 2 of 2 multisig (OP_0, sig1, sig2, redeemscript) so I am not sure of my error:

OP_0 3045022100e91708339615eb38326a5c513b5dcc040bf59a1b97faef2c1f59a7b16426519a02200a4ca9d8c9f05ec824c70d1564ae2952650bc0ddc8bce92f081dd7d29d33d7ea01 3045022100ca0e751242a6d33ab2e895a9b1d9e5dce18426f2d11e69009e794ebc1004ba1a0220022a95a3f335fd84b380d6482948c24817a9f021f0dea75689eccf59e1540ae901 2d5214a175b609a7c37011420585f1fcf392fdda9a025414b1e9f0fa01914ff497607f99bf90dbd8a41bd8bb52ae

And here is my full tx:

0100000001f51f20dce174d1a894151bdbdf397317b97ec342c4068a6b96d95babb34baa7400000000c200483045022100e91708339615eb38326a5c513b5dcc040bf59a1b97faef2c1f59a7b16426519a02200a4ca9d8c9f05ec824c70d1564ae2952650bc0ddc8bce92f081dd7d29d33d7ea01483045022100ca0e751242a6d33ab2e895a9b1d9e5dce18426f2d11e69009e794ebc1004ba1a0220022a95a3f335fd84b380d6482948c24817a9f021f0dea75689eccf59e1540ae9012e2d5214a175b609a7c37011420585f1fcf392fdda9a025414b1e9f0fa01914ff497607f99bf90dbd8a41bd8bb52aeffffffff01401f0000000000001976a914a175b609a7c37011420585f1fcf392fdda9a025488ac00000000

and the code I use to create it:
https://pastebin.com/c0EvKjPH

Your redeem script has the length of the script prepended to it (2d), which causes the stack execution to finalize with the redeem script in the stack as data instead of interpreting it as another script.
The script interprets the 2d as if you intended to put data in the stack with a length of 45 bytes, instead of actually interpreting your redeem script as a script. Therefore, Your redeem script must start with 52 and not the legth of the script which is 0x2d.
After you delete the 2d from the redeem script, sign the tx again since this extra byte also changes the whole tx to sign.
Also, if you used that redeem script to compute your p2sh address, it is possible that you sent the money to the wrong address.


How much does SegWit affect transaction size? I know that SegWit transactions are bigger than normal transactions. But how much? 10% or 15% or..?

On bitcoincore.org:

The segwit transaction formats (see BIP 141 - witness program) have the following impact when serialised:

Compared to P2PKH, P2WPKH uses 3 fewer bytes (-1%) in the scriptPubKey, and the same number of witness bytes as P2PKH scriptSig.

Compared to P2SH, P2WSH uses 11 additional bytes (6%) in the scriptPubKey, and the same number of witness bytes as P2SH scriptSig.

Compared to P2PKH, P2WPKH/P2SH uses 21 additional bytes (11%), due to using 24 bytes in scriptPubKey, 3 fewer bytes in scriptSig than in P2PKH scriptPubKey, and the same number of witness bytes as P2PKH scriptSig.

Compared to P2SH, P2WSH/P2SH uses 35 additional bytes (19%), due to using 24 bytes in scriptPubKey, 11 additional bytes in scriptSig compared to P2SH scriptPubKey, and the same number of witness bytes as P2SH scriptSig.

And "How much does it affect block size?"

A witness commitment is included in the coinbase transaction, adding between 38 and 47 bytes, or about 0.005% of a block. (See BIP 141 - commitment structure)

A new transaction serialisation that includes the segregated witness data is defined (see BIP 141, or BIP 144). This adds an overhead of 2 bytes per transaction to allow the serialisation formats to be easily distinguished, and an overhead of 1 byte per input for the count of witness items for each input. These combine to about 1% per transaction.


Transaction signature algorithm As I know, standard ECDSA digital signature algorithm returns two values (according to this article or Wikipedia), but transaction push services or APIs, like this one, require one string as a signature. Can anyone explain, what is that string, and how can I get it with those values? Is it possible with OpenSSL?
Thank you very much!

The ECDSA digital signature scheme returns two values. To be specific, the X and Y values computed on the elliptic curve are returned.

In Bitcoin the signture is DER encoded, which is represented as a string containing the X and Y values and also some header data. But both X and Y can easily be extracted from it when reading the string from left to right.

In fact the Bitcoin protocol uses more information than only those concerning the X and Y values. For example, the size of the DER encoded signature is specified, but also a so called signature type is used to define which part of the transaction the signature was computed for.

Take a look here under the section "Signing the transaction" to see exactly how it works. In the table you will see how a computed signature is used in a scriptSig.

The details regarding the DER encoding was discussed here.


Why do the xpubs from electrum and trezor not match when creating a multisig wallet? For a little background, I am trying to set up a 2-of-3 multisig wallet with 2 trezors and a coldcard. I am trying to verify that my setup is correct before putting any meaningful amount of money in there, but I am finding that the master pubkeys for the trezors are not matching my expectation.

When creating a standard p2wsh wallet in electrum using a trezor, the default derivation path is m/84'/0'/0'. Immediately after choosing the script type and derivation path electrum displays the master public key. To ensure electrum is using the correct master public key I ran the following command: trezorctl get-public-node -n "m/84'/0'/0'" -t segwit. Sure enough, the master public keys displayed by electrum and trezorctl matched.

However, when trying to do the same verification when creating a multisig wallet, the xpubs do not match. Electrum defaults to the derivation path of m/48'/0'/0'/2' for native segwit multisig wallets. Running trezorctl get-public-node "m/48'/0'/0'/2'" -t segwit outputs a different master public key than what is displayed in electrum. Is this a bug in electrum or is there a reason for the discrepancy? I think that I am misunderstanding something because even though these master public keys don't match, electrum is able to sign and broadcast valid transactions using the trezor as one of the cosigners.

In my case, the master pubkeys do match, they are just encoded differently, with one (ab)using the xpub version prefix and the other Zpub, and corresponding checksum bytes in the end. The actual curve points and all derivations from this coincide.


Mastercoin API - what to use? I am interested in communicating with the Mastercoin network through an API to control various assets. In Bitcoin, I would run the Bitcoin daemon and use the documented API. For Mastercoin, I'm hearing conflicting opinions - either using omniwallet, mastercoin-tools or mastercore.

What is the best approach to take to communicate with the Mastercoin network through an API?

I think the most easy way to do this would be through Omniwallet API.
mastercoin-tools is deprecated and should not be used.

If you want the better security achieved by running a local instance, use Master Core.


What could stop bitcoin-seeder from "hearing" DNS queries? I'm running several bitcoin-seeders. Under Ubuntu 14.04 & 16.04, they run fine and answer queries.
On Ubuntu 18.04, however, dnsseed does not detect the queries sent to it.  I know the machine is receiving the query because DNS requests are monitored with dnstop, and every DNS query sent with 'dig' is sensed by dnstop and reported, but dnsseed shows "0 DNS Requests".
There is no firewall running and apparmor has been disabled. What tests could be run or troubleshooting strategy followed to find the problem ?

Under Ubuntu 16.04:

Loading dnsseed.dat...done Starting 4 DNS threads for ra.zmark.org on
173.255.252.140 (port 5353).......done Starting seeder...done [18-10-24 19:27:41] 274/37963 available (1258 tried in 1000s, 38980 new, 1536
active), 0 banned; 3 DNS requests, 3 db queries

Under Ubuntu 18.04:

Supporting whitelisted filters: 0x1,0x5,0x9,0xd Loading
dnsseed.dat...done Starting 4 DNS threads for shido.bitmark.one on
139.162.122.138 (port 5353).......done Starting seeder...done Starting 96 crawler threads...done [18-10-24 19:25:23] 3593/87930 available
(64497 tried in 3805s, 21897 new, 1536 active), 1 banned; 0 DNS
requests, 0 db queries

dnstop:

Queries: 0 new, 1363 total                                                                                Wed Oct 24 19:39:03 2018
Replies: 0 new, 191 total

Query Name                     Count      %   cum%
-------------------------- --------- ------ ------
shido.bitmark.one               1169   85.8   85.8
bitseed.xf2.org                  117    8.6   94.4
org.members.linode.com            24    1.8   96.1
seed.bitcoin.sipa.be              20    1.5   97.6
dnsseed.bitcoin.dashjr.org        14    1.0   98.6
dnsseed.bluematt.me               12    0.9   99.5
motd.ubuntu.com                    5    0.4   99.9
github.com                         2    0.1  100.0

The problem stems from the way Ubuntu 18 handles DNS resolution.

My clue was comparing the output of netstat -an | grep "LISTEN " on a machine with a working dnsseed vs the Ubuntu 18 machine with a non-responding dnsseed

The Ubuntu 18 machine showed

 tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN

(which the other did not). Finding this line rather odd, a search for "DNS 127.0.0.53:53" revealed that Ubuntu 18 is handling DNS resolution requests in a particular way (which I have not deciphered), but I found a work-around, which proves dnsseed is not at issue.

dnsseed will answer on Ubuntu 18 on non-standard DNS ports (other than port 53), so the workaround is to use iptables' network address translation feature (NAT) to intercept incoming DNS queries on port 53 and translate them to some other port (using port 5353 in this example) where dnsseed will "see" them.

    dnsseed   -h shido.bitmark.one   -n 139.162.122.138   -p 5353       -m marker@bitmark.io
    srcPort=53
    dstPort=5353
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $srcPort -j REDIRECT --to-port $dstPort
    iptables -t nat -A PREROUTING -i eth0 -p udp --dport $srcPort -j REDIRECT --to-port $dstPort


Why are Paxful transaction fees so low? Recently I used Paxful for the first time I had bought 0.00022665 BTC and then had sent them to my Electrum wallet. The whole amount have arrived to my private wallet successfully, so that means that Paxful didn't charge me with any fees.
But when you use your private wallet such as Electrum you have to pay a large transaction fee just to get your transaction confirmed?
How does it work? Why doesn't Paxful wallet have transaction fees for outgoing transactions?

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

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


Own bitcoin pool miner algorithm I receive these variables from the mining pool:

job_id, prevhash, coinb1, coinb2, merkle_branch version, nbits, ntime, clean_jobs.

What must I do with them?

Can you write step by step formulas how to solve that problem?

What must I respond to the pool?

Are you aware of the stratum protocol definition? I found a description here: https://slushpool.com/help/#!/manual/stratum-protocol. As a prerequisite, you need to know how block hashes are computed. See https://en.bitcoin.it/wiki/Block_hashing_algorithm for the definition.

When you'd compute hashes for solo mining, only hashes that meet the current difficulty are valuable. In contrast, when pool mining, you will submit hashes to the pool which meet a significantly lower difficulty requirement, so the pool can see that you're actually working. The number of "shares" that you produce will determine the portion of the block reward allocated to you when the pool finds a block.

Note that I cannot provide code samples or more detailed explanation, as I've never coded a bitcoin miner. Since you want to write the mining software, it's your job to find out :-)


Have there been case studies of how anonymous bitcoins are? The blockchain has a lot of information about all bitcoin transactions.

I've heard a lot of conjecture about how anonymous bitcoins transactions are, but I haven't seen a scientific study.

Are there any case studies that show how to track a bitcoin transaction to an individual person? I see IP addresses on blockchain.info so that information could be subpoenaed; on the other hand, you could use Tor which also has its documented weaknesses.

Yes, the most notable one being this one. It illustrates that it is possible to associate transactions and addresses with forum users' identities, as well as connecting them to some organizations (including WikiLeaks, MyBitcoin, Slush's Pool etc).

Tracking users by their IP is a bit harder, although during the work on my master thesis I was able to find an IP address associated with a Bitcoin Address and trace it correctly to the Bitcoin Faucet.


What can be done about the no-transaction block relayer (currently 71.123.170.150)? An unknown major solo miner (currently IP 71.123.170.150), most likely a botnet, is relaying blocks with zero transactions. Two weeks ago this miner constituted ~15% of the network, now it constitutes ~30%. If the growth rate continues, in about two weeks this miner (most likely a botnet) will control more than half of the network, theoretically allowing a 51% attack. It has already orphaned two perfectly valid blocks. (Thread on BitcoinTalk)

It seems to me we have an imminent threat to Bitcoin itself. Requiring transactions to be included in a block won't work; the miner can just send coins to itself. Blacklisting IPs in the client won't work; the miner can easily switch IPs. How can we stop this?

There are too many issues rolled up into this question, I'll try to address each separately.

The fact that the miner does not include transactions is not a problem. Miners have a right to exclude transactions, even all transactions. Senders can include tx fees if they want to improve the chances of being included quickly (if the miner excludes transactions due to its nature of operation an individual fee won't help much, but if the general fee level increases, 0-tx miners will be much less profitable and thus less influential).
The fact that there is a mining botnet is a problem insomuch as we don't want Bitcoin to be an enabler of harmful activities, but it does not harm Bitcoin itself. It is likely that new FPGA- and ASIC-based mining products will make CPU-based botnets less effective.
Orphaned blocks are a normal occurrence in the functioning of the network, and an occasional orphan by this particular miner is of no concern.
If the miner starts rejecting longer branches (as in a 51% attack) it is a problem, but it is a heavily discussed core problem which is not specific to botnets and is not yet resolved. I am of the opinion that a proof-of-stake system can drastically mitigate the problem (and will probably make botnets less effective miners).
If we want as a matter of principle to discourage blocks that have little or no transactions, we can include some measure of transaction volume in the branch selection criterion. One such measure is Bitcoin days destroyed. It is resistant to manipulation by sending the same coins to oneself again and again, because such coins will only destroy few days each time.


Ledger: is the private key tied to the device or the wallet? Context: I have a Nano S since before, with one recovery phrase and a wallet with some minor BTC on it. Bought a Nano X, set up with a new phrase, and a new wallet, and put some coins in that. Then I imported the old wallet to the new device as well via Ledger Live, so there's two wallets. But then I started wondering:
Is the recovery phrase per device or wallet, or how does it work? If someone gets my old phrase, can they unlock my new device as well, or can they only unlock the old wallet?
It seems it would be possible to unlock the old wallet with either the new or old phrases, but the new wallet only with the new phrase?
Been scouring through the docs but it doesn't really say how this works. I guess when I imported, it should have regenerated that same old wallet but with new keys? But would want to be sure.
Not too worried about the old wallet, but the new. So if someone still can recover only the old one, I would not care that much, but is my new wallet on both phrases somehow I guess is my question, or is it only on my new Nano X devices phrase?

The keys are tied to the mnemonic (or seed phrase or recovery phrase) that you use. The keys are derived directly from it. If any gains access to the mnemonic, they can directly produce the private keys that you used without access to any of the physical hardware. Furthermore, having the mnemonic does not allow them to unlock your hardware wallet - the PIN you use is independent of and unrelated to the mnemonic and the private keys. But that is moot because if someone has the mnemonic, they don't need your hardware to take your Bitcoin.
Importing means that you setup a new device with the same mnemonic. So anyone with the mnemonic can still take your Bitcoin. If they get access to the old device and figure out the PIN, then they can also take your Bitcoin because it is the same private keys.


What happens with the bitcoin locked in the payment channel if both sides lose the backup? If none of the sides closes the channel, is the coin locked up forever?

Tl;dr: also in lightning we have: not your keys, not your coins.

More detailed explanation:

I assume you mean with backup the private keys of the lightning node together with the history of the state data.

Then the same would happen as in the onchain case if you loose your keys. You could not move the coins anymore. Or in a onchain 2-2 multisig wallet (remember payment channels are just such a wallet together with some protocol how to spend from it) the same if you and the other person would loose their keys. None of you could move the btc anymore.

In lightning terminology this would mean that the channel stays open forever but no new states can be negotiated (meaning noone can route through that channel or use it to send / receive payments) and additionally the channel cannot be closed.

While this is a pity for you and your channel partner as in the onchain case it is also a pity for the network as other nodes still think the channel is active and will try to route payments over it.


How can I move bitcoin-qt blockchain data to bitcoind daemon? I have a bunch of files like blk00110.dat now that bitcoin-qt (on my mac) has finally updated. I'd like to just move this over to my linux box so I can keep it up and running but the bitcoind program uses a different structure. How can I move this data?

There should be a .bitcoin directory once you install bitcoind on your linux box. Copying those .dat files in this directory should enable bitcoind to read them directly.

Bitcoin-QT is actually using bitcoind under the hood. So it shouldn't be using different structure unless you're using different versions of bitcoind.

Edit: also reading more about bitcoind commands, there's a command to import a file directly. So this should probably be better than directly placing the files in the directory:

bitcoind -loadblock=<file>      Imports blocks from external blk000??.dat file


Data directory issue I have everything set up normally. My only issue is that my data directory is in C:\Users\User Name\AppData\Roaming\Bitcoin.

Normaly this is what you would want, but, if you noticed, my username has a space in it (obviously I changed it for privacy) so when I try to designate my data directory in the miner program it says the directory does not exist because the space in my username causes the directory link to break ( C:\Users\User ) instead of the full link...

Is there a way I can change where Bitcoin-Qt stores its data by default?

And no, a re-directory won't work, because it can't find the location in the first place.

Run bitcoin with the parameter -datadir=C:\New\Dir

E.g. create a shortcut and change "target" to "C:\Program Files (x86)\Bitcoin\bitcoin-qt.exe" -datadir=C:\BitcoinData