text:
Watch Only Wallets
I don't understand the point of a Watch Only Wallet. I've seen posts that state these wallets don’t contain any private keys, which means they can’t be used to spend coins they receive. In which case how do you use the coins in the wallet.
In other posts however I see references to using a private key to send coins. In which case how are these then different from a standard wallet and private key?

A "watch-only" wallet is used in the context of "cold storage". Cold storage means that the private key for spending is not online, but offline somewhere (a USB key, a printed QR code etc) which is obviously much safer from online attacks (although not without their own risks). A watch-only wallet allows you to watch what happens to those cold storage bitcoins without exposing the private keys to the online world.
The references you mention are very likely describing how the offline private key can never the less be used to sign an online transaction.

A Watch Only cryptocurrency wallet is a wallet that does not have a private key – you will not be able to send any cryptocurrency from it, cause it is designed specifically for monitoring purposes. The wallets of this type allow viewing the balance and monitoring transactional activity. I believe that watch only addresses are a handy addition to the cryptocurrency management ecosystem. It is easy to create such a wallet and it can save you some time monitoring the assets. Personally, I use Guarda Wallet (Guarda.co) for Watch Only functionality, but there may be some other wallets that support it.

One of the reasons that watch-only addresses were added is when you want to check a balance of a certain address with only the help of you local full node.
You would think that the node can provide this instantly (getbalance command) but it cannot. Getting the balance of a specific address (not belonging to your wallet) out of a node requires external programming and some serious time.
So as a solution they added watch only so you could monitor you balance.
Do not forget that when adding those addresses, the node needs to rescan (which will take some time)

Actually, a lot of exchanges and wallets are using Cold Storage. At first, it is easier to have control over large amounts of users and transactions. That's why there is a Memo for Steem and Destination Tag for XRP. That makes a differentiation between the users easier.

Please be sure to only mention your own product where it actually is relevant to the answer. When you do, you must disclose that it's yours and it must be clear why you're mentioning it. Otherwise, your post may be considered spam. For more information, please check out: https://bitcoin.stackexchange.com/help/promotion


text:
Two question about bitcoin transaction signing
I know that the signing should use public key, what if the private key is used in signing the output? Does that mean anybody can use the money in your wallet? And is there any difference between P2PKH and P2SH?

There are three (not two) questions here

Signing requires the private key, and commits the signature hash of the transaction to the signature. Altering the transaction will change the sighash, and thereby render the signature void.
The public key is required for signature validation. Only the public key hash is shared with the public in form of the address, from which the private key cannot be derived.
P2PKH and P2SH are both standard output scripts in Bitcoin.

A P2PKH(address) output is spendable by the private key associated with the address.
A P2SH(embedded_script) output is spendable by the embedded script and the unlocking script thereof. The P2SH output script acts as a "wrapper" for other output scripts.

Really thank you for your answer, I want to ask one more question: say that the user wrong using the private key sign the output, whether an attacker can steal bitcoin from the input address?

No, because the input contains the signature, which is only valid for the specific tx.

source: Stack Exchange

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

sort: votes


text:
Recovery of lost bitcoin
i have my wallet id and bitcoin address in a safe but deleted from all electronic gadgets. So how do i recover my bitcoin by using these said method please advise.

What do you mean with wallet id? Addresses cannot help u recover funds. You need the root seed or mnemonic backup phrase of ur previous wallet.

I have my wallet id and bitcoin address [...] how do i recover my bitcoin by using these?

You cannot recover control over Bitcoin using only a Bitcoin address.
You cannot recover control over Bitcoin using only a "Wallet-ID" you typically need a password also. But in the case of custodial wallets, the custodian may provide a means of recovery based on other information (e.g. an email address used for original registration). Note that custodial wallets are widely regarded as the least secure way to store Bitcoin long term. See What kinds of wallets are there?. Also note that private companies like Blockchain.com don't own either the Bitcoin system or the Bitcoin blockchain - they are just one of many businesses that offer services based on cryptocurrencies.

You generally need either

The Private Key in some well-known format (e.g. WIF) or
A seed recovery phrase (often 12 words from a special list)

If you don't have these, it usually means your Bitcoin are forever unusable.

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


text:
Is there any point mixing coins if I were to use an online wallet?
Because when using an online wallet there isn't an address tied to your identity, would there be any reason to mix coins when making a transaction?

Assuming that you'd like to protect your privacy by mixing coins, then yes, there would be a reason. Using an 'online wallet' (I am assuming you mean an online wallet-service, that has a website you log in through, or something similar to that) does not protect you in any way that using a locally generated wallet wouldn't. In fact, it is probably a poorer security model in most cases, since your private keys will be generated in an online device.
Further, the service running the wallet may have logs of your IP, etc, so it may also be worse for your privacy.
A coinjoin helps obfuscate the traceable history of a bitcoin through time, an online wallet does no such thing.


text:
Binance hacked?
Something is happening, yesterday in reddit many people could not withdraw their funds or cancel their purchase orders .
And the administrator (who is binance and usually solves the problems) erased the posts.And today for more than an hour they arent trading because they are "keeping the servers" without warning before.  What happened?

Welcome to Bitcoin.SE! I have found a few comments on this and will answer below.

From @binance_2017 on Twitter:
00:34 AM - 8 Feb 2018 UTC

A system maintenance is in progress, some users may experience a temporary decrease in exchange performance while this in underway.Thank you for your understanding.— binance (@binance_2017) February 8, 2018

And support.binance.com:

Fellow Binancians,
Due to a significant increase in users and trading activity, Binance will need to extend the System upgrade and is expected to be completed by 2PM (UTC).
Our team is working hard to complete this upgrade as quickly as possible. We will make an announcement to all users if completed ahead of schedule.
Withdrawals and trading during this period will remain suspended. We apologize for any inconvenience caused and thank you for your patience.
Thank you for your support.
Binance Team
2018/02/08

Bianance was not hacked - so they report. see -
 https://www.ft.com/content/c17f9cae-0caf-11e8-8eb7-42f857ea9f09
Twitter Post:
binance

Verified account
@binance_2017
28 minutes ago
More binance Retweeted CZ
-Due to an unforeseen slowdown in the speed of our data sync, we now estimate for all trading activity to resume at 2018/02/09 4AM (UTC). In the 30 minutes prior to the commencement of trading, users will be able to use utilize all other account related functions.

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


text:
Mining on my godaddy hosting
I have a hosting contract with godaddy that I don't use anymore, can I use the unused CPU and space to do bitcoin mining?

What kind of contract? On a dedicated server, this would be permitted, though completely ineffective for Bitcoin as abelenky notes below.  On a shared server, it is almost certainly forbidden by terms of service; the admins will kill your mining job when they find it, and possibly terminate your contract.

No you cannot.
CPUs and GPUs can not mine bitcoin anymore.
(they can mine all they want, but they will not find a block for literally thousands of years, nor contribute a meaningful share to a pool)
Only specially designed ASICs can do any effective bitcoin work anymore.
You may be able to find some AltCoin that you can work on.

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


text:
How to get multiple connections to the same node
I'm playing around with connecting my node to another one of my nodes to see how many incoming connections I can handle.
Whenever I add node A from node B with bitcoin-cli addnode 1.1.1.1 add after the first time, I get:
error code: -23
error message:
Error: Node already added
Is there a way around this? Can I edit the source code somehow to allow multiple connections between the same nodes? Presumably I would only have to edit the code for the sending node, not the receiving node, since I think the receiving node has to be able to accept connections from what appear to be the same IP and port because of NATS?
The alternative is to run many instances of bitcoind in pruned mode which would work I guess, but it's not ideal obviously

I'm curious, why do you want to do this?

To see how many incoming connections my nodes can handle. :)

Max number of incoming connections is part of config.

@JamesC. I know but I want to allow one node (A) to establish many outgoing connections to the same node (B)

Ok, it is not allowed as you already mentioned. The same p2p communication will be repeated, so multiple channels are redundant. If a node propagates a new tx or header, it will announce it to all channels. But if you still want to do it, I think the peer is id’ed by IP in version msg, so you would have to tweak the sourcecode to broadcast a different address for each channel, or accept identical IP on multiple inbound connections.

Wouldn't changing the IP in the msg make data sent back to (A) go to the wrong IP address?

No, its separate from the actual tcp connection, which is why a peer may send a different address sitting behind a nat than is seen by receiving peer ofthe tcp connection.

@JamesC. I see, thanks!
I can't mark your comment as an answer for some reason though
Also, if anyone could point me to where in the code I should edit, that would be awesome haha

To find the point in the source code you want to change, the best thing to do is to search for the error string you receive ("Node already added").
However, for your purpose (to see how many connections you can handle) I'd rather run multiple nodes on the same machine of B. You can easily do it by using the '-datadir' option and using different ports (keeping the same IP).
The only limit there could be is the number of peers from the same subnet you can connect to, which is limited to 1 in Bitcoin Core.
But maybe this is not the case with manual connections like 'addnode'.


text:
How to setup a testnet full node on Windows 10?
I'm trying to implement an SPV and I'd like to test it on a testnet full node but can't really understand how to do it from what I've found.

Download the Windows installer for Bitcoin Core from https://bitcoincore.org/en/download/. Install Bitcoin Core. Once it has installed, you should see a shortcut in your start menu with the name Bitcoin Core (testnet). Run that. You now have a testnet full node.


text:
Secure Donations Wallet for the RCK
Hi I am looking into a secure donations wallet for the RCK - Refugee Community Kitchen. http://refugeecommunitykitchen.com/
 Theyre doing great work to provide a humanitarian response to the humanitarian crisis in Northern france. The founders are happy for me to work on setting up a secure wallet for donations which will open them up to support from the cryptocommunity. I just want to make sure its as easy to manage as possible as although I am totally confident that donors will know exactly what to do, the donations link will be added to their main webpage and ideally needs to be as maintenance free as possible.
I've been over on the SAFEnet forum and been given alot of good advice and pointed in the direction of Copay.
I understand from help on the forum that because its open source and multi sig Copay is a great option.
What I cannot seem to grasp is if a Copay wallet is suitable for donations of other cryptocurrencies as well as Bitcoin? I know my questions are very basic - so is my understanding so I really appreciate your expert opinion.
I looked at Coinomi as this seemed to readily support donations for lots of different coins. Am I missing something basic here? Can a Copay Wallet readily accept multiple types of cryptocurrency?
Thank you very much for your help with this!

https://github.com/bitpay/copay

Copay is a secure Bitcoin and Bitcoin Cash wallet platform for both desktop and mobile devices.

Copay supports Bitcoin and Bitcoin Cash only.  No other currencies are supported.


text:
I am looking for a list of all the public repositories for as many different cryptocurrencies as possible
I am interested in reviewing github repositories of many different cryptocurrencies to enhance my understanding and know the differences between them. Does anyone know of an online list of the links to all of the different repos?

https://www.coingecko.com compiles the developer activities of almost all or most public traded cryptocurrencies.
They have the repo data stored on their site. Site may be hard to navigate, click Coin then choose Developer tab and look for Code Repository link. Enjoy.


text:
How to send btc from multiple addresses to a single btc address?
Let's say, I have 3 btc addresses A, B, C i.e; 1 BTC in address A, 1 BTC in address B, 1 BTC in address C. Now I want to send 3 BTC to another address. How to do that and what about the miner fee?

If you were asking about creating transaction manually, you can do that by creating raw transactions using addresses (A, B, C) inputs.
You can set the fee by not spending the fee while creating the transaction.
so if you have 3 BTC you send 2.998 and just leave the rest, it will be considered as miners fee.
By default if you are using Bitcoin-core or any other wallet they are using required inputs to cover your payment, so you shouldn't worry about that.

Thanks. How to generate multiple public addresses using one private key?

Please don't ask multiple questions in one questions. add another question.


text:
How to get public and private keys by giving seed explicitly?
I am using bitcore to generate the public and private keys. I am using 'getnewaddress' method to generate a public address and dumpprivkey to generate a private key. When I am calling the getnewaddress method it automatically generating a new public address. I want to explicitly send a seed to generate a new address. Could anyone tell me how to do that?

Small technical clarification: When you getnewaddress, the wallet generates a privkey, and then derives the pubkey and bitcoin address from it (and then displays the bitcoin address to you). When using the dumpprivkey command, the private key is simply displayed, not generated.

By "bitcore" I assume you mean Bitcoin Core as the commands you are using are Bitcoin Core commands. There are other things which are called "bitcore" which is confusing.

I want to explicitly send a seed to generate a new address. Could anyone tell me how to do that?

You cannot. Bitcoin Core does not allow you to seed the random number generators with custom values as that is a security vulnerability.
You can import a private key (which some may call a seed) which will then add that private key and its associated address to the wallet. That may be what you want to do.
In Bitcoin Core 0.17, there will be an option to set the HD wallet seed. Bitcoin Core generates private keys deterministically using BIP 32 which has its own seed value. In Bitcoin Core 0.17, a new feature has been added which will allow you to set the seed used by the wallet for key generation.

sorry for the confusion. It is bitcoin core. Thanks a lot.


text:
How to transfer btc from multiple btc addresses to a single btc address?
I have 3 btc addresses and let's say each btc address has 1 bitcoin. If I want to transfer to my address from 3 btc addresses, I have to create 3 transactions and every time I have to pay a mining fee. Instead of that Can I transfer all the amount from 3 btc addresses to my btc address in a single transaction? How to manually create a transaction? I am using "pybitcointools" library. But It supports only to send coins to multiple addresses. Could anyone help me out in creating a single transaction manually using any library?

A very generic question, so only a generic answer. I think, what you are looking for is how to create a transaction with multiple inputs, to a single output. There are many bitcoin tools out there, I for myself use some shell scripts on unixoide systems. There is also bx and tx tools, as described in Andreas‘ book „Mastering Bitcoin“ (book is online readable). Then there are libraries for php, Java, python - each with its own learning curve. Generally: you need the previous tx ID, the outpoint, and the target address and amount. This all needs to go into a serialized set of data, then a hash is generated over it, and signed. Once you have the signed tx, you can send it from a wallet or from many Online services (like blockchain.info) to the network.
I recommend to start playing on testnet or regtest, assemble a tx, and run through the possibilities. Then you can search specifically here in the forum, or raise a question based on the experience.
Again: it can be done manually, but requires some effort to get into the logic of correct assembly. Andreas‘ book is a good starting point.


text:
How to know whether my transaction is fraudlent after one confirmation?
Let's say if the transaction tx_1 has one confirmation. But the tx_1 is fraudulent. Can it be rolled back? Here I am storing the confirmed blocks and if my transaction is in the block-1 then the confirmation of tx_1 is 1 and whenever the blocks come after the block-1 the confirmation will keep on incrementing. But after one confirmation, if the tx_1 is fraudulent then how to stop that transaction?

You cannot undo a confirmed transaction trivially. That is one of the key benefits of a network like Bitcoin.
If your tx has only 1 confirmation, you might yet be able to drop it by mining two blocks on the parent of the block that contains tx_1. However, this requires you to have enough hashpower to be able to do so before someone extends the chain building on the block containing tx_1, which is non-trivial. Additionally, even if you succeed in this, there is still a chance that someone might mine on the block you dropped and turn that into the longer chain again.
Usually, blocks which have been confirmed 6 times are considered irreversible. Practically, unless you have access to a large amount of hashpower, even 1 confirmation is effectively irreversible on the bitcoin chain (although orphan blocks do occasionally happen)

Say I am tracking a specific bitcoin transaction 'TX_1'. A confirmed block had the transaction information after I decoded the block, and I updated my database as :  {transaction: 'TX_1', 'confirmation': 1}
now how do I increment the number of confirmation, assuming I am still listening to the network through ZMQ. Should I expect the same transaction 'TX_1' to be present in upcoming blocks?

When you receive the next block, check the prevblock hash. If it matches the block with your tx, increment by one. For the n+2 block, check the prevblock hash against the n+1 block, and increment by 1. So on and so forth. As long as new blocks keep building upon a chain including the block with your tx, it keeps adding confirmations


text:
Can we do Multisignature transaction for bitcoin_cash?
I tried implementing multi-signature for bitcoin and it worked successfully. Is it possible to implement multi-signature transactions for Bitcoin_Cash?

Yes, Bitcoin Cash supports exactly the same script opcodes as Bitcoin (as of this writing), so multisig transactions can be created and spent in exactly the same way.

Could you give me an example to create the multisig transaction for bitcoin cash?

Perhaps you can explain what you are doing for Bitcoin.  It should be very easy to adapt it for Bitcoin Cash.


text:
Can I generate an address without using bitcoin core?
I am running bitcoin core in my mode. I am using getnewaddress to generate an address and then I am using unspent to get the unspent of an address which returns the unspent successfully. If I created an address without using getnewaddress (using some 3rd party or offline) and when I am using unspent on that address it is not giving the unspent instead it is returning an empty list. Could anyone tell me how to solve this?

I think you are maybe looking for watch only addresses, e.g.: https://bitcoin.org/en/developer-reference#importaddress or also here: https://bitcoin.stackexchange.com/questions/48829/import-multiple-watch-only-addresses-using-importaddress

Bitcoin Core does not store the information for all addresses as that would be computationally expensive and not very useful. For you to get this data, the address needs to be part of your wallet. So you must add the address to the wallet using importaddress and allow Bitcoin Core to rescan the blockchain. It will then find all of the transactions related to that address and look for new transactions related to that address. Note that rescanning can take a long time so if you want to import multiple addresses, use importmulti.


text:
How to store data on blockchain?
I want to store the data on blockchain so that people can see and verify the data. The data format will be a simple JSON like the user details.
{'user_id': userid, 'amount': amount, 'product_id': productId, 'place_id':place'}

Is there any way to store the above data in blockchain so that people can verify their details that are not manipulated?

The traditional way to store data is via an OP_RETURN. On Bitcoin, this is limited to 40 bytes of data. Bitcoin Cash increased this limit to 220 bytes just yesterday.
You can also store arbitrary data (more or less) on ethereum via a smart contract.
Traditionally, for this kind of use case, people opt to store the hash of the data instead of the raw data itself. They can then provide the raw data to someone, who can hash it and verify that it matches the hash that was stored on the blockchain.

A way to embed data in the blockchain may be using the Class B transactions Use the tool on this website or my tool.
Keep in mind that it's not viable to do that on the Bitcoin blockchain.
If you're looking for "proof of existence" or "proof of authenticity", use Raghav's suggestion.


text:
Transaction Broadcast error zcash
I can't broadcast the transaction to the zcash testnet. I will give the entire steps clearly. Could anyone tell me where I am doing wrong.This is my zcash address "tmRvLFZ3Lnz9vhd9bG2JuWakYESEi4ukxqs". Private key - "cSwoLKkeHSj3zaKAqiv8DXKXQVm18Ci3vwTvgrtPAS6a2YJ1HeRY"
step:1 zcash-cli listunspent 6 9999999 "[\"tmRvLFZ3Lnz9vhd9bG2JuWakYESEi4ukxqs\"]"
[
  {
    "txid": "8a1ce0ecc491ba2cb234674662769774ce81e4beaa7a7aff466aa62ea8b8345b",
    "vout": 1,
    "generated": false,
    "address": "tmRvLFZ3Lnz9vhd9bG2JuWakYESEi4ukxqs",
    "scriptPubKey": "76a914b1c61a54ae002ef35bf1fcdbdde9ea9e02b486bc88ac",
    "amount": 2.89999774,
    "confirmations": 16,
    "spendable": true
  }
]

step:2
    zcash-cli createrawtransaction "[{\"txid\":\"8a1ce0ecc491ba2cb234674662769774ce81e4beaa7a7aff466aa62ea8b8345b\",\"vout\":1}]" "{\"tmGrqWFJQJtYXFwm6b4ptKpDetNTWdpc3kX\":0.4,\"tmFHNDXpWYgRQ44FXPidCiiq1Rfx9gESuQ1\":2.39999774}"
output for step-2 "030000807082c403015b34b8a82ea66a46ff7a7aaabee481ce74977662466734b22cba91c4ece01c8a0100000000ffffffff02005a6202000000001976a9144e63b9f685635c97f578c2e94f4aba622b65d11a88ac1e1b4e0e000000001976a9143d171848a9caf0a64b7f069b116675bca56ac08b88ac00000000a52a030000"

step:3
zcash-cli signrawtransaction "030000807082c403015b34b8a82ea66a46ff7a7aaabee481ce74977662466734b22cba91c4ece01c8a0100000000ffffffff02005a6202000000001976a9144e63b9f685635c97f578c2e94f4aba622b65d11a88ac1e1b4e0e000000001976a9143d171848a9caf0a64b7f069b116675bca56ac08b88ac00000000a52a030000" "[{\"txid\":\"8a1ce0ecc491ba2cb234674662769774ce81e4beaa7a7aff466aa62ea8b8345b\",\"vout\":1,\"scriptPubKey\":\"76a914b1c61a54ae002ef35bf1fcdbdde9ea9e02b486bc88ac\",\"amount\":2.89999774}]" "[\"private_key\"]"
output :
{
  "hex": "030000807082c403015b34b8a82ea66a46ff7a7aaabee481ce74977662466734b22cba91c4ece01c8a010000006a47304402201607a0454a641dc28a81324dd292275780fde44bbdec4d95131d0be35bcd591f0220601161a481a4b690076febf5c1c7508cddfd1972fda432b9bbc55d87289beb9c012103472fba697de28693fea3ea2d7a0d744d164d6264f8c4f44648eb904162387fe4ffffffff02005a6202000000001976a9144e63b9f685635c97f578c2e94f4aba622b65d11a88ac1e1b4e0e000000001976a9143d171848a9caf0a64b7f069b116675bca56ac08b88ac00000000a52a030000",
  "complete": true
}

step:4
zcash-cli sendrawtransaction "030000807082c403015b34b8a82ea66a46ff7a7aaabee481ce74977662466734b22cba91c4ece01c8a010000006a47304402201607a0454a641dc28a81324dd292275780fde44bbdec4d95131d0be35bcd591f0220601161a481a4b690076febf5c1c7508cddfd1972fda432b9bbc55d87289beb9c012103472fba697de28693fea3ea2d7a0d744d164d6264f8c4f44648eb904162387fe4ffffffff02005a6202000000001976a9144e63b9f685635c97f578c2e94f4aba622b65d11a88ac1e1b4e0e000000001976a9143d171848a9caf0a64b7f069b116675bca56ac08b88ac00000000a52a030000"
output:
error code: -25
error message:

The Zcash testnet is currently in the midst of an upgrade. You need to upgrade your zcashd to at least 1.0.15, and it may be necessary to wait a while because the block frequency is artificially low at the moment.

This is my zcashd version : Zcash Daemon version v1.0.15. I am running on this version.


text:
Newbie question about the security of mixing
If I am running my own node, and using a mixer to anonymize my BTC, will it not be connected anyway because the transactions are to/from my own node?
I mean I am sending the BTC to the mixer from my node, and then getting it back to another address, sure, but I am accessing that address from my own node...
Even if I am using TOR, is there not something that identifes the nodes and tells observers that these two addresses have something in common, the node on my machine?

Are you using a custodial mixing service? (a very bad idea). Or are you using a wallet that implements a coinjoin/payjoin protocol? (not a bad idea).

In this case a mixing service. I tried coinjoining but it was rather complicated to setup and make work... Anyway, I'm not mixing large sums.

Those services provide terrible privacy assurances (if any at all), and expose you to massive counterparty risk (lots of examples of them running away with customer coins). I would absolutely not recommend using them, even for smaller sums.

Technically the others nodes you are connected to would see you sending the transaction to them but they wouldn’t know if it is your transaction or someone else’s and you are just relaying it.
There might be a scenario where someone has strategically placed lots and lots of nodes into the network and monitors when certain transactions arrive to each of them and might be able to narrow down where the transaction originally came from to a small set of nodes.
Using TOR would limit this potential deanonymization by obfuscating your IP (which is the identifying piece of info)


text:
Transactions with multiple input UTXOs and multiple output UTXOs
Suppose a transaction t has 5 input UTXOs each worth 1 BTC, each unlocked by a different sending address Ai.
The outputs of that transaction are 10 UTXOs of 0.5BTC each, each locked by a different receiving address Ao.
Is it correct to posit that each of the Ai sent 0.1 BTC to each Ao? (Lets ignore the existence of transaction fee).

I don't think you can make that assumption with any certainty. You can fairly easily invent other explanations that are equally valid (though probably much less likely)
For example, this transaction might be created by a 23292 member club with an annual subscription of 1 BTC that sends prizes of 0.5 BTC to ten winners of their monthly competition. There would be no real-world transaction that links one specific subscriber with two specific prize-winners.
The blockchain certainly doesn't assign inputs to outputs. The only requirement is that the sum of inputs cannot exceed the sum of outputs (and usually the sum of outputs is less than the sum of inputs - the difference being the mining fee)
This may be clearer if you just think of this as a record of a fiat cash transaction. If I hand out $1 banknotes to ten people, the various five people who each gave me a couple of $1 banknotes in change have no involvement in my later transaction. The sources, sizes or sequence of the inputs are not relevant.

Hi, thanks for the input. Your last example isn't really applicable. I'm specifically interested in a single multi-in and multi-out transaction. I'm not asking about a single entity hading out 10 $1 bank notes. I'm asking about 5 people each putting 2 $1 notes in a pot. Then 10 people come along and each take a $1 note out. Is it on the whole fair to say that each of the 5 payers gave each of the 10 payees 20 cents each? Even though we cant split the note. I can update my example to try to make it clearer if it helps.

@SimonO'Hanlon: I don't understand how you can determine how many people are involved. Normally, ten addresses appearing in a transaction might all be controlled by one person, individually by ten people or any permutation in between. Did you have some specific type of transaction in mind? Your question doesn't seem to be specific to Bitcoin. If your record of movements in and out of the pot is simply a journal of amounts and "addresses" you don't know how many people are involved do you?.

Ah, well because, even though a single person might control 10 addresses, I am interested in when those addresses are used on different platforms and looking at flows between platforms. There are examples where someone has sent from multiple different exchange addresses in a single transaction to multiple other exchanges. I would like to estimate the flow between those exchanges.

@SimonO'Hanlon: I believe there is no way to know whether someone intended to send i3  to o2 and o8  or to o1 and o3. They may have intended 1% of i3 to go to o6, 19% to o7, 40% to o2 and 40% to o9 with other imputs making up the balance of each of those outputs. The order of inputs and outputs in the transaction is arbitrary.

Thanks for continuing the conversation. Yes I understand what you mean now. Thank you.

This kind of statement does not hold.
As RedGrittyBrick's answer mentions, bitcoin has no real concept of people, or individual contributions. Multiple inputs in a transaction might be controlled by a single entity, or multiple entities (multisig) may control a single input. There is no real relation between the number of inputs, distinct or otherwise, and the number/weight of a participant in a transaction.
This is further affected by actions such as a coinjoin, where multiple independent transactions may be combined into a single larger transaction, consisting of all the inputs of the smaller ones, and all of their outputs. In fact, coinjoins are performed because people and some tracking systems view transactions as you described, by trying to link inputs and their btc to outputs, and distribute "ownership" and responsibility proportionally to the BTC value of the input. However, as this concept does not directly translate into or accurately represent the nature of the transaction, it cannot be viewed as a "correct" interpretation.
After all, in your example tx, what stops me from saying that each input is responsible for exactly 2 of the outputs, and contributed nothing to the other 8? Or, why not say that inputs 1, 3, and 5 are responsible for outputs 1, 3, 5, 6, 7, 9, and not for 2, 4, 8, and 10? Why distribute their contributions equally to each output?

Thanks also for your input. Reading this and the Bitcoin wiki page on coinjoin it becomes clear. I guess the danger is some authority philosophically decides to treat the outputs in the way I described to err on the side of caution for not accepting "bad" bitcoins.


text:
Bitcoin core node is not starting after -prune is applied in bitcoin.config file
I have a bitcoin core full node version 0.17.1 running on my machine. I want to enable prune on the node to save space on the disk. When I apply -prune=15000 in bitcoin.config file and restart bitcoin core GUI, it shows -txindex is incompatible with prune. So I want to start my node with prune enabled. Is there any way for that?

By pruning the blockchain you:

Reduce storage requirements by enabling pruning (deleting) of old
         blocks. This allows the pruneblockchain RPC to be called to
         delete specific blocks, and enables automatic pruning of old
         blocks if a target size in MiB is provided. This mode is
         incompatible with -txindex and -rescan. Warning: Reverting this
         setting requires re-downloading the entire blockchain. (default:
         0 = disable pruning blocks, 1 = allow manual pruning via RPC,
  =550 = automatically prune block files to stay under the
         specified target size in MiB)

So, -txindex cannot be enabled when the blockchain in pruned

I tried to update property of .exe file like "C:\Program Files\Bitcoin\bitcoin-qt.exe" -prune=150000 -reindex, and started bitcoin core application on windows server 2012. But still I am getting error that Prune mode is incompatible with -txindex.

Hey, I updated my answer. It seems txindex cannot run together with prune. This is the help message from bitcoind

I don't want to run -txindex, what I want is to run Bitcoin core wallet after prune is enabled. So is there any way to start node after we specify prune?

Check your bitcoin.conf file. There is a high likelihood that you have -txindex=1 over there which is why it is popping out the error.


text:
Unconfirmed transaction. Please help
Please help. Probably I set fee too small and now I wait 10 hours so far and transaction is not confirmed yet.
Is there anybody who can help speed it up ?

If you had signed it allowing replace by fee you can update it with a higher fee. Another way if you have a change output you can spend the output with a high fee  (called child pays for parent) last but not least you can wait but that does not speed it up. Also you should consider using the lightning network in the future as it improves speed of payments greatly while reducing. Tx fees.

thank You Sir. The thing is that I did transaction through Bitcoin ATM and there was fee set by default to 4sat /B.

It seems to me that the first sentence would only apply if the OP is the sending party, and the second if they are receiving.

Good answer, but you may want to consider adding it to the question I marked this as duplicate of. "Why isn't my transaction confirming?" is probably one of the most common questions asked on Bitcoin.SE, and it helps reduce clutter and improve usability to properly mark Qs as duplicate, rather than having good replies scattered amongst many duplicate questions.

First confirmation after 12 hours... wow that was fast as hell :)  The big lesson is that you have to put more attention to the fee. Better put higher fee and have good sleep than to little and wait so many hours to confirm.  Good tool to watch: https://jochen-hoenicke.de/queue/#1,2h  you can exactly see when your transaction is going to be confirmed depending on fee. And this one is nice: https://blockchair.com/  -  you can speed up transaction as I did but not sure if it was the case which helped. Only between ruffly 1AM and 6AM low transaction fees have chance to be confirmed. PEACE


text:
What is the best way to differentiate users' balances in a shared wallet?
first time posting around here. I have been thinking about an application that would highly depend on the use of bitcoin for the best user experience. A shared wallet for all users currently seems like the best option since we're talking about users making multiple micro transactions here (not actual transactions in the bitcoin network), with a database always keeping track of who is entitled to what amount of BTC inside the platform. Users would initially have to send BTC to a shared address, thus "funding" their account. But what would be the ideal way to confirm that a user has sent, say, 1 BTC to the shared address and then associating their account with this specific value in my database? I have been thinking about some solutions but would love to hear from all of you. Thanks in advance!

Creating individualized addresses for each user is the best course of action, it is what the vast majority of services do. Using a BIP 32/44/49/84 HD wallet, you can derive individualized deposit addresses for each user, in a way that is easy to manage through your backend.
Making a single deposit address not only makes it difficult to differentiate between user deposits, it is also bad for the privacy of your users, and your service. Why allow every user that learns your deposit address to know how many coins your service has received over time?
If you are storing user funds you should also be diligent with your backend coin management (ie, you should use proper cold storage methods, to reduce the risk of user funds being stolen). This means you’ll need a system of hot/cold wallets to manage not only deposits, but withdrawals as well. So just using one monolithic address will not be sufficient in this sense either, and this is perhaps even further reason to not build a system with just one deposit address.
If you really need to create just one deposit address, then you could have users sign a message using the private key of the address(es) they sent BTC into the wallet from. This would prove ownership of the deposit ina cryptographically secure way. However, the vast majority of user-friendly wallets do not provide a message-signing functionality, so it would significantly hurt UX and usability of your platform to require this. My guess is that many BTC users will likely not have any idea how to sign a message like this in the first place.

Nitpick: BIP39 is the mnemonic encoding, derivation is done by BIP32/44/49/84

@RaghavSood ahh whoops! Lazy mistake, I’ve edited my answer

A workaround on that one would be to follow a method most centralized exchanges have been following. You create a unique BTC public address for each user and maintain their private keys (you could use a HD wallet for generating these addresses.) At regular intervals (say once a day or even more frequent based on the volume of users you have) you transfer the UTXOs from the user to a master account.
With the help of this method you have solved both problems. First, you can track the BTC that is sent by the user (since it would be sent to his unique address). Second, in your internal database, you can just credit the user's account by the appropriate number of BTC once it is sent and then debit/credit it as transactions are received. You need not physically do these transactions on the Bitcoin blockchain, just in your internal database. At the time when the user wants to withdraw the funds, your software can just sign that transaction and allow the user to withdraw the amount that he is owed.
Although, I have mentioned a workaround, it is due to the nature of the question that you asked. This method is not recommended. Controlling funds in a centralized way destroys the very basic fabric for which bitcoin was founded. The current best ways for doing micro payments without sacrificing the necessary decentralizing is through sidechains, using solutions like Lightning Network. You can read more about it here (description is not the basis of the question).

Your workaround is pretty similar to what I've been looking at recently. But this would essentially mean two transactions for every deposit, right? Doesn't seem very efficient, especially when bitcoin tx fees are booming.
And definitely, utilising Lightning Network would be ideal for my application. But I would rather wait for it to mature a bit to get my hands dirty with it; in the meanwhile, I would like to acquire more solid bitcoin core programming experience.

Yes, true you would need two transactions. But when you are transferring BTC associated with user's address to the main address, you could use a lower fee as that transaction would not be time sensitive.

What do you mean it wouldn't be time sensitive?

The second transaction step where you will be consolidating the BTC associated with disparate addresses, is not that time sensitive as the first one.


text:
How can I validate the amounts of these wallets (https://bitinfocharts.com/top-100-richest-bitcoin-addresses.html) on my bitcoin full node?
Followup question: I am running a bitcoin full-node and it took a month to sync the blockchain. I did not create the full-node with a bitcoin wallet. I stumbled upon this 'importaddress' command (https://bitcoincore.org/en/doc/0.16.1/rpc/wallet/importaddress/) and I was wondering if I could somehow run the command without a bitcoin wallet or find a way to attach a bitcoin wallet and rescan the blockchain without having to restart the entire downloading of the blockchain again. Is it possible to attach a wallet without re-downloading the entire blockchain?

A wallet is not related to whether the blockchain has to be downloaded. The blockchain is not stored in a wallet. Rescanning does not redownload the blockchain unless you are using a pruned node.
To use importaddress, you must have a wallet. It cannot work without a wallet file. If you don't have a wallet file for some reason, starting Bitcoin Core normally (i.e. without any wallet disabling options) will have it automatically create a wallet for you. If you have a wallet and just want to import the address into another one, you can create one using the createwallet command. If you have another wallet file, you can move it to the Bitcoin data directory and load the wallet using the loadwallet command.

However loading or creating a wallet is not what you really want to do. You really don't want to import an address into your wallet; you really want to check if that address actually has the amount of Bitcoin that you see listed on a website. To do that, you can just use the scantxoutset command which was introduced in Bitcoin Core 0.17. It does not need a wallet and works way faster than a rescan. See it's help text (by using help scantxoutset) for how to use it.
What scantxoutset does is it scans the UTXO set for any UTXOs that match a given pattern. This will tell you what UTXOs are associated with an address or output script. From there you can sum their values and calculate the total available balance. This will give you the information you want to see without needing a wallet and without scanning the entire blockchain.


text:
Is Bitcoin Cash more secure?
I found in https://www.bitcoincash.org/index.html that this technology is
the world's most robust blockchain but searching for the details that explains why it is so secure I don't find any information. Some one knows a source that probes why this technology is secure and some technical information about the security implemented on it ?

Statements like "the world's most robust blockchain" are meaningless marketing fluff and should be ignored.  But you can certainly read about how the currency works and draw your own conclusions about its security.  The main ideas are the same as for Bitcoin, about which much more has been written.  You can browse questions on this site, for instance.

Bitcoin is secured through proof-of-work mining using SHA256 as the mining algorithm. Bitcoin Cash uses the same algorithm, so the specialized ASIC hardware used to mine one coin, could also be used to mine the other.
PoW coins are susceptible to ‘51% attacks’, which are possible when a bad actor controls a majority of the network’s hashpower.
So generally, when considering ‘how secure’ a blockchain is, we consider how possible, or likely, it is for a single entity (or a group of colluding entities) to gain control of a majority of the hash power available for a coin. The more hashpower a coin has pointed at it, the more secure we can consider it to be. This is because an attacker would need a larger amount of hashpower under their control in order to enact an attack.
From fork.lol, we can see that over the last 7 days, the BTC hashrate has been approx 47.3 exahashes/second, while the BCH hashrate has been approx 1.6 exahashes/second.
By this measure, Bitcoin Cash is most certainly not ‘more secure’.

As Nate mentioned, this is just a marketing statement. Any sane coin would try and promote themselves in this manner. Most are incorrect.
The most basic counter example being that many Bitcoin mining pools have enough hash power to perform a 51% attack on the Bitcoin cash chain. That alone is enough to not qualify it as the "World's most robust" chain.

I disagree with Chytrik: The hashrate and the number of miners are not the only factors that affect security. Here are some other factors:

Frequency of code review of nodes/wallets
Reputation of the companies who create wallet
The number of nodes in the network
Formal verification of software
How well-documented the protocol is (in long term)
Frequency of breaking changes (and other changes)
Code readability and simplicity
Whether software is signed before signed

Which means security is hard to measure.
If you had 1 BTC a year before, and today you open the wallet for the second time and that 1 BTC is still there, miners are not whom to thank.

Good points, I agree with this, but I think that for coins that share a mining algorithm, the proportion of hashrate pointed at each network is still quite important. But in any case, even if security is hard to measure in an absolute sense, I think that BTC outdoes BCH for every point you mentioned. Ergo, BCH is not the ‘most secure blockchain’, as per OP’s question.


text:
I sent bitcoin from electrum but never received it , has been confirmed but I can’t tell what’s happened to the btc. Can anyone help me out?

Should be a picture included if information !

Looks like you downloaded a malware version of Electrum and sent bitcoin using that. The output address in that transaction starts with bc1. I'm guessing that's not the address you intended to send the coins to? The malware replaced the address with its own. There is nothing you can do about it now. If you want to use cryptocurrency on the same system you should do an OS reinstall first in case there were secondary infections from the malware. Sorry for your loss.


text:
Use UTXOs before transaction is signed/broadcasted
Suppose I have an address with a single UTXO. I want to create 100 transactions and sign/broadcast them all at once. Could I do the following:

Create a transaction by hand (where change funds are sent to the sender address)
Calculate the transaction ID
Use the transaction ID and change UTXO output index to create the second transaction
Go to step 2

Until I create 100 transactions? I suppose my question boils down to: Is it possible to calculate the TXID of a raw transaction before it is signed or broadcasted?
Thanks!

It depends.
If your UTXO is a segwit UTXO, then yes. You will have everything that you need to know to calculate the txid before you signed the transaction.
If your UTXO is not a segwit UTXO, then no, you cannot know the txid until you sign the transaction. This is because with spending non-segwit UTXOs, the signature is part of data that is hashed to become the transaction id. So you cannot calculate the transaction id until you know what the signature is.

Signing and broadcasting a transaction is not a single step that happens simultaneously. You can sign a transaction before you broadcast it. So you can make your 100 transactions and sign them as you make them. Once all are made, you can then broadcast the transactions.
Furthermore, if you are sending 100 transactions with one output paying someone, and the other being change back to yourself, why don't just create one transaction with 100 outputs? This is far more efficient and will guarantee that all 100 receivers receive their money at exactly the same time. This will also save you on transaction fees.

Thanks for the reply. I want to generate transactions online and sign offline, so I wanted to group the operations together. Also, I am using Bitcoin transactions indirectly to transfer OMNI tokens, which doesn't have the concept of multiple recipients :(

He wants to have data in the op_return for each recipient therefore he needs to do the thing in a series of transactions, not a single transaction with many recipients (parallel)


text:
Is it possible to sign a transaction (to spend) from a multisig address using only one private key?
Let's assume there's a segwit address created with 3 different private keys.
Is there a chance that exist 1 (just one) other private key (in the universe of valid private keys) that can sign a transaction from that multisig address (that requires 3 keys to spend)?

No, this is not (practically) possible.
A multisig address relies on a small Bitcoin Script program that takes the form of .
The public keys that are allowed to participate in the signing are defined as the time of address creation. Any other key signing a transaction from that address will simply be an invalid transaction.
Althought, as Pieter mentions in the comments, it is technically possible if you are able to create a Bitcoin Script that requires just one key to spend (it could even require no keys to spend), such that the script hashes to the same value that is encoded in the multisig UTXO. However, this kind of preimage attack is also infeasible.

It depends on your set of assumptions. As the question is "is there a chance" - there is, though it relies on a preimage attack against SHA256/RIPEMD160 (you'd need to find a different script with the same hash). Bitcoin's security already assumes this is computationally infeasible - but it's a zero chance

@PieterWuille Good point, I was looking at it purely from the point of view that the Bitcoin Script program would fail, forgot about the preimage attacks. I've updated the answer, thank you!

If the bitcoin is locked with three private keys using a simple script that involves signing by all three private keys (3 of 3), then there is no way to spend it without providing all three private keys for the signature.
However, bitcoin being a programmable money, it allows you to create a locking script that is decided by time. By that I mean, you can include conditions within your script such that, after x amount of days, you need only 2 keys and after y amount of days you need just one key to spend the bitcoin. Thus, within the broad spectrum of your question, yes the bitcoin can be spent by only one private key that generally requires three private keys, only if the necessary condition is justified in the locking script. Below is the locking script that you will follow to meet the above condition.
IF
    IF
        3
    ELSE
        <x days> CHECKSEQUENCEVERIFY DROP
        2
    ENDIF
    <Pub key 1><Pub Key 2><Pub Key 3> 3 CHECKMULTISIG
ELSE
    <y days> CHECKSEQUENCEVERIFY DROP
    1 <Pub key 1><Pub Key 2><Pub Key 3> 3 CHECKMULTISIG
ENDIF

The unlocking script for evaluation of

3 of 3 will be < Sig 1>< Sig 2>< Sig 3> 1 1. The 1 and 1 at the end indicates evaluating both the first and second IF
2 of 3 will be < Sig 1>< Sig 2> 1 0. 1 will trigger the first IF and then the ELSE in the second loop
1 of 3 will be < Sig 1> 0 0. It will trigger the first loop ELSE


text:
Is it possible that two miners mine blocks with different headers because they include different transactions
Ok, it's a yes or no question: miners can include different transactions in a block, so does that mean that they search for different nonces

Yes, different miners will almost certainly always search for different nonces. Besides including different transactions from the network, they will also almost certainly send the proceeds from the coinbase transaction to different accounts. There are many other places where the block can also be different.

In fact at current difficulty the algorithm isn't, as often presented in ancient tutorials, 'search for a nonce that makes an otherwise-fixed block valid' but rather 'search for a block (by varying at least coinbase) for which there exists any nonce that makes it valid'.


text:
Where change the size of the window in Bitcoin code?
I already try changeing the height and width parameters of the forms in src/qt/forms but nothing changes, where else i need to look?


text:
Why must the entire chain be included in calculations if it's already been validated. Why can't the validated portions be archived to save energy?
I'm new to this so don't laugh.  If all of the previous transactions in a blockchain have been validated as authentic, why does the entire chain have to be carried forward in the calculations?  Why can't the validated portions be hashed and archived to save energy costs from handling so much historical data.  When accountants calculate the current years income, they don't go back to when the company started and add up every income and expense item, they just add the current years results to the archived past totals.  What am I missing.

When accountants calculate the current years income, they don't go back to when the company started and add up every income and expense item, they just add the current years results to the archived past totals. What am I missing.

The accountants won't start from the beginning, because they will have already done all of those calculations in previous years. This is similar to the function of a bitcoin node: it will not recompute the whole history to validate each new block, it will just validate each block once, and then store the network state, so that it can validate future blocks against that state.
The bottom line is, if you want to independently validate the history of the network, then you need to start from the beginning. Any other method will involve trusting that someone has supplied you with a legitimate intermediate state for you to begin your calculations from.
Note that a full node validating the chain is different than a miner working on finding new blocks. When people talk about the energy use of the bitcoin network, they are usually referring to the energy consumed by miners, not nodes.

There is no difference between those two things. If you have a data set that includes only things that you have fully validated all of and you confirm that something is in that data set, you have fully validated all of it. So checking that it's in a data set of things you have validated cannot be done instead of validating the entire chain because it does validate the entire chain.
I'm not sure what you mean by "archived to save energy". If they aren't archived, they're stored. If they are archived, they're stored. So I'm not sure how energy would be saved.

Perhaps more a clarification than an answer: there is absolutely no need for validating nodes to keep a copy of the full historical blockchain around, and it's unnecessary to have access to the chain's data for validation. Storing the block data or not is pretty much irrelevant for energy usage.
In Bitcoin Core (a fully-validating node that's often considered a reference implementation), there is a possibility of running in "pruned" mode, where all blocks are downloaded and fully validated, one by one, but deleted from disk afterwards. This is possible because the full block data is actually not necessary for validating future full blocks; only the set of unspent transaction outputs created by that block need to be retained. This is done in a separate database that is only a few GB in size, compared to a few 100 GB for the full blockchain.
The only impact this pruning mode has is not being able to scan for historical transactions (e.g. you can't import an old wallet because it won't be able to find those old transactions), and being unable to provide the historical blockchain to new nodes that are still synchronizing (which they need, even if they'll eventually prune that data away too).


text:
What are the best practices to close and reopen channels in order to increase capacity
I am new in the lightning so I opened a small channel with 50k sats to get started. After some research and try-and-error I would like to increase the capacity of this channel. I know that this is not possible and the only way to do that is to close the channel and open a new one since having a double channel with the same node is not recommended.
In the meanwhile a payment has been routed with this channel, so my local balance is 10k sats and in the remote balance is 30k (10k sats are gone on fees). If I close the channel now I will only get 10k sats minus fees. I will lose more than 80% of my initial amount!
The only thing I can think of is doing a rebalance of the channel so the most of the capacity is on my side and then close the channel. But since it only has 50k sats I cannot do a loop in (minimum 250k sats), or balance of satoshi (minimum 50k sats). Circular rebalance fails all the time. As an alternative I can create an invoice and route it to my self as described here (https://github.com/lightningnetwork/lnd/pull/3736).
But is it ok what I am doing? Is there a cheaper (smarter) way?

Routing a payment will not change your node's balance, it will just change the balance of each specific channel you have open (resulting in a net ~zero change in overall balance). You may have pushed 30k sats to the remote node's balance, but you would have simultaneously had 30k sats pushed to your node's balance in one of your other channels. You haven't lost any of the initial amount, it is just present in a different channel now.
So if you want more capacity, then you should just close that channel, and re-open a new one with the desired liquidity.
To save some money, try to do this while the network isn't busy (ie, the mempool is relatively empty).

Thank you. Very clear and right to the point. I overlooked the fact that the routing payment does not change my node´s overall balance but only the balance of each specific channel.


text:
How do you import an xprv using descriptors and importmulti?
I have figured out how to import an xpub, but when i use getdescriptorinfo on an xprv:
getdescriptorinfo "wpkh(xprvA1Gpa5TRogN9eRoBFZLAEKjfvxzXTZpNpuJ9WXvTsRT3ZoW1EFnrAXji4aYPAktDc5ZYgAcS8XH5npiUdVztxdyrig2rZvNsrTEbhz1x2KQ/*)"

it returns
{
  "descriptor": "wpkh(xpub6EGAyazKe3vSruseMasAbTgQUzq1s2YEC8DkJvL5Rkz2Sbq9mo76iL4Buq1opb9EeNfB2DzqeCuuDMcpx2ZTkcJdnp24Sa8Qo7CgwfbGrD1/*)#2p7j3v7x",
  "isrange": true,
  "issolvable": true,
  "hasprivatekeys": true
}

The descriptor is an xpub? Why? It sees that the key has private keys. If I use this descriptor with importmulti and specify a range will it import the private keys and addresses? I was expecting getdescriptorinfo to return an xprv. If this is not how you import an xprv then how do you?

getdescriptorinfo always returns the non-private key from of the descriptor (security precaution).
From the commands help text:
"descriptor" :  (string) The descriptor in canonical form, without private keys

So the private keys will get automatically imported with the xprv descriptor?

This is incorrect. importprivkey ignores private keys in descriptors; you need to provide them separately in WIF format (for now; this will likely be improved in 0.19).

I removed my missing/wrong comment (could not edit).


text:
Using importmulti to import a single address to keypool does not work
I create a wallet with private keys disabled.
Then use importmulti like so:

command curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "importmulti", "params":[[{ "scriptPubKey": { "address": "bcrt1qeappehxje9d46zjeyvh3cqslzzda9p92nx2xg495e8memcjvppvqhk6hcn" }, "label": "Imported Address", "timestamp": "now", "watchonly": true, "keypool": true, "internal": false }], ''{"rescan": false}''] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18443/wallet/Test
result = Optional({
    error = "<null>";
    id = curltest;
    result =     (
                {
            success = 1;
        }
    );
})

But when I run getnewaddress it says keypool empty:
curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params":["", "bech32"] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:18443/wallet/Test
result = Optional({
    error =     {
        code = "-4";
        message = "Error: This wallet has no available keys";
    };
    id = curltest;
    result = "<null>";
})

This also happens when I use importmulti descriptor approach to import a multisig.
I am trying to create a watch-only wallet for my multisig, where the only key that is in the keypool is the multisig address, just to make building transactions with the wallet seamless.

Currently the keypool is not an address pool. You cannot put addresses in the keypool. You need to be importing public keys in order for anything to be added to the keypool.

Ok, so it is not possible to add a multi-sig address to the keypool then I take it?

No, it is not possible. You currently cannot get any addresses from Bitcoin Core except for the standard single key addresses.


text:
What is the exact input for the hash function?
I've read that it's some variation of: version, previous block hash, merkle root, time, bits, and nonce, but I'm not certain on where to get this data and how it should be formatted. I'd like to know the exact string I can put into something like this and exactly where I can find it. I've followed this video and downloaded his spreadsheet but am uncertain on which part I can copy into the hash function to get the same output as the spreadsheet. Also wondering about how to convert time to the right format. Thanks in advance.

I've read that it's some variation of: version, previous block hash,
  merkle root, time, bits, and nonce

This is exactly right.
Manually verify block hash
(thanks to @exmachinalibertas) on this reddit comment

Grab a block (eg. block 3): Block 3 in json or Block 3 in hex
Concatenate (in this order, little endian, hex format) the version, previous block hash, merkle root, unix epoch time, difficulty target (bits), and nonce. You'll see you can copy the first 160 characters from the Block 3 in hex link. 01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d
Run the terminal command (unix):
$ echo 01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d | xxd -r -p | openssl sha -sha256 | xxd -r -p | openssl sha -sha256
Reverse the output from

4944469562ae1c2c74d9a535e00b6f3e40ffbad4f2fda3895501b58200000000
to
0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449
And there's the block hash!

I'd like to know the exact string I can put into something like this
  and exactly where I can find it

This likely will not work because it looks like it's expecting a string and it will be strange to try and convert the bytes in the block header to ASCII characters.
Note: You will need to install openssl for terminal. Also, the xxd command will convert the hex string to bytes so the hash is not done on the ASCII bytes.


text:
Scrypt CPU miner supporting segregated witness (for Litecoin testnet4)
I am interested in CPU mining on the Litecoin testnet (testnet4); the difficulty level is currently low enough to make this feasible.
The standard Litecoin client no longer supports CPU mining.  The only scrypt CPU miner I'm currently aware of is Pooler's cpuminer.  However, Litecoin testnet4 has gone to segregated witness, which requires miner client support, and cpuminer doesn't support segwit.
Is there any other CPU mining software that supports this?


text:
Is there a block chain bootstrap for Litecoin?
For Bitcoin, various people distribute a bootstrap.dat file which contains a snapshot of the blockchain.  A new Bitcoin user can download this file and verify it with their client, which is often more efficient than downloading the entire chain from the peer-to-peer network.
Does something similar exist for Litecoin?

The site below has good information, including guides for different operating systems:
litecoin.info/Bootstrap.dat

@user24750 I see 2 seeds in the torrent. It works for me.

http://blockchain.litecoin.net
There may be a warning on the site but what you should do is put the blk0001.dat file in the Litecoin data folder (~/.litecoin by default on gnu/linux) then when you run litecoind or litecoin-qt for the first time, include the -reindex option on the command line.


text:
recovering wallet
0
I am not exactly sure what I need to do and I do not want to accidentally overwrite my disk. I may have already done so.
After searching my web history I have found the BTC address that my BTC is on but obviously I can't access my wallet. Before I formatted my hard drives I used easeus disk clone and I cloned it on 2, maybe 3, separate hard drives. But it didn't seem to work properly. I have scanned those drives and found what I believe is the file that holds my wallet but whenever I copy/paste my wallet.dat file, Bitcoin Core does not load up and I am not even sure if that's the right file anyways. I have a lot of money in that wallet and I really need to get it back.

nobody has helped me or even answered in 2 months so I re-posted ...should I not have?

How to recover my wallet questions are asked probably weekly on this site so if the other answers didn't help you, you should explain what you've tried

Please do not repost the same question but rather seek to improve the original question by adding more background information, answering questions for clarification, and telling what you've tried since.


text:
Why is my worker disabled
When looking at my dashboard, it says my worker's state is disabled. I'm using an old S1 (which I know isn't profitable, just playing around) but it is hashing around 176 Gh/s per day.

Dashboard on what service? Regardless, this is an issue with that particular service, you should contact their customer support.

Sorry, this is on Slush Pool.


text:
any faucet that can give even 1 satoshi of BTC immediately?
Is there any faucet that can give even 1 satoshi of BTC immediately without waiting til you have some amount, and without faucethub account?

A faucet could not pay out 1 satoshi, because it falls below the dust limit that is used by the majority of nodes on the network. Further, the fees required to send a transaction would total far more than 1 satoshi, so even if it was possible to confirm such a transaction, it would cost more to do so than the amount transferred.
If you had a lightning network node with the appropriate incoming capacity, you could accept a lightning network payment on 1 satoshi. It is worth mentioning that if the channel were closed with just 1 sat on your side, you would not be able to receive an on-chain tx for this amount, due to the dust limits mentioned above.
Note that service recommendations are off-topic here, so I won't comment on the current availability of such a faucet.


text:
What is the mining pool's transaction choosing algorithm to maximize their reward?
I have read the Bitcoin Core(version 0.19)'s source code, I have read its transaction choosing algorighm, I found that algorithm can not maximize the minging reward，I think the mining pool has its own algorithm，so I want to know which algorighm does the mining pool use to choose transactions from transactioin pool to Maximize mining reward?
Is it knapsack algorithm？ or greedy algorithm？Is there someone can tell me? If you can show the source code, it would be even better. thanks a lot!

What makes you think it cannot maximize the reward?

There are many mining pools, each might be different.


text:
Orphaned block probability ratio
The probability of orphaned blocks should also take into consideration the proportion of the total mining hash power that the miner has.
If M_i and M_j are 2 miners with p_i= 2* p_j (proportion of their relative mining hash power) then in that case what is the ratio of the probability of orphaned blocks o_i and o_j
Under the assumption that mining delays exist and all miners are honest.

Is this a homework question?

lol yup. does that make this unanswerable?

No, but it means you should probably find the answer yourself. If you have specific questions about something you don't understand while trying to answer that, by all means, ask it here. But this isn't the place to give you an answer you can copy-paste.

yup. makes sense. this entire question was tough to comprehend. but anyway thanks for your help.


text:
Error in creating bitcoin raw transaction
I am creating a raw transaction to send amount from from_address to to_address. While sending a transaction I got an error. I posted the detailed process of creating a raw transaction. Could anyone tell me where it was going wrong?
from_address = '2NAvmqmZmodXKDHyWQaRufsFptZ6cDPVaPQ'
to_address = '2MyTfwJFbWYueyFpDjdN8cJ4ZwsSA7UfN8s'

Unspent of from_address
[{'txid': '421ac74f3fb137ea0f65d20e71825abefd463322b4e4a9033057e78e2a27bb69', 'vout': 1, 'address': '2NAvmqmZmodXKDHyWQaRufsFptZ6cDPVaPQ', 'account': '', 'redeemScript': '00140363a5b9ce91754185b3d39d292f262ac3f417c5', 'scriptPubKey': 'a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c687', 'amount': 0.5455, 'confirmations': 108, 'spendable': True, 'solvable': True, 'safe': True}]

creating rawtransaction
bitcoin-cli createrawtransaction [{'txid': '421ac74f3fb137ea0f65d20e71825abefd463322b4e4a9033057e78e2a27bb69', 'vout': 1}] {'2MyTfwJFbWYueyFpDjdN8cJ4ZwsSA7UfN8s' : 0.0495 ,'2NAvmqmZmodXKDHyWQaRufsFptZ6cDPVaPQ' : 0.4955}

signing the transaction
bitcoin-cli signrawtransaction '020000000169bb272a8ee7573003a9e4b4223346fdbe5a82710ed2650fea37b13f4fc71a420100000000ffffffff02f0874b000000000017a9149ca7d200ee0b4e751d1de0c56fd3cf8defde173d87b012f4020000000017a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c68700000000' [{'txid': '421ac74f3fb137ea0f65d20e71825abefd463322b4e4a9033057e78e2a27bb69', 'vout': 1, 'redeemScript': '00140363a5b9ce91754185b3d39d292f262ac3f417c5', 'scriptPubKey': 'a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c687', 'amount': 545500}] ['cR5YAMiTGaAwFgrEHeXK2MpEm8SEBFXm7pf2R2m6SNBx3sRqvPYw']

sendrawtransaction
bitcoin-cli sendrawtransaction '0200000000010169bb272a8ee7573003a9e4b4223346fdbe5a82710ed2650fea37b13f4fc71a4201000000171600140363a5b9ce91754185b3d39d292f262ac3f417c5ffffffff02f0874b000000000017a9149ca7d200ee0b4e751d1de0c56fd3cf8defde173d87b012f4020000000017a914c1f4f356a6c6d28742dd1e80270edd55e6a5b0c68702483045022100ccf694b3439a163ca100743c749ba80e6732d96e2f1dc951ea38c6aba7624cf102203463130bec546cd5cf5d0a18067b51cdd63b879eb34cbecf61b2883ee58021110121034fb6dfc450dd53dcb083cb38ad8ad4d5ad744e3da6c93b579eb19354c3ff2e6600000000'

Error:
raise Exception('Error in RPC call: ' + str(responseJSON['error']))
Exception: Error in RPC call: {'code': -26, 'message': '64: non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)'}

Try signing with full BTC amount (0.5455) not in satoshis

also see Gavin's multisig example here: https://gist.github.com/gavinandresen/3966071

You provided the amount incorrectly. The amount is 0.54551 not 545500. This is important as Segwit inputs include the previous output's amount in the signature. Providing the wrong amount will result in the wrong signature which will then fail validation.


text:
How to decode the block hash?
I got the block hash from zmq.
00000000000000000045c639280aee532c5b12b03c80bfdec7aae674fd8246e0

I want to decode the above block hash. Could anyone tell me how to decode the above block hash?

What do you mean by "decode"?
A hash algorithm is a one-way function.
The hash-function takes some block header information (timestamp, nonce, a hash of all transactions) and returns such a hexadecimal value. There is no way to "decode" such a hash.
Its reason is just to identify a unique block (and deciding wheather someone gets the block reward or not). There are no other information stored in 00000000000000000045c639280aee532c5b12b03c80bfdec7aae674fd8246e0

But if you have the blockchain on your PC or if you enter the block hash at a block explorer, you can get information about that specific block: https://blockchain.info/block-index/1696955/00000000000000000045c639280aee532c5b12b03c80bfdec7aae674fd8246e0

I believe what merklexy wanted to know is how to get information about the block. And the answer is, you cannot get details about the block from its hash. If you have access to the bitcoin command line interface (bitcoin-cli) then you can simply execute
bitcoin-cli getblock 00000000000000000045c639280aee532c5b12b03c80bfdec7aae674fd8246e0


text:
What happens to my transaction if it is not accepted by miners?
Let's say I haven't any fee or I paid a little fee. Miner didn't accept my transaction and still haven't got one confirmation. What will happen to that transaction? Will it rollback or Will it be in an unconfirmed state forever? Please explain.

Nodes will eventually drop transactions if they remain unconfirmed for too long (or if the inputs for a tx are confirmed in an alternate transaction). The time this takes to happen can vary from 3-14 days usually, depending on the nodes' config. Block explorers may cache transactions for longer than that, however, and may continue displaying them long after they have been dropped from the mempool.

And any peers on the network can broadcast the transaction again.


text:
How to sign a transaction using multi signature using bitcoind?
I created a multisignature address using
bitcoin-cli createmultisig 2 '["04A97B658C114D77DC5F71736AB78FBE408CE632ED1478D7EAA106EEF67C55D58A91C6449DE4858FAF11721E85FE09EC850C6578432EB4BE9A69C76232AC593C3B","04019EF04A316792F0ECBE5AB1718C833C3964DEE3626CFABE19D97745DBCAA5198919081B456E8EEEA5898AFA0E36D5C17AB693A80D728721128ED8C5F38CDBA0","04A04F29F308160E6F945B33D943304B1B471ED8F9EACEEB5412C04E60A0FAB0376871D9D1108948B67CAFBC703E565A18F8351FB8558FD7C7482D7027EECD687C"]'
{
    "address" : "38aNB81yPqNp6X2T3rXYZN8Z3C4pSbqEvs",
    "redeemScript" : "524104a97b658c114d77dc5f71736ab78fbe408ce632ed1478d7eaa106eef67c55d58a91c6449de4858faf11721e85fe09ec850c6578432eb4be9a69c76232ac593c3b4104019ef04a316792f0ecbe5ab1718c833c3964dee3626cfabe19d97745dbcaa5198919081b456e8eeea5898afa0e36d5c17ab693a80d728721128ed8c5f38cdba04104a04f29f308160e6f945b33d943304b1b471ed8f9eaceeb5412c04e60a0fab0376871d9d1108948b67cafbc703e565a18f8351fb8558fd7c7482d7027eecd687c53ae"
}

Now my address is : 38aNB81yPqNp6X2T3rXYZN8Z3C4pSbqEvs.
I have to send some coins to another address with my address ( created using multisignature). To create a transaction, I have to sign with atleast 2 private keys. Could anyone explain how to do that?

Generally you would need to show,us a bit more information, so we can see, how far you got, which steps were taken, etc... this would allow to follow the possible issue. (See also help files here, how to create good questions).
I have two references for you, with solutions for multisig signing:
Here it was discussed on bitcoin.SE.
And Gavin explained it here step by step on the testet.
If you have followed the links, let us know how it goes, or where you got stuck, then we can probably help better :-)

I got it when I went through the links which you shared. Is this the same procedure for all cryptocurrencies which runs on bitcoin core like bitcoin cash, litecoin, dash, doge and bitcoin gold?

I cannot say, I never worked with these altcoins...


text:
How to generate an address for bitcoin?
I installed bitcoin core and I am generating an address using getnewaddress. To get the private_key of the address I am using dumpprivkey. To get the unspents I am using listunspent. Till here everything is working perfectly. Now the problem is let's say If I created an address without using bitcoin core then can I get the unspents of the address? I tried using dumpprivkey and it is returning
unspent = host.call('listunspent',0,9999999,['msjK2Az65fzqzUDA6yB6QeNi42ssUAxG93'])

Error:
Exception: Error in RPC call: {'code': -4, 'message': 'Private key for address msjK2Az65fzqzUDA6yB6QeNi42ssUAxG93 is not known'}

I tried listunspent and it is returning empty list. How to get the unspent of the address created without using bitcoin core?

From my experience the bitcoin wallet can only use listunspend with known addresses and keys. One can import keys or addresses, addresses without keys will be watch-only addresses. I am not sure if txindex=1 is required though (with a rescan of the blockchain). See here and for txindex also here.

If I created an address without using bitcoin core then can I get the
  unspents of the address?

No you cant see them using command listunspent

I tried using dumpprivkey and it is returning Error message

This is because your node doesnt identify the address that is not generated by it. It has inbuilt wallet configuration that allow you to  send and recive fund in addresses generated by your full node . As It doesnt  have any info about address created outside your full node  it gives you error message when you call for private key.
 You cant even transfer fund from such addresses as you dont have private key to do so.
You can use bitcoin libraries to generate address, and store their pvt key to sign transaction . Full node has nothing to do in process.


text:
How to generate multiple public addresses using one private key?
I want to generate multiple btc addresses using one private key. I am using pywallet library but each child address also have the private key. Can I use one private key for multiple addresses (if they derived from the same private key) to create a transaction?

In public key cryptography, each private key is associated with a single public key. In Bitcoin, each public key generates a single Bitcoin address. (by hashing it)

Not entirely correct: pubkeys can be derived from privkey in compressed or uncompressed format. This gives two different addresses. OP is asking probably for HD wallets and the extended private keys. As in my other post: Andreas book „Mastering Bitcoin“ has a separate chapter on priv/pubkeys, wallets and extended keys (in a hierarchical deterministic wallet). There you can derive from one private key many other keys, and also addresses.

Thanks, I didn't know about compressed format. I would edit my answer to talk about that, but as we know now the OP wanted to know about HD wallets, maybe it's the case to delete my answer?

You can use extended private key, which is basically other form of expressing mnemonic words. It is string similar to normal private key, but is longer and begins always with "xpriv....". The idea is that you have extended private key and corresponding extended public key. The later enables to generate, say, unlimited amount of addresses and ext-priv-key enables to spend coins sent to that addresses.
If you have just single normal private key, there is no standardized way of generating multiple public keys.

you can't, only a seed can generate multiple keys.

Yeah. Using seed we can generate multiple keys. But all those keys will have same private key or different private keys?

different private keys.


text:
How to estimate the optimal fee for transaction(Segwit addresses)?
I am using Segwit addresses to create transactions. As per my knowledge usage of segwit addresses allows the transactions to process fast with fewer fees as it occupies less space in the block. Could anyone explain how to calculate the fee for transactions using segwit transactions?

Sameer, I added a link to your question. As your question is very generic, that should be it. If your question goes deeper, please show us what you have done so far, and where you got stuck. You can edit your question at any time!

Legacy input size: 148 bytes (compressed)
Legacy output size: 34 bytes (compressed)
Segwit input size: 104 bytes
Segwit output size: 32 bytes

so if your transaction has two inputs and one output total size is ~ 246 Bytes, Don't forget about some more additional bytes for transaction header.


text:
Can we predict about bitcoin network?
What will happen to the bitcoin network once all 21M of bitcoins have been mined? The bitcoin network will cease to exist? or the bitcoin network will continue to function the same way with miners being compensated with transaction fees when users spent their bitcoins?

I think you answered your own question.   Why would you think the network would cease to exist?

I don't think anyone can predict anything, especially that it's estimated to happen somewhere in 2140 ;)
But I'll share my take on it.
Please note that the number of BTC rewarded will he halved few times until then: https://docs.google.com/spreadsheets/u/1/d/12tR_9WrY0Hj4AQLoJYj9EDBzfA38XIVLQSOOOVePNm0/pubhtml?gid=0&single=true
So the proportion of BTC reward to transaction fees will be less and less - and the network will adjust.
Also - what is important - that this is self-regulating. If the reward was to disappear, some miners would leave the network (because of the cost bigger than transaction fees earnings). But then the difficulty would decrease, and mining cost to profit should more or less equalize.
So, unless bitcoin network is abandoned for some other reason*, the disappearing of block reward should not have a significant effect on the network itself.
BTC is like every other money - if people believe it's money, then it's money. Same with Bitcoin - doesn't matter if mining has any extra bonus or not.
(*) the biggest challenge to bitcoin seems to be the block size, which limits the network throughput. If you wanna read more thoughts on that - check my other answer here https://ethereum.stackexchange.com/questions/39477/why-is-there-a-possibility-to-increase-block-gas-limit/39479#39479


text:
hello, need some help
Who is responsible for ensuring that the bitcoin protocol is not violated in the network?
    1. The market forces behind the supply and demand of bitcoin
    2. Miners
    3. Consensus of the miners
    4. Developers of the bitcoin protocol

Welcome to Bitcoin.SE! Please do not duplicate your question. I have copied the expanded detail of this question as an edit to your existing one.

There is no single entity responsible for ensuring the rules of the protocol are not violated. Rather, bitcoin is a decentralized network, so all participants must adhere to the protocol’s rules, or else the network will ignore them.
This is accomplished by a network of full nodes, that relay and validate all transactions and blocks against the network’s rules. All of the nodes together form the decentralized network, so to join the network you must adhere to the rules defined by the node’s code.

The market forces behind the supply and demand of bitcoin

This will determine the price, but the price will not affect the ability of participants to violate the networ’s rules, nor will it ensure that rules are not violated. The rules must be followed whether the price is $1 per bitcoin, or $1 million per bitcoin.

Miners

Miners work to secure the blockchain record, they will validate transactions in the same way other (non-mining) full nodes do, and they will ensure only valid transactions are added to the blockchain.

Consensus of the miners

Same as above. Note that even if a group of miners decided to violate the network’s rules, then the network (full nodes) would simply ignore any new (invalid) blocks found by those miners.

Developers of the bitcoin protocol

The developers collaboratively write and refine the code that runs the network, but this does not give them absolute powers to violate or change the rules. Their code works to ensure that everyone involved in the network is behaving, and that any misbehaving nodes are banned.


text:
Which binaries are required to run a headless node?
There are plenty of guides on installing Bitcoin Core on Linux, and the most popular advice is to do this:
install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.21.1/bin/*

Here is an unarchived file tree:
.
├── SHA256SUMS.asc
├── bitcoin-0.21.1
│   ├── README.md
│   ├── bin
│   │   ├── bitcoin-cli
│   │   ├── bitcoin-qt
│   │   ├── bitcoin-tx
│   │   ├── bitcoin-wallet
│   │   ├── bitcoind
│   │   └── test_bitcoin
│   ├── include
│   │   └── bitcoinconsensus.h
│   ├── lib
│   │   ├── libbitcoinconsensus.so -> libbitcoinconsensus.so.0.0.0
│   │   ├── libbitcoinconsensus.so.0 -> libbitcoinconsensus.so.0.0.0
│   │   └── libbitcoinconsensus.so.0.0.0
│   └── share
│       └── man
│           └── man1
│               ├── bitcoin-cli.1
│               ├── bitcoin-qt.1
│               ├── bitcoin-tx.1
│               ├── bitcoin-wallet.1
│               └── bitcoind.1
├── bitcoin-0.21.1-x86_64-linux-gnu.tar.gz
└── laanwj-releases.asc

So it looks like this command copies six binary files and it doesn't install man pages. Is it necessary to copy all of those binaries to run a headless node without any issues? I've been using bitcoind and bitcoin-cli directly so I'm pretty sure they're required, but I didn't find any info on the rest of the binaries.

TL;DR: you don't need any binaries except the ones you want to invoke.
Let me go over your list:

SHA256SUMS.asc: a PGP signed SHA256SUMS file with the SHA256 checksums of all distributed files. The purpose of this is purely to let you verify you have legitimate binaries.
bitcoin-0.21.1/README.md: README file with general documentation
bitcoin-0.21.1/bin/bitcoin-cli: command line tool send commands to a runningbitcoind or bitcoin-qt -server instance.
bitcoin-0.21.1/bin/bitcoin-qt: the Bitcoin Core server binary, with Qt GUI included.
bitcoin-0.21.1/bin/bitcoin-tx: a standalone tool to create/manipulate/sign raw transactions.
bitcoin-0.21.1/bin/bitcoin-wallet: a standalone tool to perform operations on Bitcoin Core wallet.dat files, while they are not currently loaded into a bitcoind or bitcoin-qt instance.
bitcoin-0.21.1/bin/bitcoind: the Bitcoin Core server binary, without GUI included.
bitcoin-0.21.1/bin/test_bitcoin: the binary that implements all of Bitcoin Core's unit tests. It has been verified to pass all tests when this build of Bitcoin Core was created, but you're of course free to run it on your own system too.
bitcoin-0.21.1/include/bitcoinconsensus.h: C header file for those who want to build software using the libbitcoinconsensus.so library.
bitcoin-0.21.1/lib/libbitcoinconsensus.so*: shared library that you can link your own software against. It implements the exact same script validation rules as Bitcoin Core does, so avoids the need to reimplement consensus logic yourself.
bitcoin-0.21.1/man/man1/*: man pages
bitcoin-0.21.1-x86_64-linux-gnu.tar.gz: distribution tarball
laanwj-releases.asc: PGP key used to sign releases


text:
Is there evidence for lack of stale blocks?
There was a recently published academic paper "Bitcoin’s limited adoption problem" which used a statistic that the network latency is around 15 seconds.
Obviously, this is not true: One can provide a quick argument with Poisson distributions and Jensen's inequality that this means we should be seeing over 1000 stale blocks per year with probability near 1.
I'd like to refute this claim empirically, but have no good source for claiming that the number of stale blocks is small.  I can only see the blocks that hit my node and go stale, but I'm assuming that not every stale blocks makes it to my node.
Any better sources of data?

The average block propagation time actually used to be more than 15 seconds before 2016, see the "Block Propagation Delay History" Graph at the KIT statistics website.
However, block latency was reduced drastically with the implementation of BIP152 (compact blocks) and, according to above source, is currently close to ~1 second for 90% network penetration.
As a result of this, stale blocks are much rarer, especially considering that nodes run by miners are likely to be well-connected to the network and would hear about new blocks faster than the average node.
I don't know of a comprehensive collection of stale blocks though - see this stackoverflow answer by G. Maxwell why it would be hard to assemble this kind of data.
If that was an important part of their model, this paper may have analyzed a theoretical/historical version of bitcoin that has little resemblance with reality.


text:
Programmatically determining a full node in a peer-to-peer network
So I've found relatively few resources explaining the intricacies of the Bitcoin P2P network internal functionality. Right now, I'm writing a similar sort of peer-to-peer network, in another language however, but based on the same principles. I've gotten a pretty resillient P2P network implemented, however, obviously once I ran it on a server, and tried to connect locally, I ran into the problem of my peer being behind a NAT. I sketched out this diagram:

So essentially the 'full nodes' (green) are the ones that have portforwarding on, and will help contribute to gossiping data around the network, and the private nodes (red) are the nodes that need the network state (i.e. still needs to listen into broadcast tx's etc.) but is behind a NAT (i.e. they can only do outbound connections to full nodes, and never to each other). So my question is: What is a good way to determine if a node is a 'private node' (behind a NAT) or a 'full node' (ports open, can accept any connection). The reason why I want to determine this, is so that private peers do not become part of the 'peer-exchange' protocol (so nodes don't get a bunch of peers that they can't connect to).
My gut-solution to this problem is simply to attempt to open a new socket connection to peers connecting to me and see if they refuse the connection the other way around (where they have an inbound connection from me), if they do, we can be fairly certain that is a private node behind a NAT, however this feels hacky, and I'm wondering how bitcoin tackles this issue of private nodes (nodes behind a NAT) and full nodes (nodes that help strengthen the network).
TL;DR: How does Bitcoin avoid NAT-guarded nodes are added to peoples peer list?

Just a note on terminology: usually the term "full node" refers to nodes that fully validate (sometimes also to whether they have the full blockchain), but this is independent of whether they are reachable from the public internet.

@PieterWuille That's what I initially thought as well, but looking at this it specifically mentions "[...] validating those transactions and blocks, and then relaying them to further full nodes". From the discussion I've seen around full nodes they're described as the one 'helping strengthen the network', so I assume it is the correct terminology for the nodes that publicly reachable.

Non-public full nodes also relay transactions and blocks to their peers.

@PieterWuille Makes sense. Thanks for clearing it up. :)


text:
Can the government find out my name, address, details etc if I invest in crypto?
The data of the transactions are all stored in a blockchain right. So, will anyone trying to trace me find out my name, address etc if I buy cryptocurrencies? Sorry I am a complete noobie to this concept!

Potentially related: https://bitcoin.stackexchange.com/q/103243/63872


text:
Bitcoin Base 58 wif format Private Key recovery Front 5 character are missing
I lost my private key front 5 character can i gain back my private key my address is 1PfNh5fRcE9JKDmicD2Rh3pexGwce1LqyU  i didn't have any backup. If any one help me to get my private key back i will give you good Reward.

Check out my repo https://github.com/salian/btc-incomplete-key
Recovering 5 characters is doable.

A private key in WIF format has a checksum of 4 bytes, and with that checksum you can check every possible key for a valid checksum.
I made a program do recover missing characters in a private key. Please note it is not fast because it is written in js, but it works and should be sufficient for 5 missing character.
https://github.com/antonilol/btc_stuff/blob/master/priv_key_recovery.js
with 6 or more chracters there can be multiple possible private keys. If that's the case you can remove process.exit(0); on line 22 (it exits the program after finding a key)

if you really have the rest of the Private key, yes it is possible to recover it, there are many software out there that can help you.
Google something like "recover missing characters in Private key", then look for a result on Github links, read the instructions of that software, turn your internet off when using it, and be really really careful.


text:
Difference between block hash and transaction hash in bitcoin-core
Is there a logic based on which one can determine if a given 32-bit hash corresponds to a transaction or a block without enquiring a bitcoin-client?
In other words, how do I differentiate or validate a given 32-bit hash as a transaction or block identifier?
I understand, that a valid block hash is restricted by the difficulty limits (that offer lower and upper bounds). Is there something similar to validate a transaction hash?
Reference: How is difficulty stored in blocks?

This is not possible, both are sha256 hashes, and contain no markers as to their origin.

I was expected the same but wanted an expert opinion on this. Thanks for answering.

There is no explicit marker that identifies a hash as being related to a transaction/block, but as mentioned by OP, there is an implicit assumption that can be made, due to the difficulty target for blocks that is imposed by the network’s nodes.
Pragmatically, this means that a hash with an improbably low value could be assumed to be a potential block hash. Note that whether or not this represents a valid block cannot be known from the hash alone. While it is possible for a transaction hash to have an equivalently low value, this is incredibly unlikely (assuming someone isn’t grinding through transaction hashes to find a value below the difficulty target, but doing so would be extremely expensive, for no real gain).
Conversely, a hash of any arbitrary value is likely not a valid block hash, as it would fail to satisfy the network’s difficulty requirement.
All of that said, in order to determine if the hash in question is actually related to a valid block/transaction, you will need knowledge of the current network state (ie, you will need to verify it using some sort of bitcoin fullnode).
TL;DR:

An improbably low hash value may be representative of a block, or a transaction (though highly improbable). A full node is required to verify the validity of this hash, in any case.
An arbitrary hash value may be representative of a transaction, but again a full node is required to verify the validity of this hash.


text:
What would be the consequence of a constant network difficulty?
Say the difficulty of the bitcoin network was not variable. Then regardless of the network hash-rate, the mining puzzle will be the same. What would that mean in terms of the security and economics of the bitcoin network?
If everything else remains equal, then I'm assuming that mining a block becomes easier and easier and we will have mined all 21 million bitcoins much sooner. Besides this, will anything change security wise? And if so, can anything be done to maintain the decentralised consensus and fiscal policy of the network with a constant difficulty? For example, the block reward payed to the miner becomes inversely proportional to the number of parent blocks.

You would eventually be up against network propagation speed, since miners would get powerful enough to mine faster that the blocks can propagate across the network. The nodes with the lowest latency between each other would always be ahead with the longest chain, penalizing those with higher latency.
You're correct that the 21 million will be reached much sooner.
You can observe this on the testnet when the block times are high enough, after it resets to the initial difficulty and blocks come flying in multiple times a second (basically as fast as the network can handle it). For more info see Testnet difficulty change

The bit about testnet isn’t really correct, there’s a badly designed rule that allows difficulty 1 blocks after a period.

Aren't nodes already penalised for latency as high latency nodes can only start mining from the current head after they've learnt about the latest transactions?

@Satoshi That's true, but the penalty would be much larger when the block time is ~0

@Anonymous isn't it only if the block times are too long, though? https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp#L23

The difficulty resets to 1 on testnet if it has been more than 20 minutes since the last block. If gamed correctly, the difficulty can be set to 1 for an entire difficulty adjustment period and effectively constantly kept at 1.

@AndrewChow by adjusting the timestamps?

The blocks would come faster and faster. After a while (assuming there are enough computers and the price is high enough) the blocks would not be mined properly because their timestamps would be too close. This, however, would not happen if the mining power stayed constant as well and in that case, everything would happen as normal.