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

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

by 류정필, 송재준
November 2019
Beginner to intermediate
408 pages
9h 29m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 비트코인
8
p2sh 스크립트
229
8.5
p2sh
스크립트 코딩하기
p2sh
스크립트를 처리하는 코드는 리딤 스크립트,
OP
_
HASH160
,
hash160
해시값,
OP
_
EQUAL
로 이어지는 일련의 명령어 배치 패턴을 포착하고 예외 처리를 해야 합니다.
script
.
py
파일 안
evaluate
메서드에서 이런 예외 처리를 합니다.
class Script:
...
def evaluate(self, z):
...
while len(cmds) > 0:
cmd = cmds.pop(0)
if type(cmd) == int:
...
else:
stack.append(cmd)
if len(cmds) == 3 and cmds[0] == 0xa9 \
and type(cmds[1]) == bytes and len(cmds[1]) == 20 \
and cmds[2] == 0x87:
cmds.pop()
h160 = cmds.pop()
cmds.pop()
if not op_hash160(stack):
return False
stack.append(h160)
if not op_equal(stack):
return False
if not op_verify(stack):
LOGGER.info('bad p2sh h160')
return False
redeem_script ...
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