text:
What do I do with a bitcoin I recieved?
I was given 1 bitcoin in a paper wallet as a gift.
How do I now convert this bitcoin to spend it?

You can buy all kinds of things from https://www.bitcoinstore.com/
You could also buy gift cards using bitcoin at http://www.gyft.com/
Finally if you want to sell your bitcoin for your local currency, you'd need to open an account at a Bitcoin exchange such as https://www.bitstamp.net/ - however this is the solution I like less because they require you to send them some personal information like your ID or bank account information to overcome fraud.

There's a nice video here that shows how to pull the BTC from the paper wallet to a Mycelium Android wallet.
https://www.youtube.com/watch?v=1pDSzOiFgIk
I would recommend you only pull out what you need to spend at the appropriate time, or follow the instructions in Mycelium to backup the wallet, just in case you lose your phone you don't want to lose 1 BTC with it.

You can spend it on wide variety of products on www.overstock.com
Look for other places accepting bitcoin using http://coinmap.org/
Or as already suggested, use an exchange like bitstamp or btc-e.
But first you would probably want to import your paper wallet to make a transfer. Take a look at https://blockchain.info/pl/wallet/paper-tutorial


text:
how to earn a transaction fee for transactions originating from my client
I am working on an online litecoin wallet system. For every transaction originated from our site, we need to charge say x% of the amount as fees and it'll be sent to Admin's address ? How can I do that ?
I guess paytxfee is what we are willing to pay others for a particular transaction, right ?
I didn't found any parameter to set the address to which the transaction fees should go ?
Looking for some help...

Not sure if I understand correctly.  You want to charge a fee, such as LTC .005 for a transaction that you originate, and then also (or in addition) collect the standard Litecoin transaction fee to pass along to the network?

how is the standard litecoin transaction fee collected and which address does it go to ?

It goes to the miner who incorporates that transaction into a block. This is not the sort of fee mechanism you're looking for. Just charge a bit extra.

@PieterWuille thanks, please put it as an answer so that I can accept.

By definition, "transaction fee" is the difference between sum of inputs and sum of outputs. It always goes to the miner.
What you need is to add an output payable to your account.

You mean to say make another transaction in the back-end for the fees from user-address to admin-address ?

source: Stack Exchange

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

sort: votes


text:
how to transfer coin using bitcoin rest API
I've been googling for quite some time now, but I was unable to locate any complete example, with the request & the POST/GET parameters to the Bitcoin JSON-RPC.
How to use the JSON-RPC ? How to use it to make a transaction ?

https://en.bitcoin.it/wiki/PHP_developer_intro

The list of json RPC commands is located on the wiki: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list
There is a list of json-rpc wrapper libraries on the blockchain wallet API page: https://blockchain.info/api/json_rpc_api
Pick a wrapper library for the environment you develop in and dive in.
To create a transaction, you're going to likely use "sendfrom" or "sendtoaddress".

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


text:
why we can't delete the trust line with ripple?
We can add trust line in our ripple wallet, but there is no option to delete this.
The only way we can do is just set the limit to 0.
why is this and what is the benefit from this design?

All a "delete" option would do is set the limit to zero anyway. And "delete" may imply to people that it does something to the balance. (Related, there has been talk of a "forgive", for positive or "pay back balance" for negative balances, option that would remove left over small, balances that are annoying to clear right now). Ripple is in beta, the JavaScript client especially so; so it just could be that the trust line interface isn't finished yet.


text:
Transactions show up on blockchain but not in multibit?
1JPEobzLgKo5EKEfDVN8aJ61Pdryse6ccf This address shows transactions I was not aware of for unknown reasons, and does not show up in multibit(version 0.5.16). Which one is accurate, and how can I sync them?

I reset the blocks many times in multibit and reopened the wallet. Is there an issue with the 3 transactions for this address?(I don't see an issue)
There is more going on here since I didn't request this money. If someone wants to claim it, I need to access it before I give it back.

Reseting the blocks won't do much if it's a network or memory problem.

Could these apparent transactions be related to current bugs being exploited at this time?

Absolutely not. It's 100% a syncing issue.


text:
How the disposable private keys are being shared in Lightning Network?
From the Lightning Network paper:

... once an updated commitment transaction is agreed upon, the previous commitment transaction pair is revoked by sharing the private keys needed to redeem those encumbered outputs. Thus, A shares its  (throwaway) private key, and B shares its throwaway private key. If A were to sign and broadcast a revoked commitment transaction, B could not only immediately spend its own output, but it has both A's key and its own to generate a transaction which can spend the output which normally go to A after a delay.

It's not clear to me how the throwaway private keys should be shared between the two parties. What if Alice shared her key to Bob but Bob refuse to disclose his? In that case Alice cannot spend the earlier commitment since otherwise Bob can steal her time-locked funds. But Bob could still spend his previous commitment without worrying his fund be revoked by Alice.
Is it considered an unfair situation? And how the protocol address the problem?

So the question is if it would be unfair to Alice if:

Bob wouldn't reveal his secret information and
Bob broadcasts the previous commitment transaction

Now, the only case in which Bob would broadcast the previous transaction is if it would have a higher balance for Bob. That would mean that the intention for the channel state update is that Bob would like to pay Alice for something. However, an update of a channel state (balance) is a two-step process:

Alice and Bob exchange the new Commitment Transactions
Alice and Bob invalidate their prior Commitment Transactions (by sending each other a (secret) piece of information)

That means as long as Bob doesn't reveal his secret information to Alice, the channel state is not considered as updated. Therefore it's perfectly fine for Bob to broadcast his previous Commitment Transaction as it represents the current balance. So it wouldn't be unfair to Alice, as from her point of view she hasn't been paid (yet) anyway. Only after she received the secret info from Bob, she would consider the payment as successful.

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


text:
Does high value of change sent back to yourself affect transaction fees? Keep the balance of hot wallet low or high?
I understand that when you are sending bitcoin to someone normally you should send some money back to yourself as change. Normally wallets do this automatically for you.(Wallets normally generate a new change address for each transaction, but I can do it by myself programmatically). Lets say I have a wallet thats a very active and need to handle multiple transactions per day, so not a traditional cold storage where you just top up bitcoin and hold but some kind of hot wallet that is responsible to pay people once certain action occurs on your website(for example e-commerce). From a security perspective you dont want to have too much money in your hot wallet for an obvious reasons but at the same time you want to have flexibility to send money to your customers when they need that.
For the sake of simplicity I will provide an example:
Imagine you have to send on average around 5 bitcoin a day and you can possibly have 2 scenarios. 1.You top up your wallet address every day with 7 bitcoin so it covers all possible payment orders(in case you need to pay more you just top up your deposit address again from your cold storage). Or the second scenario 2. You deposit 100 bitcoins to this address which means you will have enough money to operate your business most likely around 20 days without worrying about the balance and having enough money to send to your customer before the next top up.
The problem here:
If in the second case I will be sending quite a decent amount of money back to myself as a change, is the fact that the value of transaction will be significantly higher going to affect my transaction fees even if most of the money will end up in my new "hot wallet" address?
The whole idea of sending money back to myself as change for every transaction looks ridiculous to me. Does that even mean that lets say someone who has got 100000 bitcoins and this person needs to send only 1 bitcoin to someone that the person will have to send over 99000bitcoins as a change, what kind of ridiculous fee would need this person to pay to actually pay someone a small fraction of his wealth, literally in the traditional old school fashioned banking you have 50 billion dollars you can send 1 dollar to someone without moving 49 billion to a different account and paying another 900 million to do that. Can somebody clarify this for me and give me an actual example of an ecommerce store that wants to pay its customers, what is the most effective way of doing that.

Fees have noting to do with value being transferred. In Bitcoin network, you pay for space used, not value. Given that, a wallet must avoid having multiple small value change.
Let me give you an example:
Say A is an exchange and have one big UTXO with 100 Bitcoins, and it makes 100 withdraws, each one as a transaction. Then, each transaction has 1 input and 2 outputs, the input on transaction n is change from n - 1. Thus, all transactions pays the same fee, independent if the change is 0.0000001 Bitcoin or 100.
On the other hand, if this exchange has 1.01 Bitcoin, but in 100 small UTXOs, and wants to send 1 Bitcoin to someone, even though change is only about 0.01 Bitcoins, fees will be high because 100 inputs consume a lot of space.

thanks I think I understand that, I found some transactions on the mainnet and I am quite surprised so technically even if you are sending $10 to someone it can cost you more then coinbase making withdrawals of $100000 for multiple people.

Yeap! We had cases of people sending 1M worth of USD for like 10 cents. It depends on the transaction size and fee market, since fees are the size of a transaction multiplied by the fee/vbyte.

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


text:
mempool data lost after raising maxmempool and restarting
I'm running bitcoind 24.0.1 and changed maxmempool from 1000 to 2000 because I don't want to drop txs (I'm running an explorer) then I restarted bitcoind.
Just before restart getmempoolinfo reported this:
"size":           395462,                                                                                "bytes":       176566561,
"usage":       986487264,                                                                                "maxmempool": 1000000000,
On shutdown I caught this message: Dumped mempool: 1.33008s to copy, 12.6878s to dump
AFAIK this should indicate the mempool has been written to disk as is the default setting.
After restart getmempoolinfo reported this:
"size":             4351,                                                                                "bytes":         1535793,                                                                                "usage":         7678800,
"maxmempool": 2000000000,
Why did the mempool data not persist?

It should persist, but it may take a few minutes to load the mempool data again after restart, as all transactions get re-verified when loading them back.


text:
LND how to recover abandoned channel
Years ago I used LND's abandonchannel command to abandon two channels, it was stupid and I didn't know what I was doing at the time.
These are the only sats I ever lost.
Ever since, whenever I use the updatechanpolicy command to change the fees on my channels I get an error stating that for those specific two channels the fees can't be changed because the channels can't be found.
{
        "failed_updates": [
                {
                        "outpoint": "[redacted]:1",
                        "reason": "UPDATE_FAILURE_INVALID_PARAMETER",
                        "update_error": "channel not found"
                },
                {
                        "outpoint": "[redacted]:0",
                        "reason": "UPDATE_FAILURE_INVALID_PARAMETER",
                        "update_error": "channel not found"
                }
        ]
}

So somehow the channels have not been entirely removed from LND's DB.
When I look up the channel points in a block explorer I find that both UTXO's still exist so my channel partners have not been able to close the channels either. I have tried contacting the channel partners so maybe they could broadcast a close tx but had no succes there.
Is there any way to construct a closing tx and finally close these channels to onchain?
If not, how do I permanently remove them from the DB?


text:
Why does my bitcoin transaction has over 400 confirmations and still not in my wallet after a week now. My wallet is also correct when i cross check
I've used same wallet for multiple transactions and it's goign through but this very one is not yet in my wallet past a week now and i checked on the blockchain explorer it has more than 400 confirmations, I don't understand this!!

Does this answer your question? Why does my client not show funds that were sent to me?


text:
Does electrum gives wallet.bin file or if it didn’t then how can I access wallet.bin file?
I have one electrum file which extension is .bin and I know the passphrase too but when I open that to electrum it don’t accept my passphrase but passphrase is correct 100% how I can excess that .bin file do anyone know how to do that ?

Unfortunately, Dash is off-topic in Bitcoin.stackexchange.com, See https://www.dash.org/forum/index.php?threads/how-convert-wallet-in-bin.49131/

Well file is encrypted through openssl  while I use enc -d -aes-256-cbc -salt -in success.bin -out success.txt  it gives error input reading data can I see encryption type ? Or any useful things


text:
I have a privat key and my wallet adress but dont know where I made my wallet
How can I transfer the money to for example binance.
I have the private key and my wallet address but dont remember where I made the wallet (on which site).

Did you search in your email inbox which was the exchange?

Does this answer your question? I have lost my wallet, what can I do?

You don't need to know in which site you originally created your wallet, all you need to do is import your private keys to some wallet software you trust like, for example, Electrum wallet for BTC, Metamask/Trust wallet for ERC-20 token (i.e. WBTC). And then just transfer your funds from that.


text:
How to get information from electrum wallet?
I have my wallet file and it is encrypted with a password.
How to decrypt wallet file using code?
Encryption seems similar to Fernet.

The electrum FAQ answers "How is the wallet encrypted?" as follows:

Electrum uses two separate levels of encryption:

Your seed and private keys are encrypted using AES-256-CBC. The private keys are decrypted only briefly, when you need to sign a transaction; for this you need to enter your password. This is done in order to minimize the amount of time during which sensitive information is unencrypted in your computer’s memory.

In addition, your wallet file may be encrypted on disk. Note that the wallet information will remain unencrypted in the memory of your computer for the duration of your session. If a wallet is encrypted, then its password will be required in order to open it. Note that the password will not be kept in memory; Electrum does not need it in order to save the wallet on disk, because it uses asymmetric encryption (ECIES).

Wallet file encryption is activated by default since version 2.8. It is intended to protect your privacy, but also to prevent you from requesting bitcoins on a wallet that you do not control.

The above doesn't seem to me to be sufficient to decrypt the information but I expect inspecting some Electrum source code would provide the missing dertails.
Searching for decrypt electrum wallet file locates tools ind information that might be of some help.


text:
Are PubKeys from multisig scripts addresses?
Are PubKeys from multisig scripts addresses? I.e. are they ever HASH160'd and re-used as normal P2PKH addresses in the future transactions?

There is nothing that prevents that from happening, but it's not recommended. In general, it is not recommended to reuse public keys.

Are there known examples when multisig keys have been reused as P2PKH addresses?

You could scan the blockchain to find some, I'm certain they exist. But I don't know of any off the top of my head.


text:
Certain spent P2PKH outputs give error: Non-canonical DER signature
Certain rare spent P2PKH outputs give error: Non-canonical DER signature when I try to verify the spent output using both btcdeb (version 5.0.24) and bitcoinconsensus (version 0.20.2, using Rust bindings).
Here is a screen grab of btcdeb failure on the 0th input of the transaction a618dc10b8a1f9d9a1469b3bb84fc17da86df2d51c27e2aa16fa130953840735. The command to reproduce is:
$ btcdeb --tx=0100000001162e699cebb46e6f3fa9b99e82c792f394562ce7e6fda97980f1866f6ca7f251010000008c493045022100a9379b66c22432585cb2f5e1e85736c69cf5fdc9e1033ad583fc27f0b7c561d802202c7b5d9d92ceca742829ffbe28ba6565faa8f94556cb091cbc39d2f11d45946700014104650a9a1deb523f636379ec70c29b3e1e832e314dea0f791160f3dba628f4f509360e525318bf7892af9ffe2f585bf7b264aa31792744ec1885ce17f3b1ef50f3ffffffff0240a5ae02000000001976a914ed2533122ffd7f0724c424599206ccb23e89d6f788ac404b4c00000000001976a914c0ac87c28c943caead3e6d64663449bfc9f0a5ce88ac00000000 --txin=010000000415a71cebe8e2bc4b4b645f685dace9966a13aa1b12646b0dc808b368e49be2f6310000008c4930460221008aa83ca31a71a65f429ae46bf216f9cae8ea4474771ec996950821660f4611e8022100e2de287ac2e0edfa90b1363fde96ff0698495eb71e1460ec1e34f56912d3949101410431740cc7170cc597693a91662f4dcf78b3130900cf5f62f0104ae7f3d17856cc0f75780c7cfebd6bcce571fa3c69f2796fd3a7ab7b223750ffed25dabf198e85ffffffff2a5e1cd0f98718655093e50992762db461b09973640a011275634c7367a6c5af230000008a4730440220329aba7a3d19d07d371e001a4d74ee14d69a25b98ac13e5726ae85ce8c90d1c7022035bdb358186091d258fddd7cdf78657d1ddd8adbefd4b245f81d9d34c833475901410431740cc7170cc597693a91662f4dcf78b3130900cf5f62f0104ae7f3d17856cc0f75780c7cfebd6bcce571fa3c69f2796fd3a7ab7b223750ffed25dabf198e85ffffffff3f22f0f55ed55307e5afcb92c1af44065dbb53e147fe12f5544b0ffdc0d56efb1b0000008b483045022100dd6496bf066835511a8d5c0ef640d339dfff51e0263843177e6ecce4db155e89022058f99badfeae1638e463a53e4baac75663482b5c367a9d79fa93cdb9d9349e1a01410431740cc7170cc597693a91662f4dcf78b3130900cf5f62f0104ae7f3d17856cc0f75780c7cfebd6bcce571fa3c69f2796fd3a7ab7b223750ffed25dabf198e85ffffffff57f75b3a3412b5a3aeeaa12a0ed8a0c4158d942c6c0d671e1781abd7f41c5d47000000008a473044022037622097853da2b3f2757cb2d3776b5c0f88ec5aba4301c89cd933b02977185b02200c869b080e60b596b0f5540011be681b7b0b2cbead1730beca2653192481b50201410439363df8bfe1566aaa40c5812e9931df6d3cf97455c67dce7c1bf2f74f1564d5646ebae32a435015a68cb73ef14d8c1c8f311a19dbfb461cb161a9e2cfdad64fffffffff02b34c0f00000000001976a914ef9b3d09be64c9372c99c6de18ca225e108e63c688ac80f0fa02000000001976a9146482d425dc43ff3890071f13c07c42236e50833888ac00000000

Lib bitcoinconsensus gives SCRIPT_ERR_SIG_DER.
My question is, how these transactions ended up being put into the old blocks?

The requirement for canonical DER signatures was only added in the BIP66 softfork in 2015.
Before that time, such non-canonical signatures were legal, and your transaction predates the BIP66 activation.

How are those old signatures verified, now that OpenSSL has been removed from the codebase?

There is a custom ECDSA parser which supports all historical violations to the encoding: https://github.com/bitcoin/bitcoin/blob/v25.0/src/pubkey.cpp#L41

But this code is not compiled into the bitcoinconsensus lib? Is there a way to invoke it from there?

@AlecMatusis Yes, it is. ECDSA signatures are always parsed using this code. The logic for enforcing BIP66 is independent. in bitcoinconsensus it is enabled using the bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG flag.


text:
What are the various Bitcoin nodes available which I can connect to via my lightning node
I am thinking of running my own lightning node in testnet. Going through the tutorials it seems the lightning node needs to be connected to bitcoin node inorder to get connected to bitcoin network. But running a full bitcoin node like bitcoind seems out of my scope as I don't want invest and maintain it.
Are there any such services available which I can connect to my lightning node.

There are several implementations of a bitcoin full node (bitcoind, btcd, etc). Generally you do not want to trust a third party to provide you with the info that your node would, as they could easily defraud you. Note that product/service recommendations are off topic here.

I am thinking of running my own lightning node in testnet. Going through the tutorials it seems the lightning node needs to be connected to bitcoin node inorder to get connected to bitcoin network. But running a full bitcoin node like bitcoind seems out of my scope as I don't want invest and maintain it.

A Bitcoin testnet node block chain occupies less than 40Gb, is that really out of your scope and why?

Are there any such services available which I can connect to my lightning node.

This defeats the p2p trust-less nature of Bitcoin. Don't do that unless you trust the people providing it to you as much as you trust yourself.

Regarding running bitcoin node being out of scope, is that I just want node to assist me lightning node, as the primary focus of mine is to build something on lightning, and having  bitcoin node about mining and stuff is what I am not interested in.

Your Lightning node needs a way to know what Bitcoin transactions happened. The best way to get that information having access to a trusted Bitcoin node. Bitcoin nodes (yours, or someone else's) are necessary for pretty much all interaction with the network, not just for mining.

If I am running a bitcoin node do I need to set any static IP and export port for the peers in network to communicate to my node ?

You can run a C-lightning instance on top of a pruned bitcoind.
You can also opt in to a different Bitcoin backend than bitcoind by using a plugin. For instance the Sauron plugin connects to an Esplora instance, this is a more lightweight way to get started albeit you are trusting whoever operates the API.
A lightweight solution seems appropriate for testnet but if you get to use your node with real funds you should really consider you threat model, as again this method involves a direct trust relationship.


text:
Is there a list of processes within Bitcoin that use hash functions?
Hashing within Bitcoin is done in several different areas of the code. EG: We have the SHA-256 mining algorithm, the Merkle tree hashing, and I believe double hashing within certain areas (SHA-256D).
Hashing is all over the place in Bitcoin and I'm confused as to where the code hashes something for a particular reason.
Is there a list somewhere of all features/processes of Bitcoin that use a hash function in order to do something.

In Bitcoin's consensus rules (block and transaction validity rules):

Transactions hashes (txids and wtxids) are computed as double-SHA256 of their serialization (without and with witness data, respectively).
Block Merkle roots are computed by repeatedly pairwise double-SHA256 hashing, starting from the list of txids in a block, until only a single element remains. The same design is used for the witness commitment added in BIP141.
Block hashes are computed using double-SHA256 of the block header (which includes the Merkle root listed above). This block hash also functions as proof-of-work, so this hashing is the operation performed by miners at scale.
The Bitcoin scripting languages has opcodes OP_SHA256, OP_RIPEMD160, OP_HASH256 (= double-SHA256), and OP_HASH160 (SHA256 followed by RIPEMD16).
To compute the message being ECDSA signed in transaction inputs, double-SHA256 of a modified transaction serialization is used in both legacy and witness v0 inputs (see BIP143 for the latter).
In the upcoming "Taproot" protocol upgrade, single-SHA256 hashes are used for a variety of purposes: tagged hashes, script leaf hashes, script Merkle trees, and key tweaks.

In wallet standards:

P2PKH, P2WPKH, and P2SH addresses are computed as the RIPEMD160 hash of the SHA256 hash of the public key (resp. script) being paid to. They are verified by the OP_HASH160 opcode in the Bitcoin scripting language.
P2WSH addresses contain a single-SHA256 hash of the script being sent to.
P2PKH and P2SH addresses include a truncated (4 bytes) double-SHA256 based checksum to detect typos.
In the BIP32 deterministic key derivation algorithm, (an HMAC based on) SHA512 is used to compute child key tweaks and chaincodes.
In the BIP39 seed phrase standard single-SHA256 is used as checksum, and repeated HMAC-SHA512 is used for strengthening.

In the P2P protocol:

In the Bitcoin P2P protocol, a 4-byte checksum is added to every message, which is a truncated double-SHA256 hash.
The deprecated BIP37 Bloom filtering protocol used 32-bit MurmurHash3 to determine the bits set in Bloom filters.
In the BIP152 compact block protocol extension SipHash is used to compute 48-bit compact transaction hashes.
In the BIP158 client-side filtering protocol extension, SipHash is used to derive filter bit positions.


text:
Lost Bitcoins Help
years and years ago I invested in bitcoins and I also got some free for signing up somewhere and since then I have had a new phone and don’t even have that computer anymore so now I am unsure of how to find my investment. Is there anyway it can be searched using my name any of my old emails name social date of birth? Please help.

Welcome to the StackExchange. You're probably going to hate this answer, but there's really nothing you can do to find those bitcoins using personal information like your e-mail, SSN, DOB, etc.
Bitcoin addresses are generated randomly (usually by whatever app you were using). These addresses are generated using nothing other than pure math and have nothing to do with your personal details or characteristics.
Short of finding that phone or the device you used to generate that address you used to receive Bitcoin, it is likely impossible for you to recover this information. Even if you were able to figure out or remember your address, you'd need the private key to that address in order to "spend" those funds (I'm assuming once you found the wallet, you'd want to send the funds somewhere so you could sell the $BTC and cash out).
Words of Consolation
This is your first post on StackExchange and it seems you're not a frequent user of Bitcoin, so its likely you've already searched everywhere, read and tried everything you could before signing up to ask directly.
You said you received these bitcoins a few years ago, so their worth may have been negligible to you back then. Of course, now, they're worth $60k+. So even if you found just one, that would likely be like hitting the lottery in a way.
With all that being said, its likely those funds are gone. Initially, that's going to hurt - but don't beat yourself up about it. When Bitcoin was at $15k-20k in 2017, there was nothing but countless stories in the media about folks that had received Bitcoin randomly, forgot about it, heard about the meteoric price increase, searching for those funds again, magically finding them and then "hitting it big".
I'm personally very skeptical of those stories and its regretful how much coverage they've gotten because they make it seem as though this is a realistic outcome. In reality, the chances of someone receiving Bitcoin when it had negligible value, then forgetting about it until its appreciated 10-100x in value, yet somehow retaining access to the old devices & software they used to store that Bitcoin in a functional enough condition to actually operate said devices and extract that Bitcoin are infinitesimally small, you likely would have had as good of a chance of striking it big playing the mega millions lottery.
These words may not help at all, but its really best to not think of it as you screwing up, misfortune/bad luck, or "losing" anything. There's a non-zero chance that even if you found the wallet, you'd find out that you already spent those funds years ago and simply forgot. This happened to me once. I had some Monero some users sent me and I forgot about it for ages. I beat myself up for ages stressing over the location of the wallet, then finally found the information I needed one day.
Lo and behold, there was:
A) Way less than I remembered having (wasn't hacked; seeing the balance total jogged my memory)
B) Because of 'A', it turns out I had way less than I thought
You're not dumb, of course, but there's a chance your mind could be playing tricks on you, making you remember you had 10 bitcoins when maybe it was just 0.0010.


text:
Corrupt block found indicating potential hardware failure; shutting down
I am experiencing issues with both Bitcoin Core 0.20 & 0.22 on my 2020 iMac per the title.  I have run diagnostics (shutdown and +D) and on black startup screen it says "No Issues found. Reference code ADP000".
The size of Application Support\Bitcoin\Chainstate is "4,571,371,737 bytes (4.58 GB on disk) for 2,287 items".  I have a 2TB hard disk with 1.2TB used (so plenty of space). The last time I had an issue like this I deleted and reloaded the Blockchain from scratch but cant recall the exact steps.  As I have a relatively fast uncapped fibre connection so comfortable to reload from 2010.  I am stuck at the block 702544 of July 28 2021 at 16:54 (so only 13 weeks ago).  I have tried to add "prune = 550" in bitcoin.conf and it said pruning in load but no avail.  Please advise what I can do e.g. increase foldersize (?) or steps of what to delete so I can reload the entire blockchain?
Thanks


text:
How to identify off-chain related transactions on the Bitcoin network
My understanding is that if someone wants to sell and buy Bitcoin via off-chain transaction, that person needs to set up a payment channel(funding transaction) first and it will recorded on the blockchain. Similarly, when that person closes the off-chain transaction, the final transaction amount will be broadcasted back to the Bitcoin network at the end of the off-chain transaction.
It seems like the first transaction(funding transaction) and the last transaction will be recorded in the bitcoin network even though it's called off-chain.
I'm trying to analyze the Bitcoin transaction data and would like to know if there's a way to tell whether a transaction is a funding transaction or the final transaction resulted from the off-chain transaction. Does Bitcoin transaction data have any feature that tells you if a transaction is a source/result of off-chain transaction? Can I identify those transactions by using information from the columns like input or output?
Plus, if Bitcoin is sent from one Coinbase address to another Coinbase address, is it always an off-chain transaction?
Thank you.

Hello Sarah, did you find if it was possible to do so ?


text:
How to get list of Bitcoin Block Hashes by Block Number?
Suppose I want to obtain the block hashes for all Bitcoin blocks numbered 1 through 50,000. What would be the best way to obtain this information? I could write a web scraper to pull it off web-based blockchain explorers but that would take forever to run.

Easy enough with your own Bitcoin node.
for height in {1..500000}; do echo "$height `bitcoin-cli getblockhash $height`"; done


text:
How does bitcoin main its release cycle?
Bitcoin is huge these days more than its value I'm interested here how does they manage all of these
what is there release cycle?

how do the deploy? and where since there are thousand of nodes.
what happen if a bug occur? how do they deal with a buggy block?.

There is no person, business or other organisation in charge of Bitcoin.
Bitcoin has rules, but these are whatever rules the majority of Bitcoin users choose to follow.
Sometimes people disagree about what the rules should be. Then Bitcoin splits ("forks") into Bitcoin plus some altcoin which goes its separate way.
There are many independent groups of people who have created software that implements the Bitcoin rules. Each group has its own release schedule (or just adhoc releases)
There is one software project with a relatively long history that many people regard as influential. But many others think the software of this project is deficient in some important ways and therefore support other projects.
Many developers of different Bitcoin software pay attention to a public process of suggesting improvements to Bitcoin. This is what results in Bitcoin Improvement Proposals (BIPs). Many BIPs fall by the wayside and are ignored. Others get widespread public acceptance on their perceived merits.
No one deploys Bitcoin software globally. It is up to every person to decide what Bitcoin software they want to use and  how often they update it.
When a bug occurs in software, people report it to the software authors using whatever means the authors of that particular software have provided. Each has their own.
If a block doesn't follow the Bitcoin rules it is discarded by all Bitcoin nodes. All full nodes are able to independently and completely verify the correctness of blocks.

Who really controls Bitcoin?
Who controls the Bitcoin software?

No one deploys Bitcoin software globally. It is up to every person to decide what Bitcoin software they want to use and how often they update it.  is it Bitcoin Wallet or Client that does this?

The answer applies to any type of  Bitcoin software, P2P, client, server, wallet, exchange, Dex, ....


text:
How can I track transactions in a way that is not affected by their malleability?
All the recent problems caused by transaction malleability have brought to the center stage the fact that tracking a transaction id is not good enough.
So here is my question, what is good enough?
The best I can come up with, is to create my own hash of the transaction I want to track before sending it to the network. Let's call that hash "tracking id". That hash would cover only signed portions of the transaction. The elements hashed would be

for all inputs: txid, vout
for all outputs: amount, address

Given the fact that the transaction must still be declared valid by the official client, would this "tracking id" be robust enough to track a transaction no matter how it may have been covertly "adjusted" through transaction malleability?
If this scheme does not work, do you know of any way that would allow me to safely track the transaction?

Since none of the answers that were given were fully fleshed enough to properly answer my question, I'm posting my own answer which synthesizes everything that has been said:
The best way to track a transaction in a way that will be resistant to transaction malleability, is to actually track only the data that has been signed. To do so, I suggest using a double SHA256 of the signed data. The documentation of the OP_CHECKSIG script operation (and it's very useful diagram form hints at which procedure should be followed.
A transaction malleability invariant "Tracking Hash" can be obtained from a pay-to-pubkey-hash transaction by:

Verify the technical validity of the transaction, as is done the reference bitcoin client. This includes verifying the signatures of the transaction. This is a crucial step, if you don't do that, the tracking hash is useless.
double SHA-256 hashing all of the following things:

the version number
the number of inputs
for each input :

the transaction ID of the output to spend
the index of the output to spend
the sequence number
(Note: We intentionally do not hash the input script or the length of the input script)

the number of outputs
for each output:

the amount
the length of the output script
the whole output script

the lockTime

Doing this should give you a nice tracking hash, that will be the same for all equivalent transactions, no matter how it may have been modified by taking advantage of transaction malleability.
Note that this tracking hash is not part of the bitcoin protocol, so you will not find it in the blockchain, and you won't be able to look it up using blockchain.info.

What's the minimal amount of things to hash for this to work?

You must include every single byte that is signed, and must exclude every singly byte that is not signed. If you don't respect that, you'll be vulnerable to some type of transaction malleability. You must follow this list precisely.

The signing hash is immutable, since that's precisely what you signed. Using the signing hash to track the transaction should ensure you are not vulnerable to any malleability attacks.

But isn't there many different signatures in a transaction (one per input)? Or is signing hash something else?

The signing hash is the thing you sign to produce the signatures. The entire purpose of the signature algorithm is to ensure the signing hash cannot be changed, so if someone could change that without invalidating the signature, ECDSA itself would be broken and we'd have much bigger problems than malleability.

So there are as many signing hashes as there are inputs, correct?

No. There is one and only one signing hash for the transaction.

I'm sorry if I appear dense, but I can't find any reference to a TX wide signing hash here. Do you have a reference where I could find out more about it?

If I understand the OP_CHECKSIG flow properly, the signing hash you are referring to is actually different for each input of the transaction, since it is built by hashing a copy of the current transaction where all the txinput scripts of the inputs that are not being signed are zeroed out. So there is really one signing hash per input, but those signing hashes cannot be changed without invalidating the transaction.

Ahh, then you would have to build a signing hash where only the signatures are zeroed out. That would ensure you were protected from anyone changing the signatures in any way.

Well, with what you've just said, and the fact that I stated that the transaction has first been verified to be valid using the official bitcoin client, it seems that the solution I give in my question would be good enough.

I agree. Any hash of all the signed data and none of the signature itself should be safe.

Was there not a problem with the signatures themselves being malleable?  Someone could change the sign of the signature and the signature would still be valid? I may have misunderstood.

Yes, that's why you hash the signed data and none of the signature. They can change the signature all they want, it won't change the signed data.

It's obvious that given the malleability issue you shouldn't use the transaction hash to track a transaction. If your wallet software needs to track a specific transaction it should check its inputs against the block chain, and track it based on that.
The idea is to always rely on the block chain and check inputs/outputs for yourself. Don't rely on the transaction hash for identification purposes.

Edit: One way to implement a solution is to track the referenced output instead of the transaction hash. If you get two unconfirmed transactions, that have different hashes but use the same referenced output, you know something fishy is going on. Therefore a good way to start tracking things would be to make sure the referenced outputs (within an input of a transaction) are not being used more than once.

Yeah, thanks. My question already makes it obvious that I know that I can't use the transaction hash. Would my tracking id solution work though? What parts of the inputs and outputs should I track against?

Inputs are the crucial since they need to reference something in the block chain. Therefore I'd suggest tracking inputs. An output on the other hand can change (you can send different amounts to various people).

Once a transaction has 1 confirmation the Tx hash becomes immutable.
Tx hashes are widely used to track transactions (e.g., blockchain.info)
Therefore, I would rephrase your question to be:
How do I track a transaction from creation to 1 confirmation and capture the Tx hash that has been confirmed?
I think that's the right question.
Further, I'd specify that the solution should be implementable by the bitcoind API.
So... If I create Tx1 what API call should I use to determine if Tx1 has 1 confirmation?

You're assuming the block that holds the transaction is not orphaned. That can happen.

Correct, I'm aware of that problem. And with transaction malleability, it could be that when that orphaned block gets ejected from the main chain, then the equivalent transaction that is present in the main chain (if it is) may not have the same txid either.

You are correct - I forgot about orphaned blocks. So, you'd have to say it becomes statistically immutable after n confirmations; where n is a number that is sufficient for your purposes. Alternatively, you could say it is the transaction hash that matches your inputs and outputs contained in the longest chain.

This may be a good rephrase of the question, but it's not an answer. Should have been a comment to the OP.


text:
How many transactions are required on trust before I can withdraw money?
I am using Trust to purchase bitcoin.  I wanted to withdraw funds.  I was told I needed another five transactions before I could withdraw funds?  Is this a policy that so many transactions are required before you a withdraw funds?  If this is the policy does a certain amount of money needed to be spent on buying bitcoin to qualify for the five transactions in order to withdraw funds?

P.s. you are being scammed by criminals. Don't send them any more money. Report theft to your local police.

Hi Dawn, I've never heard of “Trust”. So, I'm not sure whether you're asking about the rules of your customer relationship with some Bitcoin brokerage, or whether as RedGrittyBrick suspects you're being misled by some scammer. Perhaps you could tell us a little more about what you're trying to do and who your business partner is. Please also check out the link that RedGrittyBrick provided.


text:
The impact of Mining relativne to supply and therefore the price of Bitcoin
What impact does Bitcoin Mining have to on the supply of the coin, and how does it reflect on the price per coin on the exhange. I am trying to understand better the Bitcoin Mining instituons and the price movement of Bitcoin relative to Mining and strategies that can be deployed by mainly from an investors standpoint of view. Don't know whether I am thinking about it accurately on how Mining impacts the supply and price of bitcoin.

What impact does Bitcoin Mining have to on the supply of the coin

I suspect it has very little effect. It increases the current ~19000000 supply by ~6 every ~10 minutes. It is pretty constant and therefore I doubt it has any real effect on market liquidity for example. The long prescribed halvings may have a surprising effect on market commentators moods.

how does it reflect on the price per coin on the exhange

Not at all. The Bitcoin mining process is well understood and has been for over a decade. The markets must long ago have factored this in. Prices are driven largely by "market sentiment", by the fears and hopes of emotional beings. The outbreak of war, the crash of an exchange - these things likely have far far more effect than the boring reliable continuation of a decade-long routine.
I suppose it might be interesting to look at historical data to see if the relatively sudden flight of miners from China had a noticeable effect on exchange rates.

What impact does Bitcoin Mining have to on the supply of the coin?
To state it plainly…it is the act of mining that creates the supply. For every block found by a miner, BTC coins are created; currently a little more than 6 every ten minutes. Miners are therefore the first to be in possession of the coins and will either hold it or sell it to pay some bills.
Since there are only 21 million coins that will ever be mined the product is of course a scarce commodity. If the miners who held on the coins for years decided to sell all they have for some reason (going out of business or lost faith in the product or their country regulations prevented them (I.e China)) they might flood the market with a product many are after. Which way the price goes in this case, could not be determined by the excess supply.
Given todays climate as we anticipate near events (ETFs and halving) the price may go up, but it would have nothing to do with an excess supply as in the case above. In fact, in rational markets it would go down.
In rational markets the supply meets the demand at various price points (factoring in the cost to make more or less of an item) as the price increases to a point, the demand usually falls simply because it would be more than they want to pay. For the Bitcoin market this has not held true because of one small caveat… the supply is limited, fixed and the demanders have deep pockets.
How does it reflect on the price per coin on the exchange?
The miners do not set the price. They can only hold out until an agreed upon market price between seller and buyer is reached. The price of course is what people are willing to pay, usually anticipating an upside or need.
The price for this scarce commodity has been based on its values as: deflationary; store of value; and of course its limited supply/uniqueness.
The only way I can image the supply would effect the price is if somehow a change was made to the protocols allowing more than 21 million coins to be mined, which of course can’t happen with Bitcoin.
From a miners perspective their major revenue is based on mining coins and collecting transaction fees where neither directly effects the price.


text:
What do I need to complete a Bitcoin bonus payment transaction?
It's my first time requesting payment for my Bitcoin bonus payment transactions, without information on my registration form. I've been trying to get my payment process completed transfer but stops in the ending of the transaction. How do I locate where the transfer is going? Or how do I receive and have it in my accounts?

Sounds like you are being scammed. This is not how bitcoin works.

Hi Adam, I have voted to close your question as a duplicate of the above question, because it sounds to me like you are in a similar situation as the asker on that topic. If I am mistaken, please let us know here on the topic either by editing your question post or a comment so we can help you reopen your topic. Welcome to Bitcoin Stack Exchange.


text:
Bitcoin code for PayPal
I am interested in one question, is it possible that someone protected the company's paypal account with bitcoin when making transactions

Hi Adriana, could you please elaborate your question? I do not understand what you mean with “someone protected the company's paypal account with bitcoin”.

a person uses paypal to pay for his services and when he wants to send money to someone, he asks for verification of the transfer in bitcoins. The account is supposedly protected from fraud that way. When, for example, bitcoin is paid to moonpay, he only asks for a code from the mail that arrives as confirmation that it was successful  buying bitcoins

is it possible that someone protected the company's paypal account with bitcoin when making transactions

No.
That sort of nonsense is typical of the approach used by confidence tricksters (con men) who are trying to confuse you and pressure you into unwittingly giving money to thieves.
Often they will send you some kind of fake money (that looks real but can later be cancelled) and ask you to pay them a small part back in real money (using a method that can't be cancelled). They end up with your money, you end up being chased by a bank for a debt. You can end up with a wrecked credit rating and a criminal investigation for money laundering etc.
See

Is it normal to be asked for an advance fee on a withdrawal?
Sugar Daddy Bitcoin


text:
Bitcoin Core shows addresses that Electrum says don't belong to my wallet (imported MPK via EPS). What is going on?
I got a full node (pruned) up and running with Bitcoin Core via Tor. I installed Electrum Personal Server (EPS) and connected my hardware wallet with Electrum via Tor. I generated a watch-only wallet in Bitcoin Core of my hardware wallet by providing the master public key in the config.ini file (no other master public keys, only the one of my hardware wallet as shown on Electrum). Everything works: I get the green circle in Electrum, saying I'm connected to (only) my own node, and I can watch my wallet in Bitcoin Core.
However, Bitcoin Core's "receiving addresses" show addresses that do not belong to my wallet according to Electrum. I tried to send a test amount to one of the addresses in Bitcoin Core that were not shown in Electrum. This transaction now shows in Bitcoin Core as belonging to one of my watch-only addresses but does not show in Electrum. The ismine("address") command in Electrum returns false. I also can't sign messages with the address in Electrum with my hardware wallet connected as Electrum says the address doesn't belong to the wallet.
I double checked that only one MPK is mentioned in EPS's config.ini file, and I also created a new wallet in Bitcoin Core and resynced the EPS. Same problem: my wallet now shows a different amount in Bitcoin Core (including the abovementioned address) than in Electrum (excluding that address). Bitcoin Core is showing many other addresses that are not present in Electrum, besides this one that I sent a test transaction to.
How is this possible? The Bitcoin Core wallet has private keys disabled + blank wallet and is named "electrumpersonalserver", so it should be dedicated to EPS and since I only imported and master public key, shouldn't it contain only addresses derived from that one master public key?
Is the issue that Bitcoin Core has derived an address from my master public key that Electrum hasn't generated yet? But I'd think that Electrum should recognise all addresses that belong to the wallet (and ismine returned false and I can't sign messages with the address in my Electrum wallet as it says the address doesn't belong to the wallet). Or shouldn't I have imported the master public key through the EPS config.ini file (and rather imported it through the Bitcoin Core console)?
I would be very grateful for any help and insights into what's going on here. Many thanks in advance!

Uh, you specified something in Bitcoin Core's “config.ini”?  Did you mean bitcoin.conf or wallet.dat? Could you clarify which app you specified the MPK for and how you generated the “watch-only” address in Bitcoin Core?

I was referring to Electrum Personal Server (EPS)'s config.ini file (not Bitcoin Core's files).

How is this possible?

This might happen if you didn't tell Electrum to use the "derivation path" that Bitcoin Core uses.
A less likely cause might be the "gap limit"

Related questions

Default derivation paths

Thanks! It turned out to be the gap limit. Aligning this in Bitcoin Core and Electrum fixed the issue.


text:
unlock non standard script
i transferred some coins to a testnet address 2MwP5KwNRsQV5cf3T7VcFU4Vhj2LcUeMiLM with a locking script just to play with scripts. the locking script is OP_1 OP_2 OP_ADD (always evaluates to true).
how can i get the coins from this address? (not for the coins, but to learn bitcoin script)
the address was made with bitcoin-cli decodescript 515293
...
  "p2sh-segwit": "2MwP5KwNRsQV5cf3T7VcFU4Vhj2LcUeMiLM"
...

(btw i know you can now claim the 1000 test sat, but please tell me how)

Take a look at the section about spending a p2sh in the learning bitcoin from the command line course. It mainly refers back to previous sections explaining the single steps but I think your question is about the variables that you need to put into the signing-transactions-command.
In the example it says:

[...] signing requires entering extra information for the (1)
scriptPubKey; (2) the redeemScript; and (3) any required private keys.
Here's the example of doing so for that P2SH-embedded multisig in
§6.2: $ bitcoin-cli -named signrawtransactionwithkey hexstring=$rawtxhex prevtxs='''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout', "scriptPubKey": "'$utxo_spk'", "redeemScript": "'$redeem_script'" } ]''' privkeys='["cNPhhGjatADfhLD5gLfrR2JZKDE99Mn26NCbERsvnr24B3PcSbtR"]'
With any other sort of P2SH you're going to be including a different
redeemscript, but otherwise the practice is exactly the same.

Does that help?

The scriptPubkey above is a P2WSH nested in P2SH.
In order to unlock this coin:

Put P2WSH payload into input scriptSig.00204a3babc5f8f8f5f67b6331c18931e6f198b6cf576b0f3747314d11dedddf97c5
Put P2WSH's witnessScript(redeemScript) into input witness. 515293

https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#P2WSH_nested_in_BIP16_P2SH


text:
problem sending relative locktime (OP_CSV) transaction
i tried making a relative timelocked transaction with 1 block timelock (spendable after 1 confirmation)
funding tx:
0fda5412da2a2615361914fad007aac73154746108d44c04529e78f6c4424655
address: tb1qkrz7wne7p05fkgpzk8w9w8pzqswp85zcwcckr4s2z02qr03ksp6qmfduak
script:
$ bitcoin-cli -testnet decodescript 21020a14f343fa6b145921de84ff593e16007dcceba46550e2175e86cc14a8cf40cbad51b2
{
  "asm": "020a14f343fa6b145921de84ff593e16007dcceba46550e2175e86cc14a8cf40cb OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY",
  "type": "nonstandard",
  "p2sh": "2NFQbJj3QRhDXEa1TVoA92q5Ssygv7i4kK3",
  "segwit": {
    "asm": "0 b0c5e74f3e0be89b2022b1dc571c22041c13d058763161d60a13d401be368074",
    "hex": "0020b0c5e74f3e0be89b2022b1dc571c22041c13d058763161d60a13d401be368074",
    "address": "tb1qkrz7wne7p05fkgpzk8w9w8pzqswp85zcwcckr4s2z02qr03ksp6qmfduak",
    "type": "witness_v0_scripthash",
    "p2sh-segwit": "2N8xFW1ta5EhgMtsqRx32DCGwbUrey4rwvN"
  }
}

spending tx but it gives an error
01000000000101554642c4f6789e52044cd40861745431c7aa07d0fa14193615262ada1254da0f0000000000010000000179030000000000001600140aa46507f4b5c291f40224a8cb62cca18222d56d0247304402203216b9f5518ae00a8d8d16bf7c73376cc77c1f81bece6c3f4daac7f906e7030102201961be0b1464d3637e566765a37da6885e94b91155dbba4373d269840b4125f4012521020a14f343fa6b145921de84ff593e16007dcceba46550e2175e86cc14a8cf40cbad51b200000000

my first try also failed with the same error, it was a relative locktime of 5 blocks
address: tb1qmsws55wqcg6glcrk9urnjqfw0mpqp6uralha5y99wf8pvnh3sqjs8cm92l
script:
$ bitcoin-cli -testnet decodescript 21020a14f343fa6b145921de84ff593e16007dcceba46550e2175e86cc14a8cf40cbad55b2
{
  "asm": "020a14f343fa6b145921de84ff593e16007dcceba46550e2175e86cc14a8cf40cb OP_CHECKSIGVERIFY 5 OP_CHECKSEQUENCEVERIFY",
  "type": "nonstandard",
  "p2sh": "2MuimPJ2k6SArD9aCchJDdWbVHeyR2cBoUo",
  "segwit": {
    "asm": "0 dc1d0a51c0c2348fe0762f0739012e7ec200eb83efefda10a5724e164ef18025",
    "hex": "0020dc1d0a51c0c2348fe0762f0739012e7ec200eb83efefda10a5724e164ef18025",
    "address": "tb1qmsws55wqcg6glcrk9urnjqfw0mpqp6uralha5y99wf8pvnh3sqjs8cm92l",
    "type": "witness_v0_scripthash",
    "p2sh-segwit": "2N1iz6k1KgHRsYNWT64HF2fcCQduJ22DYfH"
  }
}

tx:
0100000000010171ea228f6f77c4a4fc427ca35cb09889d61673671d7321c07a2ceb5b653d62d90000000000010000000179030000000000001600140aa46507f4b5c291f40224a8cb62cca18222d56d02483045022100f33f68f8b67ab722ea82a125287bfd3d9cfd920df8a41d6286790e4fe65afe770220780cbc8b3b8d44fcc08237e7133c86d1a73b2d55cd3dadc0d850416fdd7e0164012521020a14f343fa6b145921de84ff593e16007dcceba46550e2175e86cc14a8cf40cbad55b200000000

error:
(-26)  non-mandatory-script-verify-flag (Locktime requirement not satisfied)

OP_CHECKSEQUENCEVERIFY is only available for transactions with their version number set to 2. Your transactions have a version number of 1, and so they fail.

thanks, after setting the version to 2 and signing them again they both went through.


text:
In ScriptSig, which form of the public key is considered canonical?
In the standard pay-to-pubKeyHash scriptSig, which form of the public key should be used. My understanding is that both the compressed (33 bytes) and the expanded (64 bytes) are both valid.
Is there any of these two that is considered "standard"? Will the reference implementation propagate transactions containing either form, or will it withhold one?
IMO, I should use the compressed version since it will result in smaller transactions.

Both are valid and accepted as canonical. They are NOT interchangeable however - the same public key in compressed form is hashed to a different address than that in uncompressed form. You can only use compressed form if the unspent output address is compressed.

One isn't canonical over the other but if you are creating new keys there is no reason to use anything but compressed keys.  So you could say uncompressed keys are deprecated for new key creation.   If you are writing wallet software or other tools it would be good practice to always create compressed keys by default.  Uncompressed keys have no advantages and they make each input in a transaction 32 bytes larger.
Now for transactions involving existing keys you must use the form which hashes to the PubKeyHash provided in the PkScript (output script).
This private key:
72F3F4D20089ACFF5406AE394D575466FA97790CB27BDCEC08B288C44C924622

has a public key in both of the following forms
04C02D446392E6FF2A5A80256C41F00251F22E5657A9C9889596DD44501F335F73B8CE4F74EF058871FDA861A3C642600743F5D5CA83660656AF296B66A49BD68A

02C02D446392E6FF2A5A80256C41F00251F22E5657A9C9889596DD44501F335F73

they however hash to different PubKeyHashes
3294837233cf5e8b458fad15b7581e0dd5027ace (for uncompressed key)
fe9a562ce1129ecf42ec1e65cf4872049280082d (for compressed key)

So if you are trying to spend an P2PkH output which is locked to the PubKeyHash 3294837233cf5e8b458fad15b7581e0dd5027ace the ScriptSig in the input must be created using the uncompressed key.  The scripting langugage will not check both forms.  It just directly hashes the pubkey provided and verifies that it matches the pubkeyhash in the output.  Remember an address is the pubkeyhash encoded in base58 so the output form is going to depend on which address you provide the sender.


text:
Is there any regulations on buying and selling Bitcoin on eBay?
I see a lot of people selling Bitcoin on eBay. Since the government began regulating exchanges, are there any rules you have to follow now to sell Bitcoins on a site like eBay? Additionally, are there any rules you have to follow when buying from eBay?

According to eBay's Stamps, Currency and Coins Policy:

Virtual currency must be listed in the Classified Ad format in the Coins & Paper Money > Virtual Currency category. These requirements apply regardless of whether the virtual currency is digitally or physically delivered. Examples of items subject to this policy include Bitcoins, Litecoins and other similar cryptocurrencies.

In particular, it appears you are currently not allowed to auction Bitcoins.


text:
How can I convert a wallet.aes.json file from Blockchain.info to a wallet.dat file?
I'd like to convert my Blockchain.info wallet to a local Bitcoin-qt wallet. How can I do that? (I am fine with using command line tools.)

The way I go about it is as follows:

Login to Blockchain.info and choose export
Export data as BITCOIN QT
Note the private key in the form 5Hxxxx or 5Kxxxx or 5Lxxxxx. Copy and paste this string (or hand write it to be safer; it's case sensitive and has no 0/O, l/I)
Open Bitcoin QT; click help>Console
Type importprivkey PRIVKEY NAME where PRIVKEY is what was copied and pasted and name is the name for the address eg MAIN1
If wallet.dat is encrypted you'll need to type: walletpassphrase PASSWORD 180
Be sure to encrypt your wallet again
Move funds from Blockchain wallets to a new address in case you're concerned about malware monitoring copy/paste

Anyone want to comment why the above is not right?

Be sure to encrypt your wallet again What do you mean? It will automatically re-lock after 180 seconds.

authors: أبو عبدالرحمن الشرقاوي


text:
problem with unlocking P2WSH
i made a P2WSH address with bitcoinjs-lib from a script. the same script results in the same address with bitcoin core. I made an unlocking script and tested the combination with btcdeb and everything looked fine, so i sent some sats to the address and tried unlocking it. however, bitcoin core gives me this error when trying to broadcast the transaction.
non-mandatory-script-verify-flag (unknown error)

the script is made by adding t times OP_OVER OP_SUB OP_1 OP_EQUALVERIFY and OP_0 OP_EQUAL to the end
you can run the code by putting it in a file in https://github.com/antonilol/btc_stuff and running npm i. (for bitcoinjs-lib package and files btc.js and btc2.js) on a node running testnet
my code:
const { send } = require('./btc')();
const { bech32toScriptPubKey } = require('./btc2');
const bitcoin = require('bitcoinjs-lib');
const network = bitcoin.networks.testnet;

const witnessScriptPiece = bitcoin.script.compile([
    bitcoin.opcodes.OP_OVER,
    bitcoin.opcodes.OP_SUB,
    bitcoin.opcodes.OP_1,
    bitcoin.opcodes.OP_EQUALVERIFY
]);

const l = witnessScriptPiece.length;

const witnessScriptEnd = bitcoin.script.compile([
    bitcoin.opcodes.OP_0,
    bitcoin.opcodes.OP_EQUAL
]);

const t = 3;

const witnessScript = Buffer.allocUnsafe(l * t + witnessScriptEnd.length);

for (var i = 0; i < t; i++) {
    witnessScriptPiece.copy(witnessScript, i * l);
}

witnessScriptEnd.copy(witnessScript, t * l);

console.log('Locking script: ' + witnessScript.toString('hex'));

console.log(
    'send 1000 sat to ' +
    bitcoin.payments.p2wsh({ redeem: { output: witnessScript, network }, network }).address
);

const tx = new bitcoin.Transaction(network);

// const txid = 'b37fc02fda463403a4d077863d163f6c2738659a4bba77284711ea8eeb95fc7d'; // t=17 vout=0
const txid = '407e7513afdd4baedeac62870acb7e426a6f7aa85ca45f7e54411e8b74d8876c'; // t=3 vout=1
const vout = 1;

tx.addInput(Buffer.from(txid, 'hex').reverse(), vout);
tx.setWitness(0, [
    ...Array(t + 1).fill().map((x, i) => {
        const b = Buffer.allocUnsafe(1);
        b.writeInt8(i);
        return b;
    }),
    witnessScript
]);

const fee_sat = 110;
const input_sat = 1000;

tx.addOutput(bech32toScriptPubKey('tb1q3my0fxc7n5sfx9c76p9mdyk6ly6j22wgp644q6'), input_sat-fee_sat);

send(tx.toHex()).then(console.log)

raw tx hex it produces for t=3:
010000000001016c87d8748b1e41547e5fa45ca87a6f6a427ecb0a8762acdeae4bddaf13757e400100000000ffffffff017a030000000000001600148ec8f49b1e9d2093171ed04bb692daf9352529c80501000101010201030e789451887894518878945188008700000000
t=17:
010000000001017dfc95eb8eea11472877ba4b9a6538276c3f163d8677d0a4033446da2fc07fb30000000000ffffffff017a030000000000001600148ec8f49b1e9d2093171ed04bb692daf9352529c8130100010101020103010401050106010701080109010a010b010c010d010e010f01100111467894518878945188789451887894518878945188789451887894518878945188789451887894518878945188789451887894518878945188789451887894518878945188008700000000

The error you are encountering is the requirement for the minimal encoding of data. Specifically, your witness stack contains 0x00 for the number 0. However this is not the minimal encoding of 0. Rather the minimal encoding for 0 is an empty vector. So your transactions should actually be
010000000001016c87d8748b1e41547e5fa45ca87a6f6a427ecb0a8762acdeae4bddaf13757e400100000000ffffffff017a030000000000001600148ec8f49b1e9d2093171ed04bb692daf9352529c805000101010201030e789451887894518878945188008700000000
010000000001017dfc95eb8eea11472877ba4b9a6538276c3f163d8677d0a4033446da2fc07fb30000000000ffffffff017a030000000000001600148ec8f49b1e9d2093171ed04bb692daf9352529c81300010101020103010401050106010701080109010a010b010c010d010e010f01100111467894518878945188789451887894518878945188789451887894518878945188789451887894518878945188789451887894518878945188789451887894518878945188008700000000

thanks, it worked. i also have it fixed in my javascript code now! (allocate 0 bytes buffer if i == 0)


text:
Bitcoind JSON-RPC - getbalance with 0 confirmations not included
When I access bitcoind through JSON-RPC and query:

getbalance '*' 0

It does not include transactions with 0 confirmations.
Only when a transaction has least 1 confirmation it is included in that rpc call.
Bitcoin-Qt correctly shows the number I want to get in Overview > Wallet > Unconfirmed
I am using Bitcoin 0.8.6 beta


text:
Bitcoin security/vulnerability on computer backed up by cloud?
I understand that BTC are stored as file in wallet.dat on hard/external drives.

Is there an added layer of security to Bitcoin storage when the computer is backed up by a trusted cloud storage company, or does this make BTC more vulnerable to raids/theft?
Does this redundancy allow remote access to BTC wallet without increasing security risks?
Can the third party (cloud storage company) access/steal BTC value of wallet.dat?

first you have a misconception, BTCs are only stored in the blockchain, wallet.dat stores public/private keypairs of your addresses, addresses can have or not BTCs to spent but that's irrelevant for the storage.

Bitcoin has nothing like a API for backups, but it does have encrypted wallets so you can encrypt your wallet file and you only will be able to use it if you remember the passphrase.
Having your wallet.dat file in several computers and actively using it in several pcs can cause address loss (and BTC in those addresses) see: If I backup my wallet.dat once, am I forever safe?
If the wallet.dat file stored in external sites is not ciphered and someone has access to it, yes that entity wil be able to "steal" all current and future coins on that addresses.


text:
Is there any way to mathematically optimise Bitcoin transfer fee?
Say you want to transfer X amount of Bitcoins between wallets and Y amount of transaction fee will be levied. Now you have option to send extra Bitcoins for the same amount of transaction fee, so how can you calculate what is the maximum amount of Bitcoins that can be transferred for that Y amount of transaction fee?

The network fee doesn't depend on the amount of BTC that you're sending, it depends on the total size of the transaction. So there is no such thing as "maximum amount of BTC that can be transferred". You transfer as many BTC as you want and you determine the fee per byte. The miners will include your transaction on a block depending on that fee.
To calculate an optimal fee I recommend you have to take a look at the mempool taking into account that the transactions with greater fee will be processed first. In general, except that you're on a hurry or the mempool is overloaded, a fee of 5 satoshis/byte would be enough.
For further details take a look into How is transaction fee calculated?


text:
Size of the Bitcoin network
Does anyone know where to find the size of the Bitcoin network?  Is the user adoption still growing even as the price in USD continues to drop?

What is "size"? Number of people who hold BTC? The number of people with a non-custodial wallet? The number of wallets? The number of nodes? The number of full nodes? The number of businesses? The amount of BTC transacted?

Does anyone know where to find the size of the Bitcoin network?

There are lots of different ways to define what that means and few ways to measure them.
If, for example, you search for "number of Bitcoin nodes" you might be led to several websites such as https://bitnodes.io/dashboard/7y/ and others that claim to show the number of reachable nodes in the last 24 hours.
I guess these are discovered using the Bitcoin Network Protocol's addr messages and attempt to count the number of Bitcoin nodes that respond on port 8333. Of course they may miss nodes that are temporarily offline. They might double count nodes that have multiple network addresses or which change address frequently. There must be many Bitcoin participants that might not show up, such as: Nodes configured to not accept inbound connections but which still initiate connections themselves; SPV clients or clients that are only active for a short while. I imagine such counts tell us nothing about the number of people who create transactions or who receive on-chain payments through a custodial account with one of the many commercial services.

Is the user adoption still growing

These numbers tell us nothing about the number of people or organisations that have "adopted" Bitcoin as a currency - some may treat it as a payment network for fiat currencies. Some proportion will just treat it as an investment, we probably wouldn't say that someone who buys shares in Apple has "adopted" Apple.


text:
How is a large chain split resolved?
As far as I understood, on short timescales regularly a blockchain split happens, i.e. when two miners find a block concurrently. However just a few blocks later the chain with more work wins and all unconfirmed transactions re-enter the pool.
Assume following scenario:
One miner with 51% of the hashrate decides to perform an attack, even if it is economically not feasible, by withholding their mined blocks for an extended period of time, let's say a month. What happens if they suddenly publish 4.320 blocks at once which contain more cumulative work than the current blockchain?

Does the software running on nodes just blindly accept the new blocks? Even when it is able to detect obvious double-spends?
or is there a threshold in the number of blocks after which the node software rejects the new chain even if it has more work?
or is there some form of input prompt so in the end the owner of the node decides what they accept as the valid chain?

I think this question is not so much centered around the principles of the bitcoin network but rather how node software is implemented.

Bitcoin Core has no limit on how deep a reorg is accepted. The reasoning is that any introduction of a rule to reject a reorg is just trading a reorg attack for a network split attack: with a threshold, nodes will disagree about which is the valid chain depending on which one they saw first.

Thank you for your comment. So this basically means a 51% attack will be successful even it obvious for all network members. Isn't a chain split the better choice, this way the attacker would have to maintain the hashrate in the new chain in order to maintain the value of their double-spent bitcoin?


text:
Getting Public Key for transaction in electrum
Liberty.me has asked purchasers to all pay into a single address, but then to email the "public key" of the transaction. What is the public key of the transaction? How would you find it in Electrum?

Transactions don't have public keys, only addresses do.

In the History tab, if you right click in a transaction you can see the details of that tx, then you can copy the Transaction ID (I think that is what you've been asked).
This is what is asked most of the times when having the payment method that way.

I think what they're referring to is the address that you sent the bitcoin from. It sounds like they're probably manually validating the transactions so it couldn't hurt to also send them the link to the transaction on http://blockchain.info


text:
Bitcoin script with multiple recipients?
Is it possible to write a Bitcoin script that pays multiple recipients?
For instance, a script funded with 2 BTC by Alice that pays 1 BTC each to Bob and Charlie.
Eventually I'd like to build a system using Lightning, where Alice, Bob and Charlie are all part of a channel. Alice would fund the channel and the script would determine how much of the funds go to Bob and Charlie.

Bitcoin Script has only one function: determining the conditions under which a transaction output can be spent, in its entirety. The result of evaluating a script is just "true" or "false".
So no, you cannot have a single script that corresponds to two payouts, because every output has exactly one script. You can have an output with a script that lets it be spent when two keys sign off, or one that lets it be spent when one of them signs off. But it's always going to be the entire output, with the entirety of the value it has.

No, currently scripts have no way to inspect the outputs of the spending transaction and require. There is no way to restrict what scripts can be created, nor what amounts outputs can be.
There are ideas for covenants where a script can do those things, but these are not deployed, and there are currently no plans to deploy them.


text:
Binance Bitcoin Address shows 0 balance on blockchain explorer
I was checking my Binance Bitcoin address (where i have been holding some amount for last one year) on blockchain explorers, but it shows that the btc from that address was immediately spent within a few hours of transfer.
Does binance move all the bitcoin to another address and just maintain a balance of my wallet?
When moving these funds from my address to their address, does it not incur a charge to them for making this unnecessary transaction?
Fairly new to the cryptocurrency ecosystem and want to understand how things work.
Any help would be appreciated


text:
Why checksum the privkey in WIF?
Why does the WIF conversion process mandate the double-hash-and-append on the 80+privkey / 80+privkey+01 string, given that nobody is questioning the correctness of that privkey number?

The purpose of checksums is to ensure data integrity when transferring. Given that WIF means Wallet Import Format, the assumption is that any private key in this format is being transferred from one place to another, and generally people want a check that the transfer was done successfully. Having a checksum built into the format allows for an integrity check to be done quickly at import time to inform the user whether there are any obvious errors.


text:
Generating HD Wallet Addresses in Java Using Bitcoinj
Is there some method that can be used to get the address, private and public key for any type of supported coin in a HD wallet? I can correctly generate these for Ethereum, which I verified on https://iancoleman.io/bip39/
String seedCode = "elevator dinosaur switch you armor vote black syrup fork onion nurse illegal trim rocket combine";

// BitcoinJ
DeterministicSeed seed = new DeterministicSeed(seedCode, null, "", 1409478661L);
DeterministicKeyChain chain = DeterministicKeyChain.builder().seed(seed).build();
List<ChildNumber> keyPath = HDPath.parsePath("M/44H/0H/0H/0/0");
DeterministicKey key = chain.getKeyByPath(keyPath, true);
BigInteger privKey = key.getPrivKey();

System.out.println("0x" + privKey.toString(16));
System.out.println("0x" + key.getPublicKeyAsHex());
System.out.println("0x" + Keys.getAddress(Sign.publicKeyFromPrivate(privKey)));

I'm not sure how to do the same for bitcoin or any other coin. Is there some other way to get the public key, private key, and address? I am currently using the bitcoinj and web3j libraries.

You can use method toAddress
System.out.println(key.toAddress(ScriptType.P2PKH, network));


text:
cgminer api-allow using dns instead of IP address
I am wondering why cgminer is not accepting dns instead of IP addresses
I need to allow a server by it's dns...is it possible?

Please clarify, as I do not understand how you would use domain name servers for this. Do you mean you would like to use a domain (e.g. example.com) to connect?

I would like to use a DNS in the --api-allow command and not IP, so i can control my machine with my dynamic ip address of my other machine, i have set up a noip.com dynamic dns, but the --api-allow don't work for some reason if it's not getting an IP

It's probably a bad idea anyway, since then anyone who compromised your noip account (or any crooked noip sysadmin) could point your domain to themself and then take control of your miner.

cgminer accepts domain names for me, It's all I have used, never have I used an IP. I would check and make sure your URI is correct if DNS is working for you in your web browser and such.
Here is an example of a URI for stratum
stratum+tcp://[serveraddress/domain]:[port]
The cgminer command would be:
./cgminer -o stratum+tcp://[serveraddress/domain]:[port] -u [username] -p [password]
If you want to test it on another pool, try this command below and try mining a couple shares on Eligius, there's no registration, just use your btc address as username and "x" for password
cgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -u YourBitcoinAddress -p x
Maybe you could copy and paste some of the error messages you were getting to help further diagnose this?

it's working fine with DNS's in the pool config, i am talking about the --api-allow command

authors: สุธีรา ผกานนท์


text:
Bitcoin QT Rpc Transaction date format
I am trying to get information about my transactions from my wallet,
I use Listtransactions, and get all the information, but the time/blocktime/receivetime - there are all in number i can't decipher "1390424516" i thought they were ticks, but new DateTime(1390424516) gets me 01/01/0001 00:02:19 ...
I tried using them as seconds, i got to year 0045...
the documentations says
"time" : time associated with the transaction[1].
From block timestamp, unless transaction was already in memory pool then the local time when the client added the transaction to its memory pool
so i tried both methods on Blocktime too, but can't figure out how to get the time...

This is a Unix date format. As I understand, you are using c#, so it will be look like:
public static DateTime FromUnixTime(uint time)
{
    return new DateTime(1970, 1, 1).AddSeconds(time);
}


text:
How do exchanges manage deposits and withdrawals?
Suppose users on an exchange deposit bitcoin to different addresses using the HD wallet structure. Now suppose a user wants to withdraw bitcoin to an external address.
How would this whole process be done behind the scenes? I'm assuming the following happens:
A new address is generated for each deposit. Also, one address stores coins up to a certain amount, and the rest gets transferred into a cold wallet. This is done by making a transaction to this address when a deposit happens as long as the address contains bitcoin under some threshold. Then when withdrawals occur, only that address gets topped up and withdrawn from. This makes it easy to know which address contains coins that can be withdrawn from, and this address will contain a large enough amount of bitcoin so multiple transactions across different addresses aren't needed for a withdrawal.
Is this what happens in practice?

This is a pretty broad question that also has some opinion/preference nuances.
To try to answer your question, yes, a new address for each new deposit.
Whether these funds by default go to a hot wallet or cold wallet is a preference and will differ depending on the exchange.
I would suggest that best practice would be to have all user deposit funds going to cold addresses in a cold wallet, and separately have a hot wallet that funds are sent from. This means you need enough funds in a hot wallet to maintain daily user withdrawal requests. Eventually cold funds will be moved to the hot wallet to make up for spent funds, which I suppose is what you mean when you say "only that address gets topped up and withdrawn from." But your scenario implies address re-use so instead think of the same idea but topping up a hot wallet vs a single address.

So in the hot wallet withdrawals, would address reuse still happen? For example, an address contains 2 btc but a user only wants to withdraw 1 btc. Would the address need to be reused in another withdrawal(s) to get rid of the remaining balance?

No you spend the full amount and send the left over to a change address.


text:
recovery of old wallet.dat file
Back in 2012, I mined for a bit on my computer in Slush pool.  I didn't get much, like .11 coins so I quit.
In 2018 I went to slush pool and sent my sats to my bitcoin core wallet then tried to open it, but my hard drive was too small to download the blockchain and it errored out, so I let it sit.  in late 2021, I saved the wallet.dat file, downloaded the new Bitcoin_qt and the entire blockchain on a new 64 bit machine, with a large drive, and tried to drop the wallet.dat file into the folder to replace the blank one.  Bitcoin core doesn't see it so now I am at a loss.  I am not a command line guy nor do I know how to proceed.... should I chalk the sats up as lost and move on?

If you've put it in the wallets folder of your data directory, can you see it when you choose file > open wallet? You'll have to start a rescan if you've loaded the wallet but let's first ensure it can be loaded before going into those details.

You should be able to use the File -> Open Wallet option to select your wallet and load it into BitcoinCore. Alternatively the loadwallet "filename" ( load_on_startup ) command may be what you are looking for should the GUI option not work. This post shows how you need to locate the wallet so that BitcoinCore will find it. Rescanning may be needed, but if your file is not corrupted it should recognize the funds.
Alternatively, you may use Electrum, since you mentioned downloading the whole chain is an issue for you.
In case you do not remember your password, or just its approximate shape/length there is software available to brute-force some combinations yourself. Whatever you do, do not share the file with anyone promising to help you.
All the best recovering your funds.

Thank you for taking the time to answer this.

As far as Electrum... how would I open the wallet there?  can it open the wallet.dat file?

Electrum does have an option to open wallets under File->Open->(select your wallet). However, I use BitcoinCore for all wallet-y stuff, so my knowledge there is limited.

Thx David.  I guess I probably lost the piece of coin... like a lot of people over the years.


text:
Can the order of transactions not strictly follow the chronological order?
Suppose I have 1 bitcoin, I give Alice 0.2 bitcoin first, then Bob 0.2 bitcoin immediately, both transactions are legal

can miners reverse the chronological order when packing block ?
If (1) is true, as a payment system, you can't get the correct timeline when backtracking, is this a design flaw?

Transactions have no order until they are included in a valid block. That is the entire function of the blockchain: to act as a distributed timestamp server for transactions.

can miners reverse the chronological order when packing block ?

A miner can order transactions in a block however they would like (assuming that the block remains valid otherwise, of course). Saying things like 'what is the chronological order of unconfirmed transactions?' doesn't make any sense. There are simply unconfirmed transactions, and then there are confirmed (and thus ordered) transactions that are a part of the blockchain record.
There are some cases where the ordering of transactions will matter though, for example if you create two transactions, and the second transaction spends an output that was created by the first transaction. In that case, the second transaction would only be valid if the first transaction is included ahead of it, since the second transaction would otherwise be spending a non-existent output.

If (1) is true, as a payment system, you can't get the correct timeline when backtracking, is this a design flaw?

As mentioned above, the explicit ordering of transactions is defined by their inclusion in the blockchain record. Building a system that attempts to order unconfirmed transactions wouldn't be very useful in many cases.

Bitcoin uses a UTXO model – all bitcoin exists in the form of unspent transaction outputs (UTXOs). So there are a number of different scenarios depending on how many UTXOs you have and what you do with them:

You have a single* UTXO of 1 BTC. You create a single transaction paying 0.2 BTC to Alice, 0.2 BTC to Bob and 0.6 BTC back to yourself. A transaction is atomic, so miners cannot in any way separate the payment to Alice from the payment to Bob.

You have a single* UTXO of 1 BTC. You create a transaction paying 0.2 BTC to Alice and 0.8 BTC to yourself, and then another transaction spending that 0.8 BTC, paying 0.2 BTC to Bob and 0.6 BTC to yourself. Because the latter transaction is dependent on the former, it cannot be confirmed (mined) before the former is confirmed. They may be mined within the same block, but they must have a correct order within that block.

You have two UTXOs of 0.5 BTC each. You create two transactions each paying Alice and Bob respectively 0.2 BTC and 0.3 BTC to yourself. Broadcasting them to the network in a specific order doesn't guarantee that they will be confirmed in that order.

* Or multiple smaller UTXOs that you will be spending together in one transaction.


text:
How Bitcoin browsers update balance of an address?
Suppose i have a Bitcoin address for the first time and Alice sends me 1 Bitcoin using P2SH. As far as I know, Bitcoin browsers will scan the entire blockchain. In this case, my public key is not present in the network, it is only present in the locking script and it is hashed.
So when i check my balance in Bitcoin browser, can i get a result?

P2SH Bitcoin addresses are just Base58Check encoded script hashes. A P2SH transaction output will mention this same script hash. So if we're just interested in the balance of the P2SH address, we just Base58Check decode the P2SH Bitcoin address to the script hash it encodes, and look for UTXOs that have that same script hash.
You don't need the script or any public keys until you're trying to spend.

In some cases, the locking script will be complex and contain not only my public key, but possibly other public keys (multi-signature). And the browser doesn't seem to be able to match my public key with the script hash.

@KHJUAF403456ZS3K564WAEF Right, but addresses aren't identifiers of your public key. They identify the entire locking condition. If you have a multisig script that involves your key, that is a distinct address from a single-key script with just key, and they will be counted separately. Block explorers in general give a weird address-centric view of the chain, because they cannot do better. Your own actual wallet can tell you the balance if the actual funds you can access, regardless of how things are split into addresses.


text:
What are the detailed rules for Merkle tree generation? Specifically the order of the leaf nodes
As far as I know, the first one is the coinbase transaction

The leaf nodes are in the same order as the transactions in the block. This order is chosen by the miners (other than the coinbase being first).
Please see here for more info: https://bitcoin.stackexchange.com/a/46768/51948
CVE-2012-2459 is detailed here. The relevant fix:

The problem was fixed by Gavin Andresen in Bitcoin commit be8651d [1] by rejecting blocks with duplicate transactions in CheckBlock, preventing them from being cached at all.

So essentially the Merkle tree itself still has the same issue, but it can never be a problem in practice when used in Bitcoin blocks.


text:
question about orphan transaction pool
Suppose I am a full node and a transaction C arrives at me. I didn't find its father, so I put it in the orphan transaction pool. After a while, C's father B arrived at me. But I also didn't find B's father. Assuming these transactions are legitimate, what should I do with the orphan transaction pool in this case?
Should I kick C out of the orphan transaction pool since C has father?
Or both B and C stay in the orphan transaction pool?

For a transaction to be valid, the UTXOs being spent in its inputs must exist. This is a transitive property. If the parent transaction is an orphan, you cannot be sure that its inputs exist, and therefore transitively, you cannot make any determination about the child.
All transactions that you cannot fully connect to the UTXO set should remain in the orphan pool.


text:
How bitcoin browsers check P2PK and P2SH balance?
Suppose someone sends bitcoins to me using P2PK, I only enter my address starting with 1 in the bitcoin browser, can i get results? my public key hash doesn't appear in either UTXO, only one UTXO has my public key.

Will the browser hash every public key in the UTXO to the public key hash and then compare with my?
Going a step further, if someone creates a multi-signature script, hashes that script, and sends me bitcoins using P2SH. Can Bitcoin Browser Check Balance?

Each output in Bitcoin transactions has a scriptPubKey restricting how the UTXO can later be spent. For P2PK the scriptPubKey consists of <pubkey> OP_CHECKSIG, the output type associated with addresses starting on 1…, Pay to Public Key Hash (P2PKH) corresponds to a scriptPubKey of shape OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG instead. Addresses starting with 3… encode P2SH outputs, which use the scriptPubKey of OP_HASH160 <scripthash> OP_EQUAL.
Given that there is no address standard for P2PK, some blockchain explorers misleadingly show a P2PKH address instead. I.e. even while an output paid to a <pubkey> OP_CHECKSIG script, the blockchain explorer shows the address of a OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG script using the hash of the same public key. For example, the reward for block 1 was paid out to a P2PK output, but e.g. blockchain.info has indexed the output under the P2PKH address 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX. On the other hand, searching for the same address on another explorer such as blockstream.info, the search result will not include the coinbase transaction (as I would consider correct).

Will the browser hash every public key in the UTXO to the public key hash and then compare with my?

It seems to me that blockchain explorers do not maintain indexes of public keys at all. Therefore, searching for the public key corresponding to a P2PKH will never get a hit. As said before, some blockchain explorers have indexed all P2PK outputs to the related P2PKH addresses instead. You'd be able to search for P2PK outputs that way there.
One could also expect that blockchain explorers index outputs on basis of the scriptPubKey, but testing both blockchain.info and blockstream.info, neither has an index on the full scriptPubKey. It seems that most blockchain explorers only index outputs that fit the standard address schemas.

Going a step further, if someone creates a multi-signature script, hashes that script, and sends me bitcoins using P2SH. Can Bitcoin Browser Check Balance?

There is an address standard for P2SH outputs. All blockchain explorers should index P2SH outputs the same way using these addresses. A P2SH address corresponds to the script hash used in the scriptPubKey.

in the last case , i have to give my redeem script to the browser, right?

No, just the address which encodes the scripthash, not the script.


text:
Unable to connect to litecoin-qt server from more than 3-4 machines
I've created a litecoin-qt server with the following configuration:
{
"pools" : [
        {
                "url" : "http://192.168.10.5:9332",
                "user" : "something",
                "pass" : "somethingelse"
        }
]
,
"auto-fan" : true,
"temp-cutoff" : "95",
"temp-overheat" : "85",
"scrypt" : true
}

I'm able to connect to it from at least 3 different machines on the network, plus one connection from itself (I'm having cgminer run on the server).
However, I'm unable to connect from any other machines - it flashes the following:
[2014-02-04 21:47:03] Pool: 0  URL: http://192.168.10.5:9332  User: something Password: somethingelse
 [2014-02-04 21:47:03] Press any key to exit, or cgminer will try again in 15s.
 [2014-02-04 21:48:03] HTTP request failed: Operation timed out after 60000 milliseconds with 0 out of -1 bytes received
 [2014-02-04 21:48:03] Failed to connect in json_rpc_call
 [2014-02-04 21:48:03] Succeeded delayed connect
 [2014-02-04 21:49:03] Timed out waiting for response in initiate_stratum
 [2014-02-04 21:49:03] Initiate stratum failed
 [2014-02-04 21:49:03] Closing socket for stratum pool 0
 [2014-02-04 21:49:03] FAILED to retrieve work from pool 0 http://192.168.10.5:9332
 [2014-02-04 21:49:03] Pool 0 slow/down or URL or credentials invalid

And ends with:
 [2014-02-04 21:40:48] Timed out waiting for data on socket_full
 [2014-02-04 21:40:48] Initiate stratum failed
 [2014-02-04 21:40:48] Closing socket for stratum pool 0
 [2014-02-04 21:40:48] FAILED to retrieve work from pool 0 http://192.168.10.5:9332
 [2014-02-04 21:40:48] Pool 0 slow/down or URL or credentials invalid

The datetimes are slightly off since I fetched these logs in different run instances.

Are those other machines outside of your network and getting blocked by a firewall or port rules?

Hi Jacob - no, they're all on the same wifi and the other machines can ping the .10.5 one. This is all on Windows - am I running into a connection limitation?

Bitcoind by default accepts up to 8 connections. Have you tried pinging the ip address from the trouble computers?

Yup - did that again before typing the above - am able to receive responses. Still seeing the above message (second quoted block) - note, this isn't a stratum pool.

It may be a network issue most likely. Are you using the correct ip address, port, and password for sure? The following line suggests that no communication is even established, so it's not a problem with configuration of pool. HTTP request failed: Operation timed out after 60000 milliseconds with 0 out of -1 bytes received

Yeah - I'm using the correct IP - using the same config on the other machines. Two of the worker machines are using cudaminer, 1 is using cgminer (with the config exactly as the first quoted block). The server machine itself has it modified to use 127.0.0.1 as the IP address, no other change.

let us continue this discussion in chat


text:
Middlecoin vs Wafflepool vs multipool.us
Which one actually has a better payoff? As I understand from their websites, their fees are:
Middlecoin  3.88%
Wafflepool  1%
Multipool.us    1.50%

So, clearly Wafflepool's the best, but how are their respective "algorithms"? Are they making the right mining decisions - does somebody have some empirical evidence of that?

I haven't tried multipool and middlecoin has been having a lot of server trouble. I've switched / am exploring wafflepool and it seems like a much more decent experience!

Sorry for off-topic, but can anyone check that wafflepool is online? As far as I can see, it is down.