[blockchain] difficulty, target값, blockhash
https://en.bitcoin.it/wiki/Difficulty
Difficulty - Bitcoin Wiki
See also: target What is "difficulty"? Difficulty is a measure of how difficult it is to find a hash below a given target. The Bitcoin network has a global block difficulty. Valid blocks must have a hash below this target. Mining pools also have a pool-spe
en.bitcoin.it
difficulty = difficulty_1_target / current_target
difficulty_1 은 임의로 정해진 값이 있음(the highest target) 타겟과 난이도(difficulty) 는 반비례관계 난이도가 높을수록 타겟값은 낮아짐 가장 처음의 난이도를 의미하는 difiiculty_1 이라 하고 값은 0x1d00ffff 이다.
difficulty 를 사용하여 target 값을 구할수 있다.
difficulty 를 쪼개서 index_1 = 16진수 앞2자리 index_2 = 16진수 뒤4자리 로 가정할때
index_2 * 2 ** (8*(index_1 -3)) = target 식으로 타겟값을 구할수 있다.
difficulty_1_target
= 0x00ffff * 2 ** ( 8*(0x1d -3)) = 0x00000000FFFF0000000000000000000000000000000000000000000000000000
= 2.695953529101131e+67
hash값 : 00000000000000000003c99d356fbc64d0d4a42e4607df0617231f84146417a0
#754947 블락의 난이도를 통해서 타겟값을 구해보고 실제로 해쉬값이 타겟값보다 작은지 확인해보자
맨위 식을 사용 하면 difficulty = difficulty_1_target / current_target
current_target = 2.695953529101131e+67 / 32045359565303.15
= 8.4129296e+53
= 0x8c894009ca62180000000000000000000000000000000
hash < target === true