text:
Moving funds from MultiBit 0.5.18 into new Software (Electrum)
Since Multibit support has ended I want to move my funds to a new software. As far as I've seen Electrum is recommended for this purpose. I've followed instructions from the answer of Dr.Bob https://bitcoin.stackexchange.com/a/57325/113828 in this question.
Now I've a Electrum 4.0.9 wallet with status [imported] and it displays the correct amount of credits at the bottom of Electrum.
Can I now leave things as they are and I've switched successfully to Electrum? And I can use it for upocming sendings and receivings? I just want to make sure sure that someday my funds won't be inaccessible since Multibits support has ended.

You can use it. Electrum, nowadays, is as popular as Multibit used to be, so you can assume that you will always be able to recover your coins.
To be safer, you can export the private keys from Electrum and save them in an encrypted archive such as ZIP or 7zip. (But you need to do this every time you make a transaction)
What I would actually do would be to create a new wallet in Electrum, but this time, of type HD wallet. Then you can write down just a few words (12 or 18 ?) and be able to physically backup your coins. This would have the advantage of not having to update the backup as all your private keys would be deterministic childs of your master key (=those words)

Ok thanks. How do I get my coins into the new HD wallet? By normal transfer?

Yes. Old wallet -> HD requires a transaction.


text:
Distinguishing bitcoin deposits
If i had a central Bitcoin wallet, and then allowed 3 different people to deposit bitcoin into that address, would there be anyway to distinguish who they are, without knowing who's address is who, i know sending messages with transactions isn't supported by all wallets so i was just wondering if there was a different way.
Like i said i've tried passing a message through the transaction but that isn't always possible from the wallets.
Maybe theres another way to check someone is the owner of a wallet. Other than signing a message of course.

Generally speaking, the only way to distinguish incoming payments is by some combination of

sending address (usually arbitrary and not always known in advance)
amount (could be same for many people if you are selling fixed-price widgets)
receiving address (no good if you give everyone the same address to send money to)

That is one reason why best practice is to generate a new receiving address per transaction.

source: Stack Exchange

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

sort: votes


text:
In what year and in which Bitcoin improvement proposal Opcodes such as OP_MODE have been disabled?
On Bitcoin wiki several opcodes are listed as "disabled".
My question is simple: which Bitcoin improvement proposal proposed to disable them, and when they have effectively been disabled in the past?
I'm particularly interested in the OP_MOD arithmetic opcode.

It appears many unused opcodes were disabled in 2010 for security reasons (at least OP_CAT) or as a security precaution (many others).
Pseudonymous commented that the first BIPs didn't start until 2011 - a year later.

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


text:
Script: How to check if the top item on the main stack is numeric or not?
I'm looking for the clearest way to check whether the top element of the stack is numeric or not.
Thank you in advance

The best way that I know is quite involved because bitcoin-core standardness rules around Minimal representation of script ints. If you really need to do this, I can add detail in an updated answer.
Execution vs Satisfaction:
But in almost all cases, you should never really need to check such a thing. Recall that Bitcoin Script satisfaction requires Script executes successfully. At the end of the day, we are not interested in what is execution result, we are interested in whether the witness is valid or not. And the user redeeming the coins knows whether the pushed number is ScriptInt or not, they are let the interpreter know via additional boolean input.
Previous Code: where stack top is element `e`
OP_ISTOPNUMERIC # hypothetical that pushes 1 or 0 onto the stack top
OP_IF
    <process_num>
OP_ELSE
    <something_else>
OP_ENDIF

can be read written equivalently with two user input elements [e, e_is_num] where e_is_num is at stack top denoting whether e is numeric or not.
New code: with stack as `[e, e_is_num]`
OP_IF
    <process_num>
OP_ELSE
    <something_else>
OP_ENDIF


text:
How Do I Stop My Voltage Converter From Overloading?
I have been trying to run miners that I obtained from Whatsminer
They require 220V - 240V power source. Since I live in the United States, I have tried 110 to 220 V step up converters. I have tried 3 different converters, and each one overloads. The miners will run for a short period of time, then overload the converter and the converter will shut down.
Does anyone have suggestions on what I can do to get my miners running? Surely there must be other people in the Western hemisphere that have gotten these to work at home...

Does anyone have suggestions on what I can do to get my miners running?

US split-phase homes are likely to already have a 220V outlet somewhere for high-powered appliances (laundry washers, etc). You need to be sure the miner's PSU is designed for split-phase and not single-phase because the earthing/ground arrangements differ.

An electrician can create a new 220V circuit and run new wires through your walls to 220V outlets in a suitable location.

A higher powered converter (say 5000 W) might work if you have a very high current outlet that can deliver an amount of power greater than the power rating of your miner plus the power losses inherent in any converter. For example an Antminer S19 needs 3250W, if we add 25% (a random guess) for power losses in the converter that means your supply needs to provide 3250 * 1.25 / 110 = 37 amps. Most outlets in US homes will be 15 or 20 amp outlets but you might have a 30 amp outlet for a clothes dryer or electric stove. There is a 50 amp NEMA outlet but I imagine it would be rare. This might be what you'd need for an S19 but I have no experience of that. Again a professional electrician can solve this for you.

Surely there must be other people in the Western hemisphere that have gotten these to work at home

In my part of the Western hemisphere all home power outlets are 230V and can at least power a 3.1kW - 3.4Kw appliance. 7-10kw appliances are common but are usually hardwired (non pluggable) by an electrician. Your problem doesn't exist here to the same extent.

As you have discovered, Mining bitcoin is really a light-industrial enterprise for which most US homes are unsuited. Many US homeowners would need to contact their electric supply company and get a higher power supply to their home. They also need to pay an electrician to do something like wire up a new high-powered circuit from the main panel to a subsidiary panel at the appliance location. Similar to running a hobby machine shop in the garage with an assortment of second hand industrial lathes and milling machines, welders, plasma-cutters etc.

Most houses in North America only have 100 amp service anyway, which is totally unsuitable to be loading a single leg of for a miner.

@Anonymous: Good points - answer updated a little.


text:
Bitcoins sent and confirmed by blockchain. But hasn’t been recieved
https://btc.com/57d2819220862abf8a54f4912f3f973f0041cf8c3d64e229ff6248417cad0e73
I have sent money from cryperium. They have confirmed that the money has been sent. But i havent recieved the money at the source. Please help

Thanks for the answer. So according to the blockchain link i provided the money has been recieved?  Is there anyone I can contact to help me with this? If the wallet is broken or isnt’t fully synchronised; is it still possible to recover the money?

The blockchain is the truth, the whole truth and nothing but the truth. It is the only truth,  the absolute truth. It is incontestible.
If the blockchain says the money was received it has been received. Money that has been received with more than five confirmations virtually never ever becomes unreceived.
It is probably worth checking several different copies of the blockchain by using several different blockchain explorers.
If a wallet does not show this amount it means one of:

The wallet doesn't know about the receiving address. Perhaps because the address was not generated by that wallet.
The wallet isn't fully synchronised
The wallet is broken in some way
A person managing the wallet is lying to someone without direct access to that wallet.

See also

Answers to other questions about money not received


text:
Bitcoin - private key but forgot password, please help!
I have private key but I forgot the password, is there anyway to get my bitcoin back.
Thanks,
Mina

Yes,
Install a fresh copy of the wallet on a different device and during installation use the option to recover a wallet from the private key (so it doesn't generate a new one)
Don't use the existing device in case something goes wrong and makes things worse.
A more specific answer isn't possible without knowing exactly what wallet you are using.

if your private key starts with 6 you have find the password.
or brute force it to find password.
if it doesn't start with 6 you can import to ant wallet or you can sweep it to your new coinomi wallet


text:
4 ERRORS GENERATED WHILE INSTALLING BITCOIND
I need your help plz.
I have been struggling for weeks to make bitcoind work in my mac terminal.
I installed all required programs and dependencies: xcode, bitcoin core, openssl, homebrew, and cloned the bitcoin repo but still when I run the "sudo make install" command, fours errors are generated and the bitcoin-cli commands are not there.
Below is the output of the 4 errors that showed up in my terminal,
make[2]: *** [libbitcoin_common_a-key.o] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1

Could you copy paste the full error message ?

Try to download and install it again in a new directory https://bitcoincore.org/en/download/


text:
Minimum characters to uniquely identify bitcoin trasanction in blockchain
What is the minimum number of characters (TXID from the beginning) which is generally considered to uniquely identify a bitcoin transaction in the blockchain?
(Similarly to git and a commit SHA - https://stackoverflow.com/questions/18134627/how-much-of-a-git-sha-is-generally-considered-necessary-to-uniquely-identify-a).


text:
Does Bitcoin no longer fulfill its original purpose?
The Bitcoin whitepaper details "a purely peer-to-peer version of electronic cash", usable for "small casual transactions".
According to BitInfoCharts, the average Bitcoin transaction fee is currently 58 USD.
Is Bitcoin no longer usable for its original purpose of being a peer-to-peer version of electronic cash?

The bitcoin lightning network is arguably more 'peer-to-peer' than the base layer, and it is perfect for extremely small transactions.


text:
What kind of human makes a single 300 BTC transaction?
As I'm watching the Bitcoin transactions in near-realtime, I see countless really MASSIVE ones, such as 300 BTC at once. One transaction.
What kind of person makes such a transaction? 300 BTC is currently $9,595,800 USD. Almost 10 million US dollars in one go.
Did somebody send them 10 mill over the bank system and the one who had the 300 Bitcoins trusts that transaction to not "get reversed" or something?

What kind of person makes such a transaction?

Its important to understand how bitcoin transactions work here. Whoever spent that output didn't necessarily send 300 BTC to someone else!
Under the hood, BTC exist as 'unspent transaction outputs' (UTXOs). Each UTXO has a certain value (the number of bitcoin it represents), for example someone may own a 300 BTC UTXO. To spend any amount of that money, the entire UTXO is consumed as input to a transaction, and new transaction outputs (UTXOs) will be created at the same time.
So if you owned a 300 BTC UTXO, and wanted to send someone 1 BTC, the transaction might look like this (ignoring transaction fees):
Inputs: (300 BTC)  --> Outputs: (1 BTC) (299 BTC)
Of course, it is also possible that someone really did spend 300 BTC all in one go. Or it is possible that those BTC were just transferred between two addresses that are owned by the same user. Or maybe multiple people were paid at the same time! Without being party to the transaction in question, its tough to say much more for certain.


text:
Can you use lower dual fuel electricity rates to run a crypto miner for heating with a second back up heat source?
Dual fuel electricity rates are significantly lower than standard rates.  There are devices made in Russia that are specifically sold as Bitcoin mining space heaters.  Is it permitted to use a crypto currency miner for heating and thus qualify for the lower energy rates?

Is it permitted

There are certain regions (e.g. the Pacific Ocean) where everything is permitted, and certain regions where doing stuff that are allowed by law may even land you in jail.

crypto currency miner for heating and thus qualify for the lower energy rates

Yes, this is a smart thing to do wherever it's cold and mining is permitted!
Be careful, if mining is illegal, your ISP or your energy supplier may figure out that you're mining.


text:
Understanding Bitcoin Validator Node Decentralization
I am hoping to better understand the difference between miner nodes and validator nodes and the decentralization risks (if any) posed by one party controlling X% of all validator nodes.
I have been making my way through some great resources on validation and miners here:

https://bitcoin.org/en/bitcoin-core/features/validation
https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch08.asciidoc

From what I understand, miner nodes do not have to have any of the blockchain downloaded, they can simply create hash attempts as fast as possible and report back to a ‘parent node/mining pool’ who can take the correct hash, form the block candidate, and propagate it to the rest of the network for verification and inclusion.  There exists a risk of the 51% attack when a miner (or group of miners) controls the hash rate and is able to create a longer chain or proof of work.
Is there also a similar requirement for the distribution of validator nodes to be decentralized?
For example, if a given party controlled the majority (or even smaller percentage) of validator nodes, could they change their Bitcoin Core code to do any of the following and disrupt the network?

Reject incoming mempool transactions based on their own implementation of an address block list
Flood the mempool with faulty transactions and slow things down for all other node participants (ie remove the initial verification checks for transactions (https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp))
Work in coordination with a miner to accept a mined transaction block that has invalid transactions
Reject a valid block that a miner legitimately has created, causing the reward to go elsewhere

Possible duplicate of https://bitcoin.stackexchange.com/q/95564/5406

As RedGrittyBrick points out, every node unilaterally validates all data they receive, thereby enforcing all rules of the Bitcoin protocol. Nodes can't be convinced by many peers telling them about invalid data. If data doesn't fit the consensus rules, they'll just drop that data and ban the peers that sent them invalid data. So, to respond with a bit more detail to your last paragraph:

For example, if a given party controlled the majority (or even smaller percentage) of validator nodes, could they change their Bitcoin Core code to do any of the following and disrupt the network?

Reject incoming mempool transactions based on their own implementation of an address block list
Flood the mempool with faulty transactions and slow things down for all other node participants (ie remove the initial verification checks for transactions (https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp))
Work in coordination with a miner to accept a mined transaction block that has invalid transactions
Reject a valid block that a miner legitimately has created, causing the reward to go elsewhere

It doesn't matter how many nodes misbehave, having a single honest peer is enough to learn about the actual best chain, and to learn about more peers. One exception is if all your peers are colluding to trick you. Then they can hide new data from you, and, if they also have sufficient mining power, even present you with an alternative shorter chaintip that your node will misconstrue as the best chain in absence of better information. If all your peers are controlled by an attacker, this is referred to as an eclipse attack.
Beyond that, yes, someone could do the things you propose, but they would not have the intended effect: nodes can reject transactions locally, but that will not stop other nodes from forwarding the same transactions to each other. Nodes can create faulty data and spam their peers with it, but their peers will simply ban them for relaying invalid data—your node won't ever accept invalid data just because it's presented multiple times. Nodes can deliberately accept invalid blocks, but that won't cause other nodes to accept those blocks. Nodes can reject a valid block, but that just forks them off from the best chain.
A node is free to create an alternate reality for themselves, but they cannot change other nodes' evaluation of the situation.

Thank you for all of these details, this is very helpful!

Validation
All Bitcoin nodes are validator nodes. There are no special validator nodes. No nodes rely on other nodes to perform validation. No nodes need to trust other nodes.
The only partial exception would be lightweight nodes that use Simplified Payment Verification (SPV) and which do not retain their own copy of the Bitcoin transaction journal (blockchain). But even SPV nodes perform as much validation as possible themselves.
Any miner that colludes with others to publish blocks that contain invalid transactions is throwing away money and harming themselves.
Mining
You have this part backwards. First the mining controllers have to obtain details of pending transactions and construct a block template before the mining hardware (typically ASICs) can start searching for a nonce value that causes the block hash to be less than the current target.
Hashes are not magic numbers that can be plugged into any old block. Block hashes can only be derived from a complete block (though pools can arrange that the hashing work be broken up and spread among pool members)

Related

Can a node be maliciously programmed to validate all the transactions coming from a specific entity?
Is it possible that most validating nodes are dishonest nodes?

Thank you for all of your help with this!


text:
Do mining pools eliminate the need to store blockchain?
Suppose I want to design generic crypto currency miner starting from scratch . By generic I mean it can be configured to support a large number of available crypto currencies.
This generic miner must be able to connect to mining pools for the coins it supports in addition to being able to mine solo. In the case that it is configured to connect to mining pool , it does not need to store the blockchain on the PC on which miner is running? In this case the blockchain is stored on the server running mining pool? In this case the miner PC only has the current block?
The answers to above questions do not depend on wether the miner is configured to use CPU or GPU or both?

A mining pool does need to store the entire blockchain, however that doesn't mean that every participant of the mining pool needs to store it.  Someone in the pool needs it, but not everyone.
Individuals in a pool can just be sent block headers and perform the proof-of-work without ever verifying the transactions themselves.  This does not require the full blockchain.  However, someone should have already verified the transactions ahead of time, and this node does need the blockchain.

You don't need the blockchain at all to validate transactions. You need the UTXO set defined by all previous transactions in the chain, but there is no need to keep the actual chain around. A pruned node is sufficient.

Yes, participants of the mining pool don't have to store anything certainly not the whole blockchain. What they need is the hash of the transaction included in the next block and the hash of the previous block.
The other part that has to be done but it’s the mining server that does it is validating transactions which can be a done by a pruned node minimizing the amount of data that has to be stored.

They don't need the current block either... They just need some pieces of the header, and a Merkle branch for the generation transaction.

Is this better?

I think it's not quite there yet. What they need is not a transaction - quite the opposite, they make up the transaction themselves. They need the Merkle branch that complements the transaction; and also the address to credit the pool. This is assuming that each work unit consists of multiple extraNonces; otherwise they don't need that, they are given the Merkle root and just use nonce and nTime rolling. If that's too complicated, you can just say that they need the header, it's not far from accurate.

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


text:
What is the significance of this red light on the Bitmain S9 board?
How can I fix this issue? Is it fixable?

What are you seeing on your Antminer Status page? Is two of your boards showing 0 under the GH/S(RT) column?
Because I believe the absence of the light indicates an issue.

Ant s9 has 3 arithmetic boards in total, normally each arithmetic board is green light, red light means this arithmetic board is faulty.

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


text:
Unspent account and additional wallet in a transaction
I just moved some BTC from one wallet to another.  As I investigated the TX ID, I'm confused by why there are other amounts that aren't what I sent.  In my case I sent .25 BTC, and there are 2 transactions showing up (1 for .25, and another for .7).  The other one says "unspent".
I'm wondering what's going on here, and if there is a simple explanation?

Most probably this is your wallet software doing for you. It might be, that your wallet only had one output to spend from, with .95 bitcoin. And you wanted to send only .25. So the wallet had to divide it somehow... it created a transaction with two outputs, one of which is the return address. Probably this address is also in your wallet. Check the addresses in the wallet, to see if it belongs to you. Or check the remaining balance. If there, then all ok. If not, there is a need for further investigation, but this would require more info...


text:
Displaying price in ETH based on USD exchange rate
How do i get the ETH rate in USD, and stored in a variable in php?

https://bitcoin.stackexchange.com/questions/60134/what-are-the-most-comprehensive-apis-for-cryptocurrency-market-data

There are an huge number of different sources, for instance CoinMarketCap have all the existing coins with the relative value in dollar, computed by averaging over many exchanges.

Ok... Please, how do i get and store the value of this crypto in a variable using php. So i can use as i deem fit.. A simple line of code or more, will be greatly appreciated.


text:
Setting the fee rate on regtest, or, quickly generating full blocks
I'm setting up some automated testing for a lightning wallet. At the heart of my tests is a bitcoind instance running in regtest mode. I need to be able to set the fee rate - both the fee rate reported by estimatesmartfee and the fee rate which transactions need to match in order to get confirmed.
So far, the only way I can see to do this is to mine lots of blocks filled with transactions that have the desired fee rate. I'm doing this by calling sendtoaddress (via bitcoin-cli) repeatedly in a loop to send small amounts of money into the void. This is painfully slow - it involves generating ~2500 transactions before bitcoind catches the drift that this should be the new reported fee rate. And I have to do this for every test, sometimes multiple times per test, so my CI is taking forever.
I'm wondering if there's any way to avoid doing this. Is there some way to override bitcoind's estimated fee rate and have it refuse to include transactions which pay less than that fee rate when mining blocks? If not, are there any quicker ways to pad out blocks with transactions than what I'm doing?

You can use a wrapper to mock the feerate.
Let's say you are writing your tests in Python. You can set up a Python RPC wrapper for the bitcoind interface, and optionally turn on a mock for specific tests (instead of calling bitcoind's estimatesmartfee it would return a preset value).
That is how it's done in C-lightning's functional tests. A good instance is this test which simulates a crash of bitcoind to test lightningd can support spurious failures of its Bitcoin backend.
See also a sample of feerate mock here.

I have created a bash script that is less complex than the Python script that @darosior references, but is heavily influenced by it. It keeps creating sets of 10-30 transactions until estimatesmartfee returns a fee rate.
#!/usr/bin/env bash

set -eo pipefail

cont=true
smartfee=$(bitcoin-cli estimatesmartfee 6)
if [[ "$smartfee" == *"\"feerate\":"* ]]; then
    cont=false
fi
while $cont
do
    counterb=0
    range=$(( $RANDOM % 11 + 20 ))
    while [ $counterb -lt $range ]
    do
        power=$(( $RANDOM % 29 ))
        randfee=`echo "scale=8; 0.00001 * (1.1892 ^ $power)" | bc`
        newaddress=$(bitcoin-cli getnewaddress)
        rawtx=$(bitcoin-cli createrawtransaction "[]" "[{\"$newaddress\":0.005}]")
        fundedtx=$(bitcoin-cli fundrawtransaction "$rawtx" "{\"feeRate\": \"0$randfee\"}" | jq -r ".hex")
        signedtx=$(bitcoin-cli signrawtransactionwithwallet "$fundedtx" | jq -r ".hex")
        senttx=$(bitcoin-cli sendrawtransaction "$signedtx")
        ((++counterb))
        echo "Created $counterb transactions this block"
    done
    bitcoin-cli generatetoaddress 1 "mp76nrashrCCYLy3a8cAc5HufEas11yHbh"
    smartfee=$(bitcoin-cli estimatesmartfee 6)
    if [[ "$smartfee" == *"\"feerate\":"* ]]; then
        cont=false
    fi
done
bitcoin-cli generatetoaddress 6 "mp76nrashrCCYLy3a8cAc5HufEas11yHbh"


text:
Why do bitcoin: URLs not use "//", breaking "clickability"?
I want to have something like this in a plaintext e-mail:
Pay directly: bitcoin:addresshere?amount=0.001&label=Blablabla&message=Blablabla

But if I do that, it won't be "clickable", because the standard URL format would be:
Pay directly: bitcoin://addresshere?amount=0.001&label=Blablabla&message=Blablabla

Why does the bitcoin: URL scheme not use the // part? Is it intentional to not be clickable? Or am I wrong in my assumption that e-mail clients will not make it "clickable"?

The Bitcoin URI scheme is defined in BIP21:

Bitcoin URIs follow the general format for URIs as set forth in RFC
3986. The path component consists of a bitcoin address, and the query component provides additional payment options.

You can read through the entire RFC document or the summary on Wikipedia which answers your question:

An optional authority component preceded by two slashes (//),
comprising:

An optional userinfo subcomponent that may consist of a user name and an optional password preceded by a colon (:), followed by an at
symbol (@). Use of the format username:password in the userinfo
subcomponent is deprecated for security reasons. Applications should
not render as clear text any data after the first colon (:) found
within a userinfo subcomponent unless the data after the colon is the
empty string (indicating no password).
A host subcomponent, consisting of either a registered name (including but not limited to a hostname), or an IP address. IPv4
addresses must be in dot-decimal notation, and IPv6 addresses must be
enclosed in brackets ([]).[24][c]
An optional port subcomponent preceded by a colon (:).

Conclusion: the Bitcoin URI scheme is RFC-compliant and does not require the optional "authority" component which is what the // deliniates.

Because addresses aren't meant to be clickable. They're too ugly to be featured in proper UX. If they were clickable, then more developers would show them directly to the users. Making them unclickable is a good way to incentivize the URIs to be embedded in buttons.
Plus, clickable URIs are harder to select and copy. We want either "Open In: "Wallet" " or selectable addresses or showing the first few and the last few characters. Clickable URIs don't solve any.


text:
Transaction 30MB+ from the tip for days, new message when I logged in today. Please explain
I had a pending transaction pending for days. I was in no rush and was not going to increase the fees.  I received a new message when I logged into the wallet today. It stated the transaction was on the local network and needed to be broadcast.  I had already broadcast it and signed it days ago. Please explain. Thank you.

Your wallet will broadcast your transaction to other nodes on the network, and those nodes will (most likely) add your transaction to their mempools as it awaits confirmation. If the transaction does not confirm after an extended period of time, nodes may drop the transaction from their mempools - when and what transactions are dropped is a policy that is configurable by each individual node, so ultimately there is no saying exactly when a transaction that is unconfirmed will be dropped from the network (if at all).
I believe the default setting for bitcoin-core nodes is to drop a transaction after two weeks, or once the mempool hits 300 Mb (starting with the lowest fee-rate transactions).
So if you transaction is quite old, or has a fee-rate that leaves it far below the top fee-rate transactions in the mempool, then it may be dropped by a large number of nodes in the network. At that point, your wallet software may prompt you to re-broadcast it, so that it can be confirmed.
Ideally, you would be using a wallet with RBF enabled, so that you can simply increase the fee as necessary to help gain transaction confirmation according to your needs.

Got it. Yes, I have a RBF but I am quite stubborn on increasing the fees. I didn't know a transaction could be dropped. It was at the most 50+MB from the tip of the mempool. Thank you very much.


text:
How to send little BTC coin in Bitcoin wallet
I use bitcoin wallet (find here)
I tried to send 32$ (All of them) to Binanace OR my Trust wallet or etc , but appear below error :

You should pay fees, fees cant be 0.

Careful, bitcoin,com is run by scammers! Get your coins out of there ASAP and never look back.

@Зелёный how to set fee? I choose BTC network fee policy is Economy , other wallet automatic handle pay fee .

Maybe it can't add fees because the amount you set is maximum. Unfortunately there's no "send all" option in bitcoin.com wallet, so you could instead enter the seed to a different wallet to send all your coins.

Chapter 2 :-) https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch02.asciidoc


text:
Create a non-SegWit address in electrum wallet
I am trying to get along the electrum wallet command line in ubuntu. However, my exchange only accepts withdraws to canonical non-SegWit addresses (i.e. it only generates with a "bc1" prefix). Is there a way to specifically specify such an option when typing electrum createnewaddress?

"bc1" addresses are segwit.

open console and then type create(seed_type='standard')
then you open this with File->Open->THE NAME YOU CHOSE usually Default


text:
HD wallet: Can an external party relate addresses?
DISCLAIMER: This question is not strictly for Bitcoin but a general question about wallets and any cryptocurrency.
Hi there!
Is it possible to relate 2 different addresses generated from an HD wallet (both deriving from the same seed phrase)?
I mean, being addr-1 the first generated address and addr-2 the second generated, would it be possible somehow for an external viewer to know that both addresses belong to (or were generated from) the same wallet (same seed phrase)?
My understanding is that it is impossible, by the way key-derivation functions work. But I'd like to confirm my thoughts. Any technical detail is appreciated
Thank you!

It's not possible to discover that the addresses are related in any way from the addresses alone. It can however be possible to deduce that addresses are owned by the same entity from how funds received to addresses got spent.

Hi there, just to be sure, what do you mean by "from how funds received to addresses got spent"? Do you mean an assumption but not a proof, right? Like if I pay my rent from addr-1 even months and from addr-2 odd months, then someone could "assume" but not prove in any way that both addresses are controlled by me? Is that what you mean? Thx!

I mean that when you spend your rent from funds that were received both to addr-1 and addr-2 in one transaction, the common input ownership heuristic suggests that you are in control of both keys. Or if you pay your rent from addr-1 and then use the change output to pay something else, your landlord may guess that the second address was also sent by you. Or if you use funds from addr-2 with the change from the transaction that spent from addr-1 that all addr-1, the change address and addr-2 are owned by you. Check out https://en.bitcoin.it/wiki/Privacy for more thoughts on this.

Thanks! But all of these are suggestions or hypothesis, right? In none of these cases they become a proof, does it? I think I get your points, useful to understand.

@GerardBosch: Yes, they all only are indicators, not proof. But if multiple of these indicators overlap and point at the same conclusion, they can become sufficiently reliable.

Any technical detail is appreciated

The most common forms of address in Bitcoin (e.g. P2PKH) are the result of a hashing operation using hashing algorithms like SHA256.
As a random website put it:

There are four main characteristics of a good hash function:

The hash value is fully determined by the data being hashed.
The hash function uses all the input data.
The hash function "uniformly" distributes the data across the entire set of possible hash values.
The hash function generates very different hash values for similar strings.

(my emphasis)
So the hashes are indistinguishable from random numbers. Which means you cannot learn anything about the original data by studying them. You cannot tell if two hashes are the results of data that differs by one bit or by a million bits. You cannot tell if two hashes are related. You cannot tell if two addresses are related only by studying the addresses.
Similar characteristics apply to public-keys and some other interesting numbers appearing in the public replicated journal of transactions known as the Bitcoin blockchain. I believe the process that produces a private key or a public key is intended to produce numbers that outside observers will not be able to distinguish from numbers produced completely randomly.

For example given these numbers
ad57366865126e55649ecb23ae1d48887544976efea46a48eb5d85a6eeb4d306
16dc368a89b428b2485484313ba67a3912ca03f2b2b42429174a4f8b3dc84e44
37834f2f25762f23e1f74a531cbe445db73d6765ebe60878a7dfbecd7d4af6e1
454f63ac30c8322997ef025edff6abd23e0dbe7b8a3d5126a894e4a168c1b59b
5ef6fdf32513aa7cd11f72beccf132b9224d33f271471fff402742887a171edf
1253e9373e781b7500266caa55150e08e210bc8cd8cc70d89985e3600155e860
482d9673cfee5de391f97fde4d1c84f9f8d6f2cf0784fcffb958b4032de7236c
3346f2bbf6c34bd2dbe28bd1bb657d0e9c37392a1d5ec9929e6a5df4763ddc2d
9537f32ec7599e1ae953af6c9f929fe747ff9dadf79a9beff1f304c550173011
0fd42b3f73c448b34940b339f87d07adf116b05c0227aad72e8f0ee90533e699
9bdb2af6799204a299c603994b8e400e4b1fd625efdb74066cc869fee42c9df3

From anything above, there is no analytic way to tell how they are related

Hi there, I guess from your post that the answer is: "No, it is not possible to relate them", right? :)

There are in fact huge and profitable businesses based on transaction surveillance of the blockchains.
Maintaining any privacy at all is a very difficult technical rabbit hole if you are transacting on chain.
Powerful adversaries of privacy are constantly striving to keep Bitcoin transparent as it was designed.
From a static POV, no the fact that multiple addresses were all generated from the same HD Account-wallet, cannot be deduced mathematically.


text:
Doesn't creating a masterkey password on Kraken void the protection of 2FA?
Kraken allows users to create a masterkey that is just a password. Wouldn't creating a password to bypass 2FA completely negate 2FA?

Yes. Your right.
A lot of 2FA/U2F enabled websites/webservices have such "recovery" methods.
2FA/U2F only works in the right way when you can't recover your login credentials if your second factor has been lost/not-available.


text:
What, if anything, can I do to recover bitcoin that was stolen from my MtGox acct in June, 2013?
I understand the short answer is "nothing", but I ask because I've had trouble explaining this to a coworker which made me realize I don't really get it myself.
What information can I glean from following the stolen bitcoin on a blockchain explorer?  1GvfmXt2CKP8QJfw93LNcnNV6KghD5ohVA
How useful is the IP address the withdrawal was made from? IP: 75.110.224.12
Do I have any legal recourse when the company in question is bankrupt, in Japan, and the theft occurred almost five years ago?
Thank you.

There is nothing that can be done with just a public address and an IP(as the real IP is most likely behind proxy/vpn/etc...).
Kraken was selected by the MtGox trustee to assist MtGox creditors in investigating missing Bitcoin, filing claims, and distributing remaining assets.
The due date for accepting MtGox creditor claims via online submission has past.
But creditors may still be able to submit claims via the offline claims method.

This hack happened before the bankruptcy. Can I learn anything from following the movement of the bitcoin after it was withdrawn? Anything at all?

Many have tried, example Wizsec, the conclusions are that the trails were obfuscated via mixing, laundering, or simply sold off for cash. Trails become statistically impossible to trace after going through several Darknet tumblers and cross-chain tumblers.


text:
Tramsaction taking long, 1 part is spent
So i made a transaction today:
https://blockchain.info/tx/1eab828a3e673e322aa4da4ff03962dbad3b2fa5b70818e3db9c5dc32abead93
Besides the fact that this is taking ages, 1 of them has the state 'spent'. I am missing some informatioon on this. Could someone explain this? And why is the rest unspent?

I am one of the people in your block right now and trying to figure out why were stuck. I paid for a transaction accelerator just now for our transaction so hopefully that resolves the issue

Did you withdraw your bitcoin from CEX.IO to Binance? Trying to narrow down the problem

no, gdax. I have the feeling that we shouldn't touch it anymore, so it will be dropped from the mempool, and will eventually will get back to your wallet.

Some exchanges combine many transactions into a single transaction when withdrawing, to save fees and be more efficient with space. It will likely confirm eventually, you'll just have to wait for a miner to put it in a block. One output could be spent already because it is possible to spend from unconfirmed outputs, just slightly more risky.
See also: Why is my transaction not getting confirmed and what can I do about it?


text:
Re-Installed Bitcoin Core, "Assertion Failed!" on Startup
I have had Bitcoin Core on this computer before, and it worked fine for over a year with no trouble. I had recently uninstalled it, and today attempted to re-install, but, after running setup, on attempting to open bitcoin-qt.exe, the following error appears:
Assertion failed!
Program: C:\Program Files\Bitcoin\bitcoin-qt.exe
File: wallet/scriptpubkeyman.cpp, Line 720
Expression: mapKeys.empty()
...with three options, Abort, Retry, and Ignore. This happens consistently.
I am running bitcoin-0.20.1-win64, Windows 10. I have tried further uninstalling and reinstalling, and installing in both a C:\ and D:\ drive. Running from the command prompt with -rescan does not help either.
Any assistance would be very much appreciated.

I think bug reports belong to https://github.com/bitcoin/bitcoin/issues

This indicates that your wallet file is corrupted. This error happens when the wallet contains both encrypted and unencrypted keys. Is your wallet encrypted? Did you try to encrypt it recently?

I didn't try to encrypt it, but you were correct that the wallet.dat file was the problem - as I was re-installing Bitcoin Core in a different folder, I didn't realize the old wallet.dat would still be recognized. I've moved the old wallet.dat to a USB stick and now the program runs with no issue.


text:
Can I use trezor as a backend?
One of my clients (who has a Bitcoin Node deployed) is interested in being able to use Trezor to accept payments.
The most important thing is the creation of a new address, obtaining information about transactions.
If there is such a possibility, how is it synchronized remotely from the server?

Hi localhost01, can you clarify your question? What kind of business relationship do you have with your client, what is it they hope to achieve by using Trezor specifically, and why would this setup need a remote server?

@VojtěchStrnad They do not want to use Trezor, as well as Bitcoin Backend. This is funny, but it seems that the client himself is confused in what he wants.

Creating new addresses
Trezor and other hardware wallets generate addresses in a deterministic manner, and they allow exporting a master public key (also called "xpub") which can be used by other software to generate the same addresses. This is convenient because it allows receiving payments without direct access to the hardware wallet, you only need it for sending.
Obtaining information from a server
Bitcoin is a peer-to-peer network with no servers. If you're running a node, you have information about every transaction that has ever happened. You can import the master public key into the node's wallet and scan the blockchain for transactions associated with it.


text:
The bitcoin opcode seems to have a flat rate
The bitcoin opcode seems to have a flat rate, is that correct?
Or, if bitcoin has a price per opcode, please give me the link.
If it is a flat rate, please tell me why bitcoin does not have a mechanism like ethereum.

Are you asking about the transaction fees that are paid to miners?

If by "flat rate" you mean that each opcode costs the same amount in transaction fees, then yes, Bitcoin does have a "flat rate". Opcodes don't have a direct fee themselves, the fee is based on the size of the transaction, and since each opcode is one byte, they have the same cost.
It is unnecessary to have an opcode cost scheme like Ethereum because opcodes are not very computationally expensive and do not have the same effects as Ethereum opcodes do. Bitcoin script is not Turing complete so it is impossible to loop. Each opcode can only be run a single time.
Furthermore, the more computationally expensive signature verification opcodes do have an additional cost in the form of the "signature operations" (sigops) limit. Sigops are factored into the calculation of a transactions weight which will then effect the transaction fee, but this effect is only present in extreme cases where there are a lot of sigops in a single transaction. Blocks are limited in the number of sigops that they can include.

Thank you.
The same thing happened at https://bitcoin.stackexchange.com/questions/100331/why-is-the-source-code-fee-calculated-higher-than-the-current-bitcoin-fee-amount.
I had MESSAGE_LIMIT = 80 set here, but can I think of this as the actual weight for the "op_return" opcode?
If you like, please answer.

@groundclown No. OP_RETURN isn't special. That is just how that particularly library is creating OP_RETURN outputs.


text:
Why does bitcoin use AES-256-CBC?
Why does bitcoin use AES-256-CBC? Why not some other block cipher operation mode? Is there a specific reason?

Encryption isn't part of Bitcoin at all. Nothing on the blockchain is encrypted. There is no encryption in consensus or the P2P network.
Only wallets have encryption for protecting private keys. Bitcoin Core specifically uses AES-256-CBC because it is not known to be insecure and is widely used. Other wallets may choose to use other encryption schemes.


text:
Inherited bitcoin. Want to sell. Have wallet.dat . Please help
Inherited bitcoin. Want to sell. Have wallet.dat on my computer. How to sell the bitcoin in the wallet? Do I need a passcode ?

Is your computer Windows? You need to install Bitcoin Core first.

Steps here: https://bitcoin.stackexchange.com/questions/101318/is-there-something-in-a-debug-log-from-2011-that-would-tell-me-if-there-are-btc/101319#101319


text:
Am I seriously going to have to keep this clunky old infernal machine running for weeks upon weeks to sync the blockchain?
Yesterday, I dug up my old computer, set it up physically, installed Linux Mint with full disk encryption, installed Bitcoin Core through its software manager, started it, immediately selected "pruned mode" in the settings (kept it at default 2 GB since I have no idea if it's good or bad to increase/decrease it), closed it and started it again, to let it sync from scratch to 100%...
When I went to bed, it seemed awfully unresponsive, with mouse movements taking several seconds before they showed up on the screen. When I woke up, and looked at the progress, it was still at 21%, with "10 weeks left". It now would not at all react to any attempts to close it or click on anything. I had to "hard-cut" the power to the machine and restart it. It's been running in the same sluggish, unresponsive state, still stuck at 27.x%, since.
Today, after desperately reading online for a solution, I changed the default "dbcache" to 6000 MB as somebody online said was the maximum where it matters. Seems to have no difference.
It's connected directly to 100/100 Mb/s fiber, and the hardware is 3 GB RAM and a 2011-era Intel CPU of 3 GHz or so. Dual core something. The HDD is 250 GB and mechanical. (Which is why it was not a choice to store the entire blockchain and I had to use pruned mode right away.)
It's a noisy, clunky machine which takes up a lot of space, and I really need to set up this wallet. It's important. This whole process is really dragging on and on and I did not expect this extreme slowness. I really can't express how frustrating this is. I don't get what the problem is. This isn't ancient hardware. It's just a few years old. And it's not a budget/cheap machine like a Raspberry Pi or something. Why is it going so insanely slowly?
Looking at the Linux Mint GUI tool to see system usage, it doesn't even seem to be using much of the CPU cores, but does write and read a lot on the disk... But it's always unclear (regardless of the OS) what actually is happening.
And reading online, apparently, Bitcoin Core has become much more efficient with syncing over the years! Perhaps it's offset by the increasing size of the blockchain? Either way, this is truly unbearable, and I don't know how much longer I can go on looking at that screen which seems to be forever stuck at "4 years and 13 weeks behind"...
I'd hate to have to give up and forget about it, but I have a feeling that even the "4 weeks" may increase further and that it's just going to take longer and longer. I expected it to be on overnight and perhaps most of today. Not weeks upon weeks with seemingly no progress being made after ~27%...
Oddly, even with the recent surge, this Bitcoin category on SE seems completely dead. I have no idea what people are doing, but they certainly don't seem to be looking for Bitcoin questions to answer...

What are you planning to use Core for?

@MCCCS To securely (compared to doing it on my Windows 10 machine which I'm typing this on and which has a fully synced Bitcoin Core) set up a new wallet and encrypt it and then store that encrypted wallet.dat in many redundant backups.

You can add your working node to your older computer which will then sync faster. Would this solve your problem?

You don't need to complete the sync to create a wallet. You need to sync to spend from your new wallet

@MCCCS Hmm... you actually have a point in that it doesn't need to sync. But it feels very scary to assume that it has received my entire Bitcoin fortune without seeing the account balance/transaction... But yeah... it doesn't technically need to... that's true... But as long as Bitcoin Core is running, it's using all my system resources, so doing anything is virtually impossible unless it can be paused. And that doesn't "seem right".

@MCCCS What exactly do you mean by "add your working node to your older computer which will then sync faster"?

Syncing not from the network but from your synced computer. Local LAN would be faster than 100/100

So, against your scardness, open the console in your wallet computer do dumpprivkey <addr> and unless it gives an error, you can be sure that your wallet.dat has your private key/will have your coins. You can then send your coins safely.

If you only have 3 GB of RAM, then setting the dbcache to 6 GB is going to make matters a lot worse. Synchronization is very database-intensive (constantly looking up things and writing updating entries back); on a system with slow disk operations this is going to be painful if you don't have enough RAM to cache significant parts of it. Pruning also slows things down, as it requires a database flush every time files are deleted.

It sound’s like the bottleneck is I/O on your hard drive. A couple of suggestions:

Copy the data directory from you other machine which you have already synced, this will skip you the initial sync entirely.

A lot of read/write is happening in the chainstate directory and full disk encryption probably doesn’t help. You can move the chainstate directory (around 3GB) to an SSD. If your computer doesn't have an SSD you can use an SSD thumb drive. There are instructions on how to do that here

You didn't read what I said. 250 GB HDD = impossible to copy over files.

Just make a backup and then prune your other node so it won’t be 250GB..


text:
Template of a DAO?
Where can I find a simple smart contract template of a DAO? not The DAO, but a Decentralized Autonomous Organization, rules, codes, bylaws, responsibilities, etc.

If are are asking about Ethereum's popular DAO concept, the Ethereum Foundation website has a tutorial on creating a simple DAO application on https://www.ethereum.org/dao. Hope this helps!


text:
Is it possible to deploy a python script on Ethereum Virtual Network or NEO?
Is it possible to deploy a python script as a dApp on the Ethereum or NEO virtual network?

First of all: I don't know anything about NEO, I can just give you what I know about Ethereum.
As far as I know it is not possible to deploy a python script in the Ethereum network. In Ethereum you can only deploy Ethereum bytecode. It is compiled from smart contracts written in Solidity, Serpent, LLL or Vyper.
Other code than Ethereum bytecode will never be stored on the Ethereum blockchain (at least not in an executable way).
When you want to build a dApp you need to write the needed smart contract and (if necessary) somewhere host your python (or whatever) frontend and/or backend.

Thank you. I believe NEO smart contracts can be created in python, while I know Ethereumis Solidity.


text:
What would happen to bitcoin in a world with no electricity/internet?
Many people discuss gold as an 'apocalyptic' currency because it will be what's used (supposedly) if the world ends, or there is some cataclysmic event that wipes out the power grid and internet connectivity.
In such a scenario, would bitcoin still maintain value, could a blockchain be maintained, would paper wallets still contain bitcoin, etc?

Without computers or electricity, Bitcoin would have no value and could not be used as it is entirely a digital asset. There are no such an object as a coin and thus Bitcoin cannot be put into a physical asset. The blockchain itself is what determines something is Bitcoin, and without it (because there are no computers or electricity), anything physical intended to represent or store Bitcoin (e.g. a paper wallet) has no value besides the value of the material itself.


text:
Is it possible for there to be a virus in the blockchain?
can a blockchain ever get a 'virus', that continually replicates itself, continues paying for gas (if on the ethereum network) and survives/self-replicates through the blockchain, similar to viruses on a PC?

I don't think it is possible in the way you are describing it.
Even if there was a smart contract which replicates itself and pays transactions and stuff. The thing is, a smart contract cannot act by itself. There has to be a user who initiates the actions. Then the smart contract could send a few transactions, but only within the block where the user started the actions of the smart contract. And as far as I know are smart contracts not able to pay gascosts, so the user itself has to pay for it.
Transactions which send other transactions are executed within the same block. So every action only lasts for one block and the initiating user would have to start the contract over and over again. Additionally there is a limit of executed gas within a block. So the smart contract could only send a few transactions before the block is full and will cancel all further transaction calls.
Besides this initiation issue, I cannot imagine a way how a smart contract could harm people by itself. Only if some other users would send money there, these funds might be lost. But it would be obviously stupid to do so.

Good Question.
To avoid such circumstance Consensus mechanisms are used to find faulty nodes as some blockchains are permission-less and anyone can participate.And their is no guarantee that every participant is valid one.For simple nodes faults RAFT consensus mechanism can be used.For nodes which is acting maliciously Byzantine Fault Tolerance mechanism can be used to remove the faulty node from the network.


text:
Unconfirmed transaction for 6 days now. need assistance for using CPFP
I have an unconfirmed transaction that has been sitting there for 6 days now.
The fees only got higher sins i've made the transaction and i do not feel comfortabel waiting.
I'm unable to use RBF sins trezor thus not support this and i'm nor sure on how to use CPFP
the TX is : 8b5032bcc435ebc612128fb66c30d85af19febd6f03dafb9114253dac6a9e0cf
After the transaction i've noticed that the recieving wallet is a legacy one, while i've send it from a segwit. could that cause any problems?
Is there any risk comming with waiting any longer?
Thx

You need to setup Electurm with Trezor: https://wiki.trezor.io/Apps:Electrum and https://wiki.trezor.io/Child_Pays_For_Parent_(CPFP) 2) Not a problem 3) You can also wait but the fee rate is very low, I wouldn't.

What if my balance is 0? can i do an CPFP then?

When will my transaction be removed, so i can get my BTC available again in the wallet i've send it from

If "balance 0" is the case, If you sent to your wallet, you need to CPFP from that wallet. Otherwise, the recipient should CPFP it. At least two weeks from when you submitted the transaction. Instead, I would try submitting it here https://www.viabtc.com/tools/txaccelerator?lang=en_US every hour sharp (AA:00).

I have tried CPFP and apperently its not an option for me. i do not have the nessecary green or yellow output address. So the only thing i can do is wait till it got rejected i'm afraid. Question is then, how long will this take.

14 days after you first published it

Thx, i'll wait for that then.... we are halfway this period

It has been 14 days now, the transaction is still stuck in the mempool and pending... in the meantime the BTC can not be used. is this still normal?

Apologies, someone (evil) is re-broadcasting low fee transactions. Your only hope seems to be reaching the recipient and asking them to do CPFP and deduce the CPFP fee from your payment. Otherwise it might take even a month for your transaction to be accepted. Meanwhile, I am trying to reach the Bitcoin Core developers so that maybe one day it becomes impossible to re-publish low fee transactions

What? that should not even be possible right? so how do i the CPFP as the receiver? The reciever wallet is a Safepal

i've just noticed that on the reciever side the transaction is gone, so he can't do a CPFP then i guess.

but on the wallet i've send it from, it remains visible as unconfirmed

Can he please check again?

Hi, So in the recieving wallet still nothing and in the sending wallet still unconfirmed and therefore still blocked.

OK then, let's do CPFP. Would you mind downloading the Electrum wallet and using it temporarily, then creating a new seed/account on your hardware wallet and transfer to it again?

You need to follow the steps here: https://bitcoinelectrum.com/restoring-your-standard-wallet-from-seed/ Choose "legacy" when you see a list. And when you import the seed enable "BIP39". Don't change the derivation path. If you see your unconfirmed transaction, you should be able to CPFP it by spending it (to your new account, you need to open a newer one in your hardware wallet now, since now coins are accessible to your PC)

If you don't see your unconfirmed tx there once it's synced (green on bottom-right corner) go to Load > Transaction from text and paste https://blockchain.info/rawtx/8b5032bcc435ebc612128fb66c30d85af19febd6f03dafb9114253dac6a9e0cf?format=hex

Hi, it finaly came true, got 8 confimations... i'll be able to sleep again. Anyone did something? i noticed the mempool size finaly decended. maybe that wy. Anyway problem solved. thanks alot for you support

Wow, yes that must be the cause it is confrmed now. you're welcome :)


text:
Reuse air gapped Raspi used for seed generation?
Would it be wise for an air gapped RasPi used for seed generation be used again online with a new micro SD card? Am i missing anything?

Make sure to completely wipe the Raspberry Pi's internal storage (if applicable) and any removable storage you used for seed generation.
Once you plan to use the Raspberry Pi online, ensure you secure it by updating its operating system, changing default passwords, and installing necessary security updates.

Securely wipe it back to factory default.
Even better find an amnesiac live Linux boot image to use.
Most secure though is use an rPi hardware version with no networking at all.
See also Seedsigner.


text:
Do hardware wallets store the wallet.dat redundantly inside? If not, are there such hardware wallets?
I'm baffled by how "cheap" the existing hardware wallets look and seem. They seem to have been made "at a budget", with no real high-end version available.
If I owned something like 1,000 BTC, or even 100 BTC, I would want a damn mini fortress of a metal cube full of security measures and like 100 different memories, all individually holding the wallet.dat (encrypted), physically separated from each other and with a hardware switch needed to be flicked on for them to even have any contact with the "main logic", and the entire cube to be fully fireproof and waterproof down to a 10,000 meters and able to withstand thousands of blows from a sledgehammer.
From what I can tell, these hardware wallets are just a single flash memory holding all my coins on it. They even tell you to back it up immediately... which seems to defeat the purpose of having a hardware wallet, if you have to store the wallet.dat redundantly anyway... in practice meaning it goes with all my other files which come into contact with my potentially compromised PC regularly.
I've really tried to research these hardware wallets, but all of them seem like a bad joke to me. I've only grown more and more skeptical to getting one, because my current (bad) system of storing my cold storage wallet.dat on multiple encrypted disks which DO regularly come into contact with my PC seems "just as good", if not better...
I hope I'm missing something, and that somebody can enlighten me.
Basically, how do rich Bitcoiners store their coins? Seriously? How? How do they sleep at night?

I hope I'm missing something, and that somebody can enlighten me.

As I expect you know, information-security can be described as a combination of confidentiality, integrity and availability.
You seem to be concentrating on availability, I believe the makers of hardware wallets are prioritising confidentiality.
If you have a hardware wallet, you are likely to want to also store copies of your recovery-phrase (AKA seed-phrase, backup-phrase) in other secure places e.g. stamped onto corrosion resistant metal plates in safes and/or safety-deposit boxes perhaps in multiple locations. That way, you don't lose availability if the hardware wallet is damaged, destroyed, lost or stolen.
If you keep your wallet.dat on encrypted flash drives, your confidential data is much more exposed than a hardware wallet. At some point the encryption layer decrypts the wallet.dat so that your wallet software can read and write to it. Your data is transferred into a potentially compromised environment with a comparatively large attack-surface. At that point it is probably accessible to malware or vulnerable to a maliciously altered wallet application. This is not the case with a hardware wallet - the secret keys are never accessible to any PC, they never leave the device.

Most wallets today are not merely a set of key pairs as they were originally stored in wallet.dat, but the keys are deterministically generated from a common root.
The generating process is described technically in BIP-32 (Hierarchical Deterministic Wallets). Using a fixed entropy, a master key is generated using a key derivation function, and from this, a tree of key pairs is generated with the same algorithm. There is no practical limit to the number of keys which can be generated from one master key.
Most wallets also use BIP-39 (Mnemonic Phrase) or similar. A random number is chosen and appended with a checksum, then split into 11-bit chunks, each of which represents the index of a word in a fixed dictionary of 2048 words. The words are listed in sequence and then hashed to generate the entropy for use in BIP-32.
This means you only need the set of words, known as the 'seed phrase,' to deterministically regenerate all of the private keys your wallet ever uses. As long as you back up this seed phrase, you can recover the wallet on another hardware device if one fails, and there is no danger of losing coins.
Bitcoin Core now supports BIP-32 and derivation paths for keys are included in the wallet.dat file.
Deterministic wallets ensure you will always have the private keys to recover funds in a P2PKH transaction, but P2SH transactions are a bit more difficult because they also require you to possess a redeem script. Increasingly, hardware wallets are supporting BIP-174 (Partially-Signed Bitcoin Transactions) which provides a common encoding for storing any data required to spend a transaction. This however, requires you to create backups as things such as the redeem script are not deterministically generated. Hardware Wallets such as the COLDCARD Mk3 usually come with multiple reliable microSD cards to back up everything required.

You don't store the backup on your PC. You write it down on a piece of paper using a pen. It's 12-24 random english words. The backup is there because most people lose coins not because of theft but because of mistakes they made like forgotten passwords/pins.
The only exception is coldcard. It generates an electrum wallet file and saves it to an SD card. You can choose to expose it to your regular PC or a different one dedicated for bitcoin use.
As for the HW itself it has a secure element that holds your seed/private keys and does the signing.


text:
Is there a risk in entering my Bitcoin-Core wallet passphrase, if it's for sending all my available balance and never using that wallet again?
I have Bitcoin-Core wallet.dat with a single address and a small amount of bitcoins in it.
Say I want to send all the available bitcoins I have, and then never use that wallet again. Can I use an online computer for that, including entering the passphrase while connected to the internet? Will anybody be able to steal any bitcoins from me?
Thanks

if my computer is infected and my passphrase is compromised, I'm going to do this transaction and never use that wallet again. Is there a risk that my transaction won't be fulfilled successfully?

Users of Electrum found to their cost that it is possible that a compromised computer contains a malicously modified wallet that shows it sends money where the user asked (and presumably shows the transaction as successful) but actually sends the money to the address of a thief.
If you suspect a computer may not be clean, you can't be certain that any bitcoin core wallet on that computer has not been compromised in some equally malicous way.
Quantifying the risk is hard, and deciding on an acceptable level of risk is a personal choice. However the risk is not zero.

Sure, just make sure it's a computer you trust to be free of malware.

Thanks for the answer, but what I mean is: do I really have to be careful at all? Even if my computer is infected and my passphrase is compromised, I'm going to do this transaction and never use that wallet again. Is there a risk that my transaction won't be fulfilled successfully?

@Yababa Yes: malware exists that will look for Bitcoin wallets and it'll send out any coins on those wallets faster than you can make a transaction. If want to be certain you won't lose the coins then it's still worthwhile to be careful.


text:
I know I have a Bitcoin because BlockchainInfo says so... But loading wallet.dat into Core does nothing!
Is it possible the file is corrupt? The file size is 96kb.
I just spend 2 weeks downloading Bitcoin Core, and when I replaced the wallet file in there with the wallet.dat file I saved on my computer a couple years ago, and then restarted Bitcoin Core, no luck! It still tells me I have 0 bitcoins.
Also, I regrettably took someone's advice to empty my %APPDATA%\BITCOIN file (when placing my wallet.dat into it), and now it looks like Bitcoin Core is making me download the entire damn ledger again!!
Please help me out here. If I can actually get this bitcoin, I will paypal 100 dollars to the person who figures it out for me.

"Because blockchain.info says so" - for which address? Are you sure that address is in your wallet? If you delete your blockchain it will need to download it again.

So you delete your wallet.dat?

How would I confirm that that address is in my wallet? Like I said, I do have the wallet.dat file on hand. (Thanks for the help, by the way, Pieter!)

No- I deleted the wallet file that was in the Bitcoin Core program that I downloaded... then I inserted my wallet.dat file into that location (%APPDATA%\BITCOIN)

In other words, I definitely still have my wallet.dat file.

You're looking at blockchain.info, which says you have BTC. What address are you looking at? How do you know that address belongs to that wallet.dat file?

Basically, that's the address I gave to someone who then sent a bitcoin to it about 2 years ago. How did I get that address? I believe I got it from the Bitcoin Core program that I had downloaded.
However, at that time I was not able to download the entire damn ledger (which I believe is called the "Blockchain") and as a result, I never got to display that bitcoin in my Bitcoin Core program, which requires downloading the whole blockchain first. Recently, now that BTC gained so much value, I was motivated to try to "recover" the bitcoin, and just spent days downloading Bitcoin Core.

Go to the RPC console in Bitcoin-Qt (debug window), and type validateaddress <address> (replace <address> with the address you believe to be yours). It should respond "ismine" : true if the address is yours.

Pieter, thanks for the help again. The program I have is Bitcoin Core v0.15.1. Is this what you are calling "Bitcoin-Qt?'

Also, can I do this before downloading the entire ledger again, or do I have to download the entire ledger? edit: I just did that, and it says "ismine: false." However, how on earth would the program know if it's mine or not, since I have never until now had the Bitcoin Core program on my computer?

No, you can do that while it's synchronizing. Also, increase the database cache size setting to increase sync speed.

Alright, again though, Peter.... How would Bitcoin Core know that this bitcoin address is mine or not? I don't even have the computer I originally used to download Bitcoin Core!


text:
Bitfinex - 25% annual funding fee for margin - Fiat vs crypto - how to minimize cost?
On bitfinex, funding fee for USD is around 0.05% (daily) while that for other crypto like BTC is 5-10x smaller (around 0.008%).
In my margin account, i have positions in few crypto currencies and i have posted some USD and BTC collateral in margin account. Rest gets 'funded' with USD at 0.05% funding rate daily (thats almost 25% annual cost!).
Is it possible to fund this with BTC instead of fiat and will it reduce my daily funding cost by 5-10x. If so, what do i need to do?

What you fund your account with is irrelevant to this question.
If you take a long position against a USD pair, you'll borrow USD and pay USD interest. If you short a Coin you will borrow that coin and pay its interest.
Eg. Open long position on BTC/USD for $1000, you'll be borrowing $1000 for your position and would have to pay back $1000 + Interest.
If you short BTC/USD for 1 BTC, you'll be borrowing 1 BTC for your position and would have to pay back 1 BTC + Interest.


text:
what is flow of a bitcoin transfer from one exchange to another?
Can someone please share what exactly is flow involved in transfer of a bitcoin from my account on one exchange to someone else's on another exchange?
for example: is there a transfer from my account (regular, custodial) to main exchange account for pooling purposes? Or is the transaction simply relayed on bitcoin network to validators and miners?
Does it mean that if exchange has 1000 customers, all those account are in officially owned by exchange? what does it mean if exchange doesnt keep all money in hot wallets and send to cold wallet. Will it mean that if i initiate transaction, there will be a transfer first from cold wallet (occassionaly) to hot wallet that i know of and then onwards?

what exactly is flow involved in transfer of a bitcoin from my account on one exchange to someone else's on another exchange?

Your intended recipient will have requested exchange 2 to generate a receiving address for your intended transaction. This receiving address is owned by exchange 2. The recipient will pass this address to you in any way that suits them (QR-code, whatsapp, email, etc)

The first exchange deducts an amount from your account balance. This has no effect on the Bitcoin network because you own no Bitcoin so far as the Bitcoin network is concerned.

The first exchange typically batches together a set of several tens, hundreds or thousands of customer transactions it needs to make where recipients are not its customers. It combines all these requested customer transactions into one single bitcoin transaction with hundreds or thousands of different recipients (outputs). One output of that combined transaction will pay an amount to an address owned by exchange 2 which you have requested exchange 1 to pay.

The first exchange transmits copies of the proposed (unconfirmed) Bitcoin transaction  to a handful of Bitcoin nodes (its peers). Copies multiply and diffuse across the Bitcoin network, eventually some copies of this proposed transaction reach miners.

A miner successfully includes that transaction into a block, usually with thousands of other transactions. It transmits copies of the new block to a handful of peers.

The second exchange eventually receives a copy the block, thereby discovering it has received the amount you specified.

From the receiving address (and maybe the amount) it can  reconcile this received amount against an expected payment to one of it's customers.

The second exchange credits an amount to the account of one of its customers. This part is nothing to do with the Bitcoin network.

Only the numbered items in the above list are actual Bitcoin events. The other items don't really involve any real Bitcoin.
The Bitcoin network has no record of your money or of the recipient's because you are both using a custodial service and neither of you has any money as far as the Bitcoin network knows.

for example: is there a transfer from my account (regular, custodial) to main exchange account for pooling purposes?

The Bitcoin network has no accounts.
What exchanges do with their customer accounts is of no relevance to the Bitcoin network. It is up to each exchange how they move numbers around internally.
Exchanges can internally shuffle around the IOU's and promises which they have issued to customers in order to maintain their customer's illusion that the customer owns money (customers don't). The exchanges often don't need to move any real money around. The reality is that once you give money to someone else (the exchange) you no longer own or possess that money. You only possess an expectation that the other person (the exchange) will give you back some money if you ask it.

will be a transfer first from cold wallet (occassionaly) to hot wallet ...

Probably not, but maybe so if the exchange's hot-wallet "balance" would otherwise fall below some threshold the exchange sets. This is a matter for the exchange to manage however it wants.

...that i know of

Unlikely.
You only need to know that there is a transaction that pays the specified amount to the specified address. You don't need to know where that money came from.

Related

Why are there so many recipients when I send money from one exchange to another?
Is it true that all the bitcoins in existence are on the blockchain (the ledge), but it just depends on who the owner (address) is?
A single transaction with 13107 "recipients"
List of transactions showing output count - try clicking the column header "Output Count".

Regarding batching you have mentioned in #3. Isnt is what miners do instead of exchange. I was under impression that all transactions get relayed on network and then miners batch it in block and mine that block (after validation). What do you mean here by exchange 1 batching thousands of small transaction?

@toing. Those are different kinds of batching. Miners do gather multiple transactions into a block but in addition to that any bitcoin user can create a single transaction that pays multiple people. If you look in the blockchain you will find single transactions with hundreds of outputs (and sometimes hundreds of inputs).  See https://blockchair.com/bitcoin/transactions?s=output_count(desc)

Can you please expand on single transaction that pays multiple people? For example, if X1 and X2 both initiate transfer on exchange A to send money to Y1 on exchange B and Y2 on exchange C... are you saying that somehow exchange A will record it as one single transaction having multiple outputs? p.s.: Also, your link didnt show anything (may be filter was incorrect). Thanks for your help

@toing. yes, that is what I am saying. See the new link I just added at bottom of answer.

very helpful. I now understand that one transaction can itself have a pooled several transactions. However, I am now trying to wrap my head around basic simplified case as discussed in most education videos where 1-1 transaction is shown and combination of hash, data and public key validates it. How does it happen when many-many transaction happens. Would appreciate if you can explain in context of this  transaction https://blockchair.com/bitcoin/transaction/450b70aa3f86492a028e87c5c7640f901b38ebc511283bdc353b32592f48c39a

That looks like a normal simple transaction where Alice wants to pay Bob 0.7 BTC. Alice gets a handful of coins from her pocket and sorts out three that add up to just over 0.7 BTC, (it is rare to have the exact amount in coins) the transaction destroys those three input coins belonging to Alice and creates two new output coins: the payment to Bob and some change returned to Alice, there's a small difference that the miner Michael claims as a fee


text:
How is 10% transaction fee possible for a bitcoin transfer from coinbase to another exchange?
I moved 0.01BTC from coinbase to another exchange and i got charged 0.001BTC for it. This is 10%!!. I understand concept of dynamic pricing depending on network crowding etc. However, how is 10% fee possible when many websites show that median transaction fee is still around 0.2-0.4%. Is it due a small size that i used (0.01BTC) in transfer. Is there anything i can do to avoid such high and conform with median?
Also, is there a way to avoid such high transfer fee on coinbase?

This is normal.  You can see on https://bitcoinfees.earn.com/ that BTC 0.001 is a pretty average fee right now.
You should not think of it as a percentage, since the fee for a transaction is not related to the amount of coins transacted.  Instead, it has to do with the size of the transaction in bytes, which is more a matter of its complexity (e.g. number of input transactions spent, number of addresses paid).  You'd have paid the same fee whether the amount you sent was BTC 0.0001 (in which case it would be a 1000% fee) or BTC 1 (an 0.1% fee).

Also, is there a way to avoid such high transfer fee on coinbase?

No.  If you want the percent fee to look smaller, send larger amounts.  Or you could wait and see if fees go down in the future (they might or might not).

I think I was making an error of assuming fee in terms of percent. This explains it well. Thanks.


text:
Seed discovery for bitcoin core client
I just installed bitcoin core client (from github) and started the client. It took around 24 hours to install the full block chain. Where did the blockchain come from? How did did my bitcoin core client find its first peer on the network?

Bitcoin Core chooses peers in the P2P network in a few ways:

it tries to connect to peers it already knows about, or
it connects to peers it learns about by querying volunteer-run DNS services, or
it connects to one of a number of hardcoded seeds

Once connected to the P2P network, peers rumor possible other nodes they know about, and the node builds a picture of the network using these responses. On a fresh installation there's no known peers, so the discovery begins at the seed nodes.

When you say "it tries to connect to peers it already knows about" - how does it "already" know about them?  Is that the same as point #3?

It knows about them from earlier runs. Known peers are stored on disk in peers.dat.


text:
Missing Bitcoin?
I am a Bitcoin newbie
I had some BTC transferred into my Breadwallet account on Dec 2nd and it showed up in my balance as confirmed. (Transaction ID: bcef79f0672705aa957dfa32982d504db28599289418a58c96d671842bf1e4d8). No problem.
I then transferred some more BTC from GDAX into my Breadwallet account on Dec 9th @ 16:02 . It showed as “In Progress" for a while and then it became confirmed and the amount was added to the total balance. (Transaction ID: b7194a8af423f4eb7a97b0af181203b074fa9b0b02b784fc1789c1d0beeea5b8)
I then sent some BTC from my Breadwallet on Dec 9th @ 18:44 which is now showing as “In Progress”. (Transaction ID: 6ad094d28c264d87d64512753916b76e9855f59194c18c636e87db234624fdc3)
The Economy network fee I paid for this transaction said that it would take 1 to 24hours. But it has been stuck at 40%.
Also, another issue I have is that the last receiving amount from GDAX that was confirmed on Dec 9th @ 16:02 is not showing in my Breadwallet now?
I don’t understand what is happening? Please help me as I am concerned that I have lost some Bitcoin.
What shall I do?
Thank you

The transaction that isn't showing up in your wallet (txID b7194a8...) is okay, no need to worry. If you paste that txID into a block explorer website, you can see that the coins that were transferred have not moved since then. It may be that breadwallet is just out of sync/glitching. You can go to Menu->Settings->Sync Blockchain to try to remedy the situation. Don't worry if it doesn't work, your coins are safe.
For the unconfirmed tx, the network is rather congested right now. It is fine as well, an unconfirmed tx is at no risk of losing your coins, or anything like that. Give it time it will confirm

Thank you for your help. I have done the sync and it is now showing so that’s good news. In regards to waiting for the unconfirmed tx, will I be able to send BTC to any other addresses or do I need to wait for this to become confirmed first?

Yes, but it will depend on the software. If you have other unspent outputs in the wallet, you should be able to spend them while this tx is still unconfirmed.


text:
My bitcoin transaction has not cleared in almost a month because I accidentally set the fees too low. What can I do?
Transaction ID: 050b5ba38506f8b5fb9054ff2f338999a082236a95f388449e1b8049c72e4f10
Like the title says, I have some bitcoin in a limbo transaction due to ever increasing numbers of unconfirmed transactions with a much higher fee than mine.
My ideal scenario would be to somehow cancel the transaction and have the coins return back to my wallet.
I was told from another source that Bitcoin Core evicts transactions after two weeks by default. However, it seems like that is not the case since it has been over 3 weeks now.
I was also told a method called "child pays for parent" but I am not sure if my situation would work for that.
Any help is greatly appreciated. Thanks!

You can spend in another transaction the outputs used in the limbo transaction. Off course, you need to put an higher fee so the new tx will be confirmed and the old will be invalid.


text:
If the public key characterize the wallet, is it possible to track all transactions of that wallet?
To explain better my question, consider this example:

Individual A is an investigator
Individual B is been investigated

Faking to be interested B's service, individual A gets B's public key to pay for his service.
As the system is opened for everyone to see the transactions, it is possible to track all the transactions that happened using that public key, and mainly it is possible to track all the transactions with that public key from now on.
In this case, the only way to be anonymous would be create a new pair of keys for every transaction, and never centralize the bitcoins, is it right?

If B give out his public key, then yes , A can track all public addresses related to that specific public key.
However public key is seldom used as an receiver address nowadays.
Normally B would give A his public address.
Generating a new key-pair is anonymous, but once that key-pair is used by B it is at most pseudonymous. B will need to take additional steps to be anonymous(like using stolen credit card for funding,VPN, bitcoin mixer, etc....)

A HD wallet (BIP32/44) uses a master private/public key to allow a new address to be generated for each transaction. As the address is a hash (one way function) of a child public key, it is not possible to use one Bitcoin address or even a child public key in isolation to identify all subsequent addresses. To do this the xpub (master public key) would have to be given out or an adversary would need to have the parent chain code for the child public key to start working back to the master keys.
Tracking a wallets transactions relies on a number of heuristics separate from the process of creating addresses. For example the common input heuristic is used to infer that all addresses used as transaction inputs are controlled by the same entity (entity has the private key to sign for all the inputs). Addresses are then clustered together and all transactions linked attributed to the entity in question.
Heuristics around the amount in a transaction are also used to cluster addresses together. For example if the outputs are very different in value, analysis software will look to categorise one as a change output belonging to the wallet used for the inputs.


text:
Port 8333 and Issues to have a connection
So, I have a website, and that website is going to use Bitcoins. Right now, I'm trying to connect the bitcoin core with the website.
But I have a lot of issues with port 8333:
This is my error: http://prntscr.com/i34pqa
Bitcoin Config file: http://prntscr.com/i34q2e
8333 connections: http://prntscr.com/i34r1o
The bitcoin core I have is on a Linux VPS.
The thing is, I have to be able to connect the website to the bitcoin core, so I have this code in PHP:
include('c.bitcoin.php');
  $bitcoin = new Bitcoin('root','MY PASS','MY VPS SERVER','8333');
  $address = $bitcoin->getnewaddress('Test');
  die($address);
That code works on Localhost, without using the VPS Server Just 127.0.0.1 which means it creates the address :), But when I'm trying to connect it to the bitcoin core that is on my VPS, it doesn't work.
I could open the bitcoin core if I change the rpcport on the bitcoin.conf to another port, like instead of using 8333, we are going to use 8332:
http://prntscr.com/i34vni
And now, we check the node: http://prntscr.com/i34w5a
It's supposed to be working :), But at the end of the day, it doesn't make a connection between my website and the bitcoin core on my VPS.
So I don't know what's going on. I don't know how to solve it, I've tried everything I've found on the internet, but nothing happens. I've written -listen=0, on the bitcoin conf, and I'm not able to connect my website to it yet,
I need this help, I need a big help, Thank you!.

And yes, My port 8333 is Open!.

You are conflating the two ports that Bitcoin Core opens and uses.
There is the Bitcoin network port. That is port 8333 by default. You DO NOT want to try to connect to that as it is used for the connection to other nodes on the network.
The port that you do care about is the rpcport. That is port 8332 by default. This is the port that you want to connect to as that is what lets you interface with Bitcoin Core.
If you don't set the port or rpcport options in the bitcoin.conf file, then the default ports will be used.

As a security measure, Bitcoin Core does not allow anyone to connect to the rpcport. You will need to explicitly allow an IP address to connect to it by using the rpcallowip=<ip> option in the bitcoin.conf file. If you set it to 0.0.0.0, it will be open to all IP addresses, but this is not recommended as it is not secure.

In your Qt settings, you have proxies enabled with port 8333. That's incorrect. Those are not the IP and port that you want Bitcoin Core to use but rather that a proxy is listening on those ports.

I tried to do it, even I added port and rpcport to the bitocoin config file, I changed rpcallowip = 0.0.0.0, but it doesn't work yet!. Same error!. Port 8333 doesn't want to flirt with Bitcoin core

The rpcport is 8332, not 8333. You need to make whatever you want to connect to Bitcoin Core connects to port 8332 not 8333.


text:
How does a node decide whether a block is valid?
I'm a software developer, and I've been trying to figure out how a node decides whether a block is valid,
I do understand the hashes in bitcoin, the merkle root, and all those aspects
but my question is:
If someone edits a block, how does the network know that "X" node modified a block? are the nodes constantly in communication sending some sort of fingerprint that changes if information gets modified (or sending the whole blockchain)?
If a node (A) detects that Block #XHeight from Node (b) is not valid, how does the network know who is right and who is not, since The block is valid for Node B but not for node A, how do they solve such argument? does the network goes into an election process, and the network decides which hash is the valid one? : how does two nodes certify that one of them is actually the valid one? is there some sort of "democracy" system where nodes vote in favor or against one specific hash in order to decide who's right between node A and Node B?
I'd like to get technical answers, since I'm trying to understand blockchain and bitcoin at a code level.

Blocks cannot be modified because the next block contains a hash of the previous block's header. Any change to a block would result in a change to the header, and thus, change its hash, requiring all blocks which succeed it to also be modified because their hashes would no longer be valid. It isn't possible to rebuild all of the blocks because it requires work to compute valid hashes (they must have nBits leading zeroes in their merkle root).
Blocks are correct only if they are in the longest known chain with the most accumulated proof-of-work. Meaning any chain with less work than the longest known chain is invalid.
If a node sees a valid block X but then later, receives a new block Y, where YHeight > XHeight, and the chain of blocks up to #YHeight does not contain the block X, then X is discarded. Only the blocks in the longest chain are treated as valid blocks.
This is also true in a tie. If two blocks are mined by different miners at the same time, each participant assumes that the first block they received is the valid one, and they continue the Proof-of-Work process from this valid block. The next miner to create a valid block ends the tie by creating the longer chain, and any miner who was working on a block other than the one referred to in the new block's header will discard the work they have done so far on the shorter chain, and continue working on the longer chain.

But let’s say I modify a block, how does the network know that I actually modified a block, that I have a invalid chain? Are the nodes constanly communicating with each other? If they are, what are they sending in order to let the network know about these modifications?

The only person you can deceive by attempting to modify a block is yourself. If your try to broadcast a modified block, then any other node on the network will reject the block, either because its hash does not match the expected hash of the block which is expected at that height, or because they have a longer valid chain which does not include that block.

Nodes do constantly communicate with each other when new blocks are created or new transactions are created. These are all broadcast, and you typically receive information from multiple different sources, and your own node determines which information is correct based on which one it validates to be the longest chain.

So If I broadcast my invalid block, and the network detects this, then the network would send me back the valid block. Right?

Other nodes will detect an invalid block and discard it, but it is not required that they inform you of the valid one. Your node will need to send a getheaders or getblocks command to its peers to request the most recent information, and the peers will respond with the newest blocks they know about. You can validate all of this information and determine its correctness. During normal operation, nodes will automatically send you information about new blocks with an inv command, without you requesting it (unless you opt out of this information in the initial version message to the peer).

Okay. Finally I understand such things. Thank you! I just have one more question, You mention that every node determines which information is correct, meaning, each node computes which block might be valid and which one might be not. Let’s put this example (not based on Bitcoin’s blockchain): we have 2 nodes trying to decide whether Block Z is valid. Node A says that it’s valid, Node B says that is not valid (Node A modified it). How does the network solve this? Does it go into an election process or a consensus system for blocks? I think this is called the byzantine fault problem.

If A modified the block, B will simply reject it. Instead, B will receive the valid block from a different peer, and will most likely blacklist A. Bitcoin relies on receiving information from multiple peers, because you can't rely on a single source of information being up-to-date. By default, Bitcoin Core will connect outward to 8 peers, but will receive as many as 125 incoming peers. The chances of not getting correct information from at least one peer is very low. You only need 1 honest peer, even if the others are malicious. If all peers are malicious, it is called an eclipse attack.

Thank you so much! I’d like to continue with this conversation since my questions are based on private blockchains’ concept. But so far Thank you, I might open another question.. greetings


text:
Bitcoin over Tor and man in the middle attack: risks mitigated yet?
This paper explains how combining Bitcoin and Tor creates an attack vector. A man in the middle can control the information flow between all users who connect over Tor. This paper is from 2014. Has this sort of risk been mitigated by new engineering yet?

Version 2 P2P transport probably fixes at least part of this as it encrypts the traffic between Nodes.
From the paper:

An obvious countermeasure would be to encrypt and
authenticate Bitcoin traffic. This would prevent even opportunistic
man-in-the-middle attacks (i.e. even if the user is unlucky
to choose the malicious Exit relay). - IX. COUNTERMEASURES

The Motivation paragraph of BIP324 addresses this:
https://github.com/dhruv/bips/blob/bip324/bip-0324.mediawiki#user-content-Motivation
More ressources on BIP324: https://bitcoinops.org/en/topics/v2-p2p-transport/


text:
Problem with bitcoin-cli -datadir flag
I moved my blockchain directory, including bitcoin.conf, to an external drive D:\Bitcoin. Bitcoin Core starts and runs normally using this path, however when I try to use the command line interface, even when I specify the new directory, I keep running into this error.
C:\Program Files\Bitcoin\daemon>bitcoin-cli -datadir=D:\Bitcoin -getinfo

   error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is  not set. See -rpcpassword and -stdinrpcpass.

I know that the issue is that bitcoin-cli is still looking in the default directory C:\Users\<username>\AppData\Roaming\Bitcoin because when I copy the auth .cookie and bitcoin.conf files to to old directory my commands work.
Wondering if the -datadir flag is not working properly, if I made an error somewhere, or if there is another way to fix this? I have also tried using the -conf=D:\Bitcoin\bitcoin.conf flag, however that does not fix either.
Windows 10

Have you tried putting quotes around the datadir, e.g. -datadir="D:\Bitcoin"?

As Andrew Chow suggested, the solution was simply putting quotes around the directory path. Windows SMH. Thank you.


text:
How to generate a coinbase transaction?
I am creating a miner in C++ for solo mining, and am struggling to create the proper coinbase transaction.
Say I have a bc1 address, like bc1qfc7fameteuguetm0kfzypnvf2ju6wppdvj6tkc , what would be and example of a coinbase transaction with this, and how would I get to it?
https://developer.bitcoin.org/reference/transactions.html
01000000 .............................. Version

01 .................................... Number of inputs
| 00000000000000000000000000000000
| 00000000000000000000000000000000 ...  Previous outpoint TXID
| ffffffff ............................ Previous outpoint index
|
| 29 .................................. Bytes in coinbase // height+message below, byte length
| |
| | 03 ................................ Bytes in height
| | | 4e0105 .......................... Height: 328014
| |
| | 062f503253482f0472d35454085fffed
| | f2400000f90f54696d65202620486561
| | 6c74682021 ........................ Arbitrary data // custom data, include extranonce here
| 00000000 ............................ Sequence // i thought this was all Fs?

01 .................................... Output count
| 2c37449500000000 .................... // coinbase value
| ????????????????? ............. // here, how do i properly fill this part??
| 00000000 ............................ Locktime

These are the parts needed to create the data for the transaction.
Everything up to the output, i understand. but i dont know what to put between the coinbase value and locktime. how does the address convert to hex? what OP codes do i need? and is this transaction layout correct?
And then I would then hash it and input it as a new transaction into the block as like so,
tx = {
  "data" : "<hex string mentioned above>",
  "hash" : "<double sha256 of data above>",
}

is that the only data i need for the json?
Thanks in advance.

To create a coinbase transaction you need to send this RPC command to your Bitcoin-Qt
createrawtransaction '[{"txid":"0000000000000000000000000000000000000000000000000000000000000000","vout":2147483647}]{"Your Bitcoin Adress":Amount}'
Why 2147483647 ?
Because the vout must be numeric, and you can't put 0xffffffff
So this will give you 0x7fffffff and the easiest way to do that is to change manually the 7 to f
Now as required in BIP34 you must include the block height inside the scriptSig otherwise your coinbase transaction will not be valid
PS: Be aware of little and big endian

i dont know what to put between the coinbase value and locktime.

This is the output scriptPubkey, the locking mechanism placed on a transaction output. In the case of a coinbase transaction it should spend the newly minted coins and any transaction fees.

how does the address convert to hex?

See this answer

what OP codes do i need?

You could use P2PK:
<pub key> OP_CHECKSIG

or P2PKH:
OP_DUP OP_HASH160 <RIPEMD160(SHA256(publickey))> OP_EQUALVERIFY OP_CHECKSIG

and is this transaction layout correct?

You could check it against Greg Walker's learnmeabitcoin coinbase description, or its block explorer:
https://learnmeabitcoin.com/explorer/transaction/json.php?txid=8b50f51b49f27e7bb0efb0b3bf38d12ce4f7e6258b90a75802a394cb585c879d