text:
Nbitcoin's BitcoinPubKeyAddress not recognizing native segwit addresses
I'm trying to build a transaction using Nbitcoin. When I run this line there is an error parsing the address. It runs fine with segwit addresses starting with a 1, but not native segwit.
Using System;
Using System.Text;
Using NBitcoin;

static void Main(string[] args) {

    var wallet = new BitcoinPubKeyAddress("bc1q....", Network.Main); //throws error
}

Error: System.FormatException: 'Invalid base58 data'
Is there a way to use native segwit with Nbitcoin? Thanks


text:
How many bytes of entropy are recommended for seeding a mnemonic phrase?
If I wanted to generate a 12 word mnemonic, how many additional bytes of entropy is recommended I use?

How do you mean "additional"? The words are your entropy.

To note: you should not choose your words, you should generate entropy in as random a way as possible, and then that entropy will be encoded into a mnemonic seed phrase. Humans are very bad/unreliable sources of entropy!

Sorry I meant in total how much entropy is considered secure for generating the mnemonic phrase?

To generate 12 words mnemonic, you have to seed 128bits(16bytes). It's not a recommendation but rule.
Below is detailed explanation from BIP39.

The mnemonic must encode entropy in a multiple of 32 bits. With more entropy security is improved but the sentence length increases. We refer to the initial entropy length as ENT. The allowed size of ENT is 128-256 bits.

First, an initial entropy of ENT bits is generated. A checksum is
generated by taking the first ENT / 32 bits of its SHA256 hash. This
checksum is appended to the end of the initial entropy. Next, these
concatenated bits are split into groups of 11 bits, each encoding a
number from 0-2047, serving as an index into a wordlist. Finally, we
convert these numbers into words and use the joined words as a
mnemonic sentence.

The following table describes the relation between the initial entropy
length (ENT), the checksum length (CS), and the length of the
generated mnemonic sentence (MS) in words.

CS = ENT / 32
MS = (ENT + CS) / 11
|  ENT  | CS | ENT+CS |  MS  |
+-------+----+--------+------+
|  128  |  4 |   132  |  12  |
|  160  |  5 |   165  |  15  |
|  192  |  6 |   198  |  18  |
|  224  |  7 |   231  |  21  |
|  256  |  8 |   264  |  24  |

source: Stack Exchange

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

sort: votes


text:
using curl to access the API
when I use a curl command to send json-rpc requst. I get prompted for a username and password  but afterwards I get no response.
Do I need to run a full node in order to do Bitcoin mining?

when I use a curl command to send json-rpc requst. I get prompted for a username and password but afterwards I get no response.

Perhaps your node is busy with Initial Block Download (IBD) and curl has a time-out whose default is shorter than needed for Bitcoin core under load

Do I need to run a full node in order to do Bitcoin mining?

You mainly need to spend several thousand dollars (or local equivalent) on the latest bleeding-edge ASICs and support infrastructure. I can't think of any reason why a pruning node wouldn't be adequate for use in conjunction with mining. A pruning node also needs to download the entire blockchain so this probably  doesn't help with response timeouts, just disk space.

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


text:
How does validating a transaction get more and more hard?
As far as I know, to prevent double-spend attack and to confirm that a specific transaction is valid, miners have to go through all blocks in the blockchain and check the sender's history of transactions.
until now, the blockchain has over 700,000 blocks. Isn't it computationally hard for miners as the blockchain grows?

"to confirm that a specific transaction is valid" -- note that in Bitcoin "confirmation" is producing a block containing a transaction or producing a block on top of such a block. That is very different from checking that a transaction is valid. All nodes validate, only miners confirm.

Bitcoin nodes keep track of what's called the UTXO set – the set of all unspent transaction outputs. Every valid transaction must only spend existing and not previously spent outputs, so this is enough to prevent double-spending. The UTXO set can also be stored in a way to allow efficient (constant-time) lookups, so verifying transactions doesn't require more computing power as the UTXO set grows.


text:
Advanced options of a Bitcoin wallet in bluewallet
While creating a new Bitcoin wallet in the bluewallet app, there are three options:

HD SegWit (BIP84 Bech32 Native)
SegWit (P2SH)
HD SegWit (BIP49 P2SH)

Can someone explain each option and their trade-offs?

The main trade-offs among the three Bitcoin wallet options available in BlueWallet App are related to transaction fees, compatibility, error detection, and privacy.
If you prioritize having the lowest transaction fees (smaller transaction size), better error detection and improved address readability, go for the HD SegWit (BIP84 Bech32 Native) wallet. However, not all wallets and services support Bech32 addresses yet, which could lead to compatibility issues.
If you need better compatibility with older wallets and services, choose either the HD SegWit (BIP49 P2SH) or SegWit (P2SH) wallet. HD SegWit (BIP49 P2SH) uses an HD wallet, which makes it easier to backup and restore. The SegWit (P2SH) wallet in BlueWallet has one more significant privacy drawback, namely that it is limited to a single receiving address.
You can find further explanations for all of these wallet types also on the BlueWallet website at: https://bluewallet.io/docs/create-bitcoin-wallet/
SegWit HD (BIP84 Bech32 - Native)
Is the latest bitcoin address type. It will save the most on fees and it will give you multiple addresses for best practice when it comes to protect your privacy.
SegWit HD (BIP49 PS2H - Wrapped)
It is a compromise to the new addresses type above, it provides better compatibility with older address types and most services like exchanges, but a smaller save on fees.
SegWit (P2SH)
This is a single address wallet, in case you want a wallet with just one address. The others will give you a new address every time you make a transaction. This is not good for privacy for instance, only use it if you know what you are doing.

Nearly all software and services these days support sending to Bech32: https://en.bitcoin.it/wiki/Bech32_adoption (leftmost column).


text:
How does CBlockLocator class works?
The CBlockLocator strucuture's purpose is:

Describes a place in the block chain to another node such that if the
other node doesn't have the same branch, it can find a recent common
trunk. The further back it is, the further before the fork it may be.

/** Describes a place in the block chain to another node such that if the
 * other node doesn't have the same branch, it can find a recent common trunk.
 * The further back it is, the further before the fork it may be.
 */
struct CBlockLocator
{
    std::vector<uint256> vHave;

But it's not clear to me how does it works. How does the sender specify the Block with A in this structure? Does the vHave contains a list of contiguous block hashes previous to A and A itself?

Does the vHave contains a list of contiguous block hashes previous to A and A itself?

Pretty much.
CBlockLocators are just a list of block hashes, with most recent blocks first. Of course, it would be expensive to send all of the block hashes that precede A, so the list contains hashes farther and farther apart as the blocks get older.
It starts with A and the 9 blocks that came before it. The vast majority of reorgs will be within these 10 blocks, so it just lists all 10 and there's a pretty high likelihood that the forking point will be in there. But after that, hashes start being spaced out exponentially. It starts with 2 blocks before the last in the list, then 4, then 8, and so on, until the genesis block is reached.
The list ends up having ceil(log2(n)) + 11 hashes. Currently that's 31 block hashes.

Excellent approach Andrew.

Thanks for your answer, just a question, the n in the  ceil(log2(n)) + 11 is the height of the block A?

Yes. n is the number of blocks in the chain.


text:
Does bitcoind validate every block for every time it starts?
When running bitcoind, it starts downloading the blockchain and validate every block in a row. It stores the blockchain in the ~/.bitcoin/blocks directory. And when we break daemon and restart it, starts downloading from the last block it downloaded from the previous execution and not from the first block again. This was something I understood from logs.
2022-06-11T16:51:56Z dnsseed thread start
2022-06-11T16:51:56Z addcon thread start
2022-06-11T16:51:56Z init message: Done loading
2022-06-11T16:51:56Z opencon thread start
2022-06-11T16:51:56Z msghand thread start
2022-06-11T16:51:56Z Waiting 300 seconds before querying DNS seeds.
2022-06-11T16:51:57Z New outbound peer connected: version: 70016, blocks=740373, peer=0 (outbound-full-relay)
2022-06-11T16:51:58Z Synchronizing blockheaders, height: 740373 (~100.00%)
2022-06-11T16:51:59Z UpdateTip: new best=0000000000000533f02f775db4176ec57012c76c6dc56fa3debf5f307da3d758 height=139238 version=0x00000001 log2_work=65.854192 tx=1188914 date='2011-08-02T05:59:57Z' progress=0.001607 cache=0.0MiB(308txo)
2022-06-11T16:51:59Z UpdateTip: new best=0000000000000264f2835263bdfcae0a8a4185b781fa980d0eae3e88ee4effa9 height=139239 version=0x00000001 log2_work=65.854368 tx=1189040 date='2011-08-02T06:01:53Z' progress=0.001607 cache=0.1MiB(621txo)
2022-06-11T16:51:59Z UpdateTip: new best=00000000000008ae748a17911f5d56ac7e5ede06586d98d7d6aa83ce8bda5237 height=139240 version=0x00000001 log2_work=65.854543 tx=1189100 date='2011-08-02T06:11:42Z' progress=0.001607 cache=0.1MiB(793txo)

As shown in logs above, it's downloading from height 139238. But beside downloading, does it validate the downloaded blocks again? The thing I noticed while running the program step by step using gdb, was that it calls the GetBlockProof from the first block.
(gdb) break GetBlockProof
Breakpoint 1 at 0x31be40: file chain.cpp, line 126.
(gdb) run
Starting program: /usr/local/bin/bitcoind
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.31-2.fc32.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
2022-06-11T16:58:20Z Bitcoin Core version v23.0 (release build)
2022-06-11T16:58:20Z Assuming ancestors of block 000000000000000000052d314a259755ca65944e68df6b12a067ea8f1f5a7091 have valid signatures.

...

Thread 1 "bitcoind" hit Breakpoint 1, GetBlockProof (block=...) at chain.cpp:126
126 {
Missing separate debuginfos, use: dnf debuginfo-install libevent-2.1.8-8.fc32.x86_64 libgcc-10.3.1-1.fc32.x86_64 openssl-libs-1.1.1d-7.fc32.x86_64 zlib-1.2.11-21.fc32.x86_64
(gdb) p block.nHeight
$1 = 0
(gdb) continue
Continuing.

Thread 1 "bitcoind" hit Breakpoint 1, GetBlockProof (block=...) at chain.cpp:126
126 {
(gdb) p block.nHeight
$2 = 1
(gdb) continue
Continuing.

Thread 1 "bitcoind" hit Breakpoint 1, GetBlockProof (block=...) at chain.cpp:126
126 {
(gdb) p block.nHeight
$3 = 2
(gdb)

Is this true that is starts validating blocks from the genesis block? Or my conclusion is wrong? And if no, why the GetBlockProof is called from the first block?

IIRC, it validates the best chain of headers it got, and see if this chain is indeed the best chain its peers know about. So, you won't validate blocks entirely (like, all transaction), but only the PoW performed for all headers up to now, and this is very fast.

You mean it just calculate the hash of the block to check whether it is satisfied the difficulty or not?

Yes, see if PoW is valid and sanity check (is something corrupted or so?).

If you want to validate every block, you should try setting
assumevalid=0 in bitcoin config file.
-assumevalid=<hex>

If this block is in the chain, assume that it and its ancestors are valid, and potentially skip their script verification (0 to verify all, default: 00000000000000000009c97098b5295f7e5f183ac811fb5d1534040adb93cabd, testnet: 0000000000000004877fa2d36316398528de4f347df2f8a96f76613a298ce060, signet: 000000d1a0e224fa4679d2fb2187ba55431c284fa1b74cbc8cfda866fd4d2c09)


text:
Minimum disk space required for running a full node
As far as I know, for running a full node, we should have enough storage to store the whole block chain which is currently around 390 GB. But here at the official bitcoin.org the minimum hard-disk is mentioned as 7 GB for running a full node. How is it possible?
A side question:
I have a virtual server with 100 GB capacity, and I wanted to run a full node. Can I run a full node with 100 GB storage?

As far as I know, for running a full node, we should have enough storage to store the whole block chain which is currently around 390 GB.

That's not correct. Bitcoin Core can run in pruned mode, where it downloads, processes, and verifies all blocks, but then discards them, only keeping the UTXO set and the last few hundred blocks.
A few features are unavailable in pruned mode. Obviously a pruned node cannot serve the full blockchain data to other nodes that are synchronizing, making them "leeches" in a way. Though so far, there seems to be no lack of full nodes that do serve the full chain.
Another unavailable feature is rescanning. This is only needed if you're importing an old backup of a wallet. In non-pruned mode, the wallet code can just go over all blockchain transactions to find any that may have paid it (or spent coins from it), and find its latest state. In pruning mode this is not possible, and you'd need to download all block data again.

But here at the official bitcoin.org the minimum hard-disk is mentioned as 7 GB for running a full node. How is it possible?

Running in pruned mode needs a few GB for the UTXO set, and this value may of course grow over time, but the growth much slower than the blockchain ifself.

A side question: I have a virtual server with 100 GB capacity, and I wanted to run a full node. Can I run a full node with 100 GB storage?

Running in pruned mode should be perfectly feasible.

Thanks for your answer. A question is that is there any practical difference between pruned on 50 GB or 20 GB while they both are incapable of serving blockchain to others? (the numbers 50 and 20 or just example, I mean in pruned mode does the size matter?)

If you set it to 50 GB, you can use the last 50 GB of blocks, and you can import wallet backups that are not older than 50 GB worth of blocks, for example.

What about block hashes? Are they stored separately? Because I'm running in the pruned mode with 60GB, but with bitcoin-cli getblockhash 1 I could access the hash of the first block. Though I'm sure my node has passed the 60 GB threshold and the early blocks must be removed.

Yeah, all block headers are kept. Just not the "body" (meaning the transaction data) of blocks.


text:
What are dummy batch and dummy database classes in the Bitcoin Core?
Here and here are two classes called respectively DummyBatch and DummyDatabase:
/** A dummy WalletDatabase that does nothing and never fails. Only used by unit tests.
 **/
class DummyDatabase : public WalletDatabase
{
public:
    void Open() override {};
    void AddRef() override {}
    void RemoveRef() override {}
    bool Rewrite(const char* pszSkip=nullptr) override { return true; }
    bool Backup(const std::string& strDest) const override { return true; }
    void Close() override {}
    void Flush() override {}
    bool PeriodicFlush() override { return true; }
    void IncrementUpdateCounter() override { ++nUpdateCounter; }
    void ReloadDbEnv() override {}
    std::string Filename() override { return "dummy"; }
    std::string Format() override { return "dummy"; }
    std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) override { return std::make_unique<DummyBatch>(); }
};

/** RAII class that provides access to a DummyDatabase. Never fails. */
class DummyBatch : public DatabaseBatch
{
private:
    bool ReadKey(CDataStream&& key, CDataStream& value) override { return true; }
    bool WriteKey(CDataStream&& key, CDataStream&& value, bool overwrite=true) override { return true; }
    bool EraseKey(CDataStream&& key) override { return true; }
    bool HasKey(CDataStream&& key) override { return true; }

public:
    void Flush() override {}
    void Close() override {}

    bool StartCursor() override { return true; }
    bool ReadAtCursor(CDataStream& ssKey, CDataStream& ssValue, bool& complete) override { return true; }
    void CloseCursor() override {}
    bool TxnBegin() override { return true; }
    bool TxnCommit() override { return true; }
    bool TxnAbort() override { return true; }
};

As shown in the code above, the DummyBatch is used in the DummyDatabase. The only usage I found for the DummyDatabase was here:
/** Return object for accessing dummy database with no read/write capabilities. */
std::unique_ptr<WalletDatabase> CreateDummyWalletDatabase()
{
    return std::make_unique<DummyDatabase>();
}

I can't understand what is the usage of such class which absolutely does nothing. Is it for testing or something else?

Yes, CreateDummyWalletDatabase is only invoked from tests and benchmarks.
It's used because for tests we don't want an actual database file on disk, and even creating one is annoying (slows things down, more data to clean up afterwards, ...).

If it is just for tests and benchs, why put it in the source code? Couldn't it be in the tests files?


text:
Early version of bitcoin and poker
How can we locate the code for an online poker game in version 0.1.0 of Bitcoin, which multiple articles on the internet claim was included by Satoshi Nakamoto? Furthermore, how can we verify that this code is indeed an online poker game ?

How can we locate the code for an online poker game in version 0.1.0 of Bitcoin

The article you linked to, refers to https://sourceforge.net/p/bitcoin/code/1/tree//trunk/uibase.cpp
At line 6 is a comment
 // C++ code generated with wxFormBuilder (version Apr 16 2008)

At line 1592 there is
CPokerLobbyDialogBase::CPokerLobbyDialogBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(parent, id, title, pos, size, style)

how can we verify that this code is indeed an online poker game?

Below line 1592 you can find many lines containing poker related stuff such as

Deal Me Out
Deal Hand
Fold
Call
Raise

It is vanishingly unlikely that these are not Poker related. Note that this is only small fragments of the user interface for a poker game. It is not, by a long long way, all the code for an online poker game.

Cause?
Whether this is genuine or a hoax I can't say. It does appear in several different repositories of the original source code. It looks to me like some user-interface layout definitions included by mistake from an unrelated project or accidentally left from experimentation when learning how to use wxFormBuilder.

Related sources

Where can I access the original, Satoshi written Bitcoin code?
https://www.google.com/search?q=original+bitcoin+source+code+nakamoto

Thank you very clear, I did a grep poker on the directory but didnt go deeper

Any ideas on what the initial intent of this code was for besides, "by mistake from an unrelated project or accidentally left from experimentation when learning how to use wxFormBuilder?"  What made you reach this conclusion?

@Adam: A) I see no other plausible explanation. I guess Satoshi Nakamoto, or a collaborator, was interested in poker and had started writing a poker game in C. They might not have finished the Poker project but continued to use wxWindow tooling on the Bitcoin project.  B) The absence of any mention of poker features in the Bitcoin whitepaper or other Bitcoin-related communications by Satoshi Nakamoto. Plus what I like to think of as experience as a software developer and common sense - though you are free to discount all that of course.


text:
Does bitcoin miner heat as much as a heater
If someone want to heat a room or some water for a defined amount of time and without a worry about the sound produced.
Can a bitcoin miner be a good subtitute to a modern heather with the same power consumption ?

I'd rather have a heater that makes heat and money, than a heater that just makes heat.

Makes me remember about some startup product that never went to market... for instance
https://npkdesign.com/project/nerdalize/
https://www.theverge.com/2017/6/2/15728232/using-servers-to-heat-homes-nerdalize

Possibly related. It's a Linus Tech Tips video where they hooked a radiator up to a gaming PC to see if it would do anything

another company that was trying to commercialise these appliances was called Qarnot.

Before you implement any amazing ideas, watch this video: https://youtu.be/fr8bp8a2QS4

A device that consumes N watts of power (and doesn't output electricity or some other form of energy) will eventually produce N joules of heat per second.
Thus, if your goal is converting electricity to heat, every piece of hardware that consumes electricity is 100% efficient. It's completely irrelevant what happens with that electricity before it becomes heat.
Of course, you need to take hardware depreciation/maintenance costs into account.
Also of note: as heating devices, heat pumps have over 100% efficiency, as they simultaneously consume electricity (which is turned into heat) and move additional heat from a colder area to a hotter one.

A light bulb is a decent example of a device that outputs some of the incoming energy in a different form than heat.  If some of the light makes it out a window, that part will escape your house without eventually being absorbed indoors and turning into heat indoors.

And BTW, modern heat pumps often have something like 330% efficiency when not too cold outside. (https://www.nrcan.gc.ca/energy-efficiency/energy-star-canada/about-energy-star-canada/energy-star-announcements/publications/heating-cooling-heat-pump/air-source-heat-pumps/6831 - air source heat pumps typically achieve a 3.3 ratio of heat out to input power at 10°C (cool day), or 2.3 at -8.3°C (well below freezing)).  So it's not just over 100%, it's much over. Heating your house in winter with some bitcoin mining costs a lot more total electricity, so the coins you mine are not nearly free.

I have some issues with your point in the first and second paragraph. Surely some of the energy will be converted to electrical energy and not thermal energy. The mining equipment, outputs electrical energy and thermal energy. Not only and all thermal energy. Furthermore, no piece of equipment is entirely 100% efficient either.

How would it output electrical energy?

@HamishGibson: True, it will radiate a tiny bit of energy as radio-frequency emissions, from switching in the electronics.  Shielding will absorb most of those, i.e. turn that energy into currents in metal which will produce heat via Ohm's law.  Some of the energy that escapes the immediate device will be absorbed in your walls.  Of course, in English we don't normally call that "electrical energy" - that refers to voltage x charge (and power = voltage x current), not electromagnetic radiation.

@PeterCordes isn't light heat? Specifically, isn't it thermal radiation?

@PeterCordes also, there's no such thing as >100% efficiency in thermodynamics. You're talking about "coefficient of performance", which isn't an efficiency, and is thus allowed to be over 100%.

@EricDuminil: No, heat energy is vibration / kinetic energy of matter.  Heat is closely associated with infrared electromagnetic radiation, but the later is a way for heat to transfer via blackbody radiation.  (Thanks for the terminology correction about what the 330% is for heat pumps.)

@PeterCordes: Oh dear. This description on Wikipedia is very confusing, and your summary is downright wrong. Please don't share it on stackexchange, there are enough people using heat, internal energy and temperature interchangeably already. Heat is a process function, and cannot be used when referring to a body. Finally, a light bulb is pretty much emitting blackbody radiation, part of which is in visible sprectrum, part of which is infrared.

@EricDuminil: Hmm, yeah I didn't really like what I found on wiki, but linked it anyway.  Now that you mention it, probably I'm conflating heat with temperature related things, which is IIRC classically defined as average kinetic energy of particles.  Thanks again for the correction on "heat" as technical terminology.  I think what I was describing (kinetic energy of particles) would be related to internal energy (the average of which is temperature)?  As for lights, I had in mind in my first comment in this thread an LED bulb, so most of the electromagnetic energy coming out is visible range.

@PieterWuille It would also transmit electrical energy whenever it sends a packet down its network connection - something you'd have to do quite often, in order to mine bitcoin.

@PeterCordes Yes, you described internal energy, temperature and heat correctly in your last comment. Okay for LED bulbs. The light isn't linked to blackbody radiation, but I think it can still be considered to be heat (see https://physics.stackexchange.com/a/261317/148854)

@user253751: Sorry about that. Pedantry is pretty much required for thermodynamics, so I'll take your comment as a compliment. :D

@nick012000 I wonder, how much energy per packet are we talking about here? I'll be generous here - let's assume fiber optic.

@JohnDvorak According to this document (https://www.netgear.com/images/datasheet/mobile/LB1110.pdf), a 4g LTE modem has a power consumption of 12 W (12 V * 1 A). How much of that winds up as radio signals and transmitted out of the house, I'm not certain.

It may be practical to use a miner to provide some of the heat for your home, bringing some miners into your home during the cooler months and moving them elsewhere during summer.
It's pretty much 100% efficient at converting electric energy into heat energy.  (vs. a heat pump being about 300% efficient1, moving existing heat from outdoors as well).  Even a lightbulb that turns some power into visible light will ultimately heat the room when that light is absorbed by the walls.  (Unless some light escapes out windows).  A fan moves air, but that air movement energy ultimately ends up as heat unless the moving air goes out a window.  More-ordered (low entropy) forms of energy naturally convert to high-entropy non-concentrated heat; heating a room is one time the 2nd law of thermodynamics is on your side.  (However, the 2nd law is why heat wants to flow from your warm house to the cold outdoors; that's why you insulate your walls.)  TL:DR: pretty much any form of energy can efficiently turn into heat.
Footnote 1: Modern heat pumps often have something like 330% efficiency when not too cold outside. According to this Canadian government page about heat pumps, air source heat pumps typically achieve a 3.3 ratio of heat out to input power at 10°C (cool day), or 2.3 at -8.3°C (well below freezing).
So they're about 230 to 300% efficient most of the year.  vs. 100% for a fully indoor space heater or computing equipment.  Using electric power to run a miner instead of a heat pump is an opportunity cost, if it would be possible to install a heat pump.  So the coins you mine have an opportunity cost: you could have gotten more heat for the same power input.

But if you were going to be using electricity to do any mining at all, using the heat output for something useful is good, when possible.  If the alternative is putting your mining rig in an uninsulated shed or something and still needing to heat your home, that's worse than having some mining power heating part of your house.
As others have pointed out, you wouldn't want to try to provide all the heating via mining: heating needs are highly variable (depending on weather, sunlight through the windows, and other heat sources like using your oven for cooking), but you normally want your bitcoin mining to be on all the time.  (To pay for the initial investment of buying the expensive hardware which costs much more than a dumb space heater; basically just some resistive wire that you put voltage across.)
The amount of mining power you can have indoors in a given month without causing a problem is approximately the best case (smallest) amount of heating that you'll need at any time that month.  The rest of the heating load should come from thermostat-controlled regular heating, like a heat pump, oil or gas, or worst case dumb electric heat that just gets hot.  (And hopefully that heating system distributes heat around your home better than a miner in one spot, modulo whatever air circulation you arrange to move the mining heat around.)
This "safe" amount of mining might be a few hundred watts, again depending on the month and the size of your home, and if you can hook it up to an existing air circulation mechanism to distribute heat around instead of making one room hot.
If you had more mining power indoors, you'd need some of it on a thermostat, to shut itself down when the room gets above human-desired temperature.  (Or put it in an uninsulated basement where it keeps your floors warm, but lots of extra heat can just escape into the ground.  Or in the winter, an attic.)
If you have some older less-efficient miners, setting up your computer to stop those first when the temperature rises could make sense.  You wouldn't want to buy a lot of mining hardware that would only be on part of the time; that wouldn't be worth the investment.  But some semi-obsolete gear could be worth running if the power was effectively cheaper (because you need the heat anyway, and don't have a heat pump).
Bitcoin mining is arguably not a great thing to dump a lot of electrical power into (for environmental reasons), so I'm certainly not suggesting trying to max out your mining by using it to heat your house.  Especially if you can get a heat pump instead, and/or your local area doesn't have more renewable energy than it can use (so extra power use means more oil or coal being burned somewhere).
But if you do want to mine anyway, use some of that waste heat in the winter.

Heat Quality
Not all heat is the same.  The earth maintains a fairly constant average of 10 C near the surface, but you can't boil water with that.  So the temperature of your heater makes a big difference for the uses you can apply it.  If you want your hot water to get to 50 C, but your ASIC miner only generates 40 C of heat, then you are in for a tepid shower at best.  On the other hand, if you integrated your bitcoin miners with your HVAC/water heater, you could avoid venting the excess heat.  Since your cold water input will almost certainly be much colder than your miners, you can always pre-heat your water with miners, and basically put all your waste heat to good use.
A typical water heater consumes around 12 kWh/day (4 kW x 3 hours).  A small miner consumes about 1.2 kW.  So in 10 hours, it will generate as much thermal energy as your water heater, more or less.  Unless you take a lot of really hot showers/laundry/wash dishes, you should probably buddy up with a neighbor (more convenient in an apartment/condo) to share the excess heat.  Of course, you aren't going to make much money with a single miner, but perhaps you could reduce your water heating bill slightly (by investing thousands of dollars in a miner...not really a smart investment).
A room electric heater might consume 1.5 kW and run for 4-6 hours per day, for a usage of 6-9 kWh.  That's another 6-7 hours of mining, so you might be able to heat your whole small apartment on one miner.
Return on Investment
For about $1200 you can get an Antminer R4 and 8.6 TH/s at 1.3 kW of power.  Your expected Bitcoin revenue for the year with this rig is about $500.  If you are able to replace 1.3 kW of electric heating in your home with this rig, you will basically earn $500/yr. towards your electric bill (which is expected to be higher, unless you live in an area with very cheap electricity).  It should pay for itself in about 2.5 years (not counting all the work of replacing your heating system with the mining rig, which is probably more expensive than the miner itself).

Can a bitcoin miner be a good subtitute to a modern heather with the same power consumption ?

A Bitcoin mining rig lacks certain features that are fairly desirable in a room heater. The main one is a thermostat. Even if it did, this would mean you would have to throttle back your Bitcoin miner as the room reaches some desired temperature. You would also need to do less mining in the summer than in winter. Whether reduced mining activity in those situations is acceptable is up to you, of course.

If someone want to heat a room or some water

Heating water is typically a very different proposition. If, for example, you wanted to boil water to make tea, a Bitcoin miner would probably be a very bad place to start.

Although a Bitcoin miner will make a room hot, it isn't going to be particularly good for anything other than what it was designed for.

In a cold climate, you'd want some heating most of the year.  You could imagine moving your mining rig outside your home during the hot months.  If you want to mine at all (instead of running an efficient heat pump or using oil or gas heat), having some of your mining heat output in your home during winter makes sense.  Little enough that it won't get too hot if you turn off your other heating during a warm winter day.  e.g. some mining heat could just make your regular thermostat-controlled heaters come on less often.  And put some in an uninsulated basement that cools itself.

If you want to reduce the amount you spend on heat that doesn't come from mining, you'd have to be willing to throttle the mining somewhat on less-cold winter days,  e.g. if you have an older less-efficient miner, that would be the one to shut down first as the temperature reaches the upper end of desired room temp.  If the control computer has a temperature sensor, software could do this automatically.

In my experience with using BOINC and Folding@Home to heat my computer room, you don't need precision control of temperature.

Yes, it is possible to use the waste heat of a bitcoin miner (or any other computing device or other machinery) to heat your living space.
The plan has some drawbacks and limitations:

The temperature:
These devices are efficient when they get like ~20C at the inlet and heat air to less than 40C. Trying to make them work at higher temperature may limit their clock frequency and/or useful life. This leads us to:

Noise:
You cannot put the miner much further away from the living space. It has to be inside or near (with air ducts). You'll get all the noise. They make a lot of noise.

Control:
Unless you are living in some very cold place, you will need to control the heat output from 0 to some value related to your house. There are few methods, but all of them require lowering the mining output. This means lowering the return of investment (and mining is actually quite competitive, so you will end up losing money).

Another variant is to redirect the excessive heat output somewhere else (i.e. outside). Or use the normal means of heating and only supplement it with the miners (if you have a large house and few mining devices)..

Dust
These devices require relatively clean environment, or they collect dust. Dust makes them overheat or makes you periodically disassemble and clean them.

What I did in a similar situation:
I had to host few servers at home for a while.
They ended up in the garage under the house. The heat they generated was beneficial for heating the whole house. The floor was +5..+7C, the noise didn't penetrate the floor and the dust was manageable.

I highly doubt it. Modern miners nowadays are designed so that they don’t emit too much heat such that they breakdown/ malfunction.
Whilst it is true that they generate a lot of heat, the way in which one could use this as a heating appliance beats me. The engineering required to extract the circuitry and use it as a heating filament is likely to damage the mining equipment as- could become prone to water damage, and- taking it out of its specified structure could cause it to overheat. The remaining air produced from the fan would likely not be as hot as the component due to the law of thermodynamics
Lastly, the degree to which the equipment becomes hot depends on the power drawn, the hash rate, the air humidity and temperature, degradation over time, air impurities etc.
So to summarise, no you can’t heat things with your mining equipment. It would likely damage it and the things you’re heating. And you wouldn’t achieve the outcome you’d desire also.

I was interpreting the question as asking about using it as indoor air heating, not as in cooking or anything outputting high temperature.

Why would any engineering be required at all?

Whilst the OP has already mentioned that they're not talking about using it to hear water, I was saying that engineering would be needed as you wouldn't just plonk a pot of water on top of your mining rig to boil.

You are incorrect. It doesn't matter how efficient miners are at mining. Watts in=watts out in heat energy. Some of the most efficient new miners use around 3000 watts. This is equal to 10,236 BTUs. That is only 1 miner. The average newer house in a cold climate only needs 20 BTUs per SQ ft. A few of these is enough to heat your entire house. The point about disassembling them and rewiring then to produce heat is certainly not necessary. They can be placed in a completely sealed room in the basement. The return duct of your central heating system can run into this room, the return duct from your furnace can run to the other side of this room.  When there is a call for heat you can have the furnace blower come on without the burner. This will suck all of the heat out of this room and distribute it to each room in the house at the same time bringing all of the cooler air back to this room through the return duct coming from the house. You will also need an exhaust fan and fresh air fan in this room. When there is no call for heat, and the room is above 77 degrees the fans will come on to keep the room at 77 until there is another call for heat. You can even take it one step further and install a heat pump water heater in that room. It will absorb the free heat and use it to heat your water. Making money and getting free heat/hot water!


text:
Unable to derive child keys from subkeys
I'm trying to implement bip32 derivation and have been able to derive the child keys from the master node, but not children of the child key.
The following test shows the correct result in bytes for deriving the second non-hardened key from the first hardened key (m/0'/1) of the master node xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi
Correct output:
04 88 ad e4 02 5c 1b d6 48 00 00 00 01 2a 78 57 63 13 86 ba 23 da ca c3 41 80 dd 19 83 73 4e 44 4f
db f7 74 04 15 78 e9 b6 ad b3 7c 19 00 3c 6c b8 d0 f6 a2 64 c9 1e a8 b5 03 0f ad aa 8e 53 8b 02 0f
0a 38 74 21 a1 2d e9 31 9d c9 33 68 b3 4b c4 42

Actual output:
04 88 ad e4 02 5c 1b d6 48 00 00 00 01 2a 78 57 63 13 86 ba 23 da ca c3 41 80 dd 19 83 73 4e 44 4f
db f7 74 04 15 78 e9 b6 ad b3 7c 19 00 3c 6c b8 d0 f6 a2 64 c9 1e a8 b5 03 0f ad aa 8d 0e 39 de f5
b9 81 14 5d 61 00 47 bf 6d ff 78 7a 01 be 65 76

As you can see, almost everything is correct apart from the last 20 bytes, which forms part of the private key. Since I know my derivation works for the first chain, I'm wondering if the process requires an addition of something else to make the private key for subsequent levels?
Here is my derivation function
public HDPrivateKey childAt(uint index, bool isHardened = false) {

            /*non hardened keys between 0 ~ 2^31 - 1, hardened between 2^31 ~ 2^32 - 1*/
            /*Note: A hardened key at index less than 2^31 will automatically assume it starts at 2^31*/
            if (index >= BIP32_HARDENED && !isHardened) {
                throw new Exception("Index too large for non-hardened key");
            }
            uint childNum = isHardened ? index | BIP32_HARDENED : index;

            /*perform hmac*/
            byte[] hmac;
            byte[] childNumBytes = BitConverter.GetBytes(childNum);
            Array.Reverse(childNumBytes);

            if (isHardened) {
                byte[] pkBytes = Byte.prependByte(privateKey_.toBytes(), 0x00);
                byte[] data = Byte.join(pkBytes, childNumBytes);
                hmac = Hash.HMACSHA512Encode(data, chaincode_);
            }
            else {
                byte[] data = Byte.join(pubKey_.getCompressed(), childNumBytes);
                hmac = Hash.HMACSHA512Encode(data, chaincode_);
            }

            //HMAC is correct, produces correct chaincode

            /*Properties of child*/
            byte[] pre = hmac[0..32];
            byte[] chaincode = hmac[32..64];
            byte[] fingerprint = Hash.hash160(pubKey_.getCompressed())[0..4];
            int depth = this.depth_ + 1;

            /*Perform addition of the parent and child in the field of N*/
            FieldElement parent = new Sha256Field(new BigInteger(this.privateKey_.toBytes(), true, true));
            FieldElement child = new Sha256Field(new BigInteger(pre, true, true));
            FieldElement sum = parent + child;
            PrivateKey privateKey = new PrivateKey(sum.getNum());
            Console.WriteLine("chid key {0}", Byte.bytesToString(privateKey.toBytes()));
            HDPrivateKey childKey = new HDPrivateKey(
                privateKey, chaincode, depth, fingerprint, childNum, this.testnet_);
            return childKey;
        }

Help is really appreciated! thanks in advance

I answered my own question, I was doing addition in the field of P instead of mod N, in case anyone gets caught out by this!


text:
Is there a Bitcoin casino that is willing to collaborate on some economics research?
Am looking to collaborate with the owners of some of the online Bitcoin casinos. I am in the process of designing some behavioural experiments to test for biases in Bitcoin gamblers.
I will sign NDA agreements with whoever wants to talk to me about them and am also happy to go through a fiduciary to anonymise which site the data comes from.
Thanks
Jonathan

You might want to reach-out to Bitcoin casinos with your request then, perhaps post this on reddit.com/r/bitcoin or bitcointalk.org. (Voted to close, not a question.)

This question appears to be off-topic because it is not a question, but rather a contact request.

A lot of gambling games are completely on-chain, you can analyze the blockchain and look for these transactions to get the data you're looking for.

I highly doubt that this is a right place to ask such questions. In my opinion the best way is to contact Bitcoin casinos through feedback form on the site. Keep in mind that most probably they would be reluctant in accepting your offer, because I highly doubt that it would be useful for them, but some of their customers might be disappointed with this move.
One additional plus might be if you are an established scientist (for working for established institution), in which case you might be able to generate some fuss and therefore create some advertisement through your research.

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


text:
I want to display information about my bitcoin node on a webpage (php or html)
I want to show information about my bitcoin node on a website.. how can I do this with windows + php + html + javascript + rpc?
I want something like that but with more information and perhaps more dynamic:
Example page:   http://199.58.210.124/

The node example is my node, this is the script that I'm using.
Download this script
http://pastebin.com/wKytLZmc
Put it anywhere on your server and change the RPCUSER/PASS, NODEADDR and BITCOINADDR.
Run the script to update every time. You can also use it to create a chron job.
To run the script, after editing the values above, put it anywhere and type:
python btc-update.py
If it just returns, that means it works :)
Note: If you get an error, you’ll need to install BitcoinRPC for the script to work.
Go here: https://github.com/jgarzik/python-bitcoinrpc
Follow Jeffs simple instructions. Once BitcoinRPC is installed, run the node script again and it will update!
Good luck!

I already tried this.. but I failed at installing BitcoinRPC on windows7.
But I think I got it anyway .. http://wiencloud.tk/bitcoin-node
I also made http://btcaudio.tk/live :)
Thanks anyway!

This is pretty cool:  btcaudio.tk/live can you share the script? Also how did you solve the windows7 issue?

I didn't install BitcoinRPC .. I just used jsonRPCphp (jsonRPCClient.php) to connect to my bitcoin-node and get the connections, difficulty and blocks. [no python-script used]
you can download the live-script here: http://btcaudio.tk/download

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


text:
MtGox streaming API - not receiving messages
Although it was working previously (like a day ago), I now am not receiving any messages through the MtGox streaming API (socket.io). Code is below, am I doing anything obviously wrong? The connection message is printing out so I assume it's connected OK.
var conn = io.connect('https://socketio.mtgox.com/mtgox');

conn.on('connect', function(data) {
    console.log("Connected to Mt.Gox");
    conn.send({
      "op": "mtgox.subscribe",
      "type": "depth"
    });
    conn.send({
      "op": "mtgox.subscribe",
      "type": "trade"
    });
});

conn.on('message', function(data) {
    if ('private' === data.op) {
        if ('trade' === data.private && 'USD' === data.trade.price_currency) {
            console.log("Last trade price: " + data.trade.price);
        }
        if ('depth' === data.private) {
            if ('ask' === data.depth.type_str) {
                console.log("Ask depth added: " + data.depth.price);
            } else {
                console.log("Bid depth added: " + data.depth.price);
            }
        }
    }
});

Link to jsfiddle: http://jsfiddle.net/lkavenagh/jYKjU/17/
console.log wasn't working for some reason so used alert instead. I get the connection alert but no alerts for messages.

Just discovered that if I leave it running for something like 30-45 minutes, it starts receiving messages. Will try to find out why there is such a delay...

Not 100% sure, my project is still working. Only difference I might see is the way you subscribe to the channel, I use a channel ID instead of a type. Not sure if that might have something to do with it. I'm a sort of novice programmer, just gettin back into it after years of sitting idle. Let me know if that helps

I've tried that too. Hmm, I had thought it might be on Mt.Gox's side, but it doesn't look that way.


text:
bitcoind and figuring out if it's still downloading blocks
I've asked around, and it seems that to figure out that bitcoind is still downloading blocks is to run ./bitcoind getinfo and see if the "block count" is increasing.
Is there an easier way to do this, or is there a better way? How do those clients figure out that there's "30 blocks left" to download etc?

If you have linux's shell, you may try my bash script:
$ cat coin_get_diff.sh
#!/bin/bash
[ -z "$1" ] && echo "Usage: input=coinname" && exit 1
coin="$1"

while sleep 1;do
blk="$(eval "$coin getblockcount")"
h="$(eval "$coin getblockhash $blk")"
coin_t="$(eval "$coin getblock $h" | grep '"time"' | awk '{print $3}' | sed -e 's/,//g')"

d="$[$(date +%s) - $coin_t]"; dm="$[$d / 60]"; dh="$[$dm / 60 ]"; dd="$[$dh / 24 ]"
echo "Difference with main chain $d s. or $dm m.  or $dh h.  or $dd d."

if [ -z "$first_t" ];then
        first_t="$d"
        start_watch_time="$(date +%s)"
else
        difference=$[$first_t - $d]
        speed="$(echo "$difference / $[$(date +%s) - $start_watch_time ]" | bc -l)"
        remain_seconds="$(echo "$d / $speed" | bc -l)"
        remain_minutes="$(echo "$remain_seconds / 60" | bc -l)"
        remain_hours="$(echo "$remain_minutes / 60" | bc -l)"
        remain_days="$(echo "$remain_hours / 24" | bc -l)"
        # eval "$coin getinfo"
        echo -n "Approximate remain: $remain_seconds seconds to complete  sync."
        echo "[m: $remain_minutes; h: $remain_hours; d: $remain_days ]"
fi
[ "$LAST_BLK" == "$blk" ] && echo "Alarm! Stuck on block # $blk!"
LAST_BLK="$blk"
done

Start it in next manner:
$ bash coin_get_diff.sh bitcoind

Example output:
...
....
Difference with main chain 2528577 s. or 42142 m.  or 702 h.  or 29 d.
Approximate remain: 2186.83957899106610047826 seconds to complete  sync.[m: 36.44732631651776834130; h: .60745543860862947235; d: .02531064327535956134 ]
Difference with main chain 2526232 s. or 42103 m.  or 701 h.  or 29 d.
Approximate remain: 2184.21035499949140474011 seconds to complete  sync.[m: 36.40350591665819007900; h: .60672509861096983465; d: .02528021244212374311 ]
Difference with main chain 2524021 s. or 42067 m.  or 701 h.  or 29 d.
Approximate remain: 2205.15551284291455530316 seconds to complete  sync.[m: 36.75259188071524258838; h: .61254319801192070980; d: .02552263325049669624 ]
...
..

Read this my answer: How long does it take to download blockchain

Woah, that is literally exactly what I needed! Thanks!

There are several ways to estimate the number of blocks left to download. The easiest is likely that the client takes a look around at what its peers are saying their longest chain currently looks like. So if you connect to 8 peers in the network it is very unlikely that all of them are still catching up with the rest of the network and therefore it will tell you what the current state, or something close to it is.
Another way of estimating the number of blocks is by looking at the timestamp included in the block that you just downloaded. In expectation a block should arrive every 10 minutes. The timestamp in the block is not allowed to deviate from the actual time it was mined by more than a fixed number of minutes (otherwise it would be rejected when it is first seen). So if you subtract the time of the last block you downloaded from the current time and then divide by 10 minute intervals you get an estimate of the total number of blocks in the network.
Notice that the second method may not be incredibly precise, especially in times the commputational power in the network grows quickly, like it is currently doing, or is reduced quickly.
As for you checking how many blocks are left, it's a simple matter of going to a trusted block explorer and comparing your blockchain height with the height they display.


text:
What is TokenPipe class in the Bitcoin Core?
There is a class here in the Bitcoin core called TokenPipe. I've tried to figure out what is does but couldn't find anything useful. The comment says:

An interprocess or interthread pipe for sending tokens (one-byte
values) over.

But don't understand it. What are tokens?

As the comment says: 1-byte values.
It's an abstraction for sending byte values from one process to another process, for inter-process communication.
What those bytes are or what they represent is up to the code using this class.
The point is that users of the class don't need to know how that communication happens, and, in fact, may differ from one platform/operating system to another.


text:
How can a withdraw be made on a frozen account on a platform?
HTTPS://www.xk8868.com.    Aka: Bcokcoins.com
There is funds in this account and I would like to withdraw, it is either frozen or fake. How can I make a try at withdrawal. Do I need to convert USD to BTC to enable a transfer of funds. I’m new to this.

It sounds like they are asking for an advance fee. If they actually had your money and wanted to give it to you, they could deduct the fee from it and give you the rest. That they ask you to send them money instead, clearly indicates that they do not have the money.

Thanks that’s what I suspected.


text:
How does a miner identify himself
There has been a new mining pool appearing after the halving called Lubian.com cf https://www.cryptoglobe.com/latest/2020/05/new-bitcoin-mining-pool-comes-out-of-nowhere-already-5th-largest/
How does a miners say to the world who he is, and how can he prove he is the one that has mined a specific block ?

They will either reuse the address in coinbase transaction subsidy output every time they mine a block, and then publicly claim that address, or they will "tag" their name (ascii-encoded) and some metadata in an OPRETURN or the scriptSig of the coinbase transaction.
Here's the coinbase TX from block 603526:
https://blockstream.info/tx/0eb39c3f1a6813dfe5bb9d86dd71de2593aa76f25d4f25b149c9f564eb33cd54
The script sig is
03863509fabe6d6d0f3e894118566fd52beccf2a405c060fb701171dd16d83f1fb4aa0219fa8656601000000000000002469020000535e15a74a1b00000000e6892f736c7573682f
which is ASCII for:
5  z>mm>   AVoU+lO*@\7Qmq{J !(ef$iS^'J /slush/
There's slushpool!

Note that anybody can put anything there. It’s not authenticated so you can just lie.

Sure thank you. Pools could sign proof with the coinbase address but I don't know if any do.

They couldn’t, because the hash would cover the signature.

I meant they could sign an arbitrary message and tweet it or whatever, proving control of the address that earned the block reward


text:
Private key generation method
How was bitcoin private/public key created in 2009, I observed in the blockchain some bitcoin transaction took place early 2009 Feb - April.
In the original bitcoin core in github the first bitcoin core was released September 2009.
My confusion how were the users able to generate the address ?

The first version of Bitcoin (0.1.0) was released on January 9th 2009. You can find all versions of the software at the Satoshi Nakamoto Institute. Bitcoin Core as a project didn't emerge later, after more contributors started writing code. The name "Bitcoin Core" wasn't used until version 0.9 of the project, which was released in 2014. The project didn't use GitHub in the beginning either, but Sourceforge.
To summarize: the code that Satoshi released in early 2009 had functionality for generating private keys and signing transactions. Bitcoin Core is a later project, and GitHub does not have the complete history.

Prior to BIP32, most wallets simply generated keys from random data provided by the operating system (or some other entropy source).
A handful of wallets implemented a brainwallet system, in which keys were derived from some kind of password, but they quickly fell out of use after it was discovered that most people selected easily guessable passwords which resulted in excessive loss of funds to theft.

The procedure to generate bitcoin addresses and their corresponding private keys is fairly simple, as can be seen at https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses.  Early bitcoin addresses and keys could easily have been generated using a series of command-line commands or simple scripts that performed these steps.


text:
Is it possible to create a thin client that only listens for transactions and pending transactions?
I looked into using a thin client but even thin clients implement SPV (Simple Payment Verification). What if you just wanted a client that only listens for transactions/pending transactions, doesn't store the blockchain, and only uses memory.

When receiving a payment, it is critical to know whether or not the transaction that makes that payment is a legitimate Bitcoin transaction (or not).
This is determined by checking if the transaction is valid according to the network's rules- and a crucial part of this is determining whether or not the transaction's inputs are valid. In order to determine the validity of the inputs, the client must have some way of knowing the current state of the network. Generally this is accomplished in two ways:

Full node: this is software that will independently download and validate every transaction and block, thus verifying what the current state of the network is. As such, any transaction can (and will) be checked for validity.
Thin/Lite/SPV client: this is software that will download the longest chain of block headers, but not the entire block. The client can thus check the validity of transaction by requesting proof of the transaction's inclusion in a block from full nodes on the network, this is accomplished via the merkle root included in the block header. This method of transaction verification requires more trust (that miners are in fact creating valid blocks), so the thin-client must trust that this verification is being performed by other nodes on the network.

If you are not performing verification of incoming transactions in one of these ways, then you will be easily defrauded, since you will be unable to differentiate between a valid and invalid transaction, without fully trusting someone else to supply this info to you.

That makes a lot of sense. Is it true that this lite client does not have access to the mempool?

@foba There is no 'the mempool'. Rather, each node may choose to keep a mempool (or not), it is simply a local database of unconfirmed transactions. To receive info about transactions relevant to the wallet, a thin-client will generally communicate with a full node via BIP 37/157/158.

@foba One issue I can see with a thin-client keeping a mempool, is that without validating all blockchain data, it is difficult to prove that an unconfirmed transaction's inputs have not already been spent (making the transaction invalid). I think doing so would require some sort of cryptographic UTXO-set commitment to be included in blocks, but the protocol does not currently include such a thing. This is probably worth posting as a new question.

yeah good points, thank you for your help! It looks like you really can't get around running a full node if you want to get pending transactions.

BIP37 (bloom filtered) clients today can receive unconfirmed transactions from the nodes they are connected to, but there is essentially no way for them to do any validation on those. A well-known block explorer that used this approach once accepted and showed on the site an unconfirmed transaction that paid someone 21M BTC.


text:
How to determine the peer/node that created a transaction?
You're running your node and you receive a transaction from a peer, how do you determine if that peer created the transaction or if it is simply relaying the transaction. In other words, can you map transaction creation to a peer?

how do you determine if that peer created the transaction or if it is simply relaying the transaction

You cannot, at least not with absolute certainty. This is by design: it helps preserve the privacy of users on the network.
That said, if you decided to run a whole bunch of nodes, and positioned them carefully in the network graph, then you could start to infer where transactions are originating from, based on the timing of your nodes hearing about said new transactions. I think it should be expected that chain analysis firms are doing this today.
To counter this, it must be considered that there are many ways to publish a transaction to the network - the node that first publishes a transaction is not necessarily owned or operated by the user that actually crafted the transaction. For example, today there exists services within the tor network, which allow you to copy/paste a signed transaction into a website form, to be broadcast to the network anonymously. Since you must connect to this service over tor, not even the service provider will know the identity of the transaction's author.
Further work is being done to increase the privacy of transaction broadcast. For example see BIP 156.

"run a whole bunch of nodes, and positioned them carefully in the network graph"
You could just connect to a bunch of peers to have the same effect right?
I was interested in determining the % of transactions created by a node that get included into a block. I thought that could be an interesting stat.
I am less concerned with which user creates a txn more concerned with which node. And less interested in deanonymizing transactions and more interested in the behaviour of a node.

@foba the best estimates I've seen put the number of nodes on the network at 10's of thousands, so a single node could not possibly reliably learn which nodes are the origin of certain transactions.


text:
bitcoind.service file to automatically start on boot
hi all i'm noob so sorry in advance
i installed bitcoind.service and everything is fine untill i reboot the system.
here is screenshot

when i reboot the system it doesn't work and show me this

i installed bitcoin core on linux mint.
if i do journalctl -e show me this

can anyone help me please considering i'm a noob so i need commands in details
thanks

Try taking a look at the debug.log file in the .bitcoin directory, it should hopefully tell you more about the failure reason.


text:
List of different unknown mining pools
A miner can identify himself when he receive  his coinbase transaction, we can view them on website offering block explorer like https://www.blockchain.com/charts/pools
Some of these miners are listed as Unknown because blockchain.com has been unable to identify them

A large portion of Unknown blocks does not mean an attack on the network, it simply means we have been unable to determine the origin.

But when we click on one of those block mined by an Unknown miner we can see that most of them reuse the same addresses for their coinbase transaction but blockchain.com does not seem to list those reused Unknown address, is there a place to see a listing of those unknown reused addresses so that we can know how concentrated those miners are, or at least what they want us to know because I guess each time it could have been the same miner using a different addresses.


text:
What's the specification for Compact Size service messages?
I'm trying to understand the structure of the service and network bytes for compact sizes.
what's specification for compressing the bytes for example in addrv2 message encoding?
thanks.

The compactsize encoding is a variable-length encoding for integers between 0 and 264 - 1 inclusive.

Numbers in [0,253) are stored a a single byte, encoding the value directly.
Numbers in [253,216) are stored as 3 bytes: 0xFD + the number in 16-bit little-endian format.
Numbers in [216,232) are stored as 5 bytes: 0xFE + the number in 32-bit little-endian format.
Numbers in [232,264) are stored as 9 bytes: 0xFF + the number in 64-bit little-endian format.


text:
Error when mining with MacMiner
I am super new and I understand none of this. I am using MacMiner (the recent version). I opened up the FPGA/ASIC Miner and I get this error when I try to run it.
    [2021-04-15 15:05:52] Timers: Using clock_gettime(CLOCK_MONOTONIC_RAW)
 [2021-04-15 15:05:52] Global quota greatest common denominator set to 1
 [2021-04-15 15:05:52] setrlimit: Changed soft fd limit from 4864 to 1024 (FD_SETSIZE=1024; hard limit=unlimited)
 [2021-04-15 15:05:52] Started bfgminer 5.5.0-unknown
 [2021-04-15 15:05:52] Loaded configuration file /Users/ (I am taking this out since it is my name ) /Library/Application Support/MacMiner/bfgurls.conf
 [2021-04-15 15:05:52] DISPLAY not set, setting :0 just in case
 [2021-04-15 15:05:52] CL Platform 0 vendor: Apple
 [2021-04-15 15:05:52] CL Platform 0 name: Apple
 [2021-04-15 15:05:52] CL Platform 0 version: OpenCL 1.2 (Jan  5 2021 23:17:05)
 [2021-04-15 15:05:52] Platform 0 devices: 1
 [2021-04-15 15:05:52]  0   Intel(R) Iris(TM) Graphics 6100
 [2021-04-15 15:05:52] Unable to load ati adl library
 [2021-04-15 15:05:52] Probing for an alive pool
 [2021-04-15 15:05:52] Testing pool stratum+tcp://us-east.stratum.slushpool.com:3333
 [2021-04-15 15:05:52] HTTP request failed: Protocol "stratum+tcp" not supported or disabled in libcurl
 [2021-04-15 15:05:52] Failed to connect in json_rpc_call
 [2021-04-15 15:05:52] initiate_stratum with sockbuf=0x0

How would I fix this? I understand none of this.

I suspect the source of the problem is this line

HTTP request failed: Protocol "stratum+tcp" not supported or disabled in libcurl

libcurl is a library (developed for the command-line "curl" program that can be used to fetch web-pages).
I suspect the most likely way to fix your problem is by updating MacMiner to the latest version and by checking that your computer also has the latest version of the libcurl library (using whatever package manager is appropriate for your computer)
I'm not familar with MacMiner or slushpool but you may also be able to configure MacMiner to use HTTP instead of STRATUM+TCP?


text:
Bitcoin network resources requirement
Supposing we are alone, could it be possible to run the whole bitcoin network and full capacity of it (maximum transaction per second by different peer) on a low end computer, and how can someone verify that ?

As difficulty adjusts automatically, it is indeed possible to run a mostly functional network with the bare minimum hardware required for storage and networking.
Naturally, this network will have next to no protection against a 51% attack, as anyone with a faster computer (or computers) will easily be able to outdo your bare minimum hardware.
Running it would be as simple as setting up a new node with a miner, and making sure it doesn't connect to the existing network - an easy way for that would be to have a new genesis block. You can then mine on this network, and the difficulty will adjust itself so that you have a 10 minute block time.


text:
What prevent users from cheating in an HTLC contract
I was reading about HTLC and how Charlie have to create a random number and generates its SHA256 hash that is supposed to be used by Bob in the end to finalize the payment he has received from Alice.
Here are the steps from https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts

Alice opens a payment channel to Bob, and Bob opens a payment channel to Charlie.
Alice wants to buy something from Charlie for 1,000 satoshis.
Charlie generates a random number and generates its SHA256 hash. Charlie gives that hash to Alice.
Alice uses her payment channel to Bob to pay him 1,000 satoshis, but she adds the hash Charlie gave her to the payment along with an extra condition: in order for Bob to claim the payment, he has to provide the data which was used to produce that hash.
Bob uses his payment channel to Charlie to pay Charlie 1,000 satoshis, and Bob adds a copy of the same condition that Alice put on the payment she gave Bob.
Charlie has the original data that was used to produce the hash (called a pre-image), so Charlie can use it to finalize his payment and fully receive the payment from Bob. By doing so, Charlie necessarily makes the pre-image available to Bob.
Bob uses the pre-image to finalize his payment from Alice

But what would happen if Bob and Charlie decided to cheat and at the step 4 just after Alice send the 1000 sats Charlie give to Bob the secret number that was supposed to be used in step 7 share the sats between them and then Bob said that Alice payment was wrong and she have to do it again or something else.
I suppose this kind of attack would not be worth because

you have to wait for Alice to pick a cheating peer Bob and Charlie.
the attack would not bring many benefit since lightning is not made
for big payment.
Bob and Charlie would become suspect and loose reputation in the
network.

I was wondering if I was missing something here or this kind of attack can happen

The process of saying that the payment failed and having to redo it means that the channel is first updated to a state where Alice hadn't sent the 1000 sats. The money is not gone. So if Bob were to do that, then he would be the one that is out 1000 sats because Charlie can claim the HTLC to him.


text:
Would a hardware wallet be hacked in this case
Bought a hardware wallet (Ledger nano s) recently, they claim that they are safe since it is a cold wallet. Online wallets (such as Crypto.com) are not safe as they are constantly online and hackers can hack through internet, which is fair enough.
However, in the following 2 cases, would hardware wallet still be safe?

Ledger has their app: Ledger live, which is connected to internet, and connects to Ledge Nano s when it is plugged in. Say hacker has hacked Ledger live and my nano s is plugged in, would he/she be able to steal my assets through Ledger live?

My nano s is not plugged, which is safe as it is cold. A hacker has hacked Ledger live, but he/she's not able to steal my assets since I'm offline. Will he/she be able to steal when I plug my nano s in the next time?

Your hardware wallet is only used to sign (approve) a transaction.
Therefore, unless someone gets direct access to your seed phrase(which will allow him to confirm transactions on your behalf) nobody can do anything with your funds.
The thing to remember is to always keep your seed phrase somewhere safe and OFFLINE.
The reason I like Trezor One is that it has a touchscreen feature. Meaning that even if your computer or phone is keylogged hacker still can't find out what your seed phrase is.
If you're interested, I have written an ultra descriptive guide about hardware wallets and Trezor vs Ledger comparison you can check out.

Seed phrase you mean the n-digits I input when I turn Ledger nano s on? Or the 16 words generated the first time Ledger nano s is plugged in?

Ah okay, just read your article and the seed phrase is the 16 words generated, thanks!


text:
how do i know which key has mined bitcoin?
I mined some coin in 2019 - 2020 via Bitcoin Core which i know very little about.  I have used dumpwallet to get all the keys but there are hundreds ! how do i know which keys might contain the mined coin ?  Any hep would be great as ive been trying to sort this for over 12 months.
Thanks

You have to load the keys into software which can scan the blockchain and search for transactions that belong to them. The simplest way to do this is to just start Bitcoin Core and let it sync. During the syncing process, Bitcoin Core will also be scanning the blockchain for any transactions that belong to any wallets that are loaded, so once it is synced, you will see any transactions (and thus Bitcoin) that belong to you.


text:
Transaction propagation criteria vs mempool inclusion cirteria
Do Bitcoin nodes propagate every transaction or only transactions that meet certain criteria? For instance, a transaction with a fee of 0 won't necessarily get included into a block and it might even be excluded from a node's mempool but would that transaction still get propagated throughout the entire network? Or can node choose not to propagate certain transactions?
If there is some criteria to which transactions get propagated what are they? I am guessing at the very least that nodes won't propagate invalid transactions?

There are also the 'standardness rules', which are separate from 'validity rules'. So this means a transaction can be either valid and standard, valid but non-standard, or invalid.
A node can choose to broadcast any transaction it would like to the network, or none at all.
If a node broadcasts invalid transactions, then it is likely that its peers will disconnect, due to misbehaviour. An invalid transaction cannot possibly be included in a valid block.
The bitcoin-core core code does not relay non-standard transactions, but it will still accept blocks that include them (since they are still valid). This lack of relaying the non-standard transactions is a safety measure to prevent DoS attacks, etc. You can find some good info about issues with relaying non-standard transactions here.
Even for standard transactions, there is no stipulation that requires a node to relay them through the network. Many nodes will do so, but this is entirely up to that specific node's policy.

Awesome thanks @chytrik!


text:
How long does it take to crawl and map the bitcoin network?
There are several websites that have data on the number of nodes in the network. For instance coin.dance. About how long does it take to map the entire bitcoin network?

With mapping the entire bitcoin network you mean listing all nodes? This would never end because nodes go offline and new nodes join, some nodes change their IP addresses, to some nodes your node might never get in contact ...

Ah good point but to get the initial estimate as seen on coin.dance I was curious how long that might take.


text:
Regtest createmultisig Error: Invalid public Key?
As shown below, I generated 3 new addresses (Legacy I believe) in RegTest. I then try to create a multsig address from exactly these 3 addresses. What am I doing wrong, or is this unavailable in Regtest?
'''$ bitcoin-cli getnewaddress
2NFjbToRhpR2Lrx3VyP8rZ86XhZhofqWHBk
$ bitcoin-cli getnewaddress
2NAqXJMEFzEbhNyy9xRiHHcwWNCyFddFfXH
$ bitcoin-cli getnewaddress
2NEyDQfb85jRExQUnj4wC7fkFh5T1rt5zFk
$ bitcoin-cli createmultisig 2 "[\"2NFjbToRhpR2Lrx3VyP8rZ86XhZhofqWHBk\", \"2NAqXJMEFzEbhNyy9xRiHHcwWNCyFddFfXH\",\"2NEyDQfb85jRExQUnj4wC7fkFh5T1rt5zFk\"]"
error code: -5
error message:
Invalid public key: 2NFjbToRhpR2Lrx3VyP8rZ86XhZhofqWHBk
.'''

Addresses are not public keys. You cannot give createmultisig addresses because it cannot know what public keys your addresses refer to, if any. To get the public keys, you need to first do getaddressinfo <address>. That will give you a pubkey you can give to createmultisig.

The createmultisig RPC takes as input public keys, not addresses. As you created those addresses yourself, their public keys are in your wallet. createmultisig however is a utility RPC (which operates independently of the wallet), so it has no access to that information.
You can call the getaddressinfo wallet RPC on those addresses to obtain their public keys.


text:
IBD problem: Reindexing blocks and syncing starts over every time I shut and open Core
I am currently doing IBD in segments due to logistical reasons, but each time I safely shut down Core and unplug my hard drive (HDD, 1TB) and then plug it back in and start up Core, it starts in 2009 and reindexes all blocks on disk. I've finished all indexing in one go, and still had to redo it for some reason.
I'm using v 0.19.01 on a Windows 10 computer.

Do you have reindex=1 in your bitcoin.conf, or any possibly related settings in the config file at all?

My bitcoin.conf is empty (I'm using GUI). Is that correct or am I looking at the wrong bitcoin.conf file? I installed core and ran it without changing any settings. Should I type in a certain reindex value in the file?

Can you include your debug.log file? You can post it to a site like pastebin.com and put the link here if it is too big to fit in a post.

This is my debug.log. I'm seeing the checksum fails, and a corruption message. Does this mean my drive is corrupting? It has done this 3 or 4 times now in the same way every time. I'm also seeing the error "Error opening block database, do you want to rebuild the block db now?"     https://pastebin.com/PEDEeafb


text:
Does BIP-069 use littleEndian for txid comparison?
BIP-69 writes the following about how inputs should be ordered:
Previous transaction hashes (in reversed byte-order) are to be sorted in ascending order, lexicographically.

But then, in the examples section further down, it gives an example of a transaction which, from what I can tell, sorts lexicographically in bigEndian, the typical txid byte order we see in bitcoin-cli, block explorers, etc.
Transaction 0a6a357e2f7796444e02638749d9611c008b253fb55f5dc88b739b230ed0c4c3:

Inputs:

 0: 0e53ec5dfb2cb8a71fec32dc9a634a35b7e24799295ddd5278217822e0b31f57[0]
 1: 26aa6e6d8b9e49bb0630aac301db6757c02e3619feb4ee0eea81eb1672947024[1]
 2: 28e0fdd185542f2c6ea19030b0796051e7772b6026dd5ddccd7a2f93b73e6fc2[0]
 3: 381de9b9ae1a94d9c17f6a08ef9d341a5ce29e2e60c36a52d333ff6203e58d5d[1]
 4: 3b8b2f8efceb60ba78ca8bba206a137f14cb5ea4035e761ee204302d46b98de2[0]
 5: 402b2c02411720bf409eff60d05adad684f135838962823f3614cc657dd7bc0a[1]
 6: 54ffff182965ed0957dba1239c27164ace5a73c9b62a660c74b7b7f15ff61e7a[1]
 7: 643e5f4e66373a57251fb173151e838ccd27d279aca882997e005016bb53d5aa[0]
 8: 6c1d56f31b2de4bfc6aaea28396b333102b1f600da9c6d6149e96ca43f1102b1[1]
 9: 7a1de137cbafb5c70405455c49c5104ca3057a1f1243e6563bb9245c9c88c191[0]
 10: 7d037ceb2ee0dc03e82f17be7935d238b35d1deabf953a892a4507bfbeeb3ba4[1]
 11: a5e899dddb28776ea9ddac0a502316d53a4a3fca607c72f66c470e0412e34086[0]
 12: b4112b8f900a7ca0c8b0e7c4dfad35c6be5f6be46b3458974988e1cdb2fa61b8[0]
 13: bafd65e3c7f3f9fdfdc1ddb026131b278c3be1af90a4a6ffa78c4658f9ec0c85[0]
 14: de0411a1e97484a2804ff1dbde260ac19de841bebad1880c782941aca883b4e9[1]
 15: f0a130a84912d03c1d284974f563c5949ac13f8342b8112edff52971599e6a45[0]
 16: f320832a9d2e2452af63154bc687493484a0e7745ebd3aaf9ca19eb80834ad60[0]

Am I just confusing "reversed-byte order" to mean little endian when it actually means big Endian (because txids are serialized in little endian in transactions)?

Relatedly, I would consider it best practice to shuffle the order of inputs and outputs rather than using BIP 69. There are some applications that cannot use BIP 69, and everyone shuffling inputs and outputs makes them stand out less than if everyone were to sort. If you need a pre-determined order, it would be better to shuffle them based pseudo-randomly per a pre-agreed seed.

By the way, BIP 69 probably has less adoption than one things at first seeing that “~63% txs are BIP-69 compliant”, because the ~24% 1-input-1-output txs are always compliant, and half of the 46% 1-input-2-output are compliant if they’re just shuffling—that’s already 47%. Add a quarter or 2-I-2-O txs, etc. the actual adoption is probably less than 15%.

I'm trying to build a use case and minimize interaction steps / data needed to be shared. Specifically, the DLC spec here defines a pre-agreed algorithm like you suggest. But this seems like a waste of data & complexity.
Your point about privacy does make sense. My specific use case would probably be transparent if it had a 100% adoption rate for BIP69.

The txid is the endian reversed value of the transaction hash. Therefore Previous transaction hashes (in reversed byte-order) is the same value as txid.


text:
Why doesn't my transaction go through?
I ask to buy for 253, price drops below, the transaction does not go through, and it goes up again.
Explanation anyone? or is this something i should ask the mt.gox staff?

MtGox is a roach sack of bugs. People start with it for liquidity and fame, but it is the least reliable bitcoin exchange. Anything else is better.


text:
Electrum: seed is 0 length / empty
I installed electrum a while back and noted down the 12 word seed. Haven't used it for a few months, but now when I go to view my seed (clicking on the seed icon on the bottom right of the GUI), it asks for my password, and then the dialogue says:
"Your wallet generation seed is:"
And the text box below is completely empty, underneath which it says:
"Please write down or memorize these 0 words (order is important)..."
A bit concerned my seed seems to have vanished. Any suggestions?

Odd. Can you still use your wallet?

@Nick See my answer below!

Answering my own question: appears I have uncovered a bug in electrum. The password I was entering was incorrect: the last 2 characters were wrong. However if I entered a completely wrong password I did get an "incorrect password" error, and the seed dialogue did not open.
Discovered by virtue of the command line console which did report incorrect password error when I entered the first wrong-by-two characters password.

it is most likely this bug, fixed now:
https://github.com/spesmilo/electrum/commit/059d381ba8cfed0b4c00cb9b4ec1ff13293de74c

I'm having trouble understanding how that commit is related to the asker's problem. Could you elaborate?

The asker was entering a wrong password, but instead of raising an exception the AES module was returning an empty string and that empty string was displayed as the seed. That commit replaces the faulty strip_PKCS7_padding function in the AES module, by a custom one that raises an exception.

Ah, that makes sense!


text:
Bitcoin wallet - why do i need it for cold storage?
Why do I need a bitcoin wallet for cold storage?  Can I just write down randomly generated public address and private key pairs, and keep these on paper?  I am confused by the apparent need for a wallet stored on a thumb drive or some other data storage device that may become corrupt.  So why do I need the wallet?

You can indeed do this. It has multiple environmental factors though which make this a bad idea.

Paper is easily damaged and very degradable.
You could make a mistake. If you do intend to do this maybe its best to quadruple check it.
Lack of extra security - unless you have it locked away in a safety deposit back in the city undergrounds, someone who knows it is there could steal it. Data drives give you extra level of security with wallet encryption.

There are probably other reasons but these are the main three, if you do decide to just do this there are a few techniques you could use to improve these factors..
Try laminating it, will give the paper exponentially longer lifepan.
Miss out a character that only you will remember, replacing a single character of a private key is easy if you know where it goes but hard if your not you, obviously just don't forget it!

You can indeed just write down, or print out the private key. Strictly speaking you don't need the public key in cold storage. Paper stores well for a long time as long as it is of archive quality. I would trust that more than any magnetic storage. Paper has been around for a long time and we know how to make it durable against time if so required. The ink of the pen needs to be of archive quality (at least where I live some pens are classified as such). Leaving the paper in the bank vault leaves you with one single point of failure though. And you may have made an error while copying the key to paper.
You could make another copy and give half the key to one trusted friend or relative, and the other one to another trusted friend or relative. It would be easier to brute force half a key for one of these people, but they are hopefully not into that with your key and half a key is still a lot of work.
If you consider using an offline computer, you could enter your private key into a  local off-line copy of this page: http://passguardian.com/
It implements Shamir's secret sharing and allows you to print out "keys" that needs to be combined (e.g any 3 out of 5) to yield the original key. Then give those out to people. Use a laser print for all print work, not an inkjet, since ink can be destroyed by water easily. The laser printer must not store copies of your print outs.
Laminating the paper as is suggested in another answer, then one would need to know that the plastic does not degrade the paper in the long run. There is no long term information on this, since laminated paper wasn't around 200 years ago.
Edit: Here is a link discussing archival standards at the Technical Research Institute of Sweden:
http://www.sp.se/en/index/services/permanence/sidor/default.aspx
Here is a list of their approved stuff; look in the left hand column and navigate down to the desired category:
http://www.sp.se/en/index/services/certprod/certprodprofil/arkiv/Sidor/default.aspx

From my experience, secrets.js (the library that passguardian uses) is a bit tough to read and understand, and I haven't looked much into how secure it is. Here's a python library that is quite straightforward and easy-to-read: https://github.com/halfmoonlabs/secretsharing.


text:
pool slush's pool numbers?
hello are this numbers are good or i need to do something on Pc's  i use this line with cgminer 2.11.4
./cgminer -o http://api.bitcoin.cz:8332 -u user.work -p password -I 10 -v 1 --verbose -w 256

thanks

For the amount of hashing power that you are putting out that's to be expected.  You should probably only be mining if you are using ASIC technology, not GPU's or CPU's.  There will be no profitability to mine using the hardware you have.  GPU's cost way too much in electricity to see any kind of return and with machines like KnC miners 550+/GHS Jupiters and Coin Terras 2/THS Terra miner IV you will be hard pressed to generate any BTC with the setup you have now.


text:
How to verify the signature of a raw transaction
I know there are many tools to check an ecdsa signature of a bitcoin transaction and I understand the ecdsa algorithm. It takes three inputs, a hash of the transaction, the digital signature and the public key of the sender.
In a raw transaction such as this one:
http://blockexplorer.com/rawtx/9b4912711de5e258a74a529227f43647bc3b2304212fb508c5f8e910d5986270
I know the signature is the first line of the Scriptsig and the public key is the second and I assumed that the hash of the transaction is the first line on the page (also in the URL) but they don't validade and I've tried a handful of transactions from blockexplorer.
My question is, what do I take as the first variable to validate a transaction in that form?

possible duplicate http://bitcoin.stackexchange.com/q/32305/12983

See How to calculate a hash of a Tx? .  The hash that serves as the ID of the transaction is not the same hash that is used for signing.

That's the answer to a different question. If you follow the link given in that answer (to a post of Andresen in the bitcointalk forum) and scroll to the post by etotheipi, a couple of posts below, you will see that.

authors: Олег Леонидович Блюменталь

authors: артур арутинашвили


text:
Is it possible to rename & move a MultiBit wallet
I would like to reorganise a wallet I created with MultiBit. It seems to be composed of the XYZ.wallet file, plus a XYZ.info file and a XYZ-data folder. Can those be freely moved around into another directory? Can I rename the XYZ-part of these 3 items without causing MultiBit any problem?
Thanks for any advice and many greetings!

Yes, they can be. But you will want to close MultiBit first, and then when you open MultiBit again you will need to tell it where you moved your wallet using File->Open Wallet.

You can move them all together but do not rename them.
The data folder contains a whole load of backups which also use the wallet name (XYZ) in your example.

Combined with the above, it also worked fine :-) Thanks! After renaming and moving these additional files were regenerated correctly.


text:
Are the witnesses segregated with Schnorr signatures?
SegWit fixed transaction malleability by just moving the signature out of the block of data that's being hashed to form the transaction id.
However, Schnorr does not suffer from signature malleability (https://medium.com/digitalassetresearch/schnorr-signatures-the-inevitability-of-privacy-in-bitcoin-b2f45a1f7287):

Non-malleability: ECDSA signatures are inherently malleable, which may
enable a third party without access to the private key to alter an
existing valid signature and double-spend funds. This issue was
formally discussed in BIP62. In comparison, Schnorr signatures are
provably non-malleable.

Consequently, is a Schnorr signature still segregated from the data that's being hashed, and if yes, why?

True, but also not what Dalit Sairio said. The question states "out of the block of data that's being hashed to form the transaction id", which is correct.

Schnorr (bip-340) signatures have been introduced as part of v1 Segwit outputs with the CHECKSIGADD opcode. Therefore bip-340 signatures are part of the witness and are not part of the hash forming the txid.
Script malleability is only a single among a lot of benefits brought by Segwit, and we shouldn't drop all the others (and encourage using legacy transactions) because part of the proposal does not need one of them.
For example, one of these benefits is simpler Script versioning and rolling out the CHECKSIGADD behaviour using the legacy versioning (NOP ops) would be a bit "dirty" (in addition to adding the incentive to use legacy transactions that are more expensive for the network to process).

Furthermore, script malleability is a wider problem than signature malleability. Segwit in general fixes all types of script malleability, which includes the ones cause by signature malleability, but also others.

Added to the answer (s/Signature malleability/Script malleability/).


text:
signmessage and verifymessage CLI commands not accepting Address from getnewaddress?
I am trying the following commands on my v0.19.0.1 Core implementation:
CLI signmessage $(CLI getnewaddress) <message>
and the identical
CLI signmessagewithprivkey $(bitcoin-cli dumpprivkey $(CLI getnewaddress)) <message>
Both times I get Error code: -3 "Address does not refer to key"
All my addresses are wrapped-Segwit (3...). Does this mean since its P2SH there is no way to find the privkey from the address?
Thank you

signmessage and verifymessage only work with legacy type addresses. They do not work with segwit addresses. There is ongoing work to introduce a new message signing standard that will work regardless of address type.
Some discussion about why they only work on legacy addresses can be found in this issue: https://github.com/bitcoin/bitcoin/issues/10542

Is there a way for me to request legacy addresses from my wallet?

getnewaddress "" legacy

Use signmessagewithprivkey for non legacy addresses.


text:
Who do locked bitcoins belong to?
I am currently learning about bitcoin transactions and I found out about the scriptPubKey which locks every output until it is spent by using the unlocking script.
My question is who owns the bitcoins before they are spent and unlocked?
For example, I came across a reddit post that mentions transaction outputs with a hash collision bounty as their locking script:
OP_2DUP OP_EQUAL OP_NOT OP_VERIFY OP_SHA1 OP_SWAP OP_SHA1 OP_EQUAL
Am I right to deduce that unless someone finds a collisoin to the specified hash functions these bitcoins are just unspendable and thus belong to nobody?

They are owned (or at least, controlled; ownership is more of a legal/social term than a technical one) by the script.
For simple scripts, which just require a signature by a single public key in one way or form, there is an easy correspondence between keys and scripts, and for those you can just as well say the coins are controlled by that key, or equivalently, by the person/entity who has access to its corresponding private key.
However, there is no requirement for scripts to correspond to just a single key, or even a multiple of keys. As your example shows, the script can reasonably not contain any keys at all.
Note that the example given is actually insecure. If someone were to find a viable SHA1 collision that could unlock the script, the coins can be stolen by miners. There is no signature, and thus nothing that prevents the reported collision from being used in any other transaction than the finders' one.

Can you check if my answer is correct please?

It seems my understanding that all bitcoins need to belong to some address was wrong:

There are no accounts or balances in bitcoin; there are only unspent
transaction outputs (UTXO) scattered in the blockchain.

source.
So the answer is that the Unspent Transaction Outputs created by the transaction are indeed unspendable unless someone can unlock them.
And they do not "belong" to anyone as there are no accounts or balances in bitcoin.

You're right that they don't belong to "anyone", but this is unrelated to the fact that Bitcoin has no accounts or balances. One could imagine a hypothetical account/balance based system where scripts also control access to funds (there are good reasons not to do that, but it's certainly feasible).


text:
My laptop hard drive isn't big enough to update Bitcoin Core v0.15.1 (64-bit)
First of all, I'm a complete novice, so I apologize for my ignorance. I have a MacBook where I installed Bitcoin Core v0.15.1 (64-bit).  In my wallet, it shows no BTC. (Note: I cannot find a file on my laptop called "wallet.dat"). Myy hard drive isn't big enough to download the entire blockchain.  Would this version of Bitcoin Core show a BTC balance even if the entire blockchain hasn't been sync'd, or will it only show an accurate BTC balance in my wallet only if the blockchain is sync'd with my laptop?  Again, I'm a novice, so I apologize for using incorrect terminology.  Thank you.

Bitcoin Core 0.15.1 is old (it's from 2017; the most recent release is 0.21.1), you should update it.

Your disk is almost certainly big enough to run in pruned mode (which only needs a few GB of disk space). This can be configured when you first run the software, or afterwards in settings.

If you don't have a wallet.dat file, you don't have a wallet. Have you ever actually ran the software? It will automatically create a wallet.

You will not see your balance until the software is synchronized with the network up to the point where you received coins.

Pieter, thank you very much for the detailed response.  I will take the steps.  I appreciate your help!


text:
Get balances from all addresses in wallet.dat / json file
I have a (possibly old) wallet.dat file with dozens to hundreds of addresses. It is obviously prohibitively expensive to manually look up each one.
Does anybody know a way to analyse all of them to find if any have a balance greater than 0? The current version of pywallet using --dumpwithbalance only lists the balance as error code: 1015 (apparently a CloudFlare issue)

If you have a wallet.dat, you can just load it into Bitcoin Core and wait for it to sync.


text:
Why does BIP174 take Xpubs but no addresses?
I have a few questions on BIP 174:
XPUBs: I am looking at BIP174, and I see that I can define a global XPub. How is this used. How does an updater, signer, or finalizer know what this XPub is for? Doesn't this expose some privacy?
Public Keys: For outputs, do I have to enter the public keys? Is there no option to enter an address instead?
Inputs: An input Non-Witness UTXO seems to require the entire previous transaction, instead of simply the txid and vout. Why is this?

How does an updater, signer, or finalizer know what this XPub is for?

It's not just an xpub. It's an xpub with key origin information. The fingerprint of the master public key and the derivation path to that xpub is provided. This means that a prefix match can be done with the derivation paths given in the input and output maps to find which xpub can be used to derive a particular pubkey.

Doesn't this expose some privacy?

Yes.

For outputs, do I have to enter the public keys?

No. You don't have to provide any information for the output maps.

Is there no option to enter an address instead?

No. Addresses are not useful in PSBTs.
The output fields do not specify the outputs themselves. That is done in the global transaction. Addresses only serve to specify the scriptPubKey to use in an output. The global unsigned transaction already has the output specified with their scriptPubKeys. So providing an address is not useful as it is just duplicate information.

Inputs: An input Non-Witness UTXO seems to require the entire previous transaction, instead of simply the txid and vout. Why is this?

The txid and vout are already provided by the Global unsigned transaction. Both the Non-witness UTXO and witness UTXO are needed in the inputs in order to sign the transaction. The signing algorithm requires knowing the scriptPubKey for the output being spent, and for segwit, the amount too. The full previous transaction needs to be provided to prevent attacks where users are signing for an output that they don't intend to spend. By providing the full transaction, signers can verify that the txid they compute for it matches the txid that is specified in the global unsigned transaction.


text:
WitnessScript vs. Script Witness
In BIP 174/PSBT, there is a PSBT Input key-value pair called "PSBT_IN_WITNESS_SCRIPT" (0x05) and another called "PSBT_IN_FINAL_SCRIPTWITNESS" (0x08). What is the difference between a WitnessScript and a scriptWitness?
From what I understood, a witness script is the witness data for a single input (the signatures and scripts that unlock it). Is the scriptWitness something different?

PSBT_IN_WITNESS_SCRIPT is specifically the actually executed script for a P2WSH or P2SH-P2WSH scriptPubKey being spent. It is added by an Updater who knows it.
PSBT_IN_FINAL_SCRIPTWITNESS is the witness stack needed to spend an output, including scripts, signatures, public keys, ... whatever is needed. It is created by a Finalizer, using other fields necessary (including PSBT_IN_WITNESS_SCRIPT) to produce it.

To clarify, SCRIPTWITNESS is the Segwit equivalent of ScriptSig, while WITNESS_SCRIPT is the Segwit equivalent of the redeemScript?
Or is WITNESS_SCRIPT the script for ScriptHash outputs, and it is separate by the redeemScript?

The scriptWitness (PSBT_IN_FINAL_SCRIPTWITNESS) is the per-input witness stack, so indeed more or less equivalent to scriptSig (for all segwit spends, not just P2WSH). The witness script (PSBT_IN_WITNESS_SCRIPT) is the executed script in P2WSH - similar to the redeemScript is P2SH.


text:
mining Blockchain Blocks
What if a miner starts to generate a new block hash based on trans data,latest block hash , timestamp and nonce  , then in the middle of the work a new block has been added by another miner.
in this case will the block be invalid as it hold a previous hash value which is not the latest block ?

in this case will the block be invalid as it hold a previous hash value which is not the latest block?

Yes. The miner will construct a new block template, that builds off the newest valid block, and continue to mine on the new template.
If they continued to mine on the old block, they would likely end up wasting resources, as the rest of the network will have begun following the new, longer (more work) chain.