Is a timestamp in bitcoin different than just the "stamp of time"? In the "References" section of Bitcoin's whitepaper, Satoshi Nakamoto points to three papers that serve as inspiration for digital timestamping.
When you read those documents it is clear that timestamping is not just a stamp of time, but "the hashed value of [data + timestamp]".
That said, in Bitcoin, is the timestamp the hashed value of the block header vs. the just time in the blockheader?
Or, am I totally off base?

Update: There is some discussion about timestamps here- https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2020-October/018251.html

When a Bitcoin block is produced there are essentially two times involved:

The timestamp in the block header, put there by the miner
The actual time the block was produced.

Bitcoin has two mechanisms to protect against miners manipulating the timestamp:

Median Past Time (MPT) Rule – The timestamp must be further forwards than the median of the last eleven blocks. The median of eleven blocks implies six blocks could be re-organised and time would still not move backwards, which one can argue is reasonably consistent with the example, provided in Meni Rosenfeld’s 2012 paper, that six confirmations are necessary to decrease the probability of success below 0.1%, for an attacker with 10% of the network hashrate.

Future Block Time Rule – The timestamp cannot be more than 2 hours in the future based on the MAX_FUTURE_BLOCK_TIME constant, relative to the median time from the node’s peers. The maximum allowed gap between the time provided by the nodes and the local system clock is 90 minutes, another safeguard. It should be noted that unlike the MPT rule above, this is not a full consensus rule. Blocks with a timestamp too far in the future are not invalid, they can become valid as time moves forwards.

Source: https://blog.bitmex.com/bitcoins-block-timestamp-protection-rules/


Bitcoin with primitive Blockchain Currently Bitcoin blocks are limited to 1MB and each block seems to hold roughly 1000 transactions assuming each transaction is 1KB.

Much of a transactions size seems to be caused by Bitcoin's built-in scripting system to facilitate complex transactions.

Would Bitcoin benefit from a deliberately primitive blockchain, one that can only records the input addresses and output addresses?

My thinking is that for most transactions you would only need 1 input and 2 outputs. So you could reduce the transaction size from 1KB to about 100 bytes. That would increase Bitcoin's Tx/s by 10 times I'm assuming.

What's more, since the Blockchain is primitive by design it couldn't handle anything like Escrow or any other kind of transactions. This would encourage people to do those activities before they record their transaction on the Blockchain which would mean there would be less demand on the Blockchain for transactions.

These are just ideas I had, if anyone could disprove them that would be cool too!

I won't go into details of segwit, which in fact allows for bigger blocksize than 1 MB... sticking to your approach:

  Much of a transactions size seems to be caused by Bitcoin's built-in
  scripting system to facilitate complex transactions.

no, not really to facilitate complex tx. It is required for every tx. The logic is to sign a tx, with an output condition. The signature proofs, that data hasn't changed during transfer to the blockchain. When the receiver decides later on to spend the tx, he needs to proof, he has the privkey for the pubkey hash of the previous tx. As a hash function is a one way (as per todays knowledge), this proofs, that he is indeed holding the priv key for this pubkey hash, and as such can spend the funds.

If you take this functionality out of blockchain, then you have a normal ledger, that can be manipulated by the owner of the ledger (aka as it is today with non-crypto financial institutions). This would mean, no need for a blockchain...

Btw: a minimum tx is somewhere around 227 bytes.

The logic is defined at several places, good reading is here:

1.) bitcoin.org - the developper section

2.) the book from Andreas "Mastering Bitcoin" - it is online available

3.) http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html


General book recommendation Disclaimer for moderators: I am not sure if such a question is allowed in this website. Please feel free to remove it in case it isn't. This question is based on a similar question on StackOverflow.

There are currently many books on Bitcoin and cryptocurrency/blockchain in general and surely many more will be written. Some are easier to find, some harder. Some are very good, others quite the opposite. Good reviews on websites such as Amazon are not always on par with the quality of the book, and not all books can be found in one place. I propose to provide answers to this question recommending books. The rules are as follows:

Each answer must propose one book only.
Each answer must propose a different book.
The proposal has to contain the book's author and title. A short description and subjective opinion why this book is worth reading is admissible.

The votes for each answer will determine the relative quality of each book. Please refrain from downvoting a book - simply don't upvote it.

The idea behind this question is not to argue which book is the best, but to consolidate the knowledge in one place.

Mastering Bitcoin by Andreas M. Antonopoulos - bitcoinbook.info

  Mastering Bitcoin is a book for developers, although the first two chapters cover bitcoin at a level that is also approachable to non-programmers. Anyone with a basic understanding of technology can read the first two chapters to get a great understanding of bitcoin.

The first version was published in 2014, the second edition with updates was published in 2017. Although you can get a physical copy on amazon, the whole book is available on github. The second version can be read here: https://github.com/bitcoinbook/bitcoinbook/blob/develop/book.asciidoc

I find the book a good introduction to bitcoin for developers because it gets a good first explanation of Keys, Addresses, Transactions, Scripting and so on, and it does that not on the typical management level but also goes into the technical details of it. Although the book is somewhat older, the author also tries to explain new features of Bitcoin such as Lightning and Segwit, which you can find in the second edition in the Chapter 12 and Appendix.

You may find better resources on newer topics like segwit, but I believe the book is still a good starting point for coders to get into bitcoin.

A good overview of the books content you can find here: https://bitcoinbook.info/whats-new/


Mining Profitability of BTC and BCH When I review sites like fork.lol and they speak of Mining Profitability of BTC and BCH, how are these calculated? I am trying to figure out how mining profits change between these two coins and how someone determines which one is more profitable, and why the highest profitability switches between BTC and BCH?

Source: fork.lol (PNG by me)

mining\space profitability$$\frac{\mathrm{BCH}}{\mathrm{BTC}}=\frac{\frac{(\mathrm {BCH\, block reward + estimated\, total\, transaction\, fees \, in \, a \, BCH \, block})\cdot (\mathrm {BCH\, exchange\, rate\, (in\, USD)})}{\mathrm {BCH\, block\, difficulty}}}{\frac{(\mathrm {BTC\, block reward + estimated\, total\, transaction\, fees \, in \, a \, BTC \, block})\cdot (\mathrm {BTC\, exchange\, rate\, (in\, USD)})}{\mathrm {BTC\, block\, difficulty}}}$$


Transaction fees after 0.9 protocol update As the changelog of bitcoind 0.9 tells, transaction fees should be greatly reduced. What are the implications of this?

How were transaction fees determined before the change and after the change?
How does this change affect third-party software developers (who do not use Bitcoin-Qt wallet) - do they need to mimic this change?
How does this change roll across the network? Do 51% of miners need to update to the new version before the change starts to be effective?

How were transaction fees determined before the change and after the
  change?

The fees were determined on the person sending the bitcoin, or the client in many cases. One can send a tx with no fee, but it has lower priority to get included in a block. They are still determined the same way. The "default" method for determining the fee is generally 0.000055 BTC/1kB. Technically, the fees help determine the priority for a transaction to get included in a block. The formula is: priority = sum(input_value_in_base_units * input_age)/size_in_bytes, therefore, it is a function of a few variables.

  How does this change affect third-party software developers (who do
  not use Bitcoin-Qt wallet) - do they need to mimic this change?

The change needs to be implemented in wallet software that determines the transaction fee for the user (i.e. Multibit), or changed in a setting by the user (i.e. qt client).

  How does this change roll across the network? Do 51% of miners need to update to the new version before the change starts to be effective?

The change rolls across the network as the miners update their qt client to the version with the updated protocol rules, otherwise, they will mine and still play by the rules in the old client. This change doesn't necessarily require 51% of the network to adopt the new version for the lower tx fees to take effect. Theoretically only one miner would need the new version and solve a block with the client for the new tx fee rules to take effect for that block. If one uses the lower tx fees while few miners have updated their clients, the fee will be considered low, and probably would be lower than lots of current transactions, so would be placed further down in the queue. If the update is done by a few major pools, the change would be effective, although using the new tx fee might cause a slight delay if a block is solved by a miner with old client and the block is full of transactions with higher priority.


How is the Bitcoin Mined in Genesis Block Brought into Transaction? I'm studying the source code Bitcoin, and have no clue to this question.

It looks like the genesis block is mined "out-of-band" (given a timestamp, and a message with no transaction information) and then hard coded into the source code before compiled (with the nonce, hash, Merkle Tree Root hash, and a modified timestamp if no nonce found with the original one). After Googling, it is said that 50 BTC was mined in the genesis block, is the 50 set by the Bitcoin protocol? And will the "50 BTC" message participates in the mining of the genesis block? (No from my current understanding). If the "50BTC" not part of the message for genesis block generation, we're free to change it to, e.g 500BTC after mining the genesis block, and I think that will not violate the original Bitcoin protocol. With this question pending, I am not sure how the first Bitcoin is created (looks out-of-band with the generation of genesis block).

Any hints will be highly appreciated!

is the 50 set by the Bitcoin protocol?

Yes, the block reward started at 50 BTC per block, and halves roughly every 4 years (every 210,000 blocks to be precise).

  And will the "50 BTC" message participates in the mining of the genesis block? (No from my current understanding).

Yes it is, the 50 BTC is in the output of the coinbase transaction from that first block:
https://blockchain.info/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b

The first transaction in any block is the coinbase transaction and pays the block reward to the miner. And because the hash of the transaction is part of the block header which gets mined, it does directly contribute to the hash of the header.

  If the "50BTC" not part of the message for genesis block generation, we're free to change it to, e.g 500BTC after mining the genesis block, and I think that will not violate the original Bitcoin protocol.

1) it is part of the "message" for the genesis block, so changing it would change the genesis block which would make it rejected by every other node on the network.
2) The block reward of 50 BTC is enforced by all nodes so changing it would also make the block invalid too.

  With this question pending, I am not sure how the first Bitcoin is created (looks out-of-band with the generation of genesis block).

The 50 btc from that genesis block are the first 50 BTC ever produced (although they cannot be spent, see this question for why: Why can’t the genesis block coinbase be spent?)


How do BIP numbers get assigned? Each BIP (Bitcoin Improvement Proposal) has a assigned number. For example BIP-2, BIP-42 and BIP-152. How does this number get assigned and by whom?

The current BIP process is defined in BIP-2. An author drafting a new BIP leaves the BIP number in the preamble marked as XXXX. A BIP editor  assigns a number to that BIP when the draft phase is complete. The number is chosen by the BIP editor, while generally one of the next higher numbers is assigned. Some number ranges might be reserved to allow BIPs with a common theme to have similar numbers. The current BIP editor is Luke Dashjr.


Is there a reason why MtGox is based in Japan? I was wondering why MtGox is a Japanese company. The founder was American, and the current owner is French, so is there a special reason why Japan was attractive for them?

Mtgox owner was already in japan and already had his company there when he decided to buy mtgox from historical owner Jed in 2011.

mtgox owner s blog : http://blog.magicaltux.net/
hosting company that existed years before he decided to buy mtgox : http://legal.tibanne.com/ , services on https://www.kalyhost.com/


Time it takes to Transfer btc from exchange to another wallet? I recently sent a small amount of btc from the exchange to my other bitcoin wallet and it hasn't shown up yet, can anyone give me info regarding delays and how long such a transfer can take?

Transactions are sent instantly, but may not be confirmed for a long time, depending on the fee you paid. See this answer for more info on confirmations and fees: Why is my transaction not getting confirmed and what can I do about it?


Is it possible to create batches of transactions in bitcoin blockchain? Scenario:
Suppose that I have to make three transactions simultaneously to Alice, Bob and Claudia. Now the condition is if any one transaction fails the other two must also not go through.

Query:
How can I achieve this in BTC blockchain? Is there any feature that BTC provide to batch transactions as one so that it's atomicity is maintained?

If you have no trouble with Alice, Bob and Claudia know about each other, you could create a single transaction with 3 outputs, one for each of them. In such case they will all three get bitcoins, or all three would not get bitcoins (because actually it would be 1 transaction, which will get into blockchain, or would not).
sendmany
I can show you the way to make it with bitcoin-cli. For this you'll need full node running on your machine (bitcoind). This node must own your funds (privkeys for accounts with your funds must be in its wallet.dat). If this is the case, then you need sendmany method.
Run:
# Unlock the wallet (If your wallet is unencrypted, skip this step)
bitcoin-cli walletpassphrase "passphrase" 10
# Send all funds to everybody you need
bitcoin-cli sendmany "" '{"2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF": 0.05, "2N5zxMH53RX3JLWbV5csmZrAhWY1R7Fr1SA": 0.05}'
# Lock the wallet
bitcoin-cli walletlock

You'll get transaction id as the result of sendmany call:
3a2addb48252889711a74f7e131816c8becfb112910342faefd17a8913ac2de7

(it is real transaction in bitcoin testnet)
To get more info about sendmany method, you can run bitcoin-cli help sendmany, you'll see the list of available params and examples of using it with curl. Or you can go to the official documentation
createrawtransaction
If you have access to bitcoin node, but this node does not have your funds, you can create new unsigned transaction using createrawtransaction  method on the node, then sign this transaction in your wallet and send it, using sendrawtransaction.


ECDSA r, s encoding as a signature An ECDSA algorithm when signing a given messages produces a pair of outputs, r and s. How, given a sigStr from a Tx can one extract r and s? Are they just concatenated byte arrays of a specific length, or is there more to it?

If you want, you can pay $100 for the standard, ANSI X9.62. Or, you can cheat and look at RFC3278, section 8.2. It is in DER format consisting of a SEQUENCE of two INTEGERs. The first INTEGER is r, the second s.

If you look at this transaction you can see that one of the signatures is:

  3045 0220
  316eb3cad8b66fcf1494a6e6f9542c3555addbf337f04b62bf4758483fdc881d
  022100
  bf46d26cef45d998a2cb5d2d0b8342d70973fa7c3c37ae72234696524b2bc812
  01

If we parse that as DER, we get:

 0:d=0  hl=2 l= 69 cons: SEQUENCE
 2:d=1  hl=2 l= 32 prim: INTEGER :316EB3CAD8B66FCF1494A6E6F9542C3555ADDBF337F04B62BF4758483FDC881D
36:d=1  hl=2 l= 33 prim: INTEGER :BF46D26CEF45D998A2CB5D2D0B8342D70973FA7C3C37AE72234696524B2BC812

You can also peek at the OpenSSL source code, file ecdsa/ecs_asn1.c:

ASN1_SEQUENCE(ECDSA_SIG) = {
        ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM),
        ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM)
} ASN1_SEQUENCE_END(ECDSA_SIG)


Running Bitcoind as a service on windows 10 So I am trying to run bitcoin daemon as a service on windows 10, so I don't have to keep starting it.

I have tried the following command:

sc create BitcoinServer binpath= "C:\Program Files\Bitcoin\daemon\bitcoind.exe -regetest" start=auto

Which creates a service, but when I try to start that, I get an error:

Is there any way to create a bitcoind regetest service?

I think you need to add -daemon to your command in order for this to work. Also, you have -regetest in your command which implies that you want to use the Regression Test network (regtest). Besides the fact that you have spelled it incorrectly (it should be -regtest), regtest is not the same as mainnet (the main Bitcoin network) and I don't think that is necessarily what you want to do. Because you have spelled it incorrectly, you will be using the mainnet.


Why is it impossible to get a straight answer as to whether Bitcoin is anonymous or not? Yesterday, I asked a question which got linked to this answer: Is it true that all the bitcoins in existence are on the blockchain (the ledge), but it just depends on who the owner (address) is?
Judging by that, if I interpret it correctly, there's no way to track people on the Bitcoin blockchain. Okay? So what's with the constant pointing out about how "Bitcoin is a fully open ledger blablabla not anonymous by design bladiblableblablu everyone knows exactly who does business with who forever etc."?
I swear, I've probably asked this and similar questions hundreds of individual times over the years, in chat rooms, on forums, on here, etc. I've watched endless videos and read mile-long articles on the subject, I've thought really long and hard about it, I've implemented a Bitcoin payment system on my own, I've use Bitcoin myself, etc.
I still truly have no idea if Bitcoin is anonymous or not.
The answer seems to be "kinda, but we don't wanna talk about it".
I see companies specializing in trying to determine Bitcoin ownership and who does business with what... Are those just fake? Complete BS? Are people just constantly spreading ill-intentioned FUD about Bitcoin? Is it actually anonymous after all? Is it safe for me to use the same wallet (with unique receive addresses) for my private use as my commercial project and not have them associated with me?
Is it possible to get a straight answer on this once and for all?

Why is it impossible to get a straight answer as to whether Bitcoin is anonymous or not?

Because privacy is not binary in nature. It is not as if there is some moment at which your information flips from being not-private, to private. Privacy exists on a spectrum, and as a bitcoin user, where you sit on that spectrum depends entirely on the actions you take.
This means that there are ways which bitcoin can be used which afford the user a very large degree of privacy, and there are always ways to use it which afford the user no privacy whatsoever.
Some things that the average user can do to help improve their privacy:

Never give up personally identifying information to exchanges or other bitcoin businesses
Never re-use bitcoin addresses to receive funds
Run a full node to validate the network state themselves, run it over Tor only
Only use wallets which connect to their own full node to query blockchain information
Only use wallets which allow coin control and UTXO labelling
Never look up addresses of interest on blockchain explorer websites (unless using Tor)
Never publicly post any information that could tie them to certain addresses or transactions
Use the lightning network to make payments
Do not send round number amounts when making payments (eg send 0.00104103 BTC, instead of 0.001 BTC)
Use privacy-focused wallet software, such as JoinMarket or Wasabi, to create coinjoin/payjoin/etc transactions .

As a user, you need to decide what level of privacy you need/desire. Maybe following every point on the list above is too much for you, or maybe it isn't enough. There is no 'one size fits all' for privacy, though generally I would recommend endeavouring to retain your privacy whenever possible.
To quote this great article, which I would highly recommend reading:

As of 2019 most casual enthusiasts of bitcoin believe it is perfectly traceable; this is completely false. Around 2011 most casual enthusiasts believed it is totally private; which is also false. There is some nuance - in certain situations bitcoin can be very private. But it is not simple to understand, and it takes some time and reading.


What is the absolute smallest size of the data (bytes) that a blockchain transaction could possibly be? I am looking into completing blockchain transactions over an extremely limited data transport channel. Think even more limited than a satellite connection. The maximum payload I can send at any one time is only 256 bytes. Does anyone here think it would be possible to send a payment transaction to be registered in the blockchain within that single payload?

I'm new to blockchain, so forgive me if this is a very basic question, but I'd like to understand precisely what components need to be sent, which I believe are (coins, recipient, signature) and that's it? Could someone give me more detail as to how many bytes each of these pieces of data would be on the Bitcoin network? If you can think of any network which is more compressed/efficient I would appreciate a pointer there too.

If Bitcoin or no other chain fits within the 256 byte payload to send what it needs to, can you think of any way of making things smaller/compressed? Perhaps hashing some of those values even further in a pre-determined way through an originating application that we can then "unhash/decompress" on the other side with the same properly configured receiving application to regenerate the proper data before being submitted to the chain?

Thank you!
JP

Depends on the number of inputs, the types of scripts the inputs are redeeming, the number of outputs, and the type of scripts that the ouputs are paying to.
The absolute minimum for a transaction that might appear on chain is 60 bytes :

02000000
01
  0000000000000000000000000000000000000000000000000000000000000000
  00000000
  00
  fdffffff
01
  0100000000000000
  00
00000000

But this just an academic example.  The input is redeeming a utxo where the script does not require any signatures, and the output scriptpubkey is empty.
You're more likely to find a 191 byte transaction such as :

02000000
00
01
01
  0000000000000000000000000000000000000000000000000000000000000000
  00000000
  00
  fdffffff
01
  0100000000000000
  16
    00 14 ffffffffffffffffffffffffffffffffffffffff
02
  21
    020000000000000000000000000000000000000000000000000000000000000001
  47
    3044022077777777777777777777777777777777777777777777777777777777777777770220555555555555555555555555555555555555555555555555555555555555555501
00000000

Which both redeems a and also pays to a p2wpkh segwit program.
Note that this one doesn't have a change output in it, which most transactions carry.  A second p2wpkh output will be another 32 bytes for a total of 223 bytes.  Still less than your upper bound of 256 bytes.


how long does it take for an mining machine to exhaust 2^32 in minutes and what is the actual speed of mining machines? Mining is usually about taking the double sha.
most if not all mining machines such as bitminer's machines usually give some indications for example 1TH/sec per second. Do they count the double sha as one hash operation or does it mean that they count the double sha as two operations.

Wait, even more interestingly, 1 TH/sec means literally 1 terahash per second. Meaning that we can do 1 trillion operations per second !
Does that not mean that I could exhaust a given nonce in less than a second ?! given that we are dealing with only ~4 billion values ?
Assuming that within the ~4 billion values there is one that validates the block, we find a solution in less than a second !
So it aint making sense to me that it takes so long and is so difficult to be a successful solo miner.

According to the Bitcoin wiki, it refers to:

  Hash per second is an SI derived unit representing the number of double SHA-256 computations performed in one second, referred to as hash rate. It is usually symbolized as h/s (with an appropriate SI prefix).

You are correct in noting that the nonce space is quickly exhausted with modern miners.

This is solved by updating the so-called "extraNonce" in the coinbase transaction. This has the effect of changing the hash of the coinbase transaction, which in turn changes the merkle root included in the block header. This essentially provides an additional 32 bytes of nonce space, since the coinbase tx can be modified as many times as required.

Additionally, but not nearly as relevant with today's hashrate, the timestamp field of the block updates every second and allows for all nonces to be recalculated with the new timestamp as well.


How can I know which user made which BTC transaction? I am making an app, and I want my users to deposit BTC coin to my address which is an exchange address (I don't have the private keys).

How can I know which user made which transaction?

I have a way, which is to add the numeric user ID to the amount , for example if an user wants to deposit 100.00 BTC coin , and the ID is 158769, I can add the ID in the amount like this: 100.0000158769 and make it as a QR-code so the user should deposit the exact amount so I can know that he made this transaction.

But is there any other way to do it , any idea?

Thanks in advance

You give each customer a different address. That is the only reasonable approach.


Can a blockchain's transactions be reversed? Blockchains are often described as 'immutable' (meaning the history cannot be rewritten after the fact), but is this really true? How easy is it to change the history?
I have read about the Ethereum DAO hack and how the blockchain has been hard forked to reverse a transaction by the hacker. This is very disappointing. I thought cryptos by design were irreversible, even with a hard fork.
How can we measure the immutability of a blockchain? Is Ethereum less safe than Bitcoin, for example?

The Bitcoin blockchain is not absolutely immutable, it is probabilistically immutable.

We say this because the history of transactions (the blockchain) is secured by mining power, and mining success is a probabilistic. Given a certain amount of hashpower, we expect that we'll find a block within some certain amount of time - but it is possible to find the block on the first attempt, however incredibly unlikely that may be. So for an attacker to re-write history, we expect that they will need a majority of hashpower on the network, otherwise probability is working heavily against them. For more info see section 11 of the original bitcoin whitepaper.

So the finality of a transaction is related to what portion of hashpower is being controlled by 'honest miners'. Thankfully, there are heavy financial incentives for miners to behave honestly, and so after a decade of operation, we haven't seen a majority-attack against the network take place.

The DAO hack was a different situation: ethereum developers decided that rolling back the chain to erase the DAO hack (and all transactions that had happened since then) was a good idea. This led to an interesting conundrum: what is the real guarantee offered by a blockchain? Is it probabilistic immutability? Or is there more to it than that? How much does the human element weigh in, and control the outcome? Why did the Eth developers have such power?

This is an important test of one of the core tenants of a system like Bitcoin: does any group control the protocol? How large of a group is needed, before effecting a change becomes possible?

If every single bitcoin user decided that it was a good idea to change the protocol to include a mandatory cat image with every transaction, then it would be simple to make the change (after all, everyone already agrees, and will implement the change). However, if only a small portion of users want to make this change, then they will need to convince the rest that it is a good idea. As the network grows and more users come on board, this becomes increasingly difficult to accomplish.

For bitcoin (or any blockchain) to succeed, it is paramount that no small group is able to make these sorts of decisions unilaterally, otherwise that group would represent a huge threat to the network. If the group were compromised by a bad actor, they could wreck undue havoc on the network.

This is a crucially important point: having a large, decentralized network with many users makes it more difficult to enact change. If a network has a small number of users, it will be easier to convince a majority of them to make the change.

Looking at Bitcoin's history, we can see that it is extremely difficult to force a change onto the network. Some of the most influential businesses, persons, miners, and some developers pushed heavily for a change in the base block size in 2016/2017, but were unable to convince the majority of network users to go along with it, and thus failed.

Even the developers cannot unilaterally push a change onto the network. They can propose changes (including rolling the chain back), but if the users (ie those that run nodes) do not agree with the change, then the devs cannot force it through. The open source process involves a ton of peer review and is a transparent process that would be difficult to push a contentious change through. Anyone is free to propose a change, of course, but the onus is on the proposer to convince everyone else that it is a good idea.

TL;DR:

As a user, you should want some guarantees that the system of money you are buying into will not be arbitrarily changed or rolled back at some point in the future. This means at least two things:

There is a large amount of mining power securing the network (and no large pool of hashpower that could be pointed at the network exists otherwise).
No small group of people can easily force a change onto the network.


Can I buy stocks with Bitcoin? I have got some USD balance with a Bitcoin exchange. I intend to buy stocks for these USDs. Is there an online broker that accepts Bitcoin as a deposit option for stock market trading? I mean the usual stock market where items like Google, Microsoft etc. are traded. Or do I have to go the usual way of withdrawing my USDs from the exchange to my bank account and then invest from there?

I am not aware of any. Whilst I like to think of such not-yet-existing services as simply waiting to be provided soon, there is a significant barrier to creating such a service. A broker wanting to offer taking bitcoin deposits as collateral for your stock holdings would need a reliable and classical-finance-compatible way of converting this collateral into USD. This would be needed in case stock price or bitcoin price movements come close enough to using up all the available collateral. With stock exchanges, the broker can do such a service whilst not taking any risk not somehow addressed or knowingly tolerated in the world of finance. Existing bitcoin exchanges do not fit into this because they operate slightly differently from regular stock or foreign currency exchanges. Hence there is additional risk that, whilst apparently acceptable to customers of existing bitcoin exchanges, would probably be seen as utterly unacceptable on many levels by a broker (regulatory, reputational, own risk assessment, ...). Basically, I think such a broker would have to find a bitcoin exchange operating the same way and regulated in the same way as a stock exchange, to be able to make it square with the rest of his business. There may possibly be exceptions among brokers only catering to accredited investors---those are people rich enough that the law automatically trusts them to enter financial business otherwise prohibited for customer protection reasons. But if you qualified as such, I doubt you'd go to a website for advice about finding a broker...


Bitcoin core wallet - got 0 balance after transaction I did a test lightning transaction by sending 0.00001 btc to some exchange with using bitcoin core 0.16 (downloaded from bitcoin.org and installed to dedicated pc) and... it took the rest balance of my wallet which was sent to unknown address.

Here is the transaction: https://www.blockchain.com/btc/tx/5d6111094be588c180661cb2f0ee21a7de28a7dea8641cb9921b4aada3175dd5

As you can see there is 0.00001 btc sent to some exchange wallet and also 0.00948723 is sent to unknown address (exchange says it's not belongs to them).

What was the second transaction?

The second output is most likely change being returned to your wallet. Just like when you use a $5 banknote to buy a $1 item. You get $4 back in change. You don't try to tear off 1/5th of the $5 banknote.

Unspent Transaction outputs (UTXOs) can't be half spent, you spend the whole UTXO and get change back.


What is the math behind Bitcoin's elliptic curve? I have seen many videos regarding the math behind the bitcoin elliptical curve but none of them show the public key generation. They are just defining few steps. I need the complete math behind the elliptical curve in which the generation of the public key is defined. Actually, I would like to see a visualization of the public key generation, could someone give me a link which explains the math behind elliptical curve?
What I understand that is k * n times G is equal to the public key but my question remains the same. If kn times G (where every point of G we get from point multiplication and point addition ) then at every multiplication of kG will result a different value then how can we combine them to get the public key?

In ECDSA, the private key is a scalar 256-bit number. The public key is a elliptic curve point on the secp256k1 curve. Elliptic curves are abelian groups made up of the set of points resulting from repeatedly applying its group operation starting with its base point G. The group operation is the addition of two points. So, starting with the base point as the first element, the second element is G+G, the addition of G to itself. The third element is G+G+G, etc. To enumerate all points of the curve would take eons, because the group order is 115792089237316195423570985008687907852837564279074904382605163141518161494337.
Anyway, to find the public key Q corresponding to a private key k, you have to "walk" k generator steps from the base point. We write this elliptic curve scalar multiplication as

Q = G+G+…+G [k-times] = kG

Now secp256k1 is defined as

y² = x³+7 mod P

where P is

P = 2256 - 232 - 29 - 28 - 27 - 26 - 24 - 1.

In secp256k1, the base point is G(Gx,Gy), where

Gx =
55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy =
32670510020758816978083085130507043184471273380659243275938904335757337482424

The addition of two points is defined as

P + Q = R
(xp, yp) + (xq, yq) = (xr, yr)

Which works out to be

xr = (yq - yp) / (xq - xp) - xp - xq
yr = ((yq - yp) / (xq - xp)) × (xp - xr) - yp

Note that the values are limited to [mod P]. So, taking your private key k, you now add G k times. There are some recommended shortcuts like first splitting k into a sum of factors of 2 (e.g. 37 = 1 + 22 + 25), because it will speed up your calculation immensely. Since the numbers involved are kinda hard to keep track of manually, I'd recommend using a software library.

Sources:

Wikipedia: Elliptic Curve Digital Signature Algorithm
Crypto.SE: How to generate a public key from a private ECDSA key?
Jun Wang: ECDSA and Bitcoin II
Wikipedia: Elliptic Curve Point Multiplication


How to alter user's data in block in blockchain if i want to change user's details In blockchain each user's data stored in seperate block, right? If I have created my own blockchain and i want to alter some user's data then I would need to alter some perticular block as I have stored data in that perticular block. but it will break proof-of-work. So how to change block in blockchain to alter user's data? If I create new block with updated details then what happened to old data and next time how to know which block to refer?

In blockchain each user's data stored in seperate block, right?

No, blocks do not store user data, they store transactional data.

A user of bitcoin can create a wallet using software of their choosing, and the wallet will store their keys that allow them to spend coins. The blockchain simply has a record of transactions, but no accounts/personally identifying information.

Instead the blockchain just specifices where the coins exist (in a certain address as a UTXO), and then users can spend coins if their wallet software contains the keys to that address.

So you never have to go and change an old block in order to spend coins. If you're trying to spend coins that were last sent 10 blocks ago, then you just need to sign using the key that corresponds to the address those coins exist at. This will create a new UTXO, with your transaction specifying which new address the coins will be locked into.


Will ripple automagically use the ordebook when finding a path? I have a question regarding this scenario.

A (test-gateway)

28000 XRP in balance

B (user1)

trust line with A for 1000 USD
400 XRP in balance

C (user2)

trust line with bitstamp for 100 BTC
400 XRP in balance

A issues 100 USD/A to B

B now holds 100 USD/A in the balance

A open a trade giving 10 XRP for 1 USD/A
B wants to send 0.1 BTC/bitstamp to C using his USD/A IOUs as source.

Will ripple do this?
  USD/A => XRP => BTC/bitstamp

Because i can't make it work.

C has a trust line to bitstamp.
B has no trust line with bitstamp, should it have one?

(there's a lot liquidity XRP<=>BTC/bitstamp in the order book)

There is a missing piece in your picture, the trade offers selling BTC/Bitstamp for XRP. The values you give won't work currently since the best offers in the order book are in the range of 8300 XRP/BTC or 830 XRP for the 0.1 BTC you mention.

If the values you give were adjusted or if we assumed an alternate reality where 10 XRP could buy 0.1 BTC/Bitstamp then the following should (see note at bottom*) be what a user would see if they were to go to the client's "send" page (sorry no picture):

Recipient: C
Recipient will receive: 0.1 BTC
You can send:
    10.000 XRP  <Send XRP button>
    1.00 USD    <Send USD button>

Since User B has no BTC there is no BTC option given. If the user selects "Send XRP" then a payment path such as the following would be used:

User B 10.000 XRP
   --> trade offer for 10XRP to 0.1 BTC/Bitstamp
   --> Bitstamp
   --> User C

User B's balance goes down by 10.000 XRP. The unknown person making the trade offer has their balance go up by 10 XRP and down by 0.1 BTC/Bitstamp. Bitstamp's balances are adjusted so that 0.1 BTC less is "owed" to the trader and 0.1 BTC more is "owed" to User C. User C's balance goes up by 0.1 BTC/Bitstamp.

If instead User A selects "Send USD" then a payment path such as the following would be used:

User B 1.00 USD/A
    --> User A's offer giving 10.000 XRP for 1.00 USD
    [then as above]
   --> trade offer for 10XRP to 0.1 BTC/Bitstamp
   --> Bitstamp
   --> User C

User B's balance goes down by 1.00 USD/A. User A's balance goes up by 1.00 USD/A (they owe one less USD to User B) and User A's balance goes down by 10.000 XRP. Then it's as in the previous case: The unknown person making the trade offer has their balance go up by 10 XRP and down by 0.1 BTC/Bitstamp. Bitstamp's balances are adjusted so that 0.1 BTC less is "owed" to the trader and 0.1 BTC more is "owed" to User C. User C's balance goes up by 0.1 BTC/Bitstamp.

In both cases User C considers the payment from User A complete by ending up with a larger balance with Bitstamp. All of these balance changes happen atomically within a single transaction, either all the balances change or none of them do (e.g. if the transaction fails because a required trade offer is consumed or canceled before this transaction can be processed). User B never ends up holding something they didn't want to hold (e.g. BTC/Bitstamp).

Note that path finding in Ripple is not exhaustive, not all valid paths are found. As David Schwartz says above, pathfinding is an area they are constantly improving. If the option to pay with USD as shown above is not presented currently then it's likely it will be as the pathfinding is improved.


Correct way to convert a 256-bit private key to WIF? On the Bitcoin wiki it has steps to convert a private key to WIF. So I tried following these steps in attempt to get the same result.

So I took the private key.

0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D

I put 80 on the front.

800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D

And then I performed SHA-256 on it using this.

e2e4146a36e9c455cf95a4f259f162c353cd419cc3fd0e69ae36d7d1b6cd2c09

And that is where I run into a problem. On the wiki page it says the result of SHA-256 should be...

8147786C4D15106333BF278D71DADAF1079EF2D2440A4DDE37D747DED5403592

And that does not match my SHA-256 result.

Not sure what I am doing wrong.

You're performing a SHA256 on an ASCII string, not on the actual number. That ASCII string is actually the hexadecimal representation of the actual number.

This is a little code snippet that uses a hex2bin function to turn the hexadecimal representation (from your question) into an actual number before performing the sha256 on it.


How does the 12 keyword back phrase works and how does it allow the creation of infinite number wallet address across multiple cryptocoins? I wonder how crypto wallet like BitPay works?

They claim to be an offline wallet that you can back up with simply a 12 words phrase. Yet, they allow you to create an infinite number of wallets across multiple coins like BTC, BCH, ETH, XRP ...

How does such wallet keep track of the created addresses without relying on an external 3rd party server and how it uses to the 12-word phrase to access the private key of each and all of these created wallets?

Per BIP39 the original entropy in form of mnemonic can be translated to master seed per BIP32.

  This document describes hierarchical deterministic wallets (or "HD
  Wallets"): wallets which can be shared partially or entirely with
  different systems, each with or without the ability to spend coins.

  The specification is intended to set a standard for deterministic
  wallets that can be interchanged between different clients. Although
  the wallets described here have many features, not all are required by
  supporting clients.

Using BIP44 one can use different coin_type codes for different currencies and standard derivation is m / 44' / 0' / 0'

BIP44:

  m / purpose' / coin_type' / account' / change / address_index

As far as I know BitPay/Copay use this derivation type.


Can I make and host bitcoin wallet in my own website to get rid of using 3rd party wallets I searched a lot about it but didn't get a proper answer I want to build my own bitcoin wallet and host it on my website for my personal usage and other visitors use.

If someone know that how to do that then please send me some links for reference

Thanks

First off, you'll need to have full access to your server, because you need to be running a Bitcoin-node (constantly) connected to the Bitcoin Network. So a simple shared server won't cut it. You could connect to your remote Bitcoin-node. But in that case, you still need a server to run that node.

The programmer's way:

Install and run a Bitcoin-node on your server. HOW
Learn how to use JsonRPC in your preferred programming language.
Use the API to program your own virtual wallet.

(basically how all online wallets more or less function)

The lazy programmer's way

Install and run a Bitcoin-node on your server.
Use a third-party DIY self-hosted wallet, like Coinpunk

(Note: as indicated on the website, such projects are still very beta. Careful.)


When you buy bitcoin do you get the private key mailed to you? I'm very confused about how you get your private key and how you can transfer it.

When you buy bitcoin do you get the private key mailed to you?

No

There are lots of ways to buy bitcoin but usually I'd expect they don't involve creating a private key at all. You should ideally already have one before buying Bitcoin.

If you buy Bitcoin on a service that keeps your Bitcoins in some kind of customer account then most likely you don't have any private keys and are not the owner of Bitcoin - just the possessor of a kind of IOU.

  I'm very confused about how you get your private key ..

It varies but perhaps the most common way is that you download and install a standalone wallet program and, the first time you run it, it generates a random private key and stores it in a wallet data file. Typically you never see it.

  ... and how u can transfer it

You rarely need to.

Many wallets have a function to create a backup. You then put that backup somewhere safe that is separate from your computer. That backup will contain the private key. If your wallet (or whole computer) is destroyed or lost, you can re-create your wallet from the backup.

Many wallets will give you a "recovery phrase", sometimes called a "seed phrase". Often of twelve or twenty-four words. You can save that recovery phrase somewhere safe (e.g. stamped onto a sheet of corrosion-resistant metal with a high melting point stored in a safe in another building). That recovery phrase can be used to re-create your private key in a new wallet on a new computer. Don't confuse the recovery phrase with a password or pass-phrase used to open a wallet.

Many wallets let you see the private-key in some form. There is a form called WIF. Again that can be stored somewhere safe and used to recreate a new wallet with the same private key.

If you don't like your current wallet and want to start using a new type of wallet, the safest process is to create a new wallet and, on the old wallet, create a Bitcoin transaction to transfer the money into the new wallet. Some wallets allow you to "sweep" keys into them which is the same process but uses only the new wallet to create the transaction.


How much memory (RAM) does a Bitcoin node use? How much memory (RAM) does a Bitcoin node use?

I am planning on running a Bitcoin full-node on a RasPi Model A+. It only has 256MB of RAM, so I'm not sure if this will work. Most of the threads on here and bitcointalk are very old, and I'm not sure if the memory requirements are greater now.

In addition to my answer to the question Minimal system to run a full Bitcoin node: Netbook? Raspberry Pi? etc:

I just restarted my full node and waited for it to receive a new block, which revealed that 256MB of RAM will not be enough for running a full node without memory paging/swapping:

so I would suggest you opt for RasPi Model B+ which comes with double the RAM of its A+ predecessor or you can equip your A+ with a flash storage but you should expect degraded performance in this case.


How can I recover dogecoins sent to a Bitcoin address? I had transferred my Poloniex dogecoin cryptocurrency and accidentally sent it to a Bitcoin paperwallet using walletgenerator.net. It did go somewhere but do not know where.
Is there someone to contact for missing cryptos? I thought the Dogecoin address is different than the bitcoin and would not transfer.

Even though the address format is different (the prefix part) the transaction is valid so there will be a transaction on Dogecoin blockchain to the address.

I found a reddit thread where they suggest to save your private key in the Bitcoin client and import it to your Dogecoin client, although it is not certain this will work, I think this is your best chance, as transactions are irreversible by design.

In the original Bitcoin Core client you export in the debug window (based on this and this):

click on 'help' in the menu bar (top right)
click on 'debug window'
select the 'console' tab type: walletpassphrase "passphrase here" 600
type: dumpprivkey [address here]

Then to import navigate to the same window in Dogecoin client and

type importprivkey [private key here]


Are there any other blockchains that can spawn child-chains within their own blockchain like NXT's Ardor platform? NXT is transitioning into a child-chain or sidechain type of blockchain as a service model. I know Bitcoin has the ability to issue colored coins on counterparty and colorcoins, but is there something similar to what NXT's Ardor platform is doing? Where by you can copy the existing blockchain features, but spawn your own while using the parent chain to secure it. Is there development going into this child-chain / side-chain arena in either Bitcoin or another Altcoin?

With special transactions, Bitcoin has the capability of supporting sidechains. This is different from childchains in that the sidechain itself is a different blockchain and is not extended from the main blockchain. The paper describing sidechains can be found here: https://blockstream.com/technology/sidechains.pdf and an implementation of those sidechains can be found here: https://github.com/ElementsProject/elements.


What is "segregated witness" and how can it improve network scalability? I've just heard about it, and it is claimed to be a "turning point" in the block-size debate.

What is "segregated witness?" how does it work?

How can it be used for improving network scalability?

Is this the answer to all of network's scalability concerns?

It's not a silver bullet solution, but it's a really good start.

As Gavin Andresen has said, Segregated Witness is a poor name. The 'segregated' part of the name is there to denote that there is separation being done. The 'witness' portion of the name comes from the fact that digital signatures are often time called witnesses.

Segregated witness splits up transactions into different parts that can be handled separately instead of the single chunk of data as they are now. Specifically, it takes the digital signatures out of transactions and puts them in a separate merkle tree that has the same structure as the transaction merkle tree. So, if fully implemented, to check that an input legally spends its previous output, you would get the signature from the signature tree, instead of the standard scriptSig field.

These are a few of the benefits of this idea:

Since signature data (witness data) is stored outside the transaction (and outside the standard block), it means that that data doesn't have to be counted towards the block size. Pieter Wuille is proposing a 75% discount on space taken up by signature data, meaning that you can fit 4x as much signature data into blocks. This effectively results in a soft fork increase to the block size.
Completely solves malleability issues. Using transactions with the signature data outside the transaction means that TXIDs don't hash the signature data, which means that they're not malleable (assuming you're using the standard SIGHASH flag). Technically, the signatures are still malleable, it's just that modifying them doesn't invalidate chains of transactions because the signatures don't sign the modifiable parts.
Allows for a slow upgrade. Software has to opt in to using Segregated Witness after it has been fully deployed to the network, but in the meantime (and afterward) transactions can still be made as usual without segregated witness.
All future Script updates become soft forks. When segregated witness gets fully implemented, it will have a version byte in outputs for what version of Script it is using. And the behaviour for clients that see a script with a non recognized version number is that they treat it as an 'anyone can spend' output.
Signatures only prove that a transaction is authorized, it doesn't describe where funds are going or where they came from. So, after they're checked they can be discarded. Putting the signatures in a separate data structure makes it much easier to prune that data, which results in much less blockchain data needing to be stored on your hard drive.

However, this doesn't completely increase the block size, it just increases the amount of signature data that a block can store. Since transactions are roughly 60% made up of signature data, this is still a pretty big gain.

The downside is that it's a non-trivial upgrade for the network to start using segregated witness. The transaction serialization format is different, and code everywhere that makes bitcoin transactions needs to be updated. Since it's an opt-in process, though, upgrading can be done slowly over time.

You can watch Pieter Wuille's great talk on Segregated Witness at:

https://www.youtube.com/watch?v=fst1IK_mrng&feature=youtu.be&t=37m12s.


Can anyone assign btc address with wallet? can anyone assign btc address with wallet?
I mean if I create like 5 addresses in one wallet, can anyone from outside prove that these 5 addresses belong to one person/wallet?
I know you can see IP that relayed the transaction, but if you use TOR or some other SW there will be plenty of relayed transactions from that IP so it will not say anything.. or am I wrong? Thanks for answers.

Yes it's possible if you don't take care.

Let's imagine you have 1BTC on each of your five BTC addresses.

Now you want to spend 4.5BTC, your transaction will look as following

input:
Addr A (1BTC)
Addr B (1BTC)
Addr C (1BTC)
Addr D (1BTC)
Addr E (1BTC)
output:
Addr X (4.5BTC)
Addr Y (0.5BTC) // the change

By seeing such a transaction you can easily deduce that the Addresses A,B,C,D,E belongs to the same person.

Note that this is not a 100% evidence because several people can put their coins together in one transaction for example for an Assurance contract.

Note that when you use TOR it creates a static route from your computer to an exit node. If you don't click on the 'Use a new identity' button your transactions will be broadcasted through the same TOR exit node. So click on 'Use a new identity' between each transactions.


Transfer Blockchain.info to Electrum I am moving to Electrum from Blockchain, but I can't find any guides or tutorials on the internet that explain the process of tranferring a Blockchain wallet to Electrum. I have a multi-signature wallet by the way.

Thanks.

The easiest way to move these funds is simly run both wallets and transfer the funds in a regular transaction.

For safety sake keep a backup of your old Blockchain wallet as you may find out in the future that you need the keys such that a service may have sent funds to a preregistered address or someone reused an old address.

Remember to create a backup of your new seed which Electrum will provide to you.


Are Bitcoins contained associated with a wallet or with an address in a wallet? What I want to know is, if I have a wallet with several addresses containing 10 BTC (let's say 1 BTC per address) in total and I want to send 5 BTC to a person, but first generating a new address (as this is advised for privacy reasons). What happens then?

Are the Bitcoins from 5 random addresses first accumulated into the address I just generated, after which I can then use it to send the money to the receiving party?

Or how does it work?

Bitcoins are associated with Unspent Transaction Outputs (utxo). A UTXO contains a script that defines the terms under which it may be spent. Usually, this terms are as simple as "sign with correct private key", where said private key is associated with an address.

If you create new addresses in your wallet, your coins are not moved. When you want to spend five of the bitcoins from your example, you'd end up using-up five UTXO with a balance of one bitcoin each.

If you'd want to collect them in one address first, you'd have to send five bitcoins to the new address you created, i.e. actively send them to yourself.

I don't think that you'd increase your privacy by much, if you just sent the coins to yourself and immediately pass them on. Maybe a bit more plausible deniability, but not really much (because it would be curious that you'd just received five bitcoins from somebody else in the moment when you sent them on their way again).

What is commonly meant with the "new address for each transaction" paradigm, is that you never give out the same address for receiving a transaction twice. To wash coins by sending them to yourself, you'd probably want to send them to yourself several times and split them up in a bunch of different ways. However, if a good number of the outputs were then spent together in one transaction again, it would be obvious that you had split them up yourself anyway.


where is the specification for bitcoin block-chain mining? 1.) Who wrote the rule book and where is it stored?

2.) Is it stored in a block chain?

3.) Who said bitcoin could hard-fork?

4.) What if some bitcoin holders don't want a hard fork?

Who wrote the rule book

Satoshi, whoever that is, wrote the original set of rules. They have evolved a bit over time.

  and where is it stored?

In every node that runs bitcoin software.

  Is it stored in a block chain?

No.

  Who said bitcoin could hard-fork?

Nobody. It's a consequence of the way the system works. If two nodes use different rules, it's simply a fact that they can permanently disagree on which transactions are valid.

  What if some bitcoin holders don't want a hard fork

Then they should run code with the very same rule book as those who agree with them on what the rules should be. They will then never fork from each other, but the rest of the world may follow different rules. Nobody gets to force anyone else to use rules they don't wish to use, but only people who agree on rules can interact with each other.

This is why we have Bitcoin and Bitcoin Cash. There are two groups who cannot agree on the rules the system should follow.


How long are orphaned or stale blocks kept in bitcoin core nodes memory? If there was a chain reorg, for example:

Blockchain:

0a---1a---2a---3a

becomes...

0a---1a---2b---3b

How long are blocks 2b and 3b kept in memory on the node?

If I query the node for block 2b later (getblock(2aBlockHash, VERBOSITY_LEVEL = 2)), will it still return it to me?

Thanks!

What you are referring to are stale blocks. Orphaned blocks are one for which the previous (parent) hash field points to an unknown block or to a block not yet processed by the local node. Since Bitcoin Core follows headers first approach, block headers are downloaded and validated first before downloading the block data. As a result, full nodes will never receive blocks whose parents it doesn't know about. So with the current headers first approach an orphan block will not be downloaded by your Bitcoin Core node.

Now, coming to stale blocks. All blocks are stored on the disk in the blocks/blk*.dat file. The block data that you receive from your peers, if it is valid, is stored forever in that directory. However, in order to receive stale blocks, you need to be online at the time when your peer broadcasted a block to you from different chain view. Peers will only broadcast those blocks that they view form the current active chain from their perspective. So using that command, you will only be able to retrieve the stale blocks that you received when you were online.

You can use the bitcoin-cli getchaintips command to return information about all known tips in the block tree, including the main chain as well as other branches.


How does AsicBoost work? The AsicBoost paper by Timo Hanke and Sergio Demian Lerner describes a way of increasing ASIC performance by 20%. It's a bit sparse on the details, though. What are they optimizing?

Introduction

AsicBoost speeds up Bitcoin mining in general (for ASICs and CPUs alike) by reducing the frequency of computing one part of the SHA-256 calculation.

A Bitcoin block header is 80 bytes long. It fits in 2 blocks for SHA-256 hashing. It gets hashed into a 32-byte value, then hashed again (1 block) to get the final value that is compared to the threshold.

Pseudocode

The conventional way to do Bitcoin mining looks like this:

while True:
    blockHeader = ...  # based on Merkle root and other fields
    sha256Block0 = sha256Expand(blockHeader[0 : 64])
    midState = sh256Compress(sha256InitVector, sha256Block0)

    for i in range(2**32):  # Try nonces
        blockHeader.nonce = i
        sha256Block1 = padAndExpand(blockHeader[64 : 80])
        singleSha = sh256Compress(midState, sha256Block1)

        sha256Block2 = padAndExpand(singleSha)
        doubleSha = sh256Compress(sha256InitVector, sha256Block2)
        if doubleSha < target:
            miningSuccessful(blockHeader)  # Jackpot!

Notice above that the inner loop has 2 calculations of block expansion and 2 calculations of block compression.

Now what AsicBoost proposes is that we somehow find a bunch of blockHeader values where sha256Block0 is different but sha256Block1 is the same. Because the Merkle root field straddles both hashing blocks, it means we need to group candidates by the last 4 bytes of the Merkle hash. Now the mining algorithm looks like this:

while True:
    blockHeader = ...  # based on various fields
    candidates = dict()  # 4 bytes -> sets of blocks
    for i in range(...):  # Generate the more the merrier
        tempBh = blockHeader.randomizeMerkle()
        sha256Block0 = sha256Expand(tempBh[0 : 64])
        tempBh.midState = sh256Compress(sha256InitVector, sha256Block0)
        candidates[tempBh.merkleRoot[28 : 32]].add(tempBh)

    for i in range(2**32):  # Try nonces
        for key in candidates:
            tempBh = candidates[key][0]
            tempBh.nonce = i
            sha256Block1 = padAndExpand(tempBh[64 : 80])

            for tempBh in candidates[key]:
                singleSha = sh256Compress(tempBh.midState, sha256Block1)
                sha256Block2 = padAndExpand(singleSha)
                doubleSha = sh256Compress(sha256InitVector, sha256Block2)
                if doubleSha < target:
                    miningSuccessful(blockHeader)  # Jackpot!

Now notice that the inner loop performs 1 calculation of block expansion per candidate group, and then 1 calculation of block expansion plus 2 calculations of block compression per candidate block header.

Thus the technique wins over conventional mining when most candidate groups have more than one candidate, and that the overhead of generating and sorting candidates exceeds the gains from saving at most one calculation of block expansion per candidate.


How to migrate lightning nodes? I am wondering what steps to take to migrate a lighting node to a different server, keeping the pubkey/identity. The safest option is obviously to close the channels first. How is the identitiy pubkey created? From the 24 seed, random, or other means?
In case I want to tranfer the node with opened channels, which files would I have to make sure to backup / transmit?

In C-Lightning it is fairly easy. Just shutdown the server and make a full backup of the ~/.lightning folder. This folder contains in particular the HSM secret which is used for key derivation of later keys and it also has the sqlite3 database which is used to store all current states. This means that there is no need to close channels or anything.


How to find a specific bitcoin address from all the addresses? Recently, I found a site that show all the addresses in a huge list, divided in 904625697166532776746648320380374280100293470930272690489102837043110636675 pages.

The site's link is http://directory.io/ and I want to know if I can find a certain address from the whole list. I already tried to merge all those pages into one list and then search for the address with the browser, but I'm not sure how to do it (because I don't know much about HTML).

So, if you know a way to do this, please tell me and explain me how. Thanks!

As Arturo and Aussie already said, directory.io shows all Bitcoin addresses sorted by private key. Also, the author explains his intent on directory.io/faq.

The first page has 11.302 Byte. Assuming they all are about the same size, 1TiB would just store 97,284,695 pages. Yet, there are 904625697166532776746648320380374280100293470930272690489102837043110636675 pages. That is approximately 9.05 × 1074, i.e. ~1066 TiB.

There is not enough memory to store them, and it is infeasible to search for one address in them in reasonable time.

Concluding, everyone's bitcoins are still safe. :)


Is Bitcoin given as a gift taxable? Question by someone who is new to Bitcoin. Bitcoin mining is considered taxable income in the US. However, if it's given as a gift, then should it be taxable under US law?

This is probably better for Money.SE as it doesn't really have anything to do with Bitcoin; it would be the same for any sort of  income.

However, my understanding of tax law with respect to gifts is roughly this:

Money, goods or services that you earn from working, business or investing are taxable income to you.
If you decide to give some of that money to someone else, that's your business; but you still earned it, and it's still your taxable income.  Giving it away doesn't change your taxes at all.  The IRS doesn't really care whether you gave it to your friend or used it to buy 300 pounds of jellybeans.
Within certain limits, the gift is not taxable income to your friend (who didn't earn it).  However, above those limits, it can be subject to gift tax.  I think beyond $13,000 per year, you have to start keeping track of such gifts; gift tax does not actually kick in until a larger number, but it counts gifts spread across several years.
The one major exception is if you give the money to a registered charitable organization.  Then you can deduct the gift from your income, again up to certain limits (usually 50% of your income).

Disclaimer: If you want tax advice, talk to a professional who's qualified to give it.  I'm not.


Help! Transaction unconfirmed after 1 day! I made a bitcoin transfer yesterday and it is still pending with 0 confirmation. The fee is around 0.003BTC and the miner preference is high though. Can anyone please help me get it confirmed? I'd greatly appreciate it.

Here is the link:
https://live.blockcypher.com/btc/tx/b79bffaec87a0e789be3465faecc394f692ef2c501ef2787dcbc3f56e16c7076/

At this point, AFAIK, no one can help you speed things up. There has been a record number of transactions over the last few days and the queue is really backed up.


How many consumer computers would it take to launch a 51% attack What is the hash rate of a standard laptop using the default client and what is it for the whole of Bitcoin? I am interested in this, because I want to understand what it would take to get to 51% of hashing power (is this what it is called?)

A standard laptop CPU provides around 2-8 Mhash/sec. An ATI 5870 video card, which has one the best efficiency/cost ratios, mines at about 400 Mhash/sec, and at the moment, the Bitcoin network has a total hashing power of about 12,460,000 Mhash/sec, which equals 31,150 5870 video cards.

So someone would need to invest about 10 million USD just to buy video cards, without including the cost of assembly and other hardware like mother boards, power supplies etc. It is possible to design custom hardware to do Bitcoin mining using an ASIC, which might have ten times better efficiency/cost ratio.

But it will be always too expensive to execute a 51% attack to justify just by the profit from the security breach because the Bitcoin network hash rate gets adjusted to the value of a Bitcoin -- in another words, people buy more mining hardware when the price of a Bitcoin goes up.


How can I recover btc that did not register to address I sent btc to davor coin from coinbase the night it crashed. Coinbase shows the transaction was accepted but I don't see my btc on the davor website. How can I recover my btc when davor is not responding

https://blockchain.info/address/16WArqNTvEYiZWgXXdfAPEQsgEubgNuYAq

The transactions to/from the address you linked have been confirmed and cannot be reversed.  If you click on the transaction IDs (e.g. cbbae668...), you will see the number of confirmations; currently in the thousands.

  How can I recover my btc when davor is not responding?

You cannot.  Davor owns those coins now, and any attempt to do anything with them will need their cooperation.  All you can do is ask them to credit your account and/or refund their coins.  You can ask politely, or rudely, or with the assistance of the legal system (i.e. try to sue them).  But this is no longer a problem that can be solved via technology.


How to send portion of funds from a private key programmatically? I'm building an app and one of my features is being able to scan a bitcoin private key and then send a portion of its funds to another address. How can I do something like this in javascript or php? Do I need to run my own Bitcoin server?

Is there an example script I can use where I can just plug in a private key?

You can either use your own bitcoind server or you can use a 3rd party API service.

Let's do a few examples of what you are asking.
I'll use short fake addresses and private keys as examples to make things easy.

PHP with a bitcoind server

<?php
require("easybitcoin.php");
$bitcoin = new Bitcoin("username", "somepassword");

//add the private key (label, key)
$import = bitcoin->importprivkey("5KL3cN..SOME_PRIVATE_KEY", "Satoshi1");
?>

What we did here was import a private key and give it a specific unique label.  This part might take a while as your node will need to rescan as you added a new private key and it needs to check for transactions.

Once the node is rescanned you can send the funds.

<?
require("easybitcoin.php");
$bitcoin = new Bitcoin("username", "somepassword");

//send the funds from the Satoshi1 account/label
$send = $bitcoin->$bitcoin->sendfrom("Satoshi1","1receivingAddress", 0.5);
echo $send ? $send : "Oops an error: ".$bitcoin->error;
?>

What we did above was use the sendfrom() JSON RPC command to send 0.5BTC from the account/label Satoshi1 to the 1receivingAddress. If successful it will respond with the transaction ID, or if an error it will print out the error.

This is just the code, you'll still need to set your VPS with bitcoind or you can run a node on your home computer and experiment locally using something like xampp.

PHP with a 3rd party API

Here's an example with blockchain.info wallet API. You can import the private key using their create wallet utility, and then later send from that specific address.

$private = "5KL3cN..SOME_PRIVATE_KEY";
$url = "http://127.0.0.1:3030/merchant/YOUR-GUID/create?password=YOUR-PASSWORD&api_code=YOUR-API-CODE&priv=".$private;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //change to true if your host can verify SSL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$ccc = curl_exec($ch);
$json = json_decode($ccc, true);
echo "
";
var_dump($json);
echo "
";

Then once created you can send from that specific new address that was imported.

$from = "1fromAddress";
$to = "1receivingAddress";
$url = "http://127.0.0.1:3030/merchant/YOUR-GUID/payment?password=YOUR-PASSWORD&api_code=YOUR-API-CODE&from=".$from."&amount=1000000&to=".$to;
//amounts are in satoshi so 1000000 is 0.01BTC
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
$ccc = curl_exec($ch);
$json = json_decode($ccc, true);
echo "
";
var_dump($json);
echo "
";

If you need help setting up bitcoind or blockchain.info's wallet API I suggest you check out my tutorials on youtube. The hardest part with the 3rd party route is getting an API key; I hear blockchain.info has been strict with these lately.

bitcoind server method: https://www.youtube.com/watch?v=cMM-t7azzJE
blockchain.info 3rd party method: https://www.youtube.com/watch?v=X8jsaf4sEgs


bitaddress.org: is the public key the same as the Bitcoin address? For paper wallets generated at bitaddress.org, are the public keys and BTC addresses the same thing?

No, they're not the same thing. Paper wallets are not generated differently as/in to comparison to normal wallets.
a bitcoin adress is part of a public key.

The address is at its most basic just a hash of the public key. The hash functions involved (RIPEMD-160 and SHA256) are cryptographic hash functions. They are often also referred to as one-way functions, which is exactly the reason why you cannot derive the public key from the address.
Oneway functions provide exactly that a = f(pk) so that given a you cannot derive pk.

So, an adress is basically the hash of a public key. x/x
Some good more indepth explanations of the differences here -> https://www.reddit.com/r/Bitcoin/comments/3filud/whats_the_difference_between_public_key_and/ctp3fc7/?st=jald5nmq&sh=620d5934
And, how the adress is derived from the public key is explained here ->
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses


Home address and transfers? I’ve been reading and researching bitcoin recently because I’m interested in the idea and would like to participate. My question is, since each bitcoin user is anonymous, if I bought something from someone else, how will they know where to send it? Also, if I’m transferring money to and from another person, how do I know it it going to the right person?

Bitcoin is not anonymous, it is pseudonymous.

When you send bitcoin to someone, they will tell you what their bitcoin public address is, and then you will send bitcoins to this public address. A public address is a random-looking string of numbers and letters, here is an example I just pulled randomly off a block explorer website:

15x6Ggmjwu6h5nDkidnkqpAms2L6JeuENJ

Privacy is maintained by not using an address more than once. If you have multiple people pay you at the same address, then those people will be able to know the other transactions you were involved in with that address.

Each address has a corresponding 'private key', and you need to know what the private key is in order to spend the funds. So you can tell people your public address(es) so that they can send money to you, and then you keep your private keys safe so you can later spend those coins! (wallet software automatically keeps track of private keys for you)


Why is 20 the maximum public keys in a multisig transaction? In script.h the following limit is set:

MAX_PUBKEYS_PER_MULTISIG = 20

I'm wondering:

Why is the limit set to 20?
How would one would construct a script that allows n more than the current OP_16?

E.g. would this work?

OP_m <pubKey1> ... 1 20 OP_CHECKMULTISIG

The number 20 seems to originate from this commit : 8c9479c6bbbc38b897dc97de9d04e4d5a5a36730, also tagged as v0.3.12, which introduced the term 'SigOps".  Sadly, I don't see any mention of this change in the commit message itself, or in this version's release note, and there isn't any documentation.

We see that both a limit for a maximum number of sigops in a block was set :

static const int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;

and a way of counting them :

int GetSigOpCount() const
{
    int n = 0;
    const_iterator pc = begin();
    while (pc < end())
    {
        opcodetype opcode;
        if (!GetOp(pc, opcode))
            break;
        if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY)
            n++;
        else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
            n += 20;
    }
    return n;
}

And the rules are still the same, specifically for bare multisig scripts (those not nested in p2sh or p2wsh).  A bare CHECKMULTISIG operation is always counted as 20 sigops (today 80, with witness scale factor), so allowing anything more than 20 checksigs in CHECKMULTISIG will invalidate this assumption and will make it so creating blocks with more then maximum allowed sigops possible.

The rules are less strict for p2sh\p2wsh scripts.  If the opcode just before CHECKMULTISIG is in the range [OP_1, OP_16], then that number is counted as the sigops for the multisig verification, with anything else counted as 20.  In practice, 15 is the maximum of pubkeys you can push as a p2sh script because of the 520 bytes push limit, but for p2wsh, an example of 17-of-20 would look like :

0x01 0x11 <pubkey1> <pubkey2> ... <pubkey 20> 0x01 0x14 CHECKMULTISIG


Unexpected behaviour Bitcoin RPC getbalance I am seeing a smaller amount of BTC when I run ./bitcoin-cli getbalance compared to ./bitcoin-cli getbalance "" Here is the documentation on GetBalance from the BTC wiki, which highlights why I am confused

getbalance [account] [minconf=1]

If [account] is not specified, returns the server's total available balance.
If [account] is specified, returns the balance in the account.

If no account is specified, it should return the server's total balance, and yet here is my result:

./bitcoin-cli getbalance --- 0.00001250

./bitcoin-cli getbalance "" --- 0.34869089

Why is this happening?

NULL and an empty string are interpreted differently. An empty string has no values. It’s an empty char array, one that hasn’t been assigned any elements. The string exists in memory, so it’s not NULL. Therefore we have two different labels and two different balances associated with those labels.


About traditional Bitcoin mining I'm curious about traditional bitcoin mining, before pooling.  Did an older version of the bitcoin wallet found on sourceforge have a mining feature built in which worked on a simple macbook?  if so was this later removed in favor of pooling software?

From what I've read the traditional bitcoin wallet had a mining feature which could be used on a macbook, and I'm wondering if that code would still be possible to use, even if it never wins any bitcoin..

The official Bitcoin full node software always had the mining feature built in, and will probably always have. If you have the line gen=1 in your .conf file, then you will start confirming transactions when you open the wallet. Take a look at https://en.bitcoin.it/wiki/Running_Bitcoin


Is in-person double-spending attacks negligible on bitcoin payments? If I'm planning to accept in-person payments in a store, is it negligible a double-spending attack or isn't it too hard to do?

Double spending attacks can certainly happen in person. A customer could have set up a system on a different computer which they remote into on their phone to initiate a double spend attack. However double spends can really only exist under certain conditions, so if you are planning on accepting unconfirmed payments, you should check that those conditions do not exist. This gives you a higher confidence in that transaction confirming.

You should make sure that the transaction does not have:

A low transaction fee
BIP 125's Opt in RBF flag set
A locktime that is in the future
Spending from any unconfirmed transactions
Is unusually large (e.g. several kilobytes)

If you check for these things and they are not in a transaction, you can be reasonably confident that the transaction will confirm.

You can also have a system set up to immediately perform a Child-Pays-For-Parent transaction so that you can ensure that the transaction has enough transaction fee to be confirmed. Note that if the transaction is Opts into RBF, this method may not work.


Nano Ledger s shows BTC when sending BCH I find this weird..

I have the nano ledger S
I open the Bitcoin app on the Nano Ledger S (so not the "Bitcoin Cash" app)
I open the Ledger wallet Bitcoin program on my computer
the propram asks me what bitcoin chain I want to use, I choose "Bitcoin Cash"
the program asks me to select my wallet (Main / Split), I choose "Split"
I now see my BCH balance
I click on Send
a popup appears which let's me select an adress and an amount of BCH to send
when I click Send, on the display of my Nano Ledger S I see "Amount 0.025 BTC"

Is this a bug in the nano ledger s?
Is my useage of Bitcoin cash without the "bitcoin cash" app wrong?

What am I sending.. BTC or BCH ???

I was having this problem too.  I realized where I was making an error, was when the google bitcoin app asks to open using the ledger, make sure you select the bitcoin cash icon on your ledger and not the bitcoin one.  That solved it for me.


What does bitcoin do that prevents someone from using your coins by just generating a key pair and saying "you" sent those coins? I think I'm missing and understanding about the current process of how your wallet works and how the transactions are signed.
For example, if I'm user "A" and there exists a transaction from user "B" where I received 10 BTC that has been written into a block. Then for me to use it I just generate a random public/private key pair and sign the transaction with the private key.
What is stopping user "B" from generating a public/private key pair then creating and signing a transaction saying that I, user "A" sent them 10 BTC?
I've read that some wallet implementations generate a list of public/private key pairs that can somehow be associated with the wallet address? I'm not sure how this would come into play if this is the case or if I'm misunderstanding this bit of information.

When you spend Bitcoin, you are not just using a new randomly generated keypair. You are using a specific keypair generated before. In order for you to have been sent Bitcoin, you have to give the sender a Bitcoin address. This Bitcoin address contains the hash of your public key. When you want to spend those Bitcoin, you put your public key into the transaction and verifiers will check that that public key hashes to the hash specified in the transaction that sent those Bitcoin to you. If you just put a newly generated public key there, it would not match the hash and so the spending transaction would not be valid.


Why would you need a mining pool? Why didn't the creator didn't manage to allow people to be able to mine without needing a mining pool ?

Mining pools allow miners to reduce the variance of their income. It is possible to mine without a pool. This is known as solo mining.


Want to have private key of my brc address How can i have my private key. Actually the bitcoin address which i have is generated from 'freebitco.in' . They haven't provided any private key.

Please help me in having private key.

I do not know the site but it is just easier create a new address on a wallet that allows to export the private key and send your bitcoins to it.


Bitcoin Core lost coins i have lost a bit of coins using Bitcoin Core wallet.
I have send my coins from Bitcoin Core wallet to my address on Bitstamp(copy/paste,no mistake here) and on my Bitcoin Core wallet has said "sent" as allways...than my computer crashed and there was no way of fixing it other than format an re-install Windows. I know it was stupid not to have a backup of wallet, but it is too late for that. I tryed to find the transaction using the addres i have send to, but there is no transaction found.
I have no other info about my wallet, except a couple of addresses that i have generated on my Bitcoin Core wallet, when i was sending coins to my Bitcoin Core wallet.
Is there ANY way i can get my coins back?
And if not where are thay?
Will pay a finders fee :)

Is there ANY way i can get my coins back?

No because you

don't have a backup
don't know the private key
don't have any recovery phrase (if applicable)
overwrote the disk
(though there was still a tiny chance of recovering a wallet.dat)

  And if not where are thay?

They are in the blockchain but can never be used.


Why do some addresses seem to send bitcoin to themselves? When looking at block 630873, I noticed that some addresses seem to send BTC to themselves:

Am I misunderstanding the situation, or does 1A7tWftaGHohhGcJMVkkm4zAYnF53KjRnU send large sums of BTC to itself? If that is the case, why is it beneficial?

This type of transaction is very popular amongst exchanges with hotwallet scheme. They use hotwallet (in this case the 1A7... address looks like it) to send withdrawals to clients, the change is going back to the hotwallet.
Most bitcoin wallets don't allow for this behavior, creating a fresh change address every transaction.


How to connect to antpool? So I'm using an antminer s3. I have been on btc guild for about a week. Today they announce they are closing. So I looked around and figured I would join antpool.

The problem is when I changed all my pool config, my antminer won't start. It turns on and the fans spin very slowly.

When I was on btc guild the miner ran right away. I'm not sure what the problem is. My miner stats say this section contains no values yet.

I input everything the way it showed me on antpools website. Any ideas what I'm doing wrong? Is there something else I need to change?

I made a good tutorial on how to setup the antminer or any bitcoin miner to antpool using the gui. Here is the link to the video:  Hopefully   it helps!

How to setup Antminer S9, or any antminers GUI to Antpool set mining pools in under 8 minutes for 2018!

https://youtu.be/o8op00b7_RM


Xemian Xchange Api for Java, returning a default of 100 market orders For sometime I am using this java API http://xeiam.com/xchange/ for building bitcoin trading robots. Today I got a bit stuck and I wanted to see if somebody had the same issue before.

I call the order books like this:

OrderBook orderBook = exchangeMarket.getExchange().getPollingMarketDataService().
                                getOrderBook(CurrencyPair.LTC_BTC, new int[] {20});

My problem is that the orderBook object contains 100 asks and 100 bids. I just want 20. Does anybody know why this is not returning the amount I pass in the second parameter? BTW, if I try 150, it also returns 100. I don't know how to modify the amount of returned elements.

The Cryptsy driver does not support this, or any kind of argument, actually.

https://github.com/timmolter/XChange/blob/df9eb4e4d95c5bb3954b1527f585d9238514fa94/xchange-cryptsy/src/main/java/com/xeiam/xchange/cryptsy/service/polling/CryptsyPublicMarketDataService.java#L39

Neither does BTCE.

https://github.com/timmolter/XChange/blob/df9eb4e4d95c5bb3954b1527f585d9238514fa94/xchange-btce/src/main/java/com/xeiam/xchange/btce/v2/service/polling/BTCEMarketDataService.java#L55

However, the BTCE getTrades method does support a limit argument.

https://github.com/timmolter/XChange/blob/df9eb4e4d95c5bb3954b1527f585d9238514fa94/xchange-btce/src/main/java/com/xeiam/xchange/btce/v2/service/polling/BTCEMarketDataService.java#L78


Why are there not mnemonic-seed words in Turkish especially considering the increasing rate of bitcoin adoption in the country? How come bitcoin doesn't have Turkish words as wallet seeds especially considering the increasing rate of bitcoin adoption in the country ?

Because no one has stepped up to do the work or hire someone to do it for them. That's how open source works : )
This repository contains the mnemonic list in different languages (Currently just 8). There are also wordlists in other languages that are stuck in limbo. However if you find it to be worth it, you might want to prepare a list and submit it to the repository as a pull request, and one day it might get merged.


What keeps the average block time at 10 minutes? I've been told "the network" sets the difficulty level such that there will be one new block mined every ten minutes.

I imagine the rich would instead prefer to keep difficulty as high as possible to prevent other people winning their 50 BTC and causing inflation, whereas the poor would prefer as low a difficulty as possible in order to get a greater share of the BTC available.

(By rich and poor, I mean only according to how many BTC someone has.)

What's the force saying "No, forget your petty self-interest and set the difficulty to 10 minutes."?

The bitcoin network rules define which difficulty each block has. This is done through a simple formula that only depends on the block chain itself. This means that if you give me a blockchain with blocks 1 through N, I can tell you with 100% accuracy what the difficulty of block N+1 will need to be, and I can reject any block which has the wrong difficulty. This means it is not really "the network" deciding on a difficulty, but really each separate node calculating and enforcing it independently.

The actual formula is this: at every block N which is a multiple of 2016, look at the time stamps of the past 2015 blocks, and change the difficulty for what follows to old_difficulty*(2 weeks)/(time the past 2015 blocks took). Additional rules on which time stamps are allowed in blocks prevent cheating (mostly).

In short, by using a bitcoin client, you agree to its network rules, and those include the difficulty adjustment.


Does Bitcoin account for deleted bitcoins over time? I'm sure that this question has been asked before, but I just can't seem to find it.

If there is a limit of 21 million coins to be mined, then what happens if Bitcoin wallets get deleted? Will there still be some percentage of mining that occurs to make up for the lost coins?

If Bitcoin wallets get deleted, lost, or otherwise inaccessible, then the Bitcoins contained in them cannot be accessed anymore. There is no compensation for these "lost" Coins, and it is hard to see how there could be any such compensation. After all, nobody can prove that they lost some data. Hence any compensation scheme would likely be open to fraud.

As a consequence, Bitcoin has been called deflationary because presumably some such loss of Bitcoins will always happen. However, this does not mean that there will not be any mining after all Bitcoins have been created. Mining is driven by two kinds of rewards for the miners, the new Bitcoins (which will cease at some point) and the transaction fees that get transferred from the senders to the miners. Whilst usually it currently works just fine to send not-too-small transactions with zero fees, including one might just speed up transactions, so Bitcoin users actually have some (albeit possibly small) incentive to offer the miners a reward for their activity.


Wrong Electrum private keys when using BIP-84? I'm running pre-release version d8dad7 of Electrum that supports BIP-84 HD derivations.

When exporting private keys, I'm getting WIF keys that are different from the expected output generated by bx or iancoleman.io/bip39.

Example

Create a new Electrum wallet by importing the mnemonic tumble mistake gift ill hungry chunk suggest limit artwork filter peanut exhaust with path m/84'/0'/0'.

The first pubkey (m/84'/0'/0'/0/0) is correctly generated:
0300e0d90c8cb3e1bb7b7a82bd1a118c615d97c03dd3c5f607636e9305a22bbd3e

bx shows the same key:

mnemonic="tumble mistake gift ill hungry chunk suggest limit artwork filter peanut exhaust"
echo $mnemonic | bx mnemonic-to-seed | bx hd-new | bx hd-private -i 84 -d | bx hd-private -i 0 -d | bx hd-private -i 0 -d | bx hd-private -i 0 | bx hd-private -i 0 |bx hd-to-public | bx hd-to-ec

In Electrum, the corresponding private key (Wallet -> Private keys -> export) is displayed as LEF3hMKjm4E1MVsGZLpPb5Bjza8p7qqRYn4GzjyCK8Uo1CX8w3z2.

But bx ...

 echo $mnemonic | bx mnemonic-to-seed | bx hd-new | bx hd-private -i 84 -d | bx hd-private -i 0 -d | bx hd-private -i 0 -d | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-wif

... (like iancoleman.io/bip39) gives another result:
L5fR8BxqauJsNyrW1GRVnu6Fk8wAHRZhPLS9SHd6pej5isKt3qJH

Is this a bug in Electrum or an export scheme that differs from the regular WIF?

This discrepancy in private keys doesn't appear when using m/44'/0'/0' as the derivation path in Electrum.

Electrum uses a modified WIF that encodes the address type:

Release notes

Source


I bought some bitcoins from a friend, I don't even have a wallet, now what? I bought $10 worth of Bitcoin from a friend that does Bitcoin mining, but he told me I need a wallet so he can send them to me.

So how do I create a wallet and what information do I need to email to him so he can send those bitcoins to my wallet?

The two most common options for wallets are:

Online wallet

You basically sign up on a website such as Coinbase(recommended if you are in the USA), or Bitstamp( recommended if you are in Europe). There's also other options like: Mt.Gox, BTC-e, BTer, etc. There you should find an option to "Deposit funds" using Bitcoin, which will show you your wallet address. That is the address where your friend should send the bitcoins to.
Pro's: the third party website maintains your wallet synced for you, everything is based on the cloud, so you can operate from any computer.
Con's: the third party is essentially in charge of your money, so you have to trust them

Local wallet.

You download a software ( official one is here). Install and run it. Once you run it, it will take a from one to few hours to download all the blocks from the network.
Pro's: you don't need to trust any third party. So, unless someone accesses your computer somehow(i.e. physically, malware,etc). You are the only one in charge of your money
Con's: if you loose your wallet file(i.e. stolen computer, damaged hard disk,etc), you basically loose your money( unless you kept backups of your wallet). You can't operate in all computers, although you could in principle have your OS installed in a memory stick, hence being portable, and at the same time risky.


In what ways could "bitcoin" be hacked? Dan Kaminsky said that he spent 4 months trying to hack "bitcoin" but failed.

Besides trying to find vulnerabilities in double-spending and 51% attack, what other hacks would a hacker try to achieve?

Surely an established hacker like Dan Kaminsky wouldn't have spent 4 months just trying to prove the protocol is immune to double-spending and robust against 51% attacks. There had got to be more things that he was trying.

Exactly what kind of hacks will a hacker try to achieve against bitcoin?

There could also be hacks targeting the bitcoin software implementation. If a vulerability is applicable to software running on majority (>50% hashrate) of the nodes then it is a real threat.

For example lets say someone can craft a mal-formed transaction that somehow can trick >50% nodes to accept it (for example induce a buffer overflow and somehow allow attacker to gain remote access to the node system itself and make modifications) then bad things will happen.


Is there a way to find the coinbase for a given block using only bitcoind commands? ASICMiner includes hex(Mined By ASICMiner) in the coinbase.

I'd like to generate weekly statistics that include ASICMiner' solo-mining efforts, but I don't want to have to rely on blockchain.info or blockexplorer.com. Is there a way to use bitcoind commands to return the coinbase for a block of given height (or hash)?

I think this is best answered by an example. Let's find the coinbase from a block on the Bitcoin testnet.

First we'll get the hash for a block we want to look at. We'll have a look at the (as I write this) latest block:

> bitcoind getblockcount
81626
> bitcoind getblockhash 81626
0000000000834f3933b50577b854692ed246728a17d10006ced1283a3fd8074c

Now we need to find the hash of the generation transaction from that block. It's always the first one listed. In this example there is only 1 transaction.

> bitcoind getblock 0000000000834f3933b50577b854692ed246728a17d10006ced1283a3fd8074c
[...]
    "tx" : [
        "f1fdeb7ced28f697c97b6a3ed7cc1946e1fc5e062ad8c17d05c88b1767b91b2a"
    ],
[...]

And now we can grab the coinbase from the transaction. The getrawtransaction command's second parameter can be set to 1 to give us individual pieces of the transaction so we can easily find the coinbase. Alternatively we could leave that out and it would give us a single binary blob to navigate ourselves.

> bitcoind getrawtransaction f1fdeb7ced28f697c97b6a3ed7cc1946e1fc5e062ad8c17d05c88b1767b91b2a 1
[...]
"coinbase" : "03da3e012cfabe6d6d18c47c97379852a93158528bb709355a0d38d05fedf072b610bb57442aad4e710400000000000000062f503253482f",
[...]

And there's the coinbase. Now we can check whether it contains pieces of ASCII text or whatever else we want to do with it.


How do I develop mobile applications for Bitcoin? I would like to develop a mobile Bitcoin application for the Android and iPhone platforms.  What libraries and resources can I use?

Currently there are only a few mobile apps that use the bitcoin protocol itself. Most communicate with a bitcoin client on a remote machine using the JSON API.

Those few that do, rely on BitcoinJ which is a "selfish" implementation of bitcoin that runs in Java (handily the native language for Android apps). It's got a few key modifications that bring its overhead low enough to run on embedded devices, most notably it does not download all blocks in the block-chain, only those blocks which relate to addresses in its own wallet (hence "selfish" client).

Either method works, and either is as valid a starting point as the other, given the current state of bitcoin's mobile development.


GDAX 64+bitcoin transactions I've been watching GDAX for several months and I see repeating offers to sell 64 + bitcoins (not 65 or 63). This seems very strange as it's an unusually large quantity and is repeated several times a day. Can anyone make a quess as to why this would be happening?

After continous monitoring I've determined it's someone spoofing (attempting to drive the price lower). The bid always starts out $3-$5 out from the current price and as it gets close to the bid it's offer changed a few dollars higher but is never allowed to meet the current price. Interesting.....


Tracing bitcoin cash address to bitcoin address Given a bitcoin cash address that inherited deposit from main bitcoin ,
Is it possible to trace the bitcoin cash address back to bitcoin address ?

You can look up the related transactions for the BCC address at blockdozer.com