Hot answers tagged

8

asymmetric ciphers Ones based on specific primitives, like RSA and ECDSA specifically. Symmetric algorithms are supposed to be safe. With approximately half the number of bits of security due to Grover's algorithm. Which components of the bitcoin blockchain would be exposed to quantum attacks? The security of SHA256 would be halved, ECDSA would be ...


6

Mark H's answer is correct, but I think there is a more fundamental point: addresses are directly intended for human consumption. Transaction hashes (as well as public keys, block hashes, raw scripts, raw transactions, ...) are not. They are sometimes visualized, but this is primarily for debugging purposes. And hexadecimal is a very natural choice for ...


6

A transaction could go unconfirmed indefinitely. The order in which transactions are confirmed is decided by miners, and generally they will be incentivized to include only the highest fee-rate transactions, to maximize their revenue. Even a low fee-rate transaction may eventually confirm, once the mempool clears out. But there is no guarantee of this, ...


4

Is verification of blockchain computationally cheaper than recreating it? Yes, far easier How do you verify the blockchain integrity? Don't you also have to recalculate all the values to see whether they are valid? No. The miner has to find a value for parts of the block they can choose a value for, such that a hash of the block has a certain number of ...


4

I am curious about where the actual hex value of the data that generates that hash with a lot of zeroes is. It is a composite of values from the block - in brief, it is the concatenated binary (represented here in hex notation) little endian value of each of the fields: version + previous_block_hash + merkle_root_hash + time + bits + nonce of the block ...


3

SHA256 hashes are encoded in plain binary in bitcoin protocol and in block storage (32-bytes in little-endian byte order when treated as integers, which makes them effectively "base256"). The textual hex encoding is merely used for displaying and inputting hashes into the software. Hex is a widely used and understood format for representing arrays of bytes. ...


3

I just found the answer : https://api.lightning.community/rest/index.html?javascript#v1-payreq Use the endpoint v1/payreq to decode the payment request. Exemple : var fs = require('fs'); var request = require('request'); var macaroon = fs.readFileSync('LND_DIR/data/chain/bitcoin/simnet/admin.macaroon').toString('hex'); var options = { url: 'https://...


3

The difficulty is actually represented by the target threshold encoded in the nBits value in the block header. Where difficulty represents the human readable representation ("how often do we need to try to find a solution"), the target threshold defines the prefix a block must undershoot in order to be valid. This means that the 256-bit block hash ...


3

The reason that is often stated is that you would have to re-calculate all the headers with all the hash values of the whole chain which is practically un-doable. It's not the mere recalculation of new headers: miners currently create about 8×10^19 block candidates every second. However, at current difficulty levels, it takes about 4.8×10^22 block ...


3

Is it because they're mining too fast for the timestamp to change? Precisely - even a relatively slow CPU can hash several hundred headers every second. Modern day ASICs can hit 100+ terahashes per second - ripping through the entire nonce space several times over. Moreover, the timestamp is also a 4 byte value - miners do use it, in conjunction with the ...


3

You're missing multiple parts here. If that's your complete code, you don't seem to be adding a nonce to your preimage at all. You will need to generate a nonce, add it to the preimage, and test the corresponding digest against your acceptance criteria. To that end, you probably want to use a while loop that continues rolling random nonces and testing ...


3

(This answer is a selection of quotes from an email I got from David Harding where he replied to my email reply to the newsletter. In the answer below, the quoted text is from my email question and the non-quoted text is from David Harding's reply) I think it is indeed a collision attack. The attack you describe is based on a database of preimages and ...


2

you can check this repo, iti si creedt for Cryptography For Developers, Simon Johnson (pg. 218): https://github.com/in3rsha/sha256-animation


2

combined together to get the penultimate hash which together with the nonce That's not correct. The "penultimate hash" is the merkle root. The nonce is not part of the merkle root at all. That is part of the block header and is hashed along with the merkle root and several other things in order to get the block hash. This merkle tree structure is ...


2

Adding more zeroes (more precisely as a prefix) to the required block hash (which is the hash of block header) makes it more difficult because you need to keep hashing the block header until you find a hash value that is less than the required maximum numeric hash value (you update the block header everytime by incrementing the nonce in it which changes the ...


2

A Bitcoin block is a container data structure that aggregates all the transactions. The block is made of a header (containing metadata), followed by a long list of transactions that are included in the block. The block header consists of merkle tree root, previous block header hash, timestamp amongst other metadata. The Merkle tree root in simpler terms ...


2

It depends on how you have configured your bitcoind and what commands you are using. getrawtransaction first searches the mempool for your txid. The transactions in the mempool are held in memory and can be looked up by txid. If the transaction is not in the mempool. then you need to either provide the hash of the block it can be found in, or you need to ...


2

Mining a valid block involves multiple steps. To begin with, you must know which block you are mining on top of, which is specified by the previous block hash. Then, you must obtain a merkle root that locks in a valid set of transactions. Usually, this is a set of transactions from the mempool + the coinbase transaction, such that there are no double ...


1

A miner must create a block whose header, when hashed, is numerically less than or equal to the target value for the block. Each block contains a list of transactions whose merkle root is included in the block header, and the list must have at least one transaction in it, called the coinbase. The coinbase collects all fees of other transactions in the block ...


1

You seem to be interpreting the hex encoded data as a UTF-8 string. Instead, you should be decoding it as a byte dump. To illustrate, decoding 12 as a UTF-8 string will give you: 0x3132 while decoding it as a hex dump will give you: 0x12 In bitcoin, all hashing it done on the byte values, which are often printed as hex strings for convenience - you must ...


1

For Pay2PubKey addresses, it's always 160 bits of entropy, regardless of the address format (old, 1... or the new Bech32 format) Pay2ScriptHash addresses, in the old Base58 format (3...) have 160 bits of entropy. In Bech32, they have 256 bits. You can read more about why the developers increased it here and here.


1

Increasing the nonce size would not increase or decrease the expected block time. The block time is maintained via the difficulty adjustment algorithm, which adjusts the network difficulty according to the apparent time it took for the last 2016 blocks to be found. How quickly blocks are found can thus be used to estimate how many hashes/second the ...


1

If you want to move all your computational power (hash power) suppose you could just disconnect from your current pool and connect to the other one If you want to divide between different pool I suppose you could just connect to them then use a tactic of process priority to choose how much power you want to devote to each pool depending on its process, for ...


1

Speaking of bitcoin (other cryptocurrencies may do things a bit differently but the principles will likely be similar) and simplifying slightly (i.e. not discussing stuff like segwit). For ECDSA a private key is simply a large (psuedo)-random number. Depending on the particular wallet implementation the private key may be generated and stored, or it may be ...


1

I've got the answer http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html: The key point is that each nonce generates a basically-random hash value. To get a lot of zeroes, you need to try an exponentially large number of nonces.


1

The difficulty calculation is part of the consensus rules that nodes on the network follow. It can be calculated at any time by a node and is calculated every 2016 blocks (two weeks, on average). When the correct number of blocks has passed, the node calculates it based on the last two weeks and adjusts in order to maintain a 10 minute block time (on average)...


1

Double SHA 256 follows a uniform distribution that means all hashes are equally likely to occur. So, your chances of finding the block header hash that is less than the target is same for every round of hashing. With the current mining difficulty of 10183488432890, the target bits are 0x171ba3d1. This means you will need to find the block header hash that ...


1

When a new block is received by a node, it is validated. This validation includes verifying the validity of each individual transaction, constructing the merkle tree and the merkle root, verifying the merkle root against the block header, verifying the PoW in the block header, and finally verifying the hash itself. After this validation is completed, the ...


1

When a miner authors a new block, the block contains a block header. The block header is used to put the new block in relation to previous blocks and gives a summary of the transactions. In detail, the block header contains: a version byte the block hash of the previous block the Merkle root that commits to all transactions in the block a timestamp a field ...


1

Because they aren't the same. It appears that this script IDE interprets things inside of angle brackets (< and >) as strings, not as hex values. However a hash is not a string, it is a sequence of bytes which may be represented using hexadecimal values. So what your script is actually doing is putting the string 1PUzZ61FSVTn12CafJC85Vy1ts3BoFcXdU on ...


Only top voted, non community-wiki answers of a minimum length are eligible