text:
Should full node provide BIP 157/158 services?
As an educational exericse I have a new 22.0 full node using tor onion-only. Of the 18 outbound connections, one is to a peer which offers COMPACT_FILTERS BIP 158 service. (I got the name from a list of optional node services provided here in Dec. 2019.) And here it says that a node can provide BIP 157 service by setting peerblockfilters=1. How is BIP 158 service provided?
I'd like to provide any services that are feasible and useful. I've gathered that there would be a cost of an extra 5GB of storage (growing or static?) Other than that, any downsides to be considered?
And are these services useful only to peers connecting inbound? In about 36 hours I haven't seen any of those. I did see a few inbounds occasionally in previous days running 0.21.0. Did upgrading to 22.0 and/or the recent exclusion of tor V2 peers mean an onion-only node will have no incoming connections? And if so, does that make my BIP 157/158 questions irrelevant?

Of the 18 outbound connections, one is to a peer which offers COMPACT_FILTERS BIP 158 service. (I got the name from a list of optional node services provided here in Dec. 2019.) And here it says that a node can provide BIP 157 service by setting peerblockfilters=1. How is BIP 158 service provided?

The separation between BIP158 and BIP157 is somewhat murky, but in terms of the service provided, they can be thought of a single thing. Strictly speaking, BIP158 is the definition of the filter data structure, while BIP157 is the network service that exposes the BIP158-based filtering to the network. So, peers don't offer BIP158; they implement BIP158, and then use that to expose BIP157 services (or not).

I'd like to provide any services that are feasible and useful. I've gathered that there would be a cost of an extra 5GB of storage (growing or static?) Other than that, any downsides to be considered?

More bandwidth, if peers use it.

And are these services useful only to peers connecting inbound?

Strictly speaking, no, but in practice almost certainly yes. Nodes connect out to peers that provide what they want. It's unlikely that a full node (which provides BIP157) connects out to a light client (which needs/wants BIP157 services). Most likely the light client doesn't even support incoming connections.

In about 36 hours I haven't seen any of those.

It can take way longer than that before the network learns that you're a (good) node to connect to, even if nothing is wrong.

Did upgrading to 22.0 and/or the recent exclusion of tor V2 peers mean an onion-only node will have no incoming connections?

Not necessarily - if you're correctly configured to have a V3 hidden service now, you should eventually get inbound connections.

If this isn't right, please let me know... My node implements BIP 158 by virtue of running bitcoind 22.0, so all I need do is set peerblockfilters=1. (Your answer gets a virtual +1, but I need more reputation to make it actual.)

The filter is off by default; you need blockfilterindex=1 to enable the BIP158 filter, and peerblockfilters=1 to enable exposing it through the network.


text:
Will this Transaction still arrive or was it stolen?
Was this Transaction stolen or did i make a mistake? ae6f689cb77a5eceea9eed5a91ce51f940fef2b8832946e747d0d0d788c3d9b3

What sort of situation is indicating to you that the money didn't arrive yet?

I'm voting to close this question as off-topic because this question is too localized, and unhelpful to future visitors.

The transaction ae6f689cb77a5eceea9eed5a91ce51f940fef2b8832946e747d0d0d788c3d9b3 was confirmed in block 594768, paying a total of 0.00520707 BTC to the bitcoin address 37wefhkU2JDzQWJpmkTAB73AiQxBRXFQe.
This transaction is confirmed, and at this point has several days worth of blocks on top of it, so it can definitely be considered immutable at this point.
If someone asked you to pay some BTC to this address, and now is pretending that it "didn't arrive", "was stolen", "can't be accessed without some payment", etc, then you should be extremely wary of dealing with that individual in the future. This 37wefhkU2JDzQWJpmkTAB73AiQxBRXFQe address did receive payment, it is not possible that it was "stolen before being delivered" or something like that.

thank you for the answer. what does immutable mean? can i still get the BTC?

Immutable more or less means 'non-changeable', aka the transaction cannot be changed or removed from the blockchain record. I do not know if you can 'get the BTC', because you have not given any information on what you are trying to do, which bitcoin addresses you own, etc.

sender is my blockchain wallet, receiver is a generated address of an account of mine

"receiver is a generated address of an account of mine" is this address generated for you by an exchange or some other online service? If yes, then they received the coins you sent.

source: Stack Exchange

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

sort: votes


text:
(P2WSH-nestedin-P2SH) Problem in solving question 1+5=6
this is my first question at this platform.
this matter has scratched my head badly, please pay patient to read my question.
i am trying to move traditional p2sh tx into p2wsh-nestedin-p2sh tx and this is also an ANYONE_CAN_SPEND tx.
locking script
scriptpubkey(hex) = a9149a6185672bafea7a16309a9f6e2fe03927499c6e87
scriptpubkey(asm) = OP_HASH160 9a6185672bafea7a16309a9f6e2fe03927499c6e OP_EQUAL
unlocking script
scriptsig(hex) = 2200201f41c545a5c0b1c370c2e2812b3256d690fc098ae56aa21c94cd98d7c3ca5ec6
p2sh redeemscript(hex)=00201f41c545a5c0b1c370c2e2812b3256d690fc098ae56aa21c94cd98d7c3ca5ec6
so far all i mentioned above are simple traditional p2sh lock/unlock, my base serialized tx now showing.
01000000012649c299694db1b608d4463e3b0535b3b8c0d5a1e9558b4d71be3790bde1dce800000000232200201f41c545a5c0b1c370c2e2812b3256d690fc098ae56aa21c94cd98d7c3ca5ec6ffffffff01401f0000000000001976a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac00000000
this is correct because result generated from https://testnet.smartbit.com.au/txs/pushtx shows me "PUSH TRANSACTION ERROR: 64: NON-MANDATORY-SCRIPT-VERIFY-FLAG (WITNESS PROGRAM WAS PASSED AN EMPTY WITNESS)"
so what i gonna do next is to solve witness data.
Witness Data:
P2WSH-RedeemScript(hex) = 55935687
P2WSH-RedeemScript(asm) = OP_5 OP_ADD OP_6 OP_EQUAL
witness items(hex) = 51
witness items(asm) = OP_1
so now the serialized tx looks like this and the bolded part is my new changes compared to previous one.
010000000001012649c299694db1b608d4463e3b0535b3b8c0d5a1e9558b4d71be3790bde1dce800000000232200201f41c545a5c0b1c370c2e2812b3256d690fc098ae56aa21c94cd98d7c3ca5ec6ffffffff01401f0000000000001976a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac020151045593568700000000
when i submit this tx, error told me "PUSH TRANSACTION ERROR: 64: NON-MANDATORY-SCRIPT-VERIFY-FLAG (SCRIPT EVALUATED WITHOUT ERROR BUT FINISHED WITH A FALSE/EMPTY TOP STACK ELEMENT)"
i try hard to solve the puzzle and magically i success when i change script to
010000000001012649c299694db1b608d4463e3b0535b3b8c0d5a1e9558b4d71be3790bde1dce800000000232200201f41c545a5c0b1c370c2e2812b3256d690fc098ae56aa21c94cd98d7c3ca5ec6ffffffff01401f0000000000001976a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac020101045593568700000000
so my latest submitted tx show over here https://testnet.smartbit.com.au/tx/e627feb66ed572b97ef393f20be0e76edb8dfe34fd98a9c606f62af04496341d
raw tx show over here https://api.blockcypher.com/v1/btc/test3/txs/e627feb66ed572b97ef393f20be0e76edb8dfe34fd98a9c606f62af04496341d?limit=50&includeHex=true
i dun understand how come change of this can solve my math puzzle. :(

The witness items are not encoded as scripts, so I think you're making it compute 0x51 + 5 == 6, rather than 1 + 5 == 6. Is that islt?

hi @PieterWuille , thanks for clarify this for me, i just knew that witness item is not doing as script, well, for beginner like me, witness item sound confusing and increase cost of learning.

Does it work when you change the stack to be 0x01 instead of 0x51?

@PieterWuille yes, it works

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


text:
Problem using op_checksequenceverify (op_csv) with relative time flag
i have trouble in using op_csv. The spending condition is not match to my expectation.
FUNDING
Redeem Script Hex: 03010040b27576a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac
Redeem Script Asm: 03<010040> OP_CHECKSEQUENCEVERIFY OP_DROP OP_DUP OP_HASH160 14<51d2a5e04d25ceaa86e600a6ec34bd24431c675d> OP_EQUALVERIFY OP_CHECKSIG
P2SH base85 address: 2NFRizqW8XpNQm7nxYvFpYTvYsy3BqgsEx2 (bitcoin testnet3)
Based on my mentioned redeem script, i set time parameter as 1 along with OP_CHECKSEQUENCEVERIFY. Now my expectation is once blockchain confirms this TX, supposedly, miner will accept my spending TX after 512 seconds.
here is my funding tx
https://testnet.smartbit.com.au/tx/318462c4f6fef6e3c4fc58e8803c1ca43f20d162ca41d5c74f9e89725d8b300d
SPENDING
02000000010d308b5d72899e4fc7d541ca62d1203fa41c3c80e858fcc4e3f6fef6c4628431000000008b483045022100f995ccfb8ce2bda36c4ec0f37f067ee6c87c58043155b3a583da201ffaaa4db50220794d23e402b3f0a9579ab9bb8fbb573eba8cffed27542c162b629aa0f914b10d01210292dbb331c39d84611fbaa8e225d781ec50c2ed21fbf311bfeb869042f4b3e1781f03010040b27576a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac0100400001d40c0600000000001976a91451d2a5e04d25ceaa86e600a6ec34bd24431c675d88ac00000000
i set this TX's version as 2 and input's nsequence as 03010040. Now, i am waiting for blockchain to confirm my funding tx. Not so long, my funding tx was confirmed with date 2019-11-24T10:46:05Z. Now, I expect that 2019-11-24T10:46:05Z + 512 seconds = 2019-11-24 10:54:37 is time miner will accept my spending tx. As the result once my funding TX has been confirmed then i can spend immediately without any relative time restriction. ANYONE know what is happening?
here is my spending tx
https://testnet.smartbit.com.au/tx/a68a821e06c1156d5fe80f3662c941142ed2ce1a57e597ce05bf167bce21fe2d
P/S: i further test by changing time parameter in redeem script from 1 to 4 and 5, then the result is slightly match to my expectation.

i manage to find answer for myself.
OP_CSV date consensus is based on median time past (mtp), not block's confirmed date.
once funding tx above has been confirmed, it is located in block#1609592 with block MTP is 2019-11-24 09:05:26 (UTC 0). At same time, chain's MTP is 2019-11-24 09:25:27 (UTC 0)
now come to spending tx, since utxo's confirmed date i used is 2019-11-24 09:05:26, plus 512 seconds = 2019-11-24 09:13:58. Therefore i can spend immediately as chain's MTP is more than 2019-11-24 09:13:58.


text:
What do people mean when they say that Bitcoin are "unconfiscateable"?
So all my Bitcoin are on an encrypted wallet.dat inside a VeraCrypted USB memstick inside a fireproof safe.
While this might stop random a burglar, how does it stop the government from confiscating them? Or any targeted attack?
What if I wake up tomorrow tied to my bed, with a bunch of gangsters or cops (no real difference) around me. They go:

Okay, Sonny. Instructions to locate your Bitcoins. Now.

And one of them loads a gun and points it at my head.
Let's assume that I'm the most hardened, badass Bitcoin owner on the planet (which I'm definitely not) and I actually reply:

Go ahead! Pump me full of led, you bastards! I'm going down with my Bitcoins!

Now, they look at each other, nod in a sinister manner, and one of them gets a little glass cage from a backpack. As I'm wondering what is going to happen, and why they aren't killing me, they place a gigantic, nasty spider on my chest, still in the cage, and say:

Thought you'd get away that easily, huh? We know your biggest fear, you stupid slave! You have ten seconds to tell us the correct instructions to how to get to your private keys or we'll open the door and allow this aggressive, eight-legged freak to nest in your mouth.

There is no way in Hell that I wouldn't instantly start crying my eyes out and scream:

GOD NO! PLEASE! I'LL TELL YOU! IT'S IN THE SAFE IN THAT WARDROBE BEHIND ME! COMBINATION 4 x 25 RIGHT, 3 x 73 LEFT, 2 x 23 RIGHT, 1 x 91 LEFT! THE KEY TO THE SAFE IS LOCATED UNDERNEATH THE BED! THE WALLET.DAT IS ON A VERACRYPT-ENCRYPTED USB STICK INSIDE. PASSPHRASE BLABLABLA! THE WALLET.DAT IS ENCRYPTED WITH THE PASSPHRASE BLABLABLA! YOU FIND A SERIES OF CLUES IN A RANDOM TEXT FILE CALLED SHOPPING.TXT! ANY INSTANCE OF "WOLF" MEANS "X999DL%¤(/(SSSSSFJ1389u2/(D"! MY FIRST CAT'S NAME WAS FLUFFY! MY SECRET LOVE IS ANGELICA! THE GAME I'M TALKING ABOUT TOWARD THE END IS DOOM FOR ATARI JAGUAR 64! I SWEAR THIS IS THE TRUTH! PLEASE PUT THE MONSTER AWAY RIGHT NOW!!!!!

Even somebody who isn't extremely scared of spiders like I am (which they would easily find out) would find the idea of having a spider crawl into your mouth and on your face extremely unpleasant. Of course, they could just start bashing my knees in or cut off my fingers, or threaten to kill my pet, or child, or other loved one, etc. Such people do exist.
In fact, they could simply tell me that unless I comply, they will simply imprison me under terrible conditions until I spill the beans. Would you want to sit isolated in a small room and eat whatever crap they feel like serving you to keep me alive for the rest of your life just for the sake of not having to give up your Bitcoin? I'd say that would be even more horrible than being poor again.
I don't understand why some people keep repeating this mantra that Bitcoin is somehow unconfiscatable. Haven't I more than proven my point with this frightening scenario?


text:
What's the difference between an 'address' and an 'addressHash' in a transaction on a bitcoind node?
I'm listening to a ZMQ socket; it's sending out messages every time my node receives a transaction. The message is the binary value of the transaction itself. When I decode the binary (using a tool in a python library, pybtc.Transaction), I get the string representing the entire transaction. The following is a snippet, the "vOut" or output section of the transaction.
'vOut': {0: {'address': '1EczJfLziUwBs1ry8Mz7KrTioP6tN8hZXi',
          'addressHash': '9568077c57227466e52e61ae12686acaadfff861',
          'nType': 0,
          'reqSigs': 1,
          'scriptPubKey': '76a9149568077c57227466e52e61ae12686acaadfff86188ac',
          'scriptPubKeyAsm': 'OP_DUP OP_HASH160 OP_PUSHBYTES[20] '
                             '9568077c57227466e52e61ae12686acaadfff861 '
                             'OP_EQUALVERIFY OP_CHECKSIG',
          'scriptPubKeyOpcodes': 'OP_DUP OP_HASH160 [20] OP_EQUALVERIFY '
                                 'OP_CHECKSIG',
          'type': 'P2PKH',
          'value': 500000},

You'll see the first two fields of the index-0 output are 'address' and 'addressHash'. My (loose, highlevel) understanding of an address is that it is, literally, the hash of the unlocking script. (The unlocking script? Is that what we see in the 'scriptPubKeyASM' field?). What then, is the addressHash?

addressHash is the data output by pybtc. The data is a hash of the public key or script. It is contained in the address. And also parts of scriptPubkey(locking script).

For P2PKH and P2WPKH, it is Hash160(public key)
For P2SH, it is Hash160(script)
For P2WSH, it is SHA256(script)


text:
How do I set up a long-lived lightning channel for accepting bitcoin donations?
I want to set up a long-lived lightning channel to accept bitcoin donations. The plan was to open a channel with a capacity of 2.5 mBTC (currently valued around ~100$), "reverse submarine swap" or "loop-out" the initial funds, then loop out the donations once the channel is saturated and in need of additional inbound liquidity.
I have already acquired the 3mBTC needed to cover the fees and reserves associated with opening a lightning channel. Now I'm having difficulty finding a well-connected peer with whom to open my channel. The peers I found either offer no commitment towards availability or keeping the channel open, require a large amount of bitcoin to be committed, or both. This lead me to conclude that I have misunderstood how lighting is meant to be used, and hence me posting this question.
What is the proper setup for a use-case like mine? How should reliable channels meant for sparse small donations be set up?
I am very new to bitcoin and lightning.

In my opinion, this is an open problem, and in particular, it is a difficult answer to questions like: "What is a good node for your use case?"
In addition, there are questions like "To improve the probability of success I need to have one or more channels opened?"
I try to answer these questions from my point of view, but I'm open to discussing more on this point.
For your use case, I think it is better to open a channel with people that you know, and in particular with people that are using lightning network daily and not just people with a couple of channels open without any usage.
Now there is a couple of questions, like:

How you can find this node?
There are sites like 1ml, lightningnetwork.plus where you can find node rank by goodness with some definition of goodness.
There is another site that is starting as research, that is lnmetrics.info where you can find a list of a node with the uptime for some range of period, it is research and it is under development, but I think these contain good node to start, maybe with a combination of site it can help. There is also an API if you want to see the metrics collected by the lnmetrics or see the lnmetrics specification

In conclusion, your question is unresolved nowadays, and we are researching this problem. We would like to give an easy answer to the user that wants to start with bitcoin and lightning with a small amount of money, but at the moment it is easy to find nodes only that have a lot of requirements in terms of money, but if you pass some time to search you can find also your group of nodes to open a channel with.
In addition, I don't suggest opening only a single channel with the actual state of the art, but open at least two channels, because all the implementation use the MPP (multi part payments) that usually work better with more channels options.


text:
Is it possible to generate a pool of lightning transaction invoices in advance?
When dealing with normal on-chain transactions, we can generate a large number of bitcoin addresses that can then be stored separately and used to receive payments at a later date.
I am aware that a lightning node must be reachable when a sender wants send a payment. I am also aware that reusing a lightning transaction compromises both older and newer transactions.
That said, I would still like to know if it is technically possible to generate a large pool of lightning invoices (to store on a server) in the same way normal bitcoin addresses can be generated.

No; unlike a Bitcoin address, Lightning invoices have a built-in timestamp and an expiration time. They also have information, such as the amount of Bitcoin (and sometimes routing information), that changes in an unpredictable fashion.

Thanks to your answer, I found the following link which provides more information about how lightning invoices are generated: https://docs.lightning.engineering/the-lightning-network/lightning-overview/understanding-lightning-invoices and https://github.com/lightning/bolts/blob/master/11-payment-encoding.md


text:
Where do I find the lightning node ID for my wallet in electrum?
Electrum supports running a lightning node for each wallet. I'm trying to find the ID for this node. Where can I find it?

From the GUI, you can find your lightning node ID by navigating to Wallet > Information in the applications menu bar.


text:
Best security practices accessing/trading crypto on computer/mobile
I’ve read online with regards to crypto that, as hardware wallet users, we should treat all devices, computer, mobile phone, software, exchanges/wallets, etc. as compromised. That being said, I have obtained a hardware wallet and I am wanting to transfer assets on to it but i want to make sure i am always maintaining best security practices and also learning/using any new security information available. It has been sometime since I last accessed my wallet.
What is the best approach to interacting with computer, mobile phone, etc, when trading? Is it going to be a dedicated computer that is used only for crypto? And second that, is it going to be a persistent live usb drive? I am hoping to find any alternative to “get a dedicated crypto computer” possible, but if that is the single best advice I’ll do it. Barring that, what are some alternatives or other options perhaps from most ideal to least ideal for accessing/trading/reviewing crypto?

I’ve read online with regards to crypto that, as hardware wallet users, we should treat all devices, computer, mobile phone, software, exchanges/wallets, etc. as compromised.

Yes. This is the most important thing about Bitcoin.

You consider software compromised, so you only go for open source solutions and stay up to date.
You consider exchanges compromised, so you don't use them to avoid leaking privacy. You consider hardware wallet vendors compromised, so you buy them anonymously. You don't connect to untrusted web services (that is, invalid certificates and all of those things).
You consider network compromised, so you distrust ISPs and use tools built for anonymizing communications (distrusting participants in those networks).
You consider almost all nodes compromised, so you run your own validating full node, instead of blindly relying on others.
You consider core compromised, so you don't keep up with latest versions all the time in all the devices/wallets.
You consider core was compromised but not anymore, so you don't simply stay old.
You consider bitcoin itself is compromised, so you don't act like it isn't, you don't consider it the single valid solution to all of your problems, you'll see others do so, but don't do that.

Because you fighting all of that, Bitcoin stays decentralized, and stores value.

That being said, I have obtained a hardware wallet and I am wanting to transfer assets on to it but i want to make sure i am always maintaining best security practices and also learning/using any new security information available. It has been sometime since I last accessed my wallet.

...

What is the best approach to interacting with computer, mobile phone, etc, when trading?

Not to in the first place. Inactive wallets perform better long term. Mobile phones are essentially the opposite of privacy.

Is it going to be a dedicated computer that is used only for crypto?

If you can afford that, maybe. If it gets compromised, it was all for naught.

And second that, is it going to be a persistent live usb drive?

Persistent cyphered live usb drive sounds better?

I am hoping to find any alternative to “get a dedicated crypto computer” possible, but if that is the single best advice I’ll do it. Barring that, what are some alternatives or other options perhaps from most ideal to least ideal for accessing/trading/reviewing crypto?

Cold storage and air gapped private key access.


text:
Bitcoin access for my late mommy
Mom Passed the day after Thanksgiving in Kona Hawaii. Luckily I had enough saved to get on a plane immediately after getting the same day Covid test for $250 at Seattle airport. I still had to wait at Kona airport for six hours for the results to come in. so much to do, out of nowhere I have to make all these decisions about my mothers life etc. I hate it.
I have all sorts of numbers and identifiers etc. that she wrote down for bitcoin. I have my birth certificate mommy‘s birth certificate we are waiting for death certificates. I am her only daughter. Before she passed away she had to change her email to match her new iPad which I have. I don’t have her cell phone but I have two iPads and all of her bitcoin information. Mommy told me this was mine when she passed but of course didn’t give me information on how to get it. Any help would be appreciated.

I have two iPads and all of her bitcoin information.

Bitcoin money is controlled by Bitcoin wallets. In your context there are two sorts:

The original type of wallet where each person ran their own wallet app or program on their own device. They didn't use any kind of website or managed service. This is still a very common type of wallet and is safer than the other sort of wallet:

A so-called custodial wallet where your money is controlled by a bank-like business and you have a log-in account to a website run by that business. The business acts as a custodian of your money. This is the least safe kind of wallet but it is popular because they make everything seem easy. Many people fall victim to fraudulent websites and many seemingly genuine businesses go bust and lose all their customer's money.

If your mother had the first kind, she will have written down either a "private key" or a "recovery phrase" (also called a "seed phrase"). You need to know the name of the app she used (e.g. "Electrum", "Bread Wallet" and so on) in order to re-create her wallet, which you should do on your own separate device and will then be able to see her total amount of Bitcoin and have control over it.
If your mother had the second kind, she will have written down the website URL and her account name and account password. You can use that to log in from your own device and take control of her Bitcoin money.
I suggest you don't use her iPads but keep them safely locked away until you have either recovered control over her Bitcoin or run out of options.
Never give those devices or any passwords, pass-phrases, recovery phrases or "private keys" to any helpers.  Never give helpers any access to your own devices and never install or use any remote control apps for helpers. If you are not careful your helpers will steal the money and tell you there is no money. Or they might ask you to pay invented unlocking fees or other costs. Once they have bled you dry you will not hear from them again.

Yes I have her 12 word phrase she wrote that down also not sure how that helps I’m not a tech kind of a person.

@Hulagirl. Take your time over this. I suggest learning a bit more about Bitcoin when other pressures on your time allow. All you need is that 12 word phrase. Anyone who knows that can spend all your mother's money without access to the iPads or anything else. Your mother may or may not have added an extra self-chosen passphrase onto the 12 auto generated words. You might find this out later. I suggest keeping everything safe under lock and key until you personally are confident you have a good enough understanding of Bitcoin. Beware sharks.

Thank you very much. I was able to access via the address in block chain explorer and it shows a balance I just don’t know how to get it from there into my bank..I’ll take my time and figure it out. Thanks again.

We found a "Bitstamp" client ID in her notebook but the "Temp password" which i cant really read wont give us access.....Also see an entry "Bitcoin wallet" which goes to her yahoo account which we dont have a password for,,,Tried all her usual passwords.....

UPDATE...I found a "bitcoin wallet" address in her ledger and signed in...BINGO...If I understand it correctly I need to sell on another site like COINBASE to sell it and move the cash to my bank?

@Hulagirl, there's some other questions here about best way to exchange Bitcoin for dollars (or other currencies). But yes one way is through Coinbase.


text:
bitcoin-cli: Get transaction count of wallet without listtransactions
I am trying to find a way to get the number of transactions returned from the JSONRPC interface without relying on listtransactions. The reason for this is that if the wallet has too many transactions (like hundreds of thousands), it can easily flood the node's memory and cause a crash. So I would like to know if there is a less intensive way to get just the number of transactions, so I can use listtransactions with the skip= and count= parameters to iterate in reverse order.

OK, so I found an output field in getwalletinfo called "txcount" in the top level of the output JSON that will list the number of transactions inside the wallet.
{
  ...
  "txcount": 680899,
  ...
}


text:
What's Bitcoin url or where can I find it
What is a Bitcoin transaction url? Is that the wallet or hash or what. I sent btc to address for game n it says confirmed but never came. Now the host is asking for transaction url but ?

There is no such thing as a Bitcoin transaction URL. Bitcoin transactions are identified by a transaction-ID which looks like 31144ef6faaad902f3ec4e6f6241aa09f9ea08374abb67242039f3285414cd2e
There exist web sites run by various organisations that allow you to search for Bitcoin transaction data by transaction-ID. These websites are examples of blockchain explorers. For example you could find details of the above transaction at a number of websites including

https://blockchair.com/bitcoin/transaction/31144ef6faaad902f3ec4e6f6241aa09f9ea08374abb67242039f3285414cd2e
https://www.blockchain.com/btc/tx/31144ef6faaad902f3ec4e6f6241aa09f9ea08374abb67242039f3285414cd2e
https://blockstream.info/tx/31144ef6faaad902f3ec4e6f6241aa09f9ea08374abb67242039f3285414cd2e

and many others
However, any honest recipient only needs the transaction-ID, they don't need you to tell them which blockchain explorer they should be using.
Dishonest recipients will often mis-use technical terms to try and confuse you into paying them more money.


text:
How to use `blockchain.scripthash.subscribe` from a tcp socket in Electrum server
As a personal exercise I want to write a minimal copy of BTCPayServer. I decided to use Electrum server instead of a node to fetch information from the network. My final goal is to be able to track the transactions received by an address, but so far I'm stuck. I was able to use blockchain.scripthash.get_balance after some work, but now I'm having issues with blockchain.scripthash.subscribe. There are 2 things that confuse me:

This method is supposed to establish a subscription and return a notification every time the scripthash changes, as explained here. How are these notifications returned? If I keep the tcp socket open for too long, the connection is eventually closed. When I read the jsonrpc spec, notifications are more akin to something the client sends to the server, not the other way around.

How can I decode the returned status? I've read the electrumx's docs, but I'm not sure how to reverse this last step

The status of the script hash is the sha256() hash of the full string expressed as a hexadecimal string, or null if the string is empty because there are no transactions.

I'd really appreciate it if anyone has any experience, or can point me to some code/articles that explain in detail how to properly integrate electrum.


text:
Implementing a trustless English auction on Bitcoin
Is it possible to implement an English-auction type mechanic on Bitcoin (trustlessly)?
I have tried smart contract implementations in other blockchains.
For instance, one straight forward implementation has been to move bidder's bid amount into a smart contract till
i) Auction time expires, or
ii) Someone places a higher bid (in which case, the higher bid is locked into the smart contract, and the previous bid is returned to the original owner of the bid).
However, I don't have knowledge of how to do an English auction for Bitcoin (trustlessly). I'm open to using third-party crypto projects to achieve this goal (e.g. Stacks https://www.stacks.co/), or doing it natively on Bitcoin (via Bitcoin Script, if it's possible).
Conversely, if it's not possible, you can contribute that as an answer and I'll mark it correct. It will nevertheless give me closure (and anyone else searching this later). Thanks in advance.

Does this answer your question? How to make sure that bidders in an auction have sufficient Bitcoin without storing money for them?

Luke-jr's answer in that question is an impressively simple way to run an auction using bitcoin transactions, without any auction participants needing to give up custody of their funds at any time. No complicated 'smart-contracts' required!


text:
Bitcoin Recovery
I purchased Bitcoins to make a purchase, I sent the bitcoin to my Electrum wallet and later started to make the purchase. When I checked the vendor their system timed out, but Transaction ID screen in the Electrum wallet is still running conformations, with my bitcoin floating around somewhere. Is there a way to recover the bitcoin. The merchant where the attempted purchase was made does not have a wallet onsite.

Does this answer your question? Why is my transaction not getting confirmed and what can I do about it?

with my bitcoin floating around somewhere.

The Blockchain is the definitive record of where that money is. Once there are about six confirmations there is no reasonable doubt about who now has control over that money
Bitcoins don't really float about anywhere indeterminate. They are either under your control or under the recipient's control.
I believe there is the possibility of a fork in the blockchain and for the network to converge on a fork that has your transaction in a slightly later block than your wallet initially indicated - but that's relatively rare and I suspect wouldn't make any difference after an hour or so in most cases.

Is there a way to recover the bitcoin.

After six or so confirmations, the only feasible way is to ask the recipient if they are willing to return the money to you.


text:
Am I being scammed?
So this guy on instagram claims he's a bitcoin miner, and has a lot of money in his bitcoin wallet. He says he needs the username and password to my banking account to make deposits because he can't make withdraws outside of the U.S & Canada. He also claims that he will be making daily deposits of $2500.00 which I will keep 30% of and send the rest back. When I asked how I will send his money to him, first he said through Money Gram(MG), then when I asked him again he said MG won't be necessary since he wants steam cards. I didn't go through with it yet because I don't want to give him my login information. Am I being ripped off?

Yes, this look a lot like a scam.

So very obviously a scam!

It's a good thing your brain was switched on, with some it switches off when quick money announces itself

This is absolutely, 100% a scam. You are being recruited to be a money mule. Stop dealing with this person immediately. For one thing, your username and password are not needed to deposit funds.
At least part of the scam is probably this: The scammer has bought passwords to bank accounts that have been stolen with malware. He will use those credentials to transfer stolen funds to your account and you will launder the funds for him. Eventually, the people whose accounts were hacked will complain to their banks and police and the payments will be reversed. You will wind up owing the bank a lot of money, the scammer will disappear, and you will have a very bad time.
This may not be the exact scam, but it's 100% definitely a scam one way or another.

This is a scam, if you have concerns that aren’t explained by any reasonable standard, be very cautious.

Yes definitely a scam. Please don't do it. Don't give anyone your bank account's password. And also maybe it would be good act to put some screenshots and show his/her/their instagram account name, so no one will get scammed -at least- by your scammer in the future.

I don't know how to upload images to this question but his username on instagram is @avela709


text:
8333 failed after select(): Connection refused (111)
Hello I run bitcoind and i get this 8333 failed after select(): Connection refused (111).
Can you help me with this? because it was working suddenly this happened.

my bitcoin.confıg is like this ( txindex=1
rpcuser=bitcoinrpc
rpcpassword=saadia
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0)

if you use the framework rpc the default port is 8332

when I run as testnet it works but when İ run as main it failed to connect. where can i change the port? Thank you

this happens when you have a running daemon and suddenly for whatever reason the firewall starts blocking it. IT IS A FIREWALL ISSUE.
In my case I installed additional programs on my server which changed the settings of nftables (formerly iptables). I had to open up the relevant ports again (that are required by btc-daemon).
After that you have to restart both nftables as well as btcd.
Keep checking the logs for a few minutes. And you will see it will be running just fine.


text:
Running bitcoind in a different directory
I installed bitcoin core in windows 10 using ( Windows Subsystem for Linux ) . I installed ubuntu from the store and I used it to Install bitcoin core. The thing is everything was installed in the main hard disk C and it doesn't have enough space to download blocks. Is there a way to copy it to another partition (D partition because it has enough space) ? or while running bitcoind is there any way to run it with a specified path?
Ps: I hope the question is clear
Thank you

Does this answer your question? How to change the data directory with bitcoin-cli?

Make sure to stop bitcoind with bitcoin-cli stop, then move your data directory to a new folder and add the following line to your bitcoin.conf:
datadir=path/to/new/directory

This file should be somewhere in C:\Users\username\AppData\Roaming\Bitcoin\bitcoin.conf in Windows and ~/.bitcoin/bitcoin.conf in Linux.
As the user AntMor replied, you can also pass this configuration every time you run bitcoind.

Thank you Pedro! I will try it.. Just when I write datadir=path/to/new/directory instead of directory I shoud give the path to my directory, right? And if I do this whenever I run bitcoind it will be run in the directory I gave right? Thanks a lot

yes, make sure the directory exists and you will notice new files being created as soon as bitcoind starts running. When you run df -h on the command line what do you get?

when İ run df -h  I get this                                          Filesystem      Size  Used Avail Use% Mounted on
rootfs          223G  216G  7.2G  97% /
none            223G  216G  7.2G  97% /dev
none            223G  216G  7.2G  97% /run
none            223G  216G  7.2G  97% /run/lock
none            223G  216G  7.2G  97% /run/shm
none            223G  216G  7.2G  97% /run/user
C:              223G  216G  7.2G  97% /mnt/c
D:              932G  113G  820G  13% /mnt/d

so for d partition I can use this path /mnt/d ?

yes, try to move the data folder to somewhere in /mnt/d , run bitcoind as root (sudo bitcoind ...) just in case to make sure you have permissions.

It worked thank you pedro .. but when ı run bitcoin-cli -testnet getblockchaininfo in another terminal ı got this error [ error: incorrect rpcuser or rpcpassword (authorization failed)]

to enable testnet you need to add testnet=1 to bitcoin.conf and restart bitcoind. It uses mainnet by default. does it work without the -testnet option? Also you can remove any rpcuser and rpcpassword from your configuration if you plan to use it locally as it will authenticate with the cookie

Also remove rpcbind and rpcallowip if you have any.

İ will try it..without -testnet it gave me this erroer 8333 failed after select(): Connection refused (111). And bitcoin-cli was working when i don't specify the directory

when i removed what you told me ı got this error:  error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set.  See -rpcpassword and -stdinrpcpass.  Configuration file: (/home/saadia/.bitcoin/bitcoin.conf)

I am guessing it's an issue with permissions, do you see anything being filed in your /mnt/d/... folder? try running sudo bitcoin-cli ... and what does your /mnt/d/.../debug.log say?

Let us continue this discussion in chat.

You need to run bitcoind with a different -datadir parameter. This is, all the blockchain data is under a folder (binaries and database files from LevelDB). What you need to do is something like the following:
/path-to-bitcoin/bitcoind -datadir=/path-to-directory/

Thank you for your answer! How can I find the path of D partition because ubuntu that I have used allows me  to use just the terminal so I can just type commands. How D partition is known inside ubuntu?


text:
Calculate the hash of mined block using stratum parameters (coinb1, coinb2, xtranonce1...)?
Miners get several parameters from the stratum pool: coinb1, coinb2, xtranonce1, xtranonce2... according to here.
I wonder if it is possible to reproduce the hash of one already mined block, but using that info and going all the way trough, and not just the merkle root from the block.
The only way I could think of is if, somehow, those parameters could be retrieved from the block. Since there are hashes involved to calculate the merkle root, I would say no... but I'm not sure, or maybe there is another way.
Thx!

When a pool gives a miner data to mine it is not data for one specific block, but a template for a block. The miner hashes many variations of this block data to try to find a block that has a hash value below the current target (which is determined by the current difficulty).
To calculate the hash of a block on the blockchain given only the data that the miner was given from the pool, you would have to do the same thing the miner did. You would have to hash many different blocks in search of that low hash - only then would you know the exact data the block contains - assuming you are not allowed to look at the block data on the blockchain.
For the old getwork protocol the pool would only allow you to set the nonce value in the block header. Everything else in the block was determined by the pool server. So you would have 4 bytes (32 bits) to search to rediscover the block someone mined with the given getwork-data. That's 2^32 (4294967296) different blocks. On average you'd have to search 50% before finding the right block. That's 2147483648 hash operations to perform on average. This is done in an instant with modern mining hardware.
With the Stratum protocol it gets worse. Stratum allows the miner to modify the nonce and a part of the coinbase transaction called "extra nonce 2", the size of which is determined by the pool, but usually 4 bytes. This means the miner has 8 bytes (64 bits) to fiddle with. That's a lot of blocks to search through. 2 to the power of 64. Though on average you'd only need to try 50% of those blocks.
It's actually a bit worse than the above because the miner may have also changed the timestamp on the block (ntime field of the block header). It would be a value close to the original timestamp though.
Usually pool servers push new work data to miners quite often. If you have equally fast hardware to that which found the block, then you should be able to do the above search in less than a minute. But that assumes that your miner and the one that found the block search the nonce and extranonce2 (and ntime) in the same way. For example if both miners start with a value of zero for nonce and extranonce2 and then increment from there, then it should not take long at all.

That's a great explanation, thx @Dr.Haribo. I don't have a fast hardware. I was thinking if I could reproduce the hash without having to iterate the nonce, given that the one that solved the block is already known. So instead of calculating the hash of a mined block with the known parameters "version + prevhash + merkleroot + bits + nonce + time", do it with the "version + prevhash + coinb1 + xtranonce1 + xtranonce2 + merkle + bits + nonce + time" submitted originally by the pool to the miner that mined that block. Probably I could have written the question clearer...

extranonce2 is not originally submitted by the pool. If you already have the block, you can just hash the header and you have the hash. If you want you can certainly recreate the merkleroot yourself if you wish. But for that you need the extranonce2 which comes from the miner, not the pool.

If you want to simulate what happened when the miner found the block, but without doing so many hashes, then you could use the stratum data and add in the nonce, ntime and extranonce2 values you know to be correct (taken from the block on the blockchain).

Right, this last comment helped me to put my mind in order. Thx again. PD: I would up vote the answer but don't have enough rep yet.


text:
How to estimate available size on the extension of TLV stream of lightning payment messages
I working on "value for value" payments for podcasts using bitcoin lightning payments.
There is a standard for adding metadata to this payments, which is defined here: https://github.com/satoshisstream/satoshis.stream/blob/main/TLV_registry.md#field-7629169 (Key 7629169).
Now, I'd like to estimate how much space is left for the extension section of the lightning message (as defined in BOLT #1), given that the maximum size of the total message is 2^16 bytes (65536).
Is there a reasonable way of doing this estimation?

I once suggested a pull request to add a table with the length of all messages in the Lightning Network but this was never merged.
I guess the table is somewhat outdated by now but for easier reference you can find it here.
https://github.com/renepickhardt/lightning-rfc/blob/master/appendix-a-list_of_messanges.mediawiki
I think taking those values und substract from the 2^16 bytes is currently the best you can do to estimate (Also think of the framing of the Lighting messages as there is a small header and the table only shows the length of the payload).
However you will not know what other TLV streams might be added. Yet if you are implementing this anyway you should be in full control over your data? I mean you set the length of the TLV stream yourself that you append to the message.

Thank you Rene, the table you shared is a good reference.
I do have full control over the TLV streams on the extension, so I'll know how much to subtract.
One thing I could not sort out yet, which messages are sent when I pay an invoice (or in my case, send a keysend or spontaneous amp payment) - if you have a reference for that (preferably "for dummies"), I'd be grateful.


text:
How transactions or wallet balance are retrieved from bitcoin blockchain?
Using different blockchain explorers one can retrieve the wallet balance or transactions of address. My question is how does this query works do they search the whole blockchain for the related address transactions and calculate the wallet balance? If so isn't it time consuming to do it this way ?

The process you describe is essentially correct. There is no way around that.
To improve efficiency, the results can be calculated in advance by processing the blockchain just once. Obviously this would result in an extremely large database of addresses and balances in order to provide faster lookup.


text:
Using multiple penalty transactions to increase max HTLCs per LN channel
BOLT#2 states the below as one rationale to limit a Lighting Network channel to 483 HTLCs:

It also ensures that a single penalty transaction can spend the entire commitment transaction, as calculated in BOLT #5.

In other words: we're constrained by the maximum size (according to standardness rules) of the penalty transaction. With a P2WSH output being 43 bytes, the commitment transaction could accommodate a significantly higher number of outputs (and thus, HTLCs) and stay within the max (standardness) size of 400,000 WU. Are there any significant hurdles preventing us from using multiple penalty transactions, where the nth penalty transaction spends HTLCs [n*483; (n+1)*483[ from the commitment transaction? At first sight, it seems like quite a straightforward upgrade.
To keep the questions focused, let's ignore the other rationale of 483 signatures fitting in a single commitment_signed message.
Related question (and very useful answer): Lightning Network: How was the maximum allowed HTLCs in flight computed?

Are there any significant hurdles preventing us from using multiple penalty transactions, where the nth penalty transaction spends HTLCs [n*483; (n+1)*483[ from the commitment transaction? At first sight, it seems like quite a straightforward upgrade.

If the only goal is to increase the maximum number of HTLC outputs, the above solution doesn't have any hurdles of which I'm aware.  I believe it's something LN devs have discussed before, for example in this post I believe it's what's being called "commitment fan out".
However, it's probably worth noting that most LN implementations currently limit the maximum number of pending HTLCs well below 483 for various reasons, such as:

LN fee ransom attack, leading CLN and Eclair to lower their max HTLCs to 30.  See also the PR where LND made this configurable.
Mass closure attacks (described in the original LN paper) where Mallory can get a large number of channels to all be forced closed at the same time, making them compete against each other for block space, raising fees massively and possibly leading to some channels not closing on time.  More HTLC outputs per channel means (in the worst case) more data per channel so fewer channels need to be forced closed for the attack to become viable.
Channel jamming attacks, which isn't made relatively worse by having more HTLC outputs available, but just makes the absolute number of blocked HTLCs higher

Another consideration is that it's possible for two peers to have more than 483 HTLC slots between them by simply opening a second channel between themselves.  When forwarding a payment, they can then use whichever channel they prefer, not necessarily the one requested by the payment creator (e.g. they can use a different one of their channels for liquidity reasons).  This has most of the advantages of the nested-HTLCs you propose (and all of the downsides described here previously) and doesn't require any changes to the protocol.
In short, I think the approach you describe is possible but there isn't high demand for more than 483 slots per channel, and what demand exists is being met using alternative approaches.

Pre-eltoo a penalty (or justice) transaction is stored for every commitment transaction in case a revoked commitment transaction is broadcast by the counterparty. If each commitment transaction required multiple (e.g. x) penalty transactions to sweep all the funds that would multiply the storage requirements by that factor of x and require multiple transactions to be confirmed on the blockchain in a timely fashion. It would be possible but far from ideal.
Post eltoo there are no penalty transactions, the latest commitment transaction can spend the outputs from the revoked commitment transaction so everything has to be a standalone commitment transaction.

Having multiple penalty transactions doesn't really change the on-chain scaling behaviour much. For any meaningful number of HTLCs, the transaction overhead is already negligible compared to the combined witness size of spending all the HTLCs.
The per-transaction compute and storage requirements would indeed scale linearly with the number of penalty txs, but only affects the two channel partners - and can be a worthwhile trade-off for partners that prefer to have more HTLCs on their channel, e.g. in a semi-trusted relationship, I think?


text:
Why Full Node stores whole blockchain instead of only the UTXO set?
So I have started learning bitcoin recently (from Bitcoin and Cryptocurrency course @ Coursera). And I just learnt that there are "Full-Validating Note" out there that are:

Permanently connected
Store the whole blockchain
Hear and forward every node/trans

My question is why the Full Nodes need to store the whole blockchain instead of just saving UTXO set? If I understand correctly, only having UTXO is already sufficient to prevent double spending.

How old is this course? It seems outdated.

Thanks for the reply @PieterWuille . The course was published in 2015, so, it is pretty old. Could you suggest how Full Node is functioning now?

Also, in my question I said that "only having UTXO is sufficient to prevent double spending". Is that a correct statement?

You are right, and it seems this answer is outdated.
The concept of a UTXO set is more recent than Bitcoin itself. The original software kept a database with information on every transaction output ever created, including whether it was already spent. In that setting, the UTXO set was only defined implicitly by the spentness information in that database.
Bitcoin Core 0.8 (back then still just called Bitcoin) was the first full node software version to make the UTXO set explicit. At the time (2013) it was known that it was possible to also actually delete old block data after validation, as the UTXO set was maintained separately. It was only in 2016 with Bitcoin Core 0.12 that this was actually implemented using a feature known as pruning.
Historically speaking, the answer in the course was not wrong: UTXO maintenance used to imply having the full database. Since the introduction of pruning this is however no longer the case.

Its also worthwhile to highlight that full nodes that store the whole blockchain also help bootstraping new users that join the network. AFAIK, to date, there is no implementation to distribute the UTXO set.

@renlord is there any reason to not supporting UTXO set distribution? If every Full Node store only the UTXO set, would it cause any problem?

You can't verify that a UTXO set is correct without verifying its history. For minimizing trust, the full data must be available. However, it does not mean everyone needs to revalidate the whole thing every time. There is ongoing work on distributing UTXO sets in the assumeutxo project.

So why full nodes store the whole blockchain? Aren't spent transactions useless to store?

@AmirrezaRiahi They don't. Bitcoin Core at least has the option to "prune" which means deleting block data after receiving and processing it. But it still requires downloading the full blocks once, because that's the only way to convince a node about what the current UTXO set is. It also implies that someone has to be able to provide that block data, creating a need for non-pruned full nodes.


text:
Recover corrupted wallet due to system crashed
My server was crashed suddenly and didn't shut down bitcoin core probably, so now my wallet was corrupted due to it didn't be released. I try to moved the corrupted wallet to a new server but it can't be load:
Wallet file verification failed: wallet.dat corrupt, salvage failed

I have also tried to use pywallet to rescue, but getting this error:
ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again.

I suspect that my wallet.dat was totally corrupt so pywallet couldn't found main . Any help on this please ? Possible to get back my privatekey from wallet.dat please ? Thanks alot.
Information:

bitcoin version: v0.18
os: centos7

Is it true you didn't write your private-key down and put that somewhere safe  and you didn't make any backups of your wallet in particular and you also don't have the usual daily backups of all data on your server?

Ya, didn't do any backup at all. Any ways to recover ?

Recover corrupted wallet

Possible to get back my private-key from [corrupted] wallet.dat

I doubt it.
You could put in weeks of effort and not recover anything. By effort I mean learning what tools are available, how to configure and use them and how to evaluate the results. Learning more about the internal structure of wallets etc. Learning about general tools that can recover deleted older versions of files (if you immediately stop using the computer and maybe extract and duplicate the disk) etc.
Most likely you will  be contacted by many scammers offering to recover your wallet or telling you about marvelous people who can recover wallets. It is almost certain that all of them will be trying to trick you out of more money by inventing plausible seeming fees. In this website we see a lot of pleas for help from the victims of recovery scams.

Backups
Most computer users learn early on the importance of backups. Some by seeing other people's good habits, some by seeing other people's disasters and some by making our own disasters.
See Tom Scott - The Worst Typo I Ever Made
In the case of Bitcoin, it is essential to make a backup as soon as you create your wallet and again after making any significant changes such as importing a key. This sort of backup needs to be kept somewhere safe from fire, theft or accidental loss.

Backup is another topic, since that is my testing server so i didn't do any backup for it. Anyway, thanks and appreciate for your answer.


text:
Can I restore old MultiBit wallet with receive address and password?
I have the multibit receive address and the password, from maybe 2014 or so.  The actual wallet is on a drive I will have to have recovered.  Is there any way to recover with and/or without having the drive recovered?

I guess you didn't make backups and did not export your private keys and put them somewhere safe? Is that so?

There is no relationship between the password and the wallet itself.
Without the wallet file the password is of no use to you.


text:
How can I split blockchain data over two hard drives?
My node has two SSDs and the first one is filling up. The second one still has ~230GB available and I would like to move old blockchain data over there to free up an equivalent amount on the first drive.
How can I do that? The node is running on an old Win7 machine.

How about moving 'datadir' onto the other disk?

not an option. The datadir is way bigger than my second SSD. That's why I have to split the blockchain data.

You can either move a whole folder to you other disk and link it back to your original location with soft links, or move the files and make hard links for all of them.
The windows command for doing this is mklink. It's like creating shortcuts to files in other locations/drives.
I've only tested creating soft links (I moved index folders from HDD to SDD for speed) and I can confirm it works. I think hard links should work as well.
In your case, moving the folders wouldn't solve your issue, since the data would still be on only one drive. So the solution would be to move the large files to your "empty" disk and make hard links for all those files.

Thanks! Moving only large files is not an option since those only amount to around 30GB. Ended up using this awesome tool to to be able to quickly create soft links to all files in one go: https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html
Unfortunately it can't create hard links of files to another drive. But at least so far it's working with soft links.

It seems hard links aren't possible between 2 drives in Windows. If you soft link all your folders to a different drive, then this is not different than changing the bitcoin default directory and moving all folders there. If you soft link only some folders though, you can effectively split your bitcoin data into 2 drives.
Also, "large files only amount to 30GB" - well, files amount to 100% usage on the disk, so I'm not sure what you wanted to say.

I was referring to your comment: "So the solution would be to move the large files"
Assuming you meant to only move a few large files and manually create hard links.
This isn't practical, since not enough large files exist. The only solution is to move thousands of small files from the .\blocks folder and create soft links to each one of those files. The afore mentioned tool can indeed create soft links to individual files, not just folders. So since bitcoind keeps running fine and the log has no complaints, I assume everything is working.

Not 100% sure though, since it's possible to ctrl+x old block data out of the .\blocks folder while bitcoind is running and everything seems to keep running fine as well. Not sure how to test if bitcoind actually is happy with those soft links I created...

I understand now. You could test it with --reindex-chainstate I think - that should look for the blocks you have on your disk and rebuild the chainstate. Might take a while though.
Consider accepting the answer if you think it answered your question :)

Raid 0 could save you some headache. See wikipedia.

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

No, bot, actually RAID is a well known concept and the nitty gritty details on how to achieve it out of scope here.


text:
how to explain to a child WHAT is BTC made of which is received as reward for mining a block?
i looked at different questions in this forum but cannot still clearly figure out. i am not a developer.
ok, we have currently 6,25 bitcoin as reward for miners. how to understand in 1-2 non-technical sentences what do these 6,25 bitcoins (or millions of satoshis) represent? is this just a line of code (just numbers) which was programmed at the beginning?
i understand principle of bitcoin monetary policy, mining main principles, etc... i just do not understand WHAT is this 'coin' exactly... imagine me as child, how would you tell me what do these 6,25 numbers represent itself, what are they made of, are they just numbers we send to each other in transaction? any comparison to any currently mainstream store of values like numbers on banknote, gold ounce, etc...
thanks in advance

The 'coin' is an unspent transaction output (UTXO). It's a long number which specifies a location and some code to allow the UTXO to be accessed by a further transaction which supplies the right key. So ...

it's not a coin really
you never get sent the 'coin'. It remains on the blockchain.
you specified the utxo location before the block was mined, back when you put it in the block you mined. At that time you also created the right key to access the utxo value later.
if you have trouble with the idea that a number can have value, I suggest you consider what value your bank password has.
the value is on the blockchain, visible to all. You have control of it with the right key in your wallet.

The other answers are correct, but maybe more technical than what you would explain to a young child. Perhaps something like this is what you're looking for:
A bitcoin is a digital thing, but it is a special type of digital thing. Most digital things are not scarce, since you can just copy them infinitely without any issue. If you have a picture file on your computer, you can send it to your friends, and they can send it to their friends, and eventually everyone can have a copy of the picture.
But a bitcoin is different! While it is a digital object, it is scarce, meaning we can't just copy/paste it to create more. The way this scarcity is created is simple enough: everybody that uses bitcoin keeps track of every transaction that happens. If you send a bitcoin to your friend, you cannot then send that coin to someone else after, since everyone else will already know you no longer are the owner of it! This means that everyone keeps track of who owns each and every bitcoin, and they also keep track of changes to this record of ownership. The network uses some fancy math and cryptography to make sure that only the rightful owner of a bitcoin can spend it, but this all happens 'under the hood'.
So what is a bitcoin? Where does it exist? The answer is: on the computer of each and every person that runs a bitcoin node! In order to watch all transactions, users will run some code that keeps track of where each and every bit of a bitcoin resides. Each time someone spends some bitcoin, each of those computer nodes will update their record of who owns that bitcoin (and this is what is called the 'blockchain record').
So a bitcoin is a digital thing (some numbers/bits stored on hard drives of bitcoin nodes around the world), but because of the way the network works, it is a scarce digital thing (which makes it more like a physical object, such as gold). Really though, a bitcoin is a novel thing, so while we can compare it to other things we are familiar with, it really is a new type of thing altogether, which is  part of what makes it so interesting in the first place!


text:
Why can the race between the honest chain and an attacker chain be characterized as a Binomial Random Walk?
I am not familiar with Bitcoin, hope someone can tell me why. Thank you!
Let's consider the following scenario.
The probability of the attacker finds the next block is q and the probability of the honest node finds the next block is p.
Suppose the attacker and the honest node began to find the next block in the meantime (so they spend the same time on finding the PoW solution). If now the attacker finds the next block, since the attacker will not broadcast the block, it won't affect the honest node. The honest node will continue to work on its own PoW. So maybe the probability of the honest node finds the next block is larger than p now (Because the honest node now will spend more time than the attacker on finding the solution of the next block's PoW).
Why can Satoshi consider this catch-up process as the gambler game? Is this just a simplified math model? Or is there any procedure I don't know such that once one node finds the next block, all miners will restart their mining work?

Great question.
So the general gist of 'random walk' is contingent on two different things:

Probability

Logic

It's better to start with the logic part because it will make the probability portion more logical.
Looking at the Logic
From the Bitcoin whitepaper, Satoshi states:

"The race between the honest chain and an attacker chain can be characterized as a Binomial Random Walk. The success event is the honest chain being extended by one block, increasing its lead by +1, and the failiure event is the attacker's chain being extended by one block, reducing the gap by -1."

"The probability of an attacker catching up from a given deficit is analogous to a Gambler's Ruin problem. Suppose a gambler with unlimited credit starts at a deficit and plays potentially an infinite number of trials to try to reach breakeven."

Breaking This Down
If we were to consider a miner to be an "attacker" then that means that they must have "reversed" a transaction they spent in order to spend it elsewhere (maybe to a wallet they own).
Using this principle, we know that the transaction must be in the past.
So if we're mining at block height 'n', then at best, the attacker must start at n-1 (since they need to reverse a transaction that already was mined in a block).
Here's Where Probability Comes in
As that miner attempts to catch up to the network, they're already at an inherent disadvantage since they're a block behind.
Assuming the network solves for 'n' before the attacker solves 'n-1', then their chances of then solving 'n-1', 'n', then ultimately solving 'n+1' (the new block that the network is working on) decreases substantially.
With this decreased possibility of catching up, the network's probability of extending the lead then increases.
Formula
Not sure if this suffices, but Satoshi included both a formula and C code in the original whitepaper.
The formula is as follows:

The C code is as follows:

#include "math.h"
#include "stdio.h"

double AttackerSuccessProbability(double q, int z)
{
 double p = 1.0 - q;
 double lambda = z * (q / p);
 double sum = 1.0;
 int i;
 int k;
 for (k = 0; k <= z; k++)
 {
     double poisson = exp(-lambda);

     for (i = 1; i <= k; i++)
     poisson *= lambda / i;
     sum -= poisson * (1 - pow(q / p, z - k));
 }
 return sum;
}

int main()
{
double ans = AttackerSuccessProbability(0.1, 1);
printf("'%f'", ans);
}

Hopefully this explanation thus far makes sense (and you find the answer to your question to be adequate)


text:
how make an membership app
Suppose I want to write a membership payment app. In this program, I want to give an address and members should send their membership fee to this address:

How can members prove that they paid the fee ?
What do I have to get from members to prove it?
how app should check and verify the owner of transaction ?

I know there is software for this, but I want to know how this system works.

i don't want use different address for each membership transaction.

you still should

let me describe a scenario : I get 1btc from  user-A  to address-A and 2btc from user-B to address-B now app have 3btc and app want send 3btc to another address , how it is possible to send 3btc from 2 different addresses in one transaction ?

Transactions don't really have a "from" address. They have inputs, which spend outputs created by previous transactions. It doesn't matter what addresses those outputs were sent to. Think of it as melding and reforging coins.

with a single private key can I provide many addresses to users ? or I should make private key for each addresses ?

Every key corresponds to one address. Wallet software will do all of this for you.


text:
Does this accurately show how a crypto-currency miner software works?
just got a question here:
Does this flowchart accurately show the step-by-step workings of a typical crypto-miner software?
I'm a newbie in the cryptocurrency business. Though I welcome comments and objections, please be understanding...

I’m voting to close this question because your question is a localized request for proofreading and feedback that is not comprehensively answerable, asks others to do your work for you, and unlikely to be useful to others. This sort of question would be more appropriate on a thread-based forum such as reddit. Here, we expect users to ask concrete questions that can be comprehensively answered.

You could ask about the same topic here by breaking out concrete questions about the mining flow, e.g. "How does an asic verify whether a block is valid?", "how does a miner get paid for mining?", etc.

About your new diagram: https://i.sstatic.net/WNCen.jpg
Firstly "execute mining software" implies that you have maybe at least 1% of the network hash and solo mining. Otherwise, the process is just:

Use the stratum protocol to receive the block template and the difficulty target
Attempt hashes until the block is valid in hardware.

Then every node verifies the block. This would be the bottleneck, so instead it's enough that

the block template is valid (done by the pool operator's node)
the difficulty target is reached

and checking for the target is done by the hardware, in the mining loop.
So it's the hardware that mines.
Instead of "mining software stores coins into miner's wallet address", it's the block template that has the destination address. When the generated block is valid, so is the new coinbase transaction, and the coins are minted.

Does this flowchart accurately show the step-by-step workings of a typical crypto-miner software?

No.
Just to take one example of many errors:

Verification node sends reward (mined coins) to miner's software.

This is not how Bitcoin mining works at all. The Bitcoin whitepaper does not define Bitcoin nodes that are specifically verification nodes nor does it define Bitcoin nodes with some special power to send mined Bitcoins to Bitcoin miners.
When Bitcoin miners construct a block and hash it, they construct a block with a first transaction that places a mining reward "into" the Bitcoin miner's wallet. There is no need for any third party to do anything. If the hash meets the target criteria (less than current difficulty level) and the other block contents are valid, then the block will be generally accepted by other Bitcoin nodes and other blocks will therefore be built on top of it (i.e. reference it) eventually making it possible for the Bitcoin miner to spend the "coin" in their wallet.
Bitcoin mining pools can be organised any way their creators can dream up. It would be possible to create a Bitcoin mining pool API that separated Bitcoin mining and verification roles and which had verification nodes that distributed shared rewards to pool participants. However there is no necessity for different pools to work the same way as each other.

If my previous diagram is wrong, then is my revised flowchart below the correct one now?
https://imgur.com/a/RaRgWEb
I want to understand how mining works so I'm starting from the beginning - that is, mining on my own first. Kinda find the diagram for mining pools really complicated - so I'm starting with this first...


text:
Where and when should the coinbase transaction(including the miner key) be added?
I'm making a simple demonstrator program, pretty much a simplified bitcoin clone based mostly on the original whitepaper.
Please bear with me, because I haven't found a way to describe the problem more concisely.
My blockchain is based on this tutorial.
However, it completely ignores the transaction part, so I've based the transactions on this part of the original documentation:

As specified here, my transactions consist of the next owner's public key and the signature of last transaction signed by the previous owner. I also added the amount being transferred (I'm not using the in/out system for the sake of simplicity).
Since each transaction needs a hash of a previous one, I also created a coinbase transaction. It only contains  the mined amount and the miner's public key (to know whom to give the mined amount). This allows for the first regular transaction in a block to have a previous transaction to hash and sign.
However, that also means that the miner key has to be specified before the first transaction is made (since all future transactions require that the coinbase's hash stays the same).
At the same time, it does not make sense to specify the miner before they have mined a block.
In other words, this would require the transaction user to know a priori who will mine the block with their transaction.
My assumption so far was that a coinbase transaction is added to the unconfirmed transaction list after the previous block is mined, and new transactions refer to it. Then the whole list is put into a block which is then mined. However that assumption led to the aforementioned problems.
The only possible solution which I could come up with is using the last transaction hash from the previous block to sign a new transaction, effectively bypassing the coinbase transaction. But that doesn't seem right to me.
Please, tell me if I'm missing something, or got the wrong idea somewhere.
Where and when should the coinbase transaction(including the miner key) be added?
Or should I scrap that idea completely and use the "bypass" method?
PS. I've already tried searching various wikis and questions, but nothing realy gave me a clear solution to this.
Especially, this answer is too vague

You have the idea wrong: each transaction doesn’t need to reference the transaction that comes before it in a certain block, it needs to reference the transaction that created the outputs it is now spending. This ‘chain of transactions’ refers to following the history of certain outputs through time, not just the arbitrary transaction ordering within a block.
So the second transaction in a block (first non-coinbase transaction) will reference the transaction(s) that created the outputs it is spending. It will not reference the coinbase transaction.

Thanks! I figured it out using the previous answer and digging in block explorers, but now I have confirmation that my conclusions were right.

The coinbase transaction is created when the miner creates the template for the block which they attempt to mine. Unlike regular transactions, it does not have regular inputs. The miner simply specifies the outputs to spend the coins, where the sum of the output amounts must be less than or equal to the total amount of fees in the block plus the subsidy. The coinbase is always positioned as the first transaction in the block.
The coinbase transaction has the same structure as regular transactions, but for each txIn it has, any txOutPoint should just have a zero value (there is no previous txid to refer to). The scriptSig can contain arbitrary information, as miners do not need to sign anything. Miners add information to the scriptSig such as their name, or additional source of entropy for mining. Additionally, some consensus rules which have been soft forked into Bitcoin require that the scriptSig contains the block height and a merkle root of wtxids (for segwit).
The process is roughly like this:

Miner creates a coinbase template which spends some not yet known amount of money to one or more outputs.
Miner sorts transactions in the mempool by highest paying fee per weight unit (per byte in original), and picks some number of transactions such that their serialized size plus the serialized size of the coinbase is not greater than the block size limit.
They sum all fees paid in the included transactions and add it to the subsidy to create an amount that the block is worth.
They update the coinbase template with at most this amount being spent (it is possible to not claim the full amount of fees or the subsidy, but overclaiming produces an invalid block).
The miner computes the merkle root of all of these transactions txids (where the txid is the double-SHA of the serialized transaction), taken as a binary tree ordered by the position the transaction is serialized in the block. The coinbase is explicitly the first transaction.
The miner inserts this merkle root into a block header with the 5 other required fields (version, prevBlockHash, target, nonce and timestamp) and serializes it.
The miner repeatedly attempts double-SHA256 on the block header until the resulting digest, when taken as an integer, is numerically less than or equal to what is required by the target in the header. The miner modifies the nonce, or occasionally timestamp for each double-SHA256 attempt so that a different digest is produced, but the other fields of the header remain unchanged.
At some regular interval, if the miner has not yet found a successful hash, or if a new block is received, they compute a new template by starting this process from the beginning, which can take new information and may provide a higher reward. They discard the previous template they were working on. If a new block was found, any transactions which were included in the block are dropped from the mempool.

Thank you, this was informative and helped me find the exact solution myself.


text:
Unexplained fee in electrum to localbitcoins transaction
Unexplained fee in electrum to localbitcoins transaction. How to avoid this in future? I was trying to make a transaction from electrum to localbitcoins 120$, paid 57$ fee for the transaction.

https://www.blockchain.com/btc/address/38Q5TNhLdbZzKfnHVmdFgLXxaoTMipJgjp


text:
Why is "cancel canal can" an invalid BI39 (3 word) mnemonic phrase?
Is there an entropy rule that prevents this particular combination? e.g. it's not random enough?
Or is this just a bug on this generator tool I'm using: https://iancoleman.io/bip39/#english

nevermind i figured it out. final word needs to be checksum.

To nitpick your comment: each word encodes 11 bits of entropy. In the context of your question (3 word phrase), the checksum would only contribute 1 bit, not the 'whole last word' (which encodes 11 bits in total).

When generating a BIP39 mnemonic seed phrase, the user will first want to generate an entropic value ENT (as referenced in the BIP39 docs), which will be used to generate the mnemonic.
Note that it is very important that ENT be of suitably high entropy, or else the resulting mnemonic phrase will be insecure against brute force attacks. Choosing your own words is similarly insecure - always start with a proper source of ENT, and then derive the words from it.
Next, we take the SHA256 hash of ENT, and then concatenate the first ENT/32 bits of the result to the end of ENT. This works as a checksum on the mnemonic.
Once this is done, we split the result into groups of 11 bits, and encode each 11-bit group into a word, using the BIP-39 word list.

With your example, a 3-word phrase would encode 32 bits of entropy:
32 bits + (32/32) bit checksum = 33 bits
 33 bits / (11 bits/word) = 3 words
This amount of entropy is extremely insecure against brute force attacks, if you store funds at a wallet generated from this mnemonic seed, you should expect them to be stolen. It is generally recommended to use at least 128 bits of entropy (12 words), with 256 bits (24 words) being a common standard.


text:
Import all wallet addresses efficiently for explorer
I'm trying to build an explorer and I need to pull information about the wallet address such as transactions.
Do I have to loop through everything with importaddress or is there an easier way?
I already have the blockchain indexed so I can look at transactions outside my own.

If you want to import multiple things at the same time using the Bitcoin Core RPC, then importmulti is the best way to do so. It takes an array of JSON objects which can contain descriptors, scriptPubKeys, addresses, keys, and other metadata. It is a very useful RPC.

would i have to do this every single address? how would the loop for php look like? would i have to loop through every block then every transaction?

Hi Daniel, I'm not sure I understand your question. You can pass all the addresses into a single call to importmulti and it will import all of them at once.

im trying to build an explorer, but i need to add every since wallet on a watch list. do i have to loop through the block hashes then loop through the transactions? i have to essentially add every since address to this function?

@Daniel if you want to add every address ever used on the blockchain, then you might want to reconsider your approach. Bitcoin Core is not designed as a blockchain explorer backend. In that case, you should create your own database and store all the data yourself rather than importing every single address into a wallet.

how can i obtain information about that address other than adding the watchlist wallets?

Manually parse the blockchain for all transaction data using your own program, Bitcoin Core is not designed for that purpose so using it would be inefficient.

If we maintain a separate table for all the balances, how to we deal with block re-orgs?


text:
bitcoin-qt importaddress not working
using bitcoin-qt 0.19.0.1 on mac, I type this in console:
importaddress someaddress "" false
After I hit enter, the output is "null". What's wrong ?

This is normal - importing an address does not produce any output, and you will see null in the debug console.

ok fine, except that nothing gets imported

If you don't rescan, you won't see any transactions relating to that address - your posted command also seems to be missing the actual address, but I assumed you had redacted that for privacy

I have a pruned chain, how long will a rescan take ?

With a pruned chain, you'll only see transactions for the blocks that haven't been pruned yet even after a rescan - there is no way to do a complete history on a pruned node (you will, however, always get an accurate result for the currently spendable balance even with a pruned node) - a full rescan on my nodes tends to take about 40-80 minutes, depending on what else is running. Should be less for a pruned node

when I try importaddress with rescan=true I get: Rescan is disabled when blocks are pruned (code -4). So it seems "importaddress" never works when in pruned mode


text:
how check bitcoind default values
How can I see which values bitcoind is using for eg. dbcache, or other memory and connection params ? If the value is NOT set in bitcoin.conf. Is there a bitcoin-cli command to check all the params ?

You can see all available command options by running the command bitcoind -?.
Similarly, in the GUI you can check out "HELP" -> "Command Line Options" in the task bar.
This will return a list of all available commands, as well as their default values (when applicable). Note that this just returns all possible command options, not specifics about what you have set. Default values will be used unless you specify otherwise, and I believe the hierarchy for specifying a command option is:
An option passed on command line when starting bitcoind
(takes precedence over)
an option passed in .conf file
(takes precedence over)
an option set in the GUI
(Information pulled from here)

I don't see any option for dbcache (for instance), how can a find out the default value?

No? Which version are you running? With v0.17.01 I see it under the Options section at the top: -dbcache=<n> ... default: 450

you are right, I was looking at bitcoin-cli instead of bitcoind


text:
Bitcoin core doesn’t see transaction
I’ve created address in bitcoin core from rpc and send some bitcoins on it, but my balance still zero. Transaction exists I’ve checked on blockchain info. Getaddressinfo returns “ismine”: true, but getreceivedbyaddress returns zero

Are you fully synchronized with the blockchain? You won't see the transaction until you are.

I use prune mode, the last time I used it, it worked well.  Where can I read about this?

Pruning has nothing to do with it. What do you see with getblockchaininfo RPC?

"chain": "main",   "blocks": 445138,   "headers": 614383,   "bestblockhash": "0000000000000000002de7741730df4307a0b07af877fdac1f03b9be9e97da54",   "difficulty": 310153855703.4333,   "mediantime": 1482716862,   "verificationprogress": 0.3696978576853237,   "initialblockdownload": true,   "chainwork": "00000000000000000000000000000000000000000034fc10a015a432503589bd",   "size_on_disk": 533371171,   "pruned": true,   "pruneheight": 444665,   "automatic_pruning": true,   "prune_target_size": 576716800,

You'll need to wait until blocks == headers. You're about 3 years worth of blocks behind.

As pointed out by Peter in the comments of your question, you will need to wait until your node has synced with the longest chain. At the time of your comment, you are 169,245 blocks behind which, unless your transaction took place ~3 years ago, will not be known to your node yet. As soon as the block containing your transaction is verified by your node, you will be able to see the transaction.


text:
Transfer of BTC the wallet address p2pkh to wallet address p2sh
Is it possible to send BTC from wallet having address type p2pkh to the receiver wallet address p2psh

As long as a utxo is spendable, there are no restrictions on the types of outputs - any kind of input can be used to create any kind of (valid) output, which will usually be one of the well known ones - i.e. p2pkh, p2sh, p2wpkh, p2wsh, op_return, p2ms, p2pk.


text:
Cryptocurrency wallet passphrase 10 word?
I have a pass phrase with 10 words but can't remember what wallet I used, an every one I have tried is 12. Does anyone know ?

It is possible to have a nine word mnemonic + 1 passphrase word, although it is unusual - you'd probably remember if you specifically chose that combination.
Electrum in BIP39 mode should be able to work with it.
It could also be some random wallet's passphrase system which does not conform to BIP39, in which case electrum will give you a checksum error when you try. If this is the case, you're out of luck unless you can locate the original wallet software.

In the past Electrum seeds could be smaller than 12 words. So try restoring using electrum.

Could they really?

@Anonymous yes: https://github.com/spesmilo/electrum/pull/3611

I also have a 10 word seed phrase. they have updated their encryption. so anyone with a 10 word phrase is now SOL


text:
Where is the block reward system coded in Bitcoin core?
I'm taking a look at Bitcoin core and am looking for where the TX is effectively "generated" and send out to an address. I've found the nSubsidy block reward, but I'm currently looking for where the transaction is sent out and recorded on the blockchain. If I don't understand something right, please correct me, otherwise, if you have an answer please tell me!

The coinbase transaction is added to a block template by a miner:
https://github.com/bitcoin/bitcoin/blob/4af01b37d40246cd1fdb54719855927e36a36b46/src/miner.cpp#L157-L167
When the block is solved, the entire block is broadcast to the network.
Outside of a new block, you'll never see a subsidy transaction being broadcast on their own. Here's the logic that rejects subsidy transactions from mempool acceptance:
https://github.com/bitcoin/bitcoin/blob/4af01b37d40246cd1fdb54719855927e36a36b46/src/validation.cpp#L575-L577


text:
how is litecoin different from bitcoin
So far, i only know that litecoin is using another mining algorithm called Scrypt which has some ASIC resistance. Is there any more difference? Or they are completely the same except the mining algorithm

Another key difference is the rate at which new blocks are generated. Bitcoin blocks are created every 10 minutes or so. Litecoin blocks are produced every 2.5 minutes. This has implications in terms of security of the coins against double spending.


text:
Why are there so many fake cryptocurrency airdrops?
I started learning about cryptocurrency three months ago and I have come across many airdrops spread by scammers who disappear after many persons have signed up on their platform. Are there ways one can identify the scammers in the crypto space?

There are so many airdrops, scams and fake projects, because it is an easy way to make money quickly.
Over the past years I've identified the following heuristics:

If it sounds too good to be true, it definitely is
If it's not clear how a service/project is making money, you're not a customer, but a victim
Whenever someone requests actions from you out of the blue, it's a phishing attack or scam
Nobody gives money away for free, there's either a catch, it's a scam, or you're the product
Extraordinary claims require extraordinary proof, anything unproven is just marketing
Altcoin software is malware trying to steal your bitcoins until proven otherwise
Everyone is a scammer until proven otherwise
The "next Bitcoin" is Bitcoin

There are scammers because there are people susceptible to being scammed. There is no way to be 100% certain that something is not a scam. Just be smart, and don't enter your private key or passphrase on random websites.


text:
Error while broadcasting the raw bitcoin testnet transaction
I am trying to create a simple P2PKH raw bitcoin testnet transaction from the scratch. Here is the information about the transaction:
hash of the UTXO consumed - 03e3f89f38ea81a5f1ed277e6ac424cebde4426f4bcc291006f7ecf67350e986
index of the UTXO - 1
private key of the input - 4b5963fc219d1848cc67d52e0a929340f88ff9d316b1990b24d0ae1d37edeef1
UTXO amount - 0.01 tBTC
receiving address - mtCrEgpKyRhLguqGySE4qUFXzn8sMG7hrm
receiving amount - 0.001 tBTC
change Address - mjHQ5W5B14psNsYBEmh1BykXyY4sY9r9DF
fees used - 378 sats
change amount - 0.00899622 tBTC

Here is the unsigned raw transaction I created:
010000000186e95073f6ecf7061029cc4b6f42e4bdce24c46a7e27edf1a581ea389ff8e303010000001976a914d4dc68f4d94196536c0726f51a91d500c7afa60888acffffffff0226ba0d00000000001976a914295033e5bfe3e8734334addc62c82d9c6eab981388aca0860100000000001976a9148b2d174384a41deeb78e012f4582e29b6e0d161588ac0000000001000000

Double SHA-256 digest of the above to be signed:
4b5963fc219d1848cc67d52e0a929340f88ff9d316b1990b24d0ae1d37edeef1

Next I am using self-written ECDSA library to sign the transaction. I have signed the above transaction using my library three times.
Signed Transaction 1:
010000000186e95073f6ecf7061029cc4b6f42e4bdce24c46a7e27edf1a581ea389ff8e303010000006b483045022100a482537e4225c1ba3470c68d2304d807a6e245491b486e1c6d0778a8436d25dd0220cf4cc90f2e41cafca39555caeb47be235b9c10c2b497528532cb419a7736a8d1012103ab127bf811fd8a6753fbc8cd68731a120d05ac64f1e03df5ec223d7a734e6199ffffffff0226ba0d00000000001976a914295033e5bfe3e8734334addc62c82d9c6eab981388aca0860100000000001976a9148b2d174384a41deeb78e012f4582e29b6e0d161588ac00000000

Signature: 3045022100a482537e4225c1ba3470c68d2304d807a6e245491b486e1c6d0778a8436d25dd0220cf4cc90f2e41cafca39555caeb47be235b9c10c2b497528532cb419a7736a8d1012103ab127bf811fd8a6753fbc8cd68731a120d05ac64f1e03df5ec223d7a734e6199

R: a482537e4225c1ba3470c68d2304d807a6e245491b486e1c6d0778a8436d25dd
S: cf4cc90f2e41cafca39555caeb47be235b9c10c2b497528532cb419a7736a8d1

Signed Transaction 2:
010000000186e95073f6ecf7061029cc4b6f42e4bdce24c46a7e27edf1a581ea389ff8e303010000006b48304502210076a3092727f537453e938a07c9558c605bb79824972b50386e909d8b0394f9700220745b9869b1a4e7b4671a538b7f015a19567250a66f7e965af09060450fdf4288012103ab127bf811fd8a6753fbc8cd68731a120d05ac64f1e03df5ec223d7a734e6199ffffffff0226ba0d00000000001976a914295033e5bfe3e8734334addc62c82d9c6eab981388aca0860100000000001976a9148b2d174384a41deeb78e012f4582e29b6e0d161588ac00000000

Signature: 304502210076a3092727f537453e938a07c9558c605bb79824972b50386e909d8b0394f9700220745b9869b1a4e7b4671a538b7f015a19567250a66f7e965af09060450fdf4288012103ab127bf811fd8a6753fbc8cd68731a120d05ac64f1e03df5ec223d7a734e6199

R: 76a3092727f537453e938a07c9558c605bb79824972b50386e909d8b0394f970
S: 745b9869b1a4e7b4671a538b7f015a19567250a66f7e965af09060450fdf4288

Signed Transaction 3:
010000000186e95073f6ecf7061029cc4b6f42e4bdce24c46a7e27edf1a581ea389ff8e303010000006b4830450221009b6cf3115f5738998b249cafecd69bc489b770cb104a885f93f000df662ca9860220459c6548f4a5b8032529069d704857b92ff3693684be401430a7ca6b2c28e66d012103ab127bf811fd8a6753fbc8cd68731a120d05ac64f1e03df5ec223d7a734e6199ffffffff0226ba0d00000000001976a914295033e5bfe3e8734334addc62c82d9c6eab981388aca0860100000000001976a9148b2d174384a41deeb78e012f4582e29b6e0d161588ac00000000

Signature: 30450221009b6cf3115f5738998b249cafecd69bc489b770cb104a885f93f000df662ca9860220459c6548f4a5b8032529069d704857b92ff3693684be401430a7ca6b2c28e66d012103ab127bf811fd8a6753fbc8cd68731a120d05ac64f1e03df5ec223d7a734e6199

R: 9b6cf3115f5738998b249cafecd69bc489b770cb104a885f93f000df662ca986
S: 459c6548f4a5b8032529069d704857b92ff3693684be401430a7ca6b2c28e66d

I used Blockstream Broadcasting tool to push my transaction. However, signed transaction 1 and 2 failed with the following error:
sendrawtransaction RPC error: {"code":-26,"message":"non-mandatory-script-verify-flag (Non-canonical DER signature)"}

Finally, signed transaction 3 went successfully and confirmed on the blockchain. I have verified all three signatures and there is nothing wrong in ECDSA params R and S. So, in my view the problem locates in the DER-encoding of the signature. Help me locate the problem about why do the sig-script verification failed for the first two transactions.

There are a few rules regarding the DER signature that you are not following. In the first transaction, you fail to follow the Low-S value rule. In the second transaction, you fail to follow the strict DER encoding rule.
In the first transaction, the s value is too high. Current standardness rules require that the s be between 0x1 and 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 inclusive. Your s is out of this range. To convert a high s to a low s, you do s' = n - s where n is the order of the secp256k1 curve, i.e. n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141.
In the second transaction, your signature does not follow the strict DER encoding rules. These rules are defined in BIP 66. Specifically, the r is encoded using 33 bytes when only 32 bytes is sufficient. The 0x00 that you have prepended is unnecessary in this case because r as a 32 byte signed integer is positive. That prepended 0x00 is only necessary when r as a 32 byte signed integer would be a negative number, i.e. the top bit is set.
In your third transaction, you got lucky. Because you are using a random nonce, half of the time s will be low, and half of the time r as a 32 byte integer will be negative and require the prepended 0x00 to become positive. So 1 in 4 signatures should be accepted, and that's basically what we see here.
Related to the error in the second transaction, on thing you need to watch out for is when r or s is smaller than 32 bytes. This rare, but it can happen. Essentially the rule for encoding these numbers is to encode them as a big endian signed integer but do it as small as possible.

Thank you for the answer Andrew. I wasn't aware of DER encoding rules as defined in BIP-66. I have tried to inculcate the rules in my code. Now I am converting high S into low S which solves problem for half of the transaction. However, R encoding is still not working when R as signed integer is positive. Let me show you the example:
304402203faf4f96f781a8819531c4a78a35e9c4ea3f1f4ef56493d18eff52881cdf43a702206b0f0072964a7819a9c223f38d7fd73c7063423cb49aa480eedc3b284b41c23b01210329d4fec73ecf28f4bcbe7e235c63764e1c7c3ba7f1d90feeea9be1a8a0696498
What could possibly be wrong?

@CryptoSar How do you put this in a transaction? The signature seems fine to me but maybe you are encoding it incorrectly in the transaction.

Yes, you are right Andrew. Actually the problem was in the byte just before signatures representing the sig length. I have rectified it and it is working 100% now. Thanks once again.


text:
If SHA256 is successfully attacked, will we need to replace the hash function and re-timestamp the entire blockchain from the beginning?

If SHA256 is successfully attacked, what measures will be taken to replace the compromised hash function?

In the event of a SHA256 attack, will it be necessary to re-timestamp the entire blockchain from the beginning?

What are the potential challenges and implications of switching to a new hash function in the blockchain?

This question is similar to: If SHA256 and/or RIPEMD-160 were broken, would all bitcoin addresses be compromised?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem.

There was a similar question to this on the BitcoinTalk forum in 2010, to which Satoshi Nakamoto contributed:

SHA-256 is very strong.  It's not like the incremental step from MD5
to SHA1.  It can last several decades unless there's some massive
breakthrough attack.
If SHA-256 became completely broken, I think we could come to some
agreement about what the honest block chain was before the trouble
started, lock that in and continue from there with a new hash
function.
If the hash breakdown came gradually, we could transition to a new
hash in an orderly way.  The software would be programmed to start
using a new hash after a certain block number.  Everyone would have to
upgrade by that time.  The software could save the new hash of all the
old blocks to make sure a different block with the same old hash can't
be used.