text:
Node Stability And Troubleshooting
Background: Not a lot of linux experience but technically able
What's the best way to troubleshoot the stability of bitcoind? I've had it just stop for no discernable reason.
I'm doing a full sync with txindex=1 about 615000 some blocks synced so far.
Running on a raspberry pi 3. The debug.log doesn't show anything particularly interesting. Simply starting it back up again works with no errors.
If i want to make sure my node is up... what's the best way to do that? A cron script that tries to start it if it's down? What about if that's failing?
Best solution seems to be to update some very stable external system (azure or something) every time it learns about a new block and alerting on that system if it doesn't see one for a couple hours or something.
Either using zeromq or a cron script checking for current block height to do the update.
Open to any best practices or already built solutions for this though.

What's the best way to troubleshoot the stability of bitcoind?

I would say logging.
You could also use Linux tools to monitor usage of memory and other resources. Maybe vmstat or top would show something interesting. Maybe bitcoind is filling a filesystem you didn't expect - df -Pk.

The debug.log doesn't show anything particularly interesting.

If you are not already running bitcoind with option -debug=1, I suggest you try it.
-debug=<category>

Output debugging information (default: -nodebug, supplying <category> is
optional). If <category> is not supplied or if <category> = 1, output all
debugging information. <category> can be: net, tor, mempool, http, bench,
zmq, walletdb, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock,
rand, prune, proxy, mempoolrej, libevent, coindb, qt, leveldb, validation.

Note that the default is -nodebug.

I've had it just stop for no discernable reason.

As well as turning up debug to the max, I would try to capture the return code ($?) of bitcoind.

If i want to make sure my node is up... what's the best way to do that?

The daemon process startup system on your Linux distro ought to be able to auto-restart a stopped daemon. You configure the startup system appropriately. Details probably depend in distro and version. E.g. in systemd: restart=always


text:
Understanding bitcoin merkle tree construction at code level
I have a high level understanding of how merkle trees are constructed for a Bitcoin block, but I am interested in building a little CLI tool in golang that actually takes a list of transactions for a block and reconstructs the merkle tree. I am doing this just for my own educational purposes. As I am going through this process I am realizing some details about the merkle tree construction which I do not understand.
I have the following code to construct the merkle tree from a list of transaction hashes
func buildTree(leafHashes []string, comboFn CombineHashFn) (*node, error) {
    if len(leafHashes) == 0 {
        return nil, errors.New("empty list of leaf node hashes provided, cannot construct tree")
    }
    currentLayer := make([]*node, len(leafHashes), len(leafHashes))
    for i := 0; i < len(leafHashes); i++ {
        currentLayer[i] = &node{
            hash:      leafHashes[i],
            left:      nil,
            right:     nil,
            duplicate: false,
        }
    }

    for len(currentLayer) > 1 {
        if len(currentLayer)%2 == 1 {
            lastNode := currentLayer[len(currentLayer)-1]
            duplicateNode := &node{
                hash:      lastNode.hash,
                left:      nil,
                right:     nil,
                duplicate: true,
            }
            currentLayer = append(currentLayer, duplicateNode)
        }

        nextLayerLen := len(currentLayer) / 2
        nextLayer := make([]*node, nextLayerLen, nextLayerLen)
        for i := 0; i < len(currentLayer); i += 2 {
            nextLayer[i/2] = &node{
                hash:      comboFn(currentLayer[i].hash, currentLayer[i+1].hash),
                left:      currentLayer[i],
                right:     currentLayer[i+1],
                duplicate: false,
            }
        }
        currentLayer = nextLayer
    }

    return currentLayer[0], nil
}

I am passing in a function to combine to node's hashes that looks like
func Sha256CombineHashFn(left string, right string) string {
    return fmt.Sprintf("%x", sha256.Sum256([]byte(left+right)))
}

I suspect my merkle tree logic is correct but my method for combining node's hashes is wrong. Based on some Googling I suspect the following things are wrong

I think I should not be representing the hashes as hex encoded strings, but instead should be using byte arrays.
I believe I should be doing a "double" hash.

Instead of guessing and checking if I was combining nodes correctly I instead just tried to read the Bitcoin merkle tree code. I found this code. I was hoping reading the code would unblock me, but I am just more confused for a few reasons.

It looks like two hashes are not being taken but instead some number of hashes are being taken that are proportional to the number of leaf nodes (reference code)
Understanding this line and this method implementation is going over my head. I expected this logic to be very simple, from my understanding all that needs to be done is take two node's hash values, combine them some how and then hash the result. Instead it looks like multiple hashes are being taken, it looks like the 0th index is used twice, and I do not see where hashes are combined.

If I wanted to write a simple function in go with the following function header
func Sha256CombineHashFn(left string, right string) string
// OR
func Sha256CombineHashFn(left []byte, right []byte) []byte

How might I do this to match the Bitcoin logic?

source: Stack Exchange

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

sort: votes


text:
Can someone create a Bitcoin address that is identical to another except the last letter is lowercase where mine is capital
The reason I ask is an online casino was set to pay me $1,000 via Bitcoin and showed me the address they claim to have paid, which is identical to mine except the very last letter is capital and on mine it's a lower case. Is it possible to create another address so similar to mine?

Ask them for the txnid (transaction id, aka transaction hash) and look that up (or if willing post it for others to do so)

Thank you. I know it sounds like a stupid question to you guys but I feel I'm being lied to by these guys and just wanted to clarify before I pursue my funds any further. They said only finance dept has that info and of course they never return my calls, msgs, emails ect...

It is not possible to have two valid Bitcoin addresses that differ only in their last 5 characters at all, as those only contain checksum data. For bech32/bech32m addresses (bc1...), that's even true for the last 6 characters.
In theory, it is possible to construct two P2PKH (1...) or P2SH (3...) addresses that differ only in 1 character if not at the very end, but the probability is very low that any given addresses has such a valid mutation (1 in ~75 million). With bech32/bech32m any two valid address differ in at least 5 characters.

Where do you get ~100million? Odds against the check being the same is 2^32 which is just over 4billion. And that's only after you found two pubkeys, or scripts, that hashed to near-identical values, which is only a little less than the birthday bound, maybe 2^120 against i.e. won't happen in this universe.

@dave_thompson_085 2^32 / 57 (because there are 57 distinct single-position errors). And by valid I meant "checksum valid", ignoring whether anyone else might have the private key for it. This is what matters for not accidentally sending your coins into the void.

So to clarify if they "allegedly" made a deposit to the address they claim, what exactly would happen?

@Jerry Nothing, that would not be a valid address, and there is no way to send anything to it. Either their software is horribly broken, or they are lying.

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


text:
Unprune & Re-Download Failed. Core asks for a "-reindex" due to chainstate, then fails
I was attempting to return from pruned to unpruned chainstate. Unchecked the pruned box. Core cautioned this would require re-download of the blockchain in its entirety. OK, fine. Shutdown Core to re-start and it failed, repeatedly. Since I don't know how to -reindex, I uninstalled Core, presuming ALL data, files, directory structures, etc., associated with the program would be removed or deleted. Nope. Found the following data and structures dating to first installation:

From the debug.log:
LoadBlockIndexDB(): Block files have previously been pruned
: You need to rebuild the database using -reindex to go back to unpruned mode.  This will redownload the entire blockchain. Please restart with -reindex or -reindex-chainstate to recover.
should not be overwriting a chainstate
Error: Error opening block database
Shutdown: In progress...
If I uninstall Core again, and then Delete the folders: blocks & chainstate, will this force another download? Or do I need to Delete the entire Roaming>Bitcoin folder?
Thanks

After minimal interest and no suggestions, I decided to uninstall again, and delete the Roaming > Bitcoin folder and data. Re-installed Bitcoin Core, and am now downloading the chain again.


text:
How can there exist businesses that "specialize in blockchain analysis looking for patterns of usage that reveal how money is being used"?
I read this today in a SE comment for an unrelated question:

there are businesses that specialize in blockchain analysis looking for patterns of usage that reveal how money is being used.

To me, this is downright offensive, since I have spent 20 years trying to come up with something that I can do that will actually generate money.
And now somebody claims that there are entire actual businesses that do nothing but analyze the Bitcoin blockchain looking for patterns, and somehow make money from this?
Can somebody explain to me how this makes them money? And what, more precisely, do they do when they "look for patterns"? Surely this must involve more than just having a Bitcoin Core fullnode on a PC and looking at the blocks locally?

For example when a transaction sends 0.03 BTC to an address and to 0.03783214 to another address it's easy to see which is the the change output and which is the payment. See this for similar problems: https://en.bitcoin.it/wiki/Privacy#Blockchain_attacks_on_privacy

And now somebody claims that there are entire actual businesses that do nothing but analyze the Bitcoin blockchain looking for patterns, and somehow make money from this? .. Can somebody explain to me how this makes them money?

These chain analysis businesses make money by selling data to interested parties, such as regulators, other businesses, police/gov enforcement agencies, etc.
As example, in many jurisdictions, businesses that act as bitcoin exchanges (trading fiat <-> bitcoin) are required to comply with 'anti-money laundering' (AML) and 'know-your-customer' (KYC) rules and regulations. This ultimately means that these businesses will need to catalogue data about who is using their service, and for what reasons. So they will employ the services of a chain analysis firm that can supply data about what is happening on the bitcoin network, in an effort to appease regulators.

And what, more precisely, do they do when they "look for patterns"?

Chain analysis firms will work to obtain as much information about the economic activity happening on the bitcoin network as possible. This includes:

The structure of transactions (number of inputs/outputs, value of inputs/outputs, address types, etc)
The relation between different transactions / addresses (eg, attempting to group clusters of addresses to outline a user's wallet, etc)
The messages exchanged P2P on the network (eg, where do new blocks/transactions originate from)
Publicly available data (eg, when a user posts an address of theirs to a forum online)
Privately available data (eg, buying or trading data about customers from private businesses)

By combining clues gained through the above methods, a chain analysis business can make guesses about which users own certain UTXOs, as well as the relationships and economic flows that exist between these users. Since this data is of value, these businesses can exist.
For a thorough explanation of these different types of attacks on privacy, the Bitcoin wiki has a great page: https://en.bitcoin.it/wiki/Privacy#Blockchain_attacks_on_privacy (as suggested by MCCCS in a comment)

An important thing to note is that many of the metrics used by chain analysis firms rely on certain heuristics that do not always hold true. This means that in many cases the resulting analysis is false, or perhaps just nonsensical. Bitcoin privacy is a back-and-forth battle, with many developers working on tools and techniques that directly attack the validity of heuristics used by chain analysis (eg, coinjoin, payjoin, etc).
On the other hand, a chain analysis company would be expected to overstate the validity of their results, since their revenue is contingent upon this validity, and they want to convince customers and regulators that the fees they charge are worthwhile.
Ultimately,  a user can interact with the bitcoin network in a way which grants them zero privacy against these businesses, or they can interact in a way which allows them extremely high levels of privacy. It really just depends on the user's habits, and the tools available to them.
So the true effectiveness of chain analysis is hard to discern, but in any case it is an attack on the privacy and security of bitcoin users worldwide. Note that even if the conclusion of a chain analysis firm is false, there is nothing to stop an overzealous regulator from persecuting an individual based on the result anyways. The stakes are apparently high, for everyone involved.
So I do agree that it is offensive, though perhaps for different reasons.


text:
Testnet3 app will not sync to peers
I was just trying to connect testnet3 to my own testnet node through the "trusted peer" and "skip regular peers" settings, but it seems that in this way it cannot connect to a trusted peer which runs 0.21.0.
I tested several 0.21.0 nodes and it does not connect to any of them. However, it does connect to a trusted peer which is 0.17.0, for example. Also, with default settings (no trusted node) it displays some 0.21.0 nodes in the peers list, not sure why.
Did anyone notice this and managed to find a workaround? Thank you.

It seems that I needed to activate Bloom filters in my bitcoin.conf file, as it looks like this is necessary for many SPV wallets.
Also some things that other users may need to do is to forward ports (8333 for mainnet, 18333 for testnet), and if you have the typical router setup at home, make sure that you are not within CGNAT (you can check this with your ISP).
Also it looks like your node performance has some influence, as I can sync my mobile wallet with my node as long as the latter is running on my laptop, but it seems my raspberry does not make it. Both have the same configuration.


text:
Bitcoin 2 of 4 Multisig script with one required
Hi I am to write a bitcoin locking script with property that 2 out of 4 signatures should be verified, but among those verified 2 there is a specific signature that should be verified.
I.e only 1 manager combined with 1 employee in a 4 employee company(including manager) can unlock the script, but the order of the signatures in unlocking script should not be important.
I have given a lot of thought to it, but was unable to satisfy the property that order doesnt matter in unlocking script. Could you please help me?
Thanks in advance!

Bitcoin script does not let you require a specific signature, however you could give the person that is required to have a specific signature additional keys and change it to a 4 of 6.
Manager has 3 keys.
Employee 1 has 1 key.
Employee 2 has 1 key.
Employee 3 has 1 key.
With 4 signatures required to spend the Manager only needs one employee present to sign, however the 3 employees can not produce a fully signed transaction without the Manager present as their 3 keys combined does not meet the 4 minimum required.


text:
How does the bitcoin core protect against initial DNS seed changes?
While the bitcoin network is essentially P2P, one still needs to identify an initial node to connect to. I understand that a method for such initial connections is connecting to known DNS seeds, e.g seed.bitcoin.sipa.be. If a malicious actor were to, hypothetically, redirect this "link" to a seed that points to a different network, where, for example, he has 51% majority, could any damage be caused by this ?

Generally there's some discussion about attacks against the bootstrapping of Bitcoin Core, but there's not a whole lot in terms of being able to defend against it. Fortunately the DNS seeds are only really used on the first launch of the software, the rumoring of peers within the network is used for all subsequent connections.
There's not a whole lot that could be done with gaining this sort of access without a lot of cost beyond just subverting DNS seeds. The clients have an idea of the total amount of work needed for the chain to be valid, so won't be fooled by an entirely new blockchain that has no connection to the real one. Mining with a low hashrate at the tip of the real blockchain is not possible either due to there being a maximum amount the difficulty can drop in each period; you can't simply mine 2 weeks worth of blocks and have the difficulty drop to nearly zero.
Ideally we'd now have the DNS seeds, but the risks they introduce are manageable, the bootstrapping issue isn't unique to Bitcoin, it's something that all P2P networks need to contend with to some degree.


text:
How to get private Keys from Wallet using bitcoin-qt
createwallet "MyWallet"
getwalletinfo
{
  "walletname": "MyWallet",
  "walletversion": 169900,
  "format": "bdb",
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 0,
  "keypoololdest": 1617197424,
  "keypoolsize": 1000,
  "hdseedid": "4da0242dbf5124f4f05e6ffaf6bd94c51a9d7858",
  "keypoolsize_hd_internal": 1000,
  "paytxfee": 0.00000000,
  "private_keys_enabled": true,
  "avoid_reuse": false,
  "scanning": false,
  "descriptors": false
}

But I don't know what to do next. A lot of commands are deprecated.

What are you trying to accomplish? There are commands to get the private keys, but generally this isn't something you should do. What do you need them for?

I need to be able to Send / Receive BTC using my own software.

By using Bitcoin-Qt, or something else?

I am testing with Bitcoin-QT using a private node now. Eventually will be using BTCPayServer

NVM, I have found the answer it is dumpprivkey


text:
Can I start a Bitcoin Private Node using bitcoin-qt?
Currently I am starting a private node using:
bitcoind -regtest -port=11111 -datadir=.\data -rpcport=11112

I can't find the -regtest option in qt.

Pass it when you run qt

Sorry I don't understand what you mean by Pass it. QT doesn't like -regtest if I pass it in.

bitcoin-qt -regtest -port=11111 -datadir=.\data -rpcport=11112

When I ran this command, it says that I am ''10 years 8 weeks behind". Is that means qt ignored -regtest and I am at the main net?

Regtest is a private test network that you create and control. All it has is a genesis block that was created 10 years ago, so what you see is that Bitcoin Core (both bitcoind and bitcoin-qt) only knows about that genesis block and thus believes it to be out of sync. This can be resolved by simply mining a block.


text:
How can I load a specific private key into my wallet
Starting a Private Node using bitcoin-qt.
And then I generate a pair of keys for my own testing.
But unfortunately whenever I reset the node, it will generate a new pairs of keys, it makes my recursive test very tedious.
Is there a way for me to load a private key into my wallet instead of using getnewaddress every time and test with a new pair of keys?

Replace wallet.dat with a saved copy

You mean replace the physical files inside the wallet directory?

@sk Yes. Make backups and restore backups, either manually or using the provided facilities. Practise first on non-valuable wallets until you are sure your actions have the effects you seek and no effects you consider harmful. On Ms-Windows see %APPDATA%\Bitcoin\wallets\


text:
Add bitcoin payments to java app using BitcoinJ
I need to add Bitcoin payment to my application using the BitcoinJ library, but I'm new to using Bitcoin. I have one thought To create a new address for each new user, but I don't know if this is the right approach or not. Please tell me how to implement it correctly.
(I need to determine from which user the payment was received and in what amount)

As a Java programmer who has dealt with BitcoinJ, I highly suggest using Jython to embed python bitcoin libraries for Bitcoin related tasks within your program. BitcoinJ is mostly unkept and is missing modern features. However, if all you want to do is generate new addresses for each user from a wallet that they own, BitcoinJ is sufficient:
First create a new wallet for the user:
Boolean isTestnet = true;
NetworkParameters params = isTestnet ? TestNet3Params.get() : MainNetParams.get()
Wallet wallet = new Wallet(params);

Connect to the network (I believe this is optional but not 100% sure):
BlockChain chain = new BlockChain(params, wallet, ...);
PeerGroup peerGroup = new PeerGroup(params, chain);
peerGroup.addWallet(wallet);
peerGroup.startAndWait();

Create new addresses:
Address a = wallet.currentReceiveAddress();
ECKey b = wallet.currentReceiveKey();
Address c = wallet.freshReceiveAddress();

assert b.toAddress(wallet.getParams()).equals(a);
assert !c.equals(a);

Not really for BitcoinJ, but a general approach.
You generate new address for every user you register. Store it in your DB with the userID for future reference.
Create a getAPI taking a String input. use your API endpoint and open the Bitcoin.conf file.
walletnotify=curl <your API>

If you want to have confirmation logic as well, you may need one more getAPI, and get the endpoint. then update your bitcoin.conf file again with following:
blocknotify=curl <your Block API>

Now when user makes the deposit to the address you generated, Bitcoin node will notify your app by calling the wallet notify API. You get the transaction hash. Use that txHash and make a Post call to your daemon with RPc command:
getTransaction <txHash>

Now you'll have entire transaction object to find which user has made the deposit.
Free tip: Bitcoin node calls walletnotify two times:

When a transaction is added to the chain.
When that transaction receives first confirmation.

If you don't want more than one confirmation, then blockNotify is not needed.
If you want a practical example, you can check my Github repo, where I have done it. It's not based on BitcoinJ but the logic remains the same:
https://github.com/kunalbarchha/generic-wrapper-for-bitcoinforks


text:
Alt Stack is not working as expected
I have a scenario as follows:

In a company, there is a manager and three employees. The multisig signature will be redeemed by the manager combined with one of the employees.
However, only the manager, or only the employees with enough number of signatures will not be able to redeem the transaction
The order of the signatures should not matter
Assume my_public_key is manager_public_key

My solution was: [OP_2DUP, my_public_key, OP_CHECKSIG, OP_IF, OP_DROP, OP_ELSE, my_public_key, OP_CHECKSIGVERIFY, OP_SWAP, OP_ENDIF, OP_DROP, OP_1, employee1_public_key, employee2_public_key, employee3_public_key, OP_3, OP_CHECKMULTISIG]
So I tried to shorten the script in order to have less bit in a transaction by using alt-stack.
My suggested solution is just to duplicate the my_public_key and push it into the alt-stack and whenever I need it later, I can pop it from the alt-stack and use it. So by the final script I should deduct the script by one public key.
Suggested solution: [OP_2DUP, my_public_key, OP_DUP, OP_TOALTSTACK, OP_CHECKSIG, OP_IF, OP_DROP, OP_ELSE, OP_FROMALTSTACK, OP_CHECKSIGVERIFY, OP_SWAP, OP_ENDIF, OP_DROP, OP_1, employee1_public_key, employee2_public_key, employee3_public_key, OP_3, OP_CHECKMULTISIG]
My suggested solution gives reference error.
I would be happy if anyone can help me.
Error:
{"error": "Error validating transaction: Rejected script for input 0 referencing 5f026fb3260c809d446740917bca4aa0e8633f64ec86fc8a4c5e23979f1578ba at 0.."}
Input script:
[OP_0, manager_sig,employee_sig]

Is the script you are looking for just doing manager AND (employee_1 OR employee_2 OR employee_3)? If so, you don't need to make such a complicated script or use the altstack. Is allowing any order a hard requirement? That severely complicates things, whereas if the scriptSig is just a template with signatures in a particular order, everything is a lot easier.

The order of signatures should not matter. So, the script should accept any order of signatures.

@cavitcakir OP_CHECKMULTISIG requires the signatures to be in the same order as the keys (though in case of a k-of-n, obviously sigs for some keys have to be omitted). Still, the remaining ones must be right.

@PieterWuille Yes, I know how it works so that's why I first check the order and do required manipulations. The first script works well when input is not ordered. But I used 2 my_public_key and I want to reduce the number of keys in the locking script.

@AndrewChow I forgot to mention you in the previous comment.


text:
Connection error
i have installed bitcoin node, it was syncing before i went to sleep, i want to know the percentage of the synced,  anytime i query on the bitcoin-cli getblockcount ,i get this error "
error: timeout on transient error: Could not connect to the server 127.0.0.1:18332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
" but  this is what i have in my bitcoin.conf file "rpcport=18332
rpcallowip=127.0.0.1
" would appreciate help

Is your bitcoind running? Is it on testnet?

it keeps saying this when i tried to run bitcoind "Error: Cannot obtain a lock on data directory /root/.bitcoin. Bitcoin Core is probably already running."


text:
Can satoshi nakamoto change bitcoin
If I understand correctly, Satoshi Nakamoto (or any cryptocurrency creator) can change things in Bitcoin, like supply limit, halving, etc.
My question is: How is Bitcoin decentralized if Satoshi Nakamoto can change anything in Bitcoin protocol?
What if suddenly Satoshi Nakamoto changes Bitcoin so miners receive 100 times more rewards. How can I, as a Bitcoin user, prevent this to happen?

Bitcoin is open source.

@PrinceM but still there are a group of developers to maintain the code, right? What if they decide to change the code?

No one would download it!

Related: How exactly are Bitcoin's consensus rules enforced?

If I understand correctly, Satoshi Nakamoto

You don't

If I understand correctly, Satoshi Nakamoto (or any cryptocurrency creator) can change things in Bitcoin

You have exactly the same ability to do these things as Satoshi Nakamoto.
By doing those things you would create a fork of Bitcoin. Just like many other forks.

How can I, as a Bitcoin user, prevent this to happen?

You can ignore the fork and carry on using Bitcoin software that does not implement the changes you dislike.
This is what has happened to several forks of Bitcoin. This is why there are so-called "altcoins". You will note that the majority of cryptocurrency users adhere to the "old" rules.
Those "old" rules have also had improvements (e.g. Segwit) that have proved acceptable to the majority and seen widespread adoption. So the rules are not exactly "old", they are continually under review and the wider community does see and comment on suggested improvements. It would be more accurate to call them "mainstream" rules.

Everyone has the code of Bitcoin and run it on their own computer.People believe it and run it.Satoshi can't change anything on the block unless he has the 51% hashrate.He can change the code on his own computer but he can't change the code on others.If he want to change the thing on the chain ,he must "persuade" others to beilieve  that they can earn,if following him. That is what 51% hashrate does .I think it is impossible .Emmm,Maybe he can prove that blockchain is not secure  using his wisdom and then destory the whole  cryptocurrency,or let their price go down︿(￣︶￣)︿。

Downvote: having 51% of hashrate does not allow someone to arbitrarily change the network rules. That is a different consideration entirely.

51%hashrate  can't change the network rules ,but can change  blocks.em I have mistaken his question,What he said is about rules  not  the safety


text:
Found Bitcoin Core Wallet with unconfirmed Transactions, anything to salvage?
I am currently looking through old .dat files and found a wallet with two "Received with" transactions that are unconfirmed.
When I enter the address from the Label on blockchain.info the address shows a balance of 0 and 0 transactions.
Does that mean, that the transactions are invalid, and that I have to find the origin address to figure out a remaining balance, or is there anything other that I can do?
Bitcoin Core is only synced to 2017 yet.

Wait till it syncs to today. If remains the same, congratulations, you're $100k richer. Otherwise pretty useless.


text:
Could centralisation of miners lead to censorship?
Censorship meaning: Only government approved addresses are allowed to have their transactions added to the blockchain.
Scenario: Miners are centralised within a geographic boundary with significantly cheaper energy and more processing power making competition impractical. The government of this geographic boundary now comes to the mining company and says: "Here's a list of approved addresses, if any other addresses are allowed to transact we'll put you all in jail"
From my understanding this is a possible scenario although I am uncertain about the likelihood of this happening and the incentives that might lead to this or would prevent this from happening. What is your understanding on these incentives? Is this a problem or is it unrealistic?

Scenario: Miners are centralised within a geographic boundary with significantly cheaper energy and more processing power making competition impractical. The government of this geographic boundary now comes to the mining company and says: "Here's a list of approved addresses, if any other addresses are allowed to transact we'll put you all in jail"

This would not work.
Miners must mine the blocks that users want them to mine. If they don't, users won't buy the bitcoins mined in those blocks. Users believe that censorship resistance is the value proposition of bitcoin. So they would have no interest in buying bitcoins mined in blocks enforcing effective censorship.
Exactly how this would play out could vary based on the exact scenario you imagine, but one thing that could happen is that users would agree to change the mining algorithm. Nobody in the regime that was trying to enforce censorship would bother buying ASICs that implement the new algorithm since they know that if they can't censor effectively they'll be in legal trouble and if they can censor effectively, their ASICs will be worthless.
In short, miners that destroy bitcoin's value proposition render their own ASICs worthless.

I will try to combine both answers by Hugo Franklin and David Schwartz with my thought process in the hope that this could add value to others.
The scenario of geographically centralized Bitcoin miners that are censoring transactions is one that is unrealistic for a multitude of reasons.
Bitcoin mining is permissionless so anyone can participate, i.e. compete.
Not only that, but there is lots of energy that is not being used due to expensive transportation which Bitcoin does not need. Effectively not only can anyone compete, but there are many people and places for whom it will always be worth it to compete.
So it's already unlikely that this part of the scenario would happen but suppose it did.
Any attempts at censorship would lead to the censored addresses paying higher transaction fees to incentivise miners to include their transaction. So effectively the more you censor, the more competition you invite. This makes the success of the censorship even less likely.
Summarised: The permissionless nature implies that centralization of the mining would be extremely difficult to achieve, once achieved it would once again be virtually impossible to continually enforce censorship, which, in the case it somehow still does work out, would be entirely self destructive.

If the list of censored addresses ever becomes public, the owners of said coins will be motivated to spend them (wash them) using non complying miners blocks to a fresh set of addresses, and can pay elevated fees for the privilege of doing so. And so the government will be forced to come up with a new list of addresses.
However the government will be unable to come up with a mechanism to perpetually extend the set of blocked addresses perpetually. Any mechanism to create such a growing set of banned addresses (so to speak) is equivalent to a haircomb commitment set and implies the existence of private and untraceable currency.
Now assume on the contrary, that the list of censored addresses is non-public. This implies that the government is secretly colluding in a cartel to raise fees for spending a specific unknown set of addresses. However, the miners are by necessity anonymous (1 doublehash = 1 vote). Any such cartel is unstable and will necessary collapse due to deflection.

This answer somewhat sidesteps the scenario posed in the question since the asker starts from a list of permitted addresses.

If I understand correctly, there is the assumption that there will always be non complying miners, which leads to it being unlikely that a list of blocked addresses would be sustainable and even more so in the case of a list of permitted addresses.
I'd be curious to know what this assumption (assuming it was made) is based on. How hard would it be to make any competitive mining unfeasible/impractical?

Only way to make to ban non-complying mining is to hold 51% of the hashrate.

Ah, the assumption about Bitcoin resisting state control? That would be the axiom of resistance.

I think you meant "defection" not "deflection".—As pointed out above, you're answering something else than the question asked. The scenario differs significantly between an allowlist and a banlist, e.g. because it forces address reuse and is much easier to propagate an allowlist in due time.


text:
How secure are the private keys on a hardware wallet?
Specifically two questions are interesting to me:

Are private keys ever accessible?
When are they generated and how can we know/prove this?

In more detail:

Is my understanding correct that even when connected to a computer with an internet connection the private keys are unaccessible and the only thing that can be seen is a signature/signed transaction? (let's take the Ledger Nano S as an example)

How can I know that the seed phrase I see is new and hasn't been seen by the manufacturer before? How can I be confident that when I get the seed phrase/access to the private key nobody else has before me?

Is my understanding correct that even when connected to a computer with an internet connection the private keys are unaccessible and the only thing that can be seen is a signature/signed transaction? (let's take the Ledger Nano S as an example)

Right, if you plug a hardware wallet/signer into a laptop your hardware wallet/signer will provide signatures when requested so that transactions can be constructed and broadcast but will not ever provide private keys to that laptop. The private keys stay on the hardware wallet/signer.

How can I know that the seed phrase I see is new and hasn't been seen by the manufacturer before? How can I be confident that when I get the seed phrase/access to the private key nobody else has before me?

You can generate a fresh seed phrase (or enter an existing one, Coldcard supports dice rolls) on the hardware wallet/signer but you are trusting the manufacturer that they haven't pre-loaded a set of seed phrases on the hardware wallet/signer. Hence it is important to buy directly from the manufacturer's website and not third party sellers who may have tampered with the hardware wallet/signer or be selling you a replica. One thing you may want to look into if this concerns you is multisignature or threshold schemes. This would allow you to use multiple different products and manufacturers and mitigate the risk of any one manufacturer being malicious. (They now wouldn't be able to spend your coins with knowledge of the seed on the device they sold you.) It does introduce complexity though so practise first on testnet/signet and make sure you understand what you are doing.


text:
Is it easier to reverse the entire blockchain than to guess a private key?
If I am not mistaken you could in theory revert the entire blockchain, by producing nonces which probabilistically speaking required more work.
So the (hypothetical) question is: if I wanted to steal Satoshi's Bitcoin, should I try to guess the private key or create a new chain with more work?
Set aside the economic implications of the value of Bitcoin in either case, purely probabilistically speaking, how do the two compare?

By checking the chainwork, which shows the total hashes that are expected to be calculated. As of block 765365, it's 00000000000000000000000000000000000000003a8a576dba35308e77dc8446.
In decimal, that's 18,117,375,202,741,628,848,220,608,424.
Satoshi used P2PK back in 2009, so there is only one valid Bitcoin private key that can sign for the corresponded rewarded public key. Therefore, you have 1 in 2^256 - 2^32 - 977, which is far larger number.
In decimal, it's 115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,908,834,671,663.
But, to be fair, calculating SHA256d hashes of block headers, and brute forcing private keys aren't the same computational processes, economically speaking.

Computing the private key for a given public key needs only ~2^128 group operations, roughly the square root of the number of valid private keys, using algorithms like Pollard's rho. Also, the number of valid private keys is 2^256 - 432420386565659656852420866394968145600, not 2^256 - 2^32 - 977 (which is the size of the field the secp256k1 group is defined over).


text:
Bitcoin Data Types
Sorry for this noob question. I have wrapped some Bitcoin Core JSON RPC APIs.
The tests I've made so far are working fime but now I have some issues mapping input arguments with the correct C++ data types.
For instance:
bitcoin-cli help getmempoolinfo returns:
{
  "size": xxxxx,               (numeric) Current tx count
  "bytes": xxxxx,              (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted
  "usage": xxxxx,              (numeric) Total memory usage for the mempool
  "maxmempool": xxxxx,         (numeric) Maximum memory usage for the mempool
  "mempoolminfee": xxxxx       (numeric) Minimum fee rate in BTC/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee
  "minrelaytxfee": xxxxx       (numeric) Current minimum relay fee for transactions
}

Numeric is too generic
The file blockchain.cpp defines:
static UniValue getmempoolinfo(const JSONRPCRequest& request)
{
            RPCHelpMan{"getmempoolinfo",
                "\nReturns details on the active state of the TX memory pool.\n",
                {},
                RPCResult{
                    RPCResult::Type::OBJ, "", "",
                    {
                        {RPCResult::Type::BOOL, "loaded", "True if the mempool is fully loaded"},
                        {RPCResult::Type::NUM, "size", "Current tx count"},
                        {RPCResult::Type::NUM, "bytes", "Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted"},
                        {RPCResult::Type::NUM, "usage", "Total memory usage for the mempool"},
                        {RPCResult::Type::NUM, "maxmempool", "Maximum memory usage for the mempool"},
                        {RPCResult::Type::STR_AMOUNT, "mempoolminfee", "Minimum fee rate in " + CURRENCY_UNIT + "/kB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee"},
                        {RPCResult::Type::STR_AMOUNT, "minrelaytxfee", "Current minimum relay fee for transactions"},
                        {RPCResult::Type::NUM, "unbroadcastcount", "Current number of transactions that haven't passed initial broadcast yet"}
                    }},
                RPCExamples{
                    HelpExampleCli("getmempoolinfo", "")
            + HelpExampleRpc("getmempoolinfo", "")
                },
            }.Check(request);

    return MempoolInfoToJSON(EnsureMemPool(request.context));
}

again, what C++ type is RPCResult::Type::NUM ?

As you can see from the definition in rpc/util.h, RPCResult::Type is just an enumeration, meaning they are numbers to represent different types of values.
As the values returned by the RPC are simply strings, those numbers help describing them in the output (e.g. as 'numeric').
In the enum definition, you can find a description for the values that are less intuitive (such as STR_AMOUNT).
That said, you can map those objects to C++ types by looking at the variables that are converted to such objects.
In your example, the RPC object is built by MempoolInfoToJSON.
If you look at that function (here), you will see a number of pushKV operations, which convert the original variables to the corresponding object.
So, you can easily see that:
RPCResult::Type::BOOL is a bool
RPCResult::Type::NUM is an int64_t (which is a signed long int)
and so on.
Note that these JSON objects can actually be mapped to more than a type in C++: you can convert a STR to a string or a char*, and you can convert a NUM to an int or to a long, depending on its size.
Similarly, a string hex can be mapped to a string or it can be converted to its numeric value.
So, eventually, it's up to you to decide the actual mapping, depending on your needs.


text:
I just need some advice or assistance if possible? I'd really appreciate anyones 2cents on this
I sent BTC from Paxful to an exchange called LAtoken. $36 worth of BTC was sent, nothing major to anyone else but really huge to me. Cope pasted and confirmed address. NO btc arrived almost a day later.
When I check on the blockchain the address says
"This address has transacted 2 times on the Bitcoin blockchain. It has received a total of 0.00022816 BTC ($13.04) and has sent a total of 0.00022816 BTC ($13.04). The current value of this address is 0.00000000 BTC ($0.00)."
The exchange is not answering as well so I'm lost. So frustrated and wondering if the money is lost. I would love to just be sure.
here is the Txhash
9875516de2037143c60ae2bb84d3cf18678c0c906a9c712eddd36e65018f5d6f
here is the address
1J4TJDRuCvTJ9hCL7cXihtAZbM3THVKC6d

This is from LAtoken faq:

I can't see my deposit
If you have made a deposit to your LATOKEN account, but the amount is not
reflected in your balance, it might be caused by one of the following:

Deposit was below minimum deposit, please refer to min amount on
deposit screen. In this case, deposits are considered unrecoverable.

Deposit has wrong/missing memo - create a ticket and tell us the
correct memo, we will deposit it manually (may take up to 1 week).

Deposit was not yet processed on the blockchain. Here are the
approximate time frames after which you should create a ticket:

~30 minutes for ETH, ERC-20, NEO;
~1.5 hours for BTC;
~3 hours for NIMIQ, Mircoin;
~30 days for BAYR.

My guess is that your deposit is below minimum deposit but I don't have an account there and can't check; if not, you can send the transaction ID to their support following the link above and ask them to verify.

Thanks, my deposit was above their min deposit. They require 0.0005 btc, I deposited 0.00062816 to the address. Either way its looking like they scammed me.

The transaction of which you provide the ID has an amount of 0.00022816 as you stated in the question. If you send the amount you want deposit with multiple transaction, the minimum amount is applied on every single transaction.

That's what I don't seem to get. The address they gave me is what I copy pasted to exactly on Paxful. I sent it all fully once. Once it got to the blockchain I don't understand how it was split in two. I have no clue what happens with btc on the blockchain, could you please explain if possible?

I don't have any info on the other transaction you talk about. If you have inserted this addr: 1J4TJDRuCvTJ9hCL7cXihtAZbM3THVKC6d to withdraw from paxful, the mistake is theirs: the blockchain certify  that they sent only 0.00022816. That said, i notice that difference from the amount you wanted to transfer and actual transferred is exactly 0.0004 btc, maybe there is a withdrawal fee on paxful that you did not take into account?


text:
How bitcoin daemon search nodes to connect?
How bitcoin daemon search nodes  to connect? What file in github responsible for this? How they often change? How is the veracity of the data of these nodes checked? Bitcoin daemon have function not save blockchain data on device?

How bitcoin daemon search nodes to connect? What file in github
responsible for this? How they often change?

Bitcoin use peer discovery to find nodes to connect to, some are hard coded in the file bitcoin/src/chainparams.cpp of the bitcoin core client available on github.
You can find more information here:
https://stackoverflow.com/a/19956156/1616622

How is the veracity of the data of these nodes checked?

There is no need to check them manually that is the beauty of decentralized blockchain, if someone try to trick other nodes by using wrong data like a wrong blockchain the other nodes will see it because of the bitcoin protocol and ban him


text:
I used edge wallet to send my bitcoin from my wallet to my cash app but i used a low fee soo its been unconfirmed for 10 days what can i do?
My transaction 5c8552a6744b3428d3ec4b5c0dd8b378ffeb4efd703b76a2b9d106250234d766
Has been unconfirmed for 10 days is there anything I can do to get it confirmed or do I just have to wait?


text:
Relocating Physical Node Location
Are you able to relocate your node's physical location (i.e., move from Oregon to New York) and keep all the channels you've established intact?

Yes. Channels are associated with a node_id, which is just the public key of the node. The association of a node_id to an IP address (or Onion address) is dynamic and is broadcast over the P2P gossip network when your node connects to another. It only takes a few minutes after reconnection for your new IP to propagate through the entire network.
However, you should reconnect as timely as possible after turning your node offline. If parties you have open channels with find you unresponsive for so long, they may attempt to unilaterally close the channels they have open with you. If they also believe you are offline and not monitoring the channels, they may attempt to broadcast an expired channel state to take more of the balance than they currently have in the channel.

Just to add: I already did it without problems


text:
What causes synchronous price movement within and between crypto exchanges without matching trades?
I have observed different crypto exchanges for quite some time now and analyzed the potential for different kinds of arbitrage. However, I don't quite understand what I am seeing.
Examples:

Observing Poloniex and Binance web socket streams for the same symbol, it seems like most of the time Poloniex lags behind Binance but it generally moves the same way. Interestingly, these price movements occur without any (visible) trades happening. What could cause this effect? Who makes money from this if there are no trades?
Triangular arbitrage rarely seems profitable within one exchange. I would expect that multiple symbols on a smaller exchange like Poloniex would need some time to return to balance after a major price movement. However, it seems like markets adjust faster than the real-time web socket API will let me look at the situation (1ms latency).

The attached image (sorry, didn't find a bigger one in my files) shows Binance (blue) and Poloniex (green) prices moving. There are no trades on Poloniex during this time.

Well... All of the top crypto exchanges like Binance have their inner arbitrage system. They may execute the best orders without putting them in the order book. They take the best arbitrage opportunities. So regular users like you and me can't benefit from such orders. This inner arbitrage is very profitable for the exchanges.
Maybe this is why you see what you see.
Actually, most of the top exchanges work like "Grey Boxes". We don't know what's happening inside... But they take all the best oportunities anyway.

Thanks for your answer. I have considered this option as well. Do you have any sources to support these claims?

Yeah, I know a founder of 50x.com crypto exchange. He is a very smart developer. He knows about crypto exchanges a lot. He has developed the first Any-to-Any crypto exchange in the world.
Here is my referral link: https://go.50x.com/60797
He told me about inner arbitrage a lot.

He told me all these things about this "inner" arbitrage. By the way, such arbitrage is impossible on 50x.com because the trading core of the exchange always "seeks" for better execution opportunities itself. A user always gets the best possible order execution.


text:
Unuseful backup
I know wallet.dat needs to do back up every time after I am going a transaction, 'because the backup will become unuseful.
After what else cases do I need to do backup again? What cases do my last backup wallet.dat unuseful?

If your wallet was created by Bitcoin Core 0.13 or later, this is not the case. Such wallets store a deterministic seed from which all future keys are generated.

@PieterWuille My wallet was created in BC v. 0.21. Do you want to say I don't need backup to?

He say that you have to do it only once. If you have saved the seed (that's inside the wallet.dat file), all addresses can be calculated from that one, so you don't need to back up every new address, just once after you created the wallet.


text:
How do I restore the public key?
Let say, I create wallet and have two public key and one private key.
And I remove the first public key from the wallet.
Can I restore and use my first key again? Or it's removed at all.
Sorry for the maybe a silly question I'm a newbie.

When you create a new wallet (in any recent software) a new seed is generated, from which all the private key / address pairs are generated (there cannot be an address without its specific private key); usually Bitcoin clients don't let you remove addresses from wallet, but even if you manually delete one or all of them, if you backed up your seed, you can re-generate all addresses you have used (and in the same order), since all modern wallet are hierarchical deterministic.

Here a more detailed description of how the HD wallet work: learnmeabitcoin.com/technical/hd-wallets

Thanks. I have only one question Bitcoin Core doesn't ask the seed phase. Is it mean it doesn't support HD? It asks for a password only.

Yes, Bitcoin Core use HD wallets by default, but it don't use the mnemonic seed so you can't backup the wallet with the words list but you must backup the file wallet.dat. you find more info on this answer: https://bitcoin.stackexchange.com/a/91819/117651


text:
fundrawtransaction - what is it?
I find on Internet interested article.
How I understand the raw transaction can be created simpler without fundrawtransaction.

bitcoin-cli listunspent [misconf=1] [max_number_confirmation=99999999] '''["<wallet_address>"]'''
bitcoin-cli createrawtransaction
'[{
"txid" : "<txid_of_selected_block>",
"vout" :
}]'
'{"<recipient_address>": <amount_to_send>, "<sender_address>": <amount_change>}'
bitcoin-cli signrawtransaction <hex_createrawtransaction>
bitcoin-cli sendrawtransaction <hex_signrawtransaction>

That's all and without fundrawtransaction.
And I don't understand why fundrawtransaction do need? And what is the difference between "with" and "without"?
I'm a newbie and I not sure I right understand what do mean inputs and outputs and possibly so I can't understand what mean fundrawtransaction?
Please, more examples and more simple speech. Thanks.

Just to give a little background first: Bitcoin uses a so-called UTXO model. You own UTXOs (or "coins", to give an analogy). Every coin has a value (which can be any number of satoshis) and has an owner (script) "stamped" into it. Every transactions "melts down" a number of existing coins, and "forges" new coins. The value of the new coins cannot exceed the value of the melted coins. The difference between the amount melted down and the amount forged is the fee of a transaction.
This means that the protocol really no concept of a "balance". There are just coins. You can have 3 BTC in your wallet, consisting of a 1 BTC coin X and a 2 BTC coin Y. These can be stamped with the same script (address) or not. It doesn't really matter - a wallet can consist of many addresses.
So say you want to pay 1.5 BTC to someone else, who has given you address A. Your end goal is creating a transaction that consumes the 2 BTC coin, and produces a 1.5 BTC coin (to the payee) and a 0.5 BTC coin (minus fee) back to a new address of your own wallet (called a change address). It's also possible to consume both the 1 BTC and 2 BTC coins, and outputs 2x a 1.5 BTC coin. Let's assume that's what you're doing.
How would you do this using the Bitcoin Core RPC? There are a number of ways:
The most automatic way
If you're using Bitcoin Core's built-in wallet (i.e. the Bitcoin Core wallet is what created the addresses involved, and it manages your coins), you can make it do everything. Just do:
bitcoin-cli sendtoaddress <A> 1.5

Where <A> is the recipient address. It will automatically determine which of your UTXOs to use, and create a transaction that spends those, pays <A> and creates change, then sign the result, and broadcast it on the network.
Manually but using the wallet still
If you want more control, you can perform the things sendtoaddress is doing one by one yourself, allowing you to observe the intermediary results.
The first you do is create a raw transaction that pays <A>, and nothing else:
bitcoin-cli createrawtransaction '[]' '[{"<A>": 1.5}]'

It will report a hex raw partial transaction with just that one output, and no inputs. Next you want to add inputs and change. You could do that manually (see further), but you can let the wallet do this for you. This is what fundrawtransaction is for.
bitcoin-cli fundrawtransaction '"<output from CRT>"'

This will give you another unsigned raw transaction, but now one that includes inputs (sufficient to cover the 1.5 BTC you're trying to send) and change (for whatever is left of the inputs spent after subtracting 1.5 BTC, plus a reasonable fee based on network estimation, and estimation of how big the transaction will be after signing).
Then you sign it, and broadcast it.
bitcoin-cli signrawtransactionwithwallet '"<output from FRT>"'
bitcoin-cli sendrawtransaction '"<output from SRTWW>"'

The advantage of this approach is that you can inspect the intermediary results at every stage (using decoderawtransaction amongst others), or make many changes to the process. Perhaps you have a multisig wallet with another device - and you need to make a pass by there doing another signrawtransactionwithwallet (or whatever equivalent that other device/software has for working with raw transactions).
Fully manual
If you want the most control, you can do everything manually - including the ability to include inputs that don't belong to your own wallet. This is the example you gave in the question, but if that's all you plan to do, you're much better off using one of the previous two methods.
As you pointed out, you first need to gather a list of UTXOs that can be spent. This can be done with listunspent, but you can also include other UTXOs - including ones from other people if you're participating in a CoinJoin transaction for example.
bitcoin-cli listunspent

Then you have to construct the (full) raw transaction, including the inputs you want to use from before, the output to the recipient, and including a change output back to yourself. If you want that change to go to you own wallet, you can use getrawchangeaddress (which is like getnewaddress, but will treat outputs to it as change rather than an incoming payment). You also need to manually estimate the vsize of the transaction will be after signing, determine a fee to use based on that (the block space market prioritizes transactions based on fee per vsize), and subtract that fee from the change you're creating. This is a bunch of work, and mistakes are easily made.
Next you'll need to sign the transaction. If you have the private key in your own wallet, you can use signrawtransactionwithwallet like before (note that signrawtransaction from your example no longer exists; it has been split up into signrawtransactionwithkey and signrawtransactionwithwallet). If not, you can either use signrawtransactionwithkey if you have the private key, or you could transfer the raw transaction to other devices/people, and sign there too.
Finally you'd use sendrawtransaction just like before.
Using PSBT
At this point I need to point out that all the raw transaction based transaction APIs have been superseded by the PSBT-based RPCs (see BIP 174). If you try to use the RPCs above you'll notice they really only work with simple scripts, and you need to pass a lot of information along everywhere. In particular, signrawtransactionwithkey will need information about the UTXOs again, the scripts used in those, what type of scripts they are. This is pretty painful, and easy to screw up.
PSBT is an interchange format for transferring/storing partially signed transactions, along with any information signers or other participants may need to be able to sign. It'll convey UTXOs, script information, information about the keys in it, ...
The equivalent of "manually but using the wallet still" would be:

walletcreatefundedpsbt instead of createrawtransaction + fundrawtransaction
walletprocesspsbt instead of signrawtransactionwithwallet
finalizepsbt to convert a fully-signed PSBT to a raw transaction
sendrawtransaction like before to broadcast the result.

The equivalent of "Fully manual" would be:

createpsbt instead of createrawtransaction
walletprocesspsbt instead of signrawtransactionwithwallet. There currently is no equivalent for signrawtransactionwithkey, but PSBT is supported by various other pieces of software (most notably, HWI which allows PSBT signing and other operations with hardware wallets.
Again, finalizepsbt and sendrawtransaction like before.

PSBT has a lot more utility functions, such as combinepsbt (mostly for multisig), joinpsbts (for doing CoinJoin-like things), decodepsbt and analyzepsbt that can tell you what to do next, utxoupdatepsbt to gather information from the UTXO set and add it to a PSBT file (which works even if your Bitcoin Core wallet is not involved), etc.
TL;DR
You can use a workflow with or without fundrawtransaction. If you don't use it, you have more manual control and aren't forced to use the Bitcoin Core wallet itself.

It's the best explanation that I saw. Thanks.

But I have some questions.

sendtoaddress - Does it automatically repay the change?

fundrawtransaction - Do I right understand that it's half automatized function what automatic find input, fee and auto repay the charge (if I point txhash only); also, I can set these parameters manually, as arguments with fundrawtransaction just like with createrawtransaction?

Yes, sendtoaddress (and its slightly more advanced version sendmany) does everything mentioned here, including adding change. 2. Pretty much, have a look at the documentation for fundrawtransaction.


text:
Need help can’t send Bitcoin
I purchased $40 worth of Bitcoin from a btc atm. I use this method to add to the same wallet every time a couple times a week. This time when it loaded to my wallet I needed to send it from there to another wallet on a site to use. It won’t send $32 saying I don’t have enough to cover the transaction fee. I look and see the transaction fee is $117.00??? When I’m sending $32 of btc? Why?

Which wallet software is this? Good wallet software will allow you to specify the feerate you desire, though you do need to understand how transaction fees and the mempool (transaction queue) work in order to effectively manage your UTXOs.

My funds are on Coinbase wallet


text:
Automatically forward bitcoins from address A to Address C At 0 confirmations?
I run a bitcoin full node,at that node i have an Address A.
Assuming that Address A receive an Amount from Address B.(i can get UTXO information from blockchain.info API)
How can I automaticlly resend the received amount To an Address C (on 0 confirmations) before its display in my wallet.
In fact i want to create a raw transaction with that UTXO information (txid,vout and amount) and send it to Address C.
That UTXO belong to my private key so i can sign it and send it to the network.
Transaction must be created and send to the network before block is confirmed, so that in most cases the receiving transaction and sending transaction are confirmed in the same block that is mined.
This is technically possible, because I have seen this many times (https://explorer.bitcoin.com/btc/address/1Nc4oHe7TeDNjnvGfm7ZB6Pi2YtkST9znn).
But the question is how ?

Why do you want to do this?

"Transaction must be created and send to the network before block is confirmed" Why do you need this? What is your motive?

I work for some kind of bitcoin development tests.
I just want to (receive and send) the same amount of BTC in the same block.
Address A-> Address B -> address C (in the same block).
In fact i want to create a raw transaction with the UTXO (that is not confirmed yet) sign it with my private key and send it to the network (that UTXO belong to me).
I was wondering if that possible or no.


text:
How does "importaddress" command in bitcoin-cli work?
I am trying to use "importaddress" in regtest mode. I have two bitcoin-core nodes running.  I generated address on one node, imported it on another node and then sent some coins to this address. If I run "listreceivedbyaddress 0 true" on the first node, I see right amount of coins on this adddress and right txid. If I run "listreceivedbyaddress 0 true" on the second node, I see zero amount of coins on this adddress and no txid.

Did you rescan after importing the address?

Yes, I did rescan after importing the address.

Are you sure the two regtest nodes are actually connected to each other?

Yes, I am sure. When I send coins from wallet on one node to wallet on another node I can see this transaction in "listtransactions" output on both.

What if you generate a block and confirm the TX?

Ok. You could check the logs on both nodes as well maybe there is a reason the unconfirmed tx wasn't accepted in the mempool of node 2, for example


text:
How would somebody compromise my identity if I generate new receive address in Bitcoin Core?

I open Bitcoin Core and generate a new receive address.
I publish this without mentioning my name, and make every effort to conceal my identity in every other way.
Some time passes (possibly months or years).
Some entity has figured out that I'm the owner of that "receive address".

How did that happen?
Can the Bitcoin network see which IP address is "receiving" money to a given receive address? Is there anything that leaks my IP address or any other identifiable information when creating, publishing or receiving money to a receive address?

Identity leaks usually happen in two places.
Off Chain Leaks
Here, the address is somehow linked to you off chain - this could be because you shared it from an account or network that can be traced to you (it's largely impossible to avoid being tagged online if a well funded and skilled group, such as nation states, is targeting you).
Alternatively, if you have sent funds to an address from an exchange or other wallet that has some link to your identity, off chain requests by law enforcement or other such authorities for your transaction data could link you to it quite trivially.
On Chain Leaks
Although modern wallets, especially Bitcoin Core, take steps to avoid this, there are scenarios where when spending funds from one address, you also include inputs sent to other addresses. If all your addresses do not have an equal level of privacy in how you shared them and received funds to them, transactions which spend from multiple addresses can create links that on chain monitoring tools use to identify clusters of addresses controlled by a single entity.
Thereafter, if any one address in the cluster is deanonymized, the entire cluster can be tagged to you retroactively.


text:
My receipt is Faded
Basically after purchasing my bitcoin from atm machines i put receipt in wallet by the time I went to use it some of the  the receipt was faded to were i can't read it and it won't even scan. What do I do?

I think you should contact ATM support. If the key faded to the point of being unreadable this board won't be a help.

https://www.google.com/search?q=reading+faded+receipts

Maybe try viewing the receipt under different lighting. Or take a clear, high-resolution photo of the faded receipt and use image editing software to adjust brightness, contrast, and other settings. I hope this helps.

In a way, you missed due diligence.
If I understand you correctly, you were using some kind of paper wallet scheme.
You should have created some copies of the paper wallet and properly replace them for new ones as they aged.
Or use a different way of key management. Each way comes at their different risks.

If you have a cryptocurrency wallet that you used to receive the Bitcoin from the ATM, check the wallet's transaction history. If the transaction was successful, you should see the incoming transaction in your wallet's transaction list. This will show the public address where the Bitcoin was sent.Or think back to when you made the purchase. Consider if you still have any other related documents, such as receipts from the time of the transaction or any notes you might have made.

I think the main point of the question is that many Bitcoin ATMs print a private key on the receipt that the buyer needs to use to sweep the funds into their wallet. So the question is not about finding where the funds went but accessing the funds in the first place.

Oh, I apologize for the misunderstanding. You are right; Thanks for pointing that out to me.


text:
Rewriting the blockchain?
The main bitcoin blockchain (the chain that miners choose to work on) is the chain with the most proof of work ("heaviest" chain). Currently, the cumulative proof of work on the bitcoin main blockchain is about 2^94 hashes.
I have a few questions here:
(1) How is the cumulative proof of work on a bitcoin chain calculated? Are they calculated by checking the timestamps (and thus the difficulty)?
(2) Let's say an adversary has an alien supercomputer he stole from Area 51. He uses this alien supercomputer to rewrite the entire bitcoin blockchain from the genesis block - by mining a private chain that is heavier than the current chain. Does the current bitcoin network have any method of defending against this kind of attack? (I know that checkpoints can prevent such an attack, but checkpoints are no longer in the current bitcoin protocol, as far as I know)
(3) What would be the consequences of a bitcoin blockchain rewriting attack? An instant crash in bitcoin price? Would bitcoin be essentially dead forever, or does the bitcoin network have a way to recover and go on?

There's no need to consider the timestamps in order to know the difficulty. The difficulty is stored in the blocks.
This is a bit speculative but in the past such threats have been discussed, more along the lines of the hash function being hacked, and I think in such cases there will be a large consensus to hard fork. If the hypothetical threat you're describing is basically an adversary with infinite free power then most like PoW would have to be abandoned. Let's worry about that we get there. ;)


text:
The digital trail is a "warrant" to recover transactions sent to BTC that were sent to wrong address
This is similar to a question already asked, but I disagree with the answers.  There is a big digital trail of the transaction.  To me, that is like mail delivered to the wrong house, but opened anyway.  It is a crime as is, I have suggested to the Bitcoin site I use, to have the sender and receiver have a "password" to open the wallet.  This way the unintended wallet has to return the BTC not intended for that wallet.  What is the point to have a long list of transactions and confirmations if Bitcoins promotes crime?
On my transaction, I entered the correct wallet, but on the "sending" part, a different un-"intended Wallet ID" replaced  the wallet I have.
I cannot find that other wallet anywhere on my PC, my cellphone, nor in any e-mail search I performed???.  There is an "order ID, a "destination wallet address, a Transaction hash," and other ID's on the receipt, so I think if I presented this to anybody, crime would halt because crime is unacceptable.
Besides, how does a TYPO turn into a "real wallet?"

Your proposed solution wouldn't solve the problem anyway. Anything that could make bitcoin go to the wrong address could cause it to be secured with the wrong password as well.

How do you suppose that?  I think the password is not venerated at the moment of purchase, but something already confirmed with Bitcoin, the sender, and the receiver.  You see, three confirmations needed; although just 2 are all needed.  How could the wrong address be associated, IF The wrong address was a typo that probably does not exist anyway?  It was already confirmed the checksum does not allow a typo to confirm a non-existent address.

Typos are already handled by the address checksum. The problem is either an attacker changing the destination or the sender using a previous destination. Both of those things could affect the password equally. You could accidentally reuse an old password/address and same problem. An attacker could swap in both their address and their password and steal funds.

Thanks for the information.  We are getting away from the topic, the wallet was my other wallet on a different Bitcoin site, Oops :).  The question I have is the trail is left with all the ID's so I think the BTC could be reversed.  I mean, the site knows the receiver, who claimed money not for actually intended for that wallet, so I think the transaction can be reversed.  If there is a fee, then it is understood because I made the mistake, but it was sent to my wallet, I just want it to go to a different wallet.

The value proposition of bitcoin is that its transactions are irreversible. There are no administrators or administrative functions whatsoever. If you want reversible transactions, you want something other than the bitcoin blockchain.

There is a big digital trail of the transaction. To me, that is like mail delivered to the wrong house, but opened anyway.

This analogy is off - with most "wrong address" scenarios, it is more along the lines of the piece of mail disappearing into nothing. There is no guarantee that an incorrect address belongs to anyone at all. The vast majority of the address space is unused.

I have suggested to the Bitcoin site I use, to have the sender and receiver have a "password" to open the wallet.

If the address you are sending to is not using the same wallet service you are, this is not enforceable. A wallet cannot impose requirements like this on a receiving wallet.

This way the unintended wallet has to return the BTC not intended for that wallet.

This isn't how Bitcoin works - as long as someone holds the private keys for an address, they are free to move or keep the coins as they wish.

What is the point to have a long list of transactions and confirmations if Bitcoins promotes crime?

Bitcoin solves many problems, but granting you access to funds that you claim are yours at an address that doesn't belong to you isn't one of them.

On my transaction, I entered the correct wallet, but on the "sending" part, a different un-"intended Wallet ID" replaced the wallet I have

It sounds like your device was compromised by one of many Bitcoin address changing malwares - they are specifically designed to wait for people to copy Bitcoin addresses, and then replace them with one belonging to the malware author.

There is an "order ID, a "destination wallet address, a Transaction hash," and other ID's on the receipt, so I think if I presented this to anybody, crime would halt because crime is unacceptable

The order ID here is irrelevant. All that matters is the transaction hash and destination wallet. As long as the transaction has been confirmed, no one can help you. In fact, you can't even prove that the destination address does not belong to you, as it is impossible to prove that you don't have a private key for it.

Besides, how does a TYPO turn into a "real wallet?"

In nearly all cases, it does not. Bitcoin addresses contain a checksum specifically to prevent against this. The probability of a typo producing a valid address is 2^32, so you almost certainly either copied an incorrect address to begin with, or have a malware changing copied addresses.

so you almost certainly either copied an incorrect address to begin with, or have a malware changing copied addresses.
Impossible.  I had the wallet on My PC and I had to type  it twice into the destination wallet, twice.  Besides, it was the first time I tried from my cellphone, so no Malware could be present.
granting you access to funds that you claim are yours at an address that doesn't belong to you isn't one of them.

granting you access to funds that you claim are yours at an address that doesn't belong to you isn't one of them.
Impossible.  I had the wallet on My PC so I had to type it into the destination wallet, twice.  Besides, it was the first time I tried from my cellphone, so no Malware could be present.

If the address you are sending to is not using the same wallet service you are, this is not enforceable. A wallet cannot impose requirements like this on a receiving wallet.
It is just a suggestion to prevent others from losing funds, too.  I did a search And I am NOT the only person with this error.  I Just had unanswered suggestions that are not requirements, so they can be suggested.  Only You took this as a requirement.

This analogy is off - with most "wrong address" scenarios, it is more along the lines of the piece of mail disappearing into nothing.
If it went nowhere, then Bitcoins can Easily be reversed.  I mean, the BTC or BCH is in nobody's hands, so the funds are still available.  The analogy is right on target.  You just said the address probably does not exist and the funds are in an unknown address.

@BitcoinH4ndl3r It is impossible to prove that it went nowhere - you cannot tell just by looking at an address if someone can spend funds from it. Additionally, reversals are impossible by design. Funds sent to an uncontrolled address are permanently lost.

Then why are there so many "trails?"  In the receipt, there is a destination, there is the sender, there is the transaction amount.  All show evidence that Anything can be done.  Besides, someone posted that a typo is nonexistent.  He said that there is a checksum to guarantee that a typo will not send BTC to a non-existent wallet.

They are uncontrolled addresses, but I think it was another of my addresses, so how do I find out the site where it was sent?  How is it impossible to prove it went nowhere, if there is a digital trail?  I think it is very possible because of the digital trail.  If it was all paper, the trail would lead to a location.  Bitcoins is supposed to be safe, but humans make errors, I think the sent BTC ought to stay in a secure vault as a grace period to make sure the intended wallet is real, unlike the typo that was created.

Cybercriminals Stole $1.4 Billion of Crypto in the First Half of 2020
• 2020: $1.4 Billion in crypto stolen so far
• Crimes are mostly instances of fraud
• Wotoken: Ponzi scheme stole $1 billion
(Read time: only 2 minutes)
Cover all the little holes, then stuff like this is more secure, too.

I noticed that I am not the only person, who has done this.  Most Bitcoin sites have a digital ID to replace entering a typo.  This is why I suggest there be a grace period of a certain amount of days before the money is available to be used by that wallet.  This way, the secure Bitcoins are safer to buy because if the wallet is uncontrolled, then the Bitcoins remain in my wallet where I can give permission if the receiver also approves or signs this as a real payment.

I noticed that I am not the only person, who has done this.  Most Bitcoin sites have a digital ID to replace entering a typo.  This is why I suggest there be a grace period of a certain amount of days before the money is available to be used by that wallet.  This way, the secure Bitcoins are safer to buy because if the wallet is uncontrolled, then the Bitcoins remain in my wallet where I can give permission if the receiver also approves or signs this as a real payment.
I suggest an safer way to cancel than just "cancel" because the mouses slip, so it has to be maybe a pattern to authorize

This process can end fraud because it requires 2 approvals.  Any ""cancellation can only be done by the sender, and if the receiver approves, it is overridden by the cancel, but , or a return payment issued by the bank.


text:
LND: How to use whole UTXO to open a channel?
How can I use an UTXO completely to open a Channel? Do I have to calculate the fees by hand to do this? If so, what would it be if I have a 1 million sat UTXO and set fees to 3sat/vB?


text:
If my wallet address changes, do I still get funds from old wallets?
No funds are lost but I have a question around my bitcoin wallet setup.
I am due some funds soon and I gave my address/wallet id (I guess address is the main thing). However, since then my wallet id and address has changed. I am not sure why or how but I did read that with transactions, the wallet address changes, and can't recall if I deleted wallets and recreated them.
Anyway, my question is, if someone sends bitcoin to my old address, does that get lost or would I still see it in my current wallet? What is the significance of the wallet id in this too?
Thanks

Addresses

if someone sends bitcoin to my old address, does that get lost

Addresses never expire. Money can be sent to them more than once although this affects your privacy.
Most wallets generate a new address for each transaction. They do this to protect your financial privacy. This isn't a case of your wallet address changing, it is a case of the wallet creating an additional address each time you indicate you want to receive money from someone. So nowadays there isn't a wallet-address as such because wallets have many addresses, not just one.

Wallet-IDs

What is the significance of the wallet id

Wallet-ID is not a general Bitcoin data item, it is not used in the Bitcoin network and is not used by mainstream wallets. So far as I know wallet-ID is only used by one commercial business, the one that operated the blockchain.info website that I think has been replaced by the blockchain.com website.
So Wallet-ID is proprietary and not anything to do with the Bitcoin network or the original design of Bitcoin or most Bitcoin wallets.
According to https://www.blockchain.com/learning-portal/wallet-faq

To log into your wallet you need your Wallet ID, your password, and any two-factor authentication that you have enabled. Your Wallet ID is a string of random letters and numbers that acts as a username. You can find it by navigating to the ‘General’ section of your Settings menu. Although it looks similar to an address, your Wallet ID cannot be used to send or request funds.

Wallet deletion

can't recall if I deleted wallets and recreated them.

If you deleted any normal, non-custodial, wallet, all money in the deleted wallet is lost when you deleted it. More exactly, you deleted the secret number that is stored in the wallet and which is needed when spending money. You deleted the secret number that gave you control over money.
With a normal wallet you would be able to recreate the deleted wallet from one of your regular wallet backups or from the recovery-phrase (AKA seed-phrase) you wrote down on paper (or stamped into metal) and stored in a fire-proof safe in a relative's house or similar locations. That way you recover control over money in the deleted wallet.
With a custodial wallet, you are completely dependent on what your chosen custodian is willing to do.

So on blockchain.com I made an account with my email address etc and had a wallet. That wallet, well its id and address, aren't present, but a different one now is. If bitcoin goes to the first wallet address, would I still see it in the current wallet?

You should ask Blockchain support. If you have a new wallet with a different Wallet-ID it might not know about money sent to addresses created by the old wallet that had a different Wallet-ID. This is yet another reason why I don't like the wallets provided by Blockchain.com. See types of wallet especially custodial vs non-custodial. "Account" implies custodial (bad in my book)


text:
Who chooses the nonce and the hash from a previous block?
When mining a block, who gets to choose the hash from the previous block, the nonce and its adjustment. Is it all the miners who choose or the ones who successfully found the block?
For either answer, how do they not know the correct answer to the nonce if they are the once who set it up?

Previous block hash

When mining a block, who gets to choose the hash from the previous block,

Nobody.
It isn't chosen. The current top block in the chain is known and its contents are fixed. The hash value depends only on the contents. Therefore the hash of the current top block is also a fixed value.
A good cryptographic hash algorithm, such as SHA256, produces a value that cannot be predicted from the data being hashed. Other than by doing all the work of actually computing the hash. Changing one bit in the data makes the hash result wildly different in a completely unpredictable way. The hashes look completely random.

Nonce

how do they not know the correct answer to the nonce if they are the once who set it up?

Nonces are not things that have an answer.
The nonce is just a numeric data item whose value has no meaning. It is provided for the miner's use as described below.

Hashes & Nonces in Mining
Lets look at the role of block-hashes and nonces in mining:
A new block has a header that contains a reference to the previous block. When creating their block template a miner must set the previous block reference to the block-id (hash) of the current top block in the chain of blocks. This is necessary for their new block to become the next top block of the chain. Each block links to the previous block.
Then the miner computes a hash of their new block and if the resulting hash value is higher than the network target the arrangement of data is a failure and they must change something in their block template and try again. One of the things they can change is a number in the block header provided for this purpose. That number is called the nonce.
If the miner finds a set of data that has a hash less than the target, they publish it. It takes a lot of tries before a set of data is found that has a low hash.
All nodes (wallets etc) check every part of the new block and either discard it or add it to their copy of the Blockchain.
One of the checks made by every node is to calculate the hash of the block to see if it is less than the network target. Nodes don't need to check all the miners failed arrangements of data, they only see the successful ones.

See What exactly is Mining?

When you say "One of the things they can change is a number in the block header provided for this purpose" do you mean all the miners or only a group of miners make this change?  I really appreciate your answers, thank you.

@Ghost. Outside mining pools, miners do not need to collaborate or share information. Conceptually at least, each miner acts in isolation. Each miner can create their own block template individually. Each miner can vary their template in whatever way they see fit. Each miner individually can do whatever they like with the nonce value.


text:
BTC Node for Dummies
Just downloaded, and I am now running a BTC pruned node.  Is there a good primer or beginner's guide to running it?  I have more questions than I think I can ask in one post.

I hope admins is not angry that I will share the link to another forum. On the bitcointalk.org/index.php?topic=5208641.0 you can find big discussion about pruned node - full node. There you will find a lot of useful information


text:
What is it that frees Bisq from all these KYC/AML laws and regulations?
I feel as if I should probably not ask about this, and instead just quietly go on using it in my little corner, not bringing any attention to its existence, but I still must ask:
What is it that enables Bisq (the decentralized exchange software/network) from not having to follow KYC/AML laws/regulations?
The obvious answer may be "it's decentralized", but let's be real: their website, forum and Github repo are all very much centralized, and this is the only way that I and 99% of its users would be able to get any updates, and probably for the already installed software to be able to fetch updates as well. Even decentralized applications always have some sort of "hardcoded bootstrap list of nodes", whether by hostname or IP address. Basically, decentralized anything is kind of an illusion in this Internet.
So, if it gets too big and thus poses a real threat, can't "they" just shut it down extremely easily by just taking away the domains/Github accounts, or just going after the public individuals who are known to run/develop the software?
Isn't it only because so few people use/know about it that they "get away" with this?

@Prayank Then how does Bisq find other nodes and fetch updates? Certainly not by magic.


text:
What would happen to Bitcoin if GPS/Galileo timing ceased to be available?
According to this web site, the timing from a system like GPS is essential to "financial networks [which] rely on precision timing for synchronization and operational efficiency."  Is the Bitcoin network one of those?

For example, does the "lock time" function rely on precise timing? https://coinguides.org/bitcoin-lock-time/

Also what about knowing the accuracy of blockchain timestamps?  Ref this answer: https://bitcoin.stackexchange.com/a/107019/120379

After perusing Satoshi Nakamoto's original paper and this web site, it turns out the only reason time stamps even matter is for implementing what Nakamoto calls the "moving average targeting an average number of blocks per hour" such that if blocks "are generated too fast, the [proof-of-work] difficulty increases."  According to the linked web article, the implementation also took potentially falsified time stamps into account, such that there is a 90-minute "maximum allowed gap between the time provided by the nodes and the local system clock" of the node trying to submit a new block.

Bitcoin needs approximately sundial time accuracy to operate. Computers have their own free running clocks which provide more than enough accuracy in the absence of other references, and NTP sources which are terrestrial rather than GPS based.
nLockTime and other internal tools are not based on local clocks, as there’s absolutely no guarantee that anybody in the network actually has an accurate one.
A situation in which time sync from GPS, GNSS, Baidu and Galileo were all unavailable would be rather apocalyptic anyway and would transcend the availability of Bitcoin.

thank you for guiding me to the NTP information.  I had no idea what that stood for until today! https://www.ionos.com/digitalguide/server/know-how/network-time-protocol-ntp/

I have heard that the modern financial system, including such simple things as an ATM withdrawal, relies on GPS timing.  I wanted to make sure Bitcoin is not just as vulnerable: https://qz.com/1106064/the-entire-global-financial-system-depends-on-gps-and-its-shockingly-vulnerable-to-attack/

@user24925 I just skimmed over S. Nakamoto's whitepaper on $BTC and could not see any specific reference to the level of timing accuracy required.  Do you have a reference?

The white paper is really an overview of the system, most of the things aren’t really spelled out as such. I don’t know of a reference for how timing works.


text:
Does blockchain "hold" funds?
I was talking to some friends and one mentioned to get paid bitcoin, blockchain wil only release funds to a trusted wallet with good history and transactions, and also something regarding "sequencing".
I was a little confused about this, could someone clarify this concept?

The Bitcoin blockchain

to get paid bitcoin, blockchain wil only release funds to a trusted wallet with good history and transactions

This is nonsense. At best it is very badly muddled and based on misunderstanding or severe miscommunication. At worst, a scammer is trying to confuse you into doing something foolish with your money.
The blockchain is a set of transaction data that has no information about wallets and needs none.
The blockchain is data. It is not an actor that can perform actions such as releasing funds.
The actors in the Bitcoin network are Bitcoin nodes in the form of ordinary wallets, miners etc. Bitcoin nodes do not need or use any information about other wallets or whether other wallet's history is good or bad.

Businesses with misleading names
There is a commercial business whose name includes the word Blockchain (one of several) who operate a website at blockchain.com (formerly blockchain.info).
They are no more in charge of the Bitcoin blockchain than dollar.com is in charge of the US dollar.
It might be that your friend is saying that this particular business has some rules about how it's customers can get back money they have paid to the business as a kind of Bitcoin-related investment. Sometimes the service provided to the customer is called an account, sometimes a wallet. Sometimes the thing that is called a wallet is really just an account and not a true Bitcoin wallet.
I don't have any experience with this business but your friend's statements don't match my limited understanding of that business either.
One of the main motivations for the invention of Bitcoin was to eliminate any need for this kind of business - for any kind of trusted third party of this sort.

Sequencing

something regarding "sequencing".

You might ask your friend to explain this but, since their other assertions seem obviously untrue, I would regard anything they say as needing careful confirmation.
In the Bitcoin network, you can't spend money before you have received it. That is a kind of sequencing. The purpose of Bitcoin mining is to create a globally agreed sequencing of transactions. You can see this in the blockchain as every block has a reference to the preceding block.

I assumed OP's "blockchain" was in reference to the company blockchain.info (it's still nonsense, of course).

@Pieter, this is a good point and I was just adding a section on that!


text:
one address multiple inputs one signature scheme
I have an idea and would like to know if current or future technology can allow it :
Assume 100 people with index i
each people has secret Ri
Secrets Ri are combined via an abstract mechanism to produce a public root address P0
everybody from Root address P0 and index i can compute address Pi
Only the ith people can spend from Pi via his secret Ri
assume a mechanism to aggregate signatures Si
So that a 100 people spend to a business investment address for example could use only 1 input address and 1 signature saving 99 signatures and 99 input addresses.
Is it feasible ? How hard would it be to implement on bitcoin ? Can we do that with Schnorr Signatures ?

Ok I figured it out, BLS signatures could do indexed key aggregation with m-n signatures

BLS signatures would need to be activated on Bitcoin mainnet (or a sidechain), they currently aren't available on mainnet. MuSig2 uses Schnorr and so is available on Bitcoin mainnet today.


text:
Using the Bitcoin Crate to Sign a Segwit Transaction
Using the Bitcoin crate, I'm trying to create a transaction programmatically in Rust that spends an output associated with a P2WPKH address. This is the relevant code snippet:
fn sign_transaction<SignFun>(
    own_public_key: &[u8],
    own_address: &Address,
    own_utxos: &[Utxo],
    mut transaction: Transaction,
    key_name: String,
    derivation_path: Vec<Vec<u8>>,
    signer: SignFun,
) -> Transaction
where
    SignFun: Fn(String, Vec<Vec<u8>>, Vec<u8>) -> Vec<u8>,
{

    let txclone = transaction.clone();
    let mut hash_cache = sighash::SighashCache::new(&txclone);
    for (index, input) in transaction.input.iter_mut().enumerate() {
        let value = get_value(input, own_utxos);    // Look up the value by finding the corresponding UTXO
        let sighash = hash_cache
            .segwit_signature_hash(index, &own_address.script_pubkey(), value, SIG_HASH_TYPE)
            .expect("Creating the segwit signature hash failed.");

        let signature = signer(key_name.clone(), derivation_path.clone(), sighash.to_vec()).await;

        // Convert signature to DER.
        let der_signature = sec1_to_der(signature);

        let mut sig_with_hashtype = der_signature;
        sig_with_hashtype.push(SIG_HASH_TYPE.to_u32() as u8);
        let witness_bytes = vec![sig_with_hashtype, own_public_key.to_vec()];
        input.witness = Witness::from_vec(witness_bytes);
    }

    transaction
}

When sending a signed transaction to my local Bitcoin node in RegTest mode, I get the following error:
error code: -26
error message:
non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)

I logged the following information:

Public key: 0377f5de845ac601f24e7cbf2e4abcc9e1040cd4ae971ecaa00837b1c74684e15b
Address: bcrt1qh3zle7xs34azdyycg8cpf9wx5nxjpcqyqv4eyc
Input spent with value: 625000000
Transaction to sign: 0100000001ceac446d9350730c2a886220bed7ae154ca3f717897819091d5e72dcd0f0895e00000 00000ffffffff0200e1f505000000001600148be949ae15ee4b5da9af0ce2bf8d3f3c43c582da26 dc4a1f00000000160014bc45fcf8d08d7a26909841f01495c6a4cd20e00400000000
Sighash: d7e5696f18363b58c84b8d57014d291c9f7ebbac562d219f7e7014b9a5685bbf
SEC1 signature: c10c09b210914e49f295c07c9f96352e085df9d2c4272292239445d6f89483bc64c9903bebaba4b bf998d217c80375c36b60b212a824b63435e30205b2ed5a6a
DER signature: 3045022100c10c09b210914e49f295c07c9f96352e085df9d2c4272292239445d6f89483bc02206 4c9903bebaba4bbf998d217c80375c36b60b212a824b63435e30205b2ed5a6a
DER signature with Sighash type: 3045022100c10c09b210914e49f295c07c9f96352e085df9d2c4272292239445d6f89483bc02206 4c9903bebaba4bbf998d217c80375c36b60b212a824b63435e30205b2ed5a6a01
Signed transaction: 01000000000101ceac446d9350730c2a886220bed7ae154ca3f717897819091d5e72dcd0f0895e0 000000000ffffffff0200e1f505000000001600148be949ae15ee4b5da9af0ce2bf8d3f3c43c582 da26dc4a1f00000000160014bc45fcf8d08d7a26909841f01495c6a4cd20e00402483045022100c 10c09b210914e49f295c07c9f96352e085df9d2c4272292239445d6f89483bc022064c9903bebab a4bbf998d217c80375c36b60b212a824b63435e30205b2ed5a6a01210377f5de845ac601f24e7cb f2e4abcc9e1040cd4ae971ecaa00837b1c74684e15b00000000

Note that a similar piece of code for legacy (P2PKH) transactions using the same ECDSA signer works perfectly, so I'm assuming the signer is okay.
Any help to figure out where the problem lies would be greatly appreciated!

p2wpkh is weird -- the scriptCode is not the scriptPubKey but this weird sythetic pseudo-legacy scriptpubkey. See BIP 143 https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki and search "The item 5:".

Thanks a lot for the tip! I wasn't aware of that. I'm not sure how the code needs to be updated, though. When printing out own_address.script_pubkey(), I get 0x0014{20-byte-pubkey-hash}. I changed it manually to 0x1976a914{20-byte-pubkey-hash}88ac based on the documentation you provided.
I updated the witness_bytes in my code above providing these bytes instead but the transaction was still rejected.
Next, I provided a script based on these bytes to segwit_signature_hash as well but that's not the solution, either.
Any advice on how to update the code correctly?

It's difficult to comment directly because your code doesn't work in isolation (e.g. I'd need to understand your signing logic) but in terms of general advice, I'd grab a known-working transaction off the blockchain and try to verify its signature with your logic. Once you've figured that out you have some assurance that your sighashing logic is alright and the problem lies elsewhere.

Thanks for the suggestion. I currently don't have any signature verification logic. I just run the code against bitcoind, which worked nicely for P2PKH using the same signing logic as mentioned above.
I think what would help the most is simply a working example for P2WPKH using the Bitcoin crate. My code is actually based on this implementation with all the deprecated parts updated. Unfortunately, I didn't find any code working with the current version of the crate.

Even when the rawtransaction is right, if you give the wrong script_pubkey, it will generate wrong sighash. Just try to make sure that you are giving the right one. Try giving p2pkh script_pubkey of your pubkey.
let public_key = PublicKey::from_slice(own_public_key).unwrap();
let script_code = bitcoin::Address::p2pkh(&public_key, bitcoin::network::constants::Network::Testnet).script_pubkey();
let sighash = hash_cache
        .segwit_signature_hash(index, &script_code, value, SIG_HASH_TYPE)
        .expect("Creating the segwit signature hash failed.");