text:
Can i buy a private key and add it to my watch-only wallet
I have a watch only wallet i was given the address for can i buy a private key and add it to the watch only wallet

This sounds like a scam. There is no guarantee that whomever gave you the watch-only wallet even has the private key for it.

Yes i am very suspicious myself

I dont think you need the private key to create a watch-only wallet

No, but you cannot access funds with a watch-only wallet; as the name says, it is only for watching. You should not assume anyone has the ability to give you access to those funds.

Pieter i totally understand that, i cannot spend or even transfer anything from a watch only wallet, that is why i was even asking if it is ever possible to changes its state from watch-only to a normal wallet that can transfer or spend its contents.

If you have the private key(s), you don't need the watch-only wallet anymore; you can just create a new wallet that has access to the funds through the private key material directly. Having the watch-only wallet to begin with doesn't help with that. But again, you should assume this is a scam (I understand you're suspicious already, but let me be 100% clear: if someone offers to sell you private keys, they are scamming you; if they had the keys they'd be taking the funds themselves).

Exactly my point, it is not going to happen.


text:
How to get UTXOs Data from the network Using python?
I want to have the Bitcoin Network UTXOs only for a data analysis project and the purpose is visualization of the time series of 1>BTC wallets . how can I do it using python ? ( or is there any easier and convenient way to reach to such data ? )

If you want to also do historical data, the UTXO set will not be sufficient since it only has the current UTXOs. You would need to parse the entire blockchain and record every time when a transaction creates or spends an output greater than 1 ₿. Could you clarify whether that’s what you’re trying to do?

I want to have a historical time series Data set of +1 BTC balance addresses ,, for example suppose that we have two columns named : Date and NumberOFAddresses ,, then for each we have for example : 8/1/2015   120 , 8/2/2016 123 , ..... 8/1/2023 10000...

In your example is 120 the number of outputs created on/before 8/1/2015 that remain unspent today? Or is it the number of UTXOs in the UTXO set on 8/1/2015? Or something else?

I mean for example in 8/1/2015 we had 120 addresses that had +1BTC balance in 8/1/2023 we have 10000 addresses ( for example ) that has +1BTC .. I want this Time Serie
@RedGrittyBrick   like this link : https://www.lookintobitcoin.com/charts/addresses-greater-than-1-btc/

As Murch suggested in a comment, you will have to process the entire blockchain, maintaining a UTXO set throughout and at each time interval, calculate address or equivalent for each UTXO, aggregate by address then output the block date and value for each address.
Block dates are not accurate and are not always in ascending order even if you manage to sort blocks by height and get them in chronological order, so you may have to apply some suitable averaging or heuristics.
Addresses are not defined for many types of locking scripts, so you may have to invent your own definition and method for many types.
There is no way, or no simple way, to determine if two addresses belong to the same wallet. Even if there were, you can't assume people only have one wallet each. So you need to be careful how you interpret and present results.
You may want to exclude provably unspendable outputs.
I would tackle this by using Bitcoin core to obtain the data, then write a program to fetch the data, either by API or by parsing the blk*.dat files. YMMV.

source: Stack Exchange

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

sort: votes


text:
How can I track my bitcoins to the blockchain?
I'm sorry if this is a stupid question; I'm just trying to learn more about Bitcoin and the blockchain.   How would I identify the bitcoins that are mine within the blockchain?    I can use Trezor to see my balance, but how would I find those coins within the blockchain without a 3rd party solution like Trezor?   I have used Blockchain Explorer but I used my transaction number or wallet address to find my coin balance. What if you don't have the transaction numbers or wallet address

how would I find those coins within the blockchain without a [wallet]

One way would be to write down a list of addresses that your wallet reports as having a balance.
You can then enter those addresses into any one of the many "blockchain explorer" websites, the website will show you the balance for that address.

What if you don't have the transaction numbers or wallet address

There's generally no way to check the balance outside a wallet unless you have those pieces of information.
The Bitcoin blockchain does not contain any information about people or wallets. The blockchain is simply a list of transactions. For most standard types of transactions you can calculate addresses from the data in a transaction.
Addresses are just a number and are not like postal addresses or network addresses.

Use your public address (like an account number) associated with your wallet.
Search for your address on a block explorer (like blockchain.com).
See your transaction history and balance.
Each transaction has a unique ID (TXID) for tracking.
Remember, private keys control ownership and transactions.

Understanding this helps you monitor your bitcoin activity and verify your funds on the blockchain. If I misunderstood your question, please point out

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


text:
Satoshi Bitcoin account profile
i tried to withdraw from my Satoshi mining account but, A noticed that the Bitcoin is prohibited in my country or region (Nigeria)?

Bitcoin mining requires expensive specialised equipment, anything that suggests you can mine with a PC or a phone is a scam.

I disagree with you. Everything can actually perform multiple SHA256d(). It will certainly not be productive but don't say that anything suggests you can mine with a PC or a smartphone is a scam...

@Loopite: You will pay magnitudes more in electricity than what you earn, and your devices will wear from the constant computations. RedGrittyBrick is right to categorize that sort of narrative as a red flag for a scam.

Hi Thomas, we don’t have any special insight into some company’s inner workings. If you think there is a legitimate customer support issue here, you need to take it up with them, but please also consider whether this might not be a legitimate business at all, since mining requires special hardware to be profitable and doesn’t just produce significant revenue for end users.


text:
Are the keys in a multisig transaction output hashed?
Pay to public key hash scripts hash the recipients public key for added security.
Is the same done with the public keys that make up part of a multisig script?
https://en.bitcoin.it/wiki/Script doesn't seem to indicate they are.

Yes and no.
In a bare multisig pubkey script, the public keys are not hashed.  For example, a 2-of-3 pubkey script would look like:
2 <pubkey1> <pubkey2> <pubkey3> 3 OP_CHECKMULTISIG

In a multisig pay-to-script-hash (P2SH) script, the whole redeem script---including the public keys---would be hashed.  For example, the redeem script would be the same as above, but the actual pubkey script would be:
OP_HASH160 <Hash160(redeemScript)> OP_EQUAL

Almost all multisig transactions on the network currently use P2SH multisig.
As an aside, although there is some hypothetical security increase from hashing public keys in case of a major problem with ECDSA, the main reason for hashing public keys is to create short addresses.

This is very useful, thanks. Just for clarification, with P2SH, the public keys within the redeemScript will only be public keys, not public key hashes if it is a multi-sig script? Is there no way to do multi-sig without exposing unhashed public keys at some point?

Correct.  Also, there's no way to do any transaction secured with public key crypto without exposing the unhashed public keys at some point.  In regular P2PKH, you reveal the unhashed keys in the signature script---the same as you do with P2SH.  Also noteworthy: your public key can be reconstructed from your ECDSA signature in the signature script, although Bitcoin doesn't currently use this for anything.

Typically, you will use P2SH (pay to script hash) for multisig transactions, which means the transaction output does not contain the full script (with full public keys), but instead a hash of that script - and the full script is revealed when spending. See BIP16 for more information.
When this is done, you get the same effect: the transaction output does not contain a public key directly.
Note that there is indeed a  small security benefit to this (it takes 2^160 steps in theory to reverse the hash function, while it takes 2^128 steps to find a private key for a given public key), but there are larger advantages (like the sender not needing to know the full script, and less data in the database of unspent transaction outputs that every full node maintains).

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


text:
Listening Node behind CG-NAT
My router is behind a CG-NAT protocol.
I suspect this given my WAN IP and my public IP are different.
This prevents me from running a full listening node given that my public IP is not uniquely identifying me.
As a result exposing port 8333 on router does not permit inbound node connections.
Hence I can run a fully validating node but cannot run a listening node as I am unable to receive incoming requests.
Bitcoin Core v22.0.0 - 70016/Satoshi:22.0.0/
        ipv4    ipv6   onion   total   block
in         0       0       0       0
out       10       0       0      10       2
total     10       0       0      10

I find being a leech deeply unsatisfying.
To address this I tried using a cloudflare tunnel to expose the server running my btc node.
cloudflared config below:
tunnel: <my_tunnel_id_string>
credentials-file: /home/me/.cloudflared/<my_tunnel_id_string>.json
ingress:
  - hostname: dashboard.<my_domain>.online
    service: http://192.168.20.16:8333

  - service: http_status:404

warp-routing:
    enabled: true

The cloudflare tunnel is working successfully.
I am able to expose a nextcloud instance on port 80 for example, but I still cannot get my node to accept inbound connections.
This problem is driving me mad.
Help appreciated.

Many thanks for suggestions.
Got node running over tor and now able to successfully make inbound connections.
Followed below links for setup:
stackexchange and wiki


text:
Tor: inbound self-connection
I set up my bitcoind to run on tor network.
When I list peers, I get 8 outbound connections and 4 inbound, which all have
"addr": "127.0.0.1:46310",
"addrlocal": "****.onion:8333",

where the addrlocal addres is mine listening address.
Why are there inbound connections to myself?

When your node has an inbound connection via the Tor network, the addr field of the getpeerinfo command shows the local port to which your local socket for the connection is bound. It does not show you any information about the host which requested the connection, nor does it show you information about any Tor relay to which your node happens to be connected. As you rightly point out, the addrlocal field is your onion address (and port).
When the same node has an inbound connection via the ipv4 network (which is possible even for a Tor node provided it is properly configured) then the addr field does show you the ip address (and port) of the requesting host, and there is no addrlocal field.
So what appears to be "inbound connections to yourself" are simply inbound connections (from external hosts, not yourself) via the Tor network as opposed to the ipv4 network.

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


text:
Construction of unowallet url
I just tried to use unowallet.
It seem that the private key is somehow encoded into the url.
Isn't it some known type of representation?
Wouldn't it be possible to create an url for my private key?
Or maybe its just the seed of the bitcoin address generator.
My only observation is that it is not a base58 because there are 'l' and 'O's, it may not be base64 because it does have bad number of characters (but maybe '=' are ommited).
e.g:
URL: https://uno-wallet.com/wallet/WXG7M59EniYuAm39ildMv7lUDc2L5khVLDpMPic2dOo1mJDiLJ
Address: 1BjECXazZUZdd8zAj7VoxppoBA73aZ1KrX
Private key: 5JWXyvz2DcEKQFm7pa6j8Gp1M5A8cgNhx4F2ZjM2R14MHy3D2NQ

Hidden feature of unowallet
https://uno-wallet.com/key/5JWXyvz2DcEKQFm7pa6j8Gp1M5A8cgNhx4F2ZjM2R14MHy3D2NQ
gives you access to your wallet with the private key after "key/" in the URL.
This can be used for any private key, not just the ones used on unowallet.

It's probably hashed. Any URL is valid.
https://uno-wallet.com/wallet/0


text:
Multiple coins after currency fork
Situation: bitcoin hardforks and I got payment with coins, that were in the blockchain before fork:
what can prevent me for sending the same transaction to the other forked network and get the second forked money, because I have a signed sending transaction and I own the target address private keys.

Nothing prevents you from doing such.  You now own coins on both chains, and can spend them independently. Assuming that adequate replay protection has been implemented, you shouldn't have to worry about your transaction on one network being broadcast without your consent on the other.


text:
How can I send bitcoin to an address without a third party app?
Let's say I've generated a pub-priv key pair using ssh-keygen and loaded cash into it using an ATM. I've avoided using third parties thus far, so how can I continue this with sending bitcoin to a given public address?

ssh-keygen, as far as I know, does not support the secp256k1 curve that Bitcoin uses.

@PieterWuille sorry, openssl :)

What makes OpenSSL not a third-party app in a way that a Bitcoin wallet is?

@user144264 how do you know the ATM sent you anything at all?

You might want to use client library directly. Or make your own client.

Bitcoin could be sent using software like Bitcoin Core, Electrum, Sparrow and a private key imported into it (in a particular format e.g. WIF which is not supported by OpenSSL).


text:
Coldcard sparrow
I experienced what the user on Reddit here experienced. Any idea why this happens ?
https://www.reddit.com/r/coldcard/comments/17epqk8/040_bitcoin_taken_instantly_from_my_coldcard/
Doesn’t look like the seed was shared as it’s a new wallet so what is this mechanism in coldcard. How would the user send his bitcoin if they experience this?

Could you please summarize what happened to you? We prefer when questions are self-contained on this site, so it remains understandable in case the linked resource is deleted. You can of course link to the other user’s experience for additional context.—Could you please clarify whether your funds got stolen, or all of your funds got moved to another address that you also control?

So after receiving the coins I’ve noticed electrum creates a new address and puts my coins there for privacy. It’s unclear how to use the UI to send coins now

If you received coins and they immediately got moved to some other address, I’m afraid that sounds like malware

The security of your coins relies on having being able to produce a random number within a large range of possible numbers. A large range is required so that it is infeasible for someone to search the entire space of all private keys, and so that it is extremely unlikely (basically impossible) for someone to produce the same key that you did. Randomness is required to ensure that the random number you picked cannot be guessed.
When you use only one or very few dice rolls, while you may have pretty good randomness, the range of numbers you can produce is not large enough. Thus if someone wanted to take your coins, they can just pre-generate all of the keys in that range (by iterating all possible numbers) and watch for any coins to be sent to them. That is presumably what happened to this person on Reddit.

This has happened to me as well and I did all the dice rolls. Good news is if I put my xpub key online , it does show the change address part of the same public key

If you want to provide more context to your question, please edit your question post instead of commenting.

@Murch it appears programs like electrum create a new receiving address and put your coins there for privacy

This throws the ledger off to a normal user trying to monitor his or her balances


text:
Node Operators Reward
Why don't we implement a Node Operator reward program (in the core) or if such implementation ever existed what would be the overall (Downside,Cause for concern, etc)
Why don't we use the Miner Fee Reward to pay the Nodes for instance? Without talking about the overall economic implication but more the technical side of things.


text:
Offline payments with Android wallet
This Android application for Bitcoin wallet, claims offline payment as a feature. It says,

When you're offline, you can still pay via Bluetooth.

A payment is concluded only when the transaction is broadcast to the network and confirmations are made for the transaction in a certain block as mined. So, how does one "pay" via Bluetooth?

You can simply send the signed transaction to the other entity (e.g. via Bluetooth) who then can send it to the Bitcoin network. The transaction doesn't need to be sent to the Bitcoin network by you, it just needs to somehow get to a miner to be included in a block. Even if you print it out, send someone a letter via snail mail, they type it in, and send it to the Bitcoin network, it'll still work.

So, the transaction can be broadcast either by sender or receiver of a transaction? Is this because receiver can't spoof the transaction as the private keys are secure with the sender?

It can be broadcast by anyone who by any means got hold of it. Some people seem to have the notion that a transaction is something that's secretly transmitted through the network. It's not. Everyone can read it once it's broadcast. A transaction doesn't say: "Here is my password, please send those funds I have access to with this password to those addresses and be so kind to not send them to yourself." That wouldn't work. People would steel your money. Instead – through the magic of cryptography – a transaction only allows with your funds to happen, exactly what you specified in it.

I know that, the transaction is not transmitted securely. I was referring to fact that, a transaction can be created by the owner of the private keys only; it is a different matter how the ownership was gained (genuine, malevolent, etc.).

Consider this scenario. Suppose the transaction is persisted on both the sender's and receiver's devices. Once the transaction is sent to the receiver device via Bluetooth, then it is possible that both the sender and receiver come online at different times without the other party's knowledge. I would think that, the later transaction would be rejected because that would mean double spending of UTXO. Correct?

Yes, that's correct. Well, kind of. It would be rejected but 2 times the same transaction doesn't mean double spending.

Thanks! One last thing. Could you please elaborate this, "2 times the same transaction doesn't mean double spending"?

Every full node typically has several peers. Transactions go around the network and after validating one, a node sends the transaction to its peers it didn't receive the transaction from, except if it already sent this transaction to them in the past. This is necessary because otherwise, a single transaction would clog the entire network as it would multiply until it existed trillions of times. Therefore, if you send one a second time, it's just ignored.


text:
Non-transfer to my coinbase wallet due to low priority
I'm just beginning my journey into crypto currencies and its ecosystem. Right now, I received the message below from Coinbase (coinbase@wallet-cb.support) informing me of a non-transfer to my coinbase wallet due to low priority. Does this seem normal to you? Thank you for your feedback and your help in resolving the situation.
"The transfer you made to purchase BNB was not received by the system because my transaction is stored in mempool awaiting validation. Right now your transaction has a very low priority, that's why Mempool is asking you to make a transfer of the same value so that the block increase can be done, and your transfer arrives immediately. Otherwise, we don't know how long it will take to complete your process."

Does this answer your question? Is it normal to be asked for an advance fee on a withdrawal? What you describe looks like a clear scam. The email address is obviously not coinbase.


text:
Got sendrawtransaction RPC error: {"code":-26,"message":"non-final"} when broadcast to https://blockstream.info/testnet
I am trying to broadcast this transaction and got this error :
Got sendrawtransaction RPC error: {"code":-26,"message":"non-final"}

What does this error message mean?
FYI this is the transaction I wanted to broadcast, thank you for your support !
020000000001015113867e2fd1243c28fbb148d2032920f96c5803f1c7af468fe332a1d7a1c5210000000000feffffff01e806000000000000160014b9514f31d8d06dd5782988d15f4bc762cf862dad014065f1e4f5ebe884cf006c985de2628fb1afec3ce30d869e66e6a5aabd272dec9a20dc51a79de2115e0f4bb9edf6843f56f12ca07bd63cfa0585943ecb264e1c98b493e566

If you built a psbt, did you sign your psbt with your private key?

I am building a taproot transaction that pays to a p2tr address, and it is a key path spend. It only has 1 input and I already created a valid signature for that

Your transaction has a locktime of 1726321588 which means it can only be broadcasted AFTER Sat Sep 14 2024 13:46:28 GMT+0000
$ hal tx decode 020000000001015113867e2fd1243c28fbb148d2032920f96c5803f1c7af468fe332a1d7a1c5210000000000feffffff01e806000000000000160014b9514f31d8d06dd5782988d15f4bc762cf862dad014065f1e4f5ebe884cf006c985de2628fb1afec3ce30d869e66e6a5aabd272dec9a20dc51a79de2115e0f4bb9edf6843f56f12ca07bd63cfa0585943ecb264e1c98b493e566
{
  "txid": "01a2c61803936ae58ec4f06e07bc25355db8484b9dde0fd82c9bfcb444878256",
  "wtxid": "c463a7c71c0aaf1dd583155caf47f702fd75f8a4b2922b3eb57c71a93019de2b",
  "size": 150,
  "weight": 396,
  "vsize": 99,
  "version": 2,
  "locktime": 1726321588, // HERE
  "inputs": [
    {
      "prevout": "21c5a1d7a132e38f46afc7f103586cf9202903d248b1fb283c24d12f7e861351:0",
      "txid": "21c5a1d7a132e38f46afc7f103586cf9202903d248b1fb283c24d12f7e861351",
      "vout": 0,
      "script_sig": {
        "hex": "",
        "asm": ""
      },
      "sequence": 4294967294,
      "witness": [
        "65f1e4f5ebe884cf006c985de2628fb1afec3ce30d869e66e6a5aabd272dec9a20dc51a79de2115e0f4bb9edf6843f56f12ca07bd63cfa0585943ecb264e1c98"
      ]
    }
  ],
  "outputs": [
    {
      "value": 1768,
      "script_pub_key": {
        "hex": "0014b9514f31d8d06dd5782988d15f4bc762cf862dad",
        "asm": "OP_0 OP_PUSHBYTES_20 b9514f31d8d06dd5782988d15f4bc762cf862dad",
        "type": "p2wpkh",
        "address": "bc1qh9g57vwc6pka27pf3rg47j78vt8cvtdd4p69xk"
      }
    }
  ],
  "total_output_value": 1768
}

Thank you for your answer!


text:
importing WIF key
HI I have not saved my 12 words seed phrase of Unisat wallet but I have the WIF key of my wallet. Can I still access my wallet? or is there any wallet available which have an option of importing wallet with WIF key. and I don't have bitcoin core. I have tried researching online but could not find anything on this topic

My suggestion to you is to use this cryptofuzz in Python and convert WiF Key to mnemonics:
install cryptofuzz : pip install cryptofuzz or pip3 install cryptofuzz
from cryptofuzz import Convertor
cv = Convertor()
WIF_STR = "ENTER_YOUR_WIF_KEY"
mnemonic_str = cv.wif_to_mne(WIF_STR)
print(mnemonic_str)

Please disclose self-promotion.


text:
Bought bitcoins in 2014/2015 thru a website similar to Facebook
In 2014/2015 there was a website similar to Facebook we posted articles on and communicated on, but different that mainly many Eastern Indians used where we traded bitcoins using Bitzfunda, Payza or a company to buy through to trade with one another. I purchased quite a few times when I got paid. The website no longer was in use in 2017 when I went back to post and find where our big coins were placed. I never thought the website would vanish. It just disappeared.
Cher’ie Walker


text:
How can I recover bitcoin core wallet after encryption with password?
I have backup of wallet.dat file before I encrypted it with password. I also do know the password. I deleted my server and all thing has gone but I have back up of wallet.dat file in computer. I send some bitcoin after I encrypted the wallet. Now when I reload it it shows old addresses before encryption but not the address I sent bitcoin after I encrypted with password.
How can I recover my state of my wallet.dat file after encryption if I have:

wallet.dat file before encryption with password
password which I used to encrypt the wallet with

When you create an encrypted wallet from an unencrypted wallet, Bitcoin Core will create a fresh random seed for the encrypted wallet. It is essentially the same as creating a new wallet. This is not a deterministic process and therefore cannot be repeated by knowing the password and having the prior unencrypted wallet. If you do not have a backup of the new encrypted wallet, I’m afraid you will be unable to recover your funds.

Hi, thanks for replying. The wallet is younger and used around 2019. So, that means, I can just sync and used my old password to encrypt again with same wallet.dat file to get my money back. I can use any device for that as well?

I’m sorry, somehow I got on the wrong track when I wrote my first answer. I’m afraid that at second glance it doesn’t look promising.

Thanks! That is what I was afraid of. If that is the case then I should not bother to synchronise and use it because it will never create same wallets even if encrypted with same password used. Bad luck!


text:
bitcoin-cli getrawtransaction not working as expected?
So I'm trying to set up a full bitcoin node. I compiled bitcoin core fine and I created a config file. I want to download the entire history of the blockchain, so I created a bitcoin.conf file in my ./bitcoin folder (the folder that I cloned from github). My file originally looked like:
txindex=1
prune=9
maxconnections=15
dbcache=150
maxmempool=150
maxreceivebuffer=2500
maxsendbuffer=500

Then I ran bitcoind -daemon but realized that when I was running bitcoin-cli getrawtransaction 32892hf9nvh9832948294383 (fake tx number) that it was returning an error saying that there is no such mempool transaction. I realized my mistake was putting prune in my bitcoin.conf file. So I removed that line so that my file now looks like:
txindex=1
maxconnections=15
dbcache=150
maxmempool=150
maxreceivebuffer=2500
maxsendbuffer=500

Then I ran bitcoin-cli stop, then ran bitcoind -daemon -reindex. I thought this would be fine, but I'm still getting that no mempool transaction error when I try looking at that same transaction - and I verified that the process of download the blockchain has already moved past that transaction date because I ran bitcoin-cli getblockchaininfo and I looked at the time key.
Do I have to wait for the entire blockchain to be downloaded before I run these commands? I'd like to know before I waste a bunch of time doing this the wrong way.
I appreciate your help - thanks!

I realized I misinterpreted your question, focusing on the error message rather than what you're doing. Normally, the getrawtransaction <txid> RPC only works for mempool transactions, but with txindex enabled it should work for confirmed transactions too. My guess is that perhaps the txindex hasn't caught up with synchronization so it's giving that error still, but I'm not entirely sure what's going on.

@PieterWuille as long as my config file is looking fine then I'm willing to wait it out and see if it works.


text:
Why are scams allowed
Ok so we know Bitcoin bonus is a scam Why is it allowed to exist I almost fell for it and spent hours trying to figure out what I was supposed to be doing downloading wallet apps and dock apps basically just wasting my time but isn't there some sort of cyber police to stop these crooks because it looks pretty enticing to someone that doesn't know any better and they are out $64 that's BS and nobody does a thing about it pathetic what if that was your mom that fell for it what would you say then

Why is it allowed by who? Who do you think can make such scams cease existing merely by not allowing them?

Why does crime exist?

Bitcoin bonus is a scam Why is it allowed to exist

The businesses that provide domain-name registration don't know whether you are registering dollarbonus.com with the aim of providing an honest service or a dishonest one. So long as you pay them they don't care. They may take action if they receive a large number of complaints about a customer's domain they have registered, or about a customer's website hosted on a hosting service they provide.
The US Bureau of Engraving and Printing are responsible for printing dollar bills (banknotes) but they are not consulted by a domain registry in, say, Myanmar, when a business there registers a domain name that includes the word dollar. Furthermore, the US Bureau of Engraving and Printing is not responsible for checking the motives or honesty of businesses in, for example, Myanmar.
I doubt the US Bureau of Engraving and Printing was asked for approval when the car-rental business registered the domain name dollar.com and set up their website. It simply isn't their purpose.
There are many countries that use the word dollar for their different currencies - US dollars, Canadian dollars, Singapore dollar, Caribbean dollar, etc. It would be impractical to consult all the responsible government agencies every time someone tried to use the word dollar as part of a business name or trading name. None of the national agencies responsible for printing various dollars would be interested in vetting such use of the name worldwide.
Bitcoin is essentially a set of ideas that have been made public and an early reference implementation of those ideas that has been used by many different people to make software products. There is no organisation or person in charge of Bitcoin. There is no Bitcoin organisation to check up whether someone in a small town in Ecuador is doing something dishonest using the word bitcoin. Nor is it at all practical for ordinary people like you and I to create such an organisation - it would have insufficient resources to scrutinise the daily activities of 8 billion people and no power to do anything about a suspicious activity the other side of the planet.
A person in France or Japan who occasionally publishes an improvement to one of many Bitcoin wallet projects has no authority over criminals in Myanmar or Ecuador. No more than you do.
Even if you persuaded the domain name registars to ban all use of the word Bitcoin in domain names, criminals would just register  domain names like cryptobonus.com instead and use those to trick people out of money.

Cyber Police

isn't there some sort of cyber police to stop these crooks

Your local police service are likely to have a cybercrime officer or department. Mine do.

Responsibility

nobody does a thing about it pathetic

Combatting crime is primarily the responsibility of your local police.
In a sufficiently civilised society you will be able to ask a local police commissioner what they are doing about cyvbercrime. You would be able to vote in a commissioner who commits to the specific actions you feel are necessary.
Legislating to prevent such crime is primarily the responsibility of your local legislative branch of your national government. In a sufficiently civilised society you will be able to ask your local representative what they are doing about cybercrime, you will be able to vote for a representative who commits to some specific legislative action.
Just as the US Bureau of Engraving and Printing cannot prevent you handing over dollar bills to a con-man on a street corner, the developers of, for example, Bread-wallet cannot prevent you using that wallet to pay someone dishonest.
Taking care when giving cash to strangers is primarily your responsibility. Whether the cash is paper cash or electronic cash.


text:
what does it mean
In order to receive funds right now and not report on receipt in the supervisory authority , it is necessary to make a transfer to the cadastre of gratuitous rewards. This procedure is mandatory to receive the entire amount of payment.

Can you clarify what your question is? What is this about?

Sounds like a scam.


text:
What files/code should I look for iOS Coinbase Wallet Seed Phrase?
I never wrote down my seed phrase for Coinbase wallet and used FaceId to Login for months. One day the app did an update which forced me off the app and prompted me for the seed phrase to login.
I have had a forensics data company extract my phone data and I have cellbrite software to search the files. What should I be looking for? What language? Do I need to convert it?
Thanks

TL;DR:
You need that "seed phrase". Without it, your money is gone. You won't find the seed phrase in your phone.

Coinbase claim this is a non-custodial wallet. If it works like others, the seed phrase (also known as a recovery phrase or backup phrase) is not stored on your IOS device and cannot be recoverd from it.
Coinbase's support pages say

If you no longer have access to your recovery phrase, you will need to create a new account.
Please note: Coinbase Wallet is a user-controlled, non-custodial product. The recovery phrase is what gives you, and only you, access to move funds that you have received.
For your security, Coinbase Wallet will never have access to this seed, meaning that we are unable to move funds on your behalf.

If they have done their job properly, nobody with access to your phone can get access to your money without knowing the recovery phrase (or PIN). That would include you.

Another Coinbase support page says

Coinbase Wallet generates a 12-word recovery phrase, also referred to as a seed phrase, that you and only you have access to. This means that if you lose your recovery phrase, you will lose access to your Coinbase Wallet. Please keep in mind that Coinbase will never have access to this recovery phrase, so we cannot move funds on your behalf or help you access your digital assets.
Back up your wallet
As an added safeguard, we built an encrypted Google Drive and iCloud feature so you can back up your recovery phrase. We strongly encourage you to back up your recovery phrase using this feature, as well as writing it down and storing it in a secure location. To access the backup feature, tap Settings then Recovery Phrase from your Coinbase Wallet app.
[...]
Note that if you sign out of your Coinbase Wallet mobile app you will be prompted to acknowledge that signing out without your recovery phrase being backed up may result in permanent loss of access.

(my emphasis)


text:
Access BTC balance using xpub key
I am using the exodus wallet and I exported the xpub key because I used it for a shop to receive payments using btc. Someone bought my product and sent btc to a address generated with my xpub key but its not showing up in my exodus wallet.
How can I access that btc?(I have access to the private key and the seed phrase)
Thanks in advance!

Exodus Desktop exports three extended public keys as far as I know. The first xpub belongs to your Legacy account at m/44'/0'/0', the second zpub to your Native Segwit account at m/84'/0'/0' and the third and final zpub to your Taproot account at m/86'/0'/0'.
Depending on which of these extended keys your customer used, your bitcoin may be at "different locations" in your wallet. For more information about this, see this guide on derivation paths. No reason to worry, if your customer did indeed correctly use one of your extended public keys, you will be able to recover everything.

If the customer used the first xpub, his wallet probably derived Legacy addresses from it. You should be able to see balance on those addresses in Exodus after you enabled advanced wallet mode in the settings and toggled Legacy Address on the right when viewing your bitcoin balance.

They probably didn't use the second zpub, since that most likely wouldn't have caused any issues.

If they used the third zpub things may get a little more complicated. It's quite unlikely that the wallet software of your customer used this key to derive Taproot addresses and the bitcoin would now be sitting on Native Segwit addresses, but using the wrong path at m/86'/0'/0'.

The latter and other similar scenarios (such as Legacy addresses on m/84'/0'/0' or Native Segwit addresses on m/44'/0'/0') can be recovered by manually deriving to the "wrong" path using the according script type. This can be easily done with Sparrow Wallet by disabling validate derivations in the settings, choosing the script type and changing the derivation path manually. Please only use these obscure accounts for recovery and not for actual usage in the future.
There is of course also the possibility that the customer scammed/tricked you into using an address that doesn't even belong to you. I just wanted to mention this but you probably know the circumstances better than I do.
I would generally recommend not to use extended public keys like this and instead always generate addresses yourself. That way you can verify the correct script type/path is used and verify the address belongs to you in the first place. There is also a privacy concern involved when you reveal your extended public key, since anyone knowing it can derive all addresses of the account in question, thus being able to see your total balance and transactions.

When you use xpub to generate address to receive funds, instead of using receive function wallet this happens. This is because the wallet hasn't looked ahead enough to discover the funds.
A simple fix for this is to force the wallet to discover / scan for funds. Here is a detailed guide to force rescanning for funds on exodus wallet.


text:
New Node User Opening Channels Through Zap
I recently set up my first node and connected through Zap. I currently have one channel open which is funded on my local side and on the remote side for a small amount. I was told that my node is not public and I cannot find it on 1ml. Does anyone know what I need to fix this?
I used the Strike app to create the remote funding by sending my Strike account some BTC from Zap. Ideally I would like to have a channel with about $500 capacity with the end goal of using Strike to buy BTC. To do this would I send $1000 of BTC to my Zap wallet, fund the channel on the local side with $500 worth, then send the other $500 worth to my Strike account - creating $500 local and remote funding on that channel?
An additional question I have: How do I set up a smaller channel that is fully public and will see activity so I can participate in the network and earn lightning fees?
Appreciate any help.


text:
Sign transaction externally
I create a transaction with inputs from a given address / public key without signatures. Every input needs to be signed. I use a different method to generate the signatures so I can't provide a private key to sign the transaction.
Much like the blockcypher API I want to extract a list of strings (called "tosigns" in blockcypher API), sign them externally and combine them with the partial transaction I generated before.
Question 1: What field(s) do I have to take out of the bitcoin transaction json and how do they need to be processed to receive a string (or list of strings for multiple inputs) that just needs to be signed?
Question 2: How do I intergrate the generated signatures with the transaction object to receive a valid, signed transaction, that can be send to the network.
Any JS libraries that help with it are appreciated.


text:
How to get my 24 word seed using bitcoin-cli
I've tried:
bitcoin-cli sethdseed 'word1 word2 ...'
but i got invalid private key.
please help me getting my 24 word seed using bitcoin core

How to get my 24 word seed using bitcoin-cli

You write about getting but your commands are about setting. This is confusing.
You can't get a seed-phrase from Bitcoin-core.
You can use the sethdseed function to "Set or generate a new HD wallet seed." this marks any existing private keys as inactive (which may or may not be what you want).
Note that an HD seed and a (24 word) seed phrase are different things.

I've tried: bitcoin-cli sethdseed 'word1 word2 ...' but i got invalid private key.

I think that may be because the second argument is not a seed phrase but a WIF key.

"seed"               (string, optional) The WIF private key to use as the new HD seed;

Related questions with useful answers (assuming you're trying to get seed-words out of Bitcoin Core because you think thats whats needed to transfer to another wallet that uses them)

How can I transfer a Bitcoin-qt wallet to Electrum?
How To Transfer Coins From Bitcoin Core to Electrum to avoid Sync Process?
Having trouble transfering private keys from Bitcoin Core to Electrum, for want of not having to wait for sync

Sorry Asking dumb questions but how can i convert my hdseed to a mnemonic phrase.

@Erfan. There's no need. Instead people changing from Bitcoin core to another wallet usually export the private key and tell the new wallet to sweep the key.

You can't.
Bitcoin Core is not BIP39 compliant.

To note, this is not a bad thing. Bitcoin Core is also not compliant with regulations on PPE, but that doesn't not taint it as a software product.

One still get and store the hd seed key of a wallet in it's WIF encoding. Use dumpwallet and then check the file for hdseed=1.


text:
Is Bitcoin completely Open-Source?
I am newbie in this area.
As I understand, Bitcoin was started as open-source project; But what about now?
I see on Github there is 'Bitcoin Core', is it bitcoin repository?
https://github.com/bitcoin/bitcoin
Or maybe government or corporations already bought it, like, for example, Github..

Is Bitcoin completely Open-Source?

No.
Of course it depends on what you mean by Bitcoin and what you mean by Open-Source

"Open-Source"
Most definitions of "Open-Source" focus exclusively on Open SOurce Software. There are good in-depth and rigorous definitions for what makes a piece of software "Open-Source" or not.
A few definitions of "Open-Source" allow the phrase to apply to things other than computer software. For example techopedia:

Open source revolves around the concept of freely sharing technological information so that it may be improved through multiple insights and viewpoints. Since the technology is open source, the amount of work that needs to be done is reduced because multiple contributions are added by many individuals. This concept existed way before the age of computers and even before the industrial age when people shared and improved recipes for food and medicine, for example.

The broader Bitcoin ecosystem certainly contains important concepts, ideas, services and products that are completely proprietary or contain proprietary elements. For example, some prominent ASIC mining hardware designs, some hosted wallet services.

"Bitcoin"
It is arguable what Bitcoin is or is not. One reasonable definition is that is a published set of rules and network protocols by which a distributed peer-to-peer currency can be sustained.
In my view it would be incorrect to say that Bitcoin is solely or fundamentally a piece of software (open source or not).
Some people have created and maintain open-source software (e.g. "Bitcoin core") which implements those rules (or a coherent subset of them) but there can still be proprietary software doing the same job and interoperating with installations of open-source software.
The rules are managed through a process which is fairly open (see BIPs) - but ultimately which Bitcoin rules are adopted is determined only by the consensus of people operating Bitcoin nodes. It wouldn't be right to label this process as "open source".

Right; it's like asking if the Internet is open source. Certainly a large portion of the infrastructure that supports the Internet is open source, but there there also less open pieces around. Perhaps a better question is whether you can interact fully with Bitcoin with just open source software, in which case the answer is yes.

I dunno. Is GCC not "open source" because people sometimes write proprietary software with it? :)

@G Maxwell But "GCC" isn't the name given to the ecosystem of software compiled with GCC.

Bitcoin Core is open source under an MIT license, and is the original software implementation of a Bitcoin full node, though there are others. Most nodes run Bitcoin Core, but don't have to. Bitcoin could be defined as a network of users that agree to the same consensus rules, which means they don't all have to run the same exact software.
The MIT License (MIT)

Copyright (c) 2009-2018 The Bitcoin Core developers
Copyright (c) 2009-2018 Bitcoin Developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

See COPYING


text:
Copay Multi-user Wallet
I am very new to Bitcoin.  My friend and I are doing a business that will accept Bitcoin as payment.  I would like to know how easy it is to use Copay as a wallet that we can both share, and that will require both our authorizations to distribute Bitcoins into separate Bitcoin wallets for us?  If someone could please answer this for me, I would be very appreciative.
Thank you!

how easy it is to use Copay as a wallet that we can both share,

copay.io says:

Copay is a true bitcoin wallet, not an account service. Secure your personal funds with multiple signatures, or just one

See also Multi Sig Use Cases

Multi-Sig Use Cases
m = signatures required to spend,  n = signatures possible
m=1 and n>1
Shared Wallet
Could be used for small group funds that do not require much security. Least secure multi-sig option because it is not multi-factor. Any compromised individual would compromise the entire group. Group funds for a weekend or evening event might be a good use case. A shared wallet might also be fun for some kind of games too. Besides being convenient to spend from the only benefit of this setup is that all but one of the backup/password pairs could be lost and all of the funds would be recoverable.
m=n
Partner Wallet
Scary because no keys can be lost. As the number of signatures required increases the risk also increases. Could be thought of as hard multi-factor authentication.

etc
Note that terms like "partner wallet" or "buddy wallet" are not generally used and understood. People are more likely to call this something like a "2 of 2 multisignature wallet" or a "1 of 2 multisignature wallet" respectively. Though the above terms are more general and usefully apply to many other values of m & n.

There have been desperate questions here from people who set up a 2-of-2 multisignature wallet and found their friend lost their wallet-password without making any backups. This meant all their Bitcoin became lost forever. So I'd suggest
Go for a 2-of-3 arrangement with a passive partner (someone you both trust not to use their signature except in pre-agreed  emergency
circumstances. e.g. create a third key with your friend, and lodge the key, written on paper in a sealed envelope, with a lawyer)
If you must go for 2-of-2, walk through the backup and recovery process with your friend and make sure both of you are aware of the risks of not making a backup, or of not having tested recovery. You could easily lose all your money through a bit of carelessness on your friend's part.

I can't really answer "how easy" since I don't use it and that is rather subjective anyway.
Copay appears to be a popular wallet. It ought to be well-tested by it's users. It's probably worth trying out. If you find it doesn't meet your ease-of-use needs, you can always move your funds to a different wallet or import the private keys into a different wallet (saving tx fees).

In a more official arrangement (in the context of a company) having a lawyer hold the 3rd key, with a contract that only makes the key accessible to either party if both parties agree, or either party becomes incapacitated (sickness, death etc). You can keep it in such a way that the lawyer never open/sees the key as well. An extreme would be to place the key into a safe deposit box, and give the lawyer the key.


text:
can there be a normal wallet that is equivalent to a multisig wallet?
for a normal wallet : if you own the private key you own the money
can we say that the multisig wallet is just a normal wallet which the private key was derived from others wallets ?

the multisig wallet is just a normal wallet which the private key was derived from others wallets

That's pretty much exactly what it is. A multisig address lists the public keys that are allowed to spend the coins, and how many members of the group must sign (for instance, you can require 2 of 3 signatures). As long as enough private keys are accessible, the funds can be moved.

so in this case , even if you have a multisig wallet that require many people to sign , there is still a very small propability that someone by chance find a private key for a normal wallet which is nothing but your multisig wallet , right

No, multisig wallets are p2sh wallets, private key backed wallets are p2pkh. Even if you find a hash collision, the script is different. You will need to find a collision for the redeem script hash, and your colliding redeem script must also be valid


text:
Getting transaction id from raw transaction of a multisig address
I am able to get the tx id (or transaction hash) of almost any transaction but the one where the script starts with an "OP_O" (which is, I think, the null dummy introduced here https://github.com/bitcoin/bitcoin/pull/3843)
For example:
https://www.blockchain.com/btc/tx/97d1b00fcef1f19531a19bb1722635341a9f2ad261ecf6eed89eca2cbd3bb3ee
How am I suppose to get the txid of this transaction? And how is it different from a regular (without multisig) one?

How am I suppose to get the txid of this transaction?

The same way you get the txid of any other transaction, by hashing it (unless it is segwit). Note that the transaction you linked to is not a segwit transaction, so you can just take its hash.
If the transaction is a segwit transaction (as indicated by the marker and flag bytes of 0x0001 following the version bytes), then you need to only hash the parts that are non-segwit. Specifically, you drop all of the segwit parts (so the marker and flag and any witnesses which can be found between the last output and the locktime), and hash what is left. This is described in BIP 144.

And how is it different from a regular (without multisig) one?

There isn't.

Thank you, I will double-check my code. I tested it on a full block (about 2k txs) and the only times the txid didn't match (20 times) was when a "OP_0" appeared in one of the inputs scripts.

Also, I don't simply hash the transaction as it is. I parse it, store all its elements in a data structure, and then append them back and hash them (I use the tx id as an error check).

OP_0 is used in segwit transactions too, so that may be your problem.

Problem solved: I had a problem with my "varint" function... Thank you!

FWIW, got the same symptom in 2022 but from a different underlying problem. OP_PUSHDATA1 failed to encode its opcode, 0x4c, in the transaction. Obviously, the same problem occured with OP_PUSHDATA2 and OP_PUSHDATA4.


text:
Single tx included in two different blocks
https://www.blockchain.com/btc/tx/a7bacce00e5df85d3547a3f83ac10c65eec30f715c1d77d8d4a7bc17fd470965
How is it possible that a single tx is included in two different blocks?
Isn't it considered double spending?

Occasionally, minor alternate chains emerge if multiple blocks are found for a given blockheight. Usually, these alternate chains only last for a single blocked, and are quickly dropped once another block has been found, allowing one chain to become longer (and thus have more work).
More rarely, these chains might last for a couple of blocks.
Block 525890 for this tx is not part of the main Bitcoin chain, and thus the tx was unspent when block 525891 was processed.
525889 ------ 525890 ------ 525891*
      \------ 525890*

The blocks marked with * contain the transaction in question here. As you can see, they occur on separate, parallel chains. Of these, only the chain extending 525891 survived, resulting in the version of block 525890 containing the transaction being dropped.

You must be right. I doubled checked and my parser is using the same extinct block as blockchain.info. My block index must be wrong I will have to double check this.

That has to be a parsing error from blockchain.com side. It would be indeed a double-spend and therefore block 525891 would have been invalid.
If you check other explorers (e.g. blockstream or blockcypher) you'll see how they had only included it in block 525891.
Personally I find blockchain.info's explorer not to be too reliable.

Actually I found out about the double spend using my own parser that returns an error because the same UTXO is used twice. I am parsing the blocks from my own full node.

And it agrees with blockchain info, the UTXO is created in block 525859 and spent in blocks 525890 and 525891


text:
Spending UTXO from same block
Block 546 is the first time a (actually two) transaction spends the UTXO of a transaction from the same block.
Is the order important? (The transaction that generates the UTXO has to appear before in the block than the transaction that spends it)
Is it still possible today?

Maybe this can help: https://bitcoin.stackexchange.com/questions/50576/can-transaction-inputs-reference-outputs-of-pending-transactions

The order must be causal. Most blocks today have outputs that were created earlier in the block.


text:
How to get a full view of the lightning network with c-lightning?
As I understand lightning a node should in principle have a complete view of the lightning network graph (i.e., all nodes and channels). However, I also understand that for practical reasons the view will not actually be fully complete (some update may not have reached the node, I suppose).
For example I am currently using c-lightning. After running a node for some hours, if I do lightning-cli listnodes I get a list of ~5k nodes. But if I look at 1ml.com they currently report that there are ~14k nodes (~7k with active channels). So there seems to be rather a large gap between what I see and what 1ml sees.
For a particular use case I would like to have a "as complete as possible" view, though. My question then is if there is some way to configure the node to more actively explore and learn the full network?

lightning-cli listchannels is what you are looking for to also see the channels and not only the nodes.
In general the lightning nodes learn the network view from the gossip protocol where closed channels may be discarded and not forwarded anymore. If you look proprietary tools like the one you mentioned they might have stored older nodes and channels this is one source how the different numbers can arise.
BTW you get the gossip information from your peers so you could also peer with as many nodes as you learn from your initial peers and hope that you get a larger view of gossip.

So just connecting to many nodes using the lightning-cli connect command should boost the rate at which my node discovers the network? Thanks, that sounds simple enough.


text:
How would PTLC's change invoices?
I am wondering how would switching from HTLCs to PTLCs change invoices? I assume there would not be a payment-hash anymore, but what would replace it. A payment-point?
Also, is there already support for this in BOLT11 invoices? or would it require a new/updated invoice spec?

Yes the payment point would have to be included instead of the payment hash. I believe other than that nothing in the invoices would have to change.
Invoices have various fields with various semantics. One of them is the field for the payment hash. In order to stay backwards compatible I guess there will be a new field for payment points (public keys) instead of just putting a point inside the field for the hash. In this way someone decoding the invoice could already see if the invoice was for ptlcs instead of the hopefully soon to be legacy htlcs.
AFAIK until now noone has proposed a concrete invoice format yet as we still haven't agreed upon a specific way on how to implement ptlcs in lightning


text:
Withdrawal of coins to Trezor did not happen, Where are my coins?
I set-up Trezor yesterday and withdrew coins from my exchange to store in the Trezor. I entered the address and conifrmed.
However, an hour later, Trezor said Network error. It was unable to receive the coins.
The address I entered is also not showing up on Trezor today.
How do I get my coins?

If you used the correct address, you have received that money already even if your Trezor doesn't yet know about them.
If the public blockchain (not the unrelated business who use that name) shows your address has the money, you already have it. The public blockchain is the only true record.
You won't be able to spend that money until you fix whatever problem is causing that reported network error (or until you use your safe backup copy of the seed phrase or private-key in another wallet)


text:
Is there really no manual for Bitcoin Core?
This is not the first time I'm desperately searching for Bitcoin Core help and finding none, but look at this: https://bitcoincore.org/en/doc/0.20.0/
That's the closest thing to a "manual" I can find. But it's about RPC commands. I've gone through their entire damn website (both ones, in fact) and made numerous web searches but find nothing resembling a manual. Where is the manual? Is there a manual?
Right now, I'm trying to get official descriptions of these two configuration options:

blocknotify
walletnotify

They are not mention anywhere on that page, and seemingly nowhere else officially. Am I supposed to guess what they mean and try to piece together information from ancient questions asked by random people online? How is anyone supposed to get a Bitcoin payment system running and actually use Bitcoin when there is no manual and a hundred BIPs are released per week?
The lack of information has caused countless of my projects to never get off the ground. I don't understand the mentality that a lot of people have that things are somehow "obvious" or "don't need a manual". Especially not when it's for a crucial piece of software which we're supposed to use to revolutionize the world.

https://manpages.debian.org/testing/bitcoind/bitcoind.1.en.html

There is a manual documenting both examples. The man page for bitcoind.
man bitcoind shows me:
       -blocknotify=<cmd>

              Execute command when the best block changes (%s in cmd is replaced by block hash)
        ....
       -walletnotify=<cmd>

              Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)

They're really not that hard to use.
Note that this machine runs a slightly older version of bitcoind. Newer versions support %w for the name of the wallet, as bitcoind now supports multiple wallets, in addition to %s for the transaction ID.

So I'm forced to read the manual locally, and only if I run Linux? That's... interesting.

not found......

Most of the documentation about configuration options and RPCs can be found within the software itself.
Both bitcoind and bitcoin-qt have -help and -help-debug startup options. These will print out all of the configuration options and their descriptions.
bitcoin-qt additionally displays this information in Help > Command line options
For RPCs, you can use the help RPC to list all available RPCs. Doing help <command> will show the help text for that particular command. This help text will include a description of what the RPC does, the options, and what to expect in the result.

There is man bitcoind but there is also bitcoin-cli help or bitcoin-cli help <command> which can give you more detail. Bitcoincore.org also has explanations of all RPC calls: https://bitcoincore.org/en/doc/0.19.0/rpc/blockchain/getblockfilter/
and more info.


text:
Safest way to validate typo
Let's assume that I have small crypto exchange site called "MyExchangeWebsite".
It works like this: user creates ETH-BTC order, specifies his BTC address and sends ETH to my ETH address, I exchange it on Bitfinex and send resulting BTC to the specified user's address. Site is very simple and doesn't have accounts (non-custodial model).
By some reason user made a one-character typo in his BTC address for ETH-BTC order and it's impossible now to withdraw BTC, as checksum is bad. User noticed that he didn't receive BTC and contacts me to provide right address.

Am I right in my understanding that it's safe to change user's address and it's impossible to scam MyExchangeWebsite by third person who knows about typo and user's order details?
If it's not one-character, but N-characters typo. At what N it becomes unsafe to change N characters in user's address?
What is the best way to make sure that I'm in contact with the real order creator?


text:
How exactly does "CoinDance" determine the current number of public Bitcoin nodes?
On this URL: https://coin.dance/nodes
It says how many public Bitcoin nodes are currently active in the world, and how many Bitcoin Core ones.
While it's good that I can grab these numbers from that webpage, I'd like to know how exactly they determine this, and if it's simple, I'd like to calculate it myself rather than relying on a third party which could disappear tomorrow or lie to me or have a bug or anything.
Is this simple to determine? What steps have they likely taken to calculate this? Does it involve scanning every public IP address in the world repeatedly and checking for listening Bitcoin ports? If so, I'll probably leave it to them as I don't need to emit that kind of insane amount of traffic from my home... not to mention it would probably require me to use tons of IP addresses lest I want to get banned from various network and thus get inaccurate statistics.
Or does Bitcoin Core itself have this information baked in? Does the Bitcoin network send around an integer saying how many nodes there are to each other as part of the protocol, and I can just use the RPC API to my local Bitcoin Core to get this info?

My guess would use getaddr, make new connections and repeat.

Does the Bitcoin network send around an integer saying how many nodes there are to each other as part of the protocol,

No.
See https://en.bitcoin.it/wiki/Protocol_documentation
So far as I can see, total counts of active nodes are not part of any message but there are potentially useful messages such as:

getaddr
The getaddr message sends a request to a node asking for information about known active peers to help with finding potential nodes in the network.

By sending this message to all known but previously uncontacted nodes, it is possible to discover more previously uncontacted nodes you can send this message to until the responses only contain previously contacted nodes and all the nodes you know of are either contacted nodes or unresponsive nodes.

I'd like to know how exactly they determine this,

CoinDance don't say.

As Davidson Souza's later answer reports, at least one website (Bitnodes) uses the getaddr message to approximate the number of all currently accessible nodes.

They use a crawler that connect to every single reachable node into the network recursively.
Basically connect to a node, send a getaddr request, and try to connect to the received addresses.


text:
How can AMP invoices be static in Lightning?
I have heard that there are static AMP invoices that can be reused multiple times (at least in LND). But previously I understood that you should never reuse the same paymenthash, because you could loose funds.
So how does these static invoices get around that? I suppose you have to put some hash in the HTCL?

AMP static invoices are a little different than normal payments. In typical lightning payments, the receiver generates the preimage which is hashed and sent to the sender via the invoice.
With Atomic Multi-Path Payments, the preimage must be a little more complicated to facilitate multiple payment routes, and therefore must be sender generated. Since the sender is in charge of generating the preimage, every payment to an AMP invoice can be unique.
A visual explanation on just how the base preimage is created and sharded can be found here

This answers the question. But now I am wondering: As per spec the invoice should still have a payment hash value in it. How is this value then generated in a AMP invoice, and is it used at all? And does this not technically violate the spec?

Bolt11 is a specific kind of invoice. AMP doesn't comply because it's slated for a different Bolt (Bolt4). See https://github.com/lightning/bolts/pull/658


text:
How to generate Hash160 from a private key with the Bitcoin module
I want to fix the script code. The script generates from a random private key Bitcoin Address by function (pubtoaddr) and works
on the Bitcoin module:
https://github.com/primal100/pybitcointools/blob/master/cryptos/main.py
from bitcoin import *
import os

    priv = random_key ()
    pub = privtopub (priv)
    addr = pubtoaddr (pub)

....
....

But I need to get from a Random Private Key in Hash160
For some reason I could not find such a function in main.py
I searched and found an article
>>> import pybitcointools
>>> privkey = pybitcointools.random_key ()
>>> privkey
'34030ce14e32ac982419b3683af3b59d64a29cc93798cf479d610af49d425d13'
>>> pubkey = pybitcointools.privtopub (privkey)
>>> pubkey
'04ce0ed35340803b0c21f2f7f5d5ab9d687e5fa95a79471c9b5c9d97a0bb170eac1045230cc51d13b85a5f64feb80f8fc19358a396797926e3f89d49066b1abc07'
>>> h160 = pybitcointools.hash160 (pubkey.decode ('hex'))
>>> h160
'1558c7cd9825447a31990ff964f347bb2dbfe9be'
>>> addr = pybitcointools.hex_to_b58check (h160)
>>> addr
'12wsYc4B9c9JeREqstLZXNWa3n4i42M5jg'

Unfortunately I could not get from
 priv = random_key ()  --- > Hash160

How to do it?

I find the Bit module the easiest and most straight forward, albeit a tad, limited but with bit you can simply:
from bit import Key

# To generate private key
privKey= Key()

# Create Ripemd-160 Hash (address)
privKey.address

# or

myAddress = privKey.address

# Segwit

MySegwitAddress = privKey.segwit_address

You can also import your own existing private keys like so:

# For wif format:
privKey = Key.('L1VotKmtZRLZSnSPhLhQxfts2aqBMru2APTs4Yuc8TYJ4jNhQoGB')

# For hex format:

privKey = Key.from_hex('ccb8c423403f4d5b6cde505d2a8f39d1d9399f6e06853339f5b11593cc502dc9')

# For int format:

privKey = Key.from_int('92598274663553697917256765988661195316245391320286084491562671024534692310473')

# For bytes format
privKey = Key.from_der(b'\xcc\xb8\xc4#@?M[l\xdeP]*\x8f9\xd1\xd99\x9fn\x06\x8539\xf5\xb1\x15\x93\xccP-\xc9)

Exporting works pretty much the same way as importing except you replace from.[format here] with to.[format here], you can even import or export a PEM file of your private key.
The documentation is enough for the library to give you the core functions, but is also somewhat lacking, for example you can't create compressed bitcoin addresses. But otherwise you can sign, send transactions, even select exactly which outputs you want to use .etc


text:
Bitcoin users limit
How bitcoin handle users limit if only 4000 transactions in every 10 minutes ? Let's say I transfer 2 bitcoin to Anuj account then how much time maximum it will take to reflect in Anuj's account and what will be the process running in background on bitcoin during this record.

Let's say I transfer 2 bitcoin to Anuj account

The Bitcoin network doesn't have accounts as such. You typically transfer money to a Bitcoin "address" given to you by the intended recipient.

how much time maximum it will take to reflect in Anuj's account

It depends on how busy the Bitcoin network is and on the transaction fee chosen by the sender. I don't think there is an imposed maximum but if the sender selects a very low fee and the network is busy, it can take many days.

what will be the process running in background on bitcoin during this record.

No process needs to be running in the background.
You can receive money when your computer is turned off. Receiving money typically doesn't require any participation from the recipient after the sender knows the receiving address.
Obviously, a Bitcoin wallet can only find out it has previously received money by catching up when next online.


text:
Why does printing a scriptPubKey have an extra OP_PUSHBYTES_20?
I am building a P2PKH script pubkey in code, and the standard format is:
OP_DUP OP_HASH160 <PUBKEYHASH> OP_EQUALVERIFY OP_CHECKSIG
However, when I print it (I'm using the bitcoin Rust crate) it returns as:
Script(OP_DUP OP_HASH160 OP_PUSHBYTES_20 <PUBKEYHASH> OP_EQUALVERIFY OP_CHECKSIG)
Is that OP_PUSHBYTES_20 meaningful? What does it mean? Why is it added?

@Prayank, perfect thanks!


text:
Error: Non-canonical DER signature when attempting to broadcast signed Segwit Transactions
I'm trying to build a native Segwit transaction programmatically, however, whenever I attempt to broadcast the transaction, it returns this error:
non-mandatory-script-verify-flag (Non-canonical DER signature)
My raw, unsigned tx (testnet) is here:
0200000001fd45159c94d5dcf0804e7aba6e5862445a3c41fb5ec21184fe3a41a1a6dbb5b40000000000ffffffff02a351000000000000160014d1ca74222bb5a5c1b43fae117e811b2320a286a66500000000000000160014d1ca74222bb5a5c1b43fae117e811b2320a286a600000000

My signed tx here:
02000000000101fd45159c94d5dcf0804e7aba6e5862445a3c41fb5ec21184fe3a41a1a6dbb5b40000000000ffffffff02a351000000000000160014d1ca74222bb5a5c1b43fae117e811b2320a286a66500000000000000160014d1ca74222bb5a5c1b43fae117e811b2320a286a6024630440220465c93c725454f7bda3e3453ce09e99f7636560935be9377c3ae1138cfa0bb4702206f45290b2c06fc7e2298c6778fbccd1a805e34535247c49e098bc7229e74533421034ac1bb1bc5fd7a9b173f6a136a40e4be64841c77d7f66ead444e101e0134812700000000

Both decoded look okay to me, so I I think it it's either the sighash or signing of the sighash that's going wrong.
The sighash I get of the unsigned tx, for the only input is:
e54c499bfef6f5f0b12b819de82220aa7de532f9b72ae0f74638a647e147f884
This is created using:
https://docs.rs/bitcoin/0.25.1/bitcoin/util/bip143/struct.SigHashCache.html#method.signature_hash
using SigHashType::All passing the pubKeyScript and value (22,000)
and when signing the sighash I get:
30440220465c93c725454f7bda3e3453ce09e99f7636560935be9377c3ae1138cfa0bb4702206f45290b2c06fc7e2298c6778fbccd1a805e34535247c49e098bc7229e745334
I am completely stuck on what to try next. Any direction would be appreciated.

You're missing the sighash flag byte at the end of the signature.
"Signature" objects in Bitcoin Script consist of the actual DER-encoded ECDSA signature, plus the sighash type byte (in your case, 0x01 for SIGHASH_ALL).

Thanks for the quick reply. I had noticed that, however, after adding that byte I get Signature must be zero for failed CHECK(MULTI)SIG operation instead.

That means you signed the wrong sighash, mostly likely.

In the end it was because I was using a p2pwkh when creating the sighash instead of the required p2pkh :/.


text:
What are fee_method and fee_level in Electrum's getfeerate RPC call?
I couldn't find any documentation on this.
I found that the options for fee_method are eta, static and mempool by reading the source code. But it's still not clear to me how fee_level relates to the fee_method, does it have something to do with configuration? If that's the case, the configuration isn't documented either. What is to be set? How does it work?


text:
Whats the difference in way you installing full nodes
I'm newbie in blockchain world, so I'm curious what is the difference between installing full node by using libs such as bitcore-lib (using node.js) and installing it through the daemon (mentioned here https://bitcoin.org/en/full-node#ubuntu-1604) (sudo apt-add-repository ppa:bitcoin/bitcoin etc..)

The Bitcoin Core daemon is better-reviewed and faster (because of C++). Bitcore lib is a Javascript library and not a node, the node version is Bitcore Node. You should ask yourself what you're going to do with a node. If you're a miner, the you shouldn't take risk and choose Core. If you want to use Javascript API, use Bitcore.


text:
How to convert P2PKH to Hash160 (or something else acceptable by Script)?
How to convert a bitcoin address (starts with 1) to the right format acceptable by script (I'm using this Ruby library)? I'm doing this:
tx.output do |o|
  o.value(50000)
  o.script { |s| s.recipient('1GzqkR2zNQUzHLpE7PLPjVNJ51FHC3bpDH') }
end

I'm getting:
RuntimeError: Script type must be hash160, pubkey, p2wpkh or multisig

I suspect there is something wrong with the format of the destination address. I cross-posted to GitHub too.

To convert a P2PKH address to a script, you first have to decode it using base58check.
Here is an example:
$ bs58 -dc 1GzqkR2zNQUzHLpE7PLPjVNJ51FHC3bpDH
00af7a4a30243f2301e6a14a4979ae099d52f560d4

Remove the prefix 00, see https://en.bitcoin.it/wiki/List_of_address_prefixes. You are then left with the hash160 of the pubkey, but this is not a full script. The P2PKH script looks like: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG. So you need to add the missing ops:

OP_DUP = 0x76
OP_HASH160 = 0xa9
OP_EQUALVERIFY = 0x88
OP_CHECKSIG = 0xac

Resulting script: 76a9af7a4a30243f2301e6a14a4979ae099d52f560d488ac
Note wallet software does all this for you when creating transactions based on an address.
Links

Bitcoin Wiki | Script
Bitcoin Wiki | Transaction (P2PKH)
Python Tools (bs58):
https://github.com/jbaczuk/blockchain-dev-tools/


text:
What key is used to create a script?
I'm trying to sign an input in my transaction. The question is: which key has to be used in the "script," private or public? It would be silly to disclose a private key there, right? But how will the network be sure it's me, if I provide a public key (which is known by everybody)?

The public key is used in the script. Technically, it is the pubKeyHash, which is RIPEMD160(SHA256(publicKey)), which means the public key isn't revealed until the transaction gets spent.
The way that validators can ensure it is you who spends the money locked up with a specific public key is by digitally signing the transaction which spends it, with the private key matching the public key. A digital signature can be verified against the public key to ensure that only the corresponding private key could have possibly created the signature.
Assuming a P2PKH transaction having scriptPubKey of the form:
OP_DUP OP_HAS160 pubKeyHash OP_EQUALVERIFY OP_CHECKSIG

The input script to spend simply has the form
signature publicKey

When the output is spent, the signature of the spending transaction and the public key are pushed on the stack before the scriptPubKey is evaluated.
The script first duplicates the public key on the top of the stack with with OP_DUP, and performs the OP_HASH160 on the top item. (HASH160 performs the same RIPEM160 and SHA256 which created the original pubKeyHash). This removes the duplicated public key from the stack and replaces it with the public key hash.
The script then pushes the pubKeyHash which was embedded in the scriptPubKey onto the stack. The two items at the top of the stack are then compared for equality (OP_EQUALVERIFY), and popped off the stack. If equality test fails, the script fails early.
The remaining public key and signature at the top of the stack become the arguments to OP_CHECKSIG, which verifies that the signature of the entire transaction corresponds to the public key. The signature and public key are popped from the stack and replaced with either true or false, indicating the final result of the script evaluation.


text:
How to convert Script hash into opcodes, in Ruby?
I have a script and it looks like this: 76a914af7a4a30243f2301e6a14a4979ae099d52f560d488ac. How can I create an instance of class Bitcoin::Script from ruby-bitcoin? It has to be parsed, I believe, but how? I posted a GitHub ticket too.

I guess I found an answer:
script = Bitcoin::Script.new([hash].pack('H*'))


text:
When downloading the blockchain my application is become unusable, is there an issue with my code or am I using the BitcoinJ library incorrectly?
I am building a Bitcoin wallet with the BitcoinJ Library, after looking at the example of fetching a transaction that they have shown on their github it shows that you need to download the blockchain however.
When attempting to download the blockchain to view the balance of my wallet, it begins to lock up and become unusable. I have even tried downloading the blockchain in an async task like so, but still the app becomes completely unusable and the UI doesn't even load. What am I missing? I thought that the download wouldn't be that large as I am attempting to create an SPV wallet which from what I understand doesn't download the entire blockchain, or is this something I need to configure seperately?
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
         DownloadBlockchain().execute()
    }

    inner class DownloadBlockchain : AsyncTask<Void, Int, String>() {
        override fun doInBackground(vararg p0: Void?): String {
            Globals.peerGroup?.startAsync()
            Globals.peerGroup?.downloadBlockChain()
            return "complete"
        }

        override fun onPostExecute(result: String?) {
            super.onPostExecute(result)
            Globals.peerGroup?.stopAsync()
            Globals.wallet?.saveToFile(Globals.walletFile)
        }
     }
 }

The downloadBlockChain() method looks like it downloads the whole blockchain. It looks like the PeerGroup.setFastCatchupTime method might be helpful to prevent it from downloading full blocks before that time. I imagine you'll use a method or change a boolean value to only download block headers for your SPV wallet, but I don't know where that would be.
https://bitcoinj.github.io/speeding-up-chain-sync may be a useful reference.


text:
where in the source code is the the proof of work checking the blockheader hash and nonce?
Where in the source code do we check whether
 hash(blockheader*nonce) < Difficulty

In fact, the line I found is as follows:
https://github.com/bitcoin/bitcoin/blob/v0.17.0.1/src/pow.cpp#L87
My problem with this is 3-fold
a) this is not the code that miners use to perform the check; it probably is the validation on node-side ?
b) here the "hash" refers to what exactly ?
c) why is this value tested against nTarget ? rather than Difficulty ?
d) this check is usually advertised in media as "<"less rather than "<=" less than equal. But seeing how this line
is coded , it means
     HASH<= nTarget
is OK.

Where in the source code do we check whether
  hash(blockheader*nonce) < Difficulty

The function you are looking for is in pow.cpp:
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params)
{
    bool fNegative;
    bool fOverflow;
    arith_uint256 bnTarget;

    bnTarget.SetCompact(nBits, &fNegative, &fOverflow);

    // Check range
    if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
        return false;

    // Check proof of work matches claimed amount
    if (UintToArith256(hash) > bnTarget)
        return false;

    return true;
}

a) this is not the code that miners use to perform the check; it probably is the validation on node-side ?

This is on the node side. Miners do not use Bitcoin Core software for mining, this check is implemented as part of the ASIC design, so not even software at all.

b) here the "hash" refers to what exactly ?

Here the hash is the function used to calculate the block hash. In Bitcoin, this is 2 rounds of sha256, sometimes called hash256. See Bitcoin Wiki - Bitcoin Hashing Algorithm

c) why is this value tested against nTarget ? rather than Difficulty ?

Difficulty is just an abstraction of the nTarget, which represents the actual 256 bit value that the header must be less than (or equal to). The header is a 256 bit value, so it must be compared to nTarget. The conversion between nTarget and difficulty is difficulty = difficulty_1_target / nTarget, where difficulty_1_target is the target of the genesis block. See Bitcoin Wiki - Difficulty

d) this check is usually advertised in media as "<"less rather than "<=" less than equal. But seeing how this line is coded , it means HASH<= nTarget is OK.

correct.

@JBaczuk.Thank you. This helps.
But is the PoW definition of : Hash(blockheader + nonce) <= Difficulty incorrect ?  .... or is this correct on the miner client end. Where is that line of code in the source code ? I'd be interested to see if that's "<" or "<=".
Note that in your outlined answer, we are talking here about the node side. The process that "validates" the hash (which has been computed on the miner's client). This validation takes milliseconds. If on the miner's client "<" was set (rather than "<="), then it's irrelevant of to include the "=" on the node end.

The nonce is part of the block header. The miners have their own code, they don't use Bitcoin Core to mine, in fact they probably do the check in the ASIC, so no software at all. This is the line in Bitcoin Core if (UintToArith256(hash) > bnTarget) return false, so if it's >=, then it will be valid. Also, there is virtually no chance the hash will ever be =, so it doesn't matter.

Ahh ... thanks. but I am now a bit confused. I thought that if I run a full node, I perform mining too ? That should be in the bitcoin core code, no ? There must have been a pre-implementation for CPU mining ... where can we find that ?

See https://bitcoin.stackexchange.com/a/51170/60443


text:
re : minimum sizes of transactions and blocks
I see there's a similar question provided here:
What are the minimum sizes for transactions and blocks in Bitcoin?
But the answer provided might be not correct in the light that "A valid transaction requires at least 100 bytes" or am I missing something here ?  See checklist #6.
If relevant to minimal transaction size, my question then would be, was this standard introduced after or before the answer provided.
Also, did the answer provider care about distinguishing between valid transactions and invalid transactions ?

That limit (which is different today) pertains to node policy and transaction standardness. It is important to keep in mind that something that is non-standard is not necessarily invalid. Validity and standardness are two different things, although standardness is a subset of validity.
A transaction smaller than the standardness minimum can still be valid. It will just be considered non-standard and not be accepted by nodes following that particular policy (which is most nodes as that is part of Bitcoin Core). The limit today is 82 bytes which is the smallest size a standard transaction can be.

If relevant to minimal transaction size, my question then would be, was this standard introduced after or before the answer provided.

This policy rule was introduced in 2010, long before the referenced question and answer. Furthermore, that wiki page was written containing that information in 2011. Also note that the wiki page is outdated as the rule in question is incorrect.

Also, did the answer provider care about distinguishing between valid transactions and invalid transactions ?

The answerer (me) did. The smallest valid transaction is as I state in that answer. Such a transaction will be considered non-standard and will not be relayed per the policy rule, but if a miner were to include such a transaction in a block, it would be accepted by nodes as being completely valid.


text:
regarding transaction size in a block
In What are the minimum sizes for transactions and blocks in Bitcoin?
The first transaction is set to be 65 bytes long, due to coinbase requirements. What about the second one ? That can be 61 bytes long ? Also, does each transaction carry a counter ? How is that added to the byte count.

By "does each transaction carry a counter", do you mean a counter as to how many transactions are included in the block?

The transaction counter is part of the blockheader or not ? Does the counter refer to the number of all transactions inside the block or does each transaction have a counter ID ?

There’s a counter after the block header, but not part of it. Transactions have no other index.

There’s a counter after the block header if you mean block serialization to disk by BitcoinCore. In fact, serialization to your disk is not a consensus rule. You have a right to write data on your disk in your own format.

What about the second one ? That can be 61 bytes long ?

Yes.

Also, does each transaction carry a counter ?

No. There is a global counter in the block that is right after the block header. That counter is the number of transactions included in the block. It is not part of any transaction and its size does not affect the size of any transaction in the block (compared to when that transaction was unconfirmed and in the mempool).
The transactions come after that counter just listed one after another with no additional information separating them (transactions follow a specific format so it is trivial to know when one ends and the next starts).

The "global counter" (between header and transactions) is not a part of consensus block :) You can serialize your data on disk as ||<16bit-counter> or || and so on. And you definetely can add any counters for transactions while saving block to your local database. (There is no reason for it)

The counter is part of the block weight so it is consensus critical. However, yes you can put the counter wherever you want, although blocks received over the network will have them after the header because that's what the block message specifies.

@andrewchow when does the transaction counter get the max of 9 bytes ?

Whenever the counter requires 8 bytes to represent it. Currently this is not possible because that's way too many transactions than can fit within the block weight limit. However the number of bytes required for the counter is variable.

@AndrewChow sorry let me ask differently, how is the value represented in hex ? so with let's say 5 bytes what would be the max value we could obtain ?

That way of asking differently does not make any sense. What is it that you really want to know? The way you are asking questions sounds like an XY problem as it seems like you are fixated on this counter and think that answering a question about the counter will get you an answer for some other related question.

What is the maximum number of transactions that be showcased by the maximum value which is 9 bytes, could you illustrate this ? Then I might be able to answer my own misunderstandings myself.

Just ask what it is that you are misunderstanding instead of asking for something that you think will help you understand it. A block can contain 16392 minimally sized transactions, including the coinbase transaction. This does not require 9 bytes to represent, it requires 3. The maximum number of transactions that 9 bytes can count is 18446744073709551615 (0xffffffffffffffff), but that far exceeds the maximum number of transactions in a block (and basically the capacity of  storage you would find in any computer ).

@andrewchow thank you. that does answer a lot of  questions.


text:
What happens if a country blocked external Bitcoin traffic?
Say a country decides to completely sever itself from the outside world, like so. Assume no leaks. As I understand, once the local miners process all the international transactions in everyone's' mempools, they'll be left with only local transactions, blocks, nodes, and miners. A (long) while later the difficulty adjusts downward, and you now have a local, codeless, lower-POW "fork" of BTC, even though it's the same code-wise. Travellers can go there and spend their pre-fork balances there again, either sending it to another address they own, or send to locals, though it's obviously severed from whatever transactions they performed outside this country.
Assuming they keep up-to-date with the codebase only, and they do this for a long time, say a year and more, what happens once connectivity is restored? Is their local chain just completely wiped out due to lower POW? Would local nodes be forced to go back to the time of the fork and download international blocks? All those valid transactions at the time, gone? And roles reversed, what if this country amassed enough mining power to have more POW?
And as a bonus question, how would Layer 2 solutions, assuming they were the only traffic that could cross the border the whole time, affect this scenario? Could you load funds onto the Lightning network from both networks, and effectively double your balance by withdrawing them on the outside network?

Is their local chain just completely wiped out due to lower POW?

Yep. Lower proof of work means orphan, invalid chain.

Would local nodes be forced to go back to the time of the fork and download international blocks?

Yes, because the chain they followed before they reconnected, has no value after the re-connection.

All those valid transactions at the time, gone?

Yes. This is also why the 51% attack is bad. One with more hash power could
1) cash out their coins
2) publish the new, alternative chain with more PoW
3) start mining secretly again
4) repeat until the coin price decreases enough to make mining inefficient

And roles reversed, what if this country amassed enough mining power to have more POW?

Then everyone loses money. This'll also indirectly affect Russia because of the changes in coin price.


text:
Proposing faster hash function for mining and modified difficulty to get more speed and less consumption
Do you think it could be interesting use a faster alternative Hash function for mining while proposing other form of difficulty mechanism ?
I would like to extend the question not only to bitcoin, but to a potential new cryptocurrrency.
What if we found a faster hash function than SHA-256 used by bitcoin in Mining,  which properties are secure in the context of Proof of Work( Ex: Keccak).
It could improve the speed of block's validation in the network but the difficulty mechanism would compensate this scenario improving the difficulty so we do not get an advantage.
The proposition of a new difficulty mechanism that not only depends directly of hashrate(10 min creation of blocks) could be the solution to use a faster hash function and reach improvements in terms of velocity, energy consumption.
Is it really important what Hash function you use? assuming security in their properties. And what about if you could propose a difficulty mechanism that won't increment necessarily the difficulty related to Hashrate
What do you think? Do you have any ideas how modify this difficulty mechanism?

I’m going to focus on Bitcoin, because altcoin development is not on-topic here. The block interval is unrelated to the proof of work function, a hard fork could change the hash function, the block interval, or both. This topic’s  question post appears to be based on misconceptions about the way Bitcoin works, e.g:

SHA-256 is a simple, memory-light hash function. This makes it ASIC-friendly. That is good for fostering competition among ASIC producers.
The block interval is a security parameter set at the system level that is entirely unrelated to the runtime of SHA-256.
Proof of work is not wasteful.
Without the difficulty adjusting to the amount of work done by the network, the block interval would shrink as more hash power comes online which would cause the rate of stale blocks to increase and advantage larger miners.


text:
Is there a guide or system to determine mining-profitability?
I would like to ask this question because I want to introduce in the mining and I am looking for models that I can determine if a win money or not(objective function maximize profit for example, I put the energy consumption, and more variables) .
Is there some guide or academic literature about that?
Thank you

Have you looked at other questions tagged with mining-profitability?

https://bitcoin.stackexchange.com/questions/118/how-much-bitcoin-will-i-mine-right-now-with-hardware-x


text:
How do I retrieve my lost password?
I bought $3800 of Bitcoin in 2017 and I've lost my password, the salesperson who sold me the product had a stroke and is in a wheelchair. She incapacitated. Without a decent contact us form how do find out who took over the portfolio?
Need help.
Thanks,
Billy Joe Cordova.

let me reflect your question back to be sure I understand it and to make the situation clear to you too.

You gave $3800 to someone on the understanding they would use it to buy some things for you.

That person took the money but never gave you those things

You never saw the things yourself, never saw any evidence that they existed.

You were happy for the other person to look after the things on your behalf

You never asked the other person to give you "your" things

The other person never gave you the things. Never gave you the purchase receipt they obtained when they bought the things.

The other person is now no longer available

You hope that random strangers on the other side of the world might know where the things are.

The truth is, there is no global organisation that keeps track of every thing one person owes another person. When you lend a neighbour your lawnmower, no official knows about that, nobody far away writes down that your neighbour owes you a lawnmower. The only person who knows where the lawnmower is stored is your neighbour, not some government department, not some international organisation.
Bitcoin is a mostly-anonymous peer-to-peer system of electronic cash (not accounts, not portfolios) without any need for trusted intermediaries. There is no organisation in charge of Bitcoin. If you don't have electronic cash in your own electronic wallet in your own computer, you don't really possess that cash.
From what you wrote, I'd guess you have no prospect of getting that cash.

If you believe you are the victim of fraud, the normal way to deal with that is to report it to your local police.
If you believe some person is not keeping up their side of a financial agreement, even if no fault of their own, the normal way to handle that is by consulting a lawyer about a lawsuit.