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

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

by 류정필, 송재준
November 2019
Beginner to intermediate
408 pages
9h 29m
Korean
Hanbit Media, Inc.
Content preview from 밑바닥부터 시작하는 비트코인
6
장
스크립트
165
6.3.1
연산자의 구현
이제
OP
_
DUP
연산을 다음과 같이 코딩할 수 있습니다.
OP
_
DUP
은 간단히 스택 위의 동일한 원소
를 올립니다.
def op_dup(stack):
if len(stack) < 1:
➊
return False
stack.append(stack[-1])
➋
return True
...
OP_CODE_FUNCTIONS = {
...
118: op_dup,
➌
...
}
➊ 적어도 하나의 원소가 스택 위에 있어야만 복사할 수 있습니다. 그렇지 않으면
OP
_
DUP
연
산어를 실행할 수 없습니다.
➋ 스택 위의 원소를 복사하여 붙이는 방법입니다.
➌
118
(=
0x76
)은
OP
_
DUP
의 오피코드입니다.
OP
_
DUP
동작이 오류 없이 성공하면
True
불리언을 반환합니다. 실패하면 자동적으로 스크립
트가 유효하지 않게 됩니다.
다음은
OP
_
HASH256
연산에 대한 파이썬 코딩입니다. 이 연산자는 스택 위 원소를 가져와서 이
의
hash256
해시값을 구해서 새로운 원소로 스택 위에 올립니다.
def op_hash256(stack):
if len(stack) < 1:
return False
element = stack.pop()
stack.append(hash256(element))
return True
...
OP_CODE_FUNCTIONS ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

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

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

사이토 고키
견고한 데이터 엔지니어링

견고한 데이터 엔지니어링

조 라이스, 맷 하우슬리
실리콘밸리 리더십

실리콘밸리 리더십

김정혜, 마이클 롭

Publisher Resources

ISBN: 9791162248294