txtnindex=1 but balances still zero? I'm running a full node (v0.16.0).  I added txnindex=1 to my configuration file and restarted the Bitcoin-Qt. It took 2+ days to build the index but when I check addresses with known final balances>0 the amount is still zero. For example...

REMOTE FINAL BALANCE=66.76870249 BTC:

https://blockchain.info/address/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

LOCAL FINAL BALANCE=0:

let address='1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
client.getBalance(address, 6, function(error, balance, resHeaders) {
log('Address: ' + address + ' Balance:'  + balance);
});

Any ideas would be appreciated!

RPC getBalance only works with addresses valid in the local wallet. Once txindex is enabled, RPC getrawtransaction will return transaction data for any address on the blockchain.

Calculating the balance for an arbitrary address is possible because almost every blockchain explorer does it. However, calculating a balance for an address using RPC getrawtransaction is not possible.


sent btc to bcc address. what can i do to stop swearing? Both are my accounts. Two hours ago i sent 0.2 btc from breadwallet to wirex in orden to add funds to my debit card. But I mixed up addresses and they went to a bcc one. I wrote to both supports, with no answer yet. I did not know a thing about replay protection. Is it by default or should I do something to get my transaction rejected. I don't even know if it's anything I could do, in fact.

Check out this answer to know what happens if you send BTC to BCC.

As of your case, if you were holding the private keys of both the wallets, then you could simply retrieve it except the transaction fees.

But in your case, you have send the BTC to an unknown BCC address. You cannot tell who owns that address. The person who owns the private key of that address gets the BTC.

If by any chance, that address is of Wirex, then you have a good chance to get that in your account, as if they hold the private key of that address, they have access to both BTC and BCC in that address.


What happens to my Bitcoins if I leave them at Coinbase after the hard fork? So I have a few hundred dollars worth of bitcoins that I bought at Coinbase. I basically just bought them to figure out how to buy bitcoins.

Anyway, it was going to cost like $2-3 in transaction fees to move them to an external wallet so I basically decided to just keep them at Coinbase for now, even if it is the unsafe thing to do, seeing as it's only a few hundred dollars.

I just received an email from Coinbase saying that after the fork, they will only support the current version of bitcoins (BTC) and that I would not be able to withdraw the BitCoin Cash (BCC) ones.

My understanding is that after a hard fork, basically everyone gets their bitcoins duplicated. One BTC and one BCC. So given that Coinbase isn't supporting BCC, what happens to my BCC bitcoins? Are they lost somehow?

Also, I thought that my Coinbase wallet would be exactly the same as any wallet you can get on a computer / wallet. Why is it then that if I keep my coins up on Coinbase, I only get the BTC but if I have it on my own computer, I would get to have both the BTC and BCC bitcoins.

This is what Coinbase says about the November 2017 expected hard fork:
Customers with bitcoin balances stored on Coinbase at the time of the fork will have access to bitcoin on both blockchains. There is no action required from customers and bitcoin can be securely stored on Coinbase before, during, and after the fork. Read more about it here:
https://blog.coinbase.com/update-on-the-bitcoin-segwit2x-hard-fork-69426f14bc85


Compute the balance of every address As I understand, when Bitcoins are created the beneficiary's Bitcoin address is made public. Likewise, when Bitcoins are transfered, both the source and destination Bitcoin addresses are made public.

From the above, it seems that the balance of every Bitcoin address can theoretically be inferred from the public logs. Is this true? Moreover, are there lists of all Bitcoin addresses with a non-zero balance, together with the associated balances?

There is a site for that: http://blockchain.info/
Here you will find every balance for every address.


Is one Bitcoin node has One wallet only? I have configured Bitcoin core testnet on my VPS and by running bitcoin-cli command "bitcoin-cli -testnet getwalletinfo" its show wallet info and it create all new bitcoin testnet address under this.

Is there any bitcoin-cli command to create new wallet on same node ?

As of v 0.14.x, Bitcoin Core supports only one wallet.  You can't create more than one.

You can sort of achieve this by having multiple wallet files and choosing which one you rename to wallet.dat.  You have to restart Bitcoin Core to change between them.  It's error-prone and not an officially supported feature.  You can read more about it at Bitcoin-qt multiple wallets and transferring between?


What hardware do I need to get started with Bitcoin? I am new to crypto currencies and just got into bitcoin, I want to know how to  start off, which equipment would I need?

Nothing out of the ordinary hardware wise is necessarily required if you are just using bitcoin as a currency. The only case you would need specific hardware was if you intended on mining bitcoin. For just normal bitcoin transactions you can utilize whatever electronic device you are using to visit stack-exchange.

There are really only 2 big decisions you have to make as a user. What wallet do you want to use and what exchange you want to purchase bitcoin from. Below is a resource to help you decide what wallet would meet your needs (it depends on the device you are using and the security level you require)
https://bitcoin.org/en/choose-your-wallet

There are two characteristics that make up the main difference between wallets, one being the type of environment they work on ie: some are for desktop computers, some for mobile devices and some are web based and work through the web-browser. The other is if they are full validation wallets or simplified validation. As a starter I would suggest beginning with a simplified validation wallet like electrum and getting your feet wet with that. Later as you learn more about bitcoin you can decide if running a full validation wallet like bitcoinqt would be something you'd be interested in doing to help out the network.

The second thing you need to decide is what exchange you want to use to purchase your bitcoin. This mainly depends on your location and personal preference.

Here is a general resource to help you learn more information about bitcoin:
https://bitcoin.org/en/getting-started

I would suggest reading up on most of the bitcoin.org pages, the whole website is a great resources for people new to bitcoin.


Can I run bitcoind without BerkeleyDB 4.8 installed? I am using a CentOS server to build Bitcoin from source. After installing all of Bitcoin's dependancies on this build server, I have successfully built bitcoind and bitcoin-cli (the two binaries that I need). I then copy those binaries from the build server to the bitcoin server which of course is a fresh image of the CentOS. Now I'm wondering if I need to have BerkeleyDB 4.8 installed on the bitcoin server, or if I'm just not compiling/linking bitcoin properly.

The error as you would expect if BerkeleyDB 4.8 is not installed/linked properly:

error while loading shared libraries: libdb_cxx-4.8.so: cannot open shared object file: No such file or directory

It was my assumption that I can install dependancies on one server, link and build bitcoin on that server, and then move the binaries to a server without scary build dependancies on it to run the binary in a clean environment. Someone please shed some wisdom on my lack thereof.

I feel stupid...

https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md#berkeley-db

I followed that to the T and I got it working. Now I'm struggling with OpenSSL issues :/


Bitcoin transaction cpp can anyone help me with the code to get transaction info of a block of bitcoin.
I have tried to extract the transaction using postman but did not come through properly

in python to get transaction data of block you will need to import requests library so first add that "requests" library to your project then run following code

import requests
block_hash = '0000000000000bae09a7a393a8acded75aa67e46cb81f7acaa5ad94f9eacd103'
api_url_base = 'https://blockchain.info/rawblock/'
api_url = api_url_base + block_hash
headers = {'Content-Type': 'application/json'}
response = requests.get(api_url, headers=headers)
jsondata = response.json()
trasactiondata = jsondata['tx']
print(trasactiondata)

if you are using the multiple blocks then run this code in for loop and in each iteration change the block_hash value there you have to put block hash value and this code will give you all transaction data of that block


Why the difference in send/receive fees on localbitcoins.com? At least in https://localbitcoins.com/, the fees for sending and receiving Bitcoins (from/to outside localbitcoins, of course) differ by a factor of three, approximately. Currently:
0.08715 mBTC for sending, 0.26144 mBTC for receiving.

Is there some rationale for this?

This is specific to LocalBitcoins.

From the website,

  In order  to divide the costs of handling Bitcoin transactions in a
  fair manner we are introducing deposit fees for incoming transactions.
  At the same we will lower Bitcoin sending fees for all customers.

  Deposit fees will be larger than the new sending fees, generally we
  expect it to be about 3x the amount of sending fees.

Thanks!

https://localbitcoins.com/blog/new-bitcoin-network-fee-model/


Lightning Route Discovery - How to know capacity in each direction? So i have a question how routing works in the LN. I read partly through the RFC described in https://github.com/lightningnetwork/lightning-rfc but I have still this open question.

I know every node in LN has the whole network topology information, so it knows each node and each channel and with that also the capacity of a channel. But the capacity of a channel doesn't say which side is owning how much. How can we find now a valid route and be sure that there is enough capacity in each channel for the direction which is part of our route?

So for an example lets say I am node A und have a channel to node B and this one has a channel to node C. Lets say each channel has a capacity of 1 BTC, I want to send now 0.4 BTC from A to C and chose the route A -> B -> C. But now it may be that in the channel B - C the node B only owns 0.3 BTC at the moment and node C owns 0.7 BTC. That would mean that B can't send 0.4 to node C. So if I send now this transaction B would return with an error.

If I have now a longer route the possibility of such an event increases exponentially. So at the end it is very unlikely that my chosen route is valid. How does the protocol prevent a lot of tries until one finds a really valid route?

Even if you did find such a route successfully, what guarantees that B WILL use its payment channel? B can deny at any moment, because decentralization.

Also, from routing recommendations:

  When calculating a route for an HTLC, the cltv_expiry_delta and the
  fee both need to be considered: the cltv_expiry_delta contributes to
  the time that funds will be unavailable on worst-case failure. The
  tradeoff between these two is unclear, as it depends on the
  reliability of nodes.

Goes on to explain that the problem is deeper:

  If a route is computed by simply routing to the intended recipient,
  summing up the cltv_expiry_deltas, then nodes along the route may
  guess their position in the route. Knowing the CLTV of the HTLC and
  the surrounding topology with the cltv_expiry_deltas gives an attacker
  a way to guess the intended recipient. Therefore it is highly
  suggested to add a random offset to the CLTV that the intended
  recipient will receive, bumping all CLTVs along the route. In order to
  create a plausible offset the sender MAY start a limited random walk
  on the graph, starting from the intended recipient, sum the
  cltv_expiry_deltas, and then use the sum as the offset. This
  effectively creates a shadow route extension to the actual route,
  providing better protection against this kind of attack than simply
  picking a random offset.

Importantly for this answer, it ends at:

  Other more advanced considerations involve diversity of routes to
  avoid single points of failure and detection and channel balance of
  local channels.

So the answer would be, that LN just provides discovery, doesn't build a path(because a channel cannot be guaranteed to be online in a decentralized network??) so 'tries' is not a feature of core LN(but of the autopilot feature).

The autopilot can be seen here. This is where the heuristics for finding the path goes.

  The autopilot package has been signed to be as abstract as possible in
  order to allow users, developers, and researchers to plug in various
  heuristics in order to experiment with the possibilities, or attempt
  to optimize the channel sub-graph for their targeted nodes. The
  current default heuristic is a mode called ConstrainedPrefAttachment.

Also,

  This is only one example of the
  possible heuristics which could be hooked into an active
  autopilot.Agent instance. We look forward to the additional heuristics
  that developers/researchers will implement!

In short, the current heuristic implementation first selects a slice in the network, and then greedily allocates funds.

switch {
    // If we have enough available funds to distribute the maximum channel
    // size for each of the selected peers to attach to, then we'll
    // allocate the maximum amount to each peer.
    case int64(fundsAvailable) >= numSelectedNodes*int64(p.maxChanSize):
        for i := 0; i < int(numSelectedNodes); i++ {
            directives[i].ChanAmt = p.maxChanSize
        }

        return directives, nil

    // Otherwise, we'll greedily allocate our funds to the channels
    // successively until we run out of available funds, or can't create a
    // channel above the min channel size.
    case int64(fundsAvailable) < numSelectedNodes*int64(p.maxChanSize):
        i := 0
        for fundsAvailable > p.minChanSize {
            // We'll attempt to allocate the max channel size
            // initially. If we don't have enough funds to do this,
            // then we'll allocate the remainder of the funds
            // available to the channel.
            delta := p.maxChanSize
            if fundsAvailable-delta < 0 {
                delta = fundsAvailable
            }

            directives[i].ChanAmt = delta

            fundsAvailable -= delta
            i++
        }

        // We'll slice the initial set of directives to properly
        // reflect the amount of funds we were able to allocate.
return directives[:i:i], nil

[EDIT:straight answer]

  So the heuristic only uses the channel capacity to find a route?

"based on the current internal state, the state of the channel graph, the set of nodes we should exclude, and the amount of funds available"

  Does the path finding heuristic have the information which side of a channel in the network owns how much, or does it only compute a route based on the capacity of channels?

Looking at the spec example, we only get info of "capacity" of an "edge" in the graph and not how much each party owns; only the amount they are willing to transmit. As explained above, yes, it depends on capacity, but it has more properties and not just amounts.


What prevents miners in a pool from retaining the reward? From what I understand miners submit their hashes to the pool. What prevents a miner to disengage the pool as soon as she finds the right hash?

The payout address for the miners mined blocks is the pool's moderator address. If the miners are working on blocks with a different payout address (ex. their own), the pool moderator can tell and act accordingly by either banning them or simply ignoring their work.


do you need to independently create a genesis block for a new altcoin? So if one was to try to create an altcoin that was a fork of the bitcoin code would he/she have to create a genesis block independently first?

static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    const char* pszTimestamp = "anything you want";
    const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

Is changing the variable for pszTimestamp in the above function from chainparams.cpp sufficient?

If that's all that's necessary, then what is the purpose of this "gensis block generation script"*?

*From this question.

In old versions of the Bitcoin Core codebase, the genesis block was verified as a normal block. All normal rules had to apply to it, including proof of work and difficulty. This meant that if you would modify the contents of the genesis block arbitrarily, it almost certainly would not validate anymore.

Since the genesis block is actually part of the definition of the chain, there is no real need to verify it. In more recent versions, the genesis block is just valid by fiat. This means that when using such a codebase, no complicated script that "mines" the genesis block is needed anymore to define a new chain.


why does my bitcoin wallet not access funds in my coinbase portfolio? I bought and sold Bitcoin on coinbase which is now in my portfolio. How do I recover the portfolio money? I tried Bitcoin wallet but it only accesses the active Bitcoin, not the funds in my portfolio.

I tried Bitcoin wallet ...

There are many different Bitcoin wallets and the answer may depend on exactly which one you are using. For example there is "Bitcoin Wallet" for Android phones which is sometimes known as the Schildbach wallet. There is also Bitcoin Core for PCs and many others.

... but it only accesses the active Bitcoin, not the funds in my portfolio.

A typical Bitcoin wallet such as Bitcoin core or Electrum gives you exclusive personal control over some money. These are what is called non-custodial wallets - there is no third-party custodian who has custody of your money.
Coinbase accounts are custodial. So far as the Bitcoin network is concerned, Coinbase own money in coinbase accounts, not you.
Ownership of money in the Bitcoin network is determined by who holds the secret numbers known as private-keys. Money is associated with a private key. If a wallet doesn't have the private key for some money, then that wallet cannot access that money to spend it.
If it helps, imagine having bank accounts at two different banks. Your bank-statement from one bank won't include any money in the other bank. You cannot instruct one bank to send someone money that is in the other bank. Bitcoin doesn't work like banks but it does have separation of control where there are several private keys in use.

How do I recover the portfolio money?

You can, for example, get your non-custodial wallet to display an address to "receive bitcoin". Then log in to coinbase and use it's facilities to pay money to (or withdraw money to) that address.


Buying from country A, selling in country B I was curious as to whether is it legal/allowed to buy bitcoins (from a friend for example) from another country where the value is less and then sell the bitcoins in the UK, for a profit.

I'm new to bitcoin in general and still a student at University.

If this is legal to do, is there any information, or could you provide information as to how I would go about setting up a Bank Account that would accept large volumes of money going into the account due to bitcoin selling, as well as using that account to purchase bitcoins from abroad. And what are things that I should look out for, any legal issues etc?

Appriciate your time and help people.

Sure it's legal. Unless either country has outright banned buying/selling Bitcoins. I don't think there's any country that has gone that far.

You may have to report income/profit/trades to your tax office, depending on local laws. In some countries you may need to pay VAT as well.

Setting up accounts with (foreign) exchanges means that you are entrusting them with your bitcoins, money and ID (copies of passport etc.). Exchanges disappear overnight sometimes, so make sure to put that into your risk calculation.

Sending Bitcoins around the world is pretty much instant. Exchanges require up to a few hours of confirmations sometimes, but that's still nothing compared to sending your fiat money around the world through the banking system: that can take weeks and cost you many percentages. To/from some countries it's even almost impossible to send/receive fiat money (China comes to mind).

All this means that Arbitrage is not as easy as it seems and that's why there's still a price difference.


Which inputs will be spent? Say someone holds 100,000 btc.  Over time, this address has been spammed with dust by numerous parties.

Now, the oldest funds come from the previous large transaction.  If the dust is, say 0.0000101 btc, can someone send this exact amount elsewhere and get rid of the dust?  Or will the client get the oldest inputs and spend the dust from there?

Bitcoin Core doesn't use an oldest-first selection but a more complex solver, it will probably end up spending outputs you don't want to in this particular case. You can do manual selection of the outputs you want to spend using the Coin Control section of the advanced GUI, which will let you ignore the dust if you don't want to spend it.


Bitcoin Explorer - Truth or did i just got my wallet stolen? So there is this webpage being advertised: http://allseeingbiteye.tk/

And the way it is advertised is: You can be tracked! Be careful of what you pay for. Bitcoin is as insecure and non-anonymous as a public toilet.

Obviously i got interested in it and ran the application, without administrative rights ofcourse.

With my security options, applications sometimes simply does not start until they are given administrative privileges...as soon as i ran that exe i realised that this could very well be sopfisticated scam to steal my wallet.

So anyone have any information about that site?

According to a post by grue, the program from the website adds another executable to system startup, so it certainly behaves like a virus. You should get your computer checked.

Advise for the future - don't trust any .exe file unless you know the source or the owner. If you're not sure whether to trust someone or some website, ask either here, or on the forum. The community is quite sensitive about security and you can be pretty sure to get some good feedback if you ask.


Monitor a bunch of addresses for deposits I have a situation where I create one address per user through GetNewAddress(User.Id)

So, in the end, I have a lot of addresses to monitor, to see if any user has deposited money.

I can do something like this:

foreach (var User in Users)
{
  var T = GetReceivedByAccount(User.Id);
  .. do something if money arrived
}

Wait 30 seconds and repeat...

But I'm guessing it's not the most efficient.

Is there a better way to do this?

Or can I get all transactions within a specific range in the wallet and then parse them by account?

Sorry if the question seems basic, I'm extremely new to this.. got some code running for the first time something like 16 hours ago :)

We use a third party service for this - i’d recommend https://blockchainwebhooks.com - You can set a webhook for each address, and when a new transaction enters a block with this address as an input or output the webhooks will trigger and send you the transaction details. Hope this helps!


Will your shares be lost if you restart p2pool before the payout? Will your shares be lost if you restart p2pool before payout, or is there a way to change the pool setting without takng it down?

I'm not sure about the wallet address and I want to change it.

You can restart p2pool at any time without losing your shares, because your shares are recorded in p2pool's share chain and permanently associated with your payout address.

From the wiki:

  Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network's difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while.

Please note that this also means that you cannot change the payout address of the shares you've already found - you can only change the payout address for future shares. Additionally, this architecture means that you will be able to collect payouts from your previous shares without p2pool running at all!


Generate addresses without private key: Stealth addresses vs Master Public Key In my case a store owner has different POS terminals. On none of the terminals should be a private key stored! The owner has one wallet, where he wants to get all transactions aggregated, done on the POS terminals.

According to my reasearch I came up with 2 possibilities:

Stealth addresses (BIP 63), which to my knowledge is not implemented anywhere in a library, so that I could use it easily.
Master Public Key: E.g. the electrum wallet gives you an MPK by which one could derive addresses (through HD Derivation).

Now to my questions:

Is there any other approach one could generate addresses without a private key available?
Are there any problems one could face with the MPK derivation approach?
Which wallets expose the MPK and furthermore which wallets get a notice of transactions done to addresses derived outside of their knowledge (however from the seed they know)?

What Electrum describes as 'Master Public Keys' are more commonly know as 'extended public keys' and are an excellent way for a Point of Sale terminal to accept payment without being able to spend that payment.

  Is there any other approach one could generate addresses without a private key available?

Well, there's always the approach of generating all of your addresses in advance. That has the advantage of simplicity. Other than that, I don't think there are any other approaches which work as well as BIP32.

  Are there any problems one could face with the MPK derivation approach?

You mentioned that you have multiple terminals, which means that you need to avoid using the same index with the same MPK , or you'll generate the same address. You can avoid this by either using different indexes, or different MPK's.

  Which wallets expose the MPK and furthermore which wallets get a notice of transactions done to addresses derived outside of their knowledge (however from the seed they know)?

Electrum does this. It's called a 'gap limit.' It will check for transactions beyond the last address with a balance that it knows about. By default it only checks 5 extra addresses, but you can increase that. Having an adjustable gap limit is pretty common.


BFGMiner for Debian Wheezy Is it possible to install BFGMiner on Debian Wheezy?

I have been looking for a solution but I can't find one.

Download the bfgminer source code, extract the source, change directory into it.

Then:

$ dpkg-buildpackage -uc -us -rfakeroot

And it'll build a package you can install on Debian Wheezy. You will need to install "dpkg-dev" for dpkg-buildpackage and all the build dependencies, which you'll find out by running the dpkb-buildpackage command.


How are transactions efficiently distributed to network nodes before inclusion within blocks? How does the bitcoin core efficiently distribute transactions so that they are added to node transaction pools to be inserted into a future block?

I understand that each bitcoin node has a list of peers which they are in communication with.  As an originating node makes a payment, they send the payment across their peer network, which then continues the distribution process by forwarding the transactions to the peers within their peer list.

How is this process effeciently executed, such that transactions sent from one peer, sent numerous times across the network as it is distributed?  (For further clarification of the problem, see my Problem Outline below.)

In other words, how does a node resolve which peers to send new transactions to so that the transactions can be included into their local transaction pool?  If peer filtering doesn't take place, then the result would be a considerable amount of redundant, network traffic.

PROBLEM OUTLINE

Consider the following...

Distribution level #1 - Originator (A) sends a transaction to peers (B) & (C).
Distribution level #2 - Peer (B) forwards the transaction to peers (D) & (E), & peer (C) forwards the transaction to peers (F) & (G).
Distribution level #3 (Partial) - Peer (D) forwards the transaction to (C) and (G).

This is where we see the problem!  Peer (D) is completely unaware that nodes (C) and (G) have already received this transaction.  At best, (D) can only know that nodes (A)->(B)->(D) have received this transaction.  Since (D) is completely unaware of the state of the transaction in nodes (C), (E) & (F), peer (D) can potentially forward the transaction along to a high number of peers that are aware of the transaction.

Scale this to thousands of nodes and thousands of transactions and you could have a BIG problem.  How is this resolved?

Have a look into the specifications https://en.bitcoin.it/wiki/Protocol_specification

Check the "inv" --> "getdata" --> "tx" sequence of transaction distribution


Is Bitcoin PoW actually SHA256 + Merkle generation? Or have I misunderstood coinbase/append? Miners can mutate nonce (32 bits) + time (mutates once a second). This allows for 232 (~4 billion) hashes per second. That's not enough anymore for our ASICs as they perform in the TH/s now rather than GH/s. So we allowed miners to mutate the coinbase transaction, but this requires us to generate a new Merkle tree. This means that a miner needs to generate a new Merkle tree every 232 hashes. at 1 TH/s The miner must generate a new Merkle tree 250 times per second.

TLDR: Is Bitcoin PoW actually SHA256 + Merkle tree generation? And not pure SHA256?

If I'm correct in asserting that Bitcoin PoW is SHA256 + Merkle tree, does this slow the commoditization of ASICs and therefore slow decentralization, as ASICs now must be more complex than if they did with just SHA256 + nonce mutations?

You are correct that effectively Bitcoin PoW involves computing the Merkle root every now and then in addition to the hash grinding.

However, this is negligable. Even ignoring nTime rolling, the Merkke root computation is just a dozen or so hashes every 232. It's so little because not the entire Merkle tree needs recomputation; just the coinbase transaction is modified, along with n Merkle nodes above it (assuming up to 2n transactions).

As far as I know, the burden of Merkle root computation is so low that it is generally done in the miner controller rather than in the ASIC itself.


Getting Bitcoins into my wallet from MtGox I have purchased bitcoins from MtGox and they appear in my account. However, I can't figure out how to get them into my wallet.

I don't have a MtGox account myself, but you should be able to find a function on MtGox that is called "withdrawal" or similar. There it will ask you to provide your Bitcoin address and set the amount that you want to withdraw.

Be sure to use one of your own addresses from the wallet (depending on what wallet you use look for "receive payment" or "your address"), it has happened before that people used an address of one of their business contacts instead of their own.


Is it possible to recover coins after clicking on Reset Options button? I use emercoin windows wallet -
Emercoin Core version v0.6.3emc (64-bit)

I clicked the button - Reset options.
The app restarted,
and balance changed to 0.
The wallet was completely out of sync after restarting.
But even after syncing all blockchain the balance doesn't change.
The balance equals 0.

My intention was just resetting options to default
but my coins have disappear.

Does it mean that I've completely lost all my coins ?
Or there is a way to restore coins ?

Need help.

I didn't create any backup wallet.

This post helps me detect a problem and fix it.

  It looks like you had set a different data directory and resetting the
  options cleared that setting.


How an LN node can be sure about existence / liveness of an individual path of channels? Assuming nodes A and B do not have a direct channel between themselves and previously they could find an indirect path of channels and finalize their payment successfully.

After a while, they decide to make another payment, and to avoid waiting for another routing, they prefer to use the same previous path. However, since the network state after each transaction is changed (even without opining new channels or closing previous channels and even all nodes remain alive, yet the direction of the balances in individual channels has been changed).

A and B therefore need to be sure about the situation of previous path they had used in their previous payment.

Is there a reliable approach for that?

Short answer: no (unless you control all nodes on that path)

However the problem about uncertainty is part of the routing anyway. You know the topology of the network with the cltv deltas, routingfees and capacity of ech channel. Yet you never know how the capacity is split into balance of a channel. so once your lightning nodes computed a potential path the onions are constructed and the routing process starts and will only be successful if all channels on the way have enough satoshis on their side to forward the payment. The next time this path is supposed to be used again they have to construct the onion and get feedback from the nodes on the path to see if the payment can actually be routed through.

So to some degree it seems to be of little use to store previous paths that have been used.

if however channels would be closed or new capacity is spliced in (once splicing is implemented) nodes would get this information via the gossip protocol.


Why was the maximum target set to 0xffff0000000...? Is there any specific reason why the initial target was set to this:

00000000ffff0000000000000000000000000000000000000000000000000000

Why not the maximum value for a 256 bit number:

ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

I admit that I don't know for sure, but I have a guess.  Since Satoshi was mining by himself for the first blocks, he probably set the initial target to whatever would take approximately 10 minutes to mine a block on his CPU.  Had he set it to the maximum value for a 256 bit number, he would have mined the first 2,016 blocks almost instantly, and then immediately retargeted.

Because of the large number of blocks mined in such a short amount of time, this would likely have caused the retargeting calculation to produce a less-than-perfect result, meaning that the next 2016 blocks may be mined either far too quickly or far too slowly.

It was probably just better for him to initialize the target to a reasonable value, rather than force the algorithm to run its course in order to produce one.


Does Bitcoin protocol define how miners do the selection from their set of txns? We know that miners select a set of txs from their local memory pool and put them into a block before they do PoW.

I wonder whether this selection process is defined by the protocol or do even "honest" miners can select them in the way they want, e.g. they select the subset that maximizes tx fee.

No, the selection process of transactions to include in a block is not defined in the protocol. The only transaction that miners have to include in a block is the coinbase transaction, i.e the transaction that reward them with new bitcoin(s) if they successfully mine the block. But even if miners don't have to include other transactions in a block, they will because it allow them to collect the transaction fees.

Miners in general choose to include transactions with the higher fees. In the bitcoin core client, the transaction date also plays a role: older transactions are prioritized over newer ones, so that transaction with a lower transaction fees still get a chance to be included in a block, but later.

Edit: as per Pieter Wuille comment, older transactions arent prioritized anymore from v0.15.0


Is there any way to directly query the block chain for the body of a transaction given its hash? Blockchain.info provides this functionality in a simple API like so:

https://blockchain.info/rawtx/fc15f762e8dbbdd407534047ef2a9211ca0e79c3625d5fe73cdacade4f9118d6

However, I would prefer to make this query directly against the network blockchain rather than to a third party like blockchain.info.

You can use JSON-RPC to achieve this. The only missing information will be the relayed_by field.

To use the JSON-RPC API of your client edit your bitcoin.conf file like this

rpcuser=user
rpcpassword=password
rpcport=8332
server=1

Then you can use a library to query the API like JSON-RPC for PHP

You can also do it on a much easier way by using the command line

./bitcoind getblock c15f762e8dbbdd407534047ef2a9211ca0e79c3625d5fe73cdacade4f9118d6


I sent a transaction from Electrum to Trezor wallet - the transaction has disappeared and the fund taken Any help please??
I think I lost 0.7 btc
Transaction
d18f69c508d9dd5bb5a5038894a79a2c355100a6a185b8aac1df3494ed131e94
Summary
In Block    Unconfirmed
Total Input 0.6845923 BTC
Total Output    0.68444386 BTC
Fees    0.00014844 BTC
Details
d18f69c508d9dd5bb5a5038894a79a2c355100a6a185b8aac1df3494ed131e94 ⚠
first seen Sun, 03 Jan 2021 03:54:26 UTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02577756 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00758608 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01485129 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00674268 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01514086 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00816756 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00962341 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02080733 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02851153 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02640941 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.018482 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01490001 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02437251 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00757503 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.04133579 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00165945 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01234919 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01105445 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00809206 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02749301 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01243002 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01193373 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00977051 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00124668 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02964461 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.0242969 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01011918 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01134724 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02825585 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00690033 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01524587 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00983011 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.00729229 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01968774 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.03067904 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01569381 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.01044657 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.0287376 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.02337908 BTC
➡ 1LLzrwBEHWsRHk5YLLTFY4w4BqdfbDLghm0.03672393 BTC
36UjonxSP7xBwxvpQghVBGFpXNJqdLX9zS0.68444386 BTC ×
Fee: 0.00014844 BTC
UNCONFIRMED TRANSACTION!0.68444386 BTC
Raw Transaction
{
  "txid": "d18f69c508d9dd5bb5a5038894a79a2c355100a6a185b8aac1df3494ed131e94",
  "hash": "d18f69c508d9dd5bb5a5038894a79a2c355100a6a185b8aac1df3494ed131e94",
  "version": 2,
  "size": 7381,
  "vsize": 7381,
  "weight": 29524,
  "locktime": 664234,
 ...

I can't find d18f69c508d9dd5bb5a5038894a79a2c355100a6a185b8aac1df3494ed131e94 on any block explorer. It seems that you managed to redo the transaction with f1aa25811dd5487deb693a5bde124f674c2bf954de95df40bc23749f706b8968, since it has a lot of similar input values.
In the transaction you posted, it seems that you created a raw transaction that didn't claim the change: all funds from inputs that are not assigned to outputs are transaction fee. After defining the recipient, you must claim all the remainder in a change output to yourself.
If you're experimenting with raw transactions or some new software you're writing,
I would emphatically recommend that you use testnet instead of actual Bitcoin.


Trying to calculate the strength of a brainwallet created with a custom diceware I want to create a brainwallet using a custom diceware since I don't like the original one. Instead of 7776 words it has 46656 because I use 6 dice for each word instead of 5.

So this is what I got so far, please tell me if I made a mistake:

2 ^ (log2(46656) * 5) / (1 * 10^15) / (60 * 60 * 24 * 365) = 7 years

2 ^ (log2(46656) * 5) is the entropy for a brainwallet of 5 words
1 * 10^15 is 1 Phash/s, which is the hashing power I'm assuming for this attacker. I don't even know if this makes sense, because an attacker doesn't need to start over for each brainwallet he wants to crack.
60 * 60 * 24 * 365 represents a year in seconds

you forgot to divide by 2.

7 years is exhaustive, but on average you'd expect it to take 3.5 years to crack.

10^-15 * 46656^5 seconds / 2


Using confidential transactions with plain-text ouputs I was reading about Confidential Transactions (CT) and understand the basic idea behind it. But what if CT must be bootstrapped on an existing Blockchain such as in Bitcoin, where the amounts are for now visible in the outputs?

Is it possible to create a CT transaction, where the inputs reference UTXOs that are not confidential (just as in Bitcoin now), but creating new outputs that are hiding the value using CT's scheme?

What would the network have to do to check that the sum of commitments in the outputs are the same as the sum of clear-text amounts from the inputs?

//Edit: I found some help from the mailing list describing how CT can be implemented as a Soft Fork to Bitcoin: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-January/012194.html

But I am still not sure how the network can make sure that the confidential transaction outputs from "blinding transactions" sum up to the amount that is being stored into the GCTXO.

Similarly when "unblinding", how can the network be sure that the sum of commitments from the confidential inputs is the same as the amount that is being spent from the GCTXO?

//edit2:
The only way I can think of is that the blinding tx also contains a proof using the sum of commitments in the outputs. That sum of commitments corresponds to a value equal to the amounts from the inputs (minus the tx-fee).

More precisely, a CT commitment looks like xG+aH, with G and H being generating points, x a secret key and a being the amount locked with the output. For a proof we sum all commitments from the outputs: C=xG+aH + yG+bH + ... + zG+cH = (x+y+...+z)G + (a+b+...+c)H. A proof can then be provided by subtracting (a+b+...+c)H from C and signing it with the corresponding secret key: C-(a+b+...+c)H=(x+y+...+z)G, where (a+b+...+c) is exactly the amount from the inputs (minus tx fee), and a signature is provided from the public key (x+y+...+z)G, where (x+y+...+z) is the private key.

But from reading the specification I cannot see where such a proof/signature would be provided with the blinding transaction?

Is it possible to create a CT transaction, where the inputs reference UTXOs that are not confidential (just as in Bitcoin now), but creating new outputs that are hiding the value using CT's scheme?

Yes, you include a dummy blinding factor.

  What would the network have to do to check that the sum of commitments in the outputs are the same as the sum of clear-text amounts from the inputs?

With the dummy blinding factor, it would do exactly the same a normal CT tx.

The answer was a lot simpler than you thought.


What values are hashed in the SHA-256 algorithm, and what would be the next iteration until a possible header is found? I've been doing a lot of reading on mining and software related to mining but I can't quite get my head wrapped around the specific nature of what is being hashed together. So far I feel like the current block header, and a nonce are hashed together in hopes of finding a hash that is less than the current target, if it is, you get 25BTC. Here's where I am confused, according to the psuedocode https://bitcoin.stackexchange.com/a/3047 . The only value that changes is the nonce, and that is a fixed possible hex/integer ex: from 0 to 0xFFFFFFFF.

How is it that the difficulty can increase if there are a finite number of attempts to change the nonce?

Am I right about hashing together the block header with the nonce?

I referenced this https://en.bitcoin.it/wiki/Proof_of_work and it makes perfect sense.. except for the fact that I still feel like the nonce is the only value that changes.

Maybe the 32-bit nonce yields way more possibilities that I can fathom and hashing together every possible nonce value is actually what is done.

Thanks!

When the nonce range is exhausted, miners change the extraNonce field of the generation transaction. This changes the Merkle root in the header and allows a new range of nonces to be attempted.

Since the Merkle root is 256 bits, this can be repeated indefinitely.


Where does the entropy of BitcoinJS' makeRandom() come from? The library BitcoinJS (https://github.com/bitcoinjs) has a method called makeRandom(). Where does its entropy (randomness) come from? Is it as secure as the method from http://bitaddress.org/ (moving around the mouse), or even more so?

This code calls this code, which calls crypto.getRandomValues, which is a trustworthy cryptographically secure random number generator. It's secure enough to compete with bitaddress.org, as long as one's browser was not hacked.


Are all private keys required to create a multisig bitcoin address Do all 3 private keys in a 2-of-3 multisig wallet have to exist on the same device at some point in order to generate the bitcoin address?

It would be ideal if the 3 private keys never existed on the same device together but it seems the examples I've found assume all 3 exist simultaneously when generating the bitcoin address and redeem script.

You do not need private keys at all to generate multisig m-of-n address!

You do need public keys. Yes, three for m-of-3 and eleven for 5-of-11 (for example)


How does blockchain.info resolve adresses? I wonder how sites such as blockchain.info resolve the owners of public bitcoin addresses. For example, blockchain.info knows that the xkcd donation address 14FHqYSgA... belongs to xkcd.com. It is available at xkcd.com/bitcoin, but somebody must be crawling all websites searching for that folder, right?

I assume there is a directory where this kind of websites are stored so that blockchain.info can look it up. Where is it and is there a public API available?

Thanks!

There's no central directory for this information.  You could scrape the Blockchain list if you wished, but if you do so you're relying on the accuracy of their information.


General Block Chain questions / Js Block Chain First of all. I'm very new to block chain technology so please forgive any noob questions.

So I'm going a lot on the following tutorial on youtube regarding the knowledge that I do have other than general block chain theory that I've learnt over the past week.

https://www.youtube.com/watch?v=zVqczFZr124

People say that it isn't possible to shut down the block chain but the more that I look into the subject it doesn't matter how much tech you have behind your block chain there has to be an entry point I.E to the master node with a dedicated I.P address. If this is the case then how is it not possible to shut it down? Wouldn't it be a simple fact of blocking the ip like it has been done for so long in other countries?
Proof Of Work: I get that there has to be some sort of way of proving the source of information came from a certain contributing node. However I'm not totally understanding the point of the POW. For eg, if there was 100 block nodes connected to various master nodes then the information that would be processed by each node would be then emitted by each node to the master nodes which would then process the master nodes for insertion into the ledger, correct??? If that is the case then what is the point of the POW/High powered computer specs etc?? isn't it just using up computer resources with the algorithm??? isn't there nay other more efficient way to do this. It sound like a job that any average computer could do in this day and age without having to max out the CPU etc. This is just something that I'm not understanding.
Proof of Steak and Proof of Minimum: I'm quite confused with this type of mining. I get that they say "Ok, well we want you to hold on to your tokens for a long time and then we'll reward you with coins (Mining)", But for instance if I said that I want all my customers to believe in the tooth fairy and paste it in their social profiles on my block chain based network and that is the type of mining we choose, then how does this help with the actual job at hand ??? I.E the POW method is one way to prove that they did a job etc but thats the point. There is a job to do. I don't get how POS/POM takes care of this.
Supposing that the above questions have been answered then I'm looking in to different way that I could do a different type of block chain. More like a proof of participation. Simply being a relay point of information, then I'm seeing issues.
If I did master nodes to store all the information in the ledger and insertions etc then then the information has to pass this point of entry first and then relayed to the block nodes, correct?

Presuming I'm understanding things correctly etc then can anyone point me in the right direction of how to implement the two methods above to the block chain in the tutorial?
Last question is I don't see many articles or people suggesting javascript for a block chain. I personally can't really see any issues with it. As far as I can see this is more of a theory implementation that could be pretty much implemented in any language. But if I'm understanding that wrong then I would really appreciate feed back.

Thank you.

People say that it isn't possible to shut down the block chain but the more that I look into the subject it doesn't matter how much tech you have behind your block chain there has to be an entry point I.E to the master node with a dedicated I.P address. If this is the case then how is it not possible to shut it down? Wouldn't it be a simple fact of blocking the ip like it has been done for so long in other countries?

That is completely incorrect. There is no master node nor is there any central source that dictates what the blockchain is. The blockchain is distributed to all nodes, and all nodes update their local copy of the blockchain according to the consensus rules that the node is following. If everyone is following the same consensus rules, then everyone will converge onto the using the same blockchain. However, there are some circumstances where a node will not use the same blockchain as all other nodes, but these only happen when the node is under attack.

  Proof Of Work: I get that there has to be some sort of way of proving the source of information came from a certain contributing node. However I'm not totally understanding the point of the POW. For eg, if there was 100 block nodes connected to various master nodes then the information that would be processed by each node would be then emitted by each node to the master nodes which would then process the master nodes for insertion into the ledger, correct??? If that is the case then what is the point of the POW/High powered computer specs etc?? isn't it just using up computer resources with the algorithm??? isn't there nay other more efficient way to do this. It sound like a job that any average computer could do in this day and age without having to max out the CPU etc. This is just something that I'm not understanding.

Again, there is no master node that inserts things into the blockchain.

The proof of work is something that is done by miners to show that a certain amount of work was done to produce this block. This secures the blockchain because nodes will use a blockchain which has the most proof of work and is valid under its other consensus rules. This means that if an attacker wished to defraud someone by convincing their node that a different blockchain were the real blockchain, then they would have to do the same amount of work that has been done on the real blockchain. At that point, it would be far more cost effective to simply be an actual miner instead of maliciously attacking someone as the cost of doing that much work is very high.


Why is wallet.dat BerkeleyDB instead of LevelDB? Why wasn't wallet.dat migrated to LevelDB?

Is it because

BerkeleyDB is better at [something]
Backwards compatibility

BerkeleyDB support  ACID (Atomicity, Consistency, Isolation, Durability). Leveldb no ACID, I think this is the main reason using BerkeleyDB.


Why is the block header 80 bytes, not 128 bytes (= two SHA-256 blocks)? According to the Bitcoin Developer Reference, the block header is 80 bytes total:

BYTES   NAME
4       version
32      previous block header hash
32      merkle root hash
4       time
4       nonce

As I understand it, the midstate (1st SHA block) contains 64 bytes of the block header (which fields in particular I do not know, but I do know it doesn't contain the nonce), and the 2nd SHA block contains the rest, only 80-64 = 16 bytes. Does this mean the 2nd SHA block is padded with 64 - 16 = 48 bytes? If so, why not make the nonce field, for example, 48 - 4 = 42 bytes larger (i.e., 52 bytes instead of 4 bytes)?

That way, extranonce doesn't have to be in the generation transaction, thereby speeding up hashing, no?

It could have been done that way, at the cost of increasing the amount of space it takes to store and send block headers. It seems like block header storage was a big concern for Satoshi, (there's even a section in the whitepaper about it) but it's turned out to not matter very much.

  Does this mean the 2nd SHA block is padded with 64 - 16 = 48 bytes?

Yes, (source) but your reasoning is flawed. Even if the nonce space were so large that it extended into another block, that would just mean that midstate would represent the state after hashing all but the last block (block in the cryptography sense, not the Bitcoin sense.)

Also, if the block header were exactly 128 bytes, the padding would extend it to a third block. You only have 119 bytes before that happens.

  That way, extranonce doesn't have to be in the generation transaction, thereby speeding up hashing, no?

Not really. You can check 2^32 hashes before incrementing extranonce, after which you only need to do ten or so hashes before you get back to mining.

Generally, in modern ASICs, even that part has been offloaded. There will be some sort of small processor within the ASIC, like an ARM core, which takes a block template as input and outputs block headers for the SHA256 cores to work on.

So the cost isn't one of speed, but complexity.

Like many things in Bitcoin, I think this is a technical decision that made sense at the time, but aged poorly.


Blockchain programming books C#? EDIT 1:

It seems that what I really want to learn is how to create software which makes use of a distributed hash table.

ORIGINAL QUESTION:

I want to learn about coding my own blockchain based software using the C# programming language. Do books exist yet which I could buy to learn about blockchain programming?

The blockchain idea/technology is absolutely unbelievably amazing, and I want to learn how to create blockchain based software.

Please understand, that I am not asking about a book which helps me interact with the bitcoin blockchain.  I want to know how to create distributed software using blockchain type technology.

Hats off to Satoshi Nakamoto for giving the world the blockchain idea.

I just published a book about it. It's called "Blockchain Programming in C#".

If you're looking for tools written in C#, you should try NBitcoin. You can also find the project on GitHub.

I've also written lots of articles about it:

Intro: http://www.codeproject.com/Articles/768412/NBitcoin-The-most-complete-Bitcoin-port-Part-Crypt
Stealth Payment, and BIP38: http://www.codeproject.com/Articles/775226/NBitcoin-Cryptography-Part
How to build transactions: http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All
Using the NBitcoin Indexer: http://www.codeproject.com/Articles/819567/NBitcoin-Indexer-A-scalable-and-fault-tolerant-blo
How to Scan the blockchain: http://www.codeproject.com/Articles/784519/NBitcoin-How-to-scan-the-Blockchain (You can dismiss the ScanState for that, now I concentrate on the indexer)


What's the status of alternative full node implementations? In "Does running an alternative full node implementation benefit the Bitcoin network?", I asked about running an alternative full node implementation for the benefit of the Bitcoin network.

What is the current status of different alternative full node implementations with regard to

maturity (alpha/beta/stable)
performance
compatibility tests
code review
suitability for different purposes:

experimentation
merchants
as a wallet
as a lightweight wallet back-end
solely for the benefit of the network?

Update: Moved the list of implementations into an answer.

Update: Coin Dance has an excellent table of node implementations with descriptions and links at the bottom of their Bitcoin Nodes Summary page.

Below are the implementations I've found. I'm not sure if all of them qualify as full nodes.

btcd
(in Go, by Conformal Systems LLC)
Bits of Proof
(in Java, by bits of proof zrt.)
bitcoinj has a
fully verifying mode
(in Java, by Mike Hearn)
picocoin
(in C, by Jeff Garzik)
libbitcoin has an
example full node implementation,
also advertises to be a
completely independent and full Bitcoin stack
albeit only pre-alpha proof-of-concept with no GUI
(in C++, by Amir Taaki)
caesure
(in Python, by Sam Rushing)
Electrum-server,
uses bitcoind as a back-end
(in Python, by thomasv@bitcointalk)
Ufasoft Coin
(in C++, only for Windows, by Ufasoft)
Bitcore (in JavaScript. Note that it needs parts of Bitcoin Core to function)

(Sources: Core Development Update #4 by Gavin Andresen, Jun 21 2013 on the Bitcoin Foundation blog; bitcointalk.org forums)

Updated bitcoinj and libbitcoin status (based on information from
this bitcointalk thread);
Electrum backend
Added Bitcore


Is it true that Paypal banned Bitcoins, while Google Checkout did not (yet)? Paypal claimed they were not allowed to sell Bitcoins, while currently it seems Google Checkout is a viable option.

So ... what's the story on this?  Is this true, and if so does anyone know why?

I can't speak for why Google Checkout seems to have no problem, it may simply be that they are unaware of Bitcoin as of yet. Edit: A Google Checkout employee has replied that they explicitly allow virtual currencies - at least for the time being. PayPal, on the other hand explicitly bans "the sale of traveler’s checks or money orders, currency exchanges or check cashing" in section 3(f) their acceptable use policy.


what happens to your funds when wallet provider packs up? Supposing the company that provide Electrum wallets goes bust and the service/software is withdrawn. Does this mean my fund disappear? If not then how would I recover my funds?

More specifically would the 12 recovery words (provided by Electrum)  have any use if Electrum wallet service was no longer available?

Electrum is an open source project, it is not a company. Even if all the volunteers working on the project right now decided to abandon the project, the wallet is all open source so anyone can pick up where they left off.

It is not possible for "Electrum wallet service" to no longer be available because anyone can run the Electrum server that Electrum requires. The 12 recovery words by itself are sufficient to recover all your funds. You will either need to connect to an Electrum server in order to do so or run you own Electrum server. Even if that's not an option for whatever reason, you could also regenerate all your private keys from the electrum seed and import them into any other wallet.


2 of 3 multisignature transaction vulnerability when one of the private keys is compromised I was wondering if and how multisignature wallets protect the owners from getting robbed.

So in 2 of 3 multisignature scheme, if one of the owners' machines has been compromised (i.e. bad actor possesses the private key and can initiate a transaction without the actual owner knowing about it and the 2nd owner signs the transaction who assumes that transaction request was made by the legitimate owner), does multi-signature wallet protect users from this kind of scenario?

Does it even have a way to protect in this case? Is the assumption that wallet owners will be communicating about the transaction request offline?

does multi-signature wallet protect users from this kind of scenario?

Not necessarily. Ultimately it is dependent on the design of the application which is using multisig transactions.

  Does it even have a way to protect in this case?

Assuming that the other 2 key holders will blindly sign once the primary key owner has sign, no. If the primary key is compromised, the transaction will be signed by either/both other parties.

  Is the assumption that wallet owners will be communicating about the transaction request offline?

In principle yes, the assumption is that the application requires signatories to decide to sign the transaction on their own accord. Sharing  partially signed transaction should be done in a secure private channel between signatories.


Projections for reductions in price of hardware wallets The components of hardware wallets are not very expensive (at least when purchased as scale). I understand the need to recover R&D costs and that higher sales volume will increase negotiating power with component and manufacturing providers.

Are there projections for the future prices of existing hardware wallets (such as KeepKey, Trezor and Ledger) over the next 12-24 months based on projected sales data?

When hardware wallet costs near the cost of flash drives, then usage and security for new bitcoin users (and minimal funds) should increase dramatically.

This data on Ledger production costs seems relevant:

https://forum.daohub.org/t/ledger-proposal-for-the-dao-1-ethereum-hardware-wallet/1750

Significant price savings exist with orders as small as 6,000 units
Q: "Why 6,000 units?"
A: "This is our estimate of the best compromise of minimum order needed to get good prices, without having too much stock on hands if the market is going bearish"
120,000EUR/6,000 units = 20 Euro per unit compared to a retail selling price of 59 EUR (without tax). Based on this data, significant scaling has already occurred. Higher prices (compared to production costs) reflect revenue sharing agreements with partners (in this proposal the DAO would have been paid 25 EURper unit) and profits for the wallet makers themselves.
"When hardware wallet costs near the cost of flash drives, then usage and security for new bitcoin users (and minimal funds) should increase dramatically." Depending on what type of flash drive and hardware wallet you are referring to this has occurred already. The Ledger HW.1 retails for 18EUR:
https://www.ledgerwallet.com/products/3-ledger-hw-1


Calculate Z from r and s Can anyone explain me any clearly answer or code in python with examples how we can calculate Z value from r and s and inputs outputs order ?? I search in google and youtube and i not saw any correctly answer i just see scam posts or video in youtube.
I tried different methods in python and i can’t get right results. 2coin.org is closed and I want to know how to calculate manually.

thank you in advance

z can be calculated more easily from the raw transaction.

To get z this way, you have to simply delete all the script signatures in the raw transaction. Then place the script_pubkey of the input you are trying to evaluate where the script_sig used to be. (in the case of a multi-signature transaction you have to replace the scriptSigs for the correspondent redeem script).

This has to be done for each input, so the raw transaction will contain no script_sigs at all, and only one script_pubkey (where the script_sig was for the input being evaluated).

Then, you have to append the type of sig_hash which is almost always SIGHASH_ALL at the end of the raw transaction. The sighash field has 4 bytes of length and SIGHASH_ALL has the code value of 1, which is represented by 01000000 in hexadecimal which is 1 in little endian.

After you empty all the script_sigs, and put the script_pubkey of the input being evaluated, and also append the 01000000 at the end of the raw transaction, you can procede to calculate the double SHA256 (HASH256) of the modified raw transaction. Check out https://en.bitcoin.it/wiki/OP_CHECKSIG.

The outcome of this hash will be interpreted as a big-endian integer, and that will be your z for the particular input.

You have to repeat this for every input, so there is a different z for each input.

To evaluate your signatures (r,s), you will have to use the mathematical formula of the ECDSA which is:

A)  uG + vP = R.

B)  kG = R.

where:
C)  u=z/s; v=r/s

G is the originating point of the secp256k1. https://en.bitcoin.it/wiki/Secp256k1

P is the point of the public key on the curve.

u and v are integer scalars and, therefore, uG and vP are points on the curve.

R is just another point in the curve as a result of the addition of the other 2 points uG and vP , and will be the point that will verify the signature.

If you already have r and s (as is implied from your question), and you already calculated z, then you can calculate u and v from the formulas in C. Once you get u and v, and since you have your Public key P and G is defined by the secp256k1, then you can procede to calculate R from formula A. Just remember that this addition happens on the curve which is also on a finite field.

Once you get R, you will extract the x coordinate of this point on the curve which has to be exactly the same as r from the signature. If they match, the signature is correct.

If you want some code to get z, here is a function from an excellent book called Programming Bitcoin by Jimmy Song :

def sig_hash(self, input_index):
    s = int_to_little_endian(self.version, 4)
    s += encode_varint(len(self.tx_ins))
    for i, tx_in in enumerate(self.tx_ins):
        if i == input_index:
            s += TxIn(
                prev_tx=tx_in.prev_tx,
                prev_index=tx_in.prev_index,
                script_sig=tx_in.script_pubkey(self.testnet),
                sequence=tx_in.sequence,
            ).serialize()
        else:
            s += TxIn(
                prev_tx=tx_in.prev_tx,
                prev_index=tx_in.prev_index,
                sequence=tx_in.sequence,
            ).serialize()
    s += encode_varint(len(self.tx_outs))
    for tx_out in self.tx_outs:
        s += tx_out.serialize()
    s += int_to_little_endian(self.locktime, 4)
    s += int_to_little_endian(SIGHASH_ALL, 4)
    h256 = hash256(s)
    return int.from_bytes(h256, 'big')

However, you will have to take into account that this is just for the basic case of a P2PKH. In a P2SH transaction you will have a small variation.


Can miner include non-broadcasted transaction in his block? If I understand correctly, when miners try to produce a block, they get the transactions from node's mempool, where it is put if it satisfies the transaction validity criteria. For most of the nodes the source of the transaction is another node, via the gossip network.

Since a miner can not hoard transactions and try to create block, they is a risk that while miner A tries to mine a block containing transaction TX1, some other minder B is quicker to mine a block that contains this transaction, thus putting all the work of miner A to waste.

So, it seems that miner has incentive to pad his block with transactions that are unknown to other miners. It's not hard to create a valid transaction that sends coins from one address to another address, both owned by the miner. So, if a miner puts such transaction in his block, there's now lower probability to lose the race for the next block. Heck, he could create block that contains only such "private" transactions, thus getting income only from the coinbase transaction.

What feature in the bitcoin algorithm/network prevents miners to do so?

Since a miner can not hoard transactions and try to create block, they is a risk that while miner A tries to mine a block containing transaction TX1, some other minder B is quicker to mine a block that contains this transaction, thus putting all the work of miner A to waste.

If miner B miners a block before miner A, even if it doesn't contain the same TX1, the work of miner A is still put to waste. There can only be one next block in the blockchain, mining is a race to create that block and only the first one (usually) to find a valid block will have it included in the chain. As soon as one is found, everyone gives up working on that block and starts working on a new one on top of the one that was just found.

  So, it seems that miner has incentive to pad his block with transactions that are unknown to other miners. It's not hard to create a valid transaction that sends coins from one address to another address, both owned by the miner. So, if a miner puts such transaction in his block, there's now lower probability to lose the race for the next block. Heck, he could create block that contains only such "private" transactions, thus getting income only from the coinbase transaction.

There is absolutely no point in padding the block with transactions to himself because he will just lose transaction fees as you mention, at no advantage because of what I said above.


Is there a command line Bitcoin CPU miner for Windows? Is there a Bitcoin miner that I can run using the command line on Windows? I want a CPU miner, not a GPU miner.

You can install the standard Bitcoin-QT client, navigate to

\Program Files (x86)\bitcoin\daemon\

and then run

bitcoind -gen=1

However this isn't recommended except on the Test network because it is next to impossible to generate any coins this way on the production network.


json_rpc_call solo mining with bitcoin running on Windows 7 for antminer I setup BitcoinD on a Windows 7 PC.  I configured for defaults except user/pw and rpcallowip=192.168.1.0/255.255.255.0. have also tried 192.168.1.* with no luck.

I ultimately want to use an Antminer to connect to it for solo mining but cannot use it for anything other than mining on the same computer on which it is running.

WORKING: using bfgminer with the following command line:
bfgminer-5.0.0-win64\bfgminer-5.0.0-win64\bfgminer.exe -o 127.0.0.1:8332 -u rpcuser -p rpcpw

NOT WORKING: using bfgminer-5.0.0-win64\bfgminer-5.0.0-win64\bfgminer.exe -o 192.168.1.123:8332 -u rpcuser -p rpcpw

The only difference is the IP address where 123 is my IP.

Error: "json_rpc_call failed, retry after 30 seconds"

I looked at firewall and it has entries for "Bitcoin Core"

"Netstat -a" output:

0.0.0.0:8332
0.0.0.0:8333
127.0.0.1:8332
192.168.1.123:8333

Antminer says pool is dead.

How do I get another computer or antminer, on my network, to connect for solo mining?

Thanks.

BFGminer needs to use stratum (bitcoin core doesn't)

Add --stratum-port=3333 to your bat file with 192.168.1.123:8333 then point your antminer at 192.168.1.123:3333

Ta. 3KMxGyAFJA9zFnaXfPEkrjoLozXcZz8FH4


Where can I import my keys from computer to multiBit HD I have upgraded my multiBit classic to multiBit HD but I am having hard time to find how to import private keys to my multiBit HD wallets.
Any idea ?

All your addresses and private keys in MultiBit HD are produced from the wallet words that you are given when you create a wallet. (This is why it is so important to write your wallet words down).

Because everything is generated from one thing the randomly generated private keys in MultiBit Classic cannot be imported into MultiBit HD.

The safest way to transfer your bitcoin is to spend them.

There is a step-by-step guide on migrating from MultiBit Classic to HD in the help here:
https://multibit.org/en/help/hd0.1/how-to-upgrade-from-classic.html


Do HTLC transactions work today or do they need a new soft-fork? I thought that HTLCs were just a kind of a script construct that would allow to unlock funds for a period of time, which can be unlocked to anyone that provides the original string that matches the hash. Does it need new opcodes that are not working in Bitcoin yet?
I ask this because I can see the BIP where this is proposed, linked from here: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-July/012894.html . However, neither the pull request nor the BIP inclusion seem to have had any activity.
Does this BIP need a soft-fork that hasn't been implemented/deployed yet?

Both hash locks and time locks exist in bitcoin today.

It looks like the BIP in question relates to wallet support and HTLC transaction structure, rather than changes to bitcoin's opcodes.


What happens if you receive a block with an unknown previous hash in the header I searched this question and couldn't find an answer to the following scenario.

Block 4440 gets mined at 10:00 AM
Block 4441 gets mined  at 10:01 AM

Lets assume I receive Block 4441 first and 4440 later. What happens? When I received 4441 I didnt know the block with the previous hash and I wasn't able to add 4441 to my chain.

Do I store these kinds of blocks with an unknown previous header in a pool and check periodically if I received the previous block?

Assuming we do this, do you ever remove old blocks from this pool?

If we save "invalid" blocks, how do we prevent people from submitting thousands of invalid blocks and filling up our pool? I assume we check if the difficulty was met but what happens if block 4440 lowered the required difficulty?

Blocks with an unknown parent block are stored in the orphan block pool. They will stay there until the parent block is received and then linked to the existing chain.

As far as I know, there's no other condition for the block to be removed from the pool. If the particular parent is never received, they will remain there forever.

The current difficulty should be enough to prevent people from spamming this pool with orphans, because that would require a lot a processing power and a huge waste of money. A block has to be valid to be stored in this pool, block hash has to meet target and so on. If that is not the case, the block is discarded and will not spam the orphan pool.

See Mastering Bitcoin, Chapter 10, Section Assembling and Selecting Chains of Blocks for detailed explanation.


Upper limit on the blockchain file size with pruning? If blockchain pruning is implemented is there a theoretical upper limit on the blockchain file size?

My thinking is something like with "pruned" blockchain you only store the details of the unspent bitcoins, so even if every satoshi was sent to a unique address then the file to store this information would have a finite upper size limit. Is this correct? And ballpark what file would the file size be?

If there is a reasonable upper limit and with likely continuing reduction in storage costs (i.e. Kryder's law, similar to Moore's law but for storage) then the criticism about the size of the blockchain file may become irrelevant.

Assuming all remaining transaction outputs are 0.00000001 BTC (1 satoshi), with one single ouput per transaction left, and all assigned to standard pay-to-pubkey-hash addresses, I'd say the minimal upper bound on the pruned blockchain size is 21M * 10^8 * 54 bytes, or about 113 petabyte (100 pebibyte).

The 54 bytes per transaction, is calculated as 32 txid bytes, 1 info header byte, 1 byte to store the amount, 20 bytes to store the pubkey hash (address).


Bootstrap.dat incorrect or no genesis block found Hi all i need to add bootstrap.dat after downloading i start bitcoind with -loadblock but not work i have error Incorrect or no genesis block found. Wrong datadir for network?

I start bitcoin with ./bitcoind -loadblock=/root/.bitcoin/bootstrap.dat and connexion of my VPS are very slow what is the good solution ?

Its possible because bootstrap.dat are very big file ? And what is the difference between -reindex and tindex ?

Thanks

I don't remember exactly but i think all you need to do is put the bootstrap file in the data directory of bitcoin and then just start bitcoind.

However note that bootstrap is obsolete as of version 0.10 and downloading is faster and (disk usage lower) without it.

Don't waste too much time trying to get it to work if bandwidth is not costly for you.


How can GDAX pay no fees while transfering Bitcoin between wallets? How is that possible that using GDAX you don't pay network fees (than can go up to 30 USD) to move bitcoins between wallets?

How can GDAX pay all these transactions fee for you?

GDAX is a centralized exchange, they don't actually transfer the Bitcoins between wallets. They have a database that associates every account with how much Bitcoin they are worth.This is why transferring from Coinbase to GDAX is free, because it is the same company running both platforms.


What does a coinbase output script look like? What does a coinbase output script look like and how would it be used to fund a transaction?

Coinbase transactions are almost identical to normal transactions.

The only difference is that they have exactly 1 input, which must have a special form (which would be invalid for non-coinbase transactions).

There is no difference between the outputs of coinbase transactions and others*. So just like any other transaction, they can have 1 or more outputs, and all those outputs have an amount and a script (address). Each of those outputs result in a new UTXO that is spendable by anyone who can sign for that script/address.

(*) Coinbase outputs have a special rule that they can only be spent after 100 blocks, instead of immediately. This is to prevent reorganizations from wiping out whole sequences of dependent transactions.


Speeding up bitcoin transactions? I am writing an app which trades bitcoins and one of the biggest problems I have run into is that it takes so long to move them from one wallet to another. I thinks it due too mtgox and other sites using a 6 confirmation system before registering that data.

I have two thoughts on how the time might be brought down and I am wondering how feasible each is.

Process my own bitcoin transactions. Would it be possible to route my transactions through my own computer so that it gets top priority?
Use fewer conformations before excepting a transaction as complete. Would the system allow me to use a bitcoin if it has only has 4 conformations?

Is there another way that I'm not thinking of?

The security of the Bitcoin system depends on time passed since the transaction was included in a block.  Let's call this confirmation 1.

  Are you having trouble getting your trades into a block, or want to have more confirmations?

The fact remains is that you should wait 1 hour after the transaction is included in a block before spending that output.  That one hour just happens to roughly correspond with 6 blocks.

So why do we wait 1 hour? It's because we want to make reasonably sure that no one out there has a computer strong enough to spend the output twice, and causing a split in the ledger.

I wouldn't plan on basing my business on short block times, and would instead only use the block chain for deposits and withdrawals from your private system.

If you're having trouble getting your Tx included in a block the easy solution for that is to pay transaction fees, or run a private mining rig that will accept such transactions.


What is the memory every node allocates locally for the Bitcoin blockchain? https://blockchain.info/charts/blocks-size states that the current size of the Bitcoin blockchain is ~134,000MB.  That is 127GB.  Does that mean that every machine that is mining currently allocates 127GB+ for the blockchain?

Not all mining machines need to store the whole blockchain, as a miner you would normally have one or a few nodes which do that, and then just send a block template to all the actual mining machines (ASICs) to mine without caring about the blockchain.

All non-pruned full nodes store the entire blockchain. It's possible to run in pruned mode which means older blocks are pruned and only the newest ones are kept, so you need less space, but this means those nodes can't serve old blocks to new full nodes trying to sync


How accessible is Bitcoin to blind people? Is it easy or hard for blind people to trade bitcoin if they have the appropriate assistive technology? It is easy or hard for blind people to work at tasks involving bitcoin such as utilizing computers for mining, or confirming transactions on the blockchain?

What kinds of technologies would they likely find beneficial?

The short of it is Bitcoin already has a subpar reputation for user experience, and it doesn't get better as you dig into accessibility. Hopefully the Bitcoin community can draw on accessibility solutions as general standards to improve UX as things evolve.

More specifically, the frequent use of QR codes by wallets is the biggest non-blind-friendly user flow that comes to mind. I did some searching around and it looks like there is work being done on the non-Bitcoin specific task of improving accessibility for QR codes. It seems like individual Bitcoin wallet companies in the past have taken a stab at addressing the issue, but I don't know of universal standards that have emerged.

On the flip side, the question asks about mining and confirming transactions, which I believe would not really be much more difficult. Mining has nothing to do with user interaction. Setting up the hardware seems like the biggest hurdle, and I imagine if you are already comfortable setting up building towers and putting together hardware, Bitcoin specific hardware would not be significantly worse... but I am definitely not an expert there.


NBitcoin, how to implement wallet restoration? How does it work? at first sorry for my ignorance, I have little experience at bitcoin programming.

Im trying to implement a very simple wallet using NBitcoin library. I have done some work, but now Im stucked with wallet restoration function.

Lets say I have mnemonic private key, then I calculate its public key.

With public key am I able to track all transactions associated with this key? Even if I used multiple adresses? How its done(NBitcoin)? Any advice? Do I have to iterate throught whole blockchain and chceck signatures?

Thank you.

With public key am I able to track all transactions associated with this key?

A public key has two corresponding addresses: Uncompressed and compressed. I suggest only generating compressed public keys for simplicity. The relevant methods are Compress and Decompress here.

So, yes.

  Even if I used multiple adresses?

Multiple addresses: Yes, you should track all of them.

  Do I have to iterate throughout whole blockchain and check the signatures?

You should use SPV: Download a block, verify it, keep the headers, skip to the next block. Also you should keep the transactions that are incoming/outgoing. Writing the current block height to the wallet file is a good idea, as after you launch the wallet for the second time, you'll only need to download blocks and scan for relevant transactions after that block height.


What does it mean that bitcoins have lower transaction costs than more traditional forms of currency? So I recently bought some bitcoins. I just bought a small amount and mainly for education purposes. I bought it from a site called Coinbase.

Before this, I was told that one of the advantages of bitcoin was that it had very low fees. However, I feel like it's the opposite.

First, to buy the bitcoin, I have to pay a 3.99% conversion fee to buy. I understand that's just the exchange trying to make money - fair enough.

But then when I want to transfer the money to my paper wallet, there's another $3 they want to charge. And it seems that's the case for every transaction and every time you want to move your money around from wallet to wallet, that is a transaction.

So I guess the question is, what does it mean that transaction costs are low? Is that to mean that in theory, in the future it's got potential to be low cost? Is that to mean, its cheap but only for large transactions? Cause right now, it feels like it's much higher than any traditional form of exchange.

Even with VISA and MasterCard, they don't charge 4% exchange fee for purchases in another currency. And bank transfers are essentially free and instantaneous.

In the past, the cost to send a transaction (aka the transaction fee) was literally very low. For a long time, it was basically 0 for many transactions. That is what people meant by "transaction costs are low". While 0 fee transactions are nonexistent now, Bitcoin transactions are still lower in cost than many of the traditional ways of sending money.

A lot of traditional money transfers will charge a fee based upon the amount being transferred. However in Bitcoin, the fee is based on the size of the transaction data itself, not the amount transferred. This means that the fee for transfers of say $100,000 can be the same as the fee for sending $10. And those fees are usually in the order of $0.50 - $1.00. Furthermore, sending money internationally through a bank is usually more expensive than domestically.  Transfers to an account at a different bank also costs more than transfers to accounts in the same bank. None of this matters in Bitcoin. The fee is only dependent on the transaction data itself, not who you are sending to, where they live, nor how much is being sent. This makes Bitcoin much cheaper than many traditional money transfer services.

With credit cards, there is actually a transaction fee, just that the consumer doesn't pay it, the merchant does. This fee is usually just rolled into the price of the product so you as the consumer don't notice that it is being paid. But the merchants do.

Furthermore, transaction fees with all traditional money transfer services is set by the service and unavoidable. But with Bitcoin, you can choose your own fee. You can choose to pay no fee or very little fee. It's just that paying a lower fee means that it will take longer for you transaction to confirm.

Lastly, Bitcoin transactions are irreversible and "settled" much much sooner than any of the traditional money transfer services. With credit cards, you can reverse a credit card transaction up to 180 days after purchase. With banks, it takes days for ACH transfers to clear. But with Bitcoin, a transaction can be final within 10 minutes. Since you can also change the transaction fee, you get some control over when the transaction is confirmed, unlike with other money transfers where you just have to wait for the bank or payment processor to handle it.


As required in BIP 34, how miners put the Block Height to their coinbase transaction I created a coinbase transaction with the createrawtransaction method as follow:
createrawtransaction '[{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":0}]{"kgjdtruea5w3mz7t3tudtlplm9xht4sjwg0e3tihgtr":6.25000000}'
the response to this call is:
020000000100000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0140be40250000000017a9145ea405d95b789aa887e229d8b1da44c2964054248700000000

I understand that the number of pushed bytes and the Height of the block must be included to the scriptsig of this raw data as follow:
Actually 03 + The height of the block in little endian
In this exemple must i put this just between the ffffffff and  0140be40250000?
I saw some exemples but i am confused, as there's the size of the scriptsig before the scryptsig
Help is appreciated
Thank you to all of you

In this transaction, the scriptSig is of size 0 because it isn't filled out yet. You have also used a txid of all 0's and a vout of 0, so this size of 0 gets lost in your large string of zeroes.
00000000000000000000000000000000000000000000000000000000000000000000000000ffffffff is the input data.
The first 32 bytes of this is the previous txid. The 4 bytes following that is the vout. This leaves us with 00ffffffff. That remaining 0x00 byte is the length of the scriptSig, currently length 0. The ffffffff is the sequence number.
What you have to do is replace that 0x00 byte with your scriptSig. The scriptSig is prepended by it's length, so what you replace that with would look like 040334cc09.
Note that currently your transaction would not be a valid coinbase transaction. The vout for a coinbase transaction is 0xffffffff, not 0.


What is fTestnetToBeDeprecatedFieldRPC seen in chainparams.cpp? fTestnetToBeDeprecatedFieldRPC is a bool type variable set to some values in the main, testnet and regtestin chainparams.cpp. What is the use of this value ?

The field corresponds to false for mainnet, true for testnet, and false for regtest. You can think of it as a flag that tells you whether the current network is testnet.
Why's it named like that?
To get people to not use it, and because getinfo and getmininginfo still use it:

jtimon commented:
Yeah, comparing to the testnet id was very readable so it's the new flag. The difference is that when people see "NetworkID() == something" they think they can use that too, while FlagWithLongNameIncludingTheWordDeprecated() is not as likely to be used or that's my hope.
@laanwj explained the deprecation thing, but basically, RPCs can just use bip70's networkidstring()
For the string, I was going to create another flag but @laanwj wants to keep chainparams clean of GUI-related things. Of course comparing to an enumerator is better than comparing to a string, again, the goal is that people don't see the comparation to the enumeration and think they can call CChainParams::NetworkID(), hopefully the comparison with a string will make people use that approach less, but we need the string for BIP70 anyway.

(Source.)


Making a backup of my wallet Let's suppose I make a backup of my wallet when it has 0.001 BTC, but then I transfer to it 0.001 BTC more (so at the end it has 0.002 BTC) and then my PC dies...

If I restore my wallet it will have 0.001 or 0.002 BTC?

Supposedly all transactions are recorded on the network (blocks), so what I understand by backup wouldn't be a backup, but rather a way to re-make my wallet on another device and my final balance will always be rescued no matter if I did a restore with a backup made one day or 5 years ago...

or do I have to do a backup once in a while?

If you made the second transaction to same Bitcoin address so yes you will not miss that second transaction even if you made the transaction after the backup.

if you made the transaction after the backup and you made the transaction to a different address you will also get any future transactions for two reasons:

1- Bitcoin Core using HD wallet so you have one master private key and they derive all your future addresses from that one seed.

2- if you are using old bitcoin wallet or HD wallet set to 'OFF' you will still have future transactions but not forever and that because of the limit of keypool future.

  Keypool New public and private keys are pre-generated and stored in a queue
  before use.

  This pooling feature was added so backups of the wallet would have a
  certain number of keys that would be used in the future. By default,
  the number of entries in the queue is 100[1].


Can you run a full Bitcoin node on Node.js? Are there bitcoin full node implementations running on Node.js?
Node.js is the server side language that I'm most familiar with so I was wondering if I can run a full bitcoin node on Node.js?
I just want to learn more about how a node works and possibly experiment writing my own cryptocurrency implementation in Node.js as that's what I'm most comfortable with.

Yes, bcoin:
http://bcoin.io/
https://github.com/bcoin-org/bcoin
bcoin is a modular Bitcoin library for nodejs with full node and SPV node functionality, as well as a scalable BIP44 wallet used in production by several Bitcoin businesses including Purse.io.
Bcoin has the second-fastest initial sync time out of all available full node implementations (after Bitcoin Core, of course): https://blog.lopp.net/bitcoin-node-performance-sync-tests/


Current transaction fees for various cryptocurrencies Is there a place that lists current transaction fees for various cryptocurrencies like Bitcoin, Litecoin, Ripple, Ethereum, Bitcoin Cash etc.? The best would be fees converted to some fiat (USD, EUR) for easy comparison.

I use this: https://bitinfocharts.com/bitcoin/

You can click on any other cryptocurrency on the top bar and look for the value of "Avg. Transaction Fee", in USD.


Does bitcoin 0.16.1 work with Windows Subsystem for Linux (WSL) Windows 10? Does the bitcoin core for ubuntu work with windows 10 WSL (Windows Subsystem for Linux) command line? What issues are there if any since its install the ubuntu version under windows 10.

it should work, but filesystem access from within WSL might be slower then using the windows server. There are some benchmarks available. Perhaps another alternative to consider would be running Bitcoin Core in vagrant. I don't know if and how bitcoind would be slower.


Mining computations by the numbers On average, how many "computations" (GPU computations, CPU computations, CPU cycles, etc.) does it take to solve a block ("win" a mining race)?

What are these computations measured in? Operations? Operations per second? Something else? Thanks in advance!

When mining, you computer creates hashes. These hashes must satisfy a certain condition. All a miner does is trying many many times to find a valid hash for a block.

For this reason, mining hardware performance is measured in GH/s, giga-hash-per-second, which are one billion hash calculations per second and it is called the hashrate.

It is good to know that there is no fixed amount if hashes required to find a valid hash. The Bitcoin network has a dynamic difficulty for the mining problem. This difficulty is used to make sure new bitcoins are generated at a predictable rate. The difficulty is changed every 2016 blocks, and is adapted so that it will take as close as possible to 2 weeks for the next 2016 blocks. This means that, at average, every 10 minutes a new block is found.

The chance of finding a good hash within such 2 weeks is fixed. This means that you can find one after only a few tries or it can take you weeks or even months to find one. When the total hashrate of the network raises, 2016 blocks will be found in less than 2 weeks. In this case the difficulty will automatically be adapted so that the next 2016 blocks will take 2 weeks, considering the recent hashrate change.


How are Bitcoin ATMs secured against double-spends? Some bitcoin ATMs allow the exchange from bitcoins to paper money. Since waiting in front of an ATM for a confirmation is not feasible, they must defend themselves in another way against double-spends. How do they do that?

I can't talk about other ATMs but in BTCPoint (The Bticoin ATM of Barcelona) works the following way:

The user want to SELL bitcoin
The bitcoin machine provides a fresh new public address for the transfer
The user sends the bitcoins to that address
Bitcoin network detects the transfer sent and issues a ticket with a confirmation code
The user waits for some minutes while the transaction is confirmed (the ATM can be used by other people)
After some confirmations the user scans the "ticket with the confirmation code" in the QR reader.
The ATM validates the confirmation and gives money out if everything is valid.

Check out the operations in: http://www.btcpoint.org

For some extra security (camera recording the confirmation code in step 4.) the machine can be configured so that a PIN code is inserted. This PIN code is then required in step 6.