text:
How to determine right address from address hash
I'm using private libbitcoin server and libbitcoin explorer.
When I use bx fetxh-transaction, it returns something like:

I'm trying to figure out, how to get right address from address_hash.
When I use bx base58check-encode for input address_hash without version (or -v 0) it returns:

When I use bx base58check-encode -v 5 it returns:

Check by blockexplorer shows the second way is right.
My question is: How to determine base58check-encode version to generate right address?
Thank you.

Your address 32feVAD9Haq1CtfT6JCLTt4L5qef3UnVpY is a P2SH mainnet address, with a 05 address prefix and represents the base58 encoding of the following data:

[05][20-byte hash][4-byte checksum]

So, the [05] prefix tells your wallet that your address represents a P2SH embedded script presage (20B).
On the other hand, a [00] prefix tells your wallet that the 20B digest represents a Public-Key-Hash, and that funds should be sent to a P2PKH (Pay-2-Public-Key-Hash) output.
The version number therefore gives your wallet the necessary information to produce the correct output type when sending funds, so that the recipient has the private keys (P2PKH) or presage (P2SH) to spend them.
The 05 prefix translates to a 3 in base58 encoding, which is why your addresses begin with 3. I cannot comment on what the embedded script type is though, since the P2SH has is simply the 20B hash-digest thereof. Perhaps a P2SH(P2WPKH) script type.
Amended Answer:
To determine the address version appropriate for a specific output from a transaction, simply look at the output script in question.

P2PKH: "hash160 [20B] equal" -> version 5
P2SH: "dup hash160 [20B] equalverify checksig" -> version 0
P2WPKH: "[00] [20B]" -> bech32 address

Thank you for response. Bx explorer returns address_hash as shown above, but my problem is how to correct determine version from bx response. Other blockexplorers like blockchain.info or bitpay insight shows right address, so there is a way to determine the right version. Miss I anything?

You mean how to decode the version from an address, such as 32feVAD9Haq1CtfT6JCLTt4L5qef3UnVpY? Try bx address-decode 32feVAD9Haq1CtfT6JCLTt4L5qef3UnVpY

No. I want to use bx fetch-tx result to generate address. It returns address_hash and bx base58check-encode returns address. But only with right version choosen it leads to the right address. My problem is to determine the right version.

I see. You have to examine the output scripts when you fetch the tx. The output script pattern (P2SH or P2PKH etc.) will tell you what version is required (05 or 00 etc.). BX doesn't recognise script patterns for you. Libbitcoin-System has internal methods which check for standard output script patterns, if you want to look into the Libbitcoin C++ library.

If this answer helped u, your up/downvote/check would be appreciated either way. Thank you.


text:
Sent BTC to public key instead of my address
Friend of mine was trying to buy BTC from ATM, instead of BTC address he scanned the public key from coinomi wallet (I dont know why the ATM accepted it, but it did). Is it possible to somehow access the BTC? Thanks!

Seems there is a little confusion here: are you talking about private keys or bitcoin address in form af a public key?
Anyway in coinomi wallet you cannot display any kind of uncompressed xPub or similar keys, so he should have sent the funds to a proper BTC address.
Otherwise he tried to send BTC to a private key but this should be impossible by protocol definition. Even if the BTM scanner somehow accepted a priv key as an input the software should recognize the issue and would stop the operation.

Yes I'm guessing he sent the money to a bitcoin address and the user is simply confusing that with a public key. Newbies often make this mistake. It doesn't help that people start talking about public addresses and private addresses.

Public keys, private keys and bitcoin addresses are different things. Using bitcoin script you can create arbitrary spending conditions.

Newbies often make the mistake of confusing bitcoin addresses with public keys. An address is derived from the public key but it isn't the public key. It is a hash plus checksum of the public key. Because it contains a checksum the sender can validate that the address was entered correctly before sending bitcoins to it. Most likely the user is the one who is confused. He supplied a bitcoin address and not a public key. He just doesn't know the right terms to use.

Well then where would the btc be.. I meant public key, i suppose that their front-end on the BTM is coded wrong and the BTC money wasnt assigned anywhere, it just ate the money.

What public key or bitcoin address did he give the machine?

Is it possible to somehow access the BTC?

You say the BTM used a public key as a bitcoin-address. That shouldn't be possible but maybe it's a flaw in the BTM software.
You cannot access BTC associated with a bitcoin-address for which you have no corresponding private-key.
You cannot generate or discover a private-key from an address
If what you say is true, that BTC amount has joined the 20% of all BTC that are lost forever.

I don't know about how the specifications of the ATM or the Coinomi wallet, but it is absolutely possible in Bitcoin to send coins to a public key, rather than an address. This is slightly less secure than sending to a never-before-used address (because it exposes the public key), but it's still perfectly fine to do. If that's what happened, then yes it will be possible to spend the bitcoins, as long as your friend has the private key.
To get a bit more technical, a Bitcoin address starting with a 1 is a hash of a public key. When you go to spend bitcoin that has been sent to your address, you must provide both:

A signature (generated with your private key), proving you own the public key
The public key itself, proving that it matches the address

When money has been sent to your public key, you don't need to again provide the public key to spend that money; you just need the signature. So as long as you have the private key, it's possible to generate the signature you need to spend the money sent to the public key.

source: Stack Exchange

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

sort: votes


text:
How to understand wallets?
I'm trying to generate a mnemonic seed, and everything that goes with that. I'm using c++ / libbitcoin, using the following code - https://github.com/libbitcoin/libbitcoin-system/wiki/Examples-from-Addresses-and-HD-Wallets
When I compile & run the following code - get this output
Address, WIF, Wallets:
13ggzjqKyFGQZtxNWUoG4BFDPAgdBijUe4
L5PbbAgFUENjW7XjzPBSMUwtVpV8S62cXq14cwUGDdCq1xt1SiNU
13ggzjqKyFGQZtxNWUoG4BFDPAgdBijUe4
L5PbbAgFUENjW7XjzPBSMUwtVpV8S62cXq14cwUGDdCq1xt1SiNU
1

Mnemonic Word Lists:
family episode combine ask flee weekend sword spatial vibrant leg style fancy

When I take that generated mnemonic and put it in this site - https://iancoleman.io/bip39/
I am getting completely different paymeny addresses.
Digging through the source code of libbitcoin it has very little function documentation & this is the only code sample I could find. So can someone help me generate a wallet in libbitcoin where the data is recognized by other wallets/services? Thanks.

The address 13ggzjqKyFGQZtxNWUoG4BFDPAgdBijUe4 is generated from a different word list, not the one you mentioned.

How can I verify that in code - in libbitcoin how do I generate addresses from word lists?

Check this wiki.

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


text:
Backup of a bitcoind wallet using the extended private masterkey only
If I understand correctly, bitcoind makes use of a extended private masterkey in order to deterministically generate private/public keys for a wallet.
Using the dumpwallet command, I'm able to get access to this extended private masterkey.
My questions:
1) If I only backup that extended private masterkey, would I be able to recreate the wallet entirely in case my application crashes? Or do I really need to backup the wallet file itself? (Let's say I do not import addresses that were not generated by bitcoind itself.)
2) I heard that changing the passphrase of a wallet would change the extended private masterkey... Is that true?
3) If #2 is true, can I simply backup all generated extended private masterkeys (every time I change the passphrase) to be able to recreate the wallet entirely using those multiple extended private masterkeys? What would be the command to run to recreate the wallet from more than one extended private masterkeys?

1) If I only backup that extended private masterkey, would I be able to recreate the wallet entirely in case my application crashes? Or do I really need to backup the wallet file itself? (Let's say I do not import addresses that were not generated by bitcoind itself.)

No. Bitcoin Core does not allow your to create a wallet from the master private key. There is no way to import it into a newly created wallet or to create a new wallet with a master extended private key.

2) I heard that changing the passphrase of a wallet would change the extended private masterkey... Is that true?

Only setting the password will change it. Subsequent password changes will not change any of the private keys in your wallet.

An important thing to note here is that Bitcoin Core does not use an extended private key. Rather it uses a HD seed (as defined in BIP 32). When keys are being generated, that seed is hashed to get the extended master private key, and from there the child keys are derived. That extended master private key is never stored in the wallet file itself.
Instead of backing up the master private key, you could instead backup the HD seed. This can also be found in the dumpwallet output and it will be listed as hdseed=1. It will look like a normal private key and be presented in Wallet Import Format.
Once you have the seed, you can create a new wallet and set it to use your backed up seed using the sethdseed command.

If I understand, I backup this special hdseed=1 private key, and I'll then be able to recreate the wallet from scratch, even if I set and change the passphrase after that? (Thanks a lot for the help!)

Yes. The HD seed is effectively the same thing as the extended master private key. However, other wallets probably won't be able to import it.

@AndrewChow: Do you mean the exact HD algorithms of Bitcoin Core are not standard (or can be considered a de-facto standard) and any vendor is actually free to implement HD in any way differently than what Bitcoin Core does?

@Mercedes No, Bitcoin Core follows BIP 32. It is just that Bitcoin Core does not expose the same information that other wallets typically do.


text:
Huge dependency graphs for transactions in mempool
I'm creating a web page to monitor bitcoin mempool https://mempoolexplorer.com/ and I've realized that sometimes exists huge transactions dependency graphs in the mempool.
I'm talking about +-700 transactions which depends among them, and although no mempool rule is broken, i.e. max mempool ancestors for a transaction, I'm puzzled about what can be doing this kind of dependency graphs.
I've stored some graphs in json format: https://gist.github.com/dev7ba/c144c68127b97082652bc860cc95edf6 and https://gist.github.com/dev7ba/50167d6e336100698ab2599123444efc that contains some examples of those graphs.
Those gists .json are created by the backend of my web page that you can call it here: https://mempoolexplorer.com/txmempool/miningQueueAPI/tx/{txIdHere} to obtain a transaction statistics currently in mempool. See txDependenciesInfo.nodes and txDependenciesInfo.edges data to obtain the dependency info.
Also, as it's difficult to obtain a transaction with dependencies, I've created a section https://mempoolexplorer.com/txsGraphs or https://mempoolexplorer.com/txmempool/miningQueueAPI/txGraphList which lists all the dependency graphs that exists currently in the mempool, with the transactions set, and whether the graph is linear or not (i.e. using Child Pays For Parent several times instead of BIP-125).
Be aware that mempool is refreshed in the back-end each 5 seconds. But if the mempool is too large:  >30000 transactions, graphs calculation will be omitted to avoid high overload.
Thanks.

What's your question?

Well, What can be the usefulness of these transactions graphs? Are they any kind of attack? Who is producing them? I'm really curious about them. Are they worth of investigation? Thanks for your time.

The most plausible answer is that those graphs are caused by wallets when there is not enough available UTXOs for the amount of recipients.
i.e. If you only have 2 UTXOs and you have to make 10 payments at the same time, wallets uses the unconfirmed UTXOs as TX inputs, creating those dependency graphs.


text:
Transaction being ignored by miners, I mean Ignored, Not "not mined because low fees"
I'm working on a project to visualize the mempool and (also) check if a transaction is being ignored by miners.
I have my own mining queue, to compare "my first block" with the block that has been mined. Comparing that block with mine I can take many statistics about weather a miner is choosing the best txs and/or is behaving correctly.
Project is currently in development and I have the backend more or less complete. Front-End is incomplete. So sorry if I can give you a link to it.
Today I've found that tx c3f92fe9ec20218a8c3d38b4852c9a88779d3128abdd43ac8c249207d8d3b530 has been ignored 86 times until now. And currently It's the first transaction that should be mined with 786 sat/VByte.
My bitcoin node shows that this transaction entered my mempool 20 hours ago. It's a short transaction with only 764 weight units, one input, one output, 0.24 bitcoins. Nothing special?
Also, my bitcoin node is using the tor network.
The transaction does not appear in known blockchain explorers so it seems that it has not been relayed properly. The transaction has bip125 enabled, so it could be that the person or entity broadcasting that transaction had increased many times the transaction fee.
So I'm wondering what is happening with this transaction. Anybody out there has any idea?
Maybe bitcoin nodes in tor network has poor conectivity with miners?
FYI: These are the blocks who has ignored the transaction up to date:
height: 654568,
totalTxNumMined: 2762,
postitionInQueue: 5
},
{
height: 654569,
totalTxNumMined: 2746,
postitionInQueue: 4
},
{
height: 654570,
totalTxNumMined: 2177,
postitionInQueue: 1
},
{
height: 654571,
totalTxNumMined: 3044,
postitionInQueue: 2
},
{
height: 654572,
totalTxNumMined: 2824,
postitionInQueue: 0
},
{
height: 654574,
totalTxNumMined: 0,
postitionInQueue: 1
},
{
height: 654575,
totalTxNumMined: 2706,
postitionInQueue: 3
},
{
height: 654576,
totalTxNumMined: 2515,
postitionInQueue: 0
},
{
height: 654578,
totalTxNumMined: 3141,
postitionInQueue: 3
},
{
height: 654579,
totalTxNumMined: 3040,
postitionInQueue: 6
},
{
height: 654580,
totalTxNumMined: 2501,
postitionInQueue: 0
},
{
height: 654581,
totalTxNumMined: 2399,
postitionInQueue: 1
},
{
height: 654582,
totalTxNumMined: 2889,
postitionInQueue: 1
},
{
height: 654583,
totalTxNumMined: 2098,
postitionInQueue: 1
},
{
height: 654584,
totalTxNumMined: 2973,
postitionInQueue: 5
},
{
height: 654585,
totalTxNumMined: 2135,
postitionInQueue: 4
},
{
height: 654586,
totalTxNumMined: 2451,
postitionInQueue: 6
},
{
height: 654587,
totalTxNumMined: 2312,
postitionInQueue: 8
},
{
height: 654588,
totalTxNumMined: 2614,
postitionInQueue: 5
},
{
height: 654589,
totalTxNumMined: 2946,
postitionInQueue: 2
},
{
height: 654590,
totalTxNumMined: 3170,
postitionInQueue: 0
},
{
height: 654591,
totalTxNumMined: 2624,
postitionInQueue: 7
},
{
height: 654592,
totalTxNumMined: 2638,
postitionInQueue: 4
},
{
height: 654593,
totalTxNumMined: 2988,
postitionInQueue: 0
},
{
height: 654594,
totalTxNumMined: 2781,
postitionInQueue: 11
},
{
height: 654595,
totalTxNumMined: 2486,
postitionInQueue: 3
},
{
height: 654596,
totalTxNumMined: 2423,
postitionInQueue: 0
},
{
height: 654597,
totalTxNumMined: 2526,
postitionInQueue: 0
},
{
height: 654598,
totalTxNumMined: 2973,
postitionInQueue: 1
},
{
height: 654599,
totalTxNumMined: 2866,
postitionInQueue: 0
},
{
height: 654600,
totalTxNumMined: 2910,
postitionInQueue: 10
},
{
height: 654601,
totalTxNumMined: 1814,
postitionInQueue: 0
},
{
height: 654602,
totalTxNumMined: 2642,
postitionInQueue: 0
},
{
height: 654603,
totalTxNumMined: 2572,
postitionInQueue: 0
},
{
height: 654604,
totalTxNumMined: 2068,
postitionInQueue: 0
},
{
height: 654605,
totalTxNumMined: 2300,
postitionInQueue: 1
},
{
height: 654606,
totalTxNumMined: 1911,
postitionInQueue: 3
},
{
height: 654607,
totalTxNumMined: 2503,
postitionInQueue: 0
},
{
height: 654608,
totalTxNumMined: 2060,
postitionInQueue: 1
},
{
height: 654609,
totalTxNumMined: 1666,
postitionInQueue: 5
},
{
height: 654610,
totalTxNumMined: 2241,
postitionInQueue: 1
},
{
height: 654611,
totalTxNumMined: 1947,
postitionInQueue: 0
},
{
height: 654612,
totalTxNumMined: 1496,
postitionInQueue: 0
},
{
height: 654613,
totalTxNumMined: 2140,
postitionInQueue: 4
},
{
height: 654614,
totalTxNumMined: 2460,
postitionInQueue: 0
},
{
height: 654615,
totalTxNumMined: 1338,
postitionInQueue: 2
},
{
height: 654616,
totalTxNumMined: 2320,
postitionInQueue: 0
},
{
height: 654617,
totalTxNumMined: 2394,
postitionInQueue: 2
},
{
height: 654618,
totalTxNumMined: 2630,
postitionInQueue: 1
},
{
height: 654619,
totalTxNumMined: 2858,
postitionInQueue: 0
},
{
height: 654620,
totalTxNumMined: 2097,
postitionInQueue: 0
},
{
height: 654621,
totalTxNumMined: 2856,
postitionInQueue: 5
},
{
height: 654622,
totalTxNumMined: 2379,
postitionInQueue: 1
},
{
height: 654623,
totalTxNumMined: 2585,
postitionInQueue: 5
},
{
height: 654624,
totalTxNumMined: 2434,
postitionInQueue: 2
},
{
height: 654625,
totalTxNumMined: 2032,
postitionInQueue: 6
},
{
height: 654626,
totalTxNumMined: 2667,
postitionInQueue: 4
},
{
height: 654627,
totalTxNumMined: 2521,
postitionInQueue: 1
},
{
height: 654628,
totalTxNumMined: 2662,
postitionInQueue: 1
},
{
height: 654629,
totalTxNumMined: 2313,
postitionInQueue: 1
},
{
height: 654630,
totalTxNumMined: 1995,
postitionInQueue: 0
},
{
height: 654631,
totalTxNumMined: 2330,
postitionInQueue: 0
},
{
height: 654632,
totalTxNumMined: 2588,
postitionInQueue: 0
},
{
height: 654633,
totalTxNumMined: 2775,
postitionInQueue: 3
},
{
height: 654634,
totalTxNumMined: 2604,
postitionInQueue: 0
},
{
height: 654635,
totalTxNumMined: 2135,
postitionInQueue: 0
},
{
height: 654636,
totalTxNumMined: 2540,
postitionInQueue: 2
},
{
height: 654637,
totalTxNumMined: 2244,
postitionInQueue: 0
},
{
height: 654638,
totalTxNumMined: 1231,
postitionInQueue: 1
},
{
height: 654639,
totalTxNumMined: 2367,
postitionInQueue: 1
},
{
height: 654640,
totalTxNumMined: 2370,
postitionInQueue: 0
},
{
height: 654641,
totalTxNumMined: 2935,
postitionInQueue: 4
},
{
height: 654642,
totalTxNumMined: 2453,
postitionInQueue: 1
},
{
height: 654643,
totalTxNumMined: 2414,
postitionInQueue: 0
},
{
height: 654644,
totalTxNumMined: 3102,
postitionInQueue: 6
},
{
height: 654645,
totalTxNumMined: 3211,
postitionInQueue: 5
},
{
height: 654646,
totalTxNumMined: 2561,
postitionInQueue: 0
},
{
height: 654648,
totalTxNumMined: 1931,
postitionInQueue: 10
},
{
height: 654649,
totalTxNumMined: 2578,
postitionInQueue: 2
},
{
height: 654650,
totalTxNumMined: 2588,
postitionInQueue: 0
},
{
height: 654651,
totalTxNumMined: 3038,
postitionInQueue: 7
},
{
height: 654652,
totalTxNumMined: 1305,
postitionInQueue: 0
},
{
height: 654653,
totalTxNumMined: 2260,
postitionInQueue: 3
},
{
height: 654654,
totalTxNumMined: 2627,
postitionInQueue: 1
},
{
height: 654655,
totalTxNumMined: 1980,
postitionInQueue: 2
},
{
height: 654656,
totalTxNumMined: 2645,
postitionInQueue: 0
},
{
height: 654658,
totalTxNumMined: 2861,
postitionInQueue: 5
}```

Is it possible that the transaction depending on unconfirmed inputs? It would help if you provided the full transaction, especially its input set.

No, the transaction was not dependant on any other, (my project even draw a graph of txs dependencies). but sadly I've had to delete mempool.dat of my mempool node since my algorithm was not performing fine under the big mempool of last days, the cpu was 100%, and my computer was stuck. Anyway I'll be monitoring the mempool next days. If I found any other Txs. I'll let you know. By the way I'll read your Master Thesis next days. ;-) Thanks.

I agree with Chytrik, my first bunch would also expect some other issue at play. I'll be curious to hear about it when you find another.

fa0dee70658fd00d6d205f673e79e3481cdba57100db576f2a7a308591a1c5e0 does not appear in https://mempool.observer/ nor https://blockstream.info or https://mempool.space Pays 64 sat/VByte which is now enough  to be mined. Has been ignored 14 times from block 655212 to 655227 by miners: huobi, bitdeer, 1thash&58coin, poolin, antpool, f2pool, btc.com and binance.

Depends on txs: b6bc98c8d29893f2a6e04fa3bd84f60958293739dbec0af8670c446247c3c923, 23dff917408de07b05762ceb3ebe90b07889e5da6ed74d8f4d607d3bae20705e, 414ba5ca29d582452d101a26c944b2a8ffa3e0c6407215ca0ef08c9d5dd3e0d8, f9d4f7cc3cae21da8ed864654db405dcbc90a43e811ebafa999aa83c1ec323c9, 0020bc825433a7f085afcd3288f6eb7868b806bb9efa6461ad1e7e1f2b733138 each one been confirmed 30000 blocks ago...

I cannot paste the hexadecimal representation here because it's too long. weight: 3116. Do you need more information?

I don't see the transaction on blockexplorers. I think it might be non-standard. Could you post the tx in a gist on github for example?

Great, thanks. The tx is invalid. See my answer

Regarding to the second transaction: It seems that it's a replacement for another transaction: https://blockchair.com/bitcoin/transaction/3791f433180a6807695da26e1c0b7f7328a15cbe727ad4ce7c7acbc18b77c5a0
but it does not allows replacement by bip 125.
As I'm stopping my development node when needed, it seems that this transaction was not in my node before receiving the second one (fa0dee70658fd00d6d205f673e79e3481cdba57100db576f2a7a308591a1c5e0). So it was accepted. The other node I have (pi4) rejects that transaction because its online all the time, and had tx 3791f433180a6807695da26e1c0b7f7328a15cbe727ad4ce7c7acbc18b77c5a0 before.
In brief: Some people/program was sending a replacement for a transaction which does not allow it and my node took it as the original.
Thanks a lot @Murch

Right, the original transaction had set all its nSequence numbers to final, so it was not marked for replacement. Therefore the replacement got ignored per the first-seen-safe rule. To read more see https://bitcoin.stackexchange.com/a/49518/5406

For anyone wondering how to seach for transaction outputs in the mempool: blockchair.com has a beta API which allows some queries by value or address. https://blockchair.com/api/docs#link_400

I've checked my node, and it has no evidence of transaction c3f92fe9ec20218a8c3d38b4852c9a88779d3128abdd43ac8c249207d8d3b530.
Additionally, I checked a couple of block explorer websites, and none of them show any result for this transaction.
So it seems that this transaction was either not relayed through the wider network, or it was dropped by network nodes for some reason (network fees have been very high, some mempools might be hitting their memory limits). Without additional information, it is not possible to know.
Generally, we wouldn't expect all miners to ignore a high-fee-rate transaction, so there must be some other issue at play.

I'm looking into the second tx posted by the asker: fa0dee70658fd00d6d205f673e79e3481cdba57100db576f2a7a308591a1c5e0
It doesn't appear on any explorers. I noticed that all inputs were listed as being vout: 0, e.g. the input list states
{
  "addressIds": [
    "123h581GZtFAucMPpa3hFBCedEifaka5g9"
  ],
  "amount": 76559401,
  "txId": "f9d4f7cc3cae21da8ed864654db405dcbc90a43e811ebafa999aa83c1ec323c9",
  "coinbase": null,
  "voutIndex": 0
},

for one of the inputs.
However, the unspent was actually the sixth output (vout: 5) when it was created:

When I put the txhex into https://blockstream.info/testnet/tx/push, it fails with sendrawtransaction RPC error: {"code":-25,"message":"bad-txns-inputs-missingorspent"}.
.
The transaction is invalid due to incorrectly specifying the output list position of the UTXO used in the inputs.

I'm missing something... then why that transaction is in my mempool? I thought that bitcoin nodes discards incorrect transactions. I have not generated it... I'm puzzled.

What node software are you using?

By the way there is a mistake in the json I've sent you. I'm sorry. It was taken from my program instead from bitcoin-rpc. It seems that not all vouts index are 0. but my program are not taking them correctly (I bet I have fogotten a setter somewhere) . anyway something is wrong because the hex value I've sent you is correct.

I'm using bitcoin core 0.20.1 on ubuntu

I'm getting nervous. F**k me if I've discovered a consensus bug. O_o

I have two nodes: one in a raspberry pi and other in my pc. I use Raspberry pi for having the best mempool I can (always online). The other pc is used for development and it's shutdown when needed. When I need a "good" mempool in my pc I use a tool to query all tx in a mempool and send them to the other node. See https://bitcoin.stackexchange.com/questions/63675/synchronize-mempool-between-3-nodes The node that has accepted that tx is the development one. not the pi4. both are 0.20.1 versions. Now I'm sending that transaction from the pc to the pi4. but I get an error code

My mistake, you are correct, the vouts in the txhex are correct.

I found this though: https://blockchair.com/bitcoin/transaction/3791f433180a6807695da26e1c0b7f7328a15cbe727ad4ce7c7acbc18b77c5a0

Let us continue this discussion in chat.


text:
I've found two mined txs with no fee
I was debugging my little project and I've found this pair of txs without fees (they caused an alarm):
[txId=e8f6f08430ab6b1f3e645f499cf90c69acf2eb8a8d9766abb9d76314f29209dd, fees=0, weight=879600], [txId=cf7ba67c57d72dc735c200f5bf81789f6464adf65816b7640562d38a8c706a05, fees=0, weight=16052]}
both in block 618858.
first one is very heavy (almost a quarter of a block).
just curiosity. Do I have to suppose that it's probably the miner the one who has auto-sent this tx?

A transaction having a fee is not a consensus rule. Although the vast majority of nodes refuse to relay a 0 fee transaction, it is valid.
Such transactions can be included in a block by directly passing them to a miner, and would tend to belong to the miner themselves, or someone they have some kind of relation with.


text:
Please help Txhash
i looked up my txhash on etherscan and the (from) address does not match my own. I verified the (To) address and it is correct. Even the value is the same as my purchase. How is this possible? What are my options? Please help

Why do you think it's not your own? Transactions don't have a 'from' address, it's possible etherscan made a mistake in guessing who it's from. But more likely it is one of your addresses, perhaps a different one to the one you thought, such as a change address. Or if you're using an exchange or web wallet, it might just be from another one of the UTXOs that exchange/wallet has, not deposited to you

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


text:
Is there any way to send transactions to a bitcoin node via RPC avoiding its broadcasting to the network?
If you use sendrawtransaction RPC call it will be "sent unconditionally to all peers" as the help says.
But if you only want to fill a mempool with transactions programmatically, is there any other way?

I don't know of a way to do that in Bitcoin Core today. Generally, the goal is for the mempool to be a prediction of what transactions may be mined next; that also implies letting other nodes know about things added to yours.
This functionality does exist internally however, as it's effectively used when loading the mempool.dat file from disk on startup. So it's probably not too hard to add such a feature if you're capable of developing it yourself.


text:
Can't import BIP32 key into electrum
I always struggle here and tried both ways plenty of time
i use the rubygem "moneytree" and electrum 3.3
@master = MoneyTree::Master.new
@master.to_bip32(:private)

this will give me tprv8ZgxMBicQKsPe8hnfLVQdtZk2qMKnnDQs2ZKLgoJQBhedKQ5vB7srAb6Tk2iUYNkhaacTjNP9WzkbjCqPjk8ExUFGECbiR1Z8tZDs76jytn
however, i can't import this in electrum. the next button is just non active.

i tried the other way around and created a wallet with seed fabric body bright coffee special music virus raccoon side double shield shrug and exported the master public key which will gives me xpub661MyMwAqRbcGq54zC5FfD3rTjgcAGd36JvtW6r4RGheQjSdUVqAS9Q1DLAvzyvvxdYziZced4Y6kHLCqo73vuB4gGSpt6tJwtCWYm8zsBb
now i'll run the following
master_pub_key = "xpub661MyMwAqRbcGq54zC5FfD3rTjgcAGd36JvtW6r4RGheQjSdUVqAS9Q1DLAvzyvvxdYziZced4Y6kHLCqo73vuB4gGSpt6tJwtCWYm8zsBb"
$bitcoin_root_node = MoneyTree::Node.from_bip32(master_pub_key)

i = 0
20.times do
  p $bitcoin_root_node.node_for_path("m/0/#{i}").to_address
  i+= 1
end

all generated addresses will look like this
mpQPcBLyTqPPCw9dhdXYm3Dvnnn58Y4dwA
mt6UdprJNAuJUtG3BYWTy3dZrST7nZTwtZ

starting with a small M
however, in electrum all the addresses are starting with 1xxxxx
what am i doing wrong?

It looks like in some places you're using testnet addresses (tprv.., m..) and in other places you're using mainnet addresses (xpub.., 1..). If your software is expecting one and gets the other, then you'll likely have some problems (like Electrum not letting you click 'next'). Check to make sure all the software you're using is configured to give you the desired outputs.
See: https://en.bitcoin.it/wiki/List_of_address_prefixes

thanks buddy. i used my own fork where i made testnet true unless specified otherwise. i forgot about. i'm so stupid :)


text:
Import / create a Wallet from a key with bitcoind or bitcoin-cli to use as a hotwallet?
i've created a HD Wallet via (https://github.com/GemHQ/money-tree)
i would like to take the private key and throw that into my daemon so i can listen on incoming transactions and also transfer the funds to our coldwallet via RPC calls.
how do i create a wallet.dat via privatekey only so that my daemon can open it?

You can use the importprivkey and importmulti RPC calls in bitcoin-cli to do this.

i figured out, it's more secure to not import the privatekey. just generate the adresses and put them on watchonly, so the wallet is just monitoring incoming transactions


text:
request btc payment when insufficient btc sent
If a transaction was made and not enough btc to cover it, what are the options to add to the btc to cover the transaction.  How does the request payment work in this instance?

A transaction implicitly includes a transaction fee that pays to the miner. Are you talking about a transaction that does not have a high enough fee rate to get confirmed in the blockchain? Or something else?

(from sender's perspective) see Replace-By-Fee (RBF) - BIP-125. Samourai Wallet supports it.


text:
Why my bitcoin node does not show the same mempool size than a web blockexplorer?
It's supposed to match after a while. When several bitcoin nodes are running for days they should have the same mempool, but my bitcoind node shows arround 2k transactions less than blockchain.info webpage. My mempool size limit is 300Mb and at the moment of writing is arround 16Mb. Why is this happening?

Mempools between nodes will be different. There is no "supposed to match after a while" as the mempool does not have anything that makes all nodes' mempools converge to the same thing. There is no "the mempool", there is only "a node's mempool" and these will differ based on the settings for accepting transactions.
The settings on your node's mempool are likely much stricter than the settings for blockchain.info's mempool since blockchain.info shows data for a variety of transactions that most nodes will reject (e.g. transaction fees less than 1000 sat/kB, creating dust outputs, unconfirmed transaction chains longer than 20 txs, etc.).

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


text:
why 'increasing the block size above 1 MB requires a hard fork.” actually not require fork?
in this link, they say

“increasing the block size above 1 MB requires a hard fork.” In this
  example, an actual block chain fork is not required—but it is a
  possible outcome.

but i can't understand why actually it not require block chain fork. when block upgrade, soft fork or hard fork will occurred. but it say both of fork is not required actually.
thanks for your help :)

Block size is already above 1 MB and it didn't take a hard fork.

The definitions here are a bit confusing. It is important to understand the distinction between the "soft/hard fork" and the "blockchain fork".

Blockchain fork is an actual split in a chain of blocks. If two groups of people run incompatible software - two different chains will emerge. For example, Bitcoin and Bitcoin Cash follow two different chains that used to be one chain.
Soft or hard fork is a mechanism of performing consensus rule changes. Hard fork upgrade has a risk of causing a blockchain fork, but it does not have to cause it. If everyone will upgrade in time, there would be no chain split. For example, Ethereum has performed multiple "upgrades" through hard forks (such as Byzantium), and the chain did not split. Bitcoin prefers to stay on the safe side and introduces most of the changes to the protocol as soft forks.

To add to the confusion there are also user-activated forks and miner-activated fork, but these are not relevant to the question.

thanks but i have one more question. in individual miner's[like me :)  ] side, how UASF 's agree and disagree is considered?

@user10865941 as a miner you also run a full node, so your vote is considered together with all other nodes. Also if UASF is very popular, your blocks may have a higher chance of being propagated through the network, so in theory you have an advantage as a miner.

First of all, current block size is not 1MB. Segwit soft fork (defined in BIP-141) allowed packing more transactions in a block by moving the witness data (signatures) outside the transaction. The current theoretically allowed weight of the block is 4,000,000 bytes. A little more on how this was achieved without a hard fork is at the end of the answer.
Now coming to your question, as to why a hard fork is required in order to increase block size, we need to understand when a hard fork should occur. A hard fork is a change in consensus rules that are not forward compatible. That means, previous consensus rules will lead to blocks mined after a hard fork as invalid. When a block is mined and propagated across the network, the full nodes first check the block across the different rules to ensure that the block is valid. One of the rules include checking that the block size is below 1MB. Thus including blocks with sizes above 1MB will require nodes to upgrade their consensus rules to verify such block sizes.
Segwit allowed increased block weight with a soft fork (back-war. That means, that the previous consensus rules still declare the new block weight as valid. This was achieved by taking the witness data (signatures that verify the transaction) outside the transaction data. For a non-Segwit aware client (one that did not upgrade to Segwit) these transactions will appear to be locked with signature that anyone can spend and hence are also valid. However, a Segwit aware client sees the Segregated Witness output and expect to find a valid witness for it in the transaction's witness data.


text:
Good documentation on starting bitcoind and bitcoin-cli after building them on Ubuntu Bionic
I have been following Antonopoulos book but it seems to be outdated.
I am having elementary problems. Which command to run when, after I build bitcoind and bitcoin-cli. How am I to get blockchain to start downloading?
Start with the infamous bitcoin.conf which doesn't exist and nobody knows exactly how it should come into existence.

:~/.bitcoin$ bitcoind -datadir=/mnt/d/blockchain -txindex=1 -daemon
  Bitcoin server starting

Ok, I assume it is now doing something, like downloading blocks.
But:
~/bitcoin$ bitcoin-cli -datadir=/mnt/d/blockchain -getinfo
{
  "version": 170100,
  "protocolversion": 70015,
  "walletversion": null,
  "balance": null,
  "blocks": 0,
  "timeoffset": 0,
  "connections": 0,
  "proxy": "",
  "difficulty": 1,
  "testnet": false,
  "keypoololdest": null,
  "keypoolsize": null,
  "paytxfee": null,
  "relayfee": 0.00001000,
  "warnings": ""
}

implies that nothing is going on. Nothing is being downloaded.

Start with the infamous bitcoin.conf which doesn't exist and nobody knows exactly how it should come into existence.

Well, I know.
It should come into existence by you creating it with a text editor in your datadir directory, if you wish to do so.  It's completely optional.  If there are command line options you want to use every time without having to specify them (such as -txindex=1), you can put them into bitcoin.conf.  If you're happy continuing to give them on the command line, then there is no need for bitcoin.conf to exist at all.
And now you know too.

As for your other issue, if you use getblockchaininfo instead of getinfo, you'll get more detailed information.  Current versions of Bitcoin Core try to download block headers before getting the blocks themselves.  You'll see a headers field in getblockchaininfo which perhaps will be increasing.
Otherwise, any and all diagnostic information would be in a file called debug.log in your datadir directory.  Look at that file.  If it isn't self-explanatory, then you can post the last several lines of it in a question here, or to your other favorite Bitcoin support forum.

I guess https://github.com/bitcoin/bitcoin/pull/14057 is not yet in 0.17.1.


text:
What to do when funded channel node disappears
I would like to test this scenario on a testnet.
I funded a channel with one testnet node.
Assume that node suddenly vanishes and doesn't come back up for, say, another 4 weeks, or never.
What is supposed to happen? How am I supposed to detect and react to this?

Generally your lightning node will be able to tell which peers are online (in clightning with listpeers command)
If the other node is offline you can force close the channel by publishing your channel state.. Since the other node has signed your commitment tx as part of the protocol there is no need for it to be online or to help closing the channel.

I wonder how to test this without requiring two machines and two separate installs? I am using c-lightning. I can use listpeers but have no idea how would it look if one of the peers listed went dead. listpeers would still list the peer even if peer is not up?

Is there any channel where I can talk to the people, say connect to some testnet lightning peer and ask the person: hey can you exit your node for a few minutes so that I can see what I get when I do listpeers?

With c Lightning it is very easy to run several lightning nodes on one machine. Just start lightningd with different data-dir and address arguments. Each instance needs a different data directory and a different port. You don't even have to do it on testnet but you can also do it in regtest (simnet) as described here https://github.com/shesek/spark-wallet/blob/master/doc/dev-regtest-env.md


text:
Bitcoin-qt is trying toload to C drive instead of my D drive
So I'm running a 250 GB SSHD for my windows boot drive and basic system functions. I am running a 1 TB standard HD for my larger files (like the bitcoin ledger). How do I prevent Bitcoin-qt from loading the ledger to my C drive and instead have it load to my D drive?

You can create a bitcoin.conf file that specifies datadir=(your/desired/filepath) in order to override the default data directory location.


text:
Cannot read property 'toWIF' of undefined
I am working on a cryptocurrency site in which each user will have there own individual deposit address to put currency on site. I am using bitcoin-core, bitcoinjs-lib, along with quite a few other modules.
Currently I am receiving an error after running the following code via node generate_wallet.js
var bip32 = require('bip32')
var bitcoinjs = require('bitcoinjs-lib');

var privKey = process.env.BIP32_PRIV;
var hdNode = bitcoinjs.HDNode.fromBase58(privKey);

var count = process.env.GENERATE_ADDRESSES ? parseInt(process.env.GENERATE_ADDRESSES) : 1000; // how many addresses to watch

var rescan = 'false';

for (var i = 1; i <= count; ++i) {
  console.log('bitcoin-cli importprivkey ' +  hdNode.derive(i).keyPair.toWIF() + " '' " + rescan)
}

The error:
console.log('bitcoin-cli importprivkey ' +  hdNode.derive(i).keyPair.toWIF(L4tvCJoE9nxFnmZ4znCDvpqMLo9m8ybpAzxdE4ZKWDAfBqeM8JsR) + " '' " + rescan)
                                                                      ^

TypeError: Cannot read property 'toWIF' of undefined
    at Object.<anonymous> (/root/bustabit-depositor/src/generate_wallet.js:13:71)
    at Module._compile (internal/modules/cjs/loader.js:736:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:747:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:568:12)
    at Function.Module._load (internal/modules/cjs/loader.js:560:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
    at executeUserCode (internal/bootstrap/node.js:526:15)
    at startMainThreadExecution (internal/bootstrap/node.js:439:3)
root@ubuntu:~/bustabit-depositor/src#

Any suggestions would be greatly appreciated. I don't even know how to work around this as there's no results online about this. Maybe i'm just dumb haha

First, note that HDNode was removed in 4.0.0, so you should use the BIP32 module you included. Second, you don't need the extra keyPair property, so your code becomes:
var bip32 = require('bip32')

var privKey = process.env.BIP32_PRIV;
var hdNode = bip32.fromBase58(privKey);

var count = process.env.GENERATE_ADDRESSES ? parseInt(process.env.GENERATE_ADDRESSES) : 1000; // how many addresses to watch

var rescan = 'false';

for (var i = 1; i <= count; ++i) {
  console.log('bitcoin-cli importprivkey ' +  hdNode.derive(i).toWIF() + " '' " + rescan)
}


text:
Original bitcoin core has one script.cpp.where is interepreter for it?I want to write hello world compiler to understand this.?
How to understand script.cpp and its interpreter.I understand register and postfix operation.
I want to understand how script is parsed into machine code.Can i write hello world such as only pushing value into the stack.

You mean where in the source code in the original Bitcoin v0.1 source code was the script interpreter? It was in script.cpp: https://github.com/bitcoin/bitcoin/blob/v0.1.5/script.cpp#L44L806

I want to understand how script is parsed into machine code.

Unlike Ethereum, Script isn't compiled. It's interpreted, like Javascript. The opcodes are evaluated on-the-fly.

Can I write hello world such as only pushing value into the stack?

Maybe try entering
0x0c 0x48656c6c6f20776f726c6421

to https://matiu.github.io/opcodes-playground/? (0x0c is the length of the text, as a push operation)


text:
Could you clarify the definition of bitcoin, that is "coin", which Nakamoto defined as "a chain of digital signatures"(details below)?
Say Alice buys 1 BTC and Bob 100 BTC. Nakamoto defined coin(BTC) as a "chain of digital signatures", so Alice bought 1 such chain, and Bob 100 chains. That makes no sense to me, so could you please explain?

The Bitcoin system enables its participants to collaboratively maintain a ledger of balances, the Unspent Transaction Output (UTXO) set. Satoshi referred to what we today call “UTXOs” as “coins” in his writing. The rules of the system ensure that new funds are only created per a limited reward for extending the blockchain. Hence, the amount of bitcoin tracked in the shared ledger is strictly capped and predictable.
Due to the system's global reach, reliability, scarcity, utility, and transparency, bitcoin represents a verifiable record used among bitcoiners as payment for goods and services or repayment of debt.
UTXOs are uniquely identifiable and hold a discrete amount of bitcoin. To transfer funds, a sender submits a transaction to the network which can be understood as an announcement declaring some specific UTXOs to be expended and some new UTXOs to be issued. The sender proves ownership of the claimed UTXOs by providing cryptographic signatures satisfying the spending conditions encoded in each of the UTXO when they were created.
Since each UTXO results from a pedigree of preceding transactions, it could be poetically described as stemming from  “a chain of digital signatures”.

If you are looking for a more philosophical treatise of what Bitcoin is, you may find Craig Warmke's “What is bitcoin? [PDF]” interesting. He's a Professor of Philosophy at Northern Illinois University and provides a metaphysical model for how to think about Bitcoin in the linked ~43 page work.

So, what does it mean when Alice bought 1 "Unspent Transaction Output" and when Bob bought 100 "Unspent Transaction Outputs"? I don't get it? Where is that 100 times bigger amount of "Unspent Transaction Outputs" keep for Bob and what Bob can do with that property?

@niwrad think UTXOs has physical coins and bills, with different denominations. For example, Alice has $1, in one bill of $1. Bob has $100, but it could be 1 $100 bill, or 2 $50 bills or 10 $10 bills, etc. Bills = UTXOs, UTXOs != BTC. What we call now UTXO it was Satoshi called Coin.

The transaction output specifies the amount of bitcoin that is assigned to the receiver. It can be any amount from 0 to all bitcoins. However, a sender cannot assign more to a receiver than they spent.

@bordalix Having $100 bill means owning 100 debt units created in the US banking system. $=debt/loans. So, a dollar bill is just a way to tell people that they own debt. Likewise, bitcoin wallet tells Bob to own 100 BTC, that is coins. Checking the definition of a coin, we see "chain of digital signatures". That chain is recorded on blockchain. So, it follows that the wallet tells Bob to own 100 units of blockchain. And the blockchain is only one. And it is free for everyone to download. Now this has even less sense.

@Murch So you're saying that UTXO is coin, and coin is UTXO?

Yes, "coin" was the word Satoshi used for "UTXO".

@niwrad maybe my analogy with bills is not the best one. Maybe it would be better to imagine UTXOs as bank checks, because UTXOs can have any denomination. For example, Bob owns 100 BTC, by having one UTXO of 42.42 BTC and another of 57.58. When Bob pays 1.23 BTC to Alice, he uses the 42.42 UTXO to generate a UTXO of 1.23 BTC for Alice, and a new UTXO of 41.19 for himself (his change). He can also aggregate UTXOS, i.e. send his UTXOs to himself to get one single UTXO with the total. The sum of all UTXOs is equal to the available BTC (~19 millions)

@bordalix So analogically, having one wallet with 42.42 USD in it, and another one with 57.58 USD, means having 100 USD. Ok, that's just a way how information about ownership of USD is organized. In the same way someone can have one TSLA stock certificate with 100 written on it, and another with 500. But this doesn't define USD or TSLA. USD is debt created in the US banking system. TSLA is equity of Tesla company. Debt or equity is what people transact with. What's the thing that people transact with in the bitcoin system? What is BTC?

Bitcoin is backed by the full faith of the people that accept Bitcoin. It's exactly these entries in the UTXO set and nothing more. Turns out that some people want to have more of them and offer to trade other currencies, goods, or services for that.

Perhaps check out: https://bitcoin.stackexchange.com/q/182/5406

@Murch The question here is what is BTC? If Alice has 1 BTC, and Bob 100 BTC written in their wallets, the system informs Bob that he owns a hundred times more of something than Alice. What is that something? If we replace BTC with TSLA, USD or XAU, the brokerage or bank systems inform Bob that he owns a hundred times more equity units, debt units or metal units than Alice. So what exactly is that thing behind the name BTC? Satoshi defined it as chain of digital signatures. That's nonsensical, because that chain is stored on blockchain and thus freely available to anyone. Bob doesn't own it.

It's a set of ledger entries maintained by the collective bitcoin network. Pretty much the same as your bank statement might have a bigger or smaller number than someone else's bank statement or how you might have two beers on your tab at a bar while another patron only has one beer on the tab. The main difference being that there are more people enforcing the shared rules and contributing to writing updates to the ledger.

In other words, it's an abstract thing like many other forms of money.

My bank statement informs me how how many debt units I own. The same as brokerage statement informs me how many equity units/shares I own. The chain of entries stored on blockchain is not something that Bob owns. Blockchain is a public ledger own by no particular person or organization. So it seems that Bob owns nothing. Just as I thought.

While Bob doesn't own the chain by himself (but co-owns it with all other participants), nobody but Bob can spend his units accounted in it, because spending his coins requires a signature from his private key.


text:
How many transactions fit into a single block?

there is a limited number of transactions that fit into a block
if the network requires more throughput (more bitcoin is being sent), that means more blocks will be solved in a shorter time interval
that means emission of bitcoin will happen faster, disregarding the difficulty param

some of these may be wrong, please explain

there is a limited number of transactions that fit into a block

Yes, though this is a bit inaccurate. Transactions have a "weight" (roughly proportional to its number of inputs and outputs, but more complex scripts/constracts also increase the weight). Blocks have a weight limit of 4000000. That implicitly sets a bound on the number of transactions that can get into a block, but the limit is higher for simpler transactions and lower for more involved ones.

if the network requires more throughput (more bitcoin is being sent), that means more blocks will be solved in a shorter time interval

No, there is one block per 10 minutes, on average, regardless of demand for transactions.
The space in Bitcoin blocks is effectively a market, and transactions "bid" for that space through their fees. If there are more transactions being produced per unit of time than there is space for in blocks, transactions with higher fees (per weight) will tend to get chosen first. The others will have to wait, possibly indefinitely, depending on how much competing transactions are willing to pay.

that means emission of bitcoin will happen faster, disregarding the difficulty param

No, the difficulty is a function of the block production rate. If blocks are being produced faster than once per 10 minutes on average, the difficulty will go up. Similarly, if they are produced too slow, the difficulty will go down.
The difficulty (and block production rate) are unrelated to demand for block space.


text:
What is the correct way to make crypto payments except the escrow intermediate?
For small payments, bitcoin does not require any way to guarantee the exchange of coins for goods. But how do you make a big purchase (such as houses), especially when buyer and seller do not meet in person, and considering crypto transactions are irreversible?

Is there a reason for ruling out the obvious solution which has been used for centuries for this exact problem?

@RedGrittyBrick if you are mentioning the escrow, it is somewhat a problem cause crypto was designed right from the start to require NO intermediaries, or trust institutions

Not quite. Bitcoin was designed to avoid any need for a trusted THIRD party. It wasn't originally designed for situations where you don't trust the SECOND party (to fulfil their part of the underlying agreement). See Nakamoto 2008.

Escrow solutions are essentially used in Bitcoin as M of N multi signature schemes.
A simple 2 of 3 signature scheme is the closest that is available to regular escrow with the Buyer, Holder and Escrow service each holding a key to make the secondary payment on completion of contract.
The escrow requires to take no part in the transaction if both buyer and seller are content with the deal.
There are a few third party services that facilitate this, or you can set it up yourself with some wallets.
https://www.bitrated.com/ I have used with success.

What is the correct way to make crypto payments [...]

I'm not convinced there is only one correct way to do things in Bitcoin or that anyone has the authority or right to proclaim that one way is correct and others incorrect.
I would say the correct way to use Bitcoin is simply to comply with the network protocols and consensus rules.

[...] except the escrow intermediate?

In 2008 Satoshi Nakamoto wrote

What is needed is an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party. Transactions that are computationally impractical to reverse would protect sellers from fraud, and routine escrow mechanisms could easily be implemented to protect buyers

Clearly, Nakamoto believed that escrow was the solution for situations where the first party to a transaction (the payer) did not sufficiently trust the second party (payee) to hand over the purchased goods or provide the purchased services.
Nakamoto also discussed escrow implementation in 2010
but it is certainly arguable that these arrangementss would not constitute a popular solution to the underlying issue. So far as I know, Nakamoto's ideas were never implemented in their reference implementation or explicitly provided for in the network protocols.
So far as I know, it is also true that no fiat cash currency really offers a buyer protection against non-delivery that is intrinsic to the currency.
The non-cash account-based electronic payment systems all rely on a trusted intermediary.
For most small purchases, buyers seem willing to rely on the incentive of damage to the reputation of  defaulting suppliers or marketplaces. As you note, many people will regard this as insufficient for large purchases with remote or semi-anonymous suppliers.
In reality, in my locale, the majority of people purchasing houses using fiat currencies use a form of escrow. In my locale this takes the form of making payments through solicitors who must, by law, be licensed by a government mandated regulatory body to perform those services. Some people instead use commercial escrow agents such as conveyancers. Obviously, Bitcoin's founders did not wish to replicate any sort of de-jure arrangement for important reasons that could be categorised as philosophical, political or idealogical.
The result is that, so far as I know, there is no existing widely used non-escrow peer-to-peer algorithmic solution in Bitcoin to the problem of buyer protection against non-delivery.


text:
Unconfirmed bitcoin transaction 5 hours
Its been 5 hours since I did a transaction of $ 64 and it has not been confirmed
I checked it says unspent
Am very much confused please any help?

How much did you pay in fees? when they are too low they do take a while to confirm.
Keep in mind that you will not lose your coins. The tx will either get confirmed or around 48 hours that it hasn't been confirmed it will be invalidated (your coins returning to you).
Some wallets signal that a utxo is only spent after a transaction using it has been broadcast and confirmed. As you don't have confirmations, that's probably why it is marked as Unspent


text:
How to complete install of bitcoin-0.17.1 on linux (fedora 29)
So I downloaded and unzipped bitcoin core. I now have bitcoin-0.17.1 sitting in my home directory . What next? How do I install and run this? (Obviously I am a newb, help much appreciated.)

After extraction files from the tar ball you have to install the contents of its bin subdirectory into the /usr/local/bin directory using the the install command. The install command is part of the GNU coreutils available on nearly every Linux distribution, and the /usr/local/bin directory is a standard location for self-installed executables (you may edit the commands below to use a different location).
If you use sudo to run commands as root, use the following command line:
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.14.2/bin/*

If you use su to run commands as root, use the following command line:
su -c 'install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.14.2/bin/*'

See reference here
You can then just run bitcoin-qt to startup the GUI

Are you attempting to compile from source or downloaded the linux executables? It is not clear from your original question.
If you downloaded the executables package the first answer references an old version of bitcoin - you'll have to change the references to 0.17.1 (not noob friendly). You can also just cd into the
bitcoin-0.17.1/bin

directory and run
bitcoin-qt

or move it wherever you want.
https://www.ringingliberty.com
has a repo and bitcoin packages for Fedora as Fedora does not provide packages directly if you are just looking to run the desktop client.
If you are compiling from source there are other dependencies that must be installed (boost, etc) first.
Beware the bitcoin client (whether gui or server) will consume 221 GiB of storage for the full blockchain as of today and take from days up to a week to sync initially. Research "pruned node" to reduce this to as little as 3.5 GiB.


text:
Help linking External Storage for bitcoin data using Raspberry Pi?
I mounted my external disk to wrong directory (wanted it to be ~/bitcoinData) , instead ended up creating a directory on SD card ( /home/pi/bitcoinData ) and now SD card (root) is full. i cannot seem to delete SD card bitcoinData directory (permission denied). how do i fix this? and link hdd to correct directory?

Pass -datadir=/path/to/folder/ in the command line when starting bitcoind.

For a change in the directory, I agree with @UgamKamat but I think the problem not is correlated with bitcoin core but the permission user in your raspberry pi. try a command to the terminal with sudo rm -r path/bitcoin

i have resolved this, i believe it was a user permissions issue. thanks

@gaiameta if you post a well-written answer with steps to solve it could help others and earn you addition rep on this site.


text:
Multi-destination transaction from paper wallet
As far as I know, I can make a transaction to a single destination by sweeping/importing private key. How can I make a transaction to multiple destinations?

Does this answer your question? How do you send to multiple addresses by paying a one time fee? Which wallet supports this?

You can do this with Bitcoin Core for example. You can find more details in this
answer. You need to import your private key in to Bitcoin Core first.


text:
Bitcoin Rich List - Reliable or not?
I'm doing an essay on Bitcoin and other cryptocurrencies and came across the Bitcoin Rich List ( https://bitinfocharts.com/top-100-richest-bitcoin-addresses.html). However, I only want to use reliable sources of information.
Therefore, I would be very grateful for your comments on how reliable a source this is. If anyone knows of other sources regarding Bitcoin's distribution, I would be grateful for help with this as well. Thank you very much!

I can’t really offer much insight into the reliability of the website you’ve linked, but if you’re really keen to verify what is posted there, you could run your own node, and then find/write some code to index and organize all addresses by their balance. More generally, questions asking about the reliability of a certain website or service are off-topic here.
That said, it’s important to understand what the list actually represents. Namely: this is not a list of how much BTC the top 100 BTC holders own. It is a list of how much BTC is stored in the 100 richest addresses.
This difference is important, as bitcoin users do not map 1:1 onto bitcoin addresses. Many of the addresses on that list are likely the cold storage wallets of bitcoin exchanges, meaning the balance of the address is in fact owned by a great number of users (customers of that exchange). Likewise, some very wealthy users may store their coins spread out across a great number of addresses (in order to maintain better financial privacy, for example).
So while it may be interesting to see what addresses hold the most bitcoin, this metric does not tell us much in terms of who (or how many people) actually own those coins.

Some of them may also be addresses that can't be accessed, e.g. "proof of burn addresses", where the coins belong to nobody.


text:
Payment not received
I received an email from a company about a payment,but my wallet has not received it.my wallet does not show any transactions,even unconfirmed transactions.what should I do?Thank you.

Were you supposed to receive a payment from that company prior to have receiving the email? If so, contact their support and ask them. If not, then the email was probably a scam or phishing attempt.


text:
Do I have to make a back up copy every time I make a transaction?
In other words when I make another transaction but I only have the original backup when I restore the backup does it only show the amount from my original transaction or will it be updated to the latest transaction if I've made several transactions since my back up?

It depends on the wallet software you are using, and also whether you are using an HD wallet or not.  (E.g. is your backup a mnemonic phrase, or a file containing individual private keys?) Can you add these details to your question?

You just need to backup your private key or your 12 words nothing else
The whole network keep a full backup of all your transactions
If your wallet make new bitcoin address for each transaction you need to keep a backup of your new private key as well

This answer applies to some wallet software, but certainly not everything. Please qualify what you're talking about.

@PieterWuille No Pieter you are wrong it doesn't matter which wallet you are using you JUST need to take backup of your private key or 12 words and nothing else and when I say nothing else I really mean nothing else only private key is important and with private key you can recover your wallet and all your transactions

If you have all private keys, you can recover everything. But not every wallet has just a single key or phrase that everything is derived from. Many older implementations generated new keys all the time, for example. Furthermore, your keys cannot recover unconfirmed transactions.

@PieterWuille If your wallet is old you should stop using it immediately, normal wallets have basic features like 12 words or master private key and if your wallet doesn't follow BIPs it's not safe to use it, a normal wallet have master private key and all other private keys will be generated from the first private key

bip-32 - https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki and bip-39 - https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki, if your wallet doesn't follow these you should stop using it

I strongly disagree you should stop using Bitcoin Core (which only uses BIP32 if the wallet file was created after version 0.13). Also, I wrote BIP32. Please, just clarify in your answer that it depends on the wallet.


text:
RE: Article on Brain Wallet
I apologize upfront since I am not a seasoned c-currency investor (yet) unlike my years of experience with securities, currencies and commodities. I have some queries for you:
1) Brainwallet.org does not exist I could only locate Brainwallet.io
2) It will only create and accept a key for BTC I have 18 coins I need to securely (very relative) store.
Any tips/suggestions would be much appreciated.

Most reputable wallets nowadays create a seed, meaning, a word list you can memorize (brainwallet). My approach would be to install Electrum on an offline PC, create the seed and when I'm sure I won't forget it, I'd wipe the device clean.
I would consider this approach risky, even if I was willing to commit to refreshing my memory of the seed.
I would still buy a hardware wallet such as a Trezor.
I would memorise its seed and the keys would still be accessible through the device, just in case.
Hardware wallet security:

Typically, hardware wallets have a pin.
Some, also have an extra password with magical powers: It acts as an extra seed word, so you can actually have many accounts. There is no wrong password. Depending on the password you type, it (re)creates the account. If someone ever forces you to unlock it, you can tell them the pin and that other password you have with 0.1 BTC in it.
Such wallet is the Trezor but I read recently that Nano ledger will have a similar feature soon.


text:
What does bitcoin.org mean when they say about Coldcard Wallet "the final software was not built deterministically like Bitcoin Core"?
I am looking at hardware wallets to store my Bitcoins, and Coldcard Wallet Mk3 seems like a great option. However, at looking at info about it at bitcoin.org, it says that the software is not built deterministically like the consensus Bitcoin Core protocol.
I just want to know if this is true, or the info is outdated. Because in the Coldcards page, I have not found such thing.
Coldcard even claims extreme compatibility with clients such as Bitcoin Core, Electrum of Wasabi Wallet. And it seems to be easy to use it only trough ones personal Full Node.
The other option as a Hardware Wallet I am looking for, is BitBox02.
Thank you in advance,
Ander

Some security sensitive pieces of software like Tor, Debian and Bitcoin use deterministic builds to increase the safety of binaries for end users. Typically a piece of software will be built from source code by a maintainer, signed by them, and then uploaded to a repository. Small differences in the setup of the machine compiling the software, timestamps, and random values in the output mean that every time it is compiled the output is likely to be unique.
Deterministic builds replace this with a system called Gitian that produces identical binary output no matter who produces the binaries or when, allowing many people to independently compile the software and come to the same end result.
Deteminstic builds protect against:

Malicious software on the maintainers machine changing the behavior of the software, injecting a backdoor or other code
A single maintainer acting maliciously and altering the software
An innocent maintainer being accused of having made modifications they did not

The ColdCard product not being built deterministically means that even though the project is open source, you have no way of verifying that the binaries provided by the company completely match the source code.

Thank you, very usefull explanation.


text:
How can I track bitcoin transaction(I am receiving) programatically?
Building something where I will be getting bitcoins in my bitcoin address, so is there a way I can keep track and know who sent me bitcoin?

Wallet Notify works great, however, its worth mentioning the advantage of using a 3rd-party service over Bitcoin Core. You have the ability to track ANY address, wherever it may be located (local pc, cloud service, mobile device, etc). You can even track addresses that you don't own (clients, partners, competitors, etc).
If you're looking for a enterprise solution, BlockCypher's API offers a comprehensive suite of popular coins and services.
BitNotify offers a quick and simple email notification service.

You can run Bitcoin Core with the walletnotify feature, which will execute a script of your choice every time you receive a payment.
See How do I use walletnotify?
There are also lots of third-party service providers which have APIs to notify you of incoming payments.


text:
How BTC value is determined in USD from a trading pair?
I know this is more of a general trading question but how is BTC or any base currency value determined in another currency from a trading pair?
An example of what I mean is take the BTC/NEO trading pair, how do you determine the BTC value in USD from that trading pair?

If one bitcoin is $1,000 (for the sake of easy math), and 1 Neo is worth 0.1 BTC, then you can determine the USD value of one Neo is $100.
1000 * 0.1 = 100

Look at https://coinmarketcap.com/currencies/bitcoin/#markets ...the value of BTC  in USD changes per currency pair.  I'm having a hard time figuring out how they determine the value of the base currency, in this case BTC, from a trading pair in USD or any currency for that matter.

@Derek You can just use the volume-weighted, outlier-excluding price shown at the top of the page.

@David But why does the value of BTC in USD change per currency pair?  I'm not understanding what factor determines the slight variation in USD per currency pair.

@Derek There isn't this one thing called USD that is precisely the same for everyone. USD at Bitfinex is not the same as USD at Bitstamp. They have different withdrawal and deposit policies, latencies, risks, and so on. They can be valued differently by a small fraction of a percent.


text:
How do market cap websites obtain their list of coins?
Do they manually research and enter them into the database or do the coin developers contact the websites?

They will usually scrape various exchange APIs/websites for tickers and names.

Thanks.  That is how I have been going about it but it's quite time consuming.  Maybe that's why they charge for the data afterwards.

You should be able to automate it

I am to a point.  each exchange API has different keys and such.  I may just stick to using the 5 or 6 high volume exchanges, it'll be relatively accurate.


text:
How exactly is bitcoin priced
How does bitcoin and other cryptocurrencies price the value of the currency? How exactly does this work. Do buyers just set a max price at which they want to buy and sellers a min price at which they want to sell and they are matched? Or is there something more complicated at work? I'm really interested in understanding how this works. Any details would be much appreciated

That's exactly right. People who want to sell bitcoins typically set a minimum price and people who want to buy bitcoins typically set a maximum price. When they meet, a sale takes place.

Thanks for your reply! I have 2 follow ups: 1) how is quantity matched? 2) how is the average price determined? Is it the average of the last x trades?

@AntersBear Most exchanges list 2 prices: Bid/Ask. For peer to peer transactions it is common to take the average of these 2 numbers. The other 'average price' of an exchange purchase/sale is calculated weighted by volume, e.g. 10 coins @ 100 + 10 coins @ 200 = 150 AVG/coin. Queues are matched cheapest first (taker buy) or highest bid first (taker sale).

There are many different exchanges where you can buy bitcoins in exchange for dollars.  Each will host different bids and asks, which can be transacted much like on a stock exchange.


text:
Holding Period Algorithms and the Blockchain
According to this interview, taxation holding periods in the United States for cryptocurrency can be determined by FIFO (First In First Out), LIFO (Last In First Out), or a more flexible option called Versus Purchase or Specified Asset, which allows the owner to declare which specific coins they wish to be considered to have spent.
My question is, do these holding period algorithms have to correspond to the actual UTXOs being spent on the blockchain?  Does using FIFO entail that you have to program your wallet to spend older UTXOs before newer ones, and vice-versa for LIFO?  Does Specified Asset require the owner to actually keep track of which UTXOs their wallet is spending?  These details are otherwise at a level of technical understanding far deeper than what a regular user would need to operate a wallet, and the UTXO choices wallets make are typically chaotic.  Are these details essential to holding period algorithms, or can spent coins specified for tax purposes diverge from spent UTXOs in the blockchain history?

My question is, do these holding period algorithms have to correspond to the actual UTXOs being spent on the blockchain?

This is likely a question best answered by a qualified accountant, or tax lawyer.
I say this because there are many nuances to it: if you spend half of your oldest UTXO, to sell it for cash, then what do we say about the change output? It is a brand new UTXO, but clearly you bought those coins long ago. Similarly, how would the age or origin of a coin-consolidation UTXO be calculated? What about outputs from coinjoin-style transactions? What happens if I just want to update my cold storage system, and want to move coins to new addresses? etc.
I hope these examples help highlight the difficulty of applying existing regulations to a new system like Bitcoin. If you are looking for tax/legal advice, the best course of action is to ask a professional, not a stranger on the internet.

Does using FIFO entail that you have to program your wallet to spend older UTXOs before newer ones, and vice-versa for LIFO?

A wallet using such a system would be bad for your privacy, UTXO-management, and fee-management, plus it still wouldn't answer the questions I mentioned above. So I doubt that any reasonable regulation would require such a thing.


text:
Which is the more productive miner output k/sh or G/hs
Which would be the most efficient and profitable miner, one at k/hs or g/hs ?
I am seeking to find which "miner" algorithm i.e.  daggerhashimoto blake2s etc would be best to mine with most of the time rather than enabling all

Your question doesn't really make much sense, I'll explain why:
As a miner, the number of hashes per second you can perform is relevant to the amount of payout you'll receive. More hashes per second for the same mining algorithm means a higher payout, all else equal. The 'k' or 'G' prefix is the shorthand for an exponentiation:
1 kh/s = 10^3 h/s = 1,000 hashes per second
1 Mh/s = 10^6 h/s = 1,000,000 hashes per second
1 Gh/s = 10^9 h/s = 1,000,000,000 hashes per second
etc.
With that in mind, the reason I say your question doesn't make sense is that the number of hashes per second is only one part of the equation for determining your mining income. The algorithm that allows your hardware to do more hashes/second is not necessarily the algorithm that will be most profitable to mine. There are many other factors, such as what your share of the network hashrate is, what the price of the coin you are rewarded with is, etc.

As a toy example, consider 'mining algorithm A' (maA), and 'mining algorithm B' (maB). With maA you can only do 1 h/s, but with maB you can do 1 Gh/s, so obviously you can perform way more hashes with maB.
However, if the total network hashrate of maA is only 5 h/s, and the total network hashrate of maB is 100 Gh/s, then you will have a much larger share of the hashrate for maA (1/5) than for maB (1/100). Assuming the block reward is equal, it will be more profitable to mine on maA, despite that apparently low hashrate.


text:
Is there a way to delete a test wallet without stopping bitcoind?
For my unit tests, I'd like to be able to delete and recreate a wallet without having to stop bitcoind and manually deleting the wallet directory.
When I try to delete such wallet directory without stopping bitcoind, I get an error since an handle exists on "db.log" (on Windows at least).
Is there a clean way to delete a (testnet) wallet without stopping bitcoind?

Why are you using testnet? Regtest mode exists explicitly for that purpose.

Would bitcoind really allow me to delete a wallet when running on regtest? For some reason I doubt it would make any difference... I guess I should try!

Why do you want to? You can just restart the node.

That is exactly what I try to avoid and why I ask this question in the first place! :-)

You seem to be very confused i to believing that restarting a node during a unit test is somehow bad or abnormal.

Well, recreating a wallet would make way more sense in my case and would be way faster (even if I'm sure the regTest node is faster to restart than a testnet one). I guess I'll indeed have to restart the node, if wallets can't be deleted otherwise. Thanks.

It takes seconds to restart a regtest node. Faster than whining on stack exhange about it.

You can unload the wallet using unloadwallet and then delete the wallet file.


text:
What is the simplest command I could use to test that my wallet unlocking process works properly?
I simply want to unit test that my lock/unlock process works well on an encrypted wallet.
What would be the easiest command I could send (that doesn't involve sending coins) to actually validate if my wallet is locked or unlocked? Can I try to sign a dummy transaction for example?

You can sign a message using the signmessage command. Note that this only works if you are using legacy addresses (Bitcoin Core currently defaults to p2sh-segwit addresses which cannot be used to sign a message). You an get a legacy address using:
bitcoin-cli getnewaddres "" legacy

If the wallet is locked, you won't be able to sign a message.


text:
Targetting a specific wallet when sending commands using RPC commands to bitcoind
I'm very new to Bitcoin development, using its RPC API.
I created a wallet using
{
    "method": "createwallet",
    "params": {
        "wallet_name": "/wallets/walletA"
    }
}

Now I want to get info about this wallet. I try to use the getwalletinfo command.
But it seems you can't specify the wallet name/path when running this command? You have to "load" the wallet first (using loadwallet)?
This is the part I do not understand. Let's say I have created 10 wallets and I try to run a getwalletinfo command in a multithreaded environment... How can I make sure I target the right wallet? Do I really have to send a loadwallet request to specify the wallet I want to work on, before getting info about it?
What will occure if I want to get information about "walletA" so I run loadwallet walletA, but before I can run getwalletinfo to get its info, a loadwallet walletB request is made?

did you find any solution . im stuck in sending transaction from the specific account address .

When more than one wallet is available, the wallet is selected by sending the RPC requests to <host:port>/wallet/<wallet_name>.
You might have to play around with the exact form, I suspect it might be <host:port>/wallet/wallets/walletA in your case, or <host:port>/wallets/walletA, or <host:port>/wallet/walletA.

I have been unable to make this work. Maybe because I'm on Windows with backslahes in paths. I tried everything: url encoding, escaping backslahes, etc. I even looked at Bitcoin code, and I'm not sure paths are properly managed when following /wallet/ in urls! In the end, I decided to use the walletdir config in bitcoin.confin order to specify the directory where wallets will be created. And I only use the name of a wallet (no path) in the RPC /wallet/[wallet_name] url. This works. Hope it helps someone, one day.


text:
Generator Point G multiple
if in a curve y2 mod p = x3+ 7 mod p ( ecdsa-secp256k1)
p=115792089237316195423570985008687907853269984665640564039457584007908834671663
G=55066263022277343669578718895168534326250603453777594175500187360389116729240,32670510020758816978083085130507043184471273380659243275938904335757337482424
nG=21505829891763648114329055987619236494102133314575206970830385799158076338148,98003708678762621233683240503080860129026887322874138805529884920309963580118
2nG=72488970228380509287422715226575535698893157273063074627791787432852706183111,62070622898698443831883535403436258712770888294397026493185421712108624767191
How do i find 'n' ?

This requires solving the discrete logarithm problem, which is assumed to be infeasible. If it wasn't, elliptic curve cryptography would be insecure.

Correction: solving this problem when n is uniformly randomly chosen is assumed to be infeasible.

You can find n by consulting a discrete log oracle, such as myself. N is 5. You're welcome.

Is it possible to learn this power?

I'm afraid you might not be random enough.


text:
Is the Cloudflare proposed ODOH protocol a thing that could improve Bitcoin node privacy?
Recently Cloudflare proposed an improvement to the DNS over HTTPS protocol called ODOH (Oblivious DNS over HTTPS). It allows separating a DNS server into two parts: the resolver and the proxy that receives DNS requests from an end-user, thus avoiding leaking an IP address to the resolver and an actual query to the proxy server.
When running the Bitcoin node with the onlynet=onion parameter, one has to either leave DNS queries enabled (which could potentially reveal a user is running Bitcoin), either to disable the DNS queries completely (dnsseed=0 and dns=0), and then to seed some good nodes with the addnode= parameter.  Both options aren't perfect.
Does (hypothetically) using the ODOH protocol for the initial node discovery make any sense from the privacy perspective?

Bitcoin running with onlynet=onion is severely insecure, nobody should ever be running the software in this mode. There is no sybil protection, it is completely feasible to operate an unlimited number of HS peers and prevent a node from ever connecting to one which will give them a true vision of network consensus. There is no cost to performing this attack whatsoever.

one has to either leave DNS queries enabled (which could potentially reveal a user is running Bitcoin)

DNS queries can be proxied as well.

Does (hypothetically) using the ODOH protocol for the initial node discovery make any sense from the privacy perspective?

I doubt it makes any meaningful difference, especially as seeding is typically only something which happens for initial startup of a node and likely never again. You're almost never going to be able to hide that you're running a Bitcoin node from your ISP, even by using a proxy the traffic patterns are very obviously Bitcoin.


text:
Bitcoin create TX. What is 'hash_type'?
https://bitcoin.stackexchange.com/a/5241/92798
What is the meaning of item 13?
Why is this value chosen? What does it mean?

https://en.bitcoin.it/wiki/OP_CHECKSIG
99% transactions use SIGHASH_ALL


text:
Which BIP describes the structure and algorithm for creating a wallet file?
My app is able to create a public and private key from BIP39. The uncompressed private key is concatenated with a sha256 (private key) and then encrypted via AES and saved to a file. To decrypt, you will need to decrypt the entire file, then take a hash from the first order of bytes and compare with the second half.
I plan to add support for BIP32, 43, 44 and am already working on it, but I am faced with the issue of storing information for creating backup.
My way of creating a file is not suitable, so I’m wondering if there is a ready-made BIP to solve this problem.

There is a list of BIPs at https://github.com/bitcoin/bips
I don't see anything that specifies a wallet format.
To be honest I'd be surprised to see one. This is something that each implementation ought to determine for itself, Some wallets might use an embedded SQL DBMS, some a Berkely DB format, some a JSON store of some sort and so on. Similarly, the contents may depend on what unique features and facilities the wallet offers. Wallets might be multicurrency or even multiuser, they might have settings for GUI skins that need to be saved as part of a wallet backup, they might have IDs for associated exchange or other services.

I'd say there isn't even agreement on what a wallet is. To some it's a seed phrase, to some it's a private key, to some it's a website, to some it's a file (with just keys, or keys + transactions, or more). And that's ok.

Thanks! You calmed me, I can safely work myself. :)


text:
Calculate BitcoinGold Block Header Hash
I am trying to calculate block hash # 632295
{
'version': 536870912,
'prev_block_hash': '000000017590609fd72cadc5fd05732cfa1760bd882213afbb7b788c42e115c8',
'merkle_root': '20e8e04b62d9cd21dbcee23e445fda60a07bc5785a0a2b0b419227c6a2ec936a',
'reserved': '00000000000000000000000000000000000000000000000000000000',
'timestamp': 1588602316,
'bits': 486818083,
'nonce': '0085c0dd0000000000000000000000000000000000000000000000000106002e',
'solution': '441cf79198cc4b0fb4dd5f9fa7be645adc4197ff655b555d4139051c9d7b82419f4824f055a5c993390569681ac67061ce041776751d6d72129c18e446dd31d4cc1e78e5d7b4ba440b1d188caffe6da433f73d9d53cfefc36505da3b9270521650a6930064',
'height': 632295
}

This is what my code for calculating the hash for Bitcoin looks like, but it does not work for BitcoinGold.
block_array: List = list()
block_array.append(struct.pack('<L', block['version']))
block_array.append(bytes.fromhex(block['prev_block_hash'])[::-1])
block_array.append(bytes.fromhex(block['merkle_root'])[::-1])
block_array.append(struct.pack("<L", block['timestamp']))
block_array.append(struct.pack("<L", block['bits']))
block_array.append(struct.pack("<L", block['nonce']))

header_hex: bytes = bytes.join(b'', block_array)
hash = double_sha256(header_hex)

Next, I turned to the documentation:
https://github.com/BTCGPU/BTCGPU/wiki/Technical-Spec
This suggests that I need to add 3 more fields:

nHeight, nReserved,nSolution

I believe that the code should look like this for bitcoingold:
block_array: List = list()
block_array.append(struct.pack('<L', block['version']))
block_array.append(bytes.fromhex(block['prev_block_hash'])[::-1])
block_array.append(bytes.fromhex(block['merkle_root'])[::-1])
block_array.append(struct.pack("<L", block['height']))  # 632295
block_array.append(struct.pack("<L", block['reversed']))  # 0
block_array.append(struct.pack("<L", block['timestamp']))
block_array.append(struct.pack("<L", block['bits']))
block_array.append(struct.pack("<L", block['nonce'])))
block_array.append(struct.pack("B", block['solution']))

header_hex: bytes = bytes.join(b'', block_array)
hash = double_sha256(header_hex)

But this does not work, because nonce is not int.
As a result of executing the code, should get this hash:
00000003dd91f04483e990a1ecc5176abdfb18f40ae2ca6b0d203127bc150998
How to convert "nonce" and "solution"?

Where can I ask questions about BitcoinGold?
https://bitcoin.meta.stackexchange.com/questions/1041/where-can-i-ask-questions-related-to-bitcoingold

It is resolved.
block_array: List = list()
block_array.append(struct.pack('<L', block['version']))
block_array.append(bytes.fromhex(block['prev_block_hash'])[::-1])
block_array.append(bytes.fromhex(block['merkle_root'])[::-1])
block_array.append(struct.pack("<L", block['height']))  # 632295
block_array.append(bytes.fromhex(block['reserved']))  # 0
block_array.append(struct.pack("<L", block['timestamp']))
block_array.append(struct.pack("<L", block['bits']))
block_array.append(bytes.fromhex(block['nonce'])[::-1])
block_array.append(bytes.fromhex(block['solution'])[::-1])

header_hex: bytes = bytes.join(b'', block_array)
hash = double_sha256(header_hex)

Fun
def double_sha256(bytes_str: bytes):
    result = sha256(sha256(bytes_str).digest()).digest()
    return result[::-1]  # little endian


text:
How does a wallet rebuild itself from its seed?
How does it identify the addresses and transactions on the blockchain in order to rebuild the history of that wallet?

If by seed you are referring to a mnemonic phrase (12 or 24 words is common) then the process goes something like this:

The phrase is hashed (or some other process) to produce random or pseudorandom bytes we will call the "seed"
The byte array seed is passed into BIP32 HD master key algorithm to create a BIP32 master key.
Following a standard like BIP44, the wallet then derives sub-keys sequentially in order. Checking for transaction history of each key's output.
If left alone, this loop would last forever, so standards like BIP44 specify a "gap limit" which means that if gap limit = 20, then "If I generate 20 addresses in a row that all have 0 transactions in their history, I will stop checking addresses" For receiving paths, 20 seems common, for change paths 1 is standard.

Continue this loop until the gap limit is reached.
This type of methodology doesn't work for merchants or large exchanges, so the gap limit logic of "how far do we keep checking" may vary.
But most HD wallets rebuild themselves in this way.


text:
Import wallet or transfer coins
Say if I am changing from CoPay to Bitcoin Core, is it recommended that I try and import my CoPay's private keys to Core, or just send the coins over to my Core account.

It depends on two factors.
One is, how many unspents are your funds spread across in CoPay? Will it be a really large transaction which will need high a transaction fee? Then sending to Core might be easy, but at a financial cost.
Two is, how comfortable do you feel with exporting CoPay's priv keys, safely transferring and importing then into Core? If you are OK with it, then you save the transaction fees.


text:
How does the Blockchain detect a cheater, who manipulates the blockchain?
Let's assume we have 100 blocks. One miner x has the intention to manipulate block 90. So he has to recalculate the hash for block 90. Following he also has to recalculate the hashes for block 91-100.
Correct me, if I'm talking non-sense here.
So how do all the other miners figure out that miner x is cheating? And what happens to miner x, if he gets caught?

What you are describing is a textbook example of a 51% attack. Bitcoin protocol is designed to accept the chain that has the most proof of work (most often this is same as the longest chain). If a miner needs to change block 90, he will have to recalculate hashes starting from block 90-100. To make his attack successful, the miner will have to mine blocks faster than the rest of the network so that he can broadcast the longest chain which then gets accepted by the network. So, probabilistically this would mean the miner should be in control of >50% of the total hashing power, so that he can mine blocks faster than rest of the network combined.

Thanks for the answer. But how do other miners figure out that he is cheating? Do they have a look into the hashes of the blocks and compare them? And what happens to a cheating miner? Does he get excluded from the network?

If the miner has created valid blocks following all the rules of the bitcoin protocol, then the chain he has created is valid. Nodes accept chains that has the most proof of work. If the malicious miner is able to race the network into creating the longest chain then yes, that is the truthful chain


text:
Difficulty to Hash Validation Correlation
In the validation of a block it is said that a miner has a valid block if the transactions can be tracked in the chain and the hash of the block header is less than the difficulty. I am having a hard time seeing the relationship in real world blocks that are being solved.
For Example from Block#496785 :
Difficulty("target") = 1,347,001,430,558.57
or in hex
000000000000000000000000000000000000000000000000000001399F8AB21E
Mined Hash = 000000000000000000cf3620d570d08d1799a1cafbbfae512fdba2124665eca0
so it seems to me the hash is now greater than the difficulty so an invalid block but this is obviously not the case.
I have heard also that the difficulty is related to the number of leading zeros after the maximum target in which case may make sense where 1399F8AB21E is a 11 byte number and the hash after the default 8 byte leading target contains 10 bytes which is less than the difficulty 11 bytes of zeros.
so
00000000 0000000000 cf3620d570d08d1799a1cafbbfae512fdba2124665eca0
8 bytes  difficulty             some value

Is this correct? How does this work?

Difficulty is not the same as target hash (target in short).
They are inversely related, so minimal possible difficulty (of 1) gives maximal target, by definition given as (https://en.bitcoin.it/wiki/Target):

0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Because Bitcoin stores the target as a floating-point type, this is
  truncated:
0x00000000FFFF0000000000000000000000000000000000000000000000000000

The current difficulty is calculated as maximal target divided by the current target. For example (https://en.bitcoin.it/wiki/Difficulty):

0x00000000FFFF0000000000000000000000000000000000000000000000000000 /
  0x00000000000404CB000000000000000000000000000000000000000000000000
  = 16307.420938523983

So in your example the Difficulty = 1,347,001,430,558.57 would give the current target of:

current_target =
  0x00000000FFFF0000000000000000000000000000000000000000000000000000 /
  1,347,001,430,558.57

If you calculate this (take care as one number is hexadecimal and other decimal), the comparison should give that this current_target is higher than the mined hash of:

0x000000000000000000cf3620d570d08d1799a1cafbbfae512fdba2124665eca0

EDIT: Pen and paper calculation gives me that the current target is around:

0x000000000000000000FFFF000000000000000000000000000000000000000000

How I got this. 1,347,001,430,558.57 is around 1.225 * (16^10). As the target is in base 16, this means that dividing by 1 * (16^10) is like shifting the digits 10 places to the right. To get precise result after digits shifting I should divide by 1.225, but I ignored this in this pen and paper calculation.
EDIT2: To be even more precise I take 16/1.225 is around 13 (D in hex), so the target is around:

0x000000000000000000D000000000000000000000000000000000000000000000

Why does 0x00000000FFFF0000000000000000000000000000000000000000000000000000 represent the truncated floating-point type version of 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF?


text:
ncdns uses the wrong nameserver to resolve .bit domain
Basically, I'm setting up a .bit domain for my blog.  I have registered a domain using namecoin, and given it a nameserver entry on the blockchain:
$ namecoin-cli name_show d/aoeu2code
{
  "name": "d/aoeu2code",
  "value": "{\"ns\": [\"ns.aoeu2code.com\"]}",
  "txid": "a49ad527f36fc41c47b8d743d376c3b011c7999dbf4d9da64afbdb3ccbdd8934",
  "vout": 1,
  "address": "NHE7a7xJF2XMQzCwg5PLggeTdZ3yQDvqmS",
  "height": 370929,
  "expires_in": 35991,
  "expired": false
}

The nameserver itself appears to be set up correctly.  When I dig for my .bit domain, the IP shows up as expected:
$ dig aoeu2code.bit @ns.aoeu2code.com

; <<>> DiG 9.10.3-P4-Debian <<>> aoeu2code.bit @ns.aoeu2code.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17650
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;aoeu2code.bit.                 IN      A

;; ANSWER SECTION:
aoeu2code.bit.          604800  IN      A       69.180.151.171

;; AUTHORITY SECTION:
aoeu2code.bit.          604800  IN      NS      ns.aoeu2code.com.

;; Query time: 1 msec
;; SERVER: 69.180.151.171#53(69.180.151.171)
;; WHEN: Sat Nov 18 01:30:58 CST 2017
;; MSG SIZE  rcvd: 88

However, when I try to resolve my .bit domain via ncdns, it does not try to use my nameserver, it uses a different one, ns.mydomain.com.mydomain.bit instead of ns.mydomain.com:
$ dig aoeu2code.bit @localhost -p 5300

; <<>> DiG 9.10.3-P4-Debian <<>> aoeu2code.bit @localhost -p 5300
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25963
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;aoeu2code.bit.                 IN      A

;; AUTHORITY SECTION:
aoeu2code.bit.          600     IN      NS      ns.aoeu2code.com.aoeu2code.bit.

;; Query time: 0 msec
;; SERVER: ::1#5300(::1)
;; WHEN: Sat Nov 18 01:24:44 CST 2017
;; MSG SIZE  rcvd: 73

BTW, I'd also like to be able to give myself coins on the testnet chain and run tests there, since I have been having a little bit of trouble obtaining namecoins.  I can run namecoind -testnet and namecoin-cli -getinfo shows my balance is 0, but other than that I have no clue how to use the testnet chain.

I needed to put a trailing period into the "ns" record in the blockchain.  Then the correct nameserver was used.
Also, ncdns is NOT a recursive nameserver, so it returned the correct NS record but did not reach out to the nameserver for the IP.  I had to set up Unbound as described in the ncdns readme in order to actually resolve my .bit domain to an IP.


text:
Does GNOME or KDE desktop enviroment matter, at running a BitcoinCore node?
I have just installed Debian 9 (my first linux OS), and I am now choosing my Desktop enviroment. I have doubts at choosing between GNOME and KDE.
I know that both are conpatible with BitcoinCore, but my concern comes from the UI differences. The KDE and Bitcoin Core UI are both runed by Qt and GNOME is runed by GTK.
Does this have any significance?

The particular desktop environment does not have a direct impact as long as you have the necessary libraries for running Qt applications.
On Debian (or Debian-Based distributions, such as Ubuntu) the following command should install the dependencies necessary for the UI:
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

Those are the packages used by the bitcoin-qt package. Source

And which are those libraries?

I have edited the answer to answer your question. However, most package management systems will handle installing dependencies for you.