Questions tagged [endianness]

17 questions
24
votes
4 answers

Why does the Bitcoin protocol use the little-endian notation?

Why does the Bitcoin use the litte-endian notation? It is less common than big-endian notation, thus when programming low-level applications working with Bitcoin protocol, one quite often has to create custom operations for handling the endianness…
ThePiachu
  • 42,931
  • 25
  • 138
  • 347
12
votes
1 answer

Why does Bitcoin Core print SHA256 hashes (uint256) bytes in reverse order?

When converting uint256 (the datatype used to represent hashes) to string in Bitcoin Core, the bytes are reversed. When debugging functional tests, this can create potential confusion when comparing hashes passed to script on the Python side and…
7
votes
1 answer

How does a miner perform hashing?

I'm trying to walk my way through the process by which a miner hashes. Let's say the getwork request returns a data field…
ConstableJoe
  • 655
  • 2
  • 7
  • 14
5
votes
4 answers

Why is little endian used in transaction formatting and other parts of bitcoin?

I've noticed just from studying the raw hex values of transactions that many components are formatted in hexidecimal little endian. For example, the amount specified in an output will be formatted as b6f5050000000000 instead of 0005F5B6, which…
jiamijiang
  • 105
  • 6
5
votes
1 answer

What does the little-endian notation improve for Bitcoin?

In another thread I read that the little-endian notation speeds things(?) up. Has someone info on what exactly it improves for Bitcoin?
user116823
4
votes
1 answer

How is the endian conversion done?

This answer seems simple, but I'm finding mixed answers. This question describes the conversion from little-endian to big-endian hex strings (or vice-versa) as switching the order of bytes in every slice of four bytes, where here it's described as…
ConstableJoe
  • 655
  • 2
  • 7
  • 14
3
votes
1 answer

What was the intended benefit of truncating the Target?

I'm thinking about how the Target value is truncated to and later compared to the SHA-256hash of the Block Header. Given that The maximum target (lowest possible difficulty) is 0x00000000FFFF0000000000000000000000000000000000000000000000000000 and…
makerofthings7
  • 12,656
  • 11
  • 60
  • 129
3
votes
1 answer

How does the satoshi client handle endianness?

I'm looking through the source code of the satoshi client, particularly into how transactions are serialized and sent through the network or stored to the disk. The CTransaction class has this block: IMPLEMENT_SERIALIZE ( …
Claudiu
  • 447
  • 3
  • 9
2
votes
2 answers

What are the hashes in Unspent outputs?

I am a newbie to Bitcoin. Looking at curl https://blockchain.info/unspent?active=1Cdid9KFAaatwczBwBttQcwXYCpvK8h7FK I guess that the script is the owner's address.I am not sure about this. "unspent_outputs":[ { …
2
votes
0 answers

Is my understanding of Blockhain Endianness correct?

I know questions on this topic have been asked to death in a number of different ways. I also know that what endian order refers to specifically is dependent on context. What I want are some specific clarifications, though, for peace of mind to…
2
votes
2 answers

What is Bitcoin's "genesis hash"?

From Lightning Network documentation: Used in several of the BOLT documents to denote the genesis hash of a target blockchain. This allows nodes to create and reference channels on several blockchains. Nodes are to ignore any messages that…
ripper234
  • 26,452
  • 30
  • 111
  • 246
2
votes
1 answer

Getwork and GetMemoryPool - why is previous block hash different?

When I called: print bitcoin.getmemorypool() print bitcoin.getwork() using Python JSON for a testnet BitcoinQT server, I got the following responces: {'previousblockhash': '00000000032e361b246e96c4e594523b6ff42bc0527e560f203fb20a08a86185',…
ThePiachu
  • 42,931
  • 25
  • 138
  • 347
1
vote
2 answers

Proper getmemorypool data endianness?

As there are a couple endiannesses used by Bitcoin, what is the proper way to encode the data parameter for a getmemorypool JSON API call?
ThePiachu
  • 42,931
  • 25
  • 138
  • 347
1
vote
1 answer

Do I have to worry about endian swapping when calculating ECDSA public key values, Creation & Signing of transactions and verification of signature?

Do I have to worry about endian swapping when calculating ECDSA public key values, Creation & Signing of transactions and verification of signature? This question is more of a straightforward yes/no kind of question because as far as I can tell…
1
vote
0 answers

Endianess of txids when calculating Merkle Root from getblocktemplate

I am trying to solve a merkle root from a previously mined block. Specifically this block... https://www.blockchain.com/en/btc/block/000000000003ba27aa200b1cecaad478d2b00432346c3f1f3986da1afd33e506 TXHash1:…
1
2