Skip to Content
밑바닥부터 시작하는 비트코인
book

밑바닥부터 시작하는 비트코인

by 류정필, 송재준
November 2019
Beginner to intermediate
408 pages
9h 29m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 비트코인
밑바닥부터 시작하는 비트코인
332
witness
를 스크립트 실행 메서드 (
evaluate
)에 인수로 넘겨줍니다.
또한
script
.
py
파일에서
p2wpkh
_
script
함수를 정의합니다.
def p2wpkh_script(h160):
'''Takes a hash160 and returns the p2wpkh ScriptPubKey'''
return Script([0x00, h160])
...
def is_p2wpkh_script_pubkey(self):
return len(self.cmds) == 2 and self.cmds[0] == 0x00 \
and type(self.cmds[1]) == bytes and len(self.cmds[1]) == 20
[
0x00
,
h160
]
OP
_
0
<
20
-
byte
-
hash
> 스크립트입니다.
Script
클래스의 메서드로 객체가
p2wpkh
형식 잠금 스크립트인지 판단합니다.
마지막으로
evaluate
메서드 안에 특별 규칙을 구현할 필요가 있습니다.
class Script:
...
def evaluate(self, z, witness):
...
while len(cmds) > 0:
...
else:
stack.append(cmds)
...
if len(stack) == 2 and stack[0] ==
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

밑바닥부터 시작하는 딥러닝

밑바닥부터 시작하는 딥러닝

사이토 고키
실리콘밸리 리더십

실리콘밸리 리더십

김정혜, 마이클 롭

Publisher Resources

ISBN: 9791162248294