text:
Exchanges and security
How can I ensure that my crypto-assets are secure when trading in a certain exchange? Even when I have my private wallet, I should deposit into theirs before trading.

That is the risk you take when giving someone else control of the private keys to spend your coins. When you transfer them to an address in custody of a centralized exchange, that means they have the corresponding private keys to spend it. You need to do your own research and determine if the exchange has good security measures to protect from breaches.
Many decentralized exchanges let you retain control of the private keys, but you also have to do your research on the software implementation to make sure it's design is secure with your keys.

How can I ensure that my crypto-assets are secure when trading in a certain exchange?

You cannot.
You must trust that organisation with your crypto-assets.
That means

trusting all the owners, all the staff, all the people allowed access to their premises (cleaners, maintenance engineers) and
trusting the diligence and integrity of the developers of all the software used in that organisation. Including software developed elsewhere.
trusting the diligence and integrity of the people who manage the internal
computer networks and firewalls in order to prevent intrusion by outsiders and fraud by insiders.

You should carefully consider the history of exchanges such as MtGox and evaluate how you would have known not to trust them.
Since you cannot ensure the security of your assets, held for you by the exchange, you must take great care in investigating the ownership, trading history, legal jursidiction and reputation of the exchange. You should also not give them control over more money than you can easily afford to lose without hardship.

Agree. You can’t trade until you trust and you can’t trust until you know. However, I think that it’s impossible to find a universal way of deciding if a platform is trustworthy or not. For example, each time I need to make such a decision, I’m spending plenty of time on research. I’m very careful when it comes to money and I really don’t want to lose any of my investments. Sure, cryptocurrency is almost a synonym for risk, but it doesn’t mean that we should tolerate scams without any attempt to avoid them.

Your answer would be better if you explained what your research involves.  For example, my own usually includes trying to identify the main people responsible for a new website that I'm considering trusting.

This question is not as simple as it may seem. Actually, the answer lies way deeper then it seems to be. To understand how to be sure that your assets are safe on this or another exchange, you need to find out which security means are offered by chosen trading platform. Sure thing, you need to deposit a certain amount of crypto there before trading. No one can trade straight from hardware or paper wallet :) But if you trust chosen platform enough to trade there, why don’t to deposit your coins to their storage either.

It doesn't seem like you're offering the person who asked the question much in the way of an answer.  You almost gave something simple (and good, in my opinion) but you didn't actually say it explicitly: "Just deposit a little and take that little risk and see how it goes."  If you're answer is that simple, it would be better as just a comment.


text:
is it available to pay for my multiple inputs at one time?
I have a Bitcoin wallet and there is a large number of spendable addresses.
if i make a transaction and there is a multiple inputs which is belonged to me(my wallet),  is it possible to pay a fee by the single address? (Is it possible to pay fees for my other bitcoin addresses?)

Within a bitcoin transaction, there is no specification for 'which address (input) is paying the fee'.
The fee is simply calculated by subtracting the sum of all outputs, from the sum of all inputs. The inputs are consumed entirely, and the newly formed UTXOs specify the exact amount paying each address. Whatever is left over is the fee that miners can claim.

source: Stack Exchange

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

sort: votes


text:
relationship between inputs in single transaction

I'm a student to learn about bitcoin.
i saw a lot of transactions from Blockchain.info for study, and some of transactions can not be understood.
why address '367f4YW...' pay to itself?
is it available to guess a relationship between '367f4YW...' and '15ozxv...'?

Why address '367f4YW...' pay to itself?

While reusing addresses is not recommended for various reasons (privacy, security, etc), there is nothing stopping someone from doing so. If you'd like to send the change of a transaction to the same address you used an input from, you can do so.

is it available to guess a relationship between '367f4YW...' and '15ozxv...'?

In many cases, if there are multiple inputs, you could assume that they are all controlled by the same wallet.
However, that is not always true. For example, P2EP transactions are looking to break this assumption, so that it is harder to guess at the nature of each blockchain transaction (ownership of inputs, outputs, etc).
For bitcoin to work best, fungibility is important. Making transaction inputs/outputs harder to decode is an important part of maintaining fungibility!

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


text:
How to verify if money was sent
My friend was supposed to send me $800 last night. He says he sent itAs that make up ever see this as he sucked bitcoin but it doesn’t show where it was sent. And my account which is new and doesn’t show anything in it. It’s just someone I can speak with to verify whether this occurred or not?

Hi @Rob martin, what wallet software are you using?

If you have an address or transaction id, you can look that up on a block explorer like blockchain.info. Also, you may have to wait for several confirmations (depending on your wallet) before your wallet software will count it towards your balance (each confirmation takes about 10 minutes on average).


text:
GetRawTransaction not returning time
I am trying to write a quick blockchain explorer so that I can lookup transactions on my own server rather than using a 3rd party service - consider this an exercise more than a production service.
I have a bitcoind server running with txindex = 1 and all is well, I can lookup transaction with getrawtransaction. But unconfirmed transactions do not have block data, and most importantly the time field.
However many 3rd party lookup services like blockchain, tradeblock, etc return a timestamp for the transaction even when not confirmed. So I have tried to use the walletnotify command to record the time the transaction is seen but it's not getting called - probably due to the fact I have disablewallet=1 or because these transactions do not relate to my server.
So my next step is to continuously check the transactions in the current block and record the timestamp that way - suffice to say this is not the best approach but I am really struggling to think of another way.
Perhaps someone has a better approach?

getrawtransaction does not return the time, because it only gives you the raw transaction itself, which does not include a timestamp.
However, you can use the getmempoolentry RPC to get mempool metadata about a transaction, which includes the time at which time it entered the mempool.

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


text:
sendrawtransaction on a non-synced node
This question is related to this post explaining how to use bitcoin-qt to generate a transaction.
Once obtained, I'd like to dispatch it from my system which is running a non-synced node. When issuing sendrawtransaction the following happens:
./bitcoin-cli sendrawtransaction
error code: -26
error message:
non-final

I have two questions related to this

Am I right that this is caused by the fact that my node is not synced?
Is there a way to dispatch the transaction to the BTC  network anyway?

Am I right that this is caused by the fact that my node is not synced?

It certainly could be. The transaction could have a locktime that is in the past in reality, but is in the future from the perspective of the unsynced node.

Is there a way to dispatch the transaction to the BTC network anyway?

Use a node that is synchronized. It doesn't need to be your own; you won't have RPC access to other nodes, but you can use a tool like bitcoin-submittx, or websites like block explorers that permit submitting transactions (possibly though Tor).


text:
Practical tips for validating raw transactions
I have a protocol that creates a raw signed transaction that is then broadcast to the network. The transaction aims to send X BTC to a single address Z. The transaction is created with the help of bitcoin core.
In the past I've seen a few instances where people got themselves in trouble by creating unexpected transactions, for example by paying 90% of the UTXO's value as a mining fee or the like.
Therefore I was wondering if someone could advise on procedures/tips for the following

Given a raw transaction T sending X BTC to address Z, how to validate the transaction accomplishes this gracefully?

The idea is that before the broadcast one issues an additional decoderawtransaction and checks that everything is as intended. I would like to hear tips on what one should check for at this point.
I understand the question itself is a bit vague but I'd like to hear any kind of feedback on what to look for in the output of decoderawtransaction that might be telling something is either not right, or validate that

The transaction is sending X BTC to Z,
What the exact expenditure (X+fees) is,
That the change is sent to the right (i.e under the wallet's control) address.

A very useful RPC is the testmempoolaccept RPC. This will tell you whether the transaction would be accepted by the node. You can use this to determine whether the transaction is correctly signed. It will also tell you what the transaction fee is so you can determine whether the fee is what you expect it to be. If the transaction would not be accepted, it will also tell you what went wrong.
To ensure that the transaction is logically correct (i.e. money is being sent to the right place), you can use decoderawtransaction and examine the contents of the vout array. Each output is in that array and the value for the output and the address, if any, will be listed. So you can scan that array and make sure that the intended recipients are there with the correct values.
It is harder to determine change, but if you know what the change address is and what the change value should be, then you can check it as if it were another recipient as described earlier.

One caveat about testmempoolaccept: it only works if the parent transactions are confirmed or in the mempool. The test it runs is on the mempool state at the time of the call, so it behaves as if you had done sendrawtransaction at that moment, except the part where the transaction is actually sent and added to the mempool.


text:
Manually create a transaction to spend the output of a P2SH tx
I want to manually create a transaction to spend the output of a P2SH tx, but I don't know where the redeem script should be placed in the new transaction?  I followed an online tutorial Building a Transaction By Hand
In order to sign the transaction, you need to build this tx message as the picture shows. But when there is a redeem script, where should i put this redeem script?

The redeem script is part of the scriptSig for the input you are trying to spend. Here is the format for a P2SH transaction:
scriptPubKey: OP_HASH160 <scriptHash> OP_EQUAL
scriptSig: ..signatures... <serialized script>

The script is hashed and compared with the script hash in the scriptPubKey.


text:
Access funds on legacy address related to segwit address from which I have private key
The situation
Hello. Our company running BTC pool. We've been mining BTC for a while and used segwit address 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM as pool adress.
But when we finally found a first block (actually - two blocks) for some reason block reward got sent to different address:1s2iywx94HudryMHsU2g1K9x8DB1cahGc
Here are links for both generation transactions with rewards: the first and
 the second
The problem
We cannot get access to funds on 1s2iywx94HudryMHsU2g1K9x8DB1cahGc - we simple can't see that balance on the wallet.
The question
How can we access those funds on 1s2iywx94HudryMHsU2g1K9x8DB1cahGc?
More info
Using Bitcoin Core client command validateaddress we can inspect both addresses:
Output for 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM is
{
  "isvalid": true,
  "address": "32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM",
  "scriptPubKey": "a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3887",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "iswitness": false,
  "script": "witness_v0_keyhash",
  "hex": "00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0",
  "pubkey": "02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df",
  "embedded": {
    "isscript": false,
    "iswitness": true,
    "witness_version": 0,
    "witness_program": "2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0",
    "pubkey": "02835613e6e22843ce7dafc5d22a2763a8428b81f3d44dced0fd860f08be7a29df",
    "address": "bc1q9mn8mpuueuta4my8knk55m8vmkdn7e9qmezkgv",
    "scriptPubKey": "00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0"
  },
  "addresses": [
    "bc1q9mn8mpuueuta4my8knk55m8vmkdn7e9qmezkgv"
  ],
  "account": "",
  "timestamp": 1533473707,
  "hdkeypath": "m/0'/0'/0'",
  "hdmasterkeyid": "35e9670da1b28efe5621eb9cee2cf3e88b929968"
}

Output for 1s2iywx94HudryMHsU2g1K9x8DB1cahGc is
{
"isvalid": true,
"address": "1s2iywx94HudryMHsU2g1K9x8DB1cahGc",
"scriptPubKey": "76a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3888ac",
"ismine": false,
"iswatchonly": false,
"isscript": false,
"iswitness": false
}

I can see three interesting points here:

scriptPubKey for both addresses contains 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 part, which is, afaik, actuall public key. First byte differs, which makes sense, since it's prefix, 00 for legacy and 05 for segwit respectively.

regarding output for 1s2iywx94HudryMHsU2g1K9x8DB1cahGc :

pubkey property is missing, which is weird, because usually its included for legacy addresses
isMine property equals false, wich means that wallet does not recognize this address relation to wallet PK.

So, can anyone please provide some insight and tell us if (and how?) we can access those funds, or we've lost them for good?
P.S.
When I use base58 decode on both 32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM and 1s2iywx94HudryMHsU2g1K9x8DB1cahGc I get
0509763CB05DCEA0F98F53B0F08651F92C5D2D2F385CCEC0F4 and
0009763CB05DCEA0F98F53B0F08651F92C5D2D2F3861372301 respectively.
Again, you can clearly see same bytes, so addresses are definitely related.

I'm afraid you have a bug in your mining software, and your coins are gone.
Instead of sending to the P2SH address, a block was created with a P2PKH output script, reinterpreting the script hash from the P2SH address as a public key hash. This happens somewhere in broken software that doesn't support P2SH and additionally also fails to check the address version byte.
If this is the case, it is unrecoverable and those coins are lost forever. You can't find a public key whose hash matches that script.


text:
Does all miners in mining pool increase the nonce variable one by one starting from zero?
Let us consider we have n miners in our mining pool. Now the manager of the pool verified the transactions and packed into a block to be mined. Then it passed the block to all n miners in the pool.
Lets assume that out block is as below:
    to_mine_block = {
    Block No: 1000
    Prev Block:999
    timestamp: "1000-01-01 00:00:00"
    Data : "XYZ"
    nonce : ?
}

Now,to_mine_block is sent to all n miners. Will n miners runs the following code to
String target = new String(new char[difficulty]).replace('\0', '0');

while(!hash.substring( 0, difficulty).equals(target)) {
    nonce ++;
    hash = calculateHash();
}

Will all n miners run this code individually in the pool ? If so, this race will always be wined by the miners with the highest mining power. Because the one with highest mining power will move ahead in the loop than the ones with low hash power.

This is not how mining typically works in a pool. Mining software typically assigns a different extranonce to each miner, which is part of the coinbase transaction, and will result in a different merkle root (and different block header. Then they can all start on nonce 0 as you suggest, but they will not be racing each other for the same block because they are different. See https://bitcointalk.org/index.php?topic=9438.msg136344#msg136344.
Also, just for clarification, the data that is hashing during mining is the block header, which consists of:

Version
hashPrevBlock
hashMerkleRoot
Time
Bits
Nonce

See https://en.bitcoin.it/wiki/Block_hashing_algorithm


text:
Can hardware wallets actually display the amount of funds leaving your control?
It would seem the answer is no, because the hardware wallet is not a full node and cannot know the total value represented by the input transactions. It must trust the host software for this. Am I correct, or did I miss something?
Basically, the concern is that a malicious host software could trick the user+wallet into signing a transaction that has a low amount of output value but a high total amount of input value. This would convert the user's Bitcoins into a miner reward. Though admittedly the motivation behind such an attack would be low because the attacker can't profit from it.

That is correct, a hardware wallet does not have access to any information from the blockchain except that provided by the host computer. So it does not know anything about the amounts unless the host provides it to them.
Because of this, hardware wallets have some extra requirements for signing. Many devices, for non-segwit inputs, require the entire previous transaction to be sent to the device. This way they can compute its txid and compare that to the txid specified for that input. In this way they can be sure of the amounts being sent as they can look at the output amount(s) in the previous transaction.
However Segwit actually fixes this issue for them. In Segwit, the amount for the input being signed is part of the data that is signed. So it directly commits to the amount being sent and therefore the host cannot lie about that amount or it will receive an invalid signature.


text:
how EC Public key is generated from the private key effectively
if my private key is 123456789123456789, doesn't that mean I have to dot G point that many times to generate my pubkey? there must be a shortcut to generate pubkey, otherwise the time complicity of generating the pubkey is the same compare to brutal force from trying from 1 to k? Am I missing anything here?

according to the article here: https://arstechnica.com/information-technology/2013/10/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
it looks like generating pubkey from a random generated private key(which could be a 32 bytes BigInteger) requires to dot many times = integer value of the private key. which is impossible considering the key size for the private key is 2^256(32 bytes key space).

This sounds exactly like what someone with a private key of 123436789123456789 would say...

There are a number of more efficient algorithms to compute the multiplication than just the naive method described. A simple one is double-and-add where the point is repeatedly doubled and then added with previous doublings in order to calculate the final public key. There are a number of more complicated methods which are more efficient.
You can read about these on Wikipedia.

that's exactly what I was hoping for. thank you.


text:
RPC get free address
Always when i need free address (not labled) i use:
getAccountAddress('')

And i want to know: Can it give me an already occupied address (by label)
I'm worried that I can get an already address in using (by label)

Why not just use getnewaddress?  The whole account / label system is deprecated and shouldn't be used in new code.

If you provide an empty string it will return the default account every time. Note getaccountaddress is deprecated, see https://bitcoincore.org/en/doc/0.16.2/rpc/wallet/getaccountaddress/.
getaccountaddress "account"

DEPRECATED. Returns the current Bitcoin address for receiving payments to this account.

Arguments:
1. "account"       (string, required) The account name for the address. It can also
be set to the empty string "" to represent the default account. The account does not
need to exist, it will be created and a new address created  if there is no account
by the given name.


text:
Bitcoin rawtransaction fee
Create a raw transaction createrawtransaction (transactions, vouts, amount and where to send)
then specify the commission for the miners fundrawtransaction feeRate But when I start checking or signing and sending, the commission becomes bigger .... What is it connected with?
p.s sorry for my english :)

The transaction fee calculated for the transaction by fundrawtransaction cannot actually predict the transaction's final size. This is because signatures are not fixed in length and can be smaller than what is predicted. However, in order to be sure enough fee is paid, fundrawtransaction will always assume the maximum signature size. This means that sometimes the signature will end up being smaller which means that you end up overpaying a little bit in fees. The feerate will be higher because the fee has stayed the same but the size of the transaction is smaller than predicted.

Thank you for answer. I understand this is not the good way to set a fee?

That depends, what "good" means for you. I acknowledge, it may not be the optimal way to define fees, in the sense that one can minimize/maximize fees ...


text:
Transfer between different e wallet
Can we transfer cyptocurrency to anyone so long they  hold an e-wallet, even in different part of the world?

Maybe you want to be a bit more specific in your question... Short answer is yes. You have a bitcoin wallet in Africa, I have one in Asia, and we are both connected to the internet - then we can transfer funds.

Yes, so long as both parties have wallets that support the same specific cryptocurrency - e.g. both support Bitcoin (BTC).
The two parties do not have to use the same wallet software. For example, one might use a bitcoin-core wallet and the other might use an Electrum wallet. It doesn't matter.
Physical location is irrelevant - though local laws may affect parties to the transaction.
Remember that cryptocurrency transfers are usually irrevocable - you cannot cancel or reverse the treansaction if you change your mind or discover that the recipient is a liar, cheat or fraudster.


text:
If SPV clients didn't exist, would Bitcoin still use Merkle trees?
I understand how full nodes use Merkle proofs to convince SPV clients that certain transactions are valid / invalid.
Does the Bitcoin software use Merkle trees in any other way?

The merkle root is included in the block header as a cryptographic commitment of the transactions that were included in that block. Without such a commitment, the POW for the block would be computed independent of the transactions included in the block. Transaction ordering is important, so a cryptographic proof/commitment needs to be included in the POW, otherwise the network would be unable to verify which transactions are in each block.
The merkle tree structure itself could be replaced by something else (eg just chain all transactions, hash that, and include the result in the header as a cryptographic commitment), but using the merkle tree structure has some added benefits (faster verification for SPV wallets, for example).
There may be some other reasons I am not remembering, but the cryptographic commitment is the most obvious that comes to mind.

Simply, no. Instead, probably, it'd concat all the TXIDs in the block and [Double] Sha256 them. This can be calculated much faster than a Merkle Tree. Merkle Trees have no use other than allowing someone without the complete set of the data to verify that a specific transaction was in the tree.

I guess it's technically true that the Merkle tree structure is only used to verify a tx is in a block without the full set of txs, however, SPV is not the only place where that ability is used. See my answer for additional applications - https://bitcoin.stackexchange.com/a/78838/575.

Yes.
To find a non-SPV application of the Merkle tree, you needn't look further than the first mention of "Merkle Tree" in the Bitcoin whitepaper. It appears in section 7, "Reclaiming Disk Space", which explains how it can be used to prune old, irrelevant transactions, even among full nodes.
SPV itself is presented in section 8, aptly titled "Simplified Payment Verification".
Another application is not mentioned in the Bitcoin whitepaper, because it is a later development and is not strictly a part of the core protocol, and that is in mining pools. With a Merkle Tree, a miner can tweak the generation transaction independently based on the pool's template (for a wider range of hash attempts), or alternatively choose his own work and submit to the pool a proof that he is working for the pool.


text:
getblockfilter Error: Index is not enabled for filtertype basic
I'm failing to run the getblockfilter example. What am I doing wrong?
$ bitcoin-cli help getblockfilter
getblockfilter "blockhash" ( "filtertype" )

Retrieve a BIP 157 content filter for a particular block.

Arguments:
1. blockhash     (string, required) The hash of the block
2. filtertype    (string, optional, default=basic) The type name of the filter

Result:
{                      (json object)
  "filter" : "hex",    (string) the hex-encoded filter data
  "header" : "hex"     (string) the hex-encoded filter header
}

Examples:
> bitcoin-cli getblockfilter "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" "basic"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockfilter", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09", "basic"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/

$ bitcoin-cli getblockfilter "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09" "basic"
error code: -1
error message:
Index is not enabled for filtertype basic

$ bitcoind --version
Bitcoin Core version v0.20.0.0-ga62f0ed64f8bbbdfe6467ac5ce92ef5b5222d1bd
...

Do I need to build a block filter index or something?

To enable the compact block filter, you need to start bitcoind with the -blockfilterindex=basic (or simply -blockfilterindex) command line option, or put that option in your bitcoin.conf file.
Depending on your hardware, it may take a few hours to build the compact block filter index. This is done in the background and does not affect normal node or wallet processing.

are there any other type of filters available? or is the only filtertype "basic"?

@SachinMeier Currently there is only one filter type defined (in BIP158) and implemented in Bitcoin Core. There was originally planned to be an 'extended' filter type, but that was removed during development of the proposal here: https://github.com/bitcoin/bips/pull/687.


text:
Errors with `walletcreatefundedpsbt` & non-solvable UTXOs
I'm attempting to use walletcreatefundedpsbt with a watch-only wallet.
With 2.0 BTC in the watch-only wallet, I attempt to create a psbt sending 0.2 BTC without specifying inputs and receive an "Insufficient funds" error:
$ bitcoin-cli -regtest -rpcwallet=watchonly getbalance "*" 0 true
2.00000000

$ bitcoin-cli -regtest -rpcwallet=watchonly walletcreatefundedpsbt '[]' '[{"bcrt1qnv3tl3z9cll9faqf79ppfn3rrp7pn9wwmq04p5gqgqtxg55xfxuslkyk94": "0.20000000"}]' 0 '{"includeWatching": true, "changeAddress": "bcrt1qa4h6amsgyc878k094grqh6ktmgvp97dt6et9cy5hjmyxlgd9q63q3p6hch"}' true
error code: -4
error message:
Insufficient funds

When I specify inputs to the same RPC call, I get a (confusing) "Signing transaction failed" error:
$ bitcoin-cli -regtest -rpcwallet=watchonly walletcreatefundedpsbt '[{"txid": "1d76879500aecafde541770b5d44ccec5955b4c1a455fae446bf1df7b5ea43e9", "vout": 0}, {"txid": "e5a8dfa9459ac154fe62652e1d43049dae13f11815da36cc32881e27917a0dff", "vout": 1}]' '[{"bcrt1qnv3tl3z9cll9faqf79ppfn3rrp7pn9wwmq04p5gqgqtxg55xfxuslkyk94": "0.20000000"}]' 0 '{"includeWatching": true, "changeAddress": "bcrt1qa4h6amsgyc878k094grqh6ktmgvp97dt6et9cy5hjmyxlgd9q63q3p6hch"}' true
error code: -4
error message:
Signing transaction failed

These inputs are visible in listunspent, but they are not "solvable".
$ bitcoin-cli -regtest -rpcwallet=watchonly listunspent
[
  {
    "txid": "1d76879500aecafde541770b5d44ccec5955b4c1a455fae446bf1df7b5ea43e9",
    "vout": 0,
    "address": "bcrt1qupu3f9ekx2jpu9adgnrckkuh60d0x5zunmrxla34cwc5z79lajrs52gcpu",
    "label": "",
    "scriptPubKey": "0020e07914973632a41e17ad44c78b5b97d3daf3505c9ec66ff635c3b14178bfec87",
    "amount": 1.00000000,
    "confirmations": 205,
    "spendable": false,
    "solvable": false,
    "safe": true
  },
  {
    "txid": "e5a8dfa9459ac154fe62652e1d43049dae13f11815da36cc32881e27917a0dff",
    "vout": 1,
    "address": "bcrt1qz9xlsapracexvk7gwjd8ytf9c5ckyeg6v64lmuun8j9x6l2770cs42f7kl",
    "label": "",
    "scriptPubKey": "0020114df87423ee32665bc8749a722d25c53162651a66abfdf3933c8a6d7d5ef3f1",
    "amount": 1.00000000,
    "confirmations": 103,
    "spendable": false,
    "solvable": false,
    "safe": true
  }
]

These UTXOs correspond to exotic scripts that cannot be expressed in the descriptor language, and were imported with the importmulti RPC. During the import, the following warning was displayed:
$ bitcoin-cli -regtest -rpcwallet=watchonly importmulti '[{"scriptPubKey": "0020e07914973632a41e17ad44c78b5b97d3daf3505c9ec66ff635c3b14178bfec87", "witnessscript": "63522102a7451395735369f2ecdfc829c0f774e88ef1303dfe5b2f04dbaab30a535dfdd62102303cc8dc4e50bb574899b4715c0ddcd63268137b2d95011ff0e71db0968d819d2103d9dcfae4253ef1dd7b2401f82f79b1e739e76ad22ad30cd6a58a04076a033e5a53ae6702f401b1755221033defb46605b0bf90e99821150926daabc0a909ae4d7e09ddd9cc691735896709210245449f5d5cb7cd0d299fcbfd7a3bf2e46a5ae43bdc75289f5ab1e0c7654cc057210299f94c03fc71ae8ced4d3a4f739cc2f227687885b8d1a5184ad1de14faa6c71c53ae68", "internal": false, "keypool": false, "timestamp": "now", "watchonly": true}]'
[
  {
    "success": true,
    "warnings": [
      "All private keys are provided, outputs will be considered spendable. If this is intentional, do not specify the watchonly flag.",
      "Importing as non-solvable: unrecognized script. If this is intentional, don't provide any keys, pubkeys, witnessscript, or redeemscript."
    ]
  }
]

Are both of these errors caused by the same problem -- the absence of "solvable" utxos?

Yes. Bitcoin Core will not be able to select for coins that are not solvable. This is because, for fee estimation, it must know how large the final transaction will be, but it cannot do this without knowing everything needed to construct the final transaction.
The outputs don't need to be spendable (i.e. you don't need to have the private keys for them) because Core knows how large a signature will be so it creates a dummy signature. But it needs to have everything else such as scripts and public keys. Without those, the output is not solvable and cannot be used in coin selection.

I encountered the problem described here and resolved it by replacing the call to walletcreatefundedpsbt() with a call to createpsbt(), which works as I expect.  However now I have a new problem in that I need to know the size of the TX in order to calculate the fee.  The best solution that I can think of is to execute a dummy call to createpsbt() using a dummy fee value, then measure the size of the TX, then do a real call to createpsbt() after correctly calculating the fee amount. Is there a better way?


text:
Unconfirmed transaction for 7days now, please i need help
Transaction to the  address 39j2nuZWr4F2hZ5wYDwQwZWzsTJC4H6ujn from my bitcoin wallet and it unconfirmed, i am new to this, i need help please, help me out

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


text:
Pending transaction, what can i do
Pending transaction and it been 8 day, anyone can help me here and here 3MPTn2ZwQiydkvKZKRgAVUQawA9ShjLJVh , need help

It's because you've used a very small fees  96.339 sat/B for this transaction.
You can see the current bitcoin fees here : https://bitcoinfees.21.co/ which is recommended. Your transaction will likely drop out of blockchain and you will get your coins back soon.
Solutions :
1) You can contact bitcoin pools and push your transaction in there blocks.
2) You can double spend your bitcoins ( Not easy for beginners/non-technical persons )
3) You can just wait it out.
Please use a higher fees from next time to avoid using these issues.

Thank you very much and how can i contact the bitcoin pools to push my transaction

You can find one online at viabtc.com


text:
deleted Bitcoin Wallet before transaction processed
I requested bitcoin through Bitcoin wallet before fully syncing.  Bitcoin wallet would not sync on the original laptop that I had installed it on, so I removed the program and reinstalled it on another computer.  Now, I can't use the old address to receive my transaction. I can see it on blockchain, but I have no idea how to receive it as Bitcoin core will not allow to type in the old address.  Please help!

Whenever you create a new wallet, a number of private keys are generated for you. These private keys are used to authenticate yourself as the owner of bitcoins sent to the keys' corresponding addresses. Therefore, you must keep these private keys safe. For Bitcoin Core, these private keys are in a file called wallet.dat in the Bitcoin directory. If you've deleted this file there will be no way to recover your coins, as private keys cannot be regenerated.
However, I think that the wallet file may remain even when Bitcoin gets uninstalled, so if you didn't delete the whole directory, but just uninstalled it, you might want to check if you can still find the wallet.dat.

Thanks!  So i reinstalled Bitcoin Core before looking for the .dat file, but i did find a wallet.dat file from the day I uninstalled core.  Can I transfer and use this file on another PC?

Thanks!  So i reinstalled Bitcoin Core before looking for the .dat file, but i did find a wallet.dat file from the day I uninstalled core.  Can I transfer and use this file on another PC?

Make sure Core is not running, create a backup of the new wallet.dat if it is of relevance, then copy the recovered wallet.dat into the new Bitcoin Core's directory. Then start the program. when syncing has finished you should be able to see your transaction.


text:
`walletcreatefundedpsbt` with unconfirmed inputs
I would like to create a psbt using walletcreatefundedpsbt spending unconfirmed ouptputs. Is this possible?
When I call that RPC command with 0 confirmed balance but with sufficient unconfirmed outputs, I get an Insufficient funds error.
Thanks in advance!

Are the unconfirmed inputs from incoming outputs or change outputs? If they are incoming, Bitcoin Core will not select them for transactions.

Incoming. Is it true that Bitcoin Core's coin selection algorithm won't select unconfirmed incoming outputs in general?

Bitcoin Core will never select unconfirmed incoming outputs. These are always considered to be untrusted and not safe for coin selection. This applies to any transactions that Bitcoin Core creates, including those created by using walletcreatefundedpsbt or fundrawtransaction.
For a code reference, the AvailableCoins function is used to fetch and filter the coins available for coin selection which calls the IsTrusted function for every available output (well really transaction stored in the wallet which include incoming and outgoing transactions). If the transaction was not created by that wallet, it is considered not trusted, so IsTrusted returns false which results in AvailableCoins excluding all of that transaction's outputs from the set of outputs used for coin selection.


text:
`createpsbt` RPC call doesn't provide PSBT inputs & outputs
I'm attempting to create a PSBT using RPC:
bitcoin-cli createpsbt [[{"txid": "1d76879500aecafde541770b5d44ccec5955b4c1a455fae446bf1df7b5ea43e9", "vout": 0}, {"txid": "e5a8dfa9459ac154fe62652e1d43049dae13f11815da36cc32881e27917a0dff", "vout": 1}], [{"bcrt1qnv3tl3z9cll9faqf79ppfn3rrp7pn9wwmq04p5gqgqtxg55xfxuslkyk94": "0.20000000"}, {"bcrt1qa4h6amsgyc878k094grqh6ktmgvp97dt6et9cy5hjmyxlgd9q63q3p6hch": "1.79900000"}], 0, true]

This is the PSBT I receive in return:
cHNidP8BALICAAAAAulD6rX3Hb9G5PpVpMG0VVnszERdC3dB5f3KrgCVh3YdAAAAAAD9/////w16kSceiDLMNtoVGPETrp0EQx0uZWL+VMGaRanfqOUBAAAAAP3///8CAC0xAQAAAAAiACCbIr/ERcf+VPQJ8UIUziMYfBmVztgfUNEAQBZkUoZJuWAOuQoAAAAAIgAg7W+u7ggmD+PZ5aoGC+rL2hgS+avWVlwSl5bIb6GlBqIAAAAAAAAAAAA=

When decoded, the inputs and outputs sections of the PSBT are empty. Why is this? Bitcoin Core should know everything necessary to fill these sections out. Why doesn't it?
bitcoin-cli -regtest decode <psbt>
{'inputs': [{}, {}],
 'outputs': [{}, {}],
 'tx': {'hash': 'fd88b50ec52948dcf04b0d802000b325f960f3333cff8bf7a274273c9d7e2ed7',
        'locktime': 0,
        'size': 178,
        'txid': 'fd88b50ec52948dcf04b0d802000b325f960f3333cff8bf7a274273c9d7e2ed7',
        'version': 2,
        'vin': [{'scriptSig': {'asm': '', 'hex': ''},
                 'sequence': 4294967293,
                 'txid': '1d76879500aecafde541770b5d44ccec5955b4c1a455fae446bf1df7b5ea43e9',
                 'vout': 0},
                {'scriptSig': {'asm': '', 'hex': ''},
                 'sequence': 4294967293,
                 'txid': 'e5a8dfa9459ac154fe62652e1d43049dae13f11815da36cc32881e27917a0dff',
                 'vout': 1}],
        'vout': [{'n': 0,
                  'scriptPubKey': {'addresses': ['bcrt1qnv3tl3z9cll9faqf79ppfn3rrp7pn9wwmq04p5gqgqtxg55xfxuslkyk94'],
                                   'asm': '0 '
                                          '9b22bfc445c7fe54f409f14214ce23187c1995ced81f50d100401664528649b9',
                                   'hex': '00209b22bfc445c7fe54f409f14214ce23187c1995ced81f50d100401664528649b9',
                                   'reqSigs': 1,
                                   'type': 'witness_v0_scripthash'},
                  'value': Decimal('0.20000000')},
                 {'n': 1,
                  'scriptPubKey': {'addresses': ['bcrt1qa4h6amsgyc878k094grqh6ktmgvp97dt6et9cy5hjmyxlgd9q63q3p6hch'],
                                   'asm': '0 '
                                          'ed6faeee08260fe3d9e5aa060beacbda1812f9abd6565c129796c86fa1a506a2',
                                   'hex': '0020ed6faeee08260fe3d9e5aa060beacbda1812f9abd6565c129796c86fa1a506a2',
                                   'reqSigs': 1,
                                   'type': 'witness_v0_scripthash'},
                  'value': Decimal('1.79900000')}],
        'vsize': 178,
        'weight': 712},
 'unknown': {}}

It's not supposed to. createpsbt does not have access to the wallet so it cannot fill in any input or output information. If you want those to be filled in, you can use walletcreatefundedpsbt.

Or alternatively, utxoupdatepsbt after createpsbt (but that only works for known-to-be-segwit inputs, as pre-segwit inputs need the full transaction that created the output being spent from, something the UTXO set doesn't have access to).

Ahh I didn't realize it didn't have access to the wallet. This makes perfect sense. Thanks.


text:
What is the length of largest known reorganization in bitcoin?
Usually there is an assumption, that a transaction is fully finalized after 6 confirmations, e.g. 6 blocks mined on top of the block, which includes given transaction.
What is the length of largest known reorganization in bitcoin?

There have been only two large re-orgs in Bitcoin's history. The first is the value overflow incident in August 2010 that caused a re-org of 53 blocks and the March 12, 2013 fork that caused a re-org of 24 blocks.

Value Overflow Bug
On August 15 2010, it was discovered that block 74,638 contained a transaction that created 184.4 billion bitcoins for three different addresses. Two addresses received 92.2 billion bitcoins each. Yes you read that right. 184.4 billion Bitcoins!!! This was possible because the code used for checking transactions before including them in a block didn't account for the case of outputs so large that they overflowed when summed.
Integer overflow is the digital equivalent of a mechanical odometer wrapping around to zero after a car drives 999,999km. The overflow caused the software to think that the transaction contained only a small amount of BTC while in reality the outputs of the transaction together had thousands of times more than the 21 million that should ever exist.
Satoshi published a new version of the client within five hours of the discovery. This release contained a soft forking change to the consensus rules that rejected the output value overflow transactions (as well as any transaction that paid more than 21 million bitcoins in an output for any reason).
Although many unpatched nodes continued to build on the "bad" blockchain, the "good" blockchain overtook it at a block height of 74,691 at which point all nodes accepted the "good" blockchain as the authoritative source of Bitcoin transaction history.

March 2013 Chain Fork
The v0.8 release of Bitcoin Core switched the database that it used to store blocks and transactions from BerkeleyDB to LevelDB as part of an effort to reduce blockchain synchronization time. A bitcoin miner running v0.8 created a "large" block (at height 225,430) that was incompatible with earlier versions of Bitcoin leading to the Bitcoin blockchain splitting into two, with one half of the network adding blocks to one version of the chain, and the other half adding to the other.
In order to make an update to a database, the program must make a “lock” on the part of the database which stores that particular item of information. This mechanism is implemented to prevent two changes from occurring simultaneously and accidentally corrupting the database.
In a b-tree, the data structure used by BerkeleyDB to store objects, two locks are required per update. However, BerkeleyDB requires its users to set a limit to the number of locks that can be made at the same time. If the values are too small, requests for locks in an application will fail. If the values are too large, the locking subsystem will consume more resources than is necessary.
In the case of Bitcoin, this limit was 10,000. What happened in block 225,430 was that a single block simultaneously affected the status of over 5,000 transactions, thereby requiring more than 10,000 locks on the b-tree to be made at the same time. As a result, BDB failed, and so the older (v0.7 and earlier versions) could not read the block. In the case of v0.8, LevelDB has no such restrictions, so it could accept such blocks just fine.
It was finally resolved by miners downgrading their Bitcoin Core to v0.7. This placed majority hashpower on the chain without the "larger" block, thus eventually causing the v0.8 nodes to reorganize to the v0.7 chain.


text:
How to generate html with coverage data?
I built bitcoin as:
./autogen.sh
./configure --without-gui --enable-lcov
make -j4
./src/test/test_bitcoin

I see bunch of *.gcno files. How do I generate html?

Okay, I figured that out.
After you run tests, you will see a bunch of *.gcno files. Then, do:
# better to work in a separate dir
mkdir cov && cd cov
lcov -c -d ../src -o cov.info
genhtml cov.info

And open index.html cov dir.


text:
How to get block height, if I have only block header?
Imagine I executed ReadBlockFromDisk and now I have valid instance of CBlock.
How do I read height of this block?
CBlock block = ...;
CBlockIndex index(block);
assert (index.nHeight != 0); // fails, nHeight is default initialized

I think for have the height of block you can analysis of the bitcoin blockchain

It looks like this function from validation.h does the job:
CBlockIndex* LookupBlockIndex(const uint256& hash)

The answer I posted is the answer to your next question. "How do I load the index so this function can work?"

You'd need to get a full node started up by calling AppInitMain in init.cpp in order to get the index subsystem running.
Otherwise it can't query the index database to get the block height.
The node subsystem must be warmed up and running in order to run queries linked from C++ directly. You'd also need to synchronize the calls and respect locks - not easy.
Running AppInitMain is basically the same as running bitcoind, so you're probably better off calling into the RPC interface from C++ and passing the getblock <hash> 1 command to it. The process the resulting JSON.
getblock <hash> 1 returns something like this
{
  "hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
  "confirmations": 600340,
  "strippedsize": 215,
  "size": 215,
  "weight": 860,
  "height": 1,
  "version": 1,
  "versionHex": "00000001",
  "merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
  "tx": [
    "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"
  ],
  "time": 1231469665,
  "mediantime": 1231469665,
  "nonce": 2573394689,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000000000000000200020002",
  "nTx": 1,
  "previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
  "nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd"
}

Which includes the height and other data.

I wanted to get a name of C++ function to retrieve it, but anyway, thanks.


text:
How to detect that full node is in sync (using jsonrpc)?
I have full bitcoin node available through jsonrpc interface. How my app can detect if this node  is in sync with the network?

Using the getblockchaininfo RPC command :

if initialblockdownload is true, your node is currently syncing with the network for the first time.
else :

if the headers field number is superior to the blocks field number, your node is catching up with the current state (likely after having been restarted)
else if the headers field number is equal to the blocks field number, your node is synced !

Here is the current output of the command for me :
$ bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 634379,
  "headers": 634379,
  "bestblockhash": "000000000000000000136f1b78deeebc33a9b7b33d25c2e37f5446cb33b586fd",
  "difficulty": 13732352106018.34,
  "mediantime": 1591963775,
  "verificationprogress": 0.9999999385944023,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000104a35fae53a5b470d8e9524",
--snip--
}


text:
Are HD wallets private keys any different than regular private keys
Aside from the fact that HD wallets derive them deterministically, is it correct to state that keys driven at any path or index under BIP32 isn't any different from a private key that's derived randomly in a non-HD wallet?
In other words, its theoretically possible for someone to derive a private key that's at a particular node under your master key in HD wallets, irrespective of how small the probability is, and actually the same probability that there is for generating a private key (non-deterministically) that's already in use by someone else?
Essentially, private key being just a number in a specific range, you can either guess it randomly every single time or have a mechanism of generating random numbers, it essentially means the same thing and is possible to arrive at the same number from either of the ways.
Correct?

A private key derived via the HD algorithm is still a usual private key. Does this answer your question?

@MCCCS Yes, that's what I am looking to confirm. Are Multi-sigs & P2SH any different or they are also usual private keys?

Bitcoin uses ECDSA for signing and verifying. That is, G is a curve parameter (known constant), k is a number, then the public key is kG, etc. The same mechanism is used in different script types too: Multisig scripts and other P2SH scripts. However, note that it is easier to brute-force a P2SH multisig scripts, which is why the Bech32 format P2SH scripts have longer hashes. Similarly, P2SH scripts might not use signature validation at all.
An HD private key can be encoded in the WIF private key format, and any wallet supporting importing private keys would be able to spend its outputs. This doesn't hold true for other address types.

Sorry, but I am unable to link this additional info to the question I asked. Are Multi-sigs & P2SH usual private keys too? (Y/N) I am still learning about how signing of transactions work.

A P2SH script may need zero or more private keys. A multisig needs one or more private keys. Those private keys are all of the same type: a large number between 0 and about 2^256.

m-of-n multisig means there are n public keys. For it to be spendable we need private keys of m of those public keys so sign. So a multisig is like batch verification of signatures made by private keys.

Gotcha, I think it will make more sense with time as I understand signing of transactions. Thank you! I have an additional related question https://bitcoin.stackexchange.com/q/96144/82646 Can you take a look?


text:
Verifying Bitcoin Core Integrity using PGP
I downloaded the Bitcoin Core v0.20.0 from https://bitcoin.org/en/download
To verify, I first imported the signing key at https://bitcoin.org/laanwj-releases.asc and then ran command:
gpg --import laanwj-releases.asc
Then I downloaded the release signatures from https://bitcoin.org/bin/bitcoin-core-0.20.0/SHA256SUMS.asc and to verify I ran command:
gpg --verify SHA256SUMS.asc
Output was:
gpg:                using RSA key 90C8019E36C2E964
gpg: Good signature from "Wladimir J. van der Laan (Bitcoin Core binary release signing key) <laanwj@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 01EA 5486 DE18 A882 D4C2  6845 90C8 019E 36C2 E964

Now, it says "Good signature" but the next two lines are WARNING:  This key is not certified with a trusted signature! There is no indication that the signature belongs to the owner.
What did I accomplish then, till this point?
I also tried running gpg --verify SHA256SUMS.asc bitcoin-0.20.0-win64-setup.exe but got gpg: not a detached signature as the output.
Not sure if I was able to verify it correctly or not. I was stupidly quick enough to actually run the installer after noticing "Good signature" in output and matching the Primary key fingerprint on the webpage and it matched. Please explain what's going on here.
Also how does this signing even verify the integrity of the downloaded file when the malicious actor can also modify the file at https://bitcoin.org/laanwj-releases.asc ?
Thank you!

GnuPG is telling you that the signature corresponds to that public key (your file has a valid signature and wasn't tampered with in transit), but that it doesn't know if that public key is trustworthy.
If you trust your friendly neighborhood CA, then do the following:
gpg --lsign-key 01EA5486DE18A882D4C2684590C8019E36C2E964

then enter your private key password to locally certify the key.
If you don't trust the CA (good on you for being suspicious), ask someone you know who you do trust for the key fingerprint. If that key fingerprint matches what you imported, then you can run that command. If it doesn't, then something is up.

Without understanding what did I achieve with my steps and what does your instructions aim to cover beyond that, its hard to get a grasp on it. Could you elaborate your answer? Perhaps start with to what degree the downloaded file can be considered as verified.

The command tells GnuPG that "The Bitcoin developer's signing key is trustworthy, reflect that fact the next time a signature is verified". The file you downloaded has already been signed by the website using TLS (so it's verified), but the PGP signature is just extra protection. The issue is that you have to trust that the key they listed is actually their key and not some impostor. You are right in your last sentence of the question: If bitcoin.org is hacked, the attacker can tamper with the key. This is why you should ask someone you trust for the fingerprint, for extra protection.

Right, but wasn't that the exact purpose of PGP keys? Being able to verify even if the website is compromised, otherwise this works just like verifying by the hash of the file, which an attacker can easily change if managed to get access to hosting of the website.

The purpose of PGP is that it allows you to verify files out-of-band, but you still have to trust the key. A PGP key is identical to an X.509 certificate in nearly every way except the trust model. Unless you ask someone you trust either in person or using already trusted keys, there is no way of telling whether or not the key is trustworthy. You can build this trust by joining a Web of Trust, which requires events like keysigning parties. Unless you're extremely paranoid about the safety of the binary you downloaded, it's probably safe. PGP doesn't add extra safety unless you join a WoT.

Makes sense, thanks so much for explaining! Could you confirm gpg --verify SHA256SUMS.asc was sufficient to verify the SHA256hash of the file listed in it 0f1ea61a9aa9aba383a43bcdb5755b072cfff016b9c6bb0afa772a8685bcf7b0  bitcoin-0.20.0-win64-setup.exe is accurate without me having to specify the file itself that I am trying to verify? I fear it could have just validated the signature and not the hash of the file by hashing the concerned file by locating it.

If you verify the file with the list of hashes, that means that the hashes are trustworthy, not the file itself. You have to do another step. If the files you downloaded hashes to one of these already verified hashes, then the file is also valid. Run sha256sum bitcoin-0.20.0-win64-setup.exe and see if the hash matches. If that doesn't work, use CertUtil -hashfile bitcoin-0.20.0-win64-setup.exe sha256. The reason why one would elect to sign a list of hashes is for convenience; only one signature file needs to be made, not one for every file.

Let us continue this discussion in chat.


text:
Address starting with 2, what mode I am in?
I am using https://github.com/freewil/bitcoin-testnet-box to run bitcoind in docker to test signing of transactions.
make start tells me the bitcoind is started without -regtest flag. See https://github.com/freewil/bitcoin-testnet-box/blob/master/Makefile#L13
When I run bitcoin-cli -datadir=1 getblockchaininfo, I indeed see "chain": "regtest" in output, so both the nodes are running in regression test mode, I believe.
If I generate an address for either of these 2 nodes, I get an address starting with 2:
tester@4df64413049e ~/bitcoin-testnet-box$ make address1
bitcoin-cli -datadir=1  getnewaddress
2N4DTeBWDF9yaF9TJVGcgcZDM7EQtsGwFjX
tester@4df64413049e ~/bitcoin-testnet-box$ make address2
bitcoin-cli -datadir=2  getnewaddress
2MwxP8fyh9MFqKnZXZuqt3ZYByhLpNVoiX3

make getinfo tells me its not testnet either:
tester@4df64413049e ~/bitcoin-testnet-box$ make getinfo
bitcoin-cli -datadir=1  -getinfo
{
  "version": 170100,
  "protocolversion": 70015,
  "walletversion": 169900,
  "balance": 0.00000000,
  "blocks": 0,
  "timeoffset": 0,
  "connections": 1,
  "proxy": "",
  "difficulty": 4.656542373906925e-10,
  "testnet": false,
  "keypoololdest": 1599940906,
  "keypoolsize": 1000,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "warnings": ""
}
bitcoin-cli -datadir=2  -getinfo
{
  "version": 170100,
  "protocolversion": 70015,
  "walletversion": 169900,
  "balance": 0.00000000,
  "blocks": 0,
  "timeoffset": 0,
  "connections": 1,
  "proxy": "",
  "difficulty": 4.656542373906925e-10,
  "testnet": false,
  "keypoololdest": 1599940906,
  "keypoolsize": 1000,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "warnings": ""
}

So what mode I am running these bitcoin nodes as? If I was to trust the output that its not testmode but somehow regression test mode, shouldn't the address start with 1 if its really regtest mode or with m/n if its testnet mode?
Also, when I dump the private key for any of such address and try to derive the P2PKH address from it, it doesn't match. Same code works fine with address and key taken from mainnet. What's going on?

Addresses that start with "2" are regtest or testnet P2SH (legacy pay to script hash) similar to addresses that start with "3" on mainnet.

@pinhead I looked hard at specifying addresstype in getnewaddress call and was able to get an address starting from m/n for legacy value. I was passing the argument incorrectly earlier, so it was defaulting to p2sh-segwit like you said. The code to derive the address from public key still fails though.

I figured out the issue with mismatching address too. Turns out code sample I had wasn't serializing according to the pub key being compressed or not. Using the right condition/abstraction fixed it.

Both regtest and testnet use the same address prefixes for the legacy and p2sh-segwit address types. Addresses beginning with 2 are p2sh, and if retrieved via getnewaddress, are guaranteed to be p2sh-segwit.
For bech32 type addresses, the regtest prefix is bcrt and on testnet it is tb. You can try fetching a bech32 address to see what the prefix is and be more sure of which network you are using.

shouldn't the address start with 1 if its really regtest mode

No, and that would be dangerous.
Both regtest and testnet intentionally use different prefixes than mainnet. You will never see mainnet prefixes in those modes.

Thanks! I didn't realize regtest has diff prefixes too. I thought it just tweaked another parameter to differentiate itself from mainnet.


text:
I forgot the index of my BIP32 key
I had chosen at random an index for storing some bitcoins. My key derivation path is Bip32 m/0h/1
How would I go about generating all 2 billion keys and check which one has the funds I stored?
The bip32gen software is too slow for this to happen anytime soon.
Any ideas?

A modern multicore CPU with optimized EC code should be able to search those those in ~a day or so. Is that too slow?


text:
Unable to send total amount of bitcoin even after deducting the transaction fee what do I do?
Hi I recently imported a wallet to blockchain wallet from a backup, the wallet and everything shows up and everything but since the imported wallet is not protected by the backup phrase and not as secure as if the funds were directly imported into blockchains "My Wallet", when I try to send the total amount in my imported wallet to the blockchains "my wallet" it only allows me to transfer partial funds and not the whole amount even with the blockchain transaction fee deducted and set to regular the numbers don't add up, I have 4.56093409 in my imported wallet and with the fee of 0.0015431 it should allow me to send 4.55939099 however it only allows me to send something like 3.4889... so what do I do? also same thing happens when I try to transfer the funds to "my wallet" from under my security and addresses tab. Please help Thank you

I would try importing to a different wallet (eg a mobile wallet), and then attempt to 'send all' to your desired destination address. Otherwise this seems like it would be a question best answered by the blockchain.info customer service reps.

i would go to coinb.in and manually broadcast the transaction to the network myself. this way you can have it set on the lowest fee, then go to viabtc.com and use their free transaction accelerator to give it a final push. works every time. GL


text:
Could a large group of miners theoretically lower the network hashrate to manipulate difficulty?
I am relatively new to understanding the fundamentals of the Bitcoin network, so I am still trying to learn how the actions of miners can influence the direction of the blockchain.
Back to my main question, since the difficulty adjusts at a fixed rate of every 2016 blocks (~2 weeks), what would prevent a large hashrate miner or pool from entirely shutting down their mining power minutes before the 2016th block was found? The incentive here would be that the next difficulty would become significantly lower until it is readjusted in 2016 more blocks. This process of course, could be repeated.
Is there some sort of method in place which averages transaction times preventing this from happening? If so, would such an action still have any affect?
Thanks :)

The difficulty adjusts every 2015 blocks (due to an unintentional "off-by-one" error), taking into account how much time elapsed for those 2015 blocks to be mined. If it took less than two weeks, the difficulty goes up. If it took longer than two weeks, the difficulty goes down.
If a large amount of mining (hashrate) was shutdown for the entire 2015 block period, it would take longer to mine the blocks and surely it would bring the difficulty down; but it would cost those miners substantially (in lost opportunity, blocks they could have mined), and further, after the difficulty adjusted down, it would not be long for it to once again adjust up, so really not much point in doing that.

The difficulty adjusts every 2016 blocks based on the average block time for all of those 2016 blocks. So just making the 2016th block take longer to mine has little effect on adjustment. A miner would have to manipulate block times for the entire 2016 block period to get any significant difficulty change.


text:
In the case, bitcoin transactions are becoming less frequent, will the blockchain become unsafe?
The security of the blockchain relies in the fact that new blocks are added faster than any attacker guy can add them (as long as <51%)
In case the frequency of the bitcoin transactions becomes less, an attacker could use the time to remove some previous transactions (not too far behind) and do bis proof of work.
Then... When new Block is finally verified and ready to be added, in the case he is the fastest miner (even <51%), he could propagate his bogus blockchain fork.
Of course, due to <51% his chances are little but because of the low amount of transactions, he could try over and over again (thus increasing his chances).
World this render blockchain more insecure?
Thanks!

It's not the number of transactions that determines the security level, it's the amount of work done to partially invert the hash function. For the same difficulty level, this is proportional to the number of blocks mined (though Bitcoin scales the difficulty to even out the time between blocks). In the short run, the miners do not really care if there are many transactions or few transactions available to include in the block -- they've already invested in the high fixed cost of ASIC mining hardware.
To pull off a 51% attack, the attacker would have to provide as much computing power as all legitimate miners do. A slight drop in the popularity of Bitcoin isn't going to cut it.


text:
Mining Bitcoins on PC - Experiment, looking for advice or simple instructions
I am absolutely new to Bitcoin and mining, I know that mining at home using a PC is not worth even the time and takes years to get any income out of it.
The thing is I need to mine at home using a PC for experimental purposes and education, so basically i just want to make something even like 0.0000001 bitcoin, and only bitcoin no other crypto currency.
I downloaded the Bitcoin Core wallet and downloaded all the years transactions to be up to date, where to go from there i have no idea, i found several miners but they are all confusing, I can't even find my address to start using the basic miners, so please could you give me a guide or a step by step instructions on how to proceed please? I need to do this alone not within a group (pool) of miners as most sites suggested.
Thank you

Solo mining, even with an asic, will essentially never return any money, since you either find a block or you get nothing. If you want to make even 1 satoshi, you would need to be in a pool, and this question is too broad for this site's format in any case.

As has already been commented, this is really not possible. You cannot solo mine Bitcoin with a PC. Even with an ASIC, you cannot solo mine. You simply won't have enough hash power to even get (as you said) 0.0000001 BTC.
If you are really set on mining, I would suggest you look at other currencies, and GPU based mining. You will however, be required to use mining pools. That is a necessity. If you are looking for a very simple GPU miner, you may checkout MinerGate (note: I am in no way affiliated with MinerGate, and I have never used their product).

As I mentioned in the post I have no intention of making any money, but I don't want to invest in hardware neither, the entire project is to show my students something in action and actually working, I guess it is not possible then, thanks for the answer

the entire project is to show my students something in action and actually working

You can probably do this by effectively forking a cryptocurrency with a new isolated blockchain.
If Satoshi Nakamoto could get it all started with a few PCs in 2008, so can you.
However, you'd probably need to learn a substantial amount about your chosen cryptocurrency.


text:
No idea what wallet site, or password(s) but has the old computer
My friend was paid out in bitcoin approx 2 years ago, she has no idea what wallet site, password(s) but has the old computer still. Is there a way to find enough data to recover her Btc? She is and was clueless about btc, wallets, etc...  I practiced looking on my computer after briefly searching the net and couldn't find a wallet.dat file. Went back to work searching the net and found this site first thing.

There are simply too many possible wallets, and too many of them would leave no trace on the computer to be able to narrow this down. Your best bet would be to try all the common ones such as Bitcoin Core, Blockchain.info, electrum, armory, multibit, etc.

That's what i'm afraid of.  I'll have her look through her email but I can already hear her voice saying she doesn't have/use that email anymore.

Is there a way to find enough data to recover her BTC?

Probably not.
If she didn't make a note of her password and forgot it then she almost certainly didn't make a safe backup of her private-key or seed-phrase either. You could ask her about that though

She is and was clueless about btc, wallets, etc

That often means people lose their BTC.

My friend was paid out in bitcoin approx 2 years ago

Her best chance would be to find email or other correspondence relating to that event. If she can remember who "paid out" and why, maybe she can get back in touch with them and hope that they recall where the BTC were sent - they may at least have a record of the receiving address and that will help her find out whether there is still any unspent BTC associated with that address.


text:
Can the signers of a 2 of 3 multisig tx be identified later
For accountability reasons:
If public keys of each signer is known, can the 2 out of 3 parties be identified later, or just that it was some combination of the 3 parties?
If the 2 parties can not be identified, how should this be done if its necessary?

Just to be clear, you mean transactions with more than one signature attached to them, not transactions with a single signature made by multiple parties (threshold signatures). Is that correct?

When spending a multisig output, the signatures and redeem script are public information.
This allows you to identify:

The number of potential signers
The number of required signatures
Public keys for all potential signers
Which keys signed the transaction (from the signature).

It will not reveal the identity of who owns a public key, unless you have some offchain analysis to go with this data, and already know who owns which public key.


text:
What does output mean
Will my bitcoin be there after syncronising  Am trying to sweep from my syncronising bitcoin core using my private key but its showing no output whats going on

can you post a screenshot/log output?

Okay i will but please before that let me explain better  my bitcoincore is syn and i have my bitcoin in it so from the videos i watched on youtube i went took the reciving address and paste in debuorg and i got a private key and i firstly i paste the private key on a sweep website and the new address i want to send it too and it saying no utxo for this addres and i also tried it on electrum is says no output needed to confirm the output thays what prompt my question is there anything i need to do thanks

An output is the spending part of a transaction, that establishes ownership of the funds. UTXO is an unspent transaction output. UTXO to your address are counted toward your balance. When you want to send Bitcoin, a UTXO is needed as an input to the transaction.
It is likely that if your node is syncing from scratch it doesnt know about the UTXO related to your address, yet. If it hasn't processed the block that contains the UTXO, it might not know about it, so it doesn't know you have a balance.  If you use the Bitcoin core wallet, there is a wallet database that stores that data.

Yes i use bitcoin core wallet so what will i do not curse i trued to copy the address and paste it in blockchain to see and it says only 1 transaction and the balance is there , so what should i do now wait till it liaf the block or what curse i need my coin and and its still syn

Yeah it sounds like you might need to wait for it to finish syncing.

Will i meet my coin there if it finish syn and i want to ask the address i sent the bitcoin to i checked on. Blockchain  it show rhe monay i transferd to it and the balance it means the money is in the address right

Yes, you can also verify with a block explorer before it's done syncing.

What if my computer couldn't finish the syn how can i retrive my butcoin or have i lost it

If you have the private key you can use different wallet software that will let you import the private key, and then submit a transaction that way. You don't have to run a full node to make transactions.

And how will i do that

you will need to do your own research and select a wallet that you trust, this site isn't really for software recommendations.

Can i talk to you outside this place and can you explain better how i can use the private key on other if my computer could not finish the syn bitcoin co

There is a chatroom: https://chat.stackexchange.com/rooms/8089/mempool

I cant use it am new i dnt have up to 20 reputation ro use the chatroom

The blockchain should finish syncing, if it doesn't you can post another question.


text:
Restart altcoin blockchain
So, I'm setting up an altcoin for educational purposes and I've essentially forked Litecoin.
It's got a 10% premine on it but this wasn't showing up in my wallet so I deleted the $HOME/.mycoin/ directories on my nodes and my %appdata%/mycoin folder on my wallet host in an attempt to restart the blockchain.
However, the blocks that I have attempted to delete are still reappearing as soon as I start my daemon up again.
Any idea what directories/files I need to delete to completely restart the blockchain. This ought to be fairly trivial as I have complete control of the two nodes and the only machine that's connected to it.
Thanks

You need to delete the data directories entirely with the node software shut down when you do that. If both nodes' data directories have been removed and starting one of them still results in the blockchain being downloaded, that means that there is a node that you are connecting to which did not have its data directory cleared. You can find out what node that is by looking in the debug.log file and seeing the IP address of the node that you are connecting to (or is connecting to you).
Alternatively if you generate a new genesis block, you will not have this problem as whatever blockchain you use with the new genesis block will be different from the original blockchain.

Yeah... believe it or not, someone had spied my release on github and had already mined my first block. how they did that I have no idea given I haven't advertised it anywhere


text:
How to secure a Linux node running satoshi 0.16.1?
Everyone in the BTC space seems to suggest that running a full node is the way to go. But Linux has a huge attack surface and I don't want to lose my BTC by having my wallet on an insecure OS. What is everybody else doing? Version 0.16.1 doesn't support HW wallets, so are people really keeping their BTC in an actual satoshi (bitcoin-core) wallet? Or using HW wallets, and the node is just for overall network security (and bragging rights)?

Can you outline, what you mean by huge attack surface? Contrary to Windows the kernel is setup modular, and there is a separation layer between kernel and user space. It makes things difficult to answer, if the opening is such a broad statement...

@pebwindkraft how is it not  obvious that any internet connected computer with a full-blown OS has a huge attack surface?

No, only if you use/install poor software. Unixoide systems are designed to be secure from the very bottom. See e.g. OpenBSD. But yes, a noob can install anytime software that permits complete access - why not. His use case.But per default, the statement is simply not true... I think this would be a technical discussion in a security forum, and is not necessarily bitcoin related.

Since this is pretty opinion based, I'll offer my 2 satoshis.
This sort of addresses the root question which is "Why would I run a full node?". There is also a separate question of how should I secure my funds (or what wallet should I use)?
Wallets
The main thing you need to protect is your private keys (and any access to use them). If you never import them into the full node wallet, you don't need to worry about someone controlling your funds by getting into your box and executing transactions. This goes for any "hot wallet" or online wallet.
If you keep your private keys offline, you can sign transactions with an offline wallet application or a hardware wallet. If you also run a full node, you can then submit the transaction using the node's RPC interface, see: Send Raw Transaction.
There are many libraries and applications to help you with this, here's an example of a list: Awesome-Bitcoin
Full Nodes
In the Original Whitepaper the concept of a miner and a full node were generally the same machine. Today, miners are specialized hardware optimized for the sha256 algorithm.
For some, running a full node provides a low-latency interface to the network for submitting blocks (mining), or it provides the same interface for a 3rd party application like a block explorer.
However, in my opinion, the purpose of running a full node is not for the wallet, but rather to participate in the consensus of the network by verifying transactions. If you own and transact bitcoin, don't you care if your transactions are executed properly and that your currency isn't being inflated? If you don't run a full node you are trusting others to validate this for you.
Many people don't feel as strongly in the mission of creating a decentralized, censorship-resistant global digital currency, but if you don't cast your vote by running a full node and validating the blocks, then you can't complain about the current system of currency.

Thanks for the long reply. Ideally I'd have my node just watch my balance using an extended public key, but although @aantonop seems to suggest that this is a good idea, it doesn't appear to be possible yet (see my other question). Without an xpub key, the only ways to watch transactions concerning my wallet that I know of, are 1) putting the private key on the node (horrifying) and 2) putting a public key on the node and reusing the corresponding Bitcoin address (very poor pricacy).

As a quick answer, some wallets allow you to specify a node that they will connect to. You can run your own node, and point your wallet at it. Beyond being trustless, this has an added bonus of increasing your financial privacy, especially if your node is connected to the tor network.
Note that many such wallets are ‘light wallet’ mobile applications, but I would trust a mobile wallet over a desktop full node wallet myself. This offers a good solution of maintaining sovereignty for a day-to-day use wallet in my opinion.
For larger amounts, using a HW wallet or other cold storage mechanism is highly recommended!

This! +1! Small amounts can go with any wallet, amounts less than a monthly income should go with a proper wallet on a dedicated (non-Windows, non iOS, non Android) system (probably behind a firewall), and large values beyond that should go through a security assessment, instead of blunt statements about security "in general"...

In the first:
a blockchain is normally, as bitcoin or satoshi, secured in his self. There is no way to hacking the system (blockchain) to do any fraud actions. That is why a blockchain is a chain. The chain is unbreakable. Okjay in a time of 100.000.000 Milion years you have the solution fir bruteforcing.
and that was only one block.
If want an secure wallet, you can using ledger. Ledger was actual a USB Stick Wallet and it was encrypted


text:
bitcoind getrawtransaction has no value for vin, what am I doing wrong?
I’m able to get the value for vout but my node is not returning the value for vin, how do I get the value for vin?

Transaction inputs (vin's) are simply unspent transaction outputs of a previous transaction. Here's an example to help clarify:
"vin": [
    {
      "txid": "6adf304f0a3e2afc92d864086202551041dfe0543f3116cc6f5c3b29e795fcaa",
      "vout": 1,
      "scriptSig": {
        "asm": "3044022079aca1fc033403856de39f03c856bf54b79efdaa210237a858d10675635e7b9e02206163547e0df9322fc337ab807f2874fbe1baec303bd874b3eb19c43a56b955ed[ALL] 0424140e929701fe8ad2b00e2f0995fa37357c3e0f67fa4061d387fa88f3b33f3834fec71063060de578c191cc7ab52fb5a095b72a6b692e5740fe2739ec1fcd9f",
        "hex": "473044022079aca1fc033403856de39f03c856bf54b79efdaa210237a858d10675635e7b9e02206163547e0df9322fc337ab807f2874fbe1baec303bd874b3eb19c43a56b955ed01410424140e929701fe8ad2b00e2f0995fa37357c3e0f67fa4061d387fa88f3b33f3834fec71063060de578c191cc7ab52fb5a095b72a6b692e5740fe2739ec1fcd9f"
      },
      "sequence": 4294967295
    },
    {
      "txid": "0047a70c729621f3b27897edc7a7a89c55d094b0241a91dd7a7a0fcd5351cbdd",
      "vout": 1,
      "scriptSig": {
        "asm": "30450220776842cd9d76924f0648ff434b64fef8739952684c184b4ce959ebfb2d9c9b3d022100fc101c92309a693a9fcf67c41efbb6c55483edc41d6fd66e3b3bbec7cc95fe88[ALL] 0424140e929701fe8ad2b00e2f0995fa37357c3e0f67fa4061d387fa88f3b33f3834fec71063060de578c191cc7ab52fb5a095b72a6b692e5740fe2739ec1fcd9f",
        "hex": "4830450220776842cd9d76924f0648ff434b64fef8739952684c184b4ce959ebfb2d9c9b3d022100fc101c92309a693a9fcf67c41efbb6c55483edc41d6fd66e3b3bbec7cc95fe8801410424140e929701fe8ad2b00e2f0995fa37357c3e0f67fa4061d387fa88f3b33f3834fec71063060de578c191cc7ab52fb5a095b72a6b692e5740fe2739ec1fcd9f"
      },
      "sequence": 4294967295
    }
  ],

So to get the value for the first vin, you'll need to make another getrawtransaction call with txid: 6adf304f0a3e2afc92d864086202551041dfe0543f3116cc6f5c3b29e795fcaa
Then look for the 2nd vout output (since vout is 1, which means index 1). So the value will be 0.02039242:
  "vout": [
    {
      "value": 0.02000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 27470c0fb0c4a68221f80bf01bf0e267a0a48d68 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91427470c0fb0c4a68221f80bf01bf0e267a0a48d6888ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "14agTvSiZV33GSYroQCP8p7fyYjUVBE7BU"
        ]
      }
    },
    {
      "value": 0.02039242,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 65be988f0a457cf68203271536428698776f2c51 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91465be988f0a457cf68203271536428698776f2c5188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1AGyaDKdHWo8TcGADUCWd8JYXMQrky8Uko"
        ]
      }
    }
  ],


text:
Could Bitcoin be based on accounts instead, more like banks?
In banking, a user's account will have a balance, and when they spend an amount is credited from their balance. For example, the account #310 could have $100, and spending $10 would reduce it to $90.
Bitcoin on the other hand makes you spend all $100 from the account in a transaction, but the transaction could have two outputs ($10 and $90 - you would keep control of the new $90 account).
Why was Bitcoin set up that way instead of the other way? The other way seems more natural. You'd just sign a transaction as coming from your account and going to someone else's account.

Is it more natural? Long before we had accounts and balances, we had physical money. Physical money behaves a lot more like bitcoin. Well, it doesn't have arbitrary "note" sizes and you can't break a unit of currency by yourself, but other than that...

It could, yes. Ethereum works on something similar to an account system, at least as far as ethereum balance is concerned. Both models are valid, and have their benefits and drawbacks.
The UTXO model allows for great parallelism and privacy. Each transaction can create UTXOs to new addresses, and different UTXOs can be spent independently and parallely.
The account model requires some form of ordered execution (achieved via a nonce in ethereum). Moreover, a single transaction cannot combine balance for two different accounts in current implementations, while you can combine UTXOs from as many addresses are you wish in a single transaction.
As to why Bitcoin chose a UTXO model over a balance one, I don't think an authoritative answer exists on that. It's what the creator(s) of Bitcoin started with, and there is no pressing reason to change it.


text:
My phones died and can't restore wallet on Copay
My phone recently died and I had to reset it all the apps. I tool the 16 character reference I was given in Copay to reinstate my wallet, but there is NOWHERE to put the 16 characters code. Have I just lost all my bitcoin?

probably a better question for CoPay direct, speak to their customer support

Have I just lost all my bitcoin?

Since you haven't practised recovery, that is possible. Likely even.

there is NOWHERE to put the 16 characters code.

It's not obvious what that 16-character code might represent.

CoPay uses a 12-word recovery phrase (sometimes called a "recovery seed" or "wallet seed")
Bitcoin private-keys are 256-bit numbers usually shown as 64 hexadecimall characters

You normally need one of those or a wallet backup file .

What you can do

Contact CoPay / BitPay
Read the CoPay FAQ
Read about CoPay recovery
Ask new questions here about anything specific you need help with.

I'm posting this answer because it could apply to any wallet application or service, but is limited in scope to regaining access to funds only (not restoring full functionality of a specific wallet application. The following requires a lot more technical work than the OP is likely asking, but the point is that it is feasible based on common standards.
According to CoPay Source, it appears to be following BIP39 standard for mnemonics (recovery phrase) and BIP32 standard for hierarchical deterministic wallets, it should be possible to regenerate your keys outside of their application.
Steps to regenerate

Generate the seed from the mnemonic (and password if originally used) following the standard method outlined in BIP39 - From Mnemonic to Seed. There are many open source libraries that implement this functionality (including CoPay itself).
Generate the key pairs in the hierarchy from the seed using BIP32 Key Derivation Standard also implemented in many projects including CoPay.
Convert the generated private keys to the required format for wallet import. Usually this is a WIF format (e.g. for Bitcoin-core wallet).

Some potential problems:

The original wallet application didn't implement BIP39 correctly, or made some changes.
You aren't able (with reasonable effort) to generate all of the keys because the hierarchical structure CoPay uses was unknown.


text:
Is there any RPC Java library using which I can call lite coin methods?
In case of bitcoin there is bitcoinj. but in Litecoin what will I use?

how to download litecoin wallet blockchain headers in android

Possible duplicate of JAVA JSON-RPC for Litecoin

Litecoin has forked the Bitcoinj project so that you can use Litecoinj
Repo's are here: https://github.com/hank/litecoinj
and here : https://github.com/hank/litecoinj-new
I think the last one is the most recent and active repo.

https://github.com/GENERALBYTESCOM/litecoinj this one is currently the most up to date, even though it's a little bit old too


text:
Is there a way to know how many of currently unconfirmed transactions in the MemPool is currently being attempted by other miners?
Assume there there 100 unconfirmed transactions currently in the MemPool. And the size of a block is such that it's roughly made up of 10 transactions.
Now when a miner completes the Proof of Work & successfully adds his block to the blockchain, any other miner who has even one of those 10 transactions in the current block he is trying to mine is going to be unsuccessful.
So my questions are

While the miners are trying to mine a block of transactions, do they also continuously keep checking (in parallel) where there is a new confirmed block in the system which includes even one of the transactions which is there in their ongoing mining block - so that they can abort their mining instead of only aborting it after they finish their work?

With everyone picking transactions to mine from the MemPool, isn't there a very, very high chance that before you finish completing your PoW, there will atleast be one new block which includes at least one of your 10 transactions?

Is there a way for a miner to check & pick only those transactions which aren't already picked by someone else for mining?

No one cares
(about what other miners are exactly working on)
Miners have no way of knowing the contents of block templates being used by other independent miners.
There is nothing in the Bitcoin network protocol that provides for miners to share what they are up to. Considering the speed at which miners must vary block templates, I imagine doing so would be infeasible or at least waste huge resources somewhat pointlessly.
The contents of those other block templates is of no interest. As soon as one miner publishes a valid block all other miners must abandon their work and restart mining regardless of what is in anyone's block templates.
Don't knowingly buy expired lottery tickets
(unless you have the resources to persuade the whole world the prior winner is unworthy?)
Continuing to work on a block template that includes a transaction that has already been confirmed would be pointless but, more importantly, The active blockchain is linear. Miners must always work on a block template that links back to the current head block. As soon as a new head appears on the active chain, miners must use it regardless whether the block is empty¹ or not, whether it contains transactions they had been working on or not.
Ultimately there can only be one block at any height n in the active chain. It is generally likely to be unproductive and wasteful to knowingly continue working to produce a second block at the same height as one you know about. The purpose of Blockchain reorganisations is to ensure that ultimately all Bitcoin nodes agree which chain is the active chain and therefore all agree exactly which block occurs at each height n.

Poolside chatter
Miners working in a pool are subject to some form of coordination but I believe the description above remains valid more generally.

See also

What does the term "Longest chain" mean?
Mining and pending events
Are there any mining pools that publish what transactions they will include?
Does mining a block force others to restart their work?

Notes

Containing no transactions other than the miner's coinbase transaction.

As soon as one miner publishes a valid block all other miners must abandon their work - is this because the prevhash included in their block already exists in another mined block?

So while miners are mining a block, there is a also another thread of the miner listening for new blocks being broadcast & if they find one, the listening threads sends a signal to mining thread to abandon the current mining.

For a transaction receiver to acknowledge receipt, it is advised that he shouldn't accept a block as a valid block till few more blocks are appended to it. Why shouldn't this apply to miners also - what if the miner ends up abandoning his current work because a fraudulent mined block broadcast which he has received?

Everyone, including miners, validate blocks. I don't think any block which passes validation can be regarded as fraudulent.

I am referring to this - https://www.youtube.com/watch?v=bBC-nXj3Ng4&t=1195s - i.e. blocks can be fraudulent but it's rejected if there is another longer chain of blocks which doesn't contain this block.

The basis for rejecting one chain in favour of another is simply it's length (or more accurately the accumulated work) - not its contents. It certainly needs no knowledge of other miners mempools or current use of mempool contents in block templates.

The terminology used for various aspects of validation differs, but I like this one: there are validity rules (like transactions need valid signatures, subsidy must be respected, can't spend non-existing/spent coins) and chain selection rules (most PoW wins). There can be multiple competing valid chains, but nodes only consider one of those to be active (based on chain selection).

@Pieter thanks. I'll link to your answer at https://bitcoin.stackexchange.com/q/5540/13866


text:
Would like to setup my own mining pool for PPC Peercoin
I have 8 different antminer ASIC's and I would like to setup my own mining pool.  I would like to mine PPC aka Peercoin.  Everything seems to be very old as far as tutorials and I am looking for something that is possible for a non-programmer to get running.


text:
Set up eclair wallet 0.3.1 but cannot send onchain funds
I filled my wallet with some btc then wanted to send coins onchain and it seems there is no that possibility ?

Seems like onchain send functionality is not implemented yet. Workaround until then is to import the 24-word seed into another wallet. This can be run in parallel with eclair without problems.

thats the problem. seems I have incorrectly written seed. and I need to transfer out coins from this wallet and more carefully write seed.

Well that sucks. If it is a significant amount of BTC, you can still set up a full lnd node on a RaspiPi or a PC, and send the funds there via lightning channel.


text:
API for montly and weekly averages
Bitcoinwisdom shows in their charts lines for weekly and montly averages. Are these numbers somewhere available in an API? If so, one could setup an automated strategy for trading BTC based on this data.

You can get the price data using the API of the exchange you want to trade at. You can then do any calculations based on that data and place orders.

I have not heard about an API that would return averages per se. But there are APIs that will provide you with a historical price data which you can use to calculate averages on your own.
One example would be CoinDesk, but I am pretty sure there are more. They have a JSON endpoint that will return closing prices for a given period (1 month by default). Examples:
Default (one months period): https://api.coindesk.com/v1/bpi/historical/close.json
Custom date range: https://api.coindesk.com/v1/bpi/historical/close.json?start=2018-01-01&end=2018-07-01


text:
What is the name of the procedure of downloading and checking the ledger for a new node?
When a new node connects for the first time to the Bitcoin network, it first needs to determine what is in the ledger, and what is not. As far as I understood, it does so by connecting to the Bitcoin overlay network, downloading the blockchain and checking all the proofs of work. In case of multiple blockchains found, it just selects the longest and commits its transactions on top of that one.
Now, I wonder: does this process have a name? The process to start from scratch and determine what the state of the ledger is? I usually call it bootstrap but I am not sure whether or not it is the correct term to use.

The state a full node is in while it is aware it is significantly behind the rest of the network is called initial block download, or IBD. Being in IBD makes the node make different tradeoffs, like preferring bandwidth over latency, and more aggressively batching operations.
While downloading blocks, getting a node closer to the most-work chain tip, block validation happens. This includes sanity checking the received data, verifying its difficulty and proof of work claims, checking that all coins spent by its transaction inputs exist and haven't been spent already, verifying the scripts and ECDSA signatures, and marking the inputs as spent and remembering the outputs created as being available for spending.
The whole process of learning and downloading and validating new blocks to get to the same knowledge other nodes have is called synchronization.


text:
UTXO snapshots and history pruning
Is there a research, BIP proposal or simple discussion about possible improvement on the size required to run a full node and a way to shrink/prune the history of bitcoin and have fast sync?
Let me try to narrow a bit the topic: would be interesting to have a way to have fast node sync, with few memory required to store an updated "fullnode".
I was thinking if may be useful to have a kind of UTXO snapshot periodically (let say every 2016 blocks) where a node would generate a UTXO snapshot and put the hash (a merkle tree hash or whatever struct fits well) in the block header
having this, nodes may do a lot of different kind of sync based on their needs, e.g. they may validate "header first" by using these "snapshot headers", require a specific snapshot using something similar to "assumevalid" without the need to validate all prior transactions nor having to download blocks, because the utxo set is all what they need to validate next blocks on top of the snapshot height. Of course such nodes can't serve old blocks, similar to how pruned node ares, but they can validate and sync fast.
Of course my thought isn't indeep this is why I'm wondering what's current state about this topic because I'm quite sure it's something that periodically pops out.
Beside this, I've a more broader question, that may sound a bit rhetorical but still legit: is bitcoin history that important? Having snapshots (as consensus, every node has to generate it at the same height, its hash has to be stored on block header, etc...) could theoretically cause the block containing the snapshot act as a new genesis that move bitcoin ahead An utxo that's spent, isn't useful anymore like a transaction that have all its utxo spent, so removing them shouldn't cause any harm except probably transactions using OP_RETURN but they may be stored in another kind of "DATA Snapshot".
I can't think about a valid reason (except of course for initial sync) that makes the full history of bitcoin needed to be stored and served, did I miss something?
this kind of "dynamic genesis" still would allow a node that chose to store the whole chain compatible with a node that want to start from last snapshot, everyone can validate and serve blocks (of course the latter could serve only from snapshot genesis). It's kind of similar to what we have with checkpoint with the difference that's set in consensus and not hardcoded in code (that's one of the reason why checkpoint failed)
Open to criticisms that add something to the discussion.

Search for the assumeutxo project. You don't want to trust a UTXO snapshot just because a miner included it in a block (miners behave honestly because nodes verify their blocks - trusting a claimed UTXO would invert that relation), but with sufficient eyes - similar to those already needed for full node software review - it's a completely reasonable thing to not let everyone completely validate all of history.

Besides that, this seems more of a discussion topic than a topic suitable for a Q&A site.

do you mean this could be posted on bitcoin ML?
anyway if these snapshots are generated every XX blocks (in my example the difficult retarget window) every miner will have to include the utxo snapshot hash in the block and whoever want to generate a fake one, has to generate it with an higher chainwork that in any case can be rolled back if another chain prove to have more work.
So it should be safe to sync starting from second last utxo snapshot (so from TIP height - (snapshot timeframe + 1, 2017 in this example)
Will take a look at your referenced project, thanks


text:
Bitcoin transfeered to wrong address
I'm new to copay.  I just transferred money to a bitcoin address but for some reason, Copay transferred it to my own account.  I had to pay a miners fee for this which cost a lot of money.  How can I contest this?  I put in the correct address but it did not go there.

Are you sure that you are not confusing this with change? If the inputs to the transaction were greater than what you wanted to pay, some of that will be paid back to your own wallet as change.

Its on Copays end so open a support ticket with them and see if they will refund you the miners fee and the fee for the bitcoin to go to the correct address. Purely an issue on their end and nothing you can really do on the Bitcoin network.