text:
Why does Bitcoin fail the Howey test?
The Howey test has been influential in shaping the legal understanding of what constitutes a security, particularly in the context of cryptocurrencies and token sales, where the application of securities laws can be complex and subject to ongoing debate and interpretation.
Bitcoin is considered a security as it does not meet the Howey test. Please explain.

This seems to be a question for a legal question & answer site, as it is unrelated to the technology to support the Bitcoin currency. Still, I believe that one has to satisfy the Howey test to classify as a security.

Too bad, was hoping to get a better understanding of the topic.

I’m voting to close this question because it is a legal/regulation question while this site is about technical issues.

You are confused, if an asset fails to pass the Howey test it is NOT considered a security. It is a highly common misunderstanding. This was also made clear by BTC not being listed by the SEC as a security.
Each prong of the test is a symptom of a security in the context of an asset being traded on the market. There are four main prongs:

The existence of an investment contract
The formation of a common enterprise
A promise of profits by the issuer
The use of a third party to promote the offering

https://www.investopedia.com/terms/h/howey-test.asp#mntl-sc-block_1-0-42

I am not going to go over in detail how Bitcoin does not meet these characteristics because it has been discussed by more informed people a lot already. That being said the SEC has also clearly stated Bitcoin does not meet these qualifications. As you put it, it fails the Howey test. Usually failing sounds bad like in a school exam context, but the Howey is the opposite. You WANT to fail in order to avoid being regulated by the SEC. If you think about it, the only real way to avoid it is to avoid having a network that can be captured easily and that's exactly what Bitcoin does best.
Furthermore any assets that DO meet these qualifications are considered a security by the United States of America Securities and Exchange Commission.
(It should be noted that although this represents the qualifications for a security under the Howey test accurately, evidently the SEC does not prosecute these rules thoroughly/equally and many projects that might qualify as a security might still not listed as one by them)


text:
How to Compress Public Key with OpenSSL / Bash
I generate the private and the public keys in Shell like that:
openssl ecparam -name secp256k1 -rand /dev/random -genkey -noout -out private-key.pem
openssl ec -in private-key.pem -outform DER | tail -c +8 | head -c 32 | xxd -p -c 32 > bitcoin_private_key.pem
openssl ec -in private-key.pem -pubout -outform DER | tail -c 65 | xxd -p -c 65 > bitcoin_public_key.pem

Then I can take the public key X with:
head -c 66 bitcoin_public_key.pem | tail -c 64

And the last byte of Y with:
tail -c 3 bitcoin_public_key.pem

The compressed public key must be 0x02 + X for an even last byte of Y and 0x03 + X for an odd one.
How to check if the last Y's byte is odd or even?

Instead of compressing 'by hand' you can have OpenSSL do it:
openssl ec -in privatekey.pem -pubout -conv_form compressed -outform der | tail -c 33 | xxd -p -c 33 >compressedpub.hex

And .pem is usually used to mean PEM format, while the files you are creating are totally not at all or in any way PEM format, so that's very misleading and confusing. I used .hex for my example, but there are other reasonable possibilities.

You just check if Y is divisible by 2 (i.e Y % 2 == 0). It's the default parity concept…

source: Stack Exchange

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

sort: votes


text:
Coin Mixing in Wasabi Wallet
I'm trying to understand how bitcoin works in more depth. Can someone help me understand why wasabi wallet users should not co-spend change outputs with mixed coins?
I think there's a privacy implication but is there more to it, and how does this work?

When a third party is looking at the blockchain record, they can apply certain heuristics to what they see, in order to try to discern who owns certain coins.
A wallet like wasabi works to break some of those heuristics, essentially leading these blockchain spies to a dead end. If you own an output from a wasabi-style coinjoin transaction, and then spend that output somewhere that reveals your identity to your counterparty (eg, you buy something from an online shop and have it shipped to your address), then the parties that you revealed your identity to will most likely be unable to discern any of your financial history, pre-coinjoin.
This works in the other direction as well: if someone knows you own an output, and then you use that output as input to a coinjoin transaction, then it will be unclear which coinjoin output you own, once the transaction is complete.
So to answer your question:
One of the heuristics is called the 'common input ownership heuristic', and it basically assumes that any inputs to a transaction will all come from the same wallet. Of course, this heuristic is NOT always correct, but in practice it may work well enough to damage your privacy if you are not careful.
So if you spend some coinjoin outputs (which have a history that is hard for a third party to discern) in the same transaction that you spend some change outputs (which may be known to be owned by you), then a chain spy may assume that you also own the coinjoin output! And thus your privacy (as well as the privacy of others in the mix) will be degraded.

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


text:
What are the differences between POW, RPOW and hashcash?
What are the key differences between Satoshi’s Proof-of-Work, Hal‘s Reusable Proof-of-Work and Adam Back‘s hashcash?


text:
One seed phrase created two wallets with two script types
I have a wallet on blockchain.com and it is saved with the backup phrase. Due to issues I was not able to buy anything there, so I created an account at coinbase. This lead to the usage of coinbase wallet. I imported the wallet with the phrase. Everything went well unti I added coins from coinbase. This new amount appeared only in the coinbase wallet.
So now I figured out using Electrum that I have created two wallets. One with with script type p2pkh and one with p2wpkh. Both summed togehter cointains my whole number of coins.
How can I proceed to put all in one wallet together?
Since support on blockchain.com is not able to help I want to have all at one place again.

How can I proceed to put all in one wallet together?

Decide which wallet you want the coins to end up in
Open that wallet, copy a receiving address from it
Open the other wallet, send all funds from it to the address you copied above (be sure to double check that the address you paste matches!)
Wait for transaction confirmation. Once confirmed, all your funds will be in available in that one wallet

It is not technically impossible to have a wallet handle addresses that are different script types, but I'm not sure I know of any wallets that include this functionality.


text:
How do I disable mining in `bcoin`?
When running bcoin, how does one disable mining by default? I just want to run a full node without mining. There seems to be no config options to control it.

Why do you assume bcoin is mining by default? I'd be extremely surprised if it was capable of mining by itself at all.

Mining is disabled by default, it must be switched on with rpc commands and like @PieterWuille said it can only usefully generate blocks for test networks.

@pinhead: I think that's an answer. :)

Mining is disabled by default, it must be switched on with RPC commands:
https://bcoin.io/api-docs/#rpc-calls-mining
Keep in mind without additional hardware, bcoin can only effectively generate blocks on test networks (like simnet and regtest). A bcoin full node can be used by a mining pool operator to generate block templates and ultimately find valid blocks, there has been at least one block mined on mainnet with a bcoin full node.


text:
Bitcoin core v0.19.0.1 automatically prunes. I keep loosing the blockchain. How can I stop this?
Bitcoin core v0.19.0.1 automatically prunes. I keep loosing the blockchain. How can I stop this?
I went into preferences and I de-selected the pruning. I also added the line prune=0 to bitcoin.conf. And in spite of all that when I booted my computer after a power outage Bitcoin Core desktop pruned my copy of the blockchain. At first when I booted my Mac Bitcoin Core showed me a screen asking me for the filesystem location for Bitcoin. I had to mount the USB external disk and enter its encryption password. As soon as I confirmed the file location it took it upon itself to prune. This problem is not limited to power outages. When I upgrade to the next version of the software it prunes again. How can I put a stop this?

possible duplicate of https://bitcoin.stackexchange.com/questions/92249/bitcoin-core-v0-19-0-1-automatically-prunes

I'm aware of a GitHub issue related to this where the developers claim to have added a checkbox on the welcome dialog box for whether to prune or not. However, I do not recall seeing that checkbox. Also, there is no way for me to summon that dialog box. It only shows up when I start the software and it can't find the Bitcoin directory where it expects it to be.

Please post the debug.log file.

@AndrewChow https://www.dropbox.com/s/81v5q3wzdtnk9pz/debug.log?dl=0

Start bitcoin-qt with the -choosedatadir option. You'll get first startup dialog again. Uncheck pruning there if it is checked and make sure the datadir is pointed to where you want it to point to. Once you click OK, double check the settings that pruning is disabled. Then check for a bitcoin.conf file in your datadir. If it is not there, you are fine. If it is, make sure it does not have have a prune= line.
Bitcoin Core does not prune by default, but recent changes to the Choose a Data Directory dialog may automatically enable pruning.

I tried to start bitcoin-qt with -choosedatadir at the CLI on my Mac but my Mac refused to run the command for security reasons. How else can I run it? I will try to remove my external drive to force that window to show up.

I managed to get the "Choose Data Directory" window to show up and I unchecked pruning. But, will I have to uncheck it every time or will it remember?

It should remember it now.

Yes I think it did because the next time I saw the Welcome dialog box there was no more checkbox for pruning. Thanks!


text:
macOS Monterey refuses to open Bitcoin Core.app because Apple cannot check it for malicious software
Today I upgraded to macOS Monterey. First, the new OS deleted "Bitcoin Core.app". So, I re-downloaded the signed .dmg. Second, Monterey refused to open "Bitcoin Core.app" saying

"Bitcoin Core.app" can't be opened because Apple cannot check it for malicious software.

BTW. I'm not used to compiling C++ code as I am not a C++ programmer but I have xCode installed on my macOS.

Okay! The old way still works:

In the Finder on your Mac, locate the app you want to open.
Control-click the app icon, then choose Open from the shortcut menu.
Click Open.


text:
how to test decryption of shared seed for a multisig vault
I used the script from this post
How to derive the private key associated with a Coinbase multi-sig vault address
To get the Master Private Key, Extended Private key at index 14, and WIF format of that key.
All those values  correspond to the user seed and user public key.
I need to do the same with the shared encrypted seed (and shared public key) but I am not sure I know the correct password used to encrypt the shared seed.
Looking at the coinbase multisig github they specifically state they used the BIP38 library to decrypt the encrypted shared key seeds.
Is there any way I can test passwords to decrypt the shared seed?
I assume testing should de done offline, right?
Also, I have no idea what "Extended Private key at index 14" even means in this context.  What does that mean?
Thanks in advance.

For anyone who is in the same boat, here is how I was able to test passwords on an encrypted shared seed.
Download the zip from Github
Two-factor Bitcoin (BIP38) - Formerly at bit2factor.org; domain expired 4/5/2015
unzip it and open the index.html.
Disconnect from the internet before entering any data into the web page.
Select "Decrypt Private Key"
Enter the encrypted private key and password you wish to test and click the blue "Decrypt Private Key" button.
If the Address and Private Key (WIF) display, you have the correct passphrase.


text:
Create a .psbt using the BitcoinCore client
I am trying to create a .psbt using BitcoinCore on mainnet. The use-case is that I want to be able to export the unsigned transaction, import it into my cold-storage wallet (using BitcoinCore) and sign it, to then broadcast it. I have successfully done this using Electrum as a hot wallet to generate the transaction, but would like to move away from any third party software.
Basically I am trying to follow the steps from this post, but it does not work. The problem is that BitcoinCore will recognize the balance as watch only (as it should) but when trying to create a transaction I can not find the coin inputs listed anywhere (under the Coin Control feature).
The base transaction is b69314fff08ae8b58c41d653ea212d9e1f2ecf683f0ea96ee5f9c52f22b0a189 and my address is bc1q4xuxxf6mmcyk9q3k3lufhr7rlsn9hzhrvkdgqz. For Electrum, all I had to do to generate a .psbt was importing the address. I have tried importing the address into BitcoinCore using
importaddress bc1q4xuxxf6mmcyk9q3k3lufhr7rlsn9hzhrvkdgqz

and also importing the public key using the importpubkey command, then re-scanning the wallet. Nothing worked.
I also tried the following command (and multiple variations of it) which some people claimed fixed the issue for them:
importmulti '[{"desc": "wpkh([a9b86327]0391f12147a67c291785baf634187f7ad24d4e491b07f53543a33f7705736efeb6)#jpxe908h","timestamp": "now","watchonly": true}]'

using inputs provided by getaddressinfo. Again no coin inputs were selectable after re-scanning the wallet.
Is there something I am doing wrong? I am a bit confused why BitcoinCore will not allow me to create a .psbt even though Electrum did instantly (and I was subsequently able to import and sign it using BitcoinCore).
Also, would someone be able to explain in simple terms what the desc field is doing? From what I gather, it holds a descriptor that tells the wallet how to generate addresses, but I could use a short example to understand it better.

Did you create the wallet with private keys disabled?

No, addresses generated within the wallet have private keys (using dumpprivkey). I left the standard settings unchanged when I created it.

You will need to use a wallet with private keys disabled (choose that option when creating the wallet) in order for the Create unsigned button to appear.

Thank you, turns out this solves it. Intuitively I assumed a full-wallet would have a superset of the functionality of a watch-only one and was therefore expecting the problem to be more complex. If you like to post it as an answer, I'd accept it.

The "Create Unsigned" button is only available to wallets with private keys disabled (i.e. watch only wallets). So you will need to create a new wallet and choose the "Disable private keys" option.


text:
If someone cuts a standard Bitcoin private key into two (or more) equal parts, would another person be able to spend the coins after finding one part?
Someone has a standard (non-compressed) bitcoin private key (256 bits) and wishes to store it on paper. Being paranoid about someone finding the sheet of paper, he/she cuts the private key up and stores the two (or more) equally sized pieces separately. There is no overlap between the different pieces.
Assume a malicious party found one (or more, but not all) of the different chunks. Is the malicious actor able to spend the funds? If so, what steps would be required?
Attempt to answer:
My understanding would be, that a malicious actor would have to compute the remaining part of the private key to spend the funds. Though this is easier than 'guessing' the whole key, it should be technically unfeasible after about 100 bits at the time of this writing source. Splitting the key into more chunks would only make guessing more difficult (assuming only one is found), yet easier to recover (assuming all but one are owned). Is there some flaw in my reasoning?
Note: I am aware that multi-sig is the standard way of achieving better security. What I am asking is non-standard.
PS: I'm new to Bitcoin (and to StackExchange as well). Feel free to edit as needed and remove this notice afterwards. Thank you!

Your intuition is right, if I split a key in two and someone has one part, and they are independent, he/she must guess the remaining 128 bits, which is infeasible.

The security of half a key would have to be more carefully considered. Suppose the key is n-bits long, and you know n/2. This paper suggests that generically, Pollard's kangaroo algorithm would mean you have n/4-bit security (i.e. an attack running in expected ~2^64 operations). However this doesn't mean that's the best attack possible, and it may be better to ask this on crypto.se
But as you note, there are better ways to do it. As well as multisig which you mentioned, there is also a concept known as Shamir's secret sharing which allows you to divide a secret into multiple pieces such that any chosen number of them together can recover the whole secret, but with fewer than that chosen threshold, you learn absolutely nothing about the secret.

Are you sure that's right? I can imagine that e.g. knowing that the private key is in a particular 128-bit range may permit lattice attacks that are faster than brute-force, or than DLP.

Hmm maybe you're right. I feel like it should be fine but I have edited my answer just in case. It feels like the best attack on half an n-bit key would still be 2^(n/4). Maybe it should be asked on crypto.se


text:
Is accepting Bitcoin as a gift save?
I've got certain amount of mBTC from a person I don't know well (we've never met in person, although we chat online from time to time), in the form of them giving me the key for getting access to the wallet. They say, it's just a Christmas gift; and I don't see any obvious signs of scam here (they don't ask me to do anything in exchange and say that I don't owe anything).
But I'm still anxious, as in my world people don't give away money like that. I have only basic understanding of Bitcoin. Is it possible, that I'll run into trouble here? Like, if this person got these money through some illegal activities, could the trace lead now to me instead of them? What else should I look into? (besides our local laws regarding using cryptocurrency and paying taxes, I'm looking into it now)

in the form of them giving me the key for getting access to the wallet.

Something I associate with scams.
If this is an online wallet (custodial) this sort of thing is normally explicitly forbidden in the terms and conditions. And for good reasons.
If it is a more normal wallet, it is an idiotic way of donating money. That by itself is suspicious.

Is it possible, that I'll run into trouble here?

It is possible, but there's insufficient information to guess how unlikely it is.
Suppose that the wallet (key) is stolen or that money that is the proceeds of crime will be routed through it. It is possible that, having accessed or used the wallet you will be traced and held responsible for money laundering, handling stolen money or accused of complicity in crime.
Maybe they're hoping you don't know that changing the password won't lock them out of the wallet and that sometime in the future you'll add money to that wallet that they will then steal.
Maybe they're grooming you and will later ask you to perform some sort of favour for them involving the use of that wallet in a way that helps them but lands you with debt or a day in a police interview room?
Or it may be the donor is just appallingly inept. Or thinks you are?
In the end it doesn't matter, you don't have to work out the exact way they are trying to trick you. If it seems at all suspicious, keep well clear and don't get involved at all.
The only relatively safe way to accept Bitcoin as a gift is to download a popular respected wallet to a clean PC or phone, don't give anyone else any details at all about your wallet apart from a single-use bitcoin address they can transfer some amount of Bitcoin to. Never accept wallets or keys from other people.

This can't be a scam (unless they try to make you suffer legally), those coins can now be yours. Feel free sure to use the "Sweep coins" feature of your wallet to take the control of the coins.
Also, they might be trying to find your total balance. Against that, use a mixer or an altcoin converter.


text:
Did the Bitcoin network reduce spam?
In an 2008-11-03 email, Satoshi Nakamoto hypothesized that Bitcoin could actually reduce spam by making botnets more valuable for being part of the Bitcoin network than spamming:

The Bitcoin network might actually reduce spam by diverting zombie
farms to generating bitcoins instead

Was there any research done to say if this actually occurred or not?

Was there any research done to say if this actually occurred or not?

No.

It is, of course, impossible to prove a negative.
However I consider it obvious that the sort of hardware used for botnets is not the sort of hardware used nowadays for hashing. Specialised SHA256 ASICs are not repurposed spambots.
During the era of GPU mining, I seriously doubt there was any reduction in home gaming. Merely many disgruntled addicts paying over the top for GPUs or gnashing their teeth at unavailability of bleeding edge GPUs. I doubt a significant number gave up world of warcraft etc.
Consequently I doubt the specialist market for Bitcoin mining hardware caused any measurable reduction of email spamming.
Consequently, I'd be a little surprised if any serious researcher thought it worthwhile them spending significant time carrying out rigorous research on this subject and reporting on it.

Yeah, there was a brief influx of botnet hashpower in 2011, but shortly after that, CPU mining became unprofitable, even for botnets.


text:
Hash publication - Bitcoin whitepaper Section 3 Timestamp server
In section 3.Timestamp Server of the Bitcoin whitepaper it says:

The solution we propose begins with a timestamp server. A timestamp
server works by taking a hash of a block of items to be timestamped
and widely publishing the hash, such as in a newspaper or Usenet post

I am confused by the meaning of the sentence in regards to "widely publishing the hash". I am not sure if the correct way to interpret this is, the seed / genesis block should be widely published or that a function of the server is to repeatedly publish each block that gets timestamped.

It just means that blocks, and consequently block-hashes, are widely distributed among a large community of completely independent entities. In this case, the community of Bitcoin nodes / Bitcoin users.
Any nodes that perform timestamping (mining) have to widely publish the hash in this way in order to be paid for their work.
What helps make the time-stamping immutable is 1) The size, distribution and relative anonymity of this community. 2) The use of a link to a previous block where the link takes the form of a hash of the previous block.


text:
How does change address interact with original address
change address is an additional address inside a wallet, which u can create with a raw transaction with 2 outputs.
What I want to know is how does this change address interact with the (for a lack of words) "original" address, when sending money back to the "original" address.
Does the change address have a pre-written script which sends BTC back to "original" address?

by 2 outputs, do you mean you are sending to 2 real people separately in the same single transaction? or is the 2nd output your way of saying the change address that goes back to you?

There is no relation at all between the two addresses, except that they're owned by the same person/wallet.
At the protocol level, "change" does not exist. It's just another output (with a corresponding address), indistinguishable from normal "payment" outputs. It is your wallet that's creating it: it needs a place to send the remainder of a spent UTXO of yours that you don't actually want to transfer, so it creates a new address of its own (just like you'd do when receiving funds), and sends the remainder there. And it stays there, until there is a need to spend those funds. It could send them back to the same address, but this would be a serious privacy leak (it lets people distinguish change from payment), and have no cost advantage.

If my wallet is creating the "change address", how do I know or have assurance that I own the bitcoin that is inside the change address? All I started with was the sending address, which I know I have the private key for. The change address, however, I do not have a 2nd private key for.

You obviously have to trust the software you're using to do the right thing. Your wallet, if functioning properly, does have the private key for the change output it itself creates.

How would i then next send Bitcoin from the change address to someone, instead of from my original wallet?

Your wallet manages all the addresses, both receive addresses and change addresses, and will show you as balance the sum of all funds it can control across all of them. You don't need to care about what is in which.

What is the maximum number of change addresses that a wallet can generate?

That depends on the wallet software, but usually, practically unlimited.

Ledger Nano is the wallet.

It doesn't interact with the "original address". It's just another address in the wallet. The wallet keeps track of all of its addresses, receiving and change.

How to get a list of change addresses my "wallet keeps track of", say on a Ledger?


text:
Bitcoin Native Script Language
I am intrigued by this Bitcoin Script Language, I want to learn how to program Bitcoin with it.
Any idea where I can, find some documentation to read/practice  with ?

https://en.bitcoin.it/wiki/Script ?

Script will not be very useful if you dont know first how bitcoin work in deep, I suggest programming bitcoin, which guide you to re build the whole bitcoin software with a whole chapter for Script
free and open source here:
https://github.com/jimmysong/programmingbitcoin


text:
Developers, programmers new to bitcoin engineering ecosystem
Any sites, forums dedicated  to developers new to bitcoin.
Any recommended git repo, site that shows how to interact with a node, do .i.e. p2sh,p2pkh on testnet.


text:
how can i get back money from my electronic wallet
I am new to bitcoin and someone (the account manager) call me to buy and i made it last week. However, when i asked the account manager to transfer the money back to my credit card account. They said they have to make it to a mirror transaction first and then need to debit my credit card again. Now, i am no more money in my saving and credit card account and just saw my electronic wallet with money. How can i cash those out from it and transfer back to my credit card account? please help. In fact, i dont know how to operation my electronic wallet.

This definitely sounds like a scam.

I am new to bitcoin and someone (the account manager) call me to buy and i made it last week

Bitcoin does not have 'account managers'. There is a well-known scam though, where the scammer will message/contact you pretending to be an investor/manager/miner/etc, offering amazing returns on your investment in BTC. If someone is offering large guaranteed profits, it is almost certainly a scam.

They said they have to make it to a mirror transaction first and then need to debit my credit card again

Bitcoin does not work this way, and neither do credit cards. There is no such thing as a bitcoin 'mirror transaction'. The scammer simply wants you to send them more money. Do not send them more money.

just saw my electronic wallet with money

This is part of the scam. The bitcoin blockchain is a public record, anyone can view and verify the apparent balance of an address, but only the person with the private keys for that address actually owns those coins (ie, can spend them). "Watch-only wallets" let you track the balance of any address of your choosing. The scammer will often show their victim a "watch-only" wallet to trick the victim into thinking they own that bitcoin. They do not own that bitcoin. The scammer may not even own that bitcoin. It is a mirage.
Also, there are no fees related in obtaining private keys. That is another tactic used by the scammers (eg. "please pay us a fee so that we can activate the private key").

How can i cash those out from it and transfer back to my credit card account? please help.

Your money is likely gone. You can report the crime to the relevant authorities if you so desire.

In fact, i dont know how to operation my electronic wallet.

Bitcoin is a really interesting and revolutionary thing, but you should take some time to learn about it before you start investing in it. This question is a good place to start: I am new to Bitcoin, how can I get started?

Thank you sir. I actually stop to make payment to them but before action taken, all my active money at bank are totally cash out. poor.

@Vicky: Report the fraud to police but don't expect them to get your money back for you. Do not accept s help from anyone who says they can get your money back. Many fraudsters/thieves/conmen/criminals will contact you offering to help - but they will later pressure you into paying "recovery fees" and other fees they invent to get money out of you.

I'd report it quickly to your bank, maybe they have a chance to return something. In case you got any mails with Bitcoin addresses or transactions please advise. Some scammers really buy bitcoin because it's more difficult to run away with dollars. These bitcoin transactions can sometimes be traced until cash out at an exchange. If this is successfully the next hurdle are the involved jurisdictions.


text:
Relationship of Bitcoin address and Public Key
I am trying to understand relationship between your Public Key and bitcoin address. After reading few blogs my understanding was that after generating your Master Key pair, in HD wallet. One should not share any part of it (neither public nor private) but create child keys and use those child key pair to create address but later when reading on Atmoic Wallet came across following

Now confused: is it must to share Public Key. Isnt it privacy risk. I thought one will create unique addresses for each transaction and avoid any privacy leaks.
ps. noob in BlockChain and Bitcoin

Addresses are textually encoded public key hashes, which means that somebody in possession of only the address cannot read the public key - but eventually the public key must be revealed in order to spend the funds which are locked by an address - so it may become a privacy concern if addresses are reused, which is discouraged anyway.
With a HD wallet, we have what are known as extended public keys, which, as well as a regular secp256k1 public key, also contain a chaining code and an index, and a fingerprint of the parent key. They usually begin with xpub. These should never be publicly shared as it is not necessary for anybody to know more than the secp256k1 public key in order to verify information from the blockchain. The purpose of the extended key is to allow you to create more child keys from a given key pair.
In the case of non-hardeded extended public keys, it is possible for anybody with the xpub to create the extended child public keys, which could reveal a lot more information linking your transaction activity. These kind of keys are useful for auditing purposes as you do not need to reveal private keys, but should not be shared otherwise.
Also note that, even if you never share extended public keys and you never reuse addresses, this does not give any guarantee of privacy. It may still be possible to link your transactions if multiple inputs are used, or if you transact with KYC services which relate them to other identity documents. You should never assume that any KYC service is not sharing that information with other parties, or that they won't at some point be hacked and have all of the data dumped on the web.
In regards to the way addresses are created from public keys, this is nicely illustrated by the diagram below, taken from the bitcoin wiki


text:
‘Forgot Wallet’
Transferred BTC from Crypto dot com app to blockchain dot com wallet. Somehow managed to “forget wallet” in blockchain. Have my 12 words and tried to recover but no luck. It was mentioned to me that imported addresses are not backed up.
Any way to know if the wallet was an imported address (other than it’s not showing up). AND is there a way to recover it? Pretty unversed when it comes to this stuff so the more laymans terms the better!

If Blockchaindotcom follows the Bitcoin standard of BIP32, then the 12 words should allow you to recover your funds on any wallet. You can try downloading Bluewallet and recovering the wallet there.
You do not need to "import addresses" to access your funds, as long as you have your private keys (which are derived from the 12 words).

what meant by imported address blockchaindotcom support told me when I used private key I deleted currency probably b/c imported address- not safe from backup.
Been successful at creating new wallet ID using private key. Neither website or app will fully load- very glitchy. I have another account (completely separate) has absolutely no issues.
My question what is imported address? How would I know if that’s the location my BTC was in?
I created blockchaindotcom account and sent funds to the wallet created. I purchased/sent funds from cryptodotcom- does that mean it’s an imported address?


text:
Should I be using the "encrypt wallet" feature in Bitcoin Core?
All my wallet.dats have no password. However, the internal hard disk where the "live" one is located is encrypted, and so are the offline storage devices where I have my "cold" wallet.dat.
I have known about the feature to encrypt your wallet.dat in Bitcoin Core for a long time, but never dared to do it. It feels like I will become one of those who forgot their password, even if I store it in multiple text documents on those redundant, encrypted, offline backups. I've had text files randomly get garbled many times for seemingly no reason. And it just makes my skin crawl to think of the possibility that I will one day have a wallet.dat but not be able to ever access it!
Plus, if I encrypt the "live" one, I can say "good bye" to any automation through the RPC API, which is obviously a requirement to run a Bitcoin-accepting service.
But the cold one? I feel extremely scared of it flying through my network cable away from my control. I wish I would dare to encrypt it, but I just don't. It's too scary. I'm already more than scared enough that my backup disks will fail or that I will forget the password to decrypt those! Or that they are all seized and broken into with their quantum computers.
I've spent a ridiculous amount of time worrying and thinking about my security, especially as the Bitcoin value has increased so much. Still, it feels like I'm not at all safe enough and that it's not even possible to be secure without going to such ridiculous lengths that life becomes one long ordeal.
And I don't even own lots of BTC. I can imagine how paranoid people with like 100 or 1,000 BTC feel now...

If the computer that holds your wallet.dat file is ever connected to the internet (which it surely must be) then every second that it is turned on it is being probed by thieves attempting to break into it. If any succeed, your wallet.dat file is unprotected and will be copied and used.
If you use email or a web-browser on that same computer then every message you look at, every page you read, creates a very real additional risk that your wallet.dat will be copied and used.
You could buy a cheap letter-punch and stamp your password into a sheet of metal and store it in a very safe place. Don't store important passwords in tiny weak magnetic fields.

RedGrittyBrick: "every second that it is turned on it is being probed by thieves attempting to break into it" reads to me like utter nonsense. And even if they do (automated), it takes there being some kind of horrible remote exploit for it to actually do anything whatsoever.

@Explainer: This is based on looking at the logfiles of my computers that act as servers. I see pretty continuous attacks on any ports exposed through firewall rules and this must mean the router's external interface is continually being probed. Simple desktop machines may a lower exposure but any full-node Bitcoin application has the possibility of being contacted by other bitcoin nodes and some of those may be hostile.

If we use bitcoin in the default way then its not much secure. We experienced this hack recently.
One of our client's server get hacked but the hacker unable to transfer the bitcoins from the node, because the wallet was encrypted and the wallet passphrase/password was with client only. So encryption saved the client assets.
Few suggestions:

Always clear terminal history if encrypting btc wallet using bitcoin cli


text:
what to do if I found a fraudulent wallet?
I was scammed via bitcoin and the scammers' wallet is currently holding 98 stolen bitcoins (from several victims). the amount is unspent in the current wallet . is there anything to do? I went to the police but can I report the wallet some ware ? Write to anyone ? Find out in what exchange does the wallet sit?
This is the hash of the fraud wallet : 115906bc83bebc7511a2c497961e87e7fc3783b2ae5645e4605f9adad4571847

Does this answer your question? Can bitcoins be traced to scammers or How do I recover from a cryptocurrency scam or see other questions about tracing addresses, wallets, scammers

Looking at the transactions linked to the 36Nq2uXqCaXu5kTN3mZtRubqHiVsYbQsMN address, the smaller transactions in look like they have come from a mixing service (equal amount batch transactions). The fact the address has not sent any funds limits the inferences which can be drawn. I'd suggest waiting until there is sending activity from the address and then see what that brings out as new information to pursue the matter further.  Reporting the matter to the police is a start, just a case of watching to see what happens next.
Do not visit the site outlined in the link posted, no one can get your coins back unless the recipient wants to give them back. This is even the way it works if you report it to authorities, they try to find out who the recipient is and then make them give back the coins. The company in the link will only ask for money up front and then fail to deliver anything.

is there anything to do?

No

I went to the police but can I report the wallet [somewhere] ?

You can

Write to anyone ?

Whatever you want

Find out in what exchange does the wallet sit?

Impossible with your skills
Transaction: 115906bc83bebc7511a2c497961e87e7fc3783b2ae5645e4605f9adad4571847
Address: 36Nq2uXqCaXu5kTN3mZtRubqHiVsYbQsMN

what skills do I need to find out the exchange ? if its indeed possible ...


text:
When one miner created a new block and won the mining race, what other miner do next?
Imagine that wee have 10 indexed blockchain.
Now, I start mining for index 11 block referencing index10's hash, I mean, the last hash data. Also, other miners starts too.
When other miner finishes mining and won the race for index11 block mining, is it normal  decision for me to give up current working mining (for index11) and start mining for index 12 block referencing newly added index11 block hash?

Yes.
Once they receive a new block and find it valid, other miners will immediately stop existing work and restart with the new block as the basis for their work. Anything else would be throwing money away pointlessly.


text:
If malicious person(node) tampered withone block transaction, what's gonna happen?
I understand that if one bad person(node) tampered one block of his/her blockchain, the block hash data changed completely different.
Let's say each node has 10 indexed blockchain and index4 block has transaction data like [Alice → Bob  10BTC]. Also the block has [00000000b78qgifg20b] hash as a valid data(stars with 8 zeros).
Now, one bad person(node) tampered index4 block's transaction data [Alice → Bob 30BTC] and the hash data changed from [00000000b78qgifg20b] to [f24yoxyn28hk8hohko].
Does this mean new block is created? If so, new block with [f24yoxyn28hk8hohko] is gonna be distributed to all nodes and added to their blockchain as a new mined block?

A few things would happen:

The new block would be invalid because it doesnt start with 8 zeros
Even if the bad person managed to mine the new block all the other nodes wont accept it because all the blocks after it would be invalidated and it would no longer be the longer chain, the chain would be 4 blocks long but all the other nodes would have a 10 blocks long chain.
Even if the node managed to mine the block and also mine another 6 blocks on top of it the block would still be invalid because the transaction data (Alice → Bob 10BTC) was signed by Alice’s private key. After altering it to (Alice → Bob 30BTC) the signature is no longer valid because Alice didn’t sign it.

So what would actually happen is that all nodes that received the fake block would ban the bad node because it is sending them fake data and would never put it in their blockchain.


text:
When transactions of orphan block go back to the mempool?
Imagine there are two collision blocks A and B. These are mined at the same time.
One miner created new block C on top of block A and longest chain happened.
Do transactions of block B go back to mempool immediately after being created block C?

Imagine there are two collision blocks A and B. These are mined at the same time.

If both miners are neutral, the set of transactions in A is similar to the set of transactions in B.

One miner created new block C on top of block A and longest chain happened.

If the third miner is neutral too, it is likely that some transactions in B not in A are in C. And some in A's parent block.

Do transactions of block B go back to mempool immediately after being created block C?

See https://bitcoin.stackexchange.com/a/109920/126793, attention at what is commented there: New transactions start as UNCONFIRMED. At BlockConnected, they will transition to CONFIRMED. In case of reorg, at BlockDisconnected, they roll back to UNCONFIRMED..

What if miners are not neutral (as usually the case)?


text:
Difference between Bitcoin private key space and secp256k1 modulo
I've read online that the group order for the Bitcoin secp256k1 curve is:
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

Its decimal is:
115792089237316195423570985008687907852837564279074904382605163141518161494337

However, the modulo for the secp256k1 curve is the prime number:
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

Its decimal is:
115792089237316195423570985008687907853269984665640564039457584007908834671663

These numbers are almost identical. Since the secp256k1 curve has no subgroups, its cofactor is 1. Does that mean that by accident there are almost as many points on the curve as the modulo to compute it?
Or are these the same numbers and one is wrong?

Does that mean that by accident there are almost as many points on the curve as the modulo to compute it?

It is not an accident.
The number of points on an elliptic curve over a finite field is always close to the size of that field, by Hasse's theorem. Specifically it says that the difference between the number of points on the curve (excluding the point at infinity) and the size of the field is at most twice the square root of the field size.

Or are these the same numbers and one is wrong?

No, they are distinct.
The numbers can be computed using the following Sage code:
>>> F = GF(2**256 - 2**32 - 977) # secp256k1 field
>>> E = EllipticCurve(F, [0,7])  # secp256k1 curve
>>> F.order() + 1 - E.order()
432420386565659656852420866390673177327
>>> int(sqrt(F.order())
340282366920938463463374607431768211455

Amazing thank you! Do you have any resource for the math and the formulas you used in your sage code?

No; I know the field size (2^256-2^32-977) and the curve equal parameters ([a,b]=[0,7]) for secp256k1 by heart.


text:
I Found old wallet but there is new mined transactions but unconfirmed
the wallet is old
but transactions are new 2020
transactions type : mined
unconfirmed

What is that?????????

Those are orphaned blocks, it means while you were mining that block someone else mined it faster than you, thus you do not get the credit for those mined blocks.

He's mining 11 blocks in 17 minutes (a magnitude faster than the entire network combined). His block subsidy is completely off. I think there is far more wrong here than just some orphaning. My guess is that this is broken software, or at least not Bitcoin.


text:
Is "cryptofree.best" website a scam for mining? How does it works?
Few days ago someone introduced me website "cryptofree.best" and told me that you can collect Bitcoin in this website just by a few clicks on "Roll" button and by spending at least 1 hours/day. And tempted me that you can collect 1 BTC without spending any money in 3 months. But he pointed out that the rule of the above website is minimum 1 BTC for withdrawal. In that website if you invite an active user to the website then you will receive additional bitcoin as a reward/bonus.
He also tried to convince me by commenting that one of his friends had successfully cashed his money.
But how is that possible?  Are they misusing our smartphone/computer graphics remotely. If not why they are paying for free?

Are all website like "cryptofree.best" a scam for mining?

(I am not sure about tags. Feel free to edit.)

Definitely sounds like a scam to me. To mine 1 BTC (~10,0000 USD) requires a large investment in mining hardware at this stage. Lots and lots of scams around unfortunately. If it seems too good to be true it is extremely likely it is.

So what is the benefits of this type of scams? just increasing the website viewer?

I don't know and I don't want to spend time looking into it, sorry. Maybe you install cryptocurrency mining malware where the benefits (which are considerably less than 1 BTC but not zero) accrue to the malware authors

If you have to ask whether it's a scam, it is a scam.

I am sure 99%. And according your comments now 100%.

See https://bitcoin.stackexchange.com/q/99340/13866


text:
Is a timestamp in bitcoin different than just the "stamp of time"?
In the "References" section of Bitcoin's whitepaper, Satoshi Nakamoto points to three papers that serve as inspiration for digital timestamping.
When you read those documents it is clear that timestamping is not just a stamp of time, but "the hashed value of [data + timestamp]".
That said, in Bitcoin, is the timestamp the hashed value of the block header vs. the just time in the blockheader?
Or, am I totally off base?


text:
Lowest numbered Bitcoin hash?
I was thinking about which bitcoin block has the lowest numbered hash. What I mean by a hash as a number is that. For example, the number "1" has a lower hash than "2" in SHA256. Their values are 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b and d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35. Which bitcoin block, as of me asking, has the lowest number?
To be clear, I mean by "lowest number" as the smallest hexadecimal hash. An example of a number would be block #651520 which is numbered 0000000000000000000d1f8cf49fe57d034214693cd7f7678abec20427355c82. Interestingly, the lower the number, the more work tends to be required to generate it.
I kind of like this question because the Bitcoin network is basically an extremely large SHA256 brute force machine. This hash would likely be from after the all time high in 2017 in price.

As of October 2020, the block with the lowest hash is 000000000000000000000003681c2df35533c9578fb6aace040b0dfe0d446413.

The difficulty and the hash are unrelated (except for the fact that the difficulty is a representation of of the target, and the hash has to be below the target). It's not necessarily the case that the lowest block hash is from a block with the highest difficulty (though it may in practice be the case).

There's not really a term for working out what difficulty the block "could" have solved, sadly.

nor should there be, as it's completely irrelevant. Block hashes commit to their own difficulty, so which difficulties they can beat is fixed. The actual hash only affects whether the block is PoW-valid or not. Talking about this as a "difficulty" makes people think that lower hashes are somehow better - or ought to be better - than larger values that also beat the PoW requirement.

Right, of course it has zero application to anything at all.

Where might I find the current answer, as of 2023? Is there some public-facing web dashboard that tracks this stat? (I'm aware I could look at the blockchain itself, but I'm lazy!)


text:
How long on average would it take to discover all other nodes in Bitcoin network and connect to them? Are there technical obstacles to this?
I am wondering how long on average would it take for a node to discover all other nodes in Bitcoin network and connect to them? Are there technical obstacles to this?

how long on average would it take for a node to discover all other nodes

No normal node ever does this.
A normal node only connects directly with a very small number of other nodes (e.g. max 8 outbound, max 125 inbound) and relies on those other nodes to pass on information to the small number of nodes they are in contact with. This way information diffuses across the entire network.
Since nodes are continually appearing and disappearing any attempt to contact all nodes would be essentially endless or both incomplete and incorrect (it would include nodes that have been removed since the start of the discovery process)

discover all other nodes in Bitcoin network and connect to them

Discovery and connecting are a bit different. To discover a node that node has to have advertised itself using an addr message. I believe nodes that don't accept incoming connections (have no listening port) don't do this, so they can not be discovered unless your node listens for incoming connections and they initiate the connection.
Connecting to known nodes is simple and is what statistic tools such as bitnodes do, an I'm assuming this is what you have in mind otherwise as @RedGrittyBrick there is no point.
It could start from initial peer discovery using DNS seeders then it is a matter of making a TCP connection to each node's IP address through the port they listen on (almost always the default 8333 and 18333 for mainnet and testnet) and performing the handshake (version+verack) which doesn't take more than a second. A getaddr message could be sent to each node asking for a list of nodes they know of to construct a list and connect to each of them.
I don't think going through all reachable nodes (about 10k) would take longer than a minute.


text:
Will I save on miner and network fees for sending btc if I import my bitpay wallet to another wallet like electrum or blockchain?
I have a bitpay wallet that has received many small transactions. I want to send all of the funds to my trading platform, but the fees are too high after the first send each day which is as low as 1%. Will it help to import that wallet to another client like electrum or blockchain?

I'm not sure what you mean by "fees are too high after the first send each day". I'm not very familiar with Bitpay, are you talking about the bitcoin network fees or some fee that Bitpay is charging for each send?
If we're talking about network fees, other wallets might do a better job at fees estimation and/or control than bitpay, but it's not sure that you could easily import your bitpay wallet into another, it really depends...


text:
Get any bitcoin wallet balance without other api
I have installed bitcoind. Now I'd like get any address balance, number of ingoing transactions and amount of ingoing BTC. What is the best to do it? I didn't found way to do it using RPC bitcoin api.

It's note my question. Thank you for answering


text:
How to generate or add balance in my btc testnet address
I am trying to add btc testnet, I have read that these following sites offers testnet btc but upon checking their servers were down
https://bcoin.io/
https://bitpay.com/insight/#/ALL/mainnet/home
https://api.bitcore.io/api/BTC/testnet/
Is there any other platform or way I can add balance in my testnet address so I can try transferring and viewing transactions in test mode?

You will need to rent some hash power, or have an ASIC to mine testnet coins (unfortunately).
Regtest, on the other hand lets you run a local blockchain on your machine so you can generate new coins immediately. These can only be used on regtest, but should let you do most of the testing you need.  You can access regtest by adding regtest=1 in your bitcoin.conf file. Then you can generate coins using the console or cli with the generatetoaddress command.


text:
Can a single wallet generate (and use) both SegWit and non-SegWit addresses?
Is a Segwit wallet able to generate and use non-Segwit addresses?
I'm using Bitpay's Bitcore to create wallets and generate new addresses for the users of my platform. I'm also using Bitcore-wallet-client to sign transactions.
My users have legacy wallets right now. I intend to migrate their wallets to native Segwit, but they will also need legacy addresses so that they can receive coins from anywhere. (right?)
Is it possible to have only one wallet per user, generating both types of addresses, or will I have to manage two wallets per user?
And if I have to manage two wallets per user, utxos from one wallet won't be available to the other, obviously. What's the best way to deal with their 'split balance'? Should I orient users to send all their coins to the bc1 address of the new Segwit wallet? But then, whenever they receive funds in their legacy addresses, they'd have to transfer again to the bc1 address in order to make Segwit transactions. It makes no sense - or does it? What am I missing?

I am not familiar with the wallets generated by BitPay's Bitcore specifically, but there is no general issue preventing a wallet from generating addresses of various output formats. If BitPay's wallets can only either do one or the other that would be a local implementation quirk.
While it is possible to maintain separate wallets for each user, it is rather costly to do your accounting on-chain.
The more common mode of operations for services that take custody of user funds is to only maintain a single deposit wallet. You would then generate a new address on this "omnibus wallet" for each user deposit. Since the addresses are unique, you can use the address to tell which customer to credit in your internal accounting.
However, on the operational side, you can batch multiple withdrawals into a single transaction and even move part of the funds to a cold wallet to improve your security.

"If BitPay's wallets can only either do one or the other that would be a local implementation quirk." Yes, that was indeed the issue. Bitpay's Bitcore expects an address type as a parameter for creating new wallets. Then, it uses that value whenever you ask it to create a new address. So I just added another parameter for the createAddress flow, and there I pass the addressType. Now wallets created with this system can generate and use all types of addresses. Funnily enough, the system knows how to sign everything. I have no idea why they would tie one address type with the wallet.

Maybe they assumed that it's too confusing for users to have more than one type of address or something.


text:
CryptoCompare API gives wrong historical daily OHLC data
I am trying to use CryptoCompare to get historical daily OHLC data, but the data I get seems to be wrong. For example, the following query (timestamp=1507248000) will give you data where 'open' (66.43 USD) is less than 'low' (68.88 USD):
https://min-api.cryptocompare.com/data/histoday?fsym=MLN&tsym=USD&limit=1&aggregate=1&toTs=1507248000
Am I missing something or is CryptoCompare really unreliable?

CryptoCompare has been known to sometimes present inaccurate data in US dollars when complex conversions happen.
For instance, if during the date you queried the BTC to some other reference coin price oscillated, the Bitcoin to altcoin price may have had a low price in Satoshis but the Dollar quote to one of the coins (BTC or the reference altcoin) could've been higher at that particular moment. So the Satoshi price could've been the daily low but the Dollar price could've been a bit higher. Note that in late 2017 there were wild intraday USD price oscillations.
The 2nd data item, where you spotted the bug, happened on 10/06/2017 @ 12:00am (UTC) when Bitcoin prices were at around U$ 4324, which doesn't match anywhere close to the quote you got there. So there's some conversion going on indicated by ...
"ConversionType":{"type":"multiply" ...

...in the JSON data, which you didn't specify in your question. That applied conversion and its relation to the US dollar are the keys to fixing the bug in your program.


text:
Try to migrate Bitcoin Core wallet to an HD wallet but get "St13runtime" exception
I am trying to follow these steps to migrate my wallet to an HD wallet. But it failed, the debug log has errors like this:
EXCEPTION: St13runtime_error
DeriveNewSeed: AddKeyPubKey failed
bitcoin in AppInit()

After some quick search, I found the #issue14422 of bitcoin is related to this issue, which says the upgradewallet option does not work when the wallet is encrypted. The issue is still open and no solution is given. So how can I upgrade my wallet to the HD wallet?

The answer you linked explains how to migrate without using upgradewallet in the section "Versions of Bitcoin Core prior to 0.17`. You will need to follow those steps instead.

I am using the latest v0.18.1, is it safe to follow these pre-0.17 steps?

Yes it is safe.

I see, one more question, can I reduce the transaction fee to 0? And can I import my old BTC address to the new wallet so I can continue use it?

No, you cannot reduce the transaction fee to 0. Yes, you can import your old private keys into the new wallet to continue to use them. However this is not recommended as it is address reuse (which is not recommended for privacy reasons).

Thanks. My old address is published on the web for a while, so I want to monitor it in case of any income coming in the future.


text:
Rescuing Bitcoin (Cash, Diamond, etc...) from wallet.dat on ancient PC
I recently found an old wallet.dat file on an ancient computer running Debian GNU/Linux. The file might be as old as 2012 or 2013. These are the outputs of "lscpu" and and "lshw -short" respectively:
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       36 bits physical, 48 bits virtual
CPU(s):              2
On-line CPU(s) list: 0,1
Thread(s) per core:  1
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               23
Model name:          Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
Stepping:            10
CPU MHz:             1998.504
CPU max MHz:         2997.0000
CPU min MHz:         1998.0000
BogoMIPS:            5995.51
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            6144K
NUMA node0 CPU(s):   0,1
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm pti tpr_shadow vnmi flexpriority dtherm

H/W path               Device      Class          Description
=============================================================
                                   system         OEM
/0                                 bus            G31MX Series
/0/0                               memory         128KiB BIOS
/0/4                               processor      Intel(R) Core(TM)2
/0/4/8                             memory         32KiB L1 cache
/0/24                              memory         4GiB System Memory
/0/24/0                            memory         2GiB DIMM Synchron
/0/24/1                            memory         2GiB DIMM Synchron
/0/100                             bridge         82G33/G31/P35/P31
/0/100/1                           bridge         82G33/G31/P35/P31
/0/100/1/0                         display        GF119 [GeForce GT
/0/100/1/0.1                       multimedia     GF119 HDMI Audio C
/0/100/1b                          multimedia     NM10/ICH7 Family H
/0/100/1c                          bridge         NM10/ICH7 Family P
/0/100/1c.1                        bridge         NM10/ICH7 Family P
/0/100/1c.1/0          eth1        network        RTL8111/8168/8411
/0/100/1d                          bus            NM10/ICH7 Family U
/0/100/1d/1            usb1        bus            UHCI Host Controll
/0/100/1d.1                        bus            NM10/ICH7 Family U
/0/100/1d.1/1          usb2        bus            UHCI Host Controll
/0/100/1d.1/1/1                    input          USB Multimedia Key
/0/100/1d.2                        bus            NM10/ICH7 Family U
/0/100/1d.2/1          usb3        bus            UHCI Host Controll
/0/100/1d.3                        bus            NM10/ICH7 Family U
/0/100/1d.3/1          usb4        bus            UHCI Host Controll
/0/100/1d.3/1/1                    input          USB Optical Mouse
/0/100/1d.7                        bus            NM10/ICH7 Family U
/0/100/1d.7/1          usb5        bus            EHCI Host Controll
/0/100/1e                          bridge         82801 PCI Bridge
/0/100/1f                          bridge         82801GB/GR (ICH7 F
/0/100/1f.1                        storage        82801G (ICH7 Famil
/0/100/1f.2            scsi2       storage        NM10/ICH7 Family S
/0/100/1f.2/0.0.0      /dev/sda    disk           2TB WDC WD20EARX-0
/0/100/1f.2/0.0.0/1    /dev/sda1   volume         1855GiB EXT4 volum
/0/100/1f.2/0.0.0/2    /dev/sda2   volume         7934MiB Extended p
/0/100/1f.2/0.0.0/2/5  /dev/sda5   volume         7934MiB Linux swap
/0/100/1f.2/0.1.0      /dev/cdrom  disk           CDDVDW SH-S223Q
/0/100/1f.3                        bus            NM10/ICH7 Family S
/0/1                               system         PnP device PNP0c02
/0/2                               system         PnP device PNP0b00
/0/3                               storage        PnP device PNP0700
/0/5                               communication  PnP device PNP0501
/0/6                               printer        PnP device PNP0400
/0/7                               system         PnP device PNP0c02
/0/8                               system         PnP device PNP0c02
/0/9                               system         PnP device PNP0c01
/1                     docker0     network        Ethernet interface

I would like to rescue everything from this file including all coins that might have resulted from later forks, such as Bitcoin Cash, Bitcoin Gold, Bitcoin Diamond, etc... and I would like to do that on this ancient machine. What would be the easiest, most secure and most efficient way to achieve this? Thank you very much for your help in advance. It's highly appreciated.

If you can run Bitcoin Core on your machine, the simplest way would be to move the wallet file into your .bitcoin/wallet/ directory and try to load the wallet, either using bitcoin-cli or Bitcoin-Qt GUI. If the wallet was encrypted with a passphrase, you will need to know the passphrase.
If you need a more specific solution, I'd recommend searching here on Bitcoin Stack Exchange as this topic has been covered for a variety of scenarios.
Regarding recovering coins from forks, I'm afraid that will be specific to each fork.
As always, please exercise extreme caution and don't give the wallet.dat file to anyone, even if they are offering to help.

I would recommend to start by sending the Bitcoin to a new wallet as the vast majority of the value is in the bitcoins. Then, you’ll likely need to sync a client of each fork. You could probably short cut that a bit by syncing the bitcoin node to right before the Bcash fork height, stopping it there, and making a backup of that chainstate. Then you could use that as the starting point to sync a client of each respective client.


text:
Bitcoin JSON RPC not working on Remote IP
i cannot get it to work firstly i was able to use bitcoind in my vps (locally) but when i added rpcbind and allowip to my bitcoin.conf i cannot even use bitcoin-cli its giving me this error:
error: Authorization failed: Incorrect rpcuser or rpcpassword
while I'm using the same exact user pass as in my config
curl is giving me empty response on port "8333" and connection refused on port 8332
here is my bitcoin.conf [stripped ip and user/pass]
(i was using this one before when it was working locally)
listen=1
server=1
rpcport=8332
prune=600
maxconnections=12
maxuploadtarget=20
rpcuser=XXXXX
rpcpassword=XXXXX
daemon=1
keypool=10000

now When I'm trying to get it to work on my remote server with this config
# Generated by https://jlopp.github.io/bitcoin-core-config-generator/

# This config should be placed in following path:
# ~/.bitcoin/bitcoin.conf
server=1
# [core]
# Maintain a full transaction index, used by the getrawtransaction rpc call.
# Run in the background as a daemon and accept commands.
daemon=1
# Reduce storage requirements by only storing most recent N MiB of block. This mode is incompatible with -txindex and -rescan. WARNING: Reverting this setting requires re-downloading the entire blockchain. (default: 0 = disable pruning blocks, 1 = allow manual pruning via RPC, greater than 550 = automatically prune blocks to stay under target size in MiB).
prune=600

# [rpc]
# Accept public REST requests.
rest=1
# Bind to given address to listen for JSON-RPC connections. This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times. (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)
rpcbind=~MY REMOTE VPS PUBLIC IP~
# Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. RPC clients connect using rpcuser=<USERNAME>/rpcpassword=<PASSWORD> arguments. You can generate this value with the ./share/rpcauth/rpcauth.py script in the Bitcoin Core repository. This option can be specified multiple times.
rpcuser=XXXXXXX
rpcpassword=XXXXXXXX
# Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times.
rpcallowip=~MY HOST IP~
# Number of seconds after which an uncompleted RPC call will time out
rpcservertimeout=60

# [wallet]
# Legacy
addresstype=legacy
# Legacy
changetype=legacy
# Set key pool size to <n>. Recommended to use a large number for high volume non-HD wallets.
keypool=10000
# If paytxfee is not set, include enough fee so that transactions should confirm within <n> blocks
txconfirmtarget=3
# Broadcast transactions created by the wallet.
walletbroadcast=0
# Run a thread to flush wallet periodically.
flushwallet=0

# [Sections]
# Most options automatically apply to mainnet, testnet, and regtest networks.
# If you want to confine an option to just one network, you should add it in the relevant section.
# EXCEPTIONS: The options addnode, connect, port, bind, rpcport, rpcbind and wallet
# only apply to mainnet unless they appear in the appropriate section below.

maxconnections=12
maxuploadtarget=20

# Options only for mainnet
[main]

# Options only for testnet
[test]

# Options only for regtest
[regtest]

Try to allow RPC calls on particular IP or whitelist all IP's, for example:
rpcallowip=0.0.0.0/0

Plus try to check debug.log if the connection appeared on daemon it should report. If not, probably firewall issues on a system itself.

just for confirmation should i use my vps public ip or its local ip in rpc bind?

can you try rpcbind=0.0.0.0 & and try to not use any special characters in credentials. If that works, just add a firewall rule in order to secure the daemon.

yes firewall part worked for me turn out it was blocking port 8332 thanks :)


text:
Why does the "uptime" RPC API call fail if Bitcoin Core is running but has not synced fully?
At least this appears to be the case, because the function I have created to determine whether Bitcoin Core is "working" does the most minimal/simple API call I could find, which was "uptime", to see if my system can still communicate with Bitcoin Core (on the same computer) or if something has broken.
Since the blockchain has grown to an insane size, I was forced to move my Bitcoin "datadir" from a SSD disk to a mechanical one (due to running out of space on the former). Around the same time, I also configured Bitcoin Core to always use Tor for all connections. The combination of these two things caused the unexpected issue that my "is everything OK still?" script fails for Bitcoin Core when I start the computer after a night's sleep, because Bitcoin Core takes longer than before to get ready. Sometimes it can take like half an hour.
(This same thing also affects my polls for checking the current balance, which at least is understandable because Bitcoin Core probably doesn't want to report an outdated figure if the new data about to be fetched changes the balance.)
All it says in the manual is this: https://bitcoincore.org/en/doc/0.18.0/rpc/control/uptime/
(For some reason, there's no API docs for 0.18.1... the latest version is 0.18.)
My questions:

Is this a known issue/bug? Will it be fixed soon?
Should I be using some other API call to check if Bitcoin Core is running and "can talk to me"?
Is there a separate API call I could use to determine whether Bitcoin Core is "all ready for action" (fully synced)?

If bitcoin doing the startup, so the node is updating synchronize with the network the server is not running because it is in the startup. An example if you running the game server and it is establishing a connection with the network you can not game.

The node does not need to sync fully in order for RPC to start responding to queries.
What happens is Bitcoin Core starts up in "warm up" mode. During warm up RPC is unavailable because the system is being setup. This is when wallets, the network your local UTXO information, setting the block index and verifying your local blocks take place. (I suspect you may have confused the "Verifying blocks..." message with sync'ing.). In warmup mode RPC port 8333 is open but it'll return a JSON error for every query. The open port signals to inbound connecting peers that there's a node there, but not yet able to respond to queries.
After this warmup routine is done (takes a few minutes), the node will be up and syncing from the network. During the sync, even if it takes weeks, the RPC server is up. Obviously it will not be able to respond to queries for blocks it hasn't retrieved and verified yet.

Is this a known issue/bug? Will it be fixed soon?

Not a bug. It's part of how Bitcoin Core starts up.

Should I be using some other API call to check if Bitcoin Core is running and "can talk to me"?

Try the help command. If it returns, it means the RPC server is up.

Is there a separate API call I could use to determine whether Bitcoin Core is "all ready for action" (fully synced)?

You can try using getblockcount to see what the last synced block height is. It's fully synced if the height is same as network height. Again you don't need this to use RPC, but I included this to answer your question.
Try getrpcinfo to check on the RPC server status.
Check other API methods here.


text:
Address Reuse issue
I dont understand how security works with multiple address using. I am trying to guess how security works here but need some feedback, so here are a few questions, and my own guesses.
If I have total of 100 bitcoins and lets say I transfer 10 to a seller, how do I secure the remaining 90, by creating a new Key-Pair for me and transferring the remaining 90 to new address?
Well, how is privacy kept here then, my addresses are still linked?
So when I make another payment again I transfer the remaining funds to a new account, and this means generating and or storing new keys, how do wallets provide security then?
I guess wallet keys are never used on bitcoin transactions then, probably used to generate some key pairs and to store their private keys safely in a wallet, I guess if you transfer wallet details online to some other storage, you are still risking exposing your keys.
And lets say, you collected 10 bitcoins in 10 different transactions, should I transfer them to another account to have all them together, so I can use them in a single transaction, or when I have to transfer 10 bitcoins, shall I use them all together and execute 10 different transactions, (well makes sense that if the receiver is using a new address for this action, then s/he would know that I transferred this amount.)

You are right in noticing that the change from a transaction is linked to the previous input.
Address reuse is more for receiving payments than spending them - if you have two clients paying you, giving them separate addresses for the payments creates two completely unlinkable outputs on the chain.
Naturally, if you make a future transaction that requires the combination of both outputs, you will end up linking them. Wallets employ a variety  of heuristics to minimize such linkage, including:

Use all outputs for a given address before resorting to selecting outputs from other addresses when sending coins, even if this results in higher fees
Only use addresses for inputs to a transaction that have been previously used together in other transactions to avoid creating additional, new links between wallet addresses
Select a possibly non-optimal larger input that comes from a single address vs. selecting smaller inputs from multiple addresses

Whether you would like to consolidate your existing BTC from many addresses to a single one is up to you - I personally would not do that, and prefer to maintain as many separate addresses as possible. However, some services, such as exchanges, find it advantageous to consolidate coins for security and fee reasons, and find the loss of privacy an acceptable price for that.

Thanks for clarifications, I think of it as bank accounts and like having one master account/address, so I need to adjust thinking in terms of addresses instead of accounts.


text:
Is it profitable to mine Bitcoin on iPhone X?
I'm a newbie to mining, so in just trying to explore our. I wish to know if it's profitable to mint it on iPhone X?
What I mean by profitability is making between $1000 - $3000 monthly by mining. This should be the worth is the Bitcoin mined daily.
.
I've installed Mobile miner. Please, experts, I need your contributions.

No, this is not profitable.
Mining Bitcoin on anything except specialized ASIC machines is pointless, and you will never see any returns, especially with a phone.
Even with ASICs, profits in the range of 1000-3000 would require tens of thousands of up front investment, access to cheap power, and storage space for the machines.


text:
Not receiving Compact Block even after 'sendcompact' message
I have setup a regtest net locally with 2 nodes. One of nodes generates blocks using 'bitcoin-cli generatetoaddress 10 ', sendcompact message was sent from other node yet it gets normal block(NetMsgType::BLOCK) instead of compact block(NetMsgType::CMPCTBLOCK). As per protocol documentation, 'sendcmpct' should change btc node state to send compact block. Am I misunderstanding this flow? Kindly point to resource on how to generate compact block on regtest net setup.


text:
bitcoind service daemon
So I am running bitcoind everything is fine and the blockchain got synced etc.
Next step is to have bitcoind starting on boot.
I get this error on starting the service after creating a nano /etc/systemd/system/bitcoind.service the erro is Error: Unable to create the PID file /home/path/.bitcoin/bitcoind.pid: Permission denied
thanks in advance.

Did you change /home/path to the home directory of the user bitcoind will run under? Or do you actually have a user called path?

It look like a permission read/write error, if you are sure about the bitcoin binary you are using, then try to run your command with sudo at the begining of it or try a sudo chmod 711 /etc/systemd/system/bitcoind.service which will give the proper right to the file you want to use.


text:
What stopping miner from altering value in transaction to increase transaction fee?
I'm learning bitcoin through this book "Mastering Bitcoin, 2nd Edition by Andreas M. Antonopoulos". I'm at Chapter 6 "Transactions".
Here is my doubt:
Example there is node A, received transaction like this below
{
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18",
      "vout": 0,
      "scriptSig" : "3045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e3813[ALL] 0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf",
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.01500000,
      "scriptPubKey": "OP_DUP OP_HASH160 ab68025513c3dbd2f7b92a94e0581f5d50f654e7 OP_EQUALVERIFY OP_CHECKSIG"
    },
    {
      "value": 0.08450000,
      "scriptPubKey": "OP_DUP OP_HASH160 7f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8 OP_EQUALVERIFY OP_CHECKSIG",
    }
  ]
}

So here transaction fee is: 0.0005 ( 0.1(input) - 0.015(vout[0]) - 0.0845(vout[1]) ).
So what if node A that received this transaction altered the transaction like this:
{
      "version": 1,
      "locktime": 0,
      "vin": [
        {
          "txid": "7957a35fe64f80d234d76d83a2a8f1a0d8149a41d81de548f0a65a8a999f6f18",
          "vout": 0,
          "scriptSig" : "3045022100884d142d86652a3f47ba4746ec719bbfbd040a570b1deccbb6498c75c4ae24cb02204b9f039ff08df09cbe9f6addac960298cad530a863ea8f53982c09db8f6e3813[ALL] 0484ecc0d46f1918b30928fa0e4ed99f16a0fb4fde0735e7ade8416ab9fe423cc5412336376789d172787ec3457eee41c04f4938de5cc17b4a10fa336a8d752adf",
          "sequence": 4294967295
        }
      ],
      "vout": [
        {
          "value": 0.01500000,
          "scriptPubKey": "OP_DUP OP_HASH160 ab68025513c3dbd2f7b92a94e0581f5d50f654e7 OP_EQUALVERIFY OP_CHECKSIG"
        },
        {
          "value": 0.07450000,
          "scriptPubKey": "OP_DUP OP_HASH160 7f9b1a7fb68d60c536c2fd8aeaa53a8f3cc025a8 OP_EQUALVERIFY OP_CHECKSIG",
        }
      ]
}

Now the transaction fee is: 0.0105 ( 0.1(input) - 0.015(vout[0]) - 0.0745(vout[1]) )
What If node A after altering the transaction, able to find the nonce and submit the block to the other nodes.
Other nodes trying to validate this block will checks the UTXO set and signature by the owner found it's a valid block and accepts it to the chain.
Sender can't deny because that transaction has his signature.
In the book it's mentioned that transactions can happen in unsecured network, what if someone altered the transaction values in the middle going through this unsecured network like I mentioned above, now every node gets this altered transaction.
My Question, is this possible or there any further checks happen to ensure the transaction values are the valid ones sent by owner. So far what I learned (till Chapter 6) there is no hashing of values or whole transaction just owner signature.

The signature signs the spending transaction(*). Modifying it in any way will invalidate the signatures in it.
(*) Not actually, as it's obviously impossible for the signature to sign itself. There are also means for a signature to indicate it explicitly does not sign certain parts of the transaction, permitting those to be modified after the fact.

What parts of transaction does signature includes, can you give me a link to it and is values covered under it.

For inputs that spend legacy (pre-segwit) outputs, see https://bitcoin.stackexchange.com/q/9300/208. For segwit spends another algorithm is used, described in BIP143.

In most cases the signature covers ALL transaction fields. https://en.bitcoin.it/wiki/OP_CHECKSIG

@amaclin No. In particular, the scriptSig of the input being signed is not included. In segwit inputs, the witnesses are not included.


text:
How to access Electrum remotely via the rest api?
I am able to execute calls on the server from the server. When I say calls, I mean like this. I.e. I can get the latest addresses doing something like this:
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:7777");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"id\":\"curltext\",\"method\":\"listaddresses\"}");
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
print '<pre>';
print_r($result);

The problem is, I don't want to have to execute this on the server. I was hoping there would be a secure way to execute this remotely.
Can someone please tell me if this is possible? I tried opening port 7777, but still can't access it. Is it perhaps on purpose? As I can imagine this being a security problem.
Thanks!

I got most of my answers here.

Note that HTTP basic auth sends the username and the password unencrypted as part of the request. While using it on localhost is fine in our opinion, using it across an untrusted LAN or the Internet is not secure. Hence, you should take further measures in such cases, such as wrapping the connection in a secure tunnel. For further details, read this.

So it sounds like i'll have to build a PHP wrapper myself, or use a SSL tunnel. (Not excited at all)


text:
How to decipher Bitcoin Hex code?
I have this hex code:
0200000000010369463edb561c263f1c1cd6df5a230e62f3951893e4975b37fa710598969eb8030100000000fdffffff4af5cf12b34d9f7669a146e6ab6a981b98650931ddb90846420aa03a0b46b8230300000000fdffffff810fe5d0566b662c8a6694bbbad4429adef4b7b586bcf9808d3c6f50748c6fb70100000000fdffffff02f3ae010000000000160014766cdfc2feb62daef1e8ab92393d029e07e34611770ae10000000000160014b9686f793dfcc6ebe6e120552c7f08667a1711c80247304402200484ecf7d86e39028fa3d5ecf8275629f8d5294de8a554c79bbb953914c9edda022013b1f30577f18eb988ee6b7ec810201d34f555a5d7cb334479896d3692c467610121031f1ae8de454c0ce5a239cbef1559d5004740db4b664bd3ff0623fde49142ffd50247304402202d911869548104efcb3d9657fc82df41f99edd828fa34c62a6e3a5a6f53b0892022012946e4081250724616d424ea3c05684361d7973c86fc9417cda574d230ac2f801210288e0946ff5b1c8b4ae356203256ed7d92f07288f92b09b4a47fc22527d243ad102473044022022c894a0a2c1781a6db1043c52a90b519f6c2692aa983dc73c9bc07b514788170220375bfc525e20fd044c9da198abd88b6851fca39f74668e94047ce38c8fd30ee401210288e0946ff5b1c8b4ae356203256ed7d92f07288f92b09b4a47fc22527d243ad1f9520b00

I can easily convert it using this. But then I end up with this:
{
"addresses": [
    "bc1qwekdlsh7kck6au0g4wfrj0gzncr7x3s3tx00ms",
    "bc1qh95x77falnrwhehpyp2jclcgveapwywgwqqqzs",
    "bc1qxc9v2kyal5g3qy968u86tkk29sshg2cmtqxcv8",
    "bc1qt7hwj3633p555gvweh955uzt3c3njluh68krac"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"fees": 5678,
"hash": "21777202a03e8b9e6e7cc84b08f1b10e0b01932eddf6132c91cb6eec555c7a45",
"inputs": [
    {
        "addresses": [
            "bc1qxc9v2kyal5g3qy968u86tkk29sshg2cmtqxcv8"
        ],
        "age": 741192,
        "output_index": 1,
        "output_value": 116001,
        "prev_hash": "03b89e96980571fa375b97e4931895f3620e235adfd61c1c3f261c56db3e4669",
        "script_type": "pay-to-witness-pubkey-hash",
        "sequence": 4294967293,
        "witness": [
            "304402200484ecf7d86e39028fa3d5ecf8275629f8d5294de8a554c79bbb953914c9edda022013b1f30577f18eb988ee6b7ec810201d34f555a5d7cb334479896d3692c4676101",
            "031f1ae8de454c0ce5a239cbef1559d5004740db4b664bd3ff0623fde49142ffd5"
        ]
    },
    {
        "addresses": [
            "bc1qt7hwj3633p555gvweh955uzt3c3njluh68krac"
        ],
        "age": 742121,
        "output_index": 3,
        "output_value": 500000,
        "prev_hash": "23b8460b3aa00a424608b9dd310965981b986aabe646a169769f4db312cff54a",
        "script_type": "pay-to-witness-pubkey-hash",
        "sequence": 4294967293,
        "witness": [
            "304402202d911869548104efcb3d9657fc82df41f99edd828fa34c62a6e3a5a6f53b0892022012946e4081250724616d424ea3c05684361d7973c86fc9417cda574d230ac2f801",
            "0288e0946ff5b1c8b4ae356203256ed7d92f07288f92b09b4a47fc22527d243ad1"
        ]
    },
    {
        "addresses": [
            "bc1qt7hwj3633p555gvweh955uzt3c3njluh68krac"
        ],
        "age": 742128,
        "output_index": 1,
        "output_value": 14248279,
        "prev_hash": "b76f8c74506f3c8d80f9bc86b5b7f4de9a42d4babb94668a2c666b56d0e50f81",
        "script_type": "pay-to-witness-pubkey-hash",
        "sequence": 4294967293,
        "witness": [
            "3044022022c894a0a2c1781a6db1043c52a90b519f6c2692aa983dc73c9bc07b514788170220375bfc525e20fd044c9da198abd88b6851fca39f74668e94047ce38c8fd30ee401",
            "0288e0946ff5b1c8b4ae356203256ed7d92f07288f92b09b4a47fc22527d243ad1"
        ]
    }
],
"lock_time": 742137,
"opt_in_rbf": true,
"outputs": [
    {
        "addresses": [
            "bc1qwekdlsh7kck6au0g4wfrj0gzncr7x3s3tx00ms"
        ],
        "script": "0014766cdfc2feb62daef1e8ab92393d029e07e34611",
        "script_type": "pay-to-witness-pubkey-hash",
        "value": 110323
    },
    {
        "addresses": [
            "bc1qh95x77falnrwhehpyp2jclcgveapwywgwqqqzs"
        ],
        "script": "0014b9686f793dfcc6ebe6e120552c7f08667a1711c8",
        "script_type": "pay-to-witness-pubkey-hash",
        "value": 14748279
    }
],
"preference": "low",
"received": "2022-06-29T02:42:35.768096075Z",
"relayed_by": "52.201.241.48",
"size": 518,
"total": 14858602,
"ver": 2,
"vin_sz": 3,
"vout_sz": 2,
"vsize": 276

}
My problem is understanding this second part. I know this transaction was for 0.14248279 BTC that was sent from address = bc1qt7hwj3633p555gvweh955uzt3c3njluh68krac. But my problems are:

I don't know how to calculate it based on the information above. Is there a guide that explains how to do it? What should I search for?
The Blockchain API is returning a different value for this transaction: https://blockchain.info/rawaddr/bc1qxc9v2kyal5g3qy968u86tkk29sshg2cmtqxcv8?limit-25 (look for "21777202a03e8b9e6e7cc84b08f1b10e0b01932eddf6132c91cb6eec555c7a45" and then you should see it's result value = -116001.

What am I missing? Thanks!

Does this answer your question? What are the parts of a Bitcoin transaction in segwit format?

The thing is, that all the values are written in Satoshis (1BTC = 100.000.000Sats). The value is in this line: "value": 14748279 which is 14,748,279 Satoshis or 0.14748279 Bitcoin!


text:
How to interpret vin/vout on a Bitcoin transaction?
I used nownodes api to get this response on a transaction:
(
    [txid] => 38ac1348219f8aa9349f497bfa6f8d05f775cafbbd26354867d22ca84f15e1e1
    [version] => 2
    [vin] => Array
        (
            [0] => stdClass Object
                (
                    [txid] => 38cff250be850140644a1abf022b22f3e59cab15c6091706c3f73218a4d72050
                    [vout] => 1
                    [sequence] => 4294967295
                    [n] => 0
                    [addresses] => Array
                        (
                            [0] => 1EJtMFThodiQ1j26xy1kugFck9325C38CQ
                        )

                    [isAddress] => 1
                    [value] => 158316
                    [hex] => 4830450221009548f997389fd9881dfed78fe25fcce77f5b96d1545da91dfa13f56db3c02f6e02207fe239ac7916681edc36afd6a9a569981cd12c2c6801616bc15794be5c024431012102afe2e887e3ff56edcebe6b1aa6bf48f4a5a7f02cfc8d743e778896df2054adee
                )

        )

    [vout] => Array
        (
            [0] => stdClass Object
                (
                    [value] => 7000
                    [n] => 0
                    [hex] => a9144a09be6e2917ef00e5d72bc38035db5c5a5ed8ec87
                    [addresses] => Array
                        (
                            [0] => 38SVbkkFE8qcJuGyTJ9fY2cbGS3xknEfYr
                        )

                    [isAddress] => 1
                )

            [1] => stdClass Object
                (
                    [value] => 146856
                    [n] => 1
                    [hex] => 76a91491fb9214e6ad9b3ea19c1fd7d3a646e12f804d2688ac
                    [addresses] => Array
                        (
                            [0] => 1EJtMFThodiQ1j26xy1kugFck9325C38CQ
                        )

                    [isAddress] => 1
                )

        )

    [blockHash] => 000000000000000000050bfb2a645a5eb7ac882aeb1782bce37ef6a2652c383b
    [blockHeight] => 743696
    [confirmations] => 8
    [blockTime] => 1657005608
    [value] => 153856
    [valueIn] => 158316
    [fees] => 4460
    [hex] => 02000000015020d7a41832f7c3061709c615ab9ce5f3222b02bf1a4a64400185be50f2cf38010000006b4830450221009548f997389fd9881dfed78fe25fcce77f5b96d1545da91dfa13f56db3c02f6e02207fe239ac7916681edc36afd6a9a569981cd12c2c6801616bc15794be5c024431012102afe2e887e3ff56edcebe6b1aa6bf48f4a5a7f02cfc8d743e778896df2054adeeffffffff02581b00000000000017a9144a09be6e2917ef00e5d72bc38035db5c5a5ed8ec87a83d0200000000001976a91491fb9214e6ad9b3ea19c1fd7d3a646e12f804d2688ac00000000
)

The transaction was for: 0.0001146 BTC
And the fee was:  0.0000446
Totalling: 0.0001592

However, based on teh result from Nownodes, how can I see what the transaction total was? I can easily see the fee under "Fees". But how do I calculate the actually amount that came in or went out for this transaction?
Thanks!

But how do I calculate the actually amount that came in or went out for this transaction?

The amount in Satoshis that went out from the sender's wallet(s) is the sum of the [vin][value] amounts in that transaction.
The amount that went to recipient's wallets is the sum of the [vout][value] amounts
The difference between these two totals is the amount that was paid as a mining fee.
It is likely that one of the outputs was change being returned to the sender.  So the total reduction to the sender's "balance" is sum of [vin][value] minus one of the [vout][value].


text:
Calculating the cost to send bitcoin?
This is a follow-up post to this question.
I am using Electrum to send Bitcoin. From what I can gather, it doesn't seem like there is a way to know your "inputs" upfront. The inputs are the various addresses the different chunks of bitcoin are coming from... I think? So the inputs, as I understand, will depend on the source.
I am trying to figure out the best way to calculate the fee I can charge the client for the transaction. So my questions are:

Is there any way that I can assume 1 input for my calculations? Or find another way to get a more accurate fee calculation?
I can't have a fixed fee of, for example, 0.0005, because that will probably work fine for small amounts, but if someone sends a large amount, the fee could easily be more than this. Is there a way to know what the worst case cost could be for sending 0.01 BTC versus sending 20 000 BTC?
Is there a maximum or "worst-case" formula I could use to work out what the absolute highest a fee could be for a specific scenario?

From what I can gather, it doesn't seem like there is a way to know your "inputs" upfront. The inputs are the various addresses the different chunks of bitcoin are coming from... I think? So the inputs, as I understand, will depend on the source.

Your wallet's balance is comprised of the various 'unspent transaction outputs' (UTXOs) it controls. These UTXOs can be used as inputs for new transactions (which will create new UTXOs). Some software will allow you to manually manage your UTXOs ('coin control'), which means you can pick specific UTXOs to be used as inputs for a new transaction.
This page appears to have a walkthrough of the process when using electrum: https://bitcoinelectrum.com/how-to-spend-specific-utxos-in-electrum/ (disclaimer: I am not affiliated with that site and have not verified its legitimacy, but at a very quick glance it appears it may be helpful to you).

Is there any way that I can assume 1 input for my calculations? Or find another way to get a more accurate fee calculation?

Assuming 1-input for all your transactions will probably not work well in real life. Any transactions you send that have multiple inputs will end up with fees that are lower than intended, which will likely result in long confirmation times (or, a transaction that never confirms).
The most accurate method is to simply first determine the size of the transaction you are sending (vbytes), as well as the fee-rate you would like to send it with (sats/vbyte), and then multiply the two numbers to determine the total fee (sats).

I can't have a fixed fee of, for example, 0.0005, because that will probably work fine for small amounts, but if someone sends a large amount, the fee could easily be more than this.

This is a misunderstanding of how fees work, it does not matter what the value being sent is, only the number of bytes for the transaction.
But otherwise, in general a fixed fee is not a good solution at all.

Is there a way to know what the worst case cost could be for sending 0.01 BTC versus sending 20,000 BTC? Is there a maximum or "worst-case" formula I could use to work out what the absolute highest a fee could be for a specific scenario?

You can set the fee-rate as high as you'd like. 'Worst case' would be sending 100% of the transaction value to miner fees.

"The most accurate method is to simply first determine the size of the transaction" - How would you do this though? Because that is what I want to do. Is get the actual cost. Not an estimate. But I don't know how I would calculate the size?

@coderama choose the appropriate inputs from what you have available, create outputs, and then determine the size of the resulting transaction. The electrum software is quite capable of doing this.

Thanks! Problem is I'm not using the GUI. I am using the command line. But thanks! That will steer me on the right path I'm sure!


text:
How can I calculate the correct fees for a blockchain transaction?
How can I calculate the correct fees for a blockchain transaction? I use https://bitcoinfees.earn.com/api/v1/fees/recommended. I got hourfee - 88. How can i calculate bytes of transaction?

Corollary, the Earn.com fee estimates flatlined almost a year ago: https://twitter.com/murchandamus/status/1453367595076407298. You should use something else.

@Murch ty. so. what should i do?

You should pick a better source for feerate estimates, e.g. https://mempool.space/api/v1/fees/recommended perhaps?

For Python, may I suggest using the Mempool.space API. You can use their public API or run an instance of their software locally.
Here's is a sample code I've used in the past that should point you in the right direction.

For the most part, your wallet software should take care of all this. You should only determine how urgently you need the transaction to be confirmed and pick the feerate, the wallet would take care of the rest. The 88 you mention would likely refer to a feerate of 88 sats/vbyte here, although that sounds like a gross overestimate at the current market conditions.
If you want to manually build a transaction, you need to know a bit more.
Before you build a bitcoin transaction, you know which transaction outputs you are aiming to create. The recipients addresses tell you how much data it'll take to specify each output in the transaction. The transaction header is also mostly constant size, it's 10 bytes for non-segwit transactions and 42 weight units for segwit transactions.
The input side is a bit more complicated, as you usually do not know in advance how many inputs it'll take to fund your transaction. Your wallet may also be able to spend Unspent Transaction Outputs (UTXOs) of various output types which take different amounts of data to include in a transaction.
So, you'll either need to pick the inputs first, then determine their size and calculate the fees, or you can do both in concert, by calculating the cost for each input and deducting in from the UTXO's values before considering them for inclusion.
The actual sizes for some popular output types can be seen in this table:

I try to do it with python. So, i know only minimal fee and amount of money.

The minimal feerate for a transaction to get relayed is 1 sat/vbyte. The estimate on earn.com seems to be off by a factor of 20, so I would suggest that you don't use that.