text:
Bitcoin-cli keeps crashing around block 810180 and will always restart at block 809941
So I'm downloading and syncing the blockchain using bitcoin core. Whenever it teaches block 810810, the terminal will just close by itself and then I restart the node, it will start syncing from block 809940. The debug.log file doesn't show any errors, it just stops at that point. This has happened about 5 times in a row now. The laptop I'm running it on has 8gb of ram and a terabyte of harddrive space. I checked for any hardware failures but the harddrive passes all checks. For what it's worth, my bitcoin.conf file looks like:
prune=5000
That's it.
The debug log's output when I run it with just the -daemon flag is:

2023-10-07T00:29:39Z UpdateTip: new best=00000000000000000000f560e0495f776189c1ba681c8fe4068ecd33d16584d6 height=810181 version=0x302a0000 log2_work=94.450324 tx=902025944 date='2023-10-01T18:26:02Z' progress=0.998156 cache=270.2MiB(1774949txo)

2023-10-07T00:29:39Z New outbound peer connected: version: 70015, blocks=810972, peer=268 (outbound-full-relay)

2023-10-07T00:29:51Z UpdateTip: new best=00000000000000000001efe8dc90d79e52d1de934ecffc03572d847ea8fc7296 height=810182 version=0x241c2000 log2_work=94.450337 tx=902028692 date='2023-10-01T18:33:00Z' progress=0.998158 cache=271.1MiB(1781754txo)

2023-10-07T00:29:58Z UpdateTip: new best=000000000000000000040caf3f438bb15731f6dc0f5ce1eaa6cd2ee8213d72dd height=810183 version=0x22c88000 log2_work=94.450350 tx=902031063 date='2023-10-01T18:35:09Z' progress=0.998158 cache=271.6MiB(1786104txo)

The last few lines of the debug file when running it with the flags -nodaemon and -debug are:
2023-10-07T06:30:41Z [net] received block 00000000000000000000f560e0495f776189c1ba681c8fe4068ecd33d16584d6 peer=56
2023-10-07T06:30:41Z [net] Added connection peer=63
2023-10-07T06:30:41Z [validation] Pre-allocating up to position 0x5000000 in blk03857.dat
2023-10-07T06:30:41Z [bench] FlushStateToDisk: find files to prune started
2023-10-07T06:30:51Z [rand] Feeding 18303 bytes of dynamic environment data into RNG

Any idea what could be going on? It's taken me 10 days to get to this point. I really hope I can continue from here.

Which version of Bitcoin core are you using?

@RedGrittyBrick According to the debug log I am using bitcoin core version v25.0rc2

When you run it in the terminal, there aren't any additional messages, perhaps something with the word "assert" or "assertion"?

@AndrewChow Nope, nothing at all. The terminal window will just close.

@AndrewChow I deleted the peers.dat file then restarted the node and it's gotten past the "problem block". There was nothing in the debug file to suggest that that file was a problem, but for some reason it seems to have done the trick; at least so far. I don't want to celebrate too early.

@AndrewChow I'm having an issue now where the node will be fully synced, then the terminal will just close by itself. When I restart the node, it will start a couple hundred blocks before the point at which it closed. Again, there's nothing in the debug log that shows an error (or assert/assertion) or anything like that. I know it's not much to go on, but any idea why this could be happening?
Edit: I'm running this on Ubuntu 22.04.3 LTS and there are no other programs running while the node is running. This laptop is dedicated entirely to running this node.


text:
Security risks in running a full node on my personal computer that I use for banking, work, etc
Let me start off by saying that my networking knowledge is fairly weak, so please bear with me.
I am reading the book "Mastering bitcoin" and it says that I should be running a node if I want API access to the bitcoin network - which I do want. I will be using bitcoin core to set up the node.
I've got a Macbook Pro that I do all of my coding on. I also use it for personal banking and other sensitive things activities. I connect to my home internet using wifi (other devices also use this wifi as well).
Is there a security risk in running a full node on this laptop, or should I buy another laptop to run it on?
Note that I may connect a wallet to the node, but with an inconsequential amount of btc in it. This node is entirely for learning purposes.

You run a risk from co-mingling different activities. Your other activities pose a risk to your Bitcoin, and your Bitcoin node poses a theoretical risk to those other activities. The less activities on a single computer, the less chance that one of those activities will result in a security breach.
For example, if you are browsing reddit on that computer and click a link which exploits your browser and gives a third-party access to your computer, they will also have access to your Bitcoin wallet. That's not possible if the only thing on that computer is the Bitcoin wallet and you never use it for web browsing.
The risk goes the other way too. If there is a security vulnerability in Bitcoin core that enables access to your machine, your use of Bitcoin could mean somebody gets access to your browser history. This has never happened before, I would say it's much much less likely, especially if you have not setup port forwarding and therefore are only connected to a handful of nodes regularly, but it's not impossible.
Ultimately you will have to decide how much security you want and what cost that security is worth. If you are just playing around with small amounts of funds, you probably don't need to worry. But as you increase the amount of funds you are storing, you will probably want more security and be willing to do more to have that security. Having more Bitcoin in your node doesn't do you any good (unless you have it locked up in a lightning liquidity channel or are regularly spending much of that balance). Instead, mulit-sig, cold storage, and other solutions probably make more sense.

Thanks for the reply. I've dug out an old laptop actually to use for this, based on your comment. My wallet will only have a couple dollars in it, just to play around with so I am not concerned about losing it (although if I were to lose it - the associated attack would be a concern).
Question: Would other devices connected to my wifi network be more at-risk just due to the fact that I am running a node that's connected to the same network?

Added risk exists in a theoretical sense but I wouldn't consider it significant. Somebody would need to find a remotely-exploitable flaw in Bitcoin Core, which hasn't happened in its 15 year history. Its code is probably the most widely monitored code in the world, any flaw would probably be discovered quickly and still requires that a node be able to connect to yours to exploit it. If you behind a NAT and haven't setup port forwarding, potential attackers are only the 8 other nodes you are connected to. If somebody can access your PC they would have a easier time connecting to your LAN PCs

I would not mix risky activities and security critical activities on the same computer/device.
Risky activities include reading email, browsing websites, using social media etc. I would keep all that separate from anything that involved personal money.
To reduce risks, I would put online banking on a dedicated device that is not used for any other purpose. I would keep bitcoin on a separate device too.

source: Stack Exchange

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

sort: votes


text:
Can i send bitcoin from one address in wallet with multiple addresses?
I have a btc backup wallet.dat file. I dumped the file with pywallet.py using python. I now have the wallet.txt showing all my addresses (Legacy) with their private keys in that wallet. So there are multiple addresses each with amounts of btc in them. Can i sweep or send btc from the addresses individually to another address/wallet like electrum? And will the rest if the addresses still be in my wallet then with their btc balances? How do i do this exactly?

Can i sweep or send btc from the addresses individually to another address/wallet like electrum?

Yes, but you sweep the private keys not the addresses.

How do i do this exactly?

By following published guidance, such as that given on the Electrum unofficial guide:
See Electrum - sweeping private keys

To sweep your private keys you go to Wallet menu > Private keys > Sweep:
Then you enter your private keys one per line:
Your private keys need to be in Wallet Import Format (WIF) or mini private key format. These are standard formats for private keys.

Ok great thank you. Just to be clear, can i sweep the private keys individually as my wallet holds more than one address with their priv keys. Will my wallet be compromised if i sweep them individually?

I see no reason why you couldn't sweep one key at a time. The most prudent method would be to make backups of the wallets before sweeping and test recovery from the backups on separate devices.

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


text:
How can I determine if a point on the secp256k1 curve was derived using point addition or point doubling?
I am working with the secp256k1 elliptic curve and I have a point Q on the curve. I am trying to determine whether this point Q was derived using the point addition formula or the point doubling formula.
I have tried calculating the point addition of Q with itself (Q + Q) using the point addition formula and also calculating the point doubling of Q (2Q) using the point doubling formula. However, these calculations always result in the same point.
Is there any way to determine the derivation method of a given point on the secp256k1 curve? Are there any additional steps or techniques that can help me differentiate between point addition and point doubling?
Any guidance or insights would be greatly appreciated. Thank you!

That's like asking whether it's possible to know whether someone calculated the number 8 by doing 2+2+2+2 or by doing 2*2*2. The result is the same, the process is unknowable.

@bca-0353f40e Perhaps an even better analogy is asking whether you can distinguish 5+3 from 5-(-3). Both expressions simplify to the exact same operation.

Point addition on an elliptic curve involves two formulas (the addition formula and the doubling formula), but adding a point to itself is defined as equal to the doubling. This is because in case the normal addition formula is used when applied to two identical points, you get a division by zero.
So there is nothing surprising about this. The actual addition law is something like:

If the two points are equal, use the doubling formula.
Otherwise, use the normal addition formula.

So when computing the addition of a point P with itself, what is actually invoked is the doubling formula. No wonder that it gives the same result as performing a doubling directly!
(There are more edge cases to deal with, which I've left out for simplicity)


text:
How to compute a TXID of any bitcoin transaction in Python
there, I've already looked at other similar posts on here but with little luck. All im trying to do is calculate the TXID of a transaction after downloading the transaction in hexadecimal from a blockchain explorer VIA an API.
The problem is that the TXID calculated Isn't the TXID we expect.
Here's the code, I'm using bitcoin-utils

from bitcoinutils.transactions import Transaction
import requests

# Fetch the raw transaction data from the blockchain.info API
tx_hash = '9d2d91b764ba2559b098cdd30525e2160bb15c6e27d6869e7b121a9037d8bd86'
api_response = requests.get(f'https://blockchain.info/rawtx/{tx_hash}?format=hex')

if api_response.status_code == 200:
    raw_tx_hex = str(api_response.text)
else:
    print(f"Error fetching transaction data: {api_response.status_code}")

mytrans = Transaction.from_raw(raw_tx_hex)
print(mytrans.get_txid())

That's a SegWit transaction, not all of it is part of the transaction hash preimage (see here for details). You have to exclude the SegWit parts. This Bash one-liner returns the correct TXID:
echo '0100000001189a3f6fbfb614264c8176cd2d3836882afc3c0940d698d6b481f3e5cb733c200000000000ffffffff0240420f00000000001976a914341b568f59229818c460b1795ad48cd78895c54d88ac6eeefa4a00000000160014d701ce5e753bd9454d343c8a3b86d84a3c34dbf500000000' | tr -d '\n' | xxd -r -p | sha256sum | grep -oE '^[0-9a-f]+' | xxd -r -p | sha256sum | grep -oE '^[0-9a-f]+' | tac -rs '..'; echo

Output
9d2d91b764ba2559b098cdd30525e2160bb15c6e27d6869e7b121a9037d8bd86
Explanation
Your TX can be disassembled as follows, and you have to hash everything except the bold parts:
TX version: 01000000
Witness marker and flag: 0001
Input count: 01
Prevout reference: 189a3f6fbfb614264c8176cd2d3836882afc3c0940d698d6b481f3e5cb733c2000000000
Unlocking script length: 00
Unlocking script: EMPTY (note: non-SegWit inputs will have script length >0 and have the unlocking script here instead of in the witness, so for non-SegWit this will not be EMPTY)
Sequence: ffffffff
Output count: 02
Output 01: 40420f00000000001976a914341b568f59229818c460b1795ad48cd78895c54d88ac
Output 02: 6eeefa4a00000000160014d701ce5e753bd9454d343c8a3b86d84a3c34dbf5
Witness count: 02
Witness 01: 473044022001609cd43eb8e9b8f8438eded9f6b10bad32efd7620724ccd2ed5277c0c6a3ae02200f0c1c3f4c409ada536d2363a2d8bdad418df67fed9b36bfa4482bd9985bf39601
Witness 02: 2102ee3c98964dd1bfe13bee16c0b95fcf8281f12c5885d1fcb7b59fc2cb01ca7632
TX locktime: 00000000
Concatenating only the non-SegWit parts gives us the TX hash preimage: 0100000001189a3f6fbfb614264c8176cd2d3836882afc3c0940d698d6b481f3e5cb733c200000000000ffffffff0240420f00000000001976a914341b568f59229818c460b1795ad48cd78895c54d88ac6eeefa4a00000000160014d701ce5e753bd9454d343c8a3b86d84a3c34dbf500000000

Thank you bca-0353f40e for you answer, would you be able to edit my python code so that all is needed from the user is the TXID? Thanks

That's too much work for me. You can figure it out, just parse the transaction according to format specification and skip over SegWit parts.

Do you know of any API's which will return a TX hash preimage, from a TXID?

Don't know, but maybe you can look for a library. I found PyPI which implements "tx_hash : (hex or bin tx) -> hash" https://pypi.org/project/pycryptotools/0.2.1/

Source seems to have been deleted, here's a mirror: https://bitcointalk.org/index.php?topic=5445428.0
Link to tx_hash implementation: https://github.com/ZenulAbidin/pycryptotools/blob/main/pycryptotools/transaction.py#L278


text:
How do bitcoin vanity generator work?
How do Bitcoin vanity generator work and why is there a limit to nine "specific" chars?
I tried looking up the usage, but couldn't find good articles explaining the methodology behind it.

They work by brute force.
As a private key is essentially a very large random number, and the encoding process from a public key to an address goes through a couple of hashing steps, the relation between the characters an address starts with and the underlying key is basically random.
Vanity key generators work by simply generating many, many private keys until one leads to an address that just happens to start with the desired characters. It is very similar to the block mining process in this sense.
Difficulty is estimated by the amount of effort it would take to produce an address starting with a desired pattern.
Bitcoin addresses (non-bech32) are encoded in base58, which has 58 possible characters. As the first character of an address is fixed to a 1 or a 3, we can ignore that.
To create an address starting with 1A, you effectively have a 1 in 58 chance, as the address distribution is random, and A could be any one of 58 possible values.
For one starting with 1AA, you are looking at a 1 in 58^2, or a 1 in 3364 chance. This exponential growth is why there is a limit (although the limit varies by how much computing power you can throw at a single address).
For the nine characters indicated in your question, the odds of a random address matching the desired pattern are 1 in 58^9, or 1 in 7,427,658,739,644,928. While this is a big number, it is an achievable one given a large enough cluster working on that one address, especially if you're using GPUs - even a 2-3 year old (high end) laptop CPU can hit several 10 million attempts per second, so this is still an achievable number if you have the resources.
Commercial vanity gen services further optimize this by simultaneously working on multiple independent addresses. The odds of finding an address go up proportionally with the number of addresses you are looking for.

As mentioned by Murch, the second character does not allow all 58 characters with even probability - details on why and how can be found in this question.

Those commercial vanity gen services probably store those generated addresses in a DB to directly output a few? Are there any known risks involved with using (commercial/or my own) vanity gen? Like backtracing the brute forced process?

@J.Doe Using public key combination methods, there are ways to generate an address without its generator having access to your private key. However, the generator would be able to see your balance and transactions you make. They can also use your newly generated address's transactions to find your other addresses.

Nit: The second character in Bitcoin addresses is not equally distributed, see e.g. https://bitcoin.stackexchange.com/q/18371/5406

@Murch Fair point, although I doubt it significantly changes the odds - will update the answer!


text:
(bitcoinj) How to determine which key/address to use to send funds?
I'm using Bitcoinj and am confused as to the numerous addresses it's generating. I want to be able to send funds from my wallet (for which I have my private and public key) but I am unsure as to what address I should be using.
For example, I have an ECKey from which I can debug print a private or public key, but the wallet allows me to get four different addresses:
wallet.currentAddress(KeyChain.KeyPurpose.AUTHENTICATION)
wallet.currentAddress(KeyChain.KeyPurpose.REFUND)
wallet.currentAddress(KeyChain.KeyPurpose.CHANGE)
wallet.currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS)

I understand I may not need to specify an address when creating the transaction (it seems that bitcoinj handles this?) but what address is associated with sending?
Apologies if this explanation doesn't make sense, I've been in crypto for a long time but the programming side is new to me.


text:
Blockchain wallet showing 0 however app showing balance
So my blockchain desktop wallet is showing 0 balance whoever if o go in to the app i can see my bitcoin wallet balance. When again i click on the wallet it goes back to 0 in the app for some reason. Then if i go in to transfer within the blockachain app, my balance is shown in ROI Bitcoin. I try to send From Roi to my BTC wallet and it also shows my total spendable balance but once i want to proceed after following the recomended fee by the app i get this typ of error message Transaction Failed, i then clock on the info and it comes up with Attempt to invoke virtual method intjava.lang.string.length() on null object reference.
I have now run out of options and what is the most suspicious for me is that Blockchain support have been responding to my emails and have been asking me for different screenshots which sounded as they were actually investigating this however now they have just been ghosting me for weeks, If i submitt a new support ticket they respond but then again after realising its me again they ignore any of my emails.
Please can you someone came across this situation where Wallet balance was showing the amount within the App as ROI but werent able to use the coins and in the desktop app it is balance 0 ?
I litteraly do know who to go to since support are ignoring me.
Thanks

Do you have a note of your "backup phrase"? (never tell any helper what it is, but you should have this somewhere safe).

Yes i do have that

Does the app (on your phone) use the exact same 12 word backup phrase as your desktop wallet?

I believe so, how can i find out ?

https://support.blockchain.com/hc/en-us/articles/208771356-How-do-I-make-a-wallet-backup-  Obviously I'd be very careful doing this. I'd only do it somewhere private with no distractions, no one else around, no time pressure, with pen and paper handy and somewhere safe to put the paper

Yes i have done that

So they are the same?

I didnt have the backup phrase until today, so i did it on my PC and now when i look in to the app it shows complete hence i believe whatever i did on PC has an effect on the app hence they should be the same

What exactly do you mean by "ROI"?

Ao i open my blockchain app, i see the balance i then click on to send, then under * send crypto, select the wallet you want to send from* it says ROI bitcoin and then the balance...

If Blockchain support are not able to help you and you have the 12-word "backup phrase" I believe the best course of action is to migrate to a new wallet.
By migrate wallets I mean use your backup phrase with wallet software written by a different organisation. The only important thing stored in a wallet is the private key generated from the backup phrase (also referred to as a seed phrase or recovery phrase). So any wallet that contains that key can be used to spend money that has been received at addresses created from that key.
If you are a frequent user of Blockchain's other services, such as buying and selling Bitcoin or other cryptocurrency trading, you might not want to do this. However there are alternative exchanges that you could use instead.
There are several wallets that have a much better reputation than the Blockchain wallets.
For example see ...

How can I migrate from blockchain wallet to Electrum?

As well as the backup phrase, you need to know the "derivation path" for your old wallet. The accepted answer to the linked question assumes a derivation path of m/44'/0'/0'/0.
Instead of importing the key to a new type of wallet, it can be safer to sweep the keys into a new type of wallet. Sweeping just means using the old key in a new wallet to create a Bitcoin transaction that transfers the money to the control of a new key in the new wallet. If you ever imported additional private-keys into the old wallet you'd also have to either repeat that and import those extra keys to the new wallet or instead sweep those keys into the new wallet. Given your situation I would not sweep any keys at all until certain of the derivation path of your old wallet, it would be safest to first try importing the keys using the backup phrase and, once everything is working, then move the money to new keys.
If all this seems too complicated, you might reasonably conclude that Bitcoin is not for you.

Yes this all makes sense and it does sound tok complicated all i want is to withdraw the amount i have there and thats it however i am unable to as blockchain wallet is showing different amounts every time and the most confusing thing is it shows balance there but when i want to transfer it gives me an error message saying unsuficient funds...and desktop showing 0 but app showing the balance in ROI..

@Tami: ROI usually means "Return on Investment" and so may be just some historical note about profitability of some trading activity in the past. It might not represent current balance. "Insufficient funds" means you either have no money or don't have enough to cover both the amount you are withdrawing and the necessary transaction fee.


text:
Can we sign a psbt raw tx having multiple inputs created from BTC node with bitcoinjs lib?
Due to secruity reasons, unavailablity of private keys on my end and as per project requirements I need to build back end apis where I will provide a PSBT raw transaction hex (having multiple inputs)  to front end, On front end, user will add their mnemonics and will sign all the psbt inputs individually, once all inputs are signed then a final signed raw tx hex get created.
Upon receiving signed hex I will broadcast it to the btc node and return the txid to the front end.
I am unable to find any way to sign psbt raw transaction inputs ( which is generated from btc node ) using "bitcoinjs-lib".
Could anyone please suggest how can I achieve this.
Regards,
Giri


text:
Downgrading Bitcoin Core 24.99 (latest source code) to 24.0.1
I wanted to build Bitcoin Core myself, so I followed this official guide, but in the process I failed to realize that by cloning the git repo I would just get the latest source code, not the latest stable release. I have downloaded the full blockchain, created a wallet, deposited funds, but I am running a pre-release version, 24.99. Is it possible to downgrade to the latest stable release (24.0.1)? What are the consequences, do I need to redownload the blockchain, restore my wallet, etc?

I would advise moving your funds to another wallet, and sending them back after you downgraded to 24.0.1 and created a new wallet. I don't expect there'd be any issue in this particular case (i could be very wrong though!), but IMHO you should not expect any forward-compatibility guarantee between a development branch and the latest release.

You can build any of the stable releases by checking out a tagged branch. For v24.0.1, this would be something like this:
git checkout v24.0.1

and then proceed with building, same as before. Regarding downgrading, generally speaking, you should have no issues when upgrading or downgrading between client versions but you should always check the release notes to see if there is a downgrade warning and any additional steps you might need to take.
In your case, there are no release notes yet, so make a backup of your wallet.dat file before downgrading the client. In the very unlikely event that you have issues with your block data or chainstate data after downgrading, you can first try running -reindex-chainstate before resorting to re-doing IBD.
EDIT: as mentioned in the comments, it is usually possible to use an older wallet.dat file with a newer client but not always guaranteed that a newer wallet.dat file can be used with an older client. Make sure you have a backup as you may need to sweep the funds to an intermediary wallet first and then transfer them to a newly created wallet on the downgraded client.

To be honest even if Bitcoin Core's master is reasonably stable, downgrading a wallet from a development version to the previous release sounds inadvisable. There could have been any forward incompatible change that were made during the development cycle. I'm not even sure we have any guarantee of forward-compatibility between release generally?

Good point regarding forward compatibility, as we mostly try to guarantee backward compatibility. I'll amend the answer.

If you have downloaded the source from the GitHub repo, you can simply checkout to the proper release branch and re-install the software following the tutorial again. Installing the binaries should not affect the user data.
To checkout to the proper branch just do:
git checkout v24.0.1

If the v24.0.1 tag happens not to be present in your local copy, you can fetch the tags from upstream:
> git checkout v24.0.1
error: pathspec 'v24.0.1' did not match any file(s) known to git

git fetch origin
git checkout v24.0.1

If you're concerned about potentially losing your wallet data, I'd recommend you make a backup of the user directory just to be safe. Given you're linking to a macOS installing guide, your user directory should be located at /Users/${USER}/Library/Application Support/Bitcoin/.


text:
Incorrect Transaction ID being calculated for a p2wpkh transaction
RAW Signed transaction (signet)
020000000001013ccb46c8366e39d7ff36df4f199813aa8b9dc4bed143a0eb9205cf698ca16298e400000000ffffffff0240420f00000000002200202d67ce38ba266a68f0f7c4668e9d0f5584c6da7c454bcc2368bf9fff10135157a086010000000000160014d765749aa66430b85765bdedee488f5fe3c82a8e02483045022100f71bd596f18d3caf1297a74f5619cd6c823d58acaf5f9172bea7d7d6ef82cfd502206c7c7960accd4409cccb1ca97d8268af12664de50b905d1c3579e6237c0fb823012102d3428014dd5ccf1927c6dc164e6324e2c0945a9f50b84769592e195ae6a40e8a00000000

Transaction id returned .
    "txid": "1d81e1dae9d956fd61cf79efa6a64de11465d6a1ead46e24ba043e278360fb35",
    "wtxid": "d9e69e8d05c61c78796b2d73b731a705334e07c013e7e714e10eaf45885a144c"

Transaction id calculated by following Raw_tx.
22d008e988b168165bd6c06dc4200ad57d456f1b152d25e540e75e38bb023c40

Transaction id calculated by hashing the Raw signed transaction
82fbc313fec14a7cf05309544b24bc97dc785bb82e4a9a713bb6e8d5f3cf4aeb

I have followed the above transaction formats. The signed raw transaction follows the specification given in bicoin developers raw transaction format.
Given are the implementation codes in Rust
fn get_txid(inputs: Vec<Vec<u8>>, outputs: Vec<Vec<u8>>) -> [u8; 32] {
    let mut tx = Vec::new();

    //adding version
    let version: u32 = 0x00000002;
    tx.extend_from_slice(&version.to_le_bytes());

    let inputs_length: u32 = inputs.len() as u32;
    tx.extend_from_slice(&inputs_length.to_le_bytes());

    for input in inputs {
        tx.extend_from_slice(&input);
    }

    let outputs_length: u32 = outputs.len() as u32;
    tx.extend_from_slice(&outputs_length.to_le_bytes());

    for output in outputs {
        tx.extend_from_slice(&output);
    }

    let locktime: u32 = 0x00000000;
    tx.extend_from_slice(&locktime.to_le_bytes());
    let txid = sha256_hash(&sha256_hash(&tx));
    //output

    let tx_array: [u8; 32] = match txid.try_into() {
        Ok(arr) => arr,
        Err(_) => panic!("Expected a Vec of length 32, but it was {}", tx.len()),
    };

    // reverse txid
    let mut reversed_txid = [0; 32];
    for i in 0..32 {
        reversed_txid[i] = tx_array[31 - i];
    }

    reversed_txid
}

Output serialization
fn output_from_options(script: &[u8], value: u32) -> Vec<u8> {

    let mut output = Vec::new();
    let valhue: u64 = value as u64;
    let value_in_8_bytes_in_little_endian = valhue.to_le_bytes();
    output.extend_from_slice(&value_in_8_bytes_in_little_endian);

    let script_length = script.len() as u64;
    let script_length_varint = turn_to_varint(script_length);

    output.extend_from_slice(&script_length_varint);
    output.extend_from_slice(script); //scriptpubkey {p2wpkh and p2wsh}
    output

    //OK
}

Input Serialization
fn input_from_utxo(txid: &[u8], index: u32) -> Vec<u8> {
    let mut input = Vec::new();

    //txid
    let reversed_txid: Vec<u8> = txid.iter().rev().cloned().collect();
    input.extend_from_slice(&reversed_txid);

    //index
    let index_in_little_endian_bytes = index.to_le_bytes();  // fixed 4 bytes
    input.extend_from_slice(&index_in_little_endian_bytes);

    //script length (default is zero for us)
    input.push(0x00);

    //sequence
    let sequence: u32 = 0xffffffff;
    input.extend_from_slice(&sequence.to_le_bytes());

    input

    //OK
}

The problem appears to be the lines where you encode the number of inputs and outputs:
    let inputs_length: u32 = inputs.len() as u32;
    tx.extend_from_slice(&inputs_length.to_le_bytes());
...
    let outputs_length: u32 = outputs.len() as u32;
    tx.extend_from_slice(&outputs_length.to_le_bytes());

These are not just 32 bit uints. These lengths are Compact Size unsigned ints which have a special encoding. You probably already know how to encode them since it's the same encoding for the script length in output scripts and there you use the function turn_to_varint. Assuming that function was implemented correctly, using that for the input and output lengths should resolve your issue.


text:
Import of BTC BIP38 Paper Walet into Electrum 3.3.4 not working
Trying to finalize importing BTC from a BIP38 Paper Wallet into Electrum wallet
About an hour ago I opened Electum 3.3.4, created a new wallet, set a password, saved a copy of the new wallet to a USB stick.
Then I clicked Electum's menu options for WALLET, PRIVATE KEYS, IMPORT, and pasted the decrypted private key for the BIP38 Paper Wallet into the box that opened, and clicked NEXT.
Nothing has happened: The blockexplorer shows the BTC balance is still in the Paper Wallet and not in the Electrum wallet. I closed and restarted Electrum, but same.
When I decrypted the BIP38 Paper Wallet to obtain its private key I used bitaddress.org offline, which provided me with a table containing a number of options re the decryted private key.
The specific key I chose, copied and pasted into Electrum was the one under the heading "WIF compressed format 52 character base 58 starting with 'K' or 'L' "
Would that be what needs to be corrected?
A second thing is that I see, when I click the Electrum server big green button (no idea what its called ha) that the Overview shows "Status" as connected to 10 nodes. Server is noveltybobble.coinjoined.com and Blockchain is 565750. When I initially checked this on importing the BIP38 Paper Wallet it was set to automatic not a specific server
I have read that Electrum servers can be an issue to processing transactions, and am thinking maybe that could be a problem here?
Any suggestions or help would be appreciated
ty

The blockexplorer shows the BTC balance is still in the Paper Wallet and not in the Electrum wallet.

Here's my understanding of the relationship between wallets, keys, addresses, balances and explorers:
A blockchain-explorer generally shows total unspent amounts ("balance") associated with a bitcoin-address. Blockchain-explorers do not normally have any reliable notion of wallets.
Two or more wallets can contain the same bitcoin-address and therefore both wallets can be said to "contain" the same money (BTC).
Therefore if both wallets contain the same bitcoin-address, a blockchain-explorer won't be able to tell you that an amount is in one wallet but not in another.
A wallet can contain many bitcoin-addresses. A wallet that shows a "balance" is likely to be showing you the total of the spendable amounts or unspent amounts associated with all the bitcoin-addresses it knows of.
If your new Eelectrum wallet is not showing the same balance as a blockchain-explorer shows for a bitcoin-address, it suggests the wallet does not contain that bitcoin-address (or contains more than one bitcoin-address with unspent amounts, or is not fully synchronised)

A beginners guide to the Electrum wallet says

the Addresses tab ... will be hidden by default. To reveal it, select Show Addresses item from the View menu.

Perhaps this can be used to verify that your wallet contains the same bitcoin-address that you are examining using a blockchain-explorer.
You can also check the synchronisation status:

When the block count under “Blockchain” equals the height indicated for the servers you’re connecting to, Electrum will be fully synchronized

Hi. I'm still floundering about :(
The Electrum wallet only shows one address when I click ADDRESSES, and it is not the address on the BIP38 paper wallet.
However, when I use bitaddress.org to de-encrypt the paper wallet, it comes up with a table of various private keys and QR codes. And the address that appears on Electrum appears on that de-encrypted table
(Sorry I pressed Enter instead of Shift-Enter while replying so had to go into Edit mode)

To correct my original post - I see the BIP Paper wallet's private key starts with 6P (not a "K" or "L").  So I followed bitaddress.org BIP38 de-encryption process again & looked on its table of de-encrypted private keys for priv. keys starting with 6P and I found 3 alt. de-encrypted private keys
1 Hexadecimal Format (64 char...), 2 Base64, and 3 BIP38 Format (58 characters base 58 starts with "6P"
and I chose this last one to choose . HOWEVER that de-encrypted private key on bitaddress.org table is exactly the same as the one on the actual private wallet??

What type of wallet did you create with electrum? Deterministic wallets i.e. the sort that come with a seed don't let you import private keys. You can only sweep private keys to a deterministic wallet. You can find out what wallet type you created via wallet menu > information. The wallet type, script type, seed available and keystore type options will tell us what we need to know.
The other thing is if you did import the private key (in a compatible electrum wallet type) then the coins would not have moved. The difference between importing and sweeping is that with importing the private key is added to the wallet and continues to control the coins while with sweeping the coins are sent to an address in the wallet in an on-chain transaction. When you sweep the paper wallet private key no longer controls the coins instead the electrum wallet, and it's private keys, do. So it seems like you want to sweep the private key but I strongly suggest you confirm that you downloaded a legit copy of electrum and that you have the seed/private keys of the wallet you created.
BTW deterministic electrum wallets come with 26 addresses by default and more are created as you start using addresses so the fact that you have just one address is also fishy.

The Electrum wallet kind I chose was the 4th in the list.. the one to import/sweep.
Electrum menu WALLET | INFORMATION says

Wallet type - imported
Script type - address
Seed available  - false
keystore type - imported

When I click ADDRESSES it only provides 1 address, starting with 1, which is not the same as the BIP38 Paper wallet address. But both the BIP38 Paper wallet address AND Electrum address appear on bitaddress.org's table of de-crypted private addresses when I go thru the process of de-crypting de-crypting the private key printed on the BIP38 Paper wallet

I specifically wanted to import not sweep BTC in the BIP38 Paper wallet into Electrum as I'm just moving it on to an exchange & didn't want to incur double fees. But if there is a way out of this rabbithole by sweeping instead, I'm happy to do that.
I took lots of care ensuring I downloaded Electrum from a legit site. It was https://electrum.org/#home.
I think there's only one address because I created an Electrum wallet to import, not sweep the BTC into. Does that explain why it wouldn't be fishy to only have one address?
Thanks xx
(PS I'm new here, where do I find format help?

Ok I understand what's going on now. On bitaddress when you decrypt the private key it'll give you two addresses and two separate WIF private keys corresponding to each of those addresses. You just need to import the WIF private key corresponding to the address you originally sent bitcoins to. To import just create a a new wallet again in electrum via file > new/restore, enter a unique filename and click next. If you want to sweep then create a standard wallet first and sweep into that via tools > private key > sweep.


text:
Spending BTC from an Electrum watch-only paper wallet?
I've an old BIP-38 paper wallet, and I imported that address into an Electrum (version 3.3.6) watch-only wallet.
I now want to transfer that BTC to an Exchange. I have the relevant password for the Electrum wallet and private key for the paper wallet and I've checked on a block explorer that the balance at that address is correct and it is.
Question: How do I spend from that Electrum watch-only wallet?
If I open Electum I'm only given an Export option (and from there select amount, select fee, preview, copy display where I end up with a type of report on amount sent, size of transaction, fee, locktime, inputs and outputs
I followed this option, but nothing is happening. Btc is still at my address and not at the Exchange's address and its been a while and the fee was set to max.
Where to from here? Any advice?
(PS: I see advice here to sweep the paper wallet address into the Electum wallet but I understand that would incur a transaction fee, and seeings that I'm going to send that BTC to an Exchange and that transaction would also cost fees - so I don't want to go that route :) )
ty

Solved, with some assistance from redditor u/Deminero30.
The problem was that the BIP39 Paper wallet's private key (PK) Format started with "6P..." and was 58 digits long but, when I used bitaddress.org to de-encrypt it, the de-encrypted PK bitaddress.org listed as being the de-encrypted PK was the very same encrypted PK starting with "6P...", 58 digits long. And Electrum was not importing that.
The solution was to use bitaddress.org to de-encrypted that BIP38 Paper wallet's PK that started with "6P..." and was 58 digits, but use the de-encrypted private key bitaddress.org generated for BIP38 Paper wallet PKs starting with "5..."
Go figure. u/Deminero30 who assisted thinks "the wallet was made 2 years ago and back then they were using uncompressed keys. Uncompressed keys were found to be vulnerable and they upgraded in 2018 and made compressed keys standard for all wallets. So when you imported, electrum used the compressed and not uncompressed key."
Hope that helps someone else.

As you know, it isn't possible to spend money using a wallet that doesn't contain the relevant private-key. Your watch-only wallet cannot be used for spending.
See https://bitcoinelectrum.com/importing-your-private-keys-into-electrum/
In brief it says

These instructions are for Electrum 3.0 and later.
You cannot import private keys into an existing HD wallet.
Start new electrum wallet file
Click on next to see the wallet type selection window:
select “Import bitcoin addresses or private keys”.
Enter one private key per line. Electrum supports mini private keys and full sized keys in Wallet Import Format (WIF).

You may need to convert your BIP-38 data into WIF first.
It is worth reading their notes on why you might prefer sweeping to importing despite the transaction fees involved.

Not sure etiquette in replying, but thanks RedGrittyBrick
:)


text:
White paper text is not clear to me
Is there any intention by the respective author or by Bitcoin.org to edit, improve or re-write the white paper for absolute clarity?
Among others I do not understand the value of repetitive manipulation of the message, until a hard-to-find number can be added to the message, that then forces the digest into an arbitrary format to show a given number of starting zeros.

There are many explanations of Bitcoin online, but the whitepaper is a historical document, and it is important, for one, in order to understand the inventor'(s) initial design and intentions.

Among others I do not understand the value of repetitive manipulation
  of the message, until a hard-to-find number can be added to the
  message, that then forces the digest into an arbitrary format to show
  a given number of starting zeros.

It is important because it gives everyone on the distributed network something to agree on. If the data is easily changed or forged, it is difficult to agree on. One of the main purposes of Bitcoin, as a currency, is that it is decentralized. Thus, participants on the network have to agree on supply and ownership, since there is no trust authority. Rather, users trust in the irreversibility and unforgeability of the cryptography, which includes the hash function (for mining and consensus) and the digital signing algorithms (to prove ownership).
The hash function (two rounds of SHA256) is a one-way function, so it is not reversible, i.e. you cannot calculate an input for a given output other than brute forcing (guessing). So, if you find a solution that meets a value threshold, it proves that a certain amount of work was done, on average. This acts as a way for the network to stamp transaction data as irreversibly accepted.
See also:

https://bitcoin.stackexchange.com/a/922/60443
How does proof of work inspire trust when the work is just guessing?

Is there any intention by the respective author or by Bitcoin.org to edit, improve or re-write the white paper for absolute clarity?

The pseudonymous author (Satoshi Nakamoto) has not been present online for many years; I suspect we will not see Satoshi return for a whitepaper update.
You can learn more about the contributors of bitcoin.org on this page.
Updating the whitepaper is not a priority in any sense. It is a technical paper that lays out the fundamentals of the Bitcoin Network, and it does that job well. Further, I don't believe any person or party would be capable of doing so in a way that everyone can agree on. Bitcoin has no leader, and the whitepaper is an artifact of Bitcoin's history- which is not to say it is irrelevant, just that it had its place in time. It is a great resource and starting point to learning about the Bitcoin protocol, but the modern Bitcoin network has advanced beyond what is laid out in the whitepaper, and as such there are now many other additional resources available to learn from. This website is one such resource, if you search through the history of questions you'll find there is a lot of good information available here.
With so many other resources available online, there really isn't a need to rewrite the whitepaper, at least not in any 'official capacity', even if such a thing were to exist.

Among others I do not understand the value of repetitive manipulation of the message, until a hard-to-find number can be added to the message, that then forces the digest into an arbitrary format to show a given number of starting zeros.

You may be interested to read the answer I wrote here, I think it may answer your question.


text:
electrum wallet listaddress without change addresses
i use the command

electrum listaddresses -w .electrum/testnet/wallets....

On a bash console to get all addresses of the wallet.
This however also return the "change" addresses which i cannot actually use on my project.
Is there anyway to filter those addresses on bash or i need to open the wallet file and read it?

There's command specific help with electrum help <commandname>. If you run that for listaddresses you will see that the --receiving switch does what you want. So electrum listaddresses --receiving.


text:
How do I profit from bitcoin
For a newbie like me, I am still confused about how this bitcoins works. And I don't mind if someone can help me get a clear sight on how this thing works.
Thanks

How do you profit from dollars?

Thanks @TEV I was thinking it was an investment


text:
How many nodes is too many?
Has anyone done the math on this?
For example, if we had 10’s of millions of nodes all connecting to 8 peers would there be some latency issues in propagating blocks across the network in the 10 minute block intervals?

The probability that 1 node is connected to another node will be 1 in 8, so if there were 10 million nodes, we can divide it in 8 block of nodes, every node will have access to one of the blocks.
The transaction takes less than 1 second to transfer from one node to the other, let suppose it takes 1 second, to make it easier.
On first second 8 nodes will be notified
On second 2, 8*8 = 64 nodes will be notified
On second 3, 8*8*8 = 512 nodes
Continuing this way, 8 seconds after the block is issued, a total amount of 16 million nodes can be notified of that transaction
So there is no problem with 10 minutes block, the problem arises when the block is for low times, like on some chains with 1 minute per block or less.

Yeah I figured it would be a very large number - thanks for the reply!

Note: OP asked about blocks, your answer mentions transactions, which are far less bandwidth-intensive to transmit.  It would also be nice if you could provide some supporting info, eg, some real-life network latency numbers, etc.


text:
Why isn’t connecting to your own local node a common feature for Bitcoin clients?
I come from the Monero community and connecting to my own local node running on my home PC is very simple whether it’s on the GUI, CLI or a mobile wallet.
Why does Bitcoin not have the ability to do this easily? Current using the electrum live server as a workaround but can’t help but feel this could be easier.

This is not an issue related to Bitcoin itself. Rather this is due to the protocols that clients use to communicate and the specific client implementations.
Electrum has defined their own protocol independent of commonly used node software. In order to serve Electrum clients, Electrum servers (nodes with software that can speak the Electrum protocol) have to also maintain more data than just nodes do which requires more computation and storage. Because this information is not readily available to all nodes, Electrum clients can only connect to these special Electrum servers.
You can operate an Electrum server yourself, it is just another piece of software to run. However only people who really know what they're doing and have the hardware necessary to run an Electrum server do so. By running your own Electrum server, you can configure your Electrum client to connect to your own Electrum server (and thus your own node).
The other commonly used protocol is BIP 37. Many clients that use the BIP 37 protocol actually do allow you to connect to your own node. However they typically also connect to many other nodes as well. BIP 37 has various issues and is being phased out in favor of BIP 157/158 Client Side Filtering.
Both BIP 37 and BIP 157/158 allow for clients to configure and connect to users' own nodes. It is just up to the specific clients themselves to allow users to configure this.

Great that answered my question perfectly! Why does Bitcoin core not allow a user to connect to their own node? Im guessing it may discourage users running their own node?

Bitcoin Core does let users connect their own nodes so long as they use the Bitcoin p2p protocol. Electrum's protocol is completely different and containing a full Electrum server implementation in Bitcoin Core is out of scope for the project.


text:
What information does a lightning network node hold?
Just setup my first lightning network node, what information exactly am I downloading when syncing?

When syncing the bitcoin node (a prerequisite to running Lightning securely), you are downloading the entire blockchain and validating all historical transactions, which takes a while and a over couple hundred GiB of information. Having a full validating node means that you are always receiving valid transaction information yourself, and you are not relying on third-parties who could present false information, or where you may have privacy leaks by requesting information about transactions from others.
The bitcoin node will continue to receive new blocks and transactions as they occur on the network, and each block acts as a synchronization point approximately every 10 minutes.
When initially syncing the Lightning node, you are receiving the most recent information about online nodes, open channels, and the policies by which you can send payments through those channels with Lightning's onion routing. By default, this information is limited to the previous 2 weeks only, so historical information about nodes and channels is not transmitted or stored.
After the initial sync, your node will constantly receive and rebroadcast new information about nodes and channels over Lightning's gossip network. Each node broadcasts information about itself or its channels each 2 weeks if there have been no changes and the channels are still active. Any changes to channel or node states are broadcast immediately, but nodes may limit the frequency of updates they accept to prevent potential DoS which would degrade the network. These broadcasts are also timestamped and signed.

Thanks a lot that answered my question, appreciate the quick reply also!

How does the the gossiping work? Is there situations where this doesn’t occur effectively ? Say if I have an issue routing a payment through nodes due to incorrect data?

Gossiping is staggered each 60 seconds between nodes to prevent information duplication, so it spreads through the whole network within minutes. However, in the case where you attempt to route information and something has changed since the last information you received, there is a failure message forwarded as a reply to your payment request, which contains the most up-to-date information in it so you can try again with that updated information immediately.


text:
Is there a solution to paying high fees when opening and closing lightning channels once we hit a fee only market?
Paying several hundred dollars to open and close a lightning channel seems uneconomical. This is a common argument against lightning by big blockers, I’m yet to read a valid argument against this.

Uneconomical was probably the wrong word yes, but if the fees get higher (which they will once the block subsidy is practically gone) the use of LN will decrease because no one can afford to open a channel. The main chain will be okay due to like you said, high fees = high demand. I’ll have a look into channel factories and get back to this thread.

re: "the use of LN will decrease because no one can afford to open a channel" - This is absolutely not true; on-chain fees will only increase under increased usage. If fees were too high for everyone, then usage would slow/stop, and thus fees would be lowered. In fact, if fees are high, we should expect users to be incentivized to use their transactions to open LN channels, because this will allow them to pay lower fees per payment sent. It is simply not logical to purpose that "high fees will mean no LN channel opening/closing, but regular transactions will still be economical".

Understand that no matter the fee level, some number of users/use-cases will be priced out. They key point is to find ways to allow more users to engage with the network, without sacrificing the network properties that make Bitcoin interesting in the first place.

@chytrik I never said regular transactions will not economical, I see L1 primarily being used as the SoV layer of which high fees isn’t an issue. But if I’m interacting with say a small business and want to open a LN channel with them I’m not going to pay 10’s of dollars to open a channel.

That line of reasoning makes more sense to me, though I think it is worth noting that a lot of people and businesses do spend $10's of dollars monthly in order to have a bank account that allows them access to easily transact in the wider economy.

'Under the hood' of a lightning network channel open/close, a user will be sending a bitcoin transaction. In order to send a bitcoin transaction, a fee is paid to miners.
One advantage of having a lightning channel is that you can amortize the cost of the miners fee across a potentially enormous number of payments. All else equal, having the ability to transact on the lightning network thus lowers a users expected fees/payment, small blocks or not.
Channel factories are a technology that could allow for immense cost saving for lightning users. So this is potentially a 'solution', in the context of your question.

Paying several hundred dollars to open and close a lightning channel seems uneconomical. This is a common argument against lightning by big blockers

'Uneconimcal' doesn't seem like the right word to use here. If in the future a bitcoin transaction costs hundreds of dollars in fees, that would mean that the ability to send a bitcoin transaction is in high demand. By many measures, being in high demand is a mark of success, though 'big-blockers' will argue that by increasing the block size the network can increase the 'supply', thus lowering transaction fees.
To illustrate this point, consider the absurdity of this sentence:
"That restaurant has become very popular! Nobody goes there anymore"
So you may ask "Why don't we just increase the size of the restaurant then?"
Well, the issue is that by increasing the size of the restaurant, the restaurant will lose the properties that made it popular in the first place!
So lets return to Bitcoin, to explain why increasing the block size ('making the restaurant larger') is a naïve solution that damages the network's desirable properties, while only providing a rather meagre linear scaling relief:
Implementing larger blocks means that running a full node on the network will be more resource intensive (bandwidth, computational cycles, storage, etc), and so naturally we should expect less nodes will exist due to the increased costs. This is damaging to the core properties of bitcoin (eg censorship resistance), which can only exist when the network is sufficiently decentralized. 'How decentralized is good enough?' is a question that is difficult (if not impossible) to answer, but this much is certain: increasing costs is a centralizing force, and the most conservative approach is to be 'better safe than sorry'. A blockchain network is a very expensive and inefficient way to implement a database, but the core properties mentioned above make these expenses 'worth it', at least according to the market.

In any case, there has never been a time where the average Bitcoin transaction fee is 'hundreds of dollars'... in fact transaction fees have been quite low for the majority of the history of the network. This isn't to say that fees can't or won't increase in the future, but making changes that sacrifice the most important properties of Bitcoin seems like an extremely misguided approach to scaling the network.

Chanel factories and eltoo where my first thought as well. What do you think about side chains? For example lightning could be build on top of Liquid and the cross chain Atomic swap should not be a problem. In particular the American call option Problem should not exist as the underlying asset is the same by the end of the day. In that sense we would have a fragmented base layer in which tx costs should not rise to heavily.

@RenePickhardt hmm interesting! I hadn't considered the possibility of sidechain/mainchain LN interoperability as a means of lowering fees. While the trust model of holding liquid coins is different, I think it could quite reasonably be argued that the potential cost savings would be worth the tradeoff for some users. I think you could post that idea as an answer as well, it seems reasonable to me!

@RenePickhardt I think using federated coins like L-BTC, in order to enable faster payments would kinda inhibit the decentralized scalability that we can achieve with LN. Even in LN, you do not need to trust anybody, and if anything bad happens, you can just close the channel getting your assets back.

There are other potential sidechain solutions like Paul Sztorc's Drivechains. There are some security tradeoffs versus main chain security, but they are still decentralized and permissionless, and can be implemented on Bitcoin with a soft fork.


text:
Method not found when I use bitcoin-cli to generate blocks under regtest mode

As the picture shows,I am really confuesd.

What version of Bitcoin Core are you using?

For the upcoming Bitcoin Core 0.18 release, the generate command has been deprecated and its functionality disabled. For the following major release, 0.19.0, the generate command has been removed entirely. This removal is already in the master branch of Bitcoin Core's source code. If you have built that branch from source, then the generate command does not exist.
Use generatetoaddress instead.

It works! Thanks a lot ! Next time I'll search more carefully~Thank you for your patience.


text:
Does new transaction in RBF has a txid different from the stuck transaction ? If yes , then isn't it basically creating a new transaction?
If I am sending a new RBF transaction to replace my stuck transaction and since the txid preimage has outputs value it will change the txid then why do we even care about RBF and nsequence < 0xffffffff since it will never come into effect ? Correct me If I am wrong fundamentally somewhere .

In essence, that is exactly what it is: an RBF transaction is simply a new, distinct transaction.
The RBF aspect, the rules associated with it, matter however. Full nodes maintain a list of transactions they expect to confirm (called their "mempool"), and in order to enter the mempool, and be relayed to other nodes, there are applicable rules.
One of those rules is that normally, an existing transaction in the mempool cannot be replaced by another. When RBF is enabled on the original, this is allowed under certain circumstances.
In short, while the replacement transaction is valid regardless of whether the original opted in the RBF, that does not mean it will necessarily be accepted by nodes and propagated across the network to miners.

Essentially it is a new transaction that is double spending the UTXO that has already been "spent" (is in the mempool). The nodes need some sort of rules to decide which transaction to pick up and send to miners. To prevent spamming attacks I believe that initially the RBF rule was that the new transaction had to have a higher fee than the one it is replacing. Is this still the case?


text:
what is the size of information contained in one bitcoin?
Every information stored digitally requires some space.
For example :
a text file (2-3 Kilobytes)
a song (7-8 megabytes depending upon bit rate)
a phone picture (5-6 megabytes)
\and so on..........
1 bitcoin = 100000000 sats
100 sats = 1 bit
1 bitcoin = 1000000 BITS
Assuming bit is smallest unit of computer memory, hence using standard conversion reference as below:-
/ 8 bits = 1 byte
/ 1000 bytes = 1 kb
/ 1000 kb = 1 mb
coming back to 1 bitcoin which equals 1000000 BITS.
1000000/8 = 125000 bytes
125000/1000 = 125 kb
125/1000 = 0.125 mb
so my question which I assume is technically incorrect, but hypothetically if I ask that I want to store one bitcoin in my pendrive and how much free space do I need to store that information? What would you say, am i right here in solving the numbers? //0.125 mb
(information = one bitcoin)
Thanks to whoever may answer my hypothetical (may be wrong) question.
-Praneet Jain

I want to store one bitcoin in my pendrive and how much free space do I need to store that information?

TL;DR: 32 bytes.

Bitcoins are not pieces of data, Bitcoin is a unit of measure.
To store any amount of Bitcoin in a pendrive you just store a private-key on the pendrive. That is a 256-bit number. It is exactly the same size for 0 Bitcoin, 0.00001 Bitcoin, 1 Bitcoin or for 21,000,000 Bitcoin.
To store the full history, since the beginning of time, of transfers of control of money denominated in Bitcoin, you need about 300GB and growing. But this is public information, you don't need to store it yourself as you can always obtain a copy from other Bitcoin nodes. This data is a journal of transactions called the blockchain.
Of course, you can't really point to any particular place or thing and say Bitcoin are stored there. That isn't really what is happening.

The 32 bytes (256 bits) is the smallest amount of space you will need. If you want to represent that number as printable ASCII or Unicode characters you'll need to choose an encoding scheme like Hex or Base58 etc which will increase the storage requirements.
You can store 21,000,000 Bitcoins in the space needed to store a set of letters and numerals the same length as this example:
E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262
For convenience you will most likely install a file system such as FAT on your pen-drive. The file system will have overheads and a minimum allocation unit.

1 bitcoin = 100000000 sats 100 sats = 1 bit

Those "bits" are a completely different thing to the 8 bits in a byte.

In December 2017, BIP-176 also proposed "Bits" be used as a standard term for 100 (one hundred) satoshis or 1/1,000,000 (one one-millionth) of a bitcoin.

That's nothing to do with the units of computer storage.
Just like its nothing to do with the "bits" that horse-riders put into the mouths of horses.

not 100 Satoshi, and you cannot store 8 of these in a byte

Thank you so much and what is the current size of bitcoin blockchain?

@praneetjain: I gave an approximation in the answer.


text:
Wallet for moving BCHN out of Abra
I have some BCHN in Abra and I need to move it to a different wallet.  So far, the Abra app tells me that the wallet I am trying to move to is not a BCHN wallet.  I think have tried all of the major wallets. Are there any wallets that Abra will recognize as a BCHN wallet, or should I just abandon those coins?

What is Abra? Can you link that? I think this is offtopic.

Your question is off topic, but I think I can help you:

Locate a vanity addresses generator. Maybe vanitygen-plus is good enough for your case?

Generate some Bitcoin [legacy] addresses and their corresponding private keys using the vanity generator.

Use blockchair to get the corresponding bcash addresses for those legacy addresses.
3.1 Optionally use the ecash address translator (or maybe blockchair as well, if it still supports ecash) to get the corresponding ecash addresses for those bcash addresses.

If your BCHN wallet service doesn't like legacy addresses obtained in 2, feed it the bcash addresses obtained in 3. At least one group should be a valid withdraw destination on any service.

Probe the BCHA chain. If for some reason the BCHN transactions corresponding to your withdrawals get replayed on BCHA (likely won't happen at this point), you are covered by step 3.1.

Happy shitcoining!


text:
Failing to create a debug log in functional test
I am working on a PR to migrate all test-only rpcs under the -test rpc . I am facing an issue where in one of the functional test feature_config_args.py , the node is not creating a debug log . Here is the test_framework.log.
2024-08-26T15:07:46.488000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/home/probot/bitcoin/test/functional/test_framework/test_framework.py", line 132, in main
    self.run_test()
  File "/home/probot/bitcoin/test/functional/feature_config_args.py", line 429, in run_test
    self.test_testnet3_deprecation_msg()
  File "/home/probot/bitcoin/test/functional/feature_config_args.py", line 393, in test_testnet3_deprecation_msg
    with open(f"{log_dir}/debug.log", 'w'), self.nodes[0].assert_debug_log([t3_warning_log]):
  File "/home/probot/.pyenv/versions/3.10.8/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/home/probot/bitcoin/test/functional/test_framework/test_node.py", line 485, in assert_debug_log
    prev_size = self.debug_log_size(encoding="utf-8")  # Must use same encoding that is used to read() below
  File "/home/probot/bitcoin/test/functional/test_framework/test_node.py", line 473, in debug_log_size
    with open(self.debug_log_path, **kwargs) as dl:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/test_runner_₿__20240826_203720/feature_config_args_0/node0/testnet3/debug.log'
2024-08-26T15:07:46.540000Z TestFramework (INFO): Stopping nodes

You can look at the PR here PR
The failing test is unrelated to the changes made in the file and I can't seem to figure out why the debug.log is not being created.

I do not know why the debug.log is not being produced, but how did you get the idea for this refactor? I was a bit surprised that you are working on this. Is there an open issue for this, or did someone suggest this work? If not, you might want to bring it up in the Bitcoin Core developer IRC channel to substantiate that this is something that would be considered for merging. Some of the RPCs you are moving to "test-only" are definitely used in production, e.g. stopatheight, deprecatedrpc.

@Murch . You can look at the PR description I was about to create here https://hackmd.io/@Prabhat1308/By0A4paP0/edit . This PR was something I was suggested by stratospher  to work on , however I had to choose the rpcs on my own , I asked about it here but never got the answer to the question . Link to the question here
https://bitcoin.stackexchange.com/questions/123659/identifying-test-only-rpc-arguments .

Maybe I’m confused, but the discussion on #29007 seems to mention that some RPC parameters should be moved to a "test-only" subgroup, but your PR seems to touch a bunch of startup options. Either way, if your PR is basically ready to be opened on the Bitcoin repository, how about you open it, and we discuss there?

@Murch For sure. I have found a workaround for this debug problem for now and shipped the code . Here is the link https://github.com/bitcoin/bitcoin/pull/30717.


text:
how to run bitcoind without downloading entire bitcoin core for development
I am a beginner in bitcoin development and want to contribute to some github repos and for that i need the regtest network for bitcoin but to run that i need bitcoind and bitcoin core to be downloaded which are 500+ GB in storage and my device has storage constraints . What should i do ?

It is not clear to me why you need a synchronized node to development. You can download the software and start it with -regtest. Also see: https://bitcoin.stackexchange.com/q/17553/5406

@VojtěchStrnad  I thought even to run the testnet or regtest i need to download the bitcoin core atleast one time but my misconception got cleared afterwards. I specifically didnt need to use only cli but also other libraries dependent on bitcoin core .

To run bitcoind without downloading the entire data on bitcoin core follow
https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line
And follow the

2.2: Setting Up a Bitcoin-Core Machine via Other Means

Here use the following method

Using Other Bitcoin Standup Scripts

But those are instructions for a more specific use, instead of the most generic way to prune a node, which the question was. You could edit the question in order to explain why did you need to use those specific instructions.


text:
is there such a thing as a wallet frozen due to fraud. Can funds held in such a wallet be returned to the original owner
I was recently contacted by a company called APAG-AUDIT AG claiming they have discovered funds that belong to me during the course of an audit.  I was scammed by a group of companies last year and have been contacted by numerous companies claiming they have recovered funds that belong to me.  In every case so far, the companies were confirmed as scams.  This is the first company that is actually listed and has a history of performing audits on financial sector companies.  The problem I have is that I have been unable to find a single employee listed with a local register.  For instance I contacted the FCA in an attempt to confirm registration in the UK.  They were not listed because they are primarily a firm of lawyers.  This is strange given Chartered Accountants are normally involved in financial audits not lawyers.  The company has also recently changed their web address from .com to .org.
They are not requesting fees directly however, the exchange they want me to use does charge a 2% transaction fee that I would have to pay upfront before any amounts held in bitcoin could be transferred to me.  The platform they want me to use is called cb-online.group and is formally named Crypto Bank.  When I google Crypto Bank I find that there are numerous platforms using the same or similar names and 98% of them have very poor reputations.
Any help anyone could provide regarding how to determine this firm's legitimacy is greatly appreciated.

Does this answer your question? Is it normal to be asked for an advance fee on a withdrawal?

anynews about your story with APAG AUDIT ag ? I have the same story as you. They say that audit on court will close on 10 march.
They asked me 800 usd with btc payement.
The woman who contacted us is Margot Grossman.

(1). Your answer doesn't attempt to answer the question. (2). apag-audit.org are fake - the domain used in their website was first registered a few months ago. See https://who.is/whois/apag-audit.org. (3) This is classic advance-fee fraud.

Red is right.  Their domain for their website is fairly new and I have been unable to find credentials for any of their employees.  I haven't given them a dime and don't plan to either.

It's a scam. The upfront 2% fee is a red flag and just the start, if you fall for that, they'll find other fees and charges you need to pay.


text:
Ttransaction validation in the bitcoin blockchain
I am confused.
What is exactly a validation of transaction in the bitcoin block chain?
Please correct me if I am wrong.
I know we need 6 minner to validate our transaction and those 6 minner check whether we did the transaction or not and after that if they verify that we have done the transaction then our transaction goes to the memory pool and after that minners will try to put our transaction in the new block that they are creating to add in the bitcoin blockchain.

This is what I understand please correct me if I am wrong.  There is a place called "Transaction Pool" where all unconfirmed transaction will be there, a node will be the one who will verify all those transactions and 1 transaction will need the 6 verification and this verification needed to be done by 6 different nodes. Now when Transaction gets 6 verification then it sent to the "Memory pool" [Memory pool: a collection of all confirmed transaction ].

Now here Minner will come into the pitcher Minner will collect the transaction make a block, solve the puzzle to find the nounce Noting but a proof of work and if he able to do that he will get the bitcoins as a reward.

Now I have another question that node will also get the money for verification of transaction right. the transaction fee that we give is to get by those nodes.

Transactions are validated by nodes before they are broadcasted to the Bitcoin network, and also after they are submitted as blocks.
Here are the basic steps for transaction validation:

Transaction is submitted to a node
The node does some checks to see if it is valid and standard
It enters that node's memory pool and gets broadcasted to other nodes
Miners determine if the fee rate is profitable, and if so, they begin to mine it in the next block
Block is submitted when a single miner solves the proof of work
Miner submits the block to a node
Node checks entire block including transactions
If its valid, it broadcasts it to other nodes.
Every additional block adds another confirmation to the transaction

6 confirmations is common for wallet software to consider a transaction final. That might be where you got the "6 miners" from.
Note that usually miners get and submit the block to the pool software instead of the node directly.

This is what I understand please correct me if I am wrong.  There is a place called "Transaction Pool" where all unconfirmed transaction will be there, a node will be the one who will verify all those transactions and 1 transaction will need the 6 verification and this verification needed to be done by 6 different nodes. Now when Transaction gets 6 verification then it sent to the "Memory pool" [Memory pool: a collection of all confirmed transaction ].

Now here Minner will come into the pitcher Minner will collect the transaction make a block, solve the puzzle to find the nounce Noting but a proof of work and if he able to do that he will get the bitcoins as a reward.
Now I have another question that node will also get the money for verification of transaction right. the transaction fee that we give is to get by those nodes.

There is no such thing as a "transaction pool". Transactions go straight to a node's mempool if it passes that node's validation checks. There is no requirement to get 6 verifications. And, there is no way to know how many nodes have verified a transaction.

Nodes do not earn Bitcoin only miners.

Miners do not validate transactions except in so far as they also run nodes and nodes validate transactions.  Mining serves the purpose of giving transactions a durable order so that any attempts to spend the same coin twice can be resolved in a universally consistent way.
No part of the protocol works by counting participants either, as the Bitcoin consensus is identyless.


text:
Can a non multisig wallet be a cosigner of a multisig wallet?
Let's say I have an existing BTC wallet, which is not multisig. Can that wallet be the cosigner of a multisig wallet?

That depends on the software.

Would you happen to know about Electrum?

There is no limitation that requires multisig addresses to be created using special multisig keys. A key from an old wallet can be used in conjunction with new keys from a different wallet to create a multisig address and its redeem script.
You could even create a multisig address using a few different brain wallets if you wanted to (definitely not recommended, but I'm trying to illustrate a point).
To create a multisig address, you only need to provide the public key for each key pair being used and the number of keys required to sign in order to spend. From there a redeem script is generated which is a trivial script that must resolve to true in order for funds to be spent.
There are some pitfalls to be aware of though...
Let's say you have three key pairs:
Key Pair A - Private Key A - Public Key A
Key Pair B - Private Key B - Public Key B
Key Pair C - Private Key C - Public Key C
A multisig address can be created by providing Public Key A, B & C; however if you create a multisig address by providing Public Key A, C & B it will generate a different redeem script and different multisig address. This can potentially cause trouble when trying to spend if you didn't save the redeem script and you need to re-create it to spend. So the order of the keys matters in order to re-create the same redeem script in the future (or you can just save the redeem script).


text:
Can I Find out where I sent my bitcoin from my paxful wallet
I Sent roughly "£25 worth of bitcoin to an online dark market which I'm sure was a Uk market called ''tom and jerry' but I CAN NOT For the life of me figure out or find that website I sent my coins to from my paxful address. Any way I Can work this out please??  thanks  Dale

Do you mean locate the Bitcoin address you sent it to or literally the individual/company you sent it to? If former you can can go on a block explorer like blockstream.info and search for your Paxful Bitcoin address. It will tell you which Bitcoin addresses you have sent to. If latter no. You can do search engine searches for the Bitcoin address that you sent to but apart from that you aren't able to map a Bitcoin address to an identity of an individual or company unless they announce their Bitcoin address.

I CAN NOT For the life of me figure out or find that website I sent my coins to

Bitcoin is not sent to a website, it is generally sent¹ to a bitcoin-address, which is simply a random number² so far as the Bitcoin network is concerned. Nowadays the receiver of money will generate a new receiving address for each transaction in order to increase privacy and achieve a higher degree of anonymity³.
There is no way for ordinary people⁴ to identify a website URL from a Bitcoin address, The bitcoin network does not record that sort of information.

footnotes:

Strictly speaking Bitcoin is not sent anywhere, what is transmitted is mostly instructions about changes in ownership of amounts of money (changes in control over money).

A bitcoin-address is a kind of pseudo-random number derived by a mathematical procedure that cannot be reversed. All the numbers involved are pretty much indistinguishable from mathematically random numbers. Addresses have a standard prefix and a checksum suffix but neither help identify recipients.

Bitcoin is often described as pseudo-anonymous. It is nearly anonymous, it strives for anonymity and it deliberately makes it hard to identify the people or organisations involved in transactions.

Unless you are a member of a governmental investigative agency or a wealthy individual willing to spend large amounts of time and money on an investigation.


text:
have 12 word phrase need to find wallet
I have my 12 word passphrase and would like to see the contents of my wallet how do I see this wallet on a new app or site?

Unfortunately, there is no mnemonic phrase standard that is completely unanimously adopted. (Although BIP39 seems to be the most widely accepted in my view) That's saying, different wallets may produce different types of mnemonic phrases that won't be compatible with each other. Please recall which walllet did you use, and, what did the receiving addresses look like (starting with "1" or "3" or "bc1"?). Of course, these words are your own top secret, never share it to anybody, anyone who knows them will be able to stole your funds.

If you don't care about your privacy, you can always find the associated extended public key (xpub*) and enter it in a blockchain explorer site such as https://www.blockchain.com/explorer.
Here is how a Bitcoin account's (M/44'/0'/0'/) extended public key for a given set of 12 seed words can be computed on a trusted air gapped offline computer that could be operating in a Faraday cage:
% echo "radar blur cabbage chef fix engine embark joy scheme fiction master release" | bx mnemonic-to-seed | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 0 | bx hd-public -d -i 0
xpub6DHi64TFkDPx2AH4q2ku3vX9LJYNpTis5tLrET8Sb9irp174eCkgtAnvBpyzQXgrtmF31Lrq4gTMGFUGcjJicMu9LdueVdqt6FZ2Wzcg8Fj
Ledger and Trezor devices can be queried to gain access to your xpub key.
Otherwise, just apply the KISS principle and use your wallet application that will naturally provide you with an account balance.


text:
How can I generate keypairs, and check the public key against a known public key to check for a match?
Running on headless Ubuntu Linux. I would like to use this keypair generator, and check the public keys generated with each run against a single other public key.
I know that "recovering" a lost private key is impossible and what not. But I'm not asking if this is a good or bad idea, I'm asking how I can accomplish the process of generating the keypairs and checking the public key. The address I'm checking against is pre-HD wallets. I don't know if that makes a difference, but may be relevant.
Consider this a proof-of-concept, demonstration.
I would like to generate the keys, compare against the known public key string, then if a match is found: record the public and private key information to a file.
I'm thinking I would grep/sed this, or maybe awk, but ultimately, need some direction.

Why not just make the function do nothing? It’ll never succeed to make a match anyway, so you save some effort.

See this wiki page to convert the public key to an address.


text:
How do miners know how to remove recently confirmed transactions?
A miner is in the process of creating and mining a block of 1400 transactions. Suddenly they receive a broadcast that a new block was confirmed with 200 of the transactions currently in that miner's block. How does a miner proceed in this scenario - dropping the 200 and adding 200 others from the mempool and trying to mine a block?
In a second scenario, two blocks are created almost at the same time and they each have some of the same and some different transactions. I'm assuming (a) that there is then a race to consensus for each and the first to 51% wins a confirmation. If so, then similar to above (b) the block with losing transactions has all the dissimilar transactions dumped back in the mempool. But what if a second chain surfaces with two blocks? Now all the confirmations in (a) that aren't confirmed in this second block get dumped back into the mempool and hopefully finally mined into the blockchain?
The takeway for me >>> Obviously this system does work since its very popular! But it seems that transactions can take a very long time and no way to really guarantee that they will occur unless a payor decides to pay a high fee to almost confirm that miners will pay attention to his transactions first and most will include that transaction into the miner's next block to add to the chain.

How does a miner proceed in this scenario - dropping the 200 and adding 200 others from the mempool and trying to mine a block?

If the miner is trying to build on top of the block that was received, then he will have to drop the 200 transactions that were included in the other block. He will also not be able to include the other transactions in the next block that were present in the block he received. Apart from this, he is not restricted which valid transaction he can include. He can fill in more valid transactions, remove some or remove all the transactions and just mine the block with coinbase transaction. It's up to his discretion.

Two blocks are created almost at the same time and they each have some of the same and some different transactions.

Imagine a scenario where two miners find a solution at the same time and both the blocks are valid. As soon as they find the solution, they will relay the block to the full nodes. The nodes will add the block that reaches to them first and add it on top of the existing blockchain. However, when they receive the other block at the same height, they will not discard it but maintain a copy of it. So here you have a blockchain fork, where around half the nodes have a different version of the blockchain at the best height. Other mining nodes will start mining the subsequent block based on the copy of the blockchain that they are seeing (on top of the block that they received first.) Now, one of the miner will find a solution and propagate it to the network. More likely than not, it will not happen to be simultaneous like the previous block. So when that block is propagated, the network converges back to a shared state. Now, as the network converges the full nodes will discard the transactions from the mempool that are already confirmed.

Superbly explained. Many thanks for the effort.

@rossmclochness if you think it adequately answers your question you can click the tick mark near the answer so others know this is an accepted answer and they find it helpful

so, if two miners create valids block in the same height (with transactions in common), is probably that one of them will not gain any ravenue for that mining???

@eduardopascualaseff Yes. When a miner mines a block, the payout comes through the coinbase transaction. This coinbase transaction is not spendable until 100 blocks following the mining of the block. Most reorganizations settle themselves within 2-3 blocks. So one of the miner's payout transaction will never be included in the main chain.


text:
Please tell me the procedure for installing bitcoin full node in CUI on CentOS
I am really sorry, please teach.
Please tell me the procedure for installing bitcoin full node in CUI on CentOS.
Currently I installed using the following procedure, but I got an error in RPC authentication.
1.
$ sudo yum install wget
2.
$ sudo wget https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
3.
$ sudo wget https://bitcoin.org/bin/bitcoin-core-0.17.1/SHA256SUMS.asc
4.
$ sudo wget https://bitcoin.org/laanwj-releases.asc
5.
$ sudo gpg --import laanwj-releases.asc
6.
$ sudo tar -zxvf bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
7.
$ sudo install -m 0755 -o USER_NAME -g root -t /usr/local/bin bitcoin-0.17.1/bin/*
8.
$ mkdir ~/.bitcoin
9.
$ vi ~/.bitcoin/bitcoin.conf

Enter the following with vi and save.

mainnet = 1
txindex = 1
server = 1
rest = 1
rpcuser = a
rpcpassword = a
rpcport = 8332

11.
$ cd /DATA_DIR
12.
$ sudo mkdir bitcoin
13.
$ sudo chmod -R 777 bitcoin/
14.
$ bitcoind -daemon -datadir=/DATA_DIR/bitcoin -conf=/.bitcoin/bitcoin.conf
Bitcoin server starting
15.
$ bitcoin-cli getbalance
After this, the following URL error will occur.
error: Authorization failed: Incorrect rpcuser or rpcpassword
error: Authorization failed: Incorrect rpcuser or rpcpassword
Which procedure is wrong and how do I fix it?
I am really sorry, please teach.

In your bitcoin.conf, remove the spaces before and after the equals (=) sign. I believe the conf file parser does not handle spaces well.
Also, your command has -conf=/.bitcoin/bitcoin.conf, but your conf file is at ~/.bitcoin/bitcoin.conf so it is pointing to the wrong location.

As you say, I deleted the space before and after = and corrected the path specification when starting bitcoind, and RPC worked correctly. Thank you!
　bitcoind -daemon -datadir=/DATA_DIR/bitcoin -conf=/home/USER_DIR/.bitcoin/bitcoin.conf


text:
How do many public keys correspond to one private key?
I have read online that hardware wallets can generate new public keys to facilitate transactions. Ie if someone has BTC on an exchange and they want to send that BTC in different installments to a single private key/hardware wallet, that hardware wallet can generate a different public key for each transaction. I'm a bit confused on how this works? Would the ledger not indicate that each of those installments now belongs to a different address? Or is it simply that each time a new public key is generated, the private key in the hardware wallet has the ability to sign for all of those? (Thus creating a persistent, growing list of public keys associated with one private key?).
Additionally, what is displayed on the ledger if that hardware wallet, after multiple installments with different public keys, now wants to send BTC elsewhere? Which of the previous public keys is used? Does it create a new one? Wouldn't this show up on the ledger as a public key sending more BTC than it ever acquired?

The answer is in Hierarchical Deterministic (HD) wallets. These create a tree-like repeatable sequence of key pairs (private and public) from a master private key.
Each public key is associated with one private key.
See BIP-32
Standard ways of spending Bitcoin involve reference to an output of a previous transaction and hence to a previously used public key. It typically needs the corresponding private key to be used to generate a number that will satisfy the spending script.

Thanks for your answer! I have a question about then tracking the total balance of all wallets generated via Ledger: https://bitcoin.stackexchange.com/questions/116038/how-to-retrieve-total-btc-held-in-ledger-wallet?noredirect=1&lq=1


text:
How to develop bitcoin sidechains/second layer solutions?
If I have an idea for a use case that requires transparency and ultra-secure final settlement, how do I go about programming this to be a side chain/2nd layer solution on the bitcoin network? Is there a specific language I'll write in? A specific client? A specific IDE? Where can I get started?

Is there a specific language I'll write in?

No.

A specific client?

No.

A specific IDE?

No.

Where can I get started?

If you don't wish to create intellectual property rights over your ideas or software, you could start by studying the licences to existing solutions and then study their documentation and source code. If you don't want to be bound by their licences and want to develop your own intellectual property you'd need to be much more careful and might need to start with a clean-room development process meticulously avoiding any knowledge whatsoever of existing solutions.


text:
How secure are the decentralized nodes?
I colloquially understand the inherent security provided by the decentralized distribution of the nodes that host the bitcoin network. However, is the distribution of the devices which run the nodes known? More specifically, are these devices secure? Is it possible the majority of the machines which host the nodes, geographically distributed as they are, are unprotected against sophisticated hacks from malevolent actors? (Ie random old computers with outdated firewalls)? Could a nation state corrupt the nodes?
Additionally, what is the impact of node corruption specifically?

I feel this question is too broad for this website, it needs a narrower focus. As it stands it needs something the length and depth of a PhD thesis as an answer.

Is this not something that is well understood? Can it not be generalized at least to answer the question? Granted it may be complex but… is that not a major security risk?


text:
Prior to collapse, how could FTX honor btc withdrawals if filings show they held no bitcoin?
I have seen in the news that, in bankruptcy filings, it was revealed that FTX held no bitcoin. As far as I can find on the internet there's nothing pre-implosion that suggests user were explicitly unable to ever withdraw BTC... how is this possible? If FTX owned none, prior to the bank run, how were people able to take their assets off the exchange and into private custody? Would FTX just buy it spot and then give it to them?

Bahamas authorities took custody of about $400 million worth of cryptocurrency that was held by FTX. It seems likely that that's what they had been using for things like withdrawals.


text:
Can punched-in seed phrase on steel plate be read by airport security x-ray?
If I put a steel plate with seed phrase in bag and it goes through TSA's x-ray machines at the airport, am I at risk of them being able to read the words?

High resolution x-ray cameras of the type used for baggage scanning would likely be able to read stamped metal.  For an example, this Chinese security manufacturer shows an example image where you can pretty easily make out a lot of detail.  Looking at their product line shows they have a variety of x-ray technology that would be capable of producing high resolution images from metal contained in your bags.
This answer over on the Physics Stack Exchange site says:

The X ray detectors work by sending a beam of X rays through the stuff they are probing. The higher the density, the more X rays gets absorbed, the less one detects on the other side. In fact, we are not measuring density, but integrating it along the line of sight; the total mass the ray had to go through.

So assuming the stamping slightly modifies the density of the metal or the thickness of the metal, presumably anything written on a metal surface might be read.
Multisig wallets are a way around this particular security concern in that you only have an individual piece of the private key required to spend coins.  This answer has some details about that.  Check the list of questions tagged with multi-signature for even more info.


text:
Does the time that it takes to recover a wallet by its seed protect the blockchain from rainbow tables attack on its seeds?
How are bitcoin seeds protected from rainbow tables attacks in the long term? Can't them started to be generated now and have some valid ones in 10 or 20 years?
If so, does the (what I think is) slowness of the wallet recovery process act as a security barrier? Let me explain:
If I have understood this explanation about how a wallet recovery works, the process involves to:

Download the whole blockchain.
Generate a public key from the seed.
Hash it since it's possibly a p2pkh.
Iterate over the whole blockchain gathering all transactions whose recipient is the key in (3)
Repeat from (2) until 'n' (in a row) of these public key hashes (addresses) don't exist in blockchain, being 'n' the gap.

That seems a long process, at least from the point of view of a rainbow tables attacker. Is this correct?

Rainbow tables are a lookup table, not an inherent speedup. In order to construct a rainbow table, someone has to - at one point - actually go through all possible keys to construct the table. Once the table is constructed, lookups are relatively fast, but it is all conditioned on that table being built in the first place.
Going over all possible keys (in order to build a rainbow table, or whatever other reason) is completely infeasible. The size of the keys is many orders of magnitude larger than typical password dictionaries.
Rainbow tables are just not a feasible approach for attacking Bitcoin keys.

Is this applicable to bitcoin seeds as well? They are both 128 or 256 bits strings so I assume so.


text:
Is it safe to connect my HW wallet to a computer which is connected to the internet?
Cold wallets are those that have never been connected to the internet, and are safer than hot ones, which have been exposed to it.
If I connect my HW wallet to a computer which is connected to the internet, I'm exposing my HW wallet to the internet. Does it stop being a cold wallet? Am I losing security by doing this?

According to this article, HW wallets keep the private keys always offline. That is better than a normal pendriver, but still it's not pure cold storage.

Although it is true that some HWs keep the private keys offline ex: Blockstream Jade, Coldcard. Others like ledger are still technically in a class called hardware wallet but as of recently added firmware that keeps your seed phrase on centralized servers which are absolutely not offline https://news.yahoo.com/finance/news/ledger-crypto-wallet-under-fire-141439821.html

adding details to answer

Think we should probably start by stating the basics here:

Cold wallets are those that have never been connected to the internet, and are safer than hot ones, which have been exposed to it. | ** The Concept of and AirGapped Computer or a Completely Cold Wallet which has never been exposed (either directly or indirectly) to some kind of network is extremely rare [especially these days].**

In other words, if you're not using at least a couple ColdCards from (Coinkite)[https://coinkite.com] CORRECTLY(read the docs) | then we're not really talking about an air-gapped system which is completely immune to anything. It's cold storage : Offline, plain and simple.

To whit, the context of separating devices into

"Safe"
"Not Safe"
is one where, 99.8675% of times the distinction settles within the most common of all flaws within systems :
"The Human Factor"

If I connect my HW wallet to a computer which is connected to the internet, I'm exposing my HW wallet to the internet. Does it stop being a cold wallet? Am I losing security by doing this?
In, a nut-shell : yes.
(I get where you're going with this and what you're actually trying to ask; the answer here however is a bit more complex).

assuming it was ever cold in the first place (I mean - you did have to fund it at some point right?).
are you losing security | The answer to this question depends upon your threat model. Meaning: What is security to you? Who are you trying to secure your funds from? What device are you using? Are you actually talking about security or annonimity ?

(Security, Privacy and Annonymity are entirely different Concepts)
In all honesty the best advice I can give you is own multiple Wallets, look into the ColdCard by CoinKite (link provided above) and please be sure to read the documentation so that you fully understand what you're doing and what't you're trying to ask.
On a personal note: I've got a hardware wallet which stays online 24/7 (the lattice1 by gridplus [i've cripled my entire device so that it only works via an rj45 ethernet jack connection | are my funds less secure? no.])
My advice: Buy a couple coldcard kits, microsd's and read the documentation.
Personally I'd stray away from ledger's, trezors and the likes ... then again - we're talking about your funds not mine.