text:
How many peers do you need to securely synchronize with the blockchain?
What is the minimum number of peers required to securely synchronize my local blockchain copy?

One! Your full node will check every transaction and every block for validity while synchronizing. You therefore can be sure that whatever blockchain data your node accepts follows all rules of Bitcoin. If you are provided the correct blockchain, a single node will be able to provide all data for you to catch up with the network's blockchain tip.
That said, your node will accept any data that follows all rules of Bitcoin. If an attacker knew that you were going to synchronize from scratch, they managed to sybil your node, they could attack you in two ways. First, they could withhold data from you, i.e. not give you the complete blockchain. The attacker could use this to set you up for a doublespend, by sending you money that they've already sent somewhere else in a block that they didn't tell you about. This is easy to defend against, by requiring confirmation before accepting payments or by verifying your local blockchain tip against the network's via third party resources such as blockchain explorers.
The second attack would entail feeding you a series of blocks that are not part of the most-work blockchain. This would require an immense amount of work as the blocks would have to adhere to the current network's difficulty level to pass your full node's verification. These blocks would have to be tailored to an attack on you, to include one or more transactions that send money to you that the attacker wants you to be believe to be valid. Mining valid blocks that are not part of the most-work chain is an investment on par of finding the same number of blocks in the most-work chain. Unless you're routinely accepting very large payments with few confirmations, you are not a likely target to such an attack on the Bitcoin blockchain. Note that some altcoins have very low difficulty levels and the cost of creating valid blocks would therefore be significantly lower.
The latter two scenarios are why generally Bitcoin nodes will connect to eight peers (and SPV nodes usually to four) and compare all of these peers' information about their best blockchain tip. Your node will still only download each piece of blockchain data a single time (as it can verify that it is part of the most-work blockchain).

Thanks, please, do you have any doc source to understand in deep how the synchronization process is done and how it is difficult to make a fake blockchain even with only one peer source?

@Noureddine: The protection doesn't stem from how the data is exchanged, but rather that all data is checked by each node. Perhaps these will be of interest: https://bitcoin.stackexchange.com/a/21092/5406, https://bitcoin.stackexchange.com/a/10351/5406, https://bitcoin.stackexchange.com/q/12427/5406, https://bitcoin.stackexchange.com/q/148/5406

If you sync with only 1 peer, you are trusting that 1 peer to give you the history of the correct chain.  Typical full nodes connect to 8 or more peers, that increases the chances that your node is connecting to the right chain and that it's coming to a consensus amongst its connected peers.

@ooomid: Thank you, I realized that my previous answer was too brief to properly communicate the point I was trying to make. I've reworked parts of my answer.


text:
Does Bitcoin's high price make payments in stores less viable?
With bitcoins values getting so high (now is $2250/BTC) is it still viable to use bitcoins as a way of payment in stores?
It's not that common now, but I thought that people would use it more with time. Now with the high values of BTC the fees to the miners are pretty high. In order to get a fast transaction I had to pay around $2. This would discourage low values transactions, right?
Is there a way to improve this situation? Would it for example help to increase the number of miners?
Is it otherwise correct to assume that Bitcoin will only be viable for high value transactions?

You are asking several different questions here, some of which are very subjective.  Can you focus your question more narrowly?  By the way, increasing the number of miners will not change anything, except temporarily - the rate of confirmed transactions is limited by block size, and the Bitcoin protocol keeps the block rate approximately constant over time.  There are many questions about this issue on the site.

Nate is correct by the way, you really shouldn't ask about multiple different topics in one question. ;)

Bitcoin for Point-of-Sale
Bitcoin is inherently ill-suited as a form of instant payment. This is due to transactions needing confirmations before they become reliable which even at best times can take between several minutes and an hour. Before a transaction is confirmed, it is merely a declaration of intent open to replacement by another transaction sending to a different recipient, i.e. a doublespend. This is in crass conflict with the requirements of a quick payment, e.g. at a super market with a line forming behind you or when purchasing hot food.
Value of transactions and fee market
Fees in Bitcoin are paid for the blockchain space that a transaction occupies, not relative to the amount of value that is transferred. As the data-wise smallest possible transaction could transfer $1 or $1,000,000 of value, it is obvious that a more valuable transaction can afford to pay a higher fee for the same blockspace while remaining economically viable. It is therefore inevitable that more valuable transactions will push out less valuable transactions in the competition for blockspace.
More miners and throughput
To discover a new block, a miner has to find a block template that fulfills the current difficulty level. This is a rebalancing system, if mining power increases, the difficulty will follow suit to slow down block discovery. Adding more mining power will only briefly create more capacity before the difficulty catches up.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: Юлия Филатова

sort: votes


text:
Why do some transactions have more than one input?
I know a normal transaction has 1 input and 2 outputs (if there is change that is the second output).
But what about this scenario?

Lets say I'm withdrawing bitcoin from my gemini account and want to calculate the fees. How would I even know if it's 7 addresses sending (which would make the byte size of the transaction larger = higher miner fees) or just 1 address sending?
To further elaborate on test-net here is our system with withdrawing btc to another wallet:
https://test-insight.bitpay.com/tx/8bc3db6a4a119e369752a52f0be39ae3a4d579adcdc49e9d92429b920000f934
https://test-insight.bitpay.com/tx/553a27e38a73ed90c792b70add3c3f894e94955440205917ee754787c17ea62b
https://test-insight.bitpay.com/tx/cecf112c7e3494826b165f4bcbeca9ef20cc800dce3d433c04b070e4fbc1da81
Here is when I deposited back into our wallet (from copay wallet that supports test net):
https://test-insight.bitpay.com/tx/5871e5957ef6ec67a336de01e6f3e4f6f4cffd9986d2f5db181fdcbf6b00d1e0

What software? Typically your wallet is responsible for constructing transactions, and you don't do this manually.

What about it?  What is your question?  It's perfectly possible, a transaction is allowed to have an arbitrary number of inputs and outputs.

A case scenario of how this would happen. How would one transaction do this? Is it kind of like 7 people sending money to two people (but one if the other is change). Or..? Are all those 7 outputs from one node / wallet that has different addresses?

Bitcoin transactions don't send from/to addresses. They spend coins integrally and produce new ones. Is there are reference question/answer to explain this?

Lets say I'm withdrawing bitcoin from my gemini account and want to calculate the fees. How would I even know if its 7 addresses sending (which would make the byte size of the transaction larger = higher miner fees) or just 1 address sending?

@MarcAlexander, that would be up to the software that is constructing the transaction.  Gemini may allow you to customize and lower the fee...or it may not.  If Gemini is constructing the transaction, then you will have to ask Gemini how they do it.

@MarcAlexander: I've edited your title and retagged your question to better represent what you're actually asking about. Please feel free to revert or further edit your question if you feel that I didn't quite get it right.

What might be confusing you, and which is a common misconception, is that the addresses themselves somehow "hold" the bitcoin balances, and gain and lose the coins via transactions. In fact all the blockchain does is link up previous outputs to new inputs, and the keys make sure only the correct person is allowed to send the coins.
Your balance is just the sum of the total unspent outputs and if you want to send a certain amount to someone, you end up creating a transaction which uses, as input, enough unspent outputs to give the right amount of coins. So if you have a few different smaller unspent outputs, and want to send a large amount, the transaction will end up using multiple of the smaller outputs as input. Because inputs and outputs are used as wholes - they can't be split up as such -
 you then usually receive a bit of change based on how much the total inputs sum up to, and how much you intended to send.
Of course, most of this is worked out by your wallet client or website which you use, so as an average user you wouldn't normally know in advance how many "addresses" are going to be involved with a specific transaction. The program will just select enough unspent outputs which you hold the keys to, and use them to create the transaction. Hopefully that answers your question to some degree.

Value in Bitcoin is not stored in "balances" but rather in unspent transaction outputs (UTXOs). UTXOs behave like checks, you get one each time you receive money, each is exactly for the amount that was signed over, and you can only spend from it once, in full.
When you create a transaction, your software will search for a set of UTXOs that can fund your transaction. This can be any number of inputs from one to all of your wallet's UTXOs.

Someone has 7 private keys in their wallet, but none of the private keys have enough unspent outputs for a payment of ~ 2.16 BTC, so the wallet software combines the private keys (and the unspent outputs) to make a 2.16 BTC transaction.

Downvoted. Private keys don't have bitcoins, unspent outputs do. This answer continues the confusion that leads to OP's question.

Starting from a little far away, the coins are transferred to the Bitcoin Addresses, which are really hashes of public keys. They can be spent using their respective private keys (which is used to generate the public key and the public key hash) which is stored in the Wallet.
Your balance is the sum of unspent transaction outputs (UTXOs) on your Addresses. You can check them manually: in the Bitcoin Core client go to Help > Debug > Console, to check Addresses type listaccounts, to check UTXOs type listunspent or listaddressgroupings.
When you want to send coins to an Address your Bitcoin software goes trough all your unspent transaction outputs and tries to find the best combination to fill that amount (including transaction fee) using as few as possible. In the simplest case one UTXO has enough coin so only that will be used, in other cases more will be combined.
This is the "in" part of the transaction.
After this the Bitcoin software will add the "out" part where the destination Address (or Addresses) you supplied will be present with the amount(s). As a UTXO can only be used up once, all of it must be transferred. From the rest the transaction fee will be paid and the rest is the change, that will be sent back to a newly generated Address of yours (and this will increase the "fragmentation" of your Wallet). The change appears as well in the "out" part (so it will increase the size of the transaction and therefore the fee), while the transaction fee will be left in the transaction with no output.
After this the Bitcoin software will calculate the transaction fee required based on the setting you use (fee amount/byte), update the appropriate amounts (transaciton fee and change) and the transaction is ready to be sent.

Why I got the downvote(s), what should I imporve? Thanks.

Addresses do not have "balances", they have unspent transaction outputs associated with them. There can be multiple UTXO associated with the same address at the same time or at different times. Thus, your answer should read UTXO at various points where you use address, and it doesn't describe the input selection correctly.

@Murch, thanks for the correction, I did some more research and updated the answer (I hope I understood it well this time).

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Extract private keys from litecoin-qt wallet.dat file
I used litecoin-qt back in 2014, and used the backup feature, which gave me a wallet.dat file... Now i want to extract the private key from the wallet.dat file so it can be used in electrum. I do not have a litecoin-qt installation. It seams like a very bad idea anyway to keep cryptocoin backups in a fileformat that depend on particular wallets etc...

Since Litecoin-Qt is essentially the same as Bitcoin Core, this question is closely related to How can I transfer a Bitcoin-qt wallet to Electrum?. AFAIU, you will probably have to install Litecoin to extract the keys.


text:
Lightning Network: node image
When browsing explorer.acinq.co, I noticed some nodes display an icon image in front of their name.
How can I configure such an icon for my own node with LND?

You can assign an alias to your node. The als is what is being depicted in node explorers. It is a regular utf8 string. Nowerdays there are a lot of icons as characters in utf8 encoded strings. For example ⚡.
So in lnd and in clightning (apparently both have the same Syntax) you could add the following line to your config file:
alias=⚡my node name with icons⚡
After restarting your node and waiting until the gossip protocol has propagated your new alias you will be able to see it on node explorers.

thanks! Is this config setting available in LND as well to your knowledge?

Yeah lnd also supports setting your node's alias just don't know the exact Syntax

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
My wallet doesn't show a confirmed transaction
Someone sent me Bitcoin payment but when I check my wallet nothing appears. On the blockchain, the transaction is already confirmed.
I use archived address.

What wallet software are you using? What is an "archived address"?

Open your btc wallet using app then go to addresses ! click on the address that you want to recover the and hope des :D


text:
Opening Lightning network channel: who is paying?
When opening a lightning network channel between two parties, which of the following is true:
1) They must both pay a fee to open the channel
2) They might both pay a fee to open the channel
3) Just one party pays a fee.
The fee here refers to the bitcoin mining fee, not to the amount of BTC the two parties are putting in the channel.

Because a fee is part of a transaction, the fee must be paid by whichever party creates the funding transaction.
Don't think of it as paying a fee to open a channel, think of it as funding a channel with a transaction.  The fee just happens to be part of the transaction.  I believe the current spec has just a single party funding a transaction, but I see no reason why this could not be modified for parties to share the funding cost, in which case both would likely contribute to the fee.

Well,
Opening a channel (and correct me if I am wrong), you assign the satoshis in the channel point output of the funding transaction to three balances living on the channel by agreeing to them on a commit transactions between the parties:

Your local balance
Remote balance
Reservation for a final commit fee

Essentially you create and share with your peer -but not broadcast to the Bitcoin network yet- a transaction that outputs:

Your local balance to your Bitcoin address
Remote balance to the peers Bitcoin address
Leaves the commit fee for the miners

So, essentially when you open a Lightning channel you are:

Paying a tx fee to open the channel
Part of your funding is reserved for closing and never gets shows on your channel balance

The final commit fee is coming out of your pocket as the initiator of the channel.
So it could be said that opening a channel costs you two transaction fees. So you should make at least one payment on the channel before you break even (minus ln fees so you might need two essentially)
After that besides ln fees it's all gravy from there on with every payment you make.

Downvoted. Funding transaction involves sending some satoshis to a multi-sig address that is controlled by both channel parties. To-local/remote balance form the part of the commitment transaction not the funding transaction.


text:
My wallet balance says I have 12 mBTC but only allows me to send 2.63 mBTC. How can I fix this?
I have 12mBTC but when I try to send a transaction, after I enter the amount (allocating enough for fees) Electrum says that I have only 2.63 mBTC. When I go back to check, every transaction I received is confirmed for more than a week, how do I fix this?

Try to check your address balance directly at the blockchain.

I'm using Electrum

Copy your public address from Electrum and enter in the search box at blockchain.info. There you will see exactly what is the balance. It may be a synchronizing problem of your wallet client.

It might be, that you collected a lot of small transactions in your wallet. And if Electrum assembles a new transaction, it adds a fee, which is calculated in satoshis per byte, and for sure deducted from the amount you have. This way you can only spend less satoshis, than you actually have. In times of high fees, it does not make sense to create a tax. But today, as of July 2017, fees are very low, and you can give it another try. I posted a similar reply here:
Why was the transaction fee more for a 20 mBTC transaction than for a 25 mBTC transaction?


text:
Correlation of number of (non mining) full nodes to internet bandwidth
Are there any correlation studies showing the number of (non mining) full nodes per country (total or per/capita) compared to average internet connection speeds?
I know there are great differences between connection speeds depending on ISP and if the users are in rural or urban areas.
The time to download an entire blockchain from scratch for maximum security can take a very long time in some places. I want to know how much this discourages people from using full nodes (in favor or SPV wallets).
Comparing average connection speed to number of full nodes (per capita) in each country is what I am looking for.

I don't think any such study exists, because it is very difficult to gain any concrete information about full nodes on the network.  Because nodes can (and often are) run over proxies or TOR, their true IP addresses are often obscured.  Furthermore, IP addresses aren't necessarily a good indicator of geographic location, and certainly not connection speed.
Even if you identify a node in a country with generally poor residential bandwidth, the operator of that node could be running it from a commercial data center that has much better connection speeds than the average for that country.  Attempting to sort full nodes into residential and commercial categories would be almost impossible.
It sounds like you're trying to do something similar to this:  Bitcoin node Decentralization

Bitnodes attempts to estimate the size of the network and aggregates data including, country, IP geolocation, version of bitcoin software etc.  You may be able to use IP information to determine what types of connections are being used.  Obviously this is only public facing nodes. They can be used to query peer information and learn about other nodes that may not be public facing (behind NAT/proxy/TOR etc).  This would be the place to start, although the constantly changing nature of the network would make this type of analysis very hard to complete.


text:
Why is it difficult to acquire bitcoin?
All of the buying guides or suggestions here on bitcoin.stackexchange seem dated and old.
Does anyone have any new methods for buying Bitcoin with a disposable or personal debit card?
It's not illegal to have Bitcoin (I don't think) why is it so difficult to acquire Bitcoin?

It really depends from country to country and card companies:
Countries are enforcing regulations on financial institutions: KYC (Know Your Customer) and AML (Anti Money Laundering) - which when applied to disposable cards make them impossible to use in the same way you can't use them to transfer money to anyone's personal account
Second issue is fraud and chargebacks - as explained here: Why is Bitcoin so susceptible to credit card fraud?
Third issue is TAX. Taxman wants to know how much money you have on your bank accounts and that is impossible with bitcoin, unless they can track transaction when you bought it.
Dutch taxman is asking you to report if you have bitcoins, and in Holland you can buy them using Dutch money transfer system (IDEAL). If you live in England you can buy them from EU bitcoin exchanges/sellers but you need to execute SEPA transfer from your bank which may take few days to clear.

It all kind of depends on where you live (in terms of legality), and what purpose you want out of buying with a disposable/personal debit card.
I can say in the US, in order to buy bitcoins you can't reside in NY because of the laws there.  You can read more here along with the other countries legality issues: https://en.wikipedia.org/wiki/Legality_of_bitcoin_by_country#United_States
Also for the US, North Carolina seems to be having trouble with sites like xapo: http://www.newsbtc.com/2015/07/16/bitcoin-services-provider-xapo-no-longer-operating-in-north-carolina/

As for just buying in general, if you'd like to purchase in cash I prefer using localbitcoins.com.  That's where I generally go to purchase bitcoins because I like the anonymity of it and don't have to deal with exchange sites as much and having to link my bank account in any way.  The prices are a little higher than what the base price of bitcoins are, but the price of convenience (for me) is worth the extra up charge.

authors: Андрей Путин


text:
How fast can Ripple transfer money from bank to bank?
I had a debate last night on how fast Ripple is.
If I am moving money from bank account a to bank account b, how long would it take?
I was told by one person that adding a block takes 8 secs. Another person said money can be moved cross border from any bank account to any bank account in 6 secs.

Does 2 seconds make a difference in your life?

I think it will vary based on how many intermediaries it passed to reach destination.

Would it? It seems like the major bottleneck is submitting a transaction to the Ripple network and having all of the gateways include it in a block.

It will depend on exactly what combination of technologies are being used. If it's ILP and the banks (or market makers) already have payment channels setup, it can be virtually instantaneous. If it's a direct on-ledger payment, it would be about 7 seconds on average. If it's an ILP outer payment that requires both an on-ledger lock up and on-ledger settlement, it can be closer to 15 seconds.
It also depends what you mean by "Ripple". For example, if you mean any bank-to-bank payment using Ripple Connect (the product Ripple sells to banks), that could include payments that uses all kinds of combinations of technologies. For example, if it's an ILP outer payment and the settlement is on the bitcoin block chain, then it can take as long as an hour, because that's how long for payments to be reasonably certain on the bitcoin blockchain.


text:
How is Scrypt ASIC-resistant?
I just started reading about Litecoin's Scrypt algorithm and all the explanations are quite complex. I have understood that Scrypt uses more memory than Bitcoin's SHA-256 which makes it ASIC-resistant and prevents centralization.
But, from what I understand we still require powerful GPUs to mine Litecoins because operations on larger data sets (more memory) will be faster and more efficient in GPU than in CPU.
Also, why is it not possible to build an ASIC machine for Scrypt. Is it due to the complexity involved in the algorithm? I just want to know if it's impossible or just difficult. In the future, can we expect ASIC machines for Scrypt as well?

I don't have personal experience here, but a quick Google suggests that Scrypt ASICs have been on the market for a couple years now.

The Scrypt algorithm started out as an "ASIC-resistant" algorithm, but it isn't anymore.
Because it is highly memory-intensive, it was thought to be prohibitive to design and use ASICs for it. Initially it kind of was. With cost of memory decreasing and the necessary research put in -- in order to unlock the profit potential attainable using Scrypt-capable ASICS -- that ASIC-resistance has largely vanished.
A great many ASIC hardware projects for Scrypt started out with great fanfare, but only rather few have succeeded and ever been delivered. A rather large part failed along the way or were scams from the beginning, with developers pocketing money for pre-orders and never delivering any product. Despite these numerous frauds, a number of ASIC development projects have actually been completed and mining hardware has been delivered. As soon as a successfully completed machine was deployed and hit the market, this was always visible in a significant increase in mining difficulty for Scrypt coins whose profitability has, as a result, steadily decreased with every new ASIC model delivered.
The only residues of Scrypt being ASIC-resistant these days are the lower hash rates you see with Scrypt-based Crypto coins as opposed to SHA-256 ones.

Litecoin was never ASIC resistant - see http://bitcoin.stackexchange.com/questions/36642/why-did-litecoin-choose-the-scrypt-factors-that-they-did/36644#36644

Scrypt was designed to be (or at least claimed to be) GPU resistant. When it failed at that, it got rebranded as ASIC-resistant (but fails at that too).

yes, I know -- hence the quotation marks, indicated that that's what people initially said about the algorithm.

Scrypt is a highly memory-intensive algorithm: it generates and uses a very large number of pseudo-random values in computing the final output, and for efficiency reasons, all of these intermediate values need to be stored until the computation is done.
The cost of an ASIC depends roughly on the physical size of the chip, and memory circuits take up a great deal of space.  A memory-light function like Bitcoin's SHA-256 requires a small circuit, so you can fit thousands of computation units on a reasonably-priced chip.  A similarly-priced Litecoin ASIC, on the other hand, might only be able to fit one or two computation units on the chip.

Then how do you explain that Litecoin ASICs had a larger speed boost over GPU mining then Bitcoin ASICs had over GPUs?

Scrypt is not memory hard, it has trivial time memory tradeoffs which all scrypt ASICs implement, allowing you to use almost no memory with a linear increase in time.


text:
Sent Bitcoin to Bitcoin Core Wallet before it finished "syncing with network"
So I bought some bitcoins and sent it to my Bitcoin core wallet before it finished syncing with network, will the transactions come through once it finishing syncing or have I lost them?

related: https://bitcoin.stackexchange.com/q/6056/5406

Yes everything will be normal, the bitcoin will reach your wallet once it downloaded the block your transactions was included in :).
Just wait patiently .

Praise the lord! was so worried :')


text:
I want to block my transaction
I made a payment to somebody and now he is not replying me regarding the product I made the payment for and think its a fraud.
So I want to block the transaction.
All I have is the QR code of the person to whom the payment was made.
I also have the QR code detail
Bitcoin:1PNPnadF26twbAxTZTVeEaQKjbYeXDmeNJ

Sorry, that's not how it works.  When you pay with bitcoin, you are essentially paying cash.  Since you have the recipient's address, you can look up the transaction on a block explorer like http://blockchain.info, but my guess is is that your transaction already has a few confirmations.  You can ask for your money back, but that's it.

Can you help block the address because i am unable to do anything about it.

No.  That's not how Bitcoin works.  I have no more power to do this than you do.  Looking at that address (https://blockchain.info/address/1PNPnadF26twbAxTZTVeEaQKjbYeXDmeNJ?filter=2), I can see that there are many transactions to the address.  I can also see that all the transactions to that address are confirmed by more than 6 blocks.  I don't know which is yours, but it is irreversable.  In fact, I can see that all outputs to that address are already spent.  Talk to the recipient, because all that can be done is convincing them to send your money back.

I'm voting to close this question as off-topic because they are asking for help doing the impossible.  They have not adequately researched their problem, and are treating this forum like a customer service department for Bitcoin.

If the transaction has been confirmed there is nothing to do and that is probably your situation. If not (due a small fee) then you can pay yourself with a higher fee to "block" the previous one.


text:
How do custodial lightning wallets work?
I just installed and tried to use a lightning wallet (bluewallet) on an Android device.
As per my understanding, when I fund my lightning wallet (This is an on-chain tx) with amount x, I open a direct channel with blue wallet of amount x. If I want to send a tx on the lightning network (say amount x) to a person B, they must have their own open channel with bluewallet of amount y where y must be greater than x for the tx to go through. If it goes through then it's routed via blue wallet to person B.
Is my understanding correct? Please correct me if I'm wrong.
What happens if the above conditions are not met, i.e. person B creates a wallet on blue wallet but doesn't fund the channel? What happens if the amount y is less than x?
Also, are my keys randomly generated on device only?

I am sorry to say but your understanding is wrong.
When you send x btc to Bluewallet you don't open a channel. You just give them your Bitcoin. Bluewallet and other custodial wallets run one (or possibly several) lightning nodes and allow you to use it with up to the amount of btc you have sent to them before.
So as long as Bluewallet users send each other payments no channel is needed as everything can just happen virtually in their accounting software. Also in a custodial wallet you can receive btc via lightning without providing liquidity first (as with your non custodial fullnode)


text:
Which bitcoin wallet allows me to generate and export a large number of addresses?
I need a software Bitcoin wallet (not web account based) that allows easy generation of many new payment addresses at once that are ideally stored in plain text, (bulk exported as plain text). The security is not a concern.
I like Bitcoin-Qt but it is outdated and it takes forever to download the entire chain, which make it not portable in a way.
Is it necessary to download the chain? If one can use a paper wallet than one must be able to use software one without having the blockchain, or having just a small number of blocks, right?

Have you checked the bitcoin website, https://bitcoin.org/en/choose-your-wallet , it lets you choose between different wallets.
The idea of downloading the full block chain is to have maximum security,  so its kind of not secure not to download the block chain.
Saying that there are some SPV clients which let you do without downloading the full blockchain. You can check the mobile version ones for that.

JDE: This sounds like an XY-problem to me. What do you need the large amount of addresses for? Are you asking how to provide addresses to a webshop setup?

It is not necessary to download blockchain to generate address. Use an HD wallet like electrum, so that you can regenerate wallet using seed even if you lose private keys.
To generate addresses http://docs.electrum.org/en/latest/faq.html#how-can-i-pre-generate-new-addresses
To export addresses use electrum command line http://docs.electrum.org/en/latest/cmdline.html

If you program in Java, you can use Bitcoinj to generate addresses. Bitcoinj supports HD wallets, so the addresses are generated from the same seed.

I made this wallet: Bolt does not need any account.
It saves your private keys encrypted or plain text.
And you can generate as many address you like.


text:
Curiosity, Minimal transaction accepted as valid? (zero input/ zero output)
$ bitcoin-cli decoderawtransaction 00000000000000000000
{
  "txid": "f702453dd03b0f055e5437d76128141803984fb10acb85fc3b2184fae2f3fa78",
  "hash": "f702453dd03b0f055e5437d76128141803984fb10acb85fc3b2184fae2f3fa78",
  "version": 0,
  "size": 10,
  "vsize": 10,
  "weight": 40,
  "locktime": 0,
  "vin": [
  ],
  "vout": [
  ]
}

I assume this wouldn't make it into the mempool or be relayed, but if a miner decided for some odd reason to mine a transaction like this, would it be valid? or would other miners reject it?
Thanks

If we take the transaction's structure :

00000000 (version)
00 (nInputs)
00 (nOutputs)
00000000 (locktime)

Of course, that's a good question, and your transaction's structure is correct. But,this transaction is going to be rejected. This transaction must have a version equals to 1. This must be required. In Bitcoin, it doesn't exist a transaction with a version equals to 0. In addition, a transaction must have 1 input and 1 output at last.
Have a nice day.

No, it would be invalid. Every transaction must have at least one input and at least one output.


text:
How much transaction fees are taken by bitcore for API use?
If I am using the API of bitcore.io and create transactions, how much transaction fees are taken by Bitcore?
I couldn't find any description in their documentation.

I've edited the tags, please note that Bitcoin Core and bitcore are two separate projects.

Bitcore is open source software provided at no charge, so there is no fee you have to pay to the BitCore software authors.
When creating a Bitcoin transaction, it is highly recommend that you pay a fee to Bitcoin miners to encourage them to include your transaction in a block.  How much fee you pay is optional, and there are a number of fee estimation services that will recommend a fee for you.  See also other questions on Bitcoin StackExchange for more information about transaction fees in general.


text:
Coinbase to Block Chain Transfer Delay
I recently sent a friend of mine around $950 in BTC from Coinbase to his BTC wallet on BlockChain.info.
The transaction is showing up as completed in my account, but he claims he has not received the money yet...
I'm not sure why this issue is occurring. Can someone please help? Obviously, with an amount like $950, I can't just lose that money...

Since there is no dispute about the address, you can check whether the transaction has confirmed on any of the blockchain explorers freely available, such as blockexplorer.com or the aforementioned blockchain.info.
If the transaction shows up as confirmed there, and the receiving address matches the address that he told you, the money has been successfully signed over to his control. That's sufficient to prove that you paid.
If the payment is still not showing up in his wallet, the problem is on his side, and he should either look into what's wrong with his wallet or check in with the customer support to fix his access to his funds.

If it is showing up on Coinbase but not on blockchain, there's only two possibilities.

You sent to the wrong address. Check the address you sent to in blockchain.info. It should show up with your $950. This is where your coins are. Maybe you miscopied the address. Make sure that your friend owns the address that you sent to.
Malware. There is a virus circulating around that swaps out bitcoin address in the clipboard with a hacker's bitcoin address, so when try to send to an address, it will send to the hacker's address.
Your friend is having a problem with his blockchain wallet.

I spoke with a support member at block chain. They said they can confirm that he has received the payment, but he says it has not appeared in his account yet. I'm really sure it was to the correct address. He sent me a screenshot showing his recent transactions, and mine did not show up there...although when the support member showed me his history, it showed the +950 that he received. Is it possible that it delays him receiving it, since it's a bigger amount?

Not possible that it was delayed, especially if blockchain support can see it. Get your friend to install an SPV wallet like Electrum and import his private key from the Import/Export page.

I'm not sure how to resolve this...I can see the transaction on his Block Chain history, but the transaction doesn't show in his recent history yet. He claims he still hasn't received it. I'm stuck because at this point I sent $950 that is currently at an idle stage right now..

He might be pulling your leg. Another question, how did blockchain support know he received it? They don't know anything about him. Did you give them only the address they sent to? Because obviously you sent the coins, but I still think he's either joking with you or you sent it to an address that wasnt his.

I told them the address I sent to, and they sent me a link with a history of his account deposits and withdrawals. I easily pointed out my transaction to him. He still says he has not received it. I think he's attempting to scams me, but so many say he's legit..

It's definitely his address. When i

Go to his account history, all of the transactions match up with those on the screenshot be sent me..

Then it's not your fault. Either he mistyped his wallet address, or his wallet is really, really broken. Never seen this on blockchain before. As I said, get him to try import his BIP58 seed into Electrum and see if the coins are there.

So in that screenshot he sent you, you can see the transaction that you made?


text:
With JSON how do I know the amount that was LAST sent to a given address?
I am trying to build a script that will give me the amount a user has sent to a given bitcoin address. Currently this data is in JSON format.
How can I use this JSON data to know the amount that was LAST sent to a given address?
For the moment I have as a return of a submitted form:
$userIDsent = $_POST['userID'];
$adrsBTCsent = $_POST['adrsBTC'];

$bcInfo = json_decode(file_get_contents("https://blockchain.info/address/". $adrsBTCsent ."?format=json"), true);

$nombre_de_transac  = $bcInfo["n_tx"];
$valeur_en_satochi = $bcInfo["total_received"];

If ($nombre_de_transac > 1){
    /* more then 1 transaction for that BTC adds. I need to know what is the amount last sent and NOT the total amount used on that address */

} else {
    /* 1 transaction this address is new so let's get the amount of BTC sent */
    echo "The user ".$userIDsent." has sent ". $valeur_en_satochi . "uBTC";
    echo "bra, bla, bla lets continue";
}

Thank you for your help.

You can also use the filter GET parameter to ensure that the first transaction is one where the address receives bitcoins and not one where the address spent bitcoins and the limit parameter to only fetch one transaction (the latest).
For example https://blockchain.info/address/1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp?filter=2&limit=1&format=json
To get the amount sent, you'll have to filter outputs to get the one sending BTC to the address you're interested in and then get the value field (divide by 100,000,000 to get the amount in BTC).
If you are doing this as a way to get notified of incoming payements, I highly recommend you to use the Receive Payments API as it is dedicated to this use case.

Working with JSON data can be a little tricky at first, but you'll get used to it after some practice.
To fetch blockchain.info's JSON data in PHP, as you have in your example, you just need to pull the JSON data into an array in PHP and the cycle through the array(s).
For example to get the most recent transaction you would do:
$address = "1NPrfWgJfkANmd1jt88A141PjhiarT8d9U";
$link = "https://blockchain.info/address/".$address."?format=json";
$fgc = json_decode(file_get_contents($link), true);

$lastTx = $fgc["txs"][0];

The zero means we want the first, or most recent transaction. If you wanted the 2nd most recent transaction you would just change that to a 1.
$lastTx = $fgc["txs"][1];

Now $lastTx will hold an array of all the transaction data for that specific transaction including inputs and outputs.
Your question is how to get the amount of the most recent transaction to an address. So first we will get the most recent transaction ["txs"][0] then we will want to get the outputs ["txs"][0]["out"].  The trick here is that many times there are more than one outputs for a transaction and they don't always correspond to the same address you are querying. So we'll need to create a loop and a simple if statement to sort it out.
$getOuts = $fgc["txs"][0]["out"];

foreach($getOuts as $outputs){
    $myAddress = $outputs["addr"];
    if($myAddress == $address){
        echo $outputs["value"];
    }
}

This will output the most recent value in satoshis. If you want it in full bitcoins, just divide it by 100 million.
Here's a PHPfiddle example: http://phpfiddle.org/lite/code/rksu-qwq1
If you're looking to learn more about how to read and handle JSON data and parse it with PHP here's a video tutorial: https://youtu.be/_K270ufQ6ho?t=7m20s Start at 7:20 mark


text:
I've lost my MultiBit data, is there a way to access my wallet?
I have lost access to my wallet. My hard drive is dead and I don't have access to any backup files. Does MultiBit back up everything automatically to the cloud? I know my passcode key and I can see my bitcoins on blockchain.info. I have tried data recovery but the hard drive is not recoverable. I don't know what else to do. Does anyone know how I can regain access to my bitcoins? Appreciate the help. Thanks!

I'm sorry to say this, but your bitcoin is gone. Without your hard drive, you don't have access to the private keys. You may know the password to decrypt them, but what use is a password without a username?
The best option will be to try and go to a professional data recovery service.
Rule of thumb - Always make backups.

Is there a way to restore the classic multi-bit wallet with my bitcoin having just my passcode since the wallet words concept didn't exist at the time?

@southafrica44 no, not possible, the seed phrase is only a representation of your private key. The key itself has always been randomly generated and the seed phrase computed from that. In fact you could have created a seed phrase from your existing key.

if you have enough money on there you can try to have the hard drive saved by a company who can save data from the drive.


text:
USD to BTC conversion code
So, I have looked everywhere and no one seems to have this specific problem.
I have set up a e-commerce store that is accepting BTC, So far the users can only see the price of the product in USD, however, I want the user to be able to click the USD price and convert it to BTC instantly. Like you can on a blockchain.info transaction.
For example:
Blockchain transaction conversion
So far, I have only been able to display the BTC price using Blockchain API.
I want the same effect as Blockchain on my price, or atleast under it.
(Snapshots of site below to give an idea of what I want)
My images
The code I have to display the BTC price (If it helps, im a noob sorry)
<?php

  $url = "https://blockchain.info/stats?format=json";
  $stats = json_decode(file_get_contents($url), true);

  echo $stats['market_price_usd'];

  ?>

Price display:

$200.50

It took me a bit to realize what your question is. Could you please make that clearer?

See here https://github.com/miohtama/bitcoin-prices

@SvenWilliamson Most of these seem irrelevant to the question.

Your question is a bit confusing but it sounds like you are asking how to get a currency amount worth of bitcoin.

I want the user to be able to click the USD price and convert it to BTC instantly.

The answer is simple, division.
<?php
$url = "https://blockchain.info/stats?format=json";
$stats = json_decode(file_get_contents($url), true);
$btcValue = $stats['market_price_usd'];
$usdCost = 200;

$convertedCost = $usdCost / $btcValue;

echo $convertedCost;
?>

http://phpfiddle.org/lite/code/cxsk-b62m

(If it helps, im a noob sorry)

That's okay. If you're looking to learn more beginner related Bitcoin coding stuff check out this mega-thread at bitcointalk https://bitcointalk.org/index.php?topic=990348.0  It's mostly PHP and JavaScript examples.

I'll test it now, thank you very much man !!

Yep, I suppose I can work with this, thanks buddy.

authors: Иванов Денис


text:
How can I spend my paper wallet directly?
I am totally new to Bitcoin. Can you tell step by step, how I can spend a paper wallet directly? Or is it necessary to create a software wallet?

Unless you plan on doing ECC math and hashing algorithms by hand (it would take you about a day just to do a single round of SHA256) and publishing the raw binary transaction via raw network protocol, you're going to need some software.
I would recommend getting Mycelium, which has a paper wallet import feature. You can then spend it where you like using the wallet.


text:
Where can I exchange Bitcoin for Cash, Western Union or MoneyGram?
I'm looking for a Website that allows to exchange Bitcoin for Cash, Western Union or MoneyGram.
I have heard about localbitcoin.com, but people complain about spamming...
I've also heard about cryptonit.net, but they have a 20% fee which seems exorbitant.

This question could be improved by adding information about the country the asker is located in.

related: https://bitcoin.stackexchange.com/q/17239/5406

Some bitcoin wallets allow you to link them to a checking or savings account. You could also just exchange the bitcoin onto paypal.

example please...

copay worked for me.


text:
How to confirm a payment was made?
I am planning to write a site that receive payments in Bitcoin.
The client add products to the cart, then during check out I will create a Bitcoin address to let him pay for it (each cart gets a unique address). I found the code to create multiple address here. I plan to use the NBitcoin library.
How do I verify the Bitcoin address has been paid? I'm planning to use a service like blockchain.info, but I only have the following information

destination Bitcoin address (my generated address)
the amount it should receive

Is there an easy way to use blockchain.info to query that my address was really paid using C#? I read the API but it is confusing.

I'm not sure about Nbitcoin node's API, but I could help you on a blockchain explorer API.
I would recommend Blockr.io, they are fast and trustable. Use the following code to check for confirmed transactions: (output is in json)
http://btc.blockr.io/api/v1/address/balance/198aMn6ZYAczwrE5NvNTUMyJ5qkfy4g3Hi,1L8meqhMTRpxasdGt8DHSJfscxgHHzvPgk?confirmations=1

Change the confirmations tag to whatever amount you want. I highly advise against 0.


text:
How do you create a transaction from a UTXO in BitcoinJ?
Is there a way to construct and send a transaction in BitcoinJ without a wallet? I just want to build my transaction from a utxo and broadcast it.

Sort of. Here's some code to get you started. It creates a transaction with one input and two outputs. One output sends some coins, another one commits some data. However, it still uses Wallet::sendCoinsOffline to complete and commit the TX, but I think you could get rid of it if you understand what Wallet::completeTx and Wallet::commitTx do.
public class App extends WalletAppKit {
    public void commitStatement(String statement) throws InsufficientMoneyException {
        Address addr = getSomeAddress();
        TransactionOutput prevLink = getSomeUtxo();
        NetworkParameters params = RegTestParams.get(); // regtest mode

        byte[] data = statement.getBytes();
        if(data.length > 80) {
            throw new RuntimeException("OP_RETURN data cannot exceed 80 bytes");
        }

        Transaction tx = new Transaction(params);

        log.trace("prevLink TX for '" + statement + "': " + prevLink.getParentTransaction());

        tx.addInput(prevLink);

        Coin feeAmt = Transaction.REFERENCE_DEFAULT_MIN_TX_FEE;
        Coin opRetAmt = Transaction.MIN_NONDUST_OUTPUT;
        Coin changeAmt = prevLink.getValue().minus(opRetAmt).minus(feeAmt);

        // 1st output: send coins
        tx.addOutput(changeAmt, addr);
        // 2nd output: commit some data
        tx.addOutput(opRetAmt, ScriptBuilder.createOpReturnScript(data));

        log.trace("TX for '" + statement + "' before SendRequest: " + tx);
        SendRequest req = SendRequest.forTx(tx);
        // Want inputs and outputs to keep their order
        req.shuffleOutputs = false;
        req.ensureMinRequiredFee = true;

        log.trace("SendRequest for '" + statement + "' before completeTx: " + req);
        wallet().sendCoinsOffline(req);

        // NOTE: At this point, the TX is saved in the wallet!
    }
}

Later edit: So here's an example of how you can modify completeTx and sendCoinsOffline. I actually had to do this today for my own purposes by subclassing the Wallet class. You probably need to take a different route than subclassing Wallet but this should give you an idea of what you need to do.
Warning: This modified code takes care of signing and paying the fee only for these special-kind of transactions with one input and two outputs. Seems to work so far as I've tested it.
public class MyWallet extends Wallet {
    private boolean payFee(Transaction tx, Coin feePerKb, boolean ensureMinRequiredFee) {
        final int size = tx.unsafeBitcoinSerialize().length;
        Coin fee = feePerKb.multiply(size).divide(1000);

        if (ensureMinRequiredFee && fee.compareTo(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE) < 0)
            fee = Transaction.REFERENCE_DEFAULT_MIN_TX_FEE;

        TransactionOutput output = tx.getOutput(0);
        output.setValue(output.getValue().subtract(fee));

        return !output.isDust();
    }

    public void myCompleteTx(SendRequest req) throws InsufficientMoneyException {
        lock.lock();
        try {
            // Print the output value
            Coin value = Coin.ZERO;
            for (TransactionOutput output : req.tx.getOutputs()) {
                value = value.add(output.getValue());
            }

            log.debug("Completing send tx with {} outputs totalling {} (not including fees)",
                    req.tx.getOutputs().size(), value.toFriendlyString());

            // Check for dusty sends and the OP_RETURN limit.
            if (req.ensureMinRequiredFee && !req.emptyWallet) { // Min fee checking is handled later for emptyWallet.
                int opReturnCount = 0;
                for (TransactionOutput output : req.tx.getOutputs()) {
                    if (output.isDust())
                        throw new DustySendRequested();
                    if (output.getScriptPubKey().isOpReturn())
                        ++opReturnCount;
                }
                if (opReturnCount > 1) // Only 1 OP_RETURN per transaction allowed.
                    throw new MultipleOpReturnRequested();
            }

            // Pay for the TX fee, depending on the TX size.
            Coin feePerKb = req.feePerKb == null ? Coin.ZERO : req.feePerKb;
            if (!payFee(req.tx, feePerKb, req.ensureMinRequiredFee))
                throw new CouldNotAdjustDownwards();

            // Now sign the inputs, thus proving that we are entitled to redeem the connected outputs.
            if (req.signInputs)
                signTransaction(req);

            // Check size.
            final int size = req.tx.unsafeBitcoinSerialize().length;
            if (size > Transaction.MAX_STANDARD_TX_SIZE)
                throw new ExceededMaxTransactionSize();

            final Coin calculatedFee = req.tx.getFee();
            if (calculatedFee != null)
                log.debug("  with a fee of {}/kB, {} for {} bytes",
                        calculatedFee.multiply(1000).divide(size).toFriendlyString(), calculatedFee.toFriendlyString(),
                        size);

            // Label the transaction as being self created. We can use this later to spend its change output even before
            // the transaction is confirmed. We deliberately won't bother notifying listeners here as there's not much
            // point - the user isn't interested in a confidence transition they made themselves.
            req.tx.getConfidence().setSource(TransactionConfidence.Source.SELF);
            // Label the transaction as being a user requested payment. This can be used to render GUI wallet
            // transaction lists more appropriately, especially when the wallet starts to generate transactions itself
            // for internal purposes.
            req.tx.setPurpose(Transaction.Purpose.USER_PAYMENT);
            // Record the exchange rate that was valid when the transaction was completed.
            req.tx.setExchangeRate(req.exchangeRate);
            req.tx.setMemo(req.memo);
            //req.completed = true; // FIXME: ALIN: This field is private, can't set it to true, but thankfully this is just for debugging.
            log.debug("  completed: {}", req.tx);
        } finally {
            lock.unlock();
        }
    }

    public Transaction mySendCoinsOffline(SendRequest request) throws InsufficientMoneyException {
        lock.lock();
        try {
            myCompleteTx(request);
            commitTx(request.tx);
            return request.tx;
        } finally {
            lock.unlock();
        }
    }
}

authors: Хамзат Бехтиев


text:
How does Bitcoin Gigahashes Convert to Ethereum Megahashes?
I bought 6 XFX Rx 480 8GB graphics cards and I estimate they will do 25-30 megahashes with Ethereum.
When looking on Amazon for other rig ideas I was reminded that they also sell Erupters. The erupters I was looking at are £60 roughly for 16 gigahashes. Not sure if that is only with Bitcoin or not but most of them say Bitcoin in the name/title of the product in sale.
I was wondering what this would equate to in ethereum megahashes and why?
My guess would be that it is something to do with the the difference in complexity with the encryption method, or something like that, but of course, for economy reasons the most important thing I would like to know, if possible, is what hashrate they would generate for Ethereum.
Thanks for any help in advance.

I think the OP is asking something more along the lines of "if I have 10 megahash/second, about how many mega(or giga?)hashes/second should I expect when mining bitcoin instead?"

Bitcoin and Ethereum use different hashing algorithms. General consumer hardware (like a CPU or GPU) can be easily programmed at a software level to perform either the Bitcoin or the Ethereum (amongst many other) hashing algorithms. However, specialized hardware (like the Block Erupters you mentioned, which are Application Specific Integrated Circuits (ASICs)) have the hashing algorithm hard-coded into the chip's design, allowing it to much more efficiently perform one type of work (Bitcoin's double-SHA256, for example) at the expense of flexibility--they can't be reprogrammed to do anything else.
On a side-note, a £60 ASIC which runs at 16 GH/s (which isn't a block erupter, it might be the USB Stick from GekkoScience?) is very unlikely to ever reach ROI. At current difficulty and Bitcoin price, and assuming free electricity, a 16 GH/s miner would bring in about £0.26/month, which is likely to get even worse as more mining power comes online in the future.

ASICs are application specific. A bitcoin ASIC miner is totally useless for mining Ethereum. They do not translate at all. If you want an Ethereum miner, do not look at bitcoin miners. This will not help you in any way.


text:
What causes this error when installing libbitcoin?
I'm trying to install libbitcoin on Mac os 10.9, with Eclipse for C++.
I follow the instructions given on github (https://github.com/libbitcoin/libbitcoin), then I include:
#include <bitcoin/bitcoin.hpp>
using namespace bc;

The installation seems fine but when I build the project (cap4.cpp) I get the following errors in Eclipse:
    Building file: ../cap4.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"cap4.d" -MT"cap4.o" -o "cap4.o" "../cap4.cpp"
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
In file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:29:
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:51:14: error: no type named 'initializer_list' in namespace 'std'
typedef std::initializer_list<data_slice> loaf;
        ~~~~~^
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:51:30: error: expected unqualified-id
typedef std::initializer_list<data_slice> loaf;
                             ^
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:68:31: error: unknown type name 'loaf'
inline data_chunk build_chunk(loaf slices, size_t extra_reserve=0);
                              ^
/usr/local/include/bitcoin/bitcoin/utility/data.hpp:75:41: error: unknown type name 'loaf'
bool build_array(byte_array<Size>& out, loaf slices);
                                        ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
In file included from /usr/local/include/bitcoin/bitcoin/math/hash.hpp:29:
In file included from /usr/local/include/bitcoin/bitcoin/utility/data.hpp:156:
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:32:25: error: expected '(' for function-style cast or type construction
    return byte_array<1>{ { byte } };
           ~~~~~~~~~~~~~^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:37:22: error: expected '(' for function-style cast or type construction
    return data_chunk{ byte };
           ~~~~~~~~~~^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:40:31: error: unknown type name 'loaf'
inline data_chunk build_chunk(loaf slices, size_t extra_reserve)
                              ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:55:41: error: unknown type name 'loaf'
bool build_array(byte_array<Size>& out, loaf slices)
                                        ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:95:57: error: expected expression
    /* safe to ignore */ build_array<Left + Right>(out, { left, right });
                                                        ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:105:43: error: expected expression
    /* safe to ignore */ build_array(out, { left, middle, right });
                                          ^
/usr/local/include/bitcoin/bitcoin/impl/utility/data.ipp:126:54: error: expected expression
    DEBUG_ONLY(const auto result =) build_array(out, { bytes });
                                                     ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:35:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t hash_size = 32;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:35:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t hash_size = 32;
                          ^
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:36:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t half_hash_size = hash_size / 2;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:36:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t half_hash_size = hash_size / 2;
                          ^
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:37:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t quarter_hash_size = half_hash_size / 2;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:37:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t quarter_hash_size = half_hash_size / 2;
                          ^
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:38:8: error: unknown type name 'constexpr'
static BC_CONSTEXPR size_t long_hash_size = 2 * hash_size;
       ^
/usr/local/include/bitcoin/bitcoin/compat.hpp:34:26: note: expanded from macro 'BC_CONSTEXPR'
    #define BC_CONSTEXPR constexpr
                         ^
In file included from ../cap4.cpp:5:
In file included from /usr/local/include/bitcoin/bitcoin.hpp:19:
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:25:
In file included from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27:
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:38:27: error: expected ';' after top level declarator
static BC_CONSTEXPR size_t long_hash_size = 2 * hash_size;
                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [cap4.o] Error 1

What's wrong?

It looks like there are issues with gcc on Mac. On an issue in the libbitcoin github repository 'evoskuil' states:

gcc on osx is problematic because the ABI implementation is incomplete.

It is further suggested to use "the native Mac clang++/clang compiler" instead of gcc.
The libbitcoin Macintosh readme prescribes:

Libbitcoin requires a C++11 compiler, currently minimum GCC 4.8.0 or Clang based on LLVM 3.5.


text:
Why is the blockchain called Distributed Public "Ledger" and not "Journal"?
Bitcoin (or more generally, blockchain) is a Distributed Public Ledger and as we know:

The Journal is a book where all the transactions are recorded immediately when they take place which is then classified and transferred into concerned account known as Ledger.
Source: keydifferences.com

This means that it's a "Ledger" that keeps classified and cleared transactions instead of a "Journal".
We know Bitcoin stores all transactions (UTXO - Unspent Transactions Output - is optional) so why do we call it Ledger instead of Journal?
Please add references to your answers!

You're right. The Bitcoin blockchain is not a ledger, but rather the network's transaction journal. It's actually the UTXO set that is the ledger of all Bitcoin balances.

(UTXO - Unspent Transactions Output - is optional)

If we take a step back and think about it, what are we more interested in? The compiled history of all payments, or the current state of the network's balances?
Obviously, the latter is more useful for anyone that wants to transact on the network. The UTXO set allows to check whether someone is able to pay, and upon update whether we were paid.
The blockchain is merely the means of converging on a common state of the UTXO set. We require the blockchain to compile the UTXO set, as the journal is used to derive the ledger. In fact, pruning full nodes throw away part of the blockchain after processing it, but they all keep the UTXO set. So, while it is conflating different aspects of the system, it seems to me that people speak about "Distributed Public Ledgers", because they care about the balances more than the transactions.


text:
Minimum number of transcation in blocks one must include?
Anybody as the miner can just include 1 transaction and mine 12.5 award transaction and nonce and although it may not speed up my process as (number of transaction +Award+ Nonce)=some Constant to be inside the sha256() === < target
so it does not save any calculation ??
but valid or invalid depends upon minimum one ...or not

A block is required to have one or more transactions. The first transaction must be the coinbase. (This is the transaction that claims the reward.)
Removing transactions from your block will not save you mining time. (Note that it may make your block propagate faster, and it may be impossible to tell if a transaction is valid when SPV mining.)


text:
What happens between submitting a transaction to the network and it being confirmed?
I am very new to bitcoin, appreciate any help that I can get for below queries.
1) Is there any way (site or app) to know, to which node my current (latest) transaction is headed to? Does it go to one node or many before included into block? Probably it is going to the pool, where it will be picked to included in the block. So do we know which pool it landed in?
2) How to know, how many miner are currently working with my latest transaction, which is yet to be included into the block? Here is my understanding, more than one miner can include one transaction and all may not have same transactions. So how to know who all are working on this
Kind Regards

Some miner will mine the next block. No one knows which one it will be. For transactions to be included in a block within a reasonable period of time, pretty much all miners have to know about pretty much all transactions.
You don't know who is currently mining and maybe you're on a bad internet connection so you don't want to send your transaction to every single miner in the world, just in case that is the one who will build the next block. You merely have to send your transaction to a single node in the Bitcoin network. If it's valid and contains a reasonable fee, it'll be automatically propagated through the network and find its way to all miners.
So to answer your first quesiton: It didn't just go to a single miner. You can be pretty sure all miners know about it.
Miners don't tell others which transactions they are trying to get into the next block. This changes with really, really often, for every big miner. They by the way are working on many blocks at the same time, hoping to succeed with one.
Once a transaction has been included in a block, you can find out who made that block. Let's say your transaction ID is ccb5133b45fbca133936ab059377d4a5e4078a48b98349c8beb99c2cee529716. Head over to https://blockchain.info and enter it. You'll be shown that it's included in block 446059 ("Included In Blocks"). Click on that number and you'll be shown that block. There is a field called "Relayed By" whose value in this case is "BitFury". So you know the block was probably made by BitFury.

Thanks UTF-8, few follow up questions, if I can ask, apologies for ignorance on this topic 1) Can I send the tx to a particular node or it will just send & software will direct to nearest node 2) My understanding is each node may not mine, the question is whether miner are separate nodes or an  ordinary node can be miner node too 3) Is there a pool where miner look for transaction, how exactly a transaction reaches there?. Appreciate if you can help me with these.

Whether you can send your transaction to a particular node depends on the wallet software you use. Some give you the choice, some don't. Each miner is a node but not each node is a miner. https://en.bitcoin.it/wiki/Full_node Nodes communicate with one another. https://en.bitcoin.it/wiki/Network They keep their own pools. https://99bitcoins.com/what-is-bitcoin-mempool/ If one of their peers sent them new data, they tell their other peers about it. That's how information spreads through the network. Each node decides what's in its pool and what is sent to others.

Thanks UTF-8, so If I use wallet from mycelium, would that be classified as lightweight node? Appreciate all help.

Yes, it's a lightweight node.

Bitcoin is a peer-to-peer network, so you're not sending your transaction to a miner specifically, but to some random peers. They in turn send it to other peers and so forth, until it goes through the entire network. Some of these peers will be miners who may attempt to add your transaction to a block.
In more detail, if you are running the Bitcoin client software, your computer talks to several peers, essentially randomly selected. Your computer asks them for new blocks, transactions, updated peer list, etc using a simple protocol over port 8333. Meanwhile, other random computers can ask your client for new blocks, transactions, etc. So you are helping spread other transactions through the system.
One of the key ideas of Bitcoin is this decentralized structure - there's no node in charge. You pass your new transaction to a few random nodes and a few seconds later it has been passed to just about everyone on the network, including the miners.
The network is dynamic since peers can go up and down all the time. Your client will switch to different peers if one stops responding to you. And other peers will rapidly find out about you when you join the network.
(Lightweight clients don't take part in this full network, since you wouldn't want all this traffic to your phone for instance.)

authors: Азат Ямалетдинов


text:
Can I cancel a transaction that has not been successfully broadcast yet?
In Bitcoin Core, is it possible to cancel a transaction whose status is:
"Status: 0/offline, has not been successfully broadcast yet"

The client hasn't caught up with the network. It looks like it's going to do that first, and then send the transaction.
Is that right, or is the transaction already irrevocable?
If I can cancel the transaction, what's the best way to do that?
I tried abandontransaction but it gives the error:
Transaction not eligible for abandonment (code -5)

First of all, quit Bitcoin Core.  Disconnect the machine from the Internet to be even safer.  The -zapwallettxes option might do what you want, but I am not certain.

Could you check if the transaction is confirmed, or if the transaction is in the memory pool (getrawmempool) ?

@NickODell, confirmed as in confirmations? It has none. I'll check getrawmempool now.

@Buster confirmed as in confirmations.

@NickODell, getrawmempool shows one transaction, which is the one I'd like to cancel. So -zapwallettxes?

Yeah, the transaction in the memory pool is preventing abandontransaction from removing it from your wallet.

As mentioned in comments: quit bitcoin core and restart it with zapwallettxes flag:
bitcoin-qt.exe -zapwallettxes=1
-or-
bitcoin-qt.exe -zapwallettxes=2

As per bitcoin wiki:

-zapwallettxes=   Delete all wallet transactions and only
  recover those parts of the blockchain through -rescan on startup (1 =
  keep tx meta data e.g. account owner and payment request information,
  2 = drop tx meta data)

It will take some time to rescan all blocks.
Update: It did not worked in my case. Transaction stayed in mempool. So I have had to restore older wallet.dat and run full rescan again.
Update2: Starting from bitcoin core 0.14.0, the mempool will be saved to disk. So none of above solutions helped in my case. Closing wallet and deleting mempool.dat finally did the job.

zapwallettxes has been removed and replaced with "abandontransaction"

I did a trick back in the day when I send btc I did not mean to. If you have a backup of your wallet then load this up on a new machine and u can send the coins from that address to another, thus double spending and voiding your initial first transaction. So long as first transaction has not been broardcast then this should be possible.

Not relevant in this case, but thanks!

As mentioned: double spend it if you still can. And when you do that dont forget to put a high enough fee (10 times the auto-calculated one for instance just to be sure, will only be a few cents anyway) so that it jumps the mempool and gets confirmed in the next block.

The input had not been spent, so there's no need to double spend. Restarting the client with "-zapwallettxes" is all I needed to do. Thanks!

A "double spend" means to create two transactions using the same unspent input. If the input has been spent, then it is NOT a double spend, it's just an invalid transaction.

The best way is to abandon the transaction as zapping the wallet takes a LONG time for the rescan. In order to fool bitcoin into thinking the transaction has not been broadcast, you need to shut down bitcoin-qt, rename mempool.dat to mempool.dat.old, add "walletbroadcast=0" to bitcoin.conf, and re-run bitcoin-qt. Then you can abandon the tx, then you can shutdown bitcoin-qt, rename mempool.dat.old back to mempool.dat and remove the walletbroadcast line from bitcoin.conf.
Given the tx was broadcast (as the error "Transaction not eligible for abandonment (code -5)" means this), there is still some risk that it will make its way into a block, given the valid tx could have been stored somewhere. The only way to ensure it doesn't make it into a block, is to create another transaction using the same input and get this into a block.
Also, see this for an explanation from one of the bitcoin core developers on issues you might encounter with abandoning the transaction: https://github.com/bitcoin/bitcoin/issues/11060#issuecomment-323124996

The steps outlined here to recoup the unspent/unconfirmed coins in the wallet work as expcected. Unclear on the following, just want a second opinion from anyone who knows. " The only way to ensure it doesn't make it into a block, is to create another transaction using the same input and get this into a block." This means A) the transaction can still be processed from the mempool as it was broadcasted to the network, correct? B) "using the same input" - I'm assuming that this means making a duplicate transaction matching the send to address and amount, just with a higher fee so it can be proce

A) "the mempool" - there is no single mempool - they (transactions) are stored on computers, and can be stored indefinitely.
B) No, the send to address and amount can be different, it's just the input that needs to be made invalid (by making it spent).

so the reply to the question A) is yes, there is nothing you can do to be sure that an already broadcast and valid transaction will not included in a block.


text:
v0.13.1 wallet - connect failed: Network is unreachable (101)
Noob here.  Ran the core wallet on my Linux PC and looking for help as to why it is not working after syncing up the history of blockchain Tx's.  Is this likely my router not passing port 8333 packets, or something else?  thanks!
2016-12-15 13:39:52 Pre-allocating up to position 0xe00000 in rev00709.dat
2016-12-15 13:39:52 UpdateTip: new best=0000000000000000021ab2f093924ee05d43c228c2f6ab84414d7b77bef0ca18 height=443582 version=0x20000000 log2_work=85.680045 tx=179248787 date='2016-12-15 13:40:26' progress=1.000000 cache=175.8MiB(93812tx) warning='2 of last 100 blocks have unexpected version'
2016-12-15 13:39:54 ProcessMessages: advertising address 179.125.21.234:8333
2016-12-15 13:39:54 receive version message: /Satoshi:0.13.1/: version 70014, blocks=443582, us=179.125.21.234:58800, peer=21
2016-12-15 13:39:54 AdvertiseLocal: advertising address 179.125.21.234:8333
2016-12-15 13:41:31 connect() to [2001:0:9d38:6ab8:3c33:1df8:ab64:a421]:8333 failed: Network is unreachable (101)
2016-12-15 13:41:59 connect() to 114.254.131.229:8333 failed after select(): Connection refused (111)
2016-12-15 13:43:00 connect() to [2001:0:9d38:6ab8:249a:276e:a1e9:fc4b]:8333 failed: Network is unreachable (101)
2016-12-15 13:46:38 connect() to [2001:0:9d38:90d7:2068:fbff:2776:17b5]:8333 failed: Network is unreachable (101)
2016-12-15 13:48:46 connect() to [2001:0:5ef5:79fd:344e:fda:b3e8:2a0d]:8333 failed: Network is unreachable (101)
2016-12-15 13:53:08 ProcessMessages: advertising address 179.125.21.234:8333
2016-12-15 13:53:08 receive version message: /Satoshi:0.13.1/: version 70014, blocks=443582, us=179.125.21.234:48796, peer=22
2016-12-15 13:53:08 AdvertiseLocal: advertising address 179.125.21.234:8333
2016-12-15 13:53:25 UpdateTip: new best=0000000000000000004cfce5b4e88c754daa10165a2495fbc9893a8fb054f938 height=443583 version=0x30000000 log2_work=85.680076 tx=179251601 date='2016-12-15 13:53:36' progress=1.000000 cache=217.3MiB(104890tx) warning='3 of last 100 blocks have unexpected version'

Also when I try to confirm my node on this page :  https://bitnodes.21.co
It says "179.125.21.234:8333 is unreachable."

.... and crickets.  Nobody can help me?

eh, think I found it.  My router using NAT...
https://bitcoin.stackexchange.com/questions/38057/how-do-i-identify-my-ip-address-on-bitnodes
"If you are on a NAT network (192.168.**** or 10.*******) then use port forward in your router/modem and open 8333 in your firewalls.
Not behind NAT? Check all your firewalls and add a 8333 exception when needed"

Brad, your conclusion is correct. The most likely explanation is NAT. Your bitcoin node is advertising its external (NATed) IP address, but your router is not forwarding incoming connections back to your Linux PC. You need a forwarding rule


text:
Bitcoins not showing up in MultiBit after backup import
I was using MultiBit (old version), which I've moved to
USB and moved back after a while. In between, I'd done a system recovery (Win 7 64-bit).
I reset the blockchain but still can't see the coins that
I know are still there. I had 2 wallet backups therefore
2 wallets, and it has to be in one of them. So where'd they go?

Seems as though this is not a very helpful forum....

It's utterly unclear what your quesiton is supposed to be about. It you think what you're looking for is in either one of 2 wallet backups, go check them. We can't do it for you.

You don't think I already looked in all those ? I'll tell you what you can do for me, and that's keep quiet if you have nothing useful to add.

Please provide sufficient information for other users to get an understanding of what you've been trying to do. Some things that you may want to explain: What did you do when you moved MultiBit to USB and back? What do you mean with "reset the blockchain"? Did any errors occur when you imported the backups? Have you tried importing the backups into a new version of MultiBit? Did you find any historic transactions that showed that the money ever entered the wallet?…

Your description of what you've done is too brief and it's not possible for us to tell you what went wrong.
These possible problems come to mind:

The backups you made don't include the data you're looking for. A third state that actually held the relevant private keys was lost.
You didn't copy the wallet data when you moved the MultiBit client to USB storage.
You made a mistake importing the backup.
Your bitcoins were stolen and you didn't notice.
There is an issue with MultiBit.
You didn't wait until MultiBit actually synchronized with the network.


text:
How does the node system understand which ledger is the latest before updating their own ledger?
I have two specific questions:
How does a new user realizes which is the correct copy of the ledger to be used when initially updating(downloading) the ledger, and why is it that a user cannot deceive it by broadcasting its ledgers manytimes. (there by giving the system a pseudo idea that that is indeed the majority ledger)
How does one understand if the two ledgers are the same? Does the hash function change with the last transaction? My specific doubt would be that considering that the hash will change with the guesses too even if the last block info is the same then how does the system realize that these are from the same block even if their final values are diff.

How does a new user realizes which is the correct copy of the ledger to be used when initially updating(downloading) the ledger

They find the highest-work valid blockchain. This is not the same thing as the most popular blockchain - if 999 nodes tell your node they're on a chain, but one node tells you about a longer chain, you will prefer the longer chain.
If you do not see the longer chain at least once, you will not switch to it. However, even if you start mining on the shorter chain, you will switch to a longer chain after it appears.

How does one understand if the two ledgers are the same?

You compare the block hash of the chain tip. If they are equal, both nodes have identical blockchains. If they are not equal, the nodes have different blockchains.


text:
Is it OK not to sort transactions at all?
According to Mastering Bitcoin. Mining - Transaction Age, Fees, and Priority, miners sort transactions, using special parameter, called priority, which looks like
Priority = Sum (Value of input * Input Age) / Transaction Size
If the priority is greater than 57,600,000, it means that transaction is high priority and it will be written in the first 50 kb.
The question is: Is priority really necessary? I mean, if I'm a miner and I have e.g. 1000 unconfirmed transactions, is it ok to randomly choose 100 transactions and put them into the block just as it is? Without sorting by priority or fees?
Will it work out or I'll get reject message or something?

As long as all selected transactions are valid, you may select any transactions you want.
You should check that there are no double spends among the selected transactions and that you keep any transactions which build on each other in the correct order, i.e. if TX B spends an output of TX A, TX B has to be listed after TX A in the block if you select both.
Sorting them by fee rate (i.e. fee paid per data size or satoshi per byte) will greedily maximize the transaction fees that you collect per block, to optimize block usage while maximizing fee, you'd have to perhaps use a knapsack solver.
Priority was turned off by default in Bitcoin Core 0.12.0, I actually asked a few months ago whether any miners still select by priority.


text:
How can I run bitcoin-cli with disabled syncing?
I have synced about 200.000 blocks and that's enough for my purposes. So I want to use bitcoincli, but when it runs with enabled syncing (by default), my computer works to slow.
How can I disable syncing for some time? Probably I need to set up something in bitcoin.conf, but I don't know what.

What functionality do you need? If you don't need connectivity to the network at all, you could just use -connect=0 -nolisten.

You could use the invalidateblock RPC. Bitcoin will not bother checking validity of blocks past that an invalid block.


text:
How is the human end of the Bitcoin network secured?
Being devil's advocate right now.
If you have a very strong cryptography, however, secure system's Point of Failure is always the human end. We spend hours trying to make Bitcoin secure at core level, but how secure is at the human level?
I expect big corporations and governments to secretly offer a huge sum of money to any of the developers of Core. I have nightmares about that.
How do we protect against bribery?

In an ideal world, we would want all programs to be auditable/verifiable(we can verify every execution path to be secure and correct). But that's far from reality, when you download a binary from a source(for example, Bitcoin Core), you have the following choices.
1) Trust the developers of the binary on their claim "binary works as intentded"
2) Verify the source yourself (It's open source for this reason) and build your software yourself.
All PR's to Bitcoin Core are visible to everyone, so everyone will be able to detect any harmful PR. An effective attack would involve bribing all people who actively watch the repository.
The best solution review the code yourself. If this attack really gives you nightmares, reviewing code yourself is the only way in which you don't have to trust anyone.
A more realistic solution is what happens today, you can rely upon hunderds of people who keep a watch on bitcoin repository to report if there are any backdoors in code.
EDIT: As pointed out by Peter Wuille, Bitcoin Core has a deterministic build process. You can repeat the build procedure for any release yourself, and verify that the resulting binary is identical to the release binary which you downloaded. This means that you don't necessarily have to trust just developers that the binary is created from publicly audited source code.

You may want to point out that Bitcoin Core has a deterministic build process. You can repeat the build procedure for any release yourself, and verify that the resulting binary is identical to the release binary. This means that you don't necessarily have to trust just developers that the binary is created from publicly audited source code.

After meeting some of you in person (Core devs) I sleep better at night. I know you guys have strong principles, and you know very well the open source community, and you apply those principles to your work. Thank you, and keep up the good work.

There is a joke about Thailand's road police:
Once Thailand King went to a witch a and asked: "Hey, witch! Help me to eliminate bribes on my land's roads, please. What should I do or how should I punish?". Witch looked at him precisely and answered: "Cancel all the police, so there will be not a single policeman to accept bribes!"
Since then... you know how it looks like in Thailand, if you were here.
The thing is we can't protect against bribery with a new BIP as well as we can't protect against narco traffic and other illegal services with it. Maybe we just need to change living conditions and to make such activities pointless?


text:
How does the lightning network affect miners?
Not a miner here, just wondering what other changes might be coming to the space.
With Lightning fees are really low, how do miners manage this?
Does this have a simple answer or is any resource I can look?
Thanks in advance.

The Lightning Network is a smart contract system based on bilateral payment channels. Multi-hop payments are facilitated by third-party nodes forwarding payments along a route connecting sender and recipient. For this service, the forwarding nodes will likely require a small fee corresponding to the amount forwarded.
Payments are negotiated exclusively among the participants of such a payment route, and therefore miners will not directly benefit from Lightning Network fees at all.
However, since the Lightning Network's fees are relative to the sent amount and the Bitcoin on-chain fees are relative to the amount of blockchain space occupied by the transaction, it seems likely that the two layers' payment activity will establish a self-regulating equilibrium: smaller payments being shifted towards LN, bigger payments being executed on the Bitcoin blockchain.
In the past years, we've seen a trend of the average value of on-chain transactions increasing significantly. In the last year the average transaction's value increased from $4,000 to $18,000. Since the emergence of Lightning Network is expected to vastly increase the overall utility of Bitcoin, and the creation and resolution of LN payment channels will add further demand for on-chain transactions, it seems likely that the overall transaction fee revenue for miners will further increase.

Miners do nothing with Lightning Network due off-chain transactions.
Miners are confirming only on-chain transactions.

Source

Note that miners have to confirm both the channel opening transaction and the channel closing transaction, they just don't see the intermediate exchanges while the channel is open

Yes, I understand those concepts, however does it mean that miners get the same amount of fees using lightning than without using lightning?

@Kibou, if you understand those concepts, why are you asking about miners?  Miners aren't involved.

Still can't get it. I know miners are not involved. If I was paying 0.001026 BTC for a Tx, and now I am paying virtually nothing, it means miners are losing lots of money. So with these maths it seems like miners lose a lot of money.

Miner fees and lightning network fees are different things.
Miners are only involved in the opening and closing transactions of a channel.  To them, those are just regular transactions, and as such, those transactions will have normal fees.
The fees on the lightning network are paid to hubs that bridge a transaction from one channel to another.  There are no on-chain transactions involved in this, and thus no miner fees.
Miners will not directly care about the price of fees on the lightning network.

If users do not pay the fees, who pays the fees? Maybe this is a very obvious question, sorry.

Lightning network users pay fees, but not miner fees.  They pay fees to the hubs that their transactions are routed through, but these fees are different than Bitcoin miner fees.  The hubs pay miner fees for the opening and closing transactions of their channels, which are the only actual on-chain transactions of the lightning network, and thus the only time miners are ever involved.


text:
How can I reproduce the same binary as bitcoin.org or bitcoincore.org?
I'm hoping that someone can tell me how to get the same binary that we see on bitcoincore.org/bitcoin.org.
I tried using Ubuntu 20.04
git clone https://github.com/bitcoin/bitcoin
git checkout v0.20.1
sudo apt-get update
sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 -y
sudo apt-get install libevent-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev -y
./autogen.sh
./configure --disable-wallet
make
make install

Extra details (git commit I'm going off of)
 git log
commit 7ff64311bee570874c4f0dfa18f518552188df08 (HEAD -> 20.1, tag: v0.20.1)
Author: Wladimir J. van der Laan <laanwj@protonmail.com>
Date:   Fri Jul 31 14:01:56 2020 +0200

produces bitcoind: d46f9ca67562129cb2f0d7ed7e0ae576ab06e616d98d28c2a262d82356f9d87b

bitcoincore.org link I'm going off of:
https://bitcoincore.org/bin/bitcoin-core-0.20.1/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz
produces bitcoind: 4ec74161b2a90293926ae8e20a2efbe952bd23b53aeebf051e6a6285ace18271
I was hoping that someone could tell me how to properly configure/setup my environment to produce the same binary that we see packaged nicely in the tarball on these websites.
The binary files aren't even close in size…
from tarball bitcoind size:
10312344 (10 MB)
from building from scratch bitcoind size:
192814984 (192 MB)
How do I make the super sleek and sexy 10 MB version?
Thanks!

The size is due to the inclusion of debug symbols; you can compile without them (CXXFLAGS="-O2 -g0" for example at configure time), or you can strip them after compilation (strip bitcoind). That will result in a similarly small file, but it won't give you a binary that's identical to the release binary. To do so, follow the gitian-based process like Murch suggests below.

The challenge with creating reproducible builds is that you need to ensure that the build process matches exactly across different operating systems and different architectures. Bitcoin uses Gitian, a deterministic build process to achieve that.
Bitcoin Core provides the configuration and build instructions for various operating systems in the /contrib/gitian-descriptors directory in the Bitcoin source code.
For Linux you would use this gitian-linux.yml.

In 2017 I wrote a guide to a small guide (with script) to reproduce the Debian binaries with Gitian.
The guide is obsolete and won't work for the current version, but it might still be helpful as a reference.
https://gist.github.com/frz-dev/3e3e906fa06294e61930e81b473e1e5b

Did the gitian process with both debian 10 and ubuntu 20.04, produced the same binaries. However these binaries are not the same ones that were produced 3 months ago for v0.20.1. Doesn't seem to be an easy way to get the same environment that other people use even if using a VM as there is no standard image used prebaked with dependencies. Nearly all the documentation for gitian for all methods.. on bitcoin-core and devrandom is outdated and broken. This has been a very interesting* experience. Currently "Don't trust verify" seems to be more of a nice to have w/ downloaded binaries. When Ginx?

For anyone finding this like me... Gitian has been replaced by Guix.
But this post is still good for explaining why the builds using he default settings/instructions from the Bitcoin github are so much bigger than the binaries downloaded from bitcoincore.org.


text:
How much power and cost do miners currently expend to mine one bitcoin?
How much are mining pools currently spending on mining per BTC?

I'd say this is a trade secret of the miners, but one could give a lower bound by assuming that they are using the best available hardware and guess their electricity cost. Not sure if this is a useful question, because it's very much dependent on the local situation of the miner and the mix of hardware that they use.

Power usage per GH/s changes with every new ASIC product.
I believe the Antminer S9 is probably still the state-of-the-art in december 2016. Batch 23 of this miner does 14 TH/s with 1372W +10% (at the wall, with Bitmain’s APW3 PSU,93% efficiency, 25°C ambient temp)
The price for mining hardware changes all the time. But now in december 2016 around 0.12-0.13 USD per GH/s should be expected. That's including the necessary power supply but not including shipping.
Of course there are people on ebay who will sell you a 1 GH/s USB stick for 10 USD. Not only do they cost way too much per GH/s but the power usage per GH/s will also be very high.
The price for electricity of course varies around the world.
Some miners get good deals buying mining hardware in large quantities and have special deals with power companies for very cheap electricity. Those deals will probably not be revealed. So we won't know the actual cost for a big miner to produce one bitcoin.
Keep in mind that some big miners are also manufacturers of bitcoin miners. If customers buy hardware from you, paying for the cost of having the chips designed and put in production, then you can make some extra machines for yourself very cheaply. If you can combine this with a good deal on electricity, then you can mine extremely cheaply. Unfortunately your mining will push up the difficulty which in turn hurts your customers who bought miners from you.