Does the BerkeleyDB-based wallet.dat implementation leak private key data? I read this little nugget on the bitcoin client bug tracker:

  the bdb binary log files can also contain sensitive data such as private keys

Is that true? Does this mean that even with an encrypted wallet.dat, there might be a way that the private keys are written to disk unprotected? If so, what can I do about it?

If you are using an encrypted wallet, private keys are never written unencrypted to disk.

However, the 0.4.0 release (the first to feature wallet encryption) had a bug where - upon upgrading a wallet from unencrypted to encrypted - parts of the unencrypted where not necessarily overwritten, leaving them accessible for a while.

0.4.1 and 0.5.0 fix this by first rewriting the entire wallet file upon encryption (or the first start afterwards), and invalidating the entire pool of reserve keys that was present before. This means (and has been tested), that if you start with an empty wallet, and immediately encrypt it, it will not ever use any key that was ever written to disk in unencrypted form.

Note that wallet encryption is not a silver bullet, and an attacker may have other ways of extracting the private key, such as keyloggers.

EDIT: only now I read your question correctly. The log files may contain anything that was attempted to be written to the database files themselves, and if you are using (or were using) an unencrypted wallet, that may indeed mean private keys as well. Again, if you start with an encrypted wallet in 0.5.0, no keys will be used that ever touched disk unencrypted.


Have the Bitcoin developers resigned to the idea of changing the mining algorithm to an ASIC-resistant one? Mining centralization is a big Bitcoin problem, and the development of ASICs is one of the main causes of this, but I haven't found a lot of discussion about changing the mining algorithm to a more ASIC-resistant one. Is this because there is some kind of contract between the big miners and the Bitcoin developers, to not change it ever? Or there is some work in progress?

Aside from the forking problems that arise from trying to change the mining algorithm, ASICs are gaining a longer shelf life, allowing for more time to distribute mining equipment, ultimately helping decentralization.


Is there a way to prove control over specific number of BTC kept in cold storage? Suppose I have a certain number of bitcoins kept in cold storage. Is there way to prove that I control those coins, or any coins totalling a certain amount, to another party without transferring them?

You can sign a message with your private key. But you would have to reveal your public key so that the signature is verified. But that kind of defeats the purpose of cold storage. You can just as well send a small amount from that address to the other party.


Can I receive Bitcoin on any of my wallet addresses? Can I receive Bitcoin to any addresses from my wallet?

I have more than one address on Coinbase, and it seems to change every day. Can I turn off the changing of addresses?

Yes! With an HD (Hierarchical Deterministic) wallet you control all the addresses inside of it. Using a new address for each transaction is actually a good thing for privacy.

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

https://community.coinbase.com/t/why-did-my-address-change-did-i-lose-some-payments/1589/2

To answer your last question you don't need to stop your address from changing because payments send to your old HD addresses will remain under your control.

If you want more control I suggest you run your own full node and do not give any control to a 3rd party:
https://bitcoin.org/en/choose-your-wallet

Coinbase offers convenience and other advantages but this post from CEO Brian Armstrong makes it clear what their priorities are:
https://medium.com/the-coinbase-blog/coinbase-is-not-a-wallet-b5b9293ca0e7


If bitcoin is indivisible, where does change come from? Let's say I want to give Alice .22 BTC. I currently have in my wallet 1 BTC. Because Bitcoin is indivisible, I have to spend the 1 BTC I have as input, and .78 BTC will be returned to me as change, while the other .22 BTC is sent to Alice. My question is how is this consistent with currency indivisibility? Is the .22 BTC and .78 technically created from the 1 BTC? Or is there change from another transaction? I'm just confused how it's indivisible but exact change can be created.

I like to suggest a mental model where the network is a metals forge:

You have a 1 oz gold coin stamped with your key on it, with your transaction you send it to the forge to be melted down and re-formed to two new coins, a .22 with Alice's key stamped on it and a .77 with a key of yours on it, and then the forge keeps the remainder for their fee.

You can't spend half your 1oz coin, but you can have the whole thing melted down into multiple, and perhaps many, parts.


How to call JSON RPC API from C? How do I make RPC calls from C?

My question is related to the question: "How do I call JSON RPC API using C#?"

The C API for processing JSON is Jansson. C applications like libblkmaker use cURL for making the calls and Jansson for interpreting the JSON that cURL fetches.

For example basic usage (which can be easily modified for Bitcoin RPC), see the Jansson example github_commits.c and the associated tutorial.

Here's an example of how to make JSON RPC calls with cURL, the output of which Jansson could process:

#include <stdlib.h>

#include <curl/curl.h>

int main()
{
    CURL *curl = curl_easy_init();
    struct curl_slist *headers = NULL;

    if (curl) {
    const char *data =
        "{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"getinfo\", \"params\": [] }";

    headers = curl_slist_append(headers, "content-type: text/plain;");
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

    curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:8332/");

    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) strlen(data));
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);

    curl_easy_setopt(curl, CURLOPT_USERPWD,
             "bitcoinrpcUSERNAME:bitcoinrpcPASSWORD");

    curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY);

    curl_easy_perform(curl);
    }
    return 0;
}

It will print, like the cURL example, something like this:

  {"result":{"balance":0.000000000000000,"blocks":59952,"connections":48,"proxy":"","generate":false,
       "genproclimit":-1,"difficulty":16.61907875185736},"error":null,"id":"curltest"}


Bitcoin Country of origin analysis I would like to analyze bitcoin transactions based on the origin by country.

Is there a API or program (maybe like Datasploit, only the other way around) to cross reverence location and transactions. I prefer python to analyze but of course all input is welcome on tools used and reliability of the analytics.

Location is not a detail recorded in transactions.  Specific Exchanges might record the IP address or location where their clients are located at the time they make a transaction, however that is clearly only going to be a small portion of the overall chain of transactions.


Remove public address from my wallet I have generated few fancy bitcoin addresses with vanitygen. I was looking on some webpage how-to-add the address into my bitcoin wallet.
I accidentally entered the example private key instead of my generated one.
Now I have in my wallet someone else's address and plenty of transactions.

Is there a way how to remove that address from my wallet?
I did more actions since the last backup.

The only way I came to is to backup private keys from my wallet and add them to some empty wallet.

Jackjack's fork of pywallet will allow you to delete a private key, reportedly.

http://pywallet.tk
http://bitcointalk.org/index.php?topic=294439.0


Bitcoin Mining as a Newbie (link wallet to another person's miner) I'm new in bitcoin mining. I would wish to mining to make some profit. I have just talked to someone and he has told me I can partner with him to use his miner. I have some bitcoins ready with me and before I get started  I want to know how I will configure wallet to his miner.
What should I share with him and lastly how will I know that it is configured?
I'm trying to avoid being conned

What should I share with him

Nothing, because

  I'm trying to avoid being conned

See for example

I think ive being scammed

  I invested with a man who said he can mine me btc ... he then says I need to deposit another 950usd

How can I get a private key for this address

  I invested my bitcoins in someone's miner ...
   Now for the key he wants me to pay him $500

my money gone from wallet scam

  one trader miner told me that he would double the btc and do minning. i did the i gave access online to my wallet blockchain . later a big scam. my money disapper from wallet and a watch only adress linked created and the my entire btc transferred in to it

BTC Stolen from Blockchain

  A guy ... told me that I can mine for bitcoin ... Within half an hour my wallet was empty.

I've been asked to share wallet credentials to participate in mining. Is that a scam?

    I've been approached ... claiming that they would be able to increase my bitcoin by linking my wallet to their miner.


Limit size of data files As the mere size of the constantly changing data file tampers with my backup concept, I would like to ask if there is a way to split this file into many smaller pieces. I have no problem with the size as such, but with the amount of changes.

Background is, I do my backups with rsnapshot. This links files which haven't been changed on the target together, while changed files are copied in full.

That's why I would imagine to split the currently about 763 MB big blk0001.dat into two files:

blk0001.dat having maybe 700 MB, and not changing (frequently) in the future.
blk0002.dat holding the rest.

As the 2nd file grows steadily, I would, after it has reached a certain size, put more data from it into blk0001.dat, and eventually stop changing this file at all, starting a 3rd one.

Has someone done this already?

This is actually already implemented: blk0001.dat contains the first two gigabytes of blockchain data, blk0002.dat contains the second two gigabytes, and so on. We just haven't hit two gigabytes of data yet.


How to generate a dash address? How can I generate a simple dash address from a public key?

How many address formats are there in dash?

How many address formats are there in dash?

Dash seems to be pretty similar to bitcoin when it comes to address and transaction formats. You have your typical P2PK, P2PKH, P2SH.

Here is how to generate a standard P2PKH address (and therefore also a P2PK address).

var bip39 = require('bip39');
var hdkey = require('hdkey');
var createHash = require('create-hash');
var bs58check = require('bs58check');

//const mnemonic = bip39.generateMnemonic(); //generates string
const mnemonic = 'thunder purchase pave tower lecture upgrade supreme half kid fitness tray shove'
const seed = bip39.mnemonicToSeed(mnemonic); //creates seed buffer
console.log('mnemonic: ' + mnemonic);

const root = hdkey.fromMasterSeed(seed);
const masterPrivateKey = root.privateKey.toString('hex');
//console.log('extended public key root:  ' + root.publicExtendedKey)

const addrnode = root.derive("m/44'/5'/0'/0/0");
console.log('addrnodePublicKey: '+ addrnode._publicKey.toString('hex'))
console.log('addernodePrivateKey: ' + addrnode._privateKey.toString('hex'))

const step1 = addrnode._publicKey;
const step2 = createHash('sha256').update(step1).digest();
const step3 = createHash('rmd160').update(step2).digest();

var step4 = Buffer.allocUnsafe(21);
step4.writeUInt8(0x4c, 0);
step3.copy(step4, 1); //step4 now holds the extended RIPMD-160 result
const step9 = bs58check.encode(step4);
console.log('Base58Check: ' + step9);

Notice the only difference between this and deriving a bitcoin address is the version bytes is not 0x00 but instead 0x4c & the derivation path coin index of 5 instead of 0.


Why would someone be willing to sell BitCoins at substantially below market price? A local fellow in my area is will to sell BitCoins for below market price in exchange for cash.  I can't help be wonder if it's a scam.  Is there a reason why someone might be willing to do this?

Some possible reasons

He's an idiot/uninformed
He's willing to sell low because he wants to promote adoption
He's got a very low Net Asset Value (very early adopter)
He wants to unload a lot of coins quickly
He is trying to avoid records/taxes on this transfer
He's not willing to wait for the traditional fiat system (time preference)
He only has a high fee method of withdrawing fiat, so it is not actually a loss for him
He's got stolen/tainted coins
He's going to steal your cash

There is no official system in place to assign taint, but if they are from a highly publicized theft and not mixed before they are sold to you there may eventually be people in suits knocking on your door wanting to sieze them or asking awkward questions.

In 7 of these 9 reasons there is no real problem for the buyer, but if you want to avoid stolen coins or getting mugged you should ask some questions, get a copy of his ID, and do the deal in a public place with witnesses.


How do you calculate when 98% of Bitcoin will be mined? Trying to find a calculation to work out what year will an arbitrary percentage of bitcoin will be mined, specifically 98%.
I know it takes 10 minutes to mine 1 block but unsure how to use this?
Thank you for any help :)

I have created this Google sheet to calculate various metrics of the reward schedule. The numerical maximum of bitcoins that could be created is 20,999,949.9769 BTC.
0.98 × max = 20,579,950.977362

So, the network will have issued more than 98% of all bitcoins once there are more than 20,579,950.977362 BTC. Looking at the table I linked above, we see that at the end of the fifth epoch, 20,343,700 BTC will have been mined, and 20,671,825 BTC at the end of the sixth. This means that 98% of all bitcoin will be issued some time in the sixth reward epoch, i.e. the time between the fifth and sixth halving. Since the block subsidy is constant for the whole epoch, we can calculate how much will need to be issued in the sixth epoch to reach 98%:
98%×max - supply_after_5th_halving = amount_to_issue_in_6th_epoch

To reach 98%, 236,250.977362 BTC need to be mined in the sixth epoch.
The block subsidy is 1.5625 BTC per block in the sixth epoch.
236,250.977362 ÷ 1.5625 = 151,200.63

I calculate that 98% of all bitcoins will have been issued with the 151,201st block in the sixth epoch. Since the genesis block was at height 0, and each epoch has 210,000 blocks, the first block of the second epoch was 210,000. Likewise, the first block of the sixth epoch is 1,050,000 which makes the 151,201st block occur at height 1,201,200. Since the fifth halving is projected to happen in 2028 and the sixth halving in 2032, and 151,201 is slightly less than 3/4 of 210,000, the network should have issued 98% of all bitcoins in 2030 or 2031.


How do I view information on the peers my Bitcoin Core full node is connected to? I would like to view information on the peers my Bitcoin Core full node is connected to. How do I do this?

As 0xB10C posts here you can get a peer dashboard to bitcoin-cli that looks like this.

You can get this dashboard by using
watch ./src/bitcoin-cli -netinfo 4

and you can use the -asmap flag too.
This netinfo feature was merged into Bitcoin Core in September 2020 and is included in the release of Bitcoin Core version 0.21 . (The feature was built by Jon Atack.)
Additional guidance for using this feature was added in this PR.


Are there any services to tell black list address? I'd like to know the addresses used for a fraud, in order to make a service for analysing bitcoin blockchain. If you know the service for that, could you tell me it?

No and active work is being done to make this even harder as we speak. Fungibility is a necessity of a currency, black lists are not compatible with that.


I used a BTC mining site and paid the fees but never got paid [Where I paid mining fees and never got my BTC][1]

the transaction from my wallett shows 150 confirmations. I am new BTC can anyone help with this so i can understand WTF happened and am I just straight effed on the fees i paid. Thanks for your time help I appreciate it. I used the following site http://getbtc.online/dashboard/ one puts in the amount to be mined, the miners mine it and then you pay fee. Afterwards it should deposit the selected BTC amount in your wallet. Mine never got deposited in has several hundred confirmation and i know my wallet address is correct. The miners got paid; This is the site I get after I click on the confirmations in the wallet. I hope this is better as I stated previously; I am new to this and not sure WTF is going on. https://btc.blockr.io/tx/info/c842cc71b4f5133896a6302e208179400d57a79e885b617c4e21489e708fe2d1

To give this a clear answer, so it can stop being bumped:

You have been scammed.

You are not going to get paid, and it is very unlikely you will be able to recover the money you have sent.  Accept that your money is lost, and don't send them any more.


How to generate wallet address? And how to get that connected with internet for transactions? I would like to know how a wallet address can be generated? One site suggested me to create a script for that, that is 1 option, I would like if any other there.

Mainly I am willing to know is how that address will get connected to network for transactions?

If I have my wallet address and I give it to anyone, will the other be able to deposit bitcoins in that address, using my wallet address only? If yes how will the network come to know about my wallet address?

You dont have to be connected to the internet to have your wallet verified or something. People can send bitcoin to you (or a random valid address) even without them knowing it exist. You can create an address on a site like this or create an address in your wallet app (such as Multibit, which is a program I'd advise to use). I would suggest the latter option, because it is safer (just 1 site/app that could possible know your secret key) and it takes away the hassle of importing the wallet in Multibit.

Your second question: yes, the address is the only thing the other person needs to know. Sometimes you also have a QR-code which act as the same thing, but your address alone is enough.

TL;DR. No need to connect to the internet, and create (and control) an address in Multibit. The one who is going to send you coins only needs to know your address. Good luck!


Used salvagewalllet, now it shows zero balance I used the salvage wallet command in bitcoin. Now the new and old wallet files both say zero balance. Can anybody help me understand what`s going on?

-salvagewallet will extract only the private keys from your wallet. When it does that, it may also end up corrupting your wallet if it was not already corrupted. -salvagewallet should only be used as a last resort.

Because only the private keys are pulled out, all transaction and comment information is lost. That means that you will lose all of your labels and your wallet balance. You will need to rescan the blockchain be starting Bitcoin Core with -rescan.


Virtual currency used as alternative currency Would it be feasible for a virtual currency to be used in the same way as alternative currencies such as Berkshares and Brixton Pounds ? Furthermore, do you think it is possible to make it independent of conventional currencies such that it is held to a standard, say a basket of household goods ?

While there's no technical issue preventing the use of Bitcoin and its' associated engine for any number of alternate currency types, the problem you're likely to run into with your question is the addition of a central issuer. Bitcoin is explicitly designed for distributed issuance of funds according to a carefully designed algorithm that requires distributed proof-of-work. It would be non-trivial to chance the issuance mechanism.

That said, if you have a talented programmer, Bitcoin is open-source under the MIT license and you're welcome to modify it as you see fit, just know that it's probably not going to be as easy as your question seems to indicate it should be.


Is BitcoinJS under active development? I love the idea of a powerful alternative to bitcoind, and especially the ability to subscribe on blockchain events and easily process them on the server side.

However, I see the last activity on the BitcoinJS code is 7-10 months ago.
Does anybody know the status of the BitcoinJS projects or can suggest alternatives?

Update: I'm now looking into bitsofproof supernode, a project that looks really promising.

Not sure but I think those guys started working on the Ripple project instead. They are skilled JS developers and they want to do something of their own with Ripple.


Is it possible to use a PGP key as a bitcoin address? Both bitcoin and encrypted emailing are based on public key cryptography. However, they use different implementations, so I assume that a public PGP key cannot be used as a bitcoin address directly.

But would it be possible to convert a public PGP key to a bitcoin address in such a way that it can be accessed only with the corresponding private PGP key (or something derived from it)?

If such an algorithm existed it would allow for sending coins to people without them knowing anything about Bitcoin, as long as they have a PGP key (e.g. for giving someone a little incentive to learn something about Bitcoin).

No, this is not possible.

Recent GPG versions do have support for Elliptic Curve crypto, with associated EC keys. The EC curves supported there are different from the one used in Bitcoin, though (they don't have the same size, so they certainly can't be isomorphic).


Digibyte Wallet Hash I recently invested in digibyte.
As someone of IT-security field, I'd love to know how the passphrase is stored in digibytes wallet.dat.
The Bitcoin2John doesn't work on it and hashcat, too, has no support for the wallet.
I couldn't find any information on how storage is done, so I'm asking you.
Best wishes and thanks in advance

I am not familiar with digibyte's wallet implementation specifically, but I can probably shed some general light:

Your passphrase is not stored in the wallet.dat - the passphrase is the encryption key that can be used to decrypt the wallet.dat. The wallet.dat itself stores private keys that can be used to sign transactions with the associated addresses.

When you run JTR or hashcat on the wallet.dat, you are brute forcing the passphrase itself to gain access to the private keys inside the wallet (trying to find a passphrase that when used as a decryption key is successfully able to decrypt the wallet)

Briefly looking at the digibyte core wallet, the wallet.dat appears to be in a standard format just like for any other wallet based on Bitcoin Core. You should start here if you want to know more about what information is stored inside the wallet.dat and how (look under Bitcoin Core): https://en.bitcoin.it/wiki/Wallet

If Bitcoin2John and hashcat don't work on the wallet.dat, this is probably due to minor differences in storage, but it should be fundamentally the same.


Error validating a transaction with blockcypher I've created a testnet transaction using blockcypher API (https://api.blockcypher.com/v1/btc/test3/txs/new) and then signed the transaction using the signer (go lang). And then sent signed transaction to blockcypher (https://api.blockcypher.com/v1/btc/test3/txs/send)
But it's returning error:
Error validating generated transaction: Error running script for input 0 referencing e41a5ceca53f2cd6076f3a100137d6182d0bd567d91e508f4171712b9c67f429 at 0: Script was NOT verified successfully.

The response I'm receiving:
{
  "errors": [
    {
      "error": "Error validating generated transaction: Error running script for input 0 referencing e41a5ceca53f2cd6076f3a100137d6182d0bd567d91e508f4171712b9c67f429 at 0: Script was NOT verified successfully."
    }
  ],
  "tx": {
    "block_height": -1,
    "block_index": -1,
    "hash": "c514900d8ed184c37bd795c30f24d56508c40ca5f65c2bf8d724162fd8976353",
    "addresses": [
      "tb1qy0jm6vmy2vmndpzzj34z6h6xnelta98d0ukf6s",
      "tb1qwchaysp9wfukq54yee8uye20f2c5zkpl97elvx"
    ],
    "total": 3996400,
    "fees": 3600,
    "size": 222,
    "vsize": 141,
    "preference": "low",
    "relayed_by": "2a01:4f8:192:6027::2",
    "received": "2021-05-01T09:34:02.926591638Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 1,
    "vout_sz": 2,
    "confirmations": 0,
    "inputs": [
      {
        "prev_hash": "e41a5ceca53f2cd6076f3a100137d6182d0bd567d91e508f4171712b9c67f429",
        "output_index": 0,
        "output_value": 4000000,
        "sequence": 4294967295,
        "addresses": [
          "tb1qwchaysp9wfukq54yee8uye20f2c5zkpl97elvx"
        ],
        "script_type": "pay-to-witness-pubkey-hash",
        "age": 1973087,
        "witness": [
          "3045022100a4a53cc0eaae807e5c3500af2132a8e575823fc0ff7ceb92de94b739920810ba0220339aa4128967654977b6afb8be9a8897c5e822e2cb5659fe987c106bec44101e",
          "03f2cfd459014d4f19f36e28dcae329ca4f6b263d4d7c13ca7317a75b1a130f0f6"
        ]
      }
    ],
    "outputs": [
      {
        "value": 2000000,
        "script": "001423e5bd33645337368442946a2d5f469e7ebe94ed",
        "addresses": [
          "tb1qy0jm6vmy2vmndpzzj34z6h6xnelta98d0ukf6s"
        ],
        "script_type": "pay-to-witness-pubkey-hash"
      },
      {
        "value": 1996400,
        "script": "0014762fd2402572796052a4ce4fc2654f4ab141583f",
        "addresses": [
          "tb1qwchaysp9wfukq54yee8uye20f2c5zkpl97elvx"
        ],
        "script_type": "pay-to-witness-pubkey-hash"
      }
    ]
  },
  "tosign": [
    ""
  ]
}

Any help would be greatly appreciated. Thank you all.

It seems that there is no sighash type at the end of the signature data in witness.


Do bitcoin exchanges based outside of the US who serve US customers have to register with FinCEN as MSBs? From what I understand, Bitstamp is not registered with FinCEN, whereas Mt.Gox is, does this mean Bitstamp is in danger of being shut down?

The short (slightly oversimplified) answer is that most consumer protection oriented laws (including Money Services Business and Money Transmitter laws) apply to the consumers themselves. So if you serve customers in the US, you must comply with the laws that protect those customers.

IANAL, YMMV, etc. Consult an attorney specializing in MSB/Money Transmitter laws for an more accurate application of the laws to your business model.


A few security-related questions: how do I automate a web service as much as possible without storing private keys on server? I'm learning how to use bitcoind, and want to set up a side project that uses bitcoin to learn along the way. I'll be using the json-rpc with PHP on my server. I want to create a service that will receive bitcoins from users, and will eventually send those bitcoins either back to the users or to my own wallet.

In order to keep things secure, as soon as coins arrive at a user's unique address, I want to automatically forward them to another wallet that doesn't have the private keys on the server.

My questions are thus:

What's the easiest way to handle the bitcoins from an off-server wallet (on my computer or such), without doing absolutely everything by hand? Would it be possible to write a script that does everything I want it to do with the off-server coins, after prompting me for the private keys? For example, a database could hold all the bitcoin commands that would need to be run, but it would need by "OK" to run (requiring the keys). Would the keys be somehow visible if someone got access to the server?
If not the above method, how else can I automate the process as much as possible? The only thing I can think of currently is to do everything by hand: have a private wallet on my home computer, seeing what to do with bitcoins on various addresses, and manually sending them out using my home bitcoin client to the required addresses. This would be extremely tedious with a lot of users on the service. Surely there's a better, secure way?
I don't want to keep private keys on the server for two reasons: a) I don't know anything about server administrations or server security, as I'm just a developer, and b) as a result, I have a managed server (managed by the host), so they could get into the server at any time. I'm wondering, can anyone suggest how to get started in server administration and security so that I can take it into my own hands?

Thank you.

EDIT: To clarify, I mean handling transactions that are off of the server, not actually in "cold storage." The off-server wallet could be hosted on my personal computer--I just don't want it on the server, since it's more prone to attack.

Set up a cold storage machine, not connected to the internet but with boitcoin installed. Generate a bunch of addresses on the cold storage machine.

Using a USB drive, copy the addresses from the cold storage machine to the online system's database.  No need to do anything with the private keys.

When needed on the online system, just send to 1 of the addresses in the database.  This can be totally automated.  You don't need a private key to send to an address.


ELI5: What is Base58Check encoding? I've seen posts on how to do it and I've read the wiki on what it is, however these explanations are too complex. Can someone explain what it is and why it's called Base58Check encoding? Are addresses generated without going over those steps still valid in Bitcoin?

This is the explanation provided by the original bitcoind client in base58.h

// Why base-58 instead of standard base-64 encoding?
// - Don't want 0OIl characters that look the same in some fonts and
//      could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won't line-break if there's no punctuation to break at.
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.

To further this question, what do npm packages like bs58check do exactly? The description is as so

  A straight forward implementation of base58check extending upon bs58.

Can someone explain what it is and why it's called Base58Check encoding?

Because of the name the function in the original Bitcoin codebase had.

The "Base58" refers to the fact that it is a base 58 format (it uses 58 different characters to encode the data), and the "Check" refers to the fact that a checksum is added to the encoded data.

  Are addresses generated without going over those steps still valid in Bitcoin?

It's complicated.

Base58Check is simply a way to encode a number of bytes of data into a string. In theory, if you find another way to construct a string that can be decoded by the Base58Check decoder to something with the right length and version byte, the result will indeed be a valid address.

I expect the answer to your question is no. You need to use something at least vaguely similar to a Base58Check encoder to end up with a valid address.

  To further this question, what do npm packages like bs58check do exactly?

It implements a way to convert bytes to Base58Check strings, and a way to convert such strings back to bytes.


Why the signature is always 65 (1+32+32) bytes long? A signature created by the Bitcoin-Qt client can always be decoded (base64) to a 65-byte array. This array seems (according to https://github.com/bitcoin/bitcoin/blob/master/src/key.cpp#L217) to contain a header byte, a 32-byte R part, and a 32-byte S part.

I've extracted some (R,S) pairs from some ECDSA Signatures encoded in the DER format. I found that R and S are not necessarily of 32 bytes in size. They sometimes can be 33 bytes long. Could anyone tell me why the signature created by the Qt client is always 65 bytes, or whether it is OK to always convert both R and S into a 32-byte array? Thanks.

There are two different encodings used.

Everything in the Bitcoin protocol, including transaction signatures and alert signatures, uses DER encoding. This results in 71 bytes signatures (on average), as there are several header bytes, and the R and S valued are variable length.

For message signatures, a custom encoding is used which is more compact (and more recent) and supports public key recovery (given a message and a signature, find which public key would have created it). The code you're referring to in the question is for creating such signatures.

A correct DER-encoded signature has the following form:

0x30: a header byte indicating a compound structure.
A 1-byte length descriptor for all what follows.
0x02: a header byte indicating an integer.
A 1-byte length descriptor for the R value
The R coordinate, as a big-endian integer.
0x02: a header byte indicating an integer.
A 1-byte length descriptor for the S value.
The S coordinate, as a big-endian integer.

Where initial 0x00 bytes for R and S are not allowed, except when their first byte would otherwise be above 0x7F (in which case a single 0x00 in front is required). Also note that inside transaction signatures, an extra hashtype byte follows the actual signature data.


Safe way to claim hard fork coin let said ALice own 10 BTC at address "ABC", at block height 3,456,700, it was hard-forked to Bitcoin "Zaza".
At block height 3,500,000. The stable version of Bitcoin"Zaza" wallet is available.
Thus, at block 3,456,710, Alice uses her old bitcoin wallet software and transfer out all her coins into another address "XYZ".
Then, at block height 3,500,000, she uses Bitcoin "Zaza" wallet to claim her Bitcoin Zaza.
Is this method safe?

If you have Zaza and BTC in one wallet it's suggested that you first send your BTCs away (because they're more precious and the BTC client is more trustworthy) then your Zazas so that the Zaza client can't steal your BTC.


How many more transactions per second will be possible with SegWit? On a percentage basis compared to the current theoretical limit how many more transactions per second will be possible after SegWit?
Will the answer to number 1 scale linearly with block size increases in the future?

Please exclude the impact of lightning or thunder networks for the purposes of my question.

Best estimates on effective blocksize with SegWit are 1.6-2.0 MB.

Current transactions/second possible are around 3 tx/s. Given that the effective increase is 1.6 - 2.0x, the transactions/second are also the same multiple giving us somewhere around 5-6 tx/s.

The second question is harder to answer. There's a reason I wrote "effective blocksize" since segwit transaction sizes are different. However a straight blocksize increase on top of segwit indeed would be linear.


What's raw undo data for? I see block chain is stored basically four pieces of data that are maintained:

blocks/blk*.dat:

the actual Bitcoin blocks, in network format, dumped in raw on disk. They are only needed for rescanning missing transactions in a wallet, reorganizing to a different part of the chain, and serving the block data to other nodes that are synchronizing.

blocks/index/*:

this is a LevelDB database that contains metadata about all known blocks, and where to find them on disk. Without this, finding a block would be very slow.

chainstate/*:

this is a LevelDB database with a compact representation of all currently unspent transaction outputs and some metadata about the transactions they are from.

blocks/rev*.dat:

these contain "undo" data. You can see blocks as 'patches' to the chain state (they consume some unspent outputs, and produce new ones), and see the undo data as reverse patches. They are necessary for rolling back the chainstate, which is necessary in case of reorganisations.

But I still don't understand how rev*.dat work. Can somebody explain in detail how to use them?

I found a similar question here:

so I just Reprinted:

The rev*.dat files (the "undo files"), contain all UTXOs spent by the inputs of a block. It was introduced in Bitcoin Core 0.8, and contains a concatenation of records, one for each block. This mimicks the structure of the blk*.dat files which contain blocks.

Each block record consists of:

bytes: network magic (0xf9,0xbe,0xb4,0xd9)
4 bytes: size of the CBlockUndo record (LE32)
data_size bytes: CBlockUndo record
32 bytes: double-SHA256 of the serialized CBlockUndo record

A CBlockUndo record consists of a serialized vector of CTxUndo records, one for each transaction in the block excluding the coinbase transaction. Vector serialization first writes a CompactSize-encoded length of the number of records (the transaction count - 1, in this case), and then serialized all the records themselves sequentially.

A CTxUndo record consists of a serialized vector of CTxInUndo records, one for each input in the transaction.

A CTxInUndo record consists of:

varint: 2*height (+1 if it was a coinbase output): the height of the block that created the spent UTXO
varint: creating transaction's version [only when height > 0]
CompressedScript: spent UTXO's scriptPubKey
CompressedAmount: spent UTXO's nValue

Until Bitcoin Core 0.14.x, the height is zero for all but the last output of a given transaction being spent. In Bitcoin Core 0.15 (to be released soon), it will be present for every spend.


Can someone confirm that my GPUs are working correctly? I'm specifically litecoin/scrypt mining at Multipool.us, but the web interface there is only showing about 20khash, when I obviously should be getting much more. I am using a HD 5870 (GPU 0) and HD 7850 (GPU 1) on Linux, specifically Ubuntu Server 13.10. Are my GPUs working correctly, and if not, what should I change? Thanks.

 cgminer version 3.7.2 - Started: [2014-02-04 17:14:29]
--------------------------------------------------------------------------------
 (5s):606.0K (avg):589.6Kh/s | A:1792  R:0  HW:37264  WU:16.3/m
 ST: 5  SS: 0  NB: 84  LW: 1051  GF: 23  RF: 0
 Connected to eu2.multipool.us diff 256 with stratum as user XXX
 Block: 7880a600...  Diff:1.1K  Started: [18:26:10]  Best share: 8.16K
--------------------------------------------------------------------------------
 [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
 GPU 0:  76.0C 2843RPM | 303.1K/295.0Kh/s | A: 768 R:0 HW:18955 WU: 4.0/m I:16
 GPU 1:  76.0C 1688RPM | 303.1K/295.0Kh/s | A:1024 R:0 HW:18334 WU:12.3/m I:16
--------------------------------------------------------------------------------

 [2014-02-04 18:13:02] Stratum from pool 0 detected new block
 [2014-02-04 18:13:27] Stratum from pool 0 detected new block
 [2014-02-04 18:14:27] Stratum connection to pool 0 interrupted
 [2014-02-04 18:14:28] Pool 0 difficulty changed to 512
 [2014-02-04 18:14:28] Pool 0 difficulty changed to 256
 [2014-02-04 18:14:43] Stratum from pool 0 detected new block
 [2014-02-04 18:15:35] Stratum from pool 0 detected new block
 [2014-02-04 18:15:48] Stratum from pool 0 detected new block
 [2014-02-04 18:16:13] Stratum from pool 0 detected new block
 [2014-02-04 18:16:39] Stratum from pool 0 detected new block
 [2014-02-04 18:16:50] Stratum from pool 0 detected new block
 [2014-02-04 18:17:10] Stratum from pool 0 detected new block
 [2014-02-04 18:17:49] Stratum from pool 0 detected new block
 [2014-02-04 18:18:45] Accepted 080863ba Diff 8.16K/256 GPU 1
 [2014-02-04 18:19:49] Stratum connection to pool 0 interrupted
 [2014-02-04 18:19:50] Pool 0 difficulty changed to 512
 [2014-02-04 18:19:50] Pool 0 difficulty changed to 256
 [2014-02-04 18:20:24] Stratum from pool 0 detected new block
 [2014-02-04 18:21:08] Stratum from pool 0 detected new block
 [2014-02-04 18:22:09] Stratum connection to pool 0 interrupted
 [2014-02-04 18:22:09] Pool 0 difficulty changed to 512
 [2014-02-04 18:22:09] Pool 0 difficulty changed to 256
 [2014-02-04 18:22:19] Stratum from pool 0 detected new block
 [2014-02-04 18:23:02] Stratum from pool 0 detected new block
 [2014-02-04 18:23:12] Stratum from pool 0 detected new block
 [2014-02-04 18:23:25] Stratum from pool 0 detected new block
 [2014-02-04 18:23:55] Stratum from pool 0 detected new block
 [2014-02-04 18:24:18] Stratum from pool 0 detected new block
 [2014-02-04 18:24:30] Stratum from pool 0 detected new block
 [2014-02-04 18:25:32] Stratum from pool 0 detected new block
 [2014-02-04 18:25:41] Stratum from pool 0 detected new block
 [2014-02-04 18:25:55] Stratum from pool 0 detected new block
 [2014-02-04 18:26:10] Stratum from pool 0 detected new block

Right next to HW is the number of hardware errors you are seeing.  This is an indicator that your intensity is set too high. Decrease your intensity until you stop seeing hardware errors. I usually use this link as a starting point for my configurations: https://litecoin.info/Mining_hardware_comparison


General-Purpose Hardware Wallet Fundamentally, crypto-currency hardware wallets are just devices that securely generate public/private key pairs, and sign input data when approved using a password and physical approval mechanism, right?

This seems like a generally useful capability, though as far as I can tell, the only devices available are purpose-built for a specific set of crypto-currency protocols, or some other protocol like U2F on the YubiKey.  I don't want my $100 Ledger wallet to become useless if its supported currencies (or the entire market) fall into disuse.  So is there any way to either:

Use (or modify to use) the Ledger to perform general key generation and signing?
Buy a general-purpose keygen + signing device that supports crypto-currency signature methods?

Use (or modify to use) the Ledger to perform general key generation and signing?

Yes. The things that the Ledger support are not specific to cryptocurrencies. You can write applications for the Ledger that do other things, so long as the firmware supports the cryptographic operations that are necessary.

  : Buy a general-purpose keygen + signing device that supports crypto-currency signature methods?

Yes. The cryptocurrency stuff happens externally to the cryptography. You can write an application that offloads the cryptography to a general purpose keygen and signing device (usually HSMs) and handles the remaining cryptocurrency stuff (transaction construction, node, etc.) on a general purpose computer.

Hardware wallets are really generic HSMs (although the Trezor does not contain a secure element like Ledger Nano S's do) that have had specific cryptocurrency applications built into them. They can be used for general cryptography things too, you just need to write software for that, and possibly modify firmware.


Known cases of block-withholding attacks At the moment I am doing a course about Bitcoin. The topic of the last session was the block-withholding attack and the course (being from 2014) claimed that there are no known attacks so far.
Is block-withholding a strategy used by mining pools in 2021? If so, where can I find evidence to back that up?

According to this article from 2016 it seems Slush pool had noticed or someone reported issues related to block withholding:
http://organofcorti.blogspot.com/2016/02/detecting-unintentional-block.html
Not sure if it works in 2021 and which mining pools are affected.
While researching about OP_CTV I read about trustless coordination free mining pools: https://utxos.org/uses/miningpools/ so we can assume OP_CTV fixes this however it's not activated yet.

This type of mining pool has no trusted operator and requires no coordination. This eliminates various types of mining pool attacks, such as block witholding.


How are 'Not Mineable ' cryptos able to verify transactions? NEM, Stratis, BitShares are 'non mineable' cryptocurrencies.

How do they verify transactions if there are no miners? Maybe nodes only? Or... what am I missing here?

I ask because I assume with a non mineable currency I believe miner fees, aka transaction fees, would be super low. Transactions would also clear faster. Like Ripple. Takes about 10 seconds to transfer XRP.

I'm not sure about Ripple, but I know IOTA specifically uses each transaction to confirm the transactions around it. So instead of a dedicated miner, each user is essentially a "miner" for the short time they are making a transaction.


Privacy: How should I handle UTXO's? We know that, for security and anonymity, we shouldn't reuse addresses. Also, there is the idea of change avoidance to protect ourselves from any number of change detection heuristics.

But I find that unspent change addresses ("UTXO's") are often unavoidable. Especially when using other privacy-enhancing techniques, such as equal-output CoinJoins, where you end up with many source addresses.

Is there a good technique to be able to spend these UTXO's without compromising privacy?

I don't see the problem, or what compromises privacy exactly?

Say you have UTXO A1 and B1 of 0.001, (I've never used Coinjoin so i'm just assuming here.)

Now you put both A1 and B1 through Coinjoin, Now you have A2 and B2.

How would combining the outputs of A2 and B2 compromise the privacy of outputs A1 and B1?
You used CoinJoin to break exactly that chain right?

Put the balance of the change adresses all individually through coinjoin mixing sessions and then combine the outputs? That way the chain is broken, and due to them being linked only after the chain was broken, privacy isn't compromised?

If they're too low of an amount to be send to Coinjoin, i'm afraid it's just dust, and they should be frozen to prevent them from accidently being spent  in the future when tx fees might be lower again.


Why doesn't a change address just point back to the address that sent the transaction? Why over complicate things with additional private and public keys that are hidden from the user and make it possible for backed up wallets to go out of date?  Why can't the change address just be the address that started the transaction?

The reason for not sending back to (one of the) previous addresses, is privacy. Not just your privacy - perhaps you don't care - but the privacy of everyone using the system. Reusing addresses this way makes it blatantly obvious which of the output is the real output and which is change, meaning that transaction graph analysis becomes a lot easier.

Wallet backups going out of date is a very good counter-argument to this. Security and privacy are often hard to combine. It's also the reason why for example Multibit and Bitcoin Wallet for Android up to now do reuse addresses for change.

However, a solution that has the advantages of both exists. Deterministic wallets (in particular BIP32) allow generation of new change addresses (including the ability to detect them when recovering from a backup), without revealing this to everyone in the world. In addition, they do support selective disclosure to people with whom you want to share your wallet's history.


What are "automatic coin choice pools"? Referenced in this thread about a 51% attack on feathercoin.

  This would have been a hell of a lot worse without automatic coin
  choice pools. They routed a ton of hashpower at FTC. This broke the
  attacker's control of the blockchain.

There are some pools that reroute the computational power, depending on where they can make the most money, i.e., they maximize their utility for a fixed amount of hashing power. Apparently the huge influx of computational power triggered these automatic coin choice pools to switch to the Feathercoin network, which again triggered more pools to switch.

In the end, the attacker not only had to fight against the computational power of FC, but also had to deal with the power coming from those pools, which proved to be too much, and he lost his majority.


Why is my segwit private key generating a 3 address vs a bc1 address like how I originally generated? I have the following btc private key that I generated from another application:

5KCPzu4tEAnFqwLrXUbW3GKMDSnUYY8CMie2HMRuHouSvrFhXA9

That application gives me the following segwit address:

bc1qluk574lw9t536u72n0z2ya0ksx3s0kg0evkrme

But when I goto https://segwitaddress.org and scroll down and enter in my private key at Enter a WIF private key to generate its corresponding segwit address. I get a totally different address:

37wArHq69dxRwLkHt6MY8PpmbB6qjErrbK

So do these 2 public keys actually have the same private key? How do I verify if my private key does indeed output the same public keys? I couldn't find any program to do this verification.

There is no standard for specifying whether a private key should correspond to a bech32 address, P2SH nested segwit address, or P2PKH address (1... address). The WIF format has traditionally been used for P2PKH addresses. However some wallets now will decide to instead create a P2SH nested segwit address or even a bech32 address instead. But because there is no standard for private keys that correspond to segwit addresses, it is entirely up to the wallet to determine what kind of address to give you for a private key.

In your case, the wallet gave you a P2SH nested segwit address. But it could have just as easily given you the P2PKH address or the bech32 address since the private key can be used to produce all 3 types of addresses.


What determines a bitcoin's value? I've been talking with my friend about this, and apparently, it seems that Bitcoins have some sort of value that is given to them.

On some websites like bitstamp, there are graphs and charts that indicate what the value is of a bitcoin in USD.

My question is, what/who determines a bitcoin's value, and what factors are involved when determining the pricing?  Some things I've heard are that Bitcoins are completely seperate from other currencies and do not rely on them for value, but there must be some way it's priced.

Fiat money is money that has no entity backing it other than the issuer, usually a government. When the United States dollar finally disconnected from the gold standard in 1971 it became a fiat currency. Basically the USA declared, "The dollar has value because we are 'Murica" and the world said, "OK". In actuality, the US dollar has no intrinsic value other than the fact it is issued by the United States. Most modern currencies are fiat money.

Bitcoin follows the same principle, in that its value is determined by perception. Instead of the trust of some government entity being evaluated to determine the value of Bitcoin, other factors (the technology, widespread acceptance, understanding of e-money, etc.) are taken into consideration. When magazines and online entities write intriguing articles about Bitcoin, people take interest in it, the demand goes up and so does its value v. government-back currencies. Likewise when Mt. Gox is DDoSed, a bitcoin service shutters, or $250,000 worth of BTC is stolen, people get nervous, demand drops, and so does BTC's value.


BTCPayServer vs. Bitpay or other for accepting bitcoin payments in online store For stores that would like to begin accepting bitcoins, would Bitpay or BTCPayServer be a better choice? The first seems to act as an intermediary, whereas the second does not. How do they compare in reputation, reliability, merchant anonymity (no ID submission required), and ease of use?
Ideally, the transactions are entirely in Bitcoin, and not covered later by credit card.
Are there other, better services besides these two?

It's my highly subjective opinion, but if you're not a government organization, using a service provider like Bitpay is a terrible idea. Bitpay was known to create anti-privacy features, perform KYC, and even known to stop some payments from going to the recipient. Every time you use a payment processor who is the custodian for the funds you want to receive you're in danger of losing those funds. And on top of it, you pay for that.
BTCPay is feature-packed, not only for bitcoin (segwit addresses) but also for lightning network, connectivity to hardware wallets and much more. If you want to use any compliance suit on top, cool, but you don't have to. Also there are no fees for using an intermediary. You can create widgets and use it as a patreon page, webshop, or just monthly subscription. Setup is extremely easy and running it in a light version costs less than $10 per month.


Is it possible to transmit a tx over the network that does not go into the blockchain? Can I somehow create a transaction that is broadcasted over the bitcoin network but will not go into a block?

Might be handy for SatoshiDice like confirmations.

edit:
What I have in mind is transporting information over the bitcoin network without bloating the blockchain.

This has two problems:

The network still needs to remember those transactions, so this doesn't save storage space.
If someone does a double-spend attack, two nodes could believe two different things about the state of the network, depending on which transaction they heard about first. Over time, their views of the network would diverge more and more.


How are thousands of transactions put into a block? As much as I hate to admit it, I am not very tech savvy, and as such, I am fairly confused about the concept of the blockchain. I understand that the chain holds information about previously approved transactions that are grouped together into blocks. How exactly are these blocks formed? Also, does each transaction have its own hash? If so, how are all of the hashes grouped together into one has for the block?

How exactly are these blocks formed?

First a miner decides which transactions to include in their block (usually they run algorithms that maximize its profit), and collects the transactions fees in the block.

  Also, does each transaction have its own hash?

Yep, transactions are named with their hash. For example the transaction c58523726c33e982a69ff092f56d782790ece31185bd4b824e36002e5f507e1e is called c58523726c33e982a69ff092f56d782790ece31185bd4b824e36002e5f507e1e.

  If so, how are all of the hashes grouped together into one has for the block?

That's a complex process named "Merkle root".


Can we design the protocol, so that an address can only be used once as an output in a transaction? Most users reuse their addresses for deposits (ie. they receive money more than once on a given address).
Can the protocol be designed in such a way that an address can be used only once as an output in a transaction?
I guess there would need to be a way of quickly looking up if an address was already "used-up".
Also there would need to be a way to somehow to get "next address". For eg if an address is used for dividends and it can be used only once, the dividend payer should be able to automatically get a new address without the owner's (payee's) repeated input. (a one time set up of this, would be ok)
The point of this is to enhance privacy.

These are just thoughts, comments welcome.

Alice gets her computer hacked by Mallory, and she steals her wallet. Fortunately, Alice had encrypted it with a strong passphrase. Alice wants to sue Mallory for breaking into her computer, so she gets a lawyer, Bob.

Alice's address, 10BTC --> Bob's address

Unfortunately for Alice, Mallory controls a node on the Bitcoin network, not too far from Alice, that quickly sees the transaction is from Alice (she has all her addresses), and instead relays, to hundreds of nodes at once, the transaction:

Mallory's address, 1000 satoshis --> Bob's address

Which is incompatible with Alice's honest transaction.

Now, three things happen:

1) Alice tries to send the bitcoins to a different address given by Bob

2) Alice's nodes see her transaction as a double spend, and refuse to relay any transaction spending that coin to a different address

3) Mallory's transaction eventually gets mined. Back to trying to spend the coins to Bob.

Mallory can do other mischievous things with her position, such as allowing Alice to spend her bitcoin at a church fundraiser but not an abortion clinic (assuming she knows the address of both).

The main way people lose their privacy in bitcoin today is through heuristic analysis of the blockchain, not address reuse. Introducing a new network rule to protect users against their own stupidity will not significantly improve privacy (most wallets don't reuse addresses by default anyway), and opens up users to some interesting attacks.


Avoiding Bitcoin malleable bug with implementation I'm currently working on some Bitcoin code and whilst I'm hoping I've covered my bases, I wanted to check the implementation theory.

If I understand the malleable bug it's basically...
You create a transaction address for the transaction to take place on.  At this point a transaction id is created (txid)

The txid is changed before the transaction is complete on the network, creating a second txid, that the transaction will eventually be completed/confirmed/verified on.

So if that is correct (please correct me if I'm wrong)...

A script/program transferring coins to somebody should work something like this:

A transaction address is created and given to the payee to transfer the requested balance to.
That transaction address is checked periodically for number of confirmations.  When the transaction address receives 6 or more confirmations it can be considered as completed.

Is there a better/quicker/securer way ?

Thanks

Lower the confirmation.
The security reports are specific, 1 confirmation is not safe. 2 confirmations is considered 'safe'. More is considered 'safe'.
You can "rock'n roll" with 2 confirmation.
MtGox died the epic death because their custom made wallet was accepting coins after just 1 confirmation


When an IP address in *new* table is overwritten? I'm reading the address management of Bitcoin core implementation. There is one thing I couldn't understand is in which condition an IP address in the new table of a node is overwritten?

In particular, when the node hears about a new peer, it adds that IP address into a slot in the new table, if that slot is occupied, it checks if the existing isTerrible: https://github.com/bitcoin/bitcoin/blob/master/src/addrman.cpp#L309

if (infoExisting.IsTerrible() || (infoExisting.nRefCount > 1 && pinfo->nRefCount == 0))

What is nRefCount? What is the idea behind this check?

nRefCount indicates the number of slots in the new table that is occupied by the same IP address.


How to configure CGMiner with CPU? I'd like to start mining Bitcoins on a CPU for testing purposes. I've downloaded CGMiner, compiled it and created a config file without any problems, however starting it results in an error message:

  All devices disabled, cannot mine!

What do I need to do in order for CGMiner to consider my CPU a device?

CPU mining is no longer supported. See CGMiner FAQ:

Q: What happened to CPU mining?
A: Being increasingly irrelevant for most users, and a maintenance issue, it is
no longer under active development and will not be supported. No binary builds
supporting CPU mining will be released. Virtually all remaining users of CPU
mining are as back ends for illegal botnets. The main reason cgminer is being
inappopriately tagged as a virus by antivirus software is due to the trojans
packaging a CPU mining capable version of it. There is no longer ANY CPU mining
code in cgminer. If you are mining bitcoin with CPU today, you are spending
1000x more in electricity costs than you are earning in bitcoin.


My node is not showing on Bitnodes I have a 0.16.3 Bitcoin Core wallet running. I have incoming transactions allowed and I have lots of incoming connections. However, I fail to see my node on the map of Bitnodes; it says it's unreachable, also I have tried to appoint it as a trusted node to my Samourai wallet, and Samourai also fails to connect to my node.

From my experience, sometimes the router doesn't actually respond to the UPnP setting for mapping the listening port. What always seems to be working for me is

Shutdown your node (cli stop && shutdown)
Restart your router (usually unplug, wait a minute, replug and wait a few minutes)
Restart node

Regarding the hookup to Samourai, what exactly are your bitcoin.conf settings?


I have Bitcoin Core 0.13.1 (64-bit) and I can't get prune to work First I close Bitcoin Core...

The size of Bitcoin Core it is 105GB and I want to do pruning so I can have only 2 GB. I make a notepad file named bitcoin.conf and then I write inside prune=2000 or I even tried prune=<2000>.

Then, I have put this file at the install directory or I created the folder Bitcoin and I have put the notepad file in there at the path C:\Users\<user name>\AppData\Roaming\Bitcoin

After all these I open the Bitcoin Core, but nothing happens, it still is 105 GB.

What I am doing wrong? Please help me, I can't understand!

If you put startup commands on the command line, you need to add a dash in the beginning (e.g. bitcoind -prune=2000).

However, when you put them in the bitcoin.conf, I think they have to be put without a dash (e.g. prune=2000). Yet, in the screenshot you show it has a dash. Have you tried putting it in the bitcoin.conf without the dash?


Are both CSV and nLocktime unnecessary in Eltoo? The Eltoo paper says "Notice that we could use nSequence for this purpose, but due to the interplay with OP_CSV we opted to use nLocktime". Now that Lau showed CSV not to be necessary, does that mean that there is also no reason to use nLocktime?

Anthony Towns' recent draft uses CLTV, which also uses nLocktime.


How could the dogecoin increase the limit of money supply? As far as I know, Dogecoin will only have 100,000,000,000 coins in total. But how can the supply of coins remain uncapped? How could it produce unlimited dogecoins? Is there any specific skill to make the block provide unlimited coins?

The amount of bitcoins is not set by a hard coded limit, but indirectly through the rules of Bitcoin's reward schedule.
Bitcoin's reward started out at 100 bitcoins per block, and halves every 210,000 blocks (approximately four years) until the block reward drops to less than a satoshi when it just stops.

On the other hand, Dogecoin's reward will only halve five times.
Then instead of halving again, it will go to a flat reward of 10k dogecoins indefinitely starting from Block 600,001. Therefore, it will continue to grow slowly without limit.

Also see my answer here: Reward schedule and maximum number of dogecoins?.


Balance in bitcoin-qt suddenly significantly diminished after a small transaction? I had my wallet stored on a storage provider for a while, and recently got a new computer and installed bitcoin-qt and imported my wallet.
It said I had about 2 BTC and showed INGOING transactions from 2013, which I had not touched since.
I recently then transferred 0.33 BTC to another recipient, and then immediately the bitcoin balance dropped to 0.07 BTC.
I have no recollection if I have used my wallet on other computers in the time between 2013 and now, but I thought the blockchain had a perfect copy of all transactions from my wallet.
Any idea what could have happend? Can I have spend bitcoin on my wallet on another computer in say, 2015, that never got relayed to my wallet stored on cloud storage? Are the transactions stored in the wallet.dat and not on the blockchain only?
Sorry, I am confused.

The balance that you see is the confirmed balance. This is the sum of the unspent transaction outputs controlled by your wallet that are in transactions that have been confirmed. The confirmed balance can temporarily decrease more than the amount that you actually want to send due to change outputs. However once the transactions confirm, it should be what you expect it to be.
When you make a Bitcoin transaction, it has to spend transaction outputs that were created previously. Because an output can only be spent in full, the transactions that your wallet makes typically create another output called a change output. This is a transaction output that your wallet can spend; it is sending the change back to itself.
When this happens, because the change output is a new output in an unconfirmed transaction, the value in that change output no longer counts towards the confirmed balance. It counts as part of the unconfirmed balance which is shown in the GUI as the Pending Balance. Once the transaction confirms, it will be counted as the confirmed balance.


litecoin mining very slow I recently heard about litecoin and thought it would be a good alternative of bitcoin as it is "faster" with less requirement. however, I noticed that any attempt to mine litecoins is significantly slower than mining bitcoins.
why is the hashrate so much  lower?

Litecoin, by intentional design, uses a hashing algorithm that can't be made as efficient as Bitcoin's can. Computing a Litecoin block hash requires about 1,000 times more computations that a Bitcoin block hash.


Why is the block size limited to 2mb? bitcoin is experiencing mass gross. Even some local businesses around me are starting to accept bitcoin payments. Of coarse, with new growth availability problems arise; and one is the slow and high transaction fees.

It seems the reason to this is because there is only one block every 10 minutes, and each have a 2mb size limit. Why is this? Why don't we remove the size limit? It sounds like a simple problem that has a easy solution. Wouldent miners make more coins from the extra fees from the extra transactions in each block? What our are other solutions?

(Actually that's a deep, political question, but I'll answer it neutrally)

  Why is this? Why don't we remove the size limit?

As Nate Elredge said, miners can create free transactions. RIP Blockchain.
The limit also protects the blockchain from spam attacks - the dust transactions stay in the mempool.

  It sounds like a simple problem that has a easy solution

Hard forks. It may take until forever to wait for people upgrading their nodes compatible with the HF. Also SegWit is a clever trick: "block size increase as a soft fork". In the future, the witness blocks' size can be increased so that Bitcoin won't need a block size increase anymore. (Actually this needs another complex trick, like SegWit)

  Wouldn't miners make more coins from the extra fees from the extra transactions in each block?

Nope. If blocks were bigger, the users would set lower fees and the miners would earn the same.

  What our are other solutions?

Schnorr. A signature system that is much more size (bytes) efficient. This would require a hard fork (or another soft-fork trick), but would work. Or as I said above, a newer version of SegWit that increases witness block size. Or maybe FlexTrans, a compressed transaction format (It looks like Bitcoin won't have it.) Or the most likely one: Layer two solutions: Lightning network, Liquid... They'll allow low fee instant payments, while keeping blockchain size low.


Are ripple transactions reversible like how a CC chargeback works? Does ripple take the properties of bitcoin where its irreversible?

Ripple transactions are irreversible. There are no chargebacks.


Qualities of "Pay to Nested Witness Key Hash" The lightning dev tutorial mentions the np2wkh or Pay to Nested Witness Key Hash address type, and I would like to find out more about it, so far without success.

Can anybody explain how they are different from other address types, e.g. P2PKH or P2SH?

Nested P2WPHK is just the normal P2WPKH embedded within a P2SH, to make it compatible with older wallets which don't recognize native witness addresses (bech32). Check out this for more info: https://bitcoincore.org/en/segwit_wallet_dev/#creation-of-p2sh-p2wpkh-address


Is it possible for corporate interests to incentivize securing alternate Blockchains instead of Bitcoin's Blockchain? Is it possible for corporate interests to incentivize securing POW of alternate blockchains instead of Bitcoin's blockchain?

Given the large amount of funding and/or "partnerships" announced the last month or so where established companies like Paypal and Klarna are getting into bed with Bitcoin.

I ask this because companies like Blockchain.info are getting significant "Blockchain development" funding and it would appear this is an investment in the blockchain itself:

Blockchain president Peter Smith said:

  “The company has grown exponentially in every way over the last 18 months. We are honoured to add investors and partners to the team with deep expertise in
  financial services and consumer technology.”

Also from Scott Ellison (PayPal senior director of corporate strategy):

  “We’re proceeding gradually, supporting bitcoin in some ways today and holding off on other ways until we see how things develop.”

Is it plausible/possible for corporate interests to divert miners/investors from Bitcoin's blockchain to another blockchain with better rates of return (perhaps just initially) on investment?

EDIT discussion on this over at /r/bitcoinserious

I am struggling to understand the motivation for this question, but I'll take a guess. From the Reddit post you linked, it seems like you're wondering if alternative ways of securing the blockchain will be adopted by companies who have an interest in keeping costs low? I'm not sure exactly what costs you mean here, maybe costs associated with securing the blockchain?

Short answer:

Who really knows? It's possible, but any answer is really just a best guess.

Long(er) Answer

One thing to be noted is that it's not actually companies who build tech around bitcoin that have an incentive to keep blockchain securing costs low. Companies building technology around Bitcoin (and other coins) work almost exactly the same depending on whether the system is secured with PoW/PoS/other, assuming the system meets some base security level. Rather, it's the miners who have an interest in keeping costs low, and fees high. I don't think that mining companies are being invested in as much as companies that are building tech around the bitcoin blockchain.

    Is it plausible/possible for corporate interests to divert miners/investors from Bitcoin's blockchain to another blockchain with better rates of return (perhaps just initially) on investment?

What kind of rates of return are you looking for here? If you mean rates of return while mining, then see above paragraph. If you mean rates of return for just using the cryptocurrency, then you probably won't be seeing one that is better than bitcoin any time soon, partially because of bitcoins' spreading adoptance and partially because it is a deflationary currency.

If by rate of return, you essentially mean least costly to transact, then you are talking about the fee structure in bitcoin. One of the problems with bitcoin's current fee system (in the long term) is that the people making the transactions are the only ones paying fees. Or rather, those who are just storing bitcoins are still benefitting from the security while not paying for that security. Inflationary currencies differ in that those who store it pay for the security, in a sense, by the money they have losing value over time.

Coding in a slight inflationary factor might make a currency more appealing to transact with. PoS coins have inflationary factors (as do some PoW coins, this one for example), and from this perspective, I could see companies preferring to store value in Bitcoin but transact in a different currency which has some inflation. So, I could possibly see some companies wanting to invest in other currencies that are cheaper to transact in.


When do miners include low-fee-transactions? Are Low-fee-transactions low priority to be included in block?

When do miners include low-fee-transactions?

Do they have their own formula to get priority?

Or just oldest transactions are first?

They will never include low fees transactions before high fee transactions because they have an incentive to mine higher fee transactions before lower fee ones. If they mine higher fee transactions they will make more money. If you make a transaction and pay a $1 fee while the average is $50, it is likely to never be processed. The miner will only process your transaction once there's no more transactions with a fee above $1.


Where did Staoshi Nakamoto state that bitcoin is gold or digital gold? I'm confronted by someone who states that Satoshi Nakamoto never compared Bitcoin to gold in the monetary sense (not about mining).
However, I'm sure that I recall a quote from Satoshi stating Bitcoin is digital gold which was used several years ago in the debate of Bitcoin vs Bitcoin Cash as an argument that Bitcoin is a store of value and not a means of payment.
I'm failing to find it again. The only thing I found is about Bitcoin mining, but this isn't in the meaning I need to prove.

Where did Staoshi Nakamoto stated that bitcoin is gold or digital gold?

He didn't.
Not in any of his public writings.

an argument that Bitcoin is a store of value and not a meant of payment.

In his original whitepaper, Satoshi Nakamoto was very clear that they saw Bitcoin as a means of payment.

What is needed is an electronic payment system

The whitepaper does not mention the phrase "store of value". Since they were undoubtedly aware of this property of currencies, we must infer it was not of primary importance in the motivation for the design of Bitcoin.
So it would be surprising if there is any evidence available that would conclusively prove that Nakomoto completely changed their mind about this.

See also Breakdown of all Satoshi's Writings Proves Bitcoin not Built Primarily as Store of Value

Did Satoshi build Bitcoin to serve primarily as a store of value, or did he build it for making payments?
To answer this question, I went straight to the source. Thanks to the Satoshi Nakamoto Institute’s archives I was able to read every single thing Satoshi ever posted publicly. Comments from 260 forum threads, 63 emails, and his original source code.
After reviewing all of Satoshi’s writings, I can confidently state that Bitcoin was not purpose-built to first be a store of value. It was built for payments.


Why does unspent address index differ between APIs? I've been using Blocktrail's API:

https://www.blocktrail.com/api/docs/lang/nodejs#data_overview

to get data for the following unspent address on the testnet:

2N6qMqR9D4BTkD6fS1h6Sq3kRV2FeB1L14j.

Blocktrail's API returns the index as 4, whereas blockexplorer's:

https://testnet.blockexplorer.com/api/addr/2N6qMqR9D4BTkD6fS1h6Sq3kRV2FeB1L14j/utxo

and smartbit's APIs:

https://testnet-api.smartbit.com.au/v1/blockchain/address/2N6qMqR9D4BTkD6fS1h6Sq3kRV2FeB1L14j/unspent

both return an index of 0. Am I missing something here?

both return an index of 0.

0 is the correct answer here.

  Am I missing something here?

Not sure.

I can't reproduce your problem. I'm querying blocktrail like this:

curl https://api.blocktrail.com/v1/tbtc/address/2N6qMqR9D4BTkD6fS1h6Sq3kRV2FeB1L14j/transactions?api_key=MY_APIKEY

and that returns all of the transactions for the address, none of which have an index of 4.

Can you post the line of code that calls their API?


How to recover my Copay app I cannot access my copay app because I forgot my PIN number. My app is locked with the PIN number. How can I recover it?

According to https://github.com/bitpay/copay

Copay wallet is now Bitpay Wallet. Repo at https://github.com/bitpay/wallet

So you shouldn't be using the Copay app.
it also says

WE HAVE DETECTED SOME FAKE COPAY WALLETS ON THE GOOGLE PLAY STORE FOR ANDROID THAT WILL STEAL YOUR COINS

So you need to be certain you have a genuine non-malicious app.

If you have an old Copay non-custodial wallet app, and have forgotten it's password, and did not make unencrypted backups, and did not write down a recovery phrase or equivalent,  it is probable that the only hope is to use a brute-force guessing tool like BTCrecover (not an endorsement) along with anything you can recall about the length, composition and structure of the "PIN".
Remember that the most important job of the app is to keep out people who don't know the "PIN".


How big is the NXT blockchain in disk usage compared to the Bitcoin Blockchain as of June 2014? And rate of increase? Currently I'm looking for the disk usage size of the NXT and Bitcoin blockchain size as of June 2014 and the current rate of of increase every day/week/year?

As of today June 29, 2014. NXT Blockchain takes up 512MB. and the value is at 5-7 cents per nxt.


Bitcoin - Is the  in scriptPubKey already hashed? In Bitcoin protocol, to set the output of a transaction you need a scriptPubKey which is in the following format.

scriptPubKey = OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG

Is <pubKeyHash> the address of the receiver of bitcoin or is it the hash of a address of the receiver?

A Bitcoin address is actually an encoded public key hash. The public key is hashed with SHA-256 and RIPEMD160, a version byte is added and a checksum is created, and then the address is encoded with Base 58 which gives the normal bitcoin address you see day-to-day. The pubKeyHash is actually just the SHA256/RIPEMD160 hash of the public key, before the checksum is added or encoded with Base58. So it is not the address itself, but it can be obtained from an address. It is a hash of the public key not a hash of the address.


Why is it dangerous to hard fork the Bitcoin network? In the blocksize debate it is often stated that hard forks are dangerous. This is sometimes supported by the claim that "people may lose money and must be protected". And that it's impossible to prepare for a hard fork in a few months.

What are the dangers of a hard fork?
How would people lose money due to a hard fork?
Why is it necessary to give more than a month time to prepare for a hard fork?

The following assumes that one understands what happens with a soft and hard fork. See all the answers here for a good explanation.

Say a new change is implemented in the bitcoin protocol and it requires a hard fork. Full nodes are required to upgrade to the new version (otherwise there are dangers...).

  What are the dangers of a hard fork?

The real danger is that the blockchain will split in two parallel blockchains. Miners, merchants, users (via wallets and other software), etc. that did not upgrade will support/use blockchain A and miners, merchants, users, etc. that did upgrade will support/use blockchain B.

  How would people lose money due to a hard fork?

Effectively there are now two bitcoin blockchains. The bitcoins that you had before the fork will exist in both blockchains A and B (they doubled!). A simplified example would be that: You can use your bitcoins from an old wallet and buy something from a merchant that uses old nodes. Then you can use a new wallet and buy something from a merchant that uses the new nodes with the same bitcoins. This is not even doublespend since the chains are different.

However, what this also means is that the bitcoin users and community are also split. Each blockchain instead of having X nodes (the nodes before the split) that keep it secure will have X/2 nodes. Several merchants accept bitcoin but some accept version A and some version B... and so on. This is not user friendly and it will cause much confusion. Something like that will shatter trust in the bitcoin network causing its price to diminish. Fear of future hard forks (splits) will diminish trust (and price) even more. So people will lose money indirectly since the value of bitcoin will collapse (best case scenario the price will split... but it is probably going to be much much worse).

  Why is it necessary to give more than a month time to prepare for a hard fork?

Because we want to make sure that everybody is aware of the change; miners, merchants and users. We want to make sure that they do not have objections to the change and that they agree on the upgrade. In addition wallet creators and merchants might also need time to upgrade their software accordingly (depending on the upgrade changes). The delay is for both (first) social and (second) technical reasons.

Also note that if the split is, say 95% upgraded - 5% did not (or vice versa), it will not be a big problem since the bigger chain will have the overwhelming majority and the remaining will be forced to upgrade or be ignored.


Blockchain.com wallet | 1178$ transaction with low fee = 10 satoshi | How fix unconfirmed issue I have a blockchain.com wallet.
yesterday i did a big mistake :
I customized transaction fee and set it to 10 satoshi.
Here is the tx link of that transaction.
Now after 1 day it has n't confirm.

Did i lose my bitcoin?
How many days should i wait for confirm?
Does it back to my wallet if it fail for confirmation?
is there a way to change it's fee?

I have a blockchain.com wallet.
yesterday i did a big mistake :
I customized transaction fee and set it to 10 satoshi.
Here is the tx link of that transaction.
Now after 1 day it has n't confirm.

I would consider use of blockchain.com wallet also a mistake but that's just my opinion.
Tx shared in the question: 3bbab54af84e75a3b02da3f45fafbd683b3a76005f7caf84cb57685c6a32d031
It's effective fee rate right now is 16 sat/vByte because a child transaction associated with it has used 99 sat/vByte in fc254...fd22c
Just read about 30-40% hashrate going offline, so this transaction can take few more days to get confirmed: https://twitter.com/Bitcoin_Vietnam/status/1383452911632412684
If the transaction is really urgent, maybe you can try CPFP with the transaction fc25499e2829cc9851ddf70ad0074f0494231413041ee8bfcd6e64c9814fd22c.

Did i lose my bitcoin?

No

How many days should i wait for confirm?

It's difficult to predict this because transactions are prioritized by miners based on fee rate. You can check the visual representation of it here by searching for your transaction: https://mempool.observer

Does it back to my wallet if it fail for confirmation?

It will remain in the mempool of most of the full nodes until it's confirmed considering the fee rate.

is there a way to change it's fee?

I think you already tried CPFP with the child transaction: fc25499e2829cc9851ddf70ad0074f0494231413041ee8bfcd6e64c9814fd22c
You can use this calculator for CPFP in future: https://cpfp.djbooth007.com/ however it only helps if the child transaction is RBF enabled.
To learn more about CPFP: https://bitcoinops.org/en/topics/cpfp/
Open source bitcoin wallets that support RBF, segwit which can be used in future for managing your transactions in a better way and pay less fees:

Bitcoin Core
Electrum
Wasabi
Sparrow
Samourai
Bluewallet
Green


Web wallet making direct RPC calls to bitcoin node Is it good idea to make direct RPC call's to node computer to generate web wallet addresses

here is what i am trying to implement
i want to create new web wallet based on bitcoin and want to allow the users to create their own wallet , and also send and receive the tokens or cryptocurrency

If you want to do it from front-end (web browser) it's not a good idea because you will expose an access to your bitcoin node so anyone able do anything with you bitcoin node, if you want to do it on the server so it is normal practice.

Just don't expose your RPC node access, allow connections only from localhost.


How's Blockchain like "magical Smart Contract"? Please keep everything like I'm 5. I don't know computer science or programming. Please help me understand this ELI5 comment? I simplified names.

Bob opens a candy shop called BCS (Bob's Candy Shop).
He has no idea how taxes and all this adult stuff work so he asks his brother Charlie, a smart IT guy, to write him a magical SmartContract that cares about everything. [Question 1] He just needs a buyer to show the QR code Charlie gave him.
Alice comes by to buy some chocolate. She scans the QR code with her phone and sends the amount to the SmartContract Charlie made.
This contract automatically orders new chocolate and pays for it. The chocolate is already on its way to BCS. The taxes are calculated and stored in the SmartContract. This cares about paying the taxes and tells the taxman some other stuff in order to make taxman happy. The rest gets transferred to Bob's account. This all happens magically and faster as Bob can say "Thank you".
After the first day he buys a ticket for the film "Frozen" from the money he just earned. [Question 2] He only has to copy the address code which the cinema has on their website. He sends the amount of money and the name of the film to this address. The magical SmartContract of the cinema sends the ticket back.
Bob coincidentally meets Alice in the cinema. Both loved the film.

What does this mean?  Buyer like Alice has QR Code. Why Charlie gave Bob QR code?

This is just QR Code and buying movie ticket online What do with Block Chain?

Where's Block Chain in this analogy? Does Blockchain suppose be the "magical SmartContract"?

Bob's Candy Shop

What does this mean?

Sadly I think some of it is nonsense. Or at least overenthusiastic. Firstly when the author says taxes I think they are only referring to sales tax in the USA, not to other taxes such as income tax. Secondly I'd be very surprised if the taxman wants to receive individual tax payments for each customer transaction, normally these sort of taxes are paid periodically - e.g. at the end of a month. Thirdly, tax is often complex, there are often different tax-rates for different categories of product, different tax-thresholds and so on. Fourthly, I suspect the US taxman wants to be paid in USD not BTC and will want the unit-conversion to be based on an exchange-rate from a specific source - I don't think Bitcoin payment scripts have access to this sort of external data.Therefore I'd by very surprised if any but the most simple tax payment could be encompassed wholly within a purely  Bitcoin transaction without some off-chain support.

Buyer like Alice has QR Code. Why Charlie gave Bob QR code?

I believe the author is probably just referring to the standard way that a seller communicates a receiving-address to a buyer. Nothing special there.

This is just QR Code and buying movie ticket online What do with Block Chain?

If you purchase anything with bitcoin, the transaction involves a bitcoin-script. The transaction details, including this script are recorded in the blockchain.
The script is written in a simplified programming language and in an abstract way defines the parties involved and defines how they must prove they are entitled to spend the proceeeds.
There are some standard scripts.

Where's Block Chain in this analogy? Does Blockchain suppose be the "magical SmartContract"?

The blockchain is simply a list of transactions. It is like an accountants journal.
Smart contracts are either in the bitcoin-script in the transaction details or in some extra layer of software that sits on top of the Bitcoin network and only uses the bitcoin blockchain for final settlement (e.g. monthly reconciliation of accounts) not necessarily for each transaction.

Smart Contracts in Bitcoin
Wikipedia says

Bitcoin provides a Turing-incomplete script language that allows the creation of custom smart contracts on top of Bitcoin like multisignature accounts, payment channels, escrows, time locks, atomic cross-chain trading, oracles, or multi-party lottery with no operator.

The article refers to this PDF file: Atzei, Nicola; Bartoletti, Massimo; Cimoli, Tiziana; Lande, Stefano; Zunino, Roberto (2018), "SoK: unraveling Bitcoin smart contracts" (PDF), 7th International Conference on Principles of Security and Trust (POST), European Joint Conferences on Theory and Practice of Software

ELI5
This is the problem with ELI5. Many explanations to five year olds are of the form: "If you don't eat your greens the bogeyman will eat you in the night". You are not a five year old and are unlikely to find those sorts of explanation satisfying.


Creating Testnet Bitcoin Transaction with bitcoinjs-lib I'm trying to setup a simple bitcoin testnet transaction using the bitcoinjs-lib npm module.  It seems like I'm building the transaction correctly, and I receive the hex code but I think I'm unable to broadcast my transaction for some reason.  Here is my code:

const address_1 = 'mzMVV43nRcdGdL9D6xuMez2GkHq8oN1965'; //balance: 130281960 satoshi
const address_2 = 'moCytanji9FNUsDJWVeDGdEFxtGT5psHM6'; //balance: 0 satoshi

const input = {
  sender_prev_txid: 'efc912c7ea9b6eafe129c5fcc64c76d8adc87120bf09196e56c39ced84e6eb36'
};

const output = {
  address: address_2,
  satoshi: 130200000
};

const createTestnetTransaction = (wif, input, output) => {
  const transaction = new bitcoin.TransactionBuilder(bitcoin.networks.testnet);
  const sender = bitcoin.ECPair.fromWIF(wif, bitcoin.networks.testnet);

  transaction.setVersion(1);
  transaction.addInput(input.sender_prev_txid, 0);
  transaction.addOutput(output.address, output.satoshi);
  transaction.sign(0, sender);
  console.log(transaction.build().toHex());
};

createTestnetTransaction(wif_1, input, output);

Using the following hex code:

010000000136ebe684ed9cc3566e1909bf2071c8add8764cc6fcc529e1af6e9beac712c9ef000000006b483045022100ce67916a053e94faf940e81ae665fc81daae226d1a70e7a5bc82adac302a290802207b564151889dd22b9e755297ca502b06f1345106296379762daeae2ac46d0af301210226a0c89db3a526fc5751606bf2592bd1477a4ac0d95616a4dd6b01ba65080a96ffffffff01c0b1c207000000001976a914545ad9c5df8da219b16f8c844498090aa88a764c88ac00000000

I receive the error: 'Error validating transaction: Transaction efc912c7ea9b6eafe129c5fcc64c76d8adc87120bf09196e56c39ced84e6eb36 referenced by input 0 of a7f8e0b48c77b5c192f301d655dffcedee1bd8aac2a5a058bb9552b4ff711002 has already been spent..'

If someone could help point out what I'm doing wrong and help my complete the transaction that would be great, thanks!

The input you are trying to spend appears to be vout 1 in the tx.

Your current code tries to spend vout 0, which has already been spent. Try changing transaction.addInput(input.sender_prev_txid, 0); to transaction.addInput(input.sender_prev_txid, 1);


How to export public key for an address in bitcoin-qt? With the probable increase in demand for multi-sig (P2SH) addresses, and since the procedure for creating such addresses requires that each participant provides the uncompressed public key for an address under their control, I find it surprising hard to find documentation on how to export the public key of a bitcoin address.

So for the benefit of future searches: How exactly to you get the public key for an existing address for which you have a private key in bitcoin-qt?

And the answer is:

copy the address in question from your "Receive" address list
Help -> Debug window -> Console
type: validateaddress <address>

where <address> is the address you copied in step 1.

The command validateaddress will output a number of key-value pairs, one of them being "pubkey".

Edit: bitcoin-qt creates compressed keys (as you can check in the iscompressed key-value). If you need uncompressed keys you can use something like https://coinb.in/


How to confirm my node is on the network? I wanted to verify that my node is on the bitcoin network. For this I used the 'getnetworkinfo' command on my bitcoincore console and was able to optain my node's IP address. This is: 2001:0:9d38:6abd:18e2:3f37:8f79:532e
I then entered this address and port (8333) into https://bitnodes.earn.com and my node checked out.
However my node does not display, when I look at the map of live nodes at: https://bitnodes.earn.com/nodes/live-map/

Can someone tell me why my node is not appearing on the live map?

Can someone tell me why my node is not appearing on the live map?

It is likely due to the software that they are running and it does not necessarily see your node. You don't have to be on the map in order to be online. You don't have to be listed on any website in order to be online. That you are not on the map should not concern you as it does not matter. It's just a fancy graphic and does not actually mean much.

You can check if you are connected to the network by using the getconnectioncount or getnetworkinfo commands. Those will tell you how many connections to other nodes that you have, and if it is more than 0, then you are connected to the Bitcoin network.


How to remove an address used for signing from the key pool? The message signing feature available in the Bitcoin-Qt client lets me prove that I own a Bitcoin address.  I don't wish for this address to ever be used for a future transaction however.

Is there a way I can get the private key (and address) removed from the key pool so that it will not end up being assigned when I click "New Address" or used for the change address in some future transaction?

If so, what is the command and syntax?  (Presuming I do this from the debug window).

I am not a developer, but I believe that once you assign or create the address in a new account (you can name the account "Signing Key"), and then don't touch the account, this address will never be reused. Except only after there are some bitcoins sent to it.


can i run a full node on a laptop without a 3rd party router? i am  using verizon fios and have attemped to connect to full node. verizon said that i can n0t do it on their router and would need to purchase a 3rd party router and daisy chain to theirs. Any suggestions would be appreciated. thanks.

This may be a good start.

https://bitcoin.org/en/full-node#configuring-dhcp

There may be more specific info about configuring a Verizon router on their website.

There are services that allow routing to your node and I believe Verizon routers support using dyn.com and other DNS services - it may be in an advanced configuration tab in the router UI.

https://dyn.com/remote-access/

It depends on what you are trying to do - but this should point you in the right direction.


Abrupt increase in difficulty of proof-of-work I am simulating a private bitcoin network that I started with the initial difficulty set to (1/2)^16, however after about 20 blocks of mining on the network it increased to 1 and has been constant since then. As far as I understand from the source code, it is supposed to increase after every 2016 blocks, so how did it increase after only 20 blocks.

Change of powLimit in my bitcoind instances.

strNetworkID = "regtest";
        consensus.nSubsidyHalvingInterval = 210000;
        consensus.nMajorityEnforceBlockUpgrade = 51;
        consensus.nMajorityRejectBlockOutdated = 75;
        consensus.nMajorityWindow = 100;
        consensus.powLimit = uint256S("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
        consensus.nPowTargetSpacing = 10 * 60;
        consensus.fPowAllowMinDifficultyBlocks = true;
        consensus.fPowNoRetargeting = false;

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

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

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

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

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

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


What would be the easiest way to test the submitblock method? I'm constructing a customized miner, and I'd like to check if the submitblock method would work properly when connected to mainnet. What would be the easiest way of doing that using RPC calls and bitcoind?
Which alternate network (testnet, regtest, signet) would suit better for this kind of test? (I'd like to use something with a very low difficulty)
Should I try to remine the genesis block, or should I try to create my own blocktemplate to be mined? And how could I do this?

regtest is the test network best suited for this kind of testing. While it does still have a PoW requirement, the work required is basically negligible. It also does not do retargeting so the difficulty does not change. This allows you to create blocks at will. So you can use the regtest network option in order to test that your code is creating blocks correctly.

Should I try to remine the genesis block, or should I try to create my own blocktemplate to be mined? And how could I do this?

As all of the alternate networks available have genesis blocks, there is no need (nor way) to remine the genesis block. You should be creating new blocks that build on top of the existing chain. Since regtest is a local private network, all it has is the genesis block and you can add blocks on top.
You can either create your own blocks from scratch, or use the getblocktemplate RPC to get block templates that you can use. This will still work on regtest. The only caveat is that you need to generate at least 1 block after you start the regtest node in order for getblocktemplate to work. There is a generatetoaddress RPC built into bitcoind so that you can do that. This RPC will mine a new regtest block with the coins from the coinbase going to an address of your choice.


What does the Bitcoin Core linearize script do? What use cases would make use of it? What does the Bitcoin Core linearize script do? The Bitcoin Core docs state it will:

Construct a linear, no-fork, best version of the Bitcoin blockchain.

By "linear, no-fork" blockchain does that mean throwing away orphan/stale blocks (blocks that were successfully mined but didn't make it into the blockchain due to competing mined blocks)?
What use cases would make use of this linearize script?

By "linear, no-fork" blockchain does that mean throwing away orphan/stale blocks (blocks that were successfully mined but didn't make it into the blockchain due to competing mined blocks)?

Yes.

What use cases would make use of this linearize script?

The script was used to construct the bootstrap.dat file that was previously used to quickly sync new nodes. This method of node initialization has been deprecated and remove as headers-first syncing is faster.