Bitcoin Forum
May 24, 2024, 05:33:08 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [29] 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ... 590 »
561  Bitcoin / Development & Technical Discussion / Re: Why importprivkey needs rescanning blocks instead of checking UTXO? on: February 29, 2020, 05:08:02 PM
There are many reasons, but it mostly comes down to technical debt in Bitcoin Core's codebase.

Originally, Bitcoin Core did not build a UTXO set. Instead it indexed every transaction in the blockchain and would look up transactions directly. So when a new transaction arrived, it would lookup the transactions specified in their inputs and check whether the specified outputs were marked as spent. There was no separate UTXO set as we do today. So to get the UTXOs for an import, you had to rescan the entire blockchain. Even after the change to construct a separate UTXO set, this hasn't really been changed.

The second issue is the wallet itself. The wallet does not work with UTXOs. It uses entire transactions, which you cannot get from the UTXO set. The wallet computes the balance by iterating through every transaction stored and checks whether each output belongs to it before adding its amount. So there is no explicit UTXO set in the wallet either, it has to check every transaction it stores. Because of this, we cannot use just the UTXO set as we require storing the entire transaction, even if only one UTXO as actually ours.

The last reason is that users expect to be able to see their transaction history and be able to look at transaction details. Both of these are not possible without a rescan. Just the UTXOs do not provide the transaction history, and the UTXOs also do not give any other details about the incoming transaction.



Reworking the wallet so that you can just scan the UTXO set (and so that does things with just UTXOs too) is on my list of things to do. But there are other priorities in the wallet right now as what it does now is still mostly sane.
562  Bitcoin / Development & Technical Discussion / Re: Doubt on double spending on: February 26, 2020, 06:08:46 PM
This method of pruning was never implemented. Bitcoin Core uses a different method for pruning that is more efficient.

With this method of pruning, parts of the merkle tree is still stored, not just the root hash. It's more than just the block header. As transactions get spent, their txids get pruned from the merkle tree and the intermediate merkle branch hashes are stored. So if you were to perform a double spend, looking up the input would fail either because the txid is no longer stored as it has been hashed with others into a merkle branch, or it is still there but the particular output you are spending has been marked as spent. Either way, it is still safe.

But this is not as efficient and harder to reason about than how Bitcoin Core does pruning today. Bitcoin Core today builds a separate database of just the UTXOs. As a block is processed, all of the transactions are verified and the UTXO set is updated. When a block is done processing, it actually doesn't need to keep the block around because the UTXO set is what determines the chain state. So in Bitcoin Core, after a block is deep enough, its transaction data is discarded in entirety. The block header is still kept in another database, but the block data itself is deleted. This is safe because all of the important information, the UTXOs, are stored separately in the UTXO database. So if a double spend were to occur with a transaction that has been pruned, the output being spent would not exist in the UTXO database and thus that double spend is invalid.
563  Bitcoin / Development & Technical Discussion / Re: Why Bitcoin blocks are generated every 10 minutes? on: February 26, 2020, 05:52:23 PM
Sad to see another topic get derailed into another block size and LN argument. /locked
564  Bitcoin / Development & Technical Discussion / Re: latest bitcoin core version still support mining ? on: February 23, 2020, 11:50:20 PM
generatetoaddress is for regtest only. It is only used for testing purposes. It cannot be used on mainnet. Bitcoin Core no longer has mainnet mining capability. This has been removed for a long time
What? Since when? Works fine for me:
Didn't work last time I tried it, but that was also a while ago, so I probably just misremember.
565  Bitcoin / Development & Technical Discussion / Re: latest bitcoin core version still support mining ? on: February 23, 2020, 02:58:37 AM
generatetoaddress is for regtest only. It is only used for testing purposes. It cannot be used on mainnet.

Bitcoin Core no longer has mainnet mining capability. This has been removed for a long time because it is not worth CPU mining (as mining with Bitcoin Core was). Even if you do use a version of Bitcoin Core that has mining capabilities, you will never find a block.

If you just want to learn how mining works, do it on regtest or testnet. You will need external mining software. Running a CPU miner on mainnet won't get you anything. You probably won't find any shares that can be submitted to a pool either.
566  Bitcoin / Development & Technical Discussion / Re: Why does importing a compressed private key result in an uncompressed P2SH Segwi on: February 17, 2020, 06:08:24 PM
1. Yes, this version number (5.7.1) is under "help".
Go to Help > About Bitcoin Core not Help > About Qt

Address WIF    mqHRuQJ7yZMTy8rYHSJnmUVWC1eY9UsxRW
That's not WIF, it's not a private key.

Here's an example TestNet:

Priv Hex:       d3751d33f9cd5049c4af2b462735457e4d3baf130bcbb87f389e349fbaeb20b9
Priv WIF:       cUfkJKKBr962B4JcCvKv3TZPgsLn6mGxwqDrANjvrsZZvzim1p9V
Pub Key:        03c49741ee0b1c03ec1478da5157bd41709ae7a23f36fbff8b5c18a5222cc62a9e
Address WIF    mqHRuQJ7yZMTy8rYHSJnmUVWC1eY9UsxRW


-------------- BitCoin Core  -----------------
P2SH Address: 2N8fMnWYo2h9JfZZvYFnPC73baYn5E3oyiU


--------------- My calculation: --------------------
P2SH Address:  2N31hbddcKtjwUyhuN6csz8dNgtYiaXcvZY
How did you compute this P2SH address?

I've imported that private key and it does not produce a P2SH segwit address with an uncompressed pubkey. The address that Core produces (the one that you have listed) has a compressed pubkey. What makes you think that it is uncompressed? That you have calculated a different address?



Your calculated P2SH address is incorrect and will result in lost funds.

You have hashed the public key and just made that hash the hash inside of the P2SH. That is incorrect. The public key is not a script and it is not the redeemScript. The correct thing to do is to produce the Segwit scriptPubKey, hash that, and put that hash inside of the P2SH.

The Segwit scriptPubKey is 00146b227b4934af1a8f9648b40c3614dec300abf435. Note that it contains the pubkey hash but has more to it than just the pubkey hash. The hash of this script is a91a60e23a8ce5654cbefb50cdee7c05acfc82b1 which means that the P2SH scriptPubKey is a914a91a60e23a8ce5654cbefb50cdee7c05acfc82b187. This corresponds to the address of 2N8fMnWYo2h9JfZZvYFnPC73baYn5E3oyiU produced by Bitcoin Core.
567  Bitcoin / Bitcoin Technical Support / Re: My Tor Node IP? on: February 16, 2020, 06:01:10 PM
It should be in getnetworkinfo under localaddresses. It should also be logged in your debug.log file.
568  Bitcoin / Development & Technical Discussion / Re: How does a node knows the current tip of best block chain on: February 10, 2020, 04:53:00 PM
Question 1:
Assume some node is offline for a long time. After it reconnects to block chain, how does it know what is latest block? As his peer nodes maybe "wake up just now". From their view of chain, maybe the current tip is not the really Latest block.
A node will connect to many peers in a way that is unlikely to have many peers that are also behind. The reason for this is twofold. Firstly, a node will store a database of peers and some information about those peers. When it starts up, it chooses peers from that database and chooses them based on some "goodness" information it stores. Secondly, if that database is too small or has a lot of offline nodes, then it will use the DNS seeders. The DNS seeders will filter for nodes which are up for a long time so new nodes will be connected to seed nodes that know many peers. Those nodes will return additional nodes for new nodes to connect to based on node uptime and other characteristics. So peer discovery itself will select for nodes that have been up for a while and thus are likely to have the latest block.

But even if all of the peers are just coming online, they too will be connected to other nodes and syncing their own blockchain. As they receive new blocks and block headers, they will be able to serve them to their peers. So if you are only connected to nodes that are still syncing, you will still sync from them as they sync their blockchain from their other peers.

Question 2:
I am confused how "IsInitialBlockDownload" function works. What is role of this function? It require a node to download a fixed number of block("nChainWork" must more than "nMinimumChainWork").
It is a bunch of heuristic tests that just check for whether the node is likely to be not synced. It is used to disable certain functionality that is dependent on a recent blockchain (IsIBD will return true before being fully synced).

Question 3:
I run the a new node and read its debug.log file. I find Node got many inv tx info. But it does not sync all the block data(blk***.dat). And it does not "Requesting tx data of tx hash". why ?

"2020-02-10T12:21:14Z got inv: tx 04ef3414b55e45555ebfad775b6164827a020a25836e6a4db87eeb9ebee462d9  new peer=4
"
Other nodes will just send invs to all of their peers regardless of sync state and other status. It is up to the receiver of those invs to do something with them. Because your node is still syncing, it won't request those transactions as it might not be able to validate them yet.
569  Bitcoin / Bitcoin Technical Support / Re: compare and relate raw transaction info with block explorer's info on: February 02, 2020, 07:48:01 PM
Ok, so that means that if I decode the transaction after signed, I'll get the same values as the block explorers will tell me after I broadcast it?
Yes.

Another question I have is that after I sign a transaction and I want to cancel it, do I need to undo any action or I just ignore it and issue the createrawtransaction and signrawtransactionwithkey commands again and broadcast the last one?
Transactions cannot be canceled. There is no undo nor can you force any nodes on the network to forget about your transaction.

You can try to replace a transaction with another if you have it set to signal BIP125 RBF. In your original transaction, you need to set the replaceable argument of createrawtransaction to true. So you would do something like
Code:
createrawtransaction '[....]' '[.....]' 0 true
That 0 is needed for the locktime. Setting it to 0 just means no locktime.

When you send your replacement transaction, you need to use the same inputs but also pay a higher fee. Note that replacing a transaction is not guaranteed to work. Not all nodes support RBF, and various network issues may cause your original transaction to still be mined. Furthermore, you can only replace transactions that have not yet been included in a block.
570  Bitcoin / Bitcoin Technical Support / Re: compare and relate raw transaction info with block explorer's info on: February 02, 2020, 04:18:04 PM
As far as I know, it will fail to decode the RAW transaction if it isn't signed.
That is not true. decoderawtransaction will decode unsigned transactions. This is intentional. Users need to be able to decode and understand their transaction before it is signed

Ok, I could use the decoderawtransactio before and after signing the transaction. But the extra parameter True in decoderawtransaction is not accepted, unless I used it wrong. I just added the word True at the end of the command. I'm not sure it needs any JSON special chars to be accepted.
Use a lowercase t. so it's true not True.

Anyway, I hope I don't run into trouble (risk) of disclosing any private info by sharing these 2 images. I hope that no one is going to take the pictures, process them and be able to undo the white lines I draw to hide possible sensitive private information present in the decoded transaction details.
There is no private information contained in a transaction that can cause Bitcoin loss. Transactions are completely public information, so anyone can go look up your transaction in a node anyways and learn all of the details that you have tried to hide. The only "private" information are txids which may allow others to link this transaction to your identity which reduces your privacy.



The difference in size is because you are comparing your unsigned transaction to the signed one. createrawtransaction creates an unsigned transaction signrawtransactionwithkey will modify the transaction and add signatures to it.
571  Bitcoin / Development & Technical Discussion / Re: Compressed signature on: January 27, 2020, 11:47:30 PM
Any public key is simply privateKey*basePoint. Thus, having two public keys we can now add these two points and have "shared public key": (privKeyA*basePoint)+(privKeyB*basePoint)=(privKeyA+privKeyB)*basePoint. In this way we can join as many public keys as we want (without revealing private keys), creating one public key for all of those inputs.
This is not secure. I can generate my own priv and pubkey pair, subtract everyone else's pubkeys from that to get a different pubkey, then claim that calculated pubkey is mine. When all those pubkeys are added up, you get the pubkey I generated which I have the private key for. So now I can use my private key to produce a signature and steal coins. I would be able to do this with any other UTXO for which I know the pubkeys for without needing anyone else to be involved.

Then, we need a valid signature matching this key and it will be enough to validate it. Assuming common-input-ownership heuristic it may be a good way of merging all inputs into single output owned by the same entity, but I am still thinking about doing it in a secure way without knowing all private keys.
I don't think there is a secure way to do this with ECDSA, or if there is, it will be fairly complicated. ECDSA does not allow signatures to be combined linearly which makes this difficult.

What you are describing is a technique known as Cross Input Signature Aggregation. This is an idea that has been around for a while, and using Schnorr signatures, would be possible. Schnorr signatures can be combined linearly and there are now secure pubkey aggregation and signature aggregation schemes that have been developed using Schnorr signatures. The proposed Taproot and Schnorr signatures BIPs do not include Cross Input Signature Aggregation, as it requires more complicated changes to transaction formats, but do introduce Schnorr signatures themselves. So in the future, we could deploy Cross Input Signature Aggregation into Bitcoin using Schnorr signatures.
572  Bitcoin / Development & Technical Discussion / Re: Questions about version number in block header on: January 27, 2020, 11:35:01 PM
Does this mean that version number actually is not part of the consensus rule, since miners could set whatever version number they want?
There are consensus rules regarding what the version number can be. But there is no consensus rule saying that the version number must be a particular value.

E.g. there is a rule saying that the number cannot be less than 3. But there is no rule saying that it must be 4, so it can be 4, 5, or any other number so long as it is greater than 3.
573  Bitcoin / Development & Technical Discussion / Re: Questions about version number in block header on: January 27, 2020, 07:01:33 PM
1) I noticed that the version number could be different for blocks. How could we introduce a new version number by soft forking?
A soft fork isn't required to use a different version number. Some numbers cannot be used, but, for the most part, miners can set whatever block version number they want. This is what allows them to use the version number to signal soft fork readiness and also allows them (unfortunately) to use asicboost.

2) Why doesn't it use compact Int to save bytes?
Compact int isn't very compact. There is not much space to be saved there, and really no reason for the version to be a super expandable field.
574  Bitcoin / Development & Technical Discussion / Re: Is witness script itself malleable? on: January 27, 2020, 06:58:57 PM
Since the original transaction and the malleated transaction have the same transaction id, the mempool will accept the first it receives, right? Will mempool compare the fee rate for transactions with the same id?
Ah, yes, that's right. Because they have the same txid, they would be treated as the same transaction even though the contents are different. So if a node received the malleated one first, it would ignore the correct one later, and vice versa.
575  Bitcoin / Development & Technical Discussion / Re: Is witness script itself malleable? on: January 27, 2020, 04:39:04 PM
Yes, the scriptWitness is malleable.

While you could malleate a transaction to be larger, I'm not sure why you would. You can't change the fee that is paid by that transaction, so your malleated one would have a lower fee rate than the original, so it would most likely be rejected in favor of the original. That also means that the malleated transaction is less likely to show up in a block than the original transaction. Additionally, such malleation would make the transaction non-standard, so most nodes would discard it regardless of whether they had seen the original.
576  Bitcoin / Development & Technical Discussion / Re: How to force repeated payment of subscription cost using blockchain or LN? on: January 27, 2020, 04:35:18 PM
You can use Lightning Loop style swaps to rebalance the channel. Essentially, after the subscriber runs out of funds on his side of the channel, he can perform a Loop In swap where he sends the balance with an on chain payment and then the service sends the same amount back to the subscriber over their payment channel. This swap is enforced by Bitcoin scripts so that it is atomic.

For example, if the user has paid 1 BTC in subscription fees and now his side of the channel is empty, he sends 1 BTC to the service on chain, and the service sends 1 BTC to him over their channel. The net result is that both sides have the same amount of money, the channel can continue to be used for payments, and the service now has BTC that they can actually use as it isn't tied up in the channel.

This means that channels don't need to be continually closed and reopened, just every so often a Loop In swap is made.
577  Bitcoin / Development & Technical Discussion / Re: bitcoin core on github build fail ? on: January 21, 2020, 05:03:02 PM
What if I want to "After I push commit to github on my cloned bitcoin repo, then github will automatically build Bitcoin Core and run tests" ?
You will need to create accounts on https://travis-ci.org/ and https://www.appveyor.com/ and link them to your GitHub. Then you can enable builds for your cloned repo. They will then automatically build when you push.
578  Bitcoin / Development & Technical Discussion / Re: bitcoin core on github build fail ? on: January 21, 2020, 01:06:46 AM
travis-ci and appveyor and completely unrelated to your error, and to MSVC. They are services which automatically build Bitcoin Core and run tests and are used to check Pull Requests before they are merged. They are not for building Bitcoin Core locally.
579  Bitcoin / Bitcoin Discussion / Re: Bitcoin Core 0.19.0.1 Released on: January 16, 2020, 05:28:06 PM
Still, I also do not understand why the CPU mining was disabled. Users must have a choice and removing option what once was available is evil. This is exactly like removing PRIME95 stress test option because of waste of resources. Some people still have free electricity or want to use computer as a heat source.
Because it would be dead code and dead weight in the codebase. IIRC the CPU miner got fairly complex because it was using different CPU instructions and extensions and various tricks to make computing SHA256 hashes faster. This means that it was complex. If the CPU miner was still in Core, it would still have to be maintained which adds additional burden on developers. It means that refactors are a bit harder. It means that we would needs tests for it. Because it would be consensus related, it means that people have to review it more carefully, and if there are bugs, those have to be fixed. There would be feature requests related to the miner to do things like make it support Stratum and pool mining. In general, more work is required to maintain it, but it is a feature that few, if any, people would use at all. It was eventually decided that it was not worth maintaining a feature that basically no one used, so the CPU miner was removed.

Even so, there were other mining software that had more efficient CPU miners and more mining features than Core even when it still had a miner built in. So people who wanted to CPU mine weren't using Core anyways.
580  Bitcoin / Development & Technical Discussion / Re: Merkle tree and Bitcoin block on: January 15, 2020, 05:18:34 PM
That's because blocks don't contain the hashes. If it did, then you'd lose the transaction data itself which means you can't validate the transactions themselves.

The merkle tree is used for proving to clients that don't have the full block that a given transaction is in that block. A full node can provide such a client the block header and the path of merkle branches to a particular transaction so the client can be sure that that transaction was in the block.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [29] 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ... 590 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!