KR102269174B1 - Appratus and method for verification of smart contracts - Google Patents

Appratus and method for verification of smart contracts Download PDF

Info

Publication number
KR102269174B1
KR102269174B1 KR1020190123850A KR20190123850A KR102269174B1 KR 102269174 B1 KR102269174 B1 KR 102269174B1 KR 1020190123850 A KR1020190123850 A KR 1020190123850A KR 20190123850 A KR20190123850 A KR 20190123850A KR 102269174 B1 KR102269174 B1 KR 102269174B1
Authority
KR
South Korea
Prior art keywords
verification
invariant
unit
condition
smart contract
Prior art date
Application number
KR1020190123850A
Other languages
Korean (ko)
Other versions
KR20210041310A (en
Inventor
오학주
소순범
이명호
Original Assignee
고려대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 고려대학교 산학협력단 filed Critical 고려대학교 산학협력단
Priority to KR1020190123850A priority Critical patent/KR102269174B1/en
Publication of KR20210041310A publication Critical patent/KR20210041310A/en
Application granted granted Critical
Publication of KR102269174B1 publication Critical patent/KR102269174B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements
    • G06F21/562Static detection
    • G06F21/563Static detection by source code analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Health & Medical Sciences (AREA)
  • Virology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

스마트 컨트랙트 검증 장치 및 방법에 관한 것으로 스마트 컨트랙트 검증 장치는 적어도 하나의 불변식 후보를 포함하는 불변식 후보군을 생성하는 불변식 처리부 및 컨트랙트의 적어도 하나의 검증 대상을 획득하고, 상기 불변식 후보를 이용하여 상기 적어도 하나의 검증 대상 각각에 대한 검증 조건을 생성하는 검증부를 포함할 수 있으며, 상기 검증부는 상기 적어도 하나의 검증 대상 중에서 반환 대상을 검출하여 상기 불변식 처리부로 전달하되, 상기 반환 대상은 타당하지 않은 검증 조건에 대응하는 검증 대상을 포함할 수 있다.A smart contract verification apparatus and method, wherein the smart contract verification apparatus obtains an invariant processing unit that generates an invariant candidate group including at least one invariant candidate and at least one verification target of the contract, and uses the invariant candidate and a verification unit generating verification conditions for each of the at least one verification target, wherein the verification unit detects a return target from among the at least one verification target and delivers it to the invariant processing unit, wherein the return target is valid A verification target corresponding to a verification condition that has not been verified may be included.

Figure 112019102129571-pat00038
Figure 112019102129571-pat00038

Description

스마트 컨트랙트 검증 장치 및 방법{APPRATUS AND METHOD FOR VERIFICATION OF SMART CONTRACTS}Smart contract verification apparatus and method

본 발명은 스마트 컨트랙트 검증 장치 및 방법에 관한 것이다.The present invention relates to a smart contract verification apparatus and method.

스마트 컨트랙트(Smart Contract, 스마트 계약 등으로 지칭 가능함)는 복수의 계약자 간에 협의된 디지털화된 계약서 또는 이와 같은 계약서 내의 계약 내용을 자동적으로 이행해주는 프로그램 코드(프로그램이나 소프트웨어 등으로 지칭 가능함)를 의미한다. 근자에는 가상 화폐나 보안 프로그램과 같은 블록체인 기반 기술의 발달에 따라 스마트 컨트랙트에 대한 관심이 급격히 증가하고 있다.A smart contract (which can be referred to as a smart contract, etc.) means a digitized contract negotiated between a plurality of contractors or a program code (which can be referred to as a program or software, etc.) that automatically implements the contract contents in such a contract. Recently, with the development of blockchain-based technologies such as virtual currency and security programs, interest in smart contracts is rapidly increasing.

스마트 컨트랙트는 다른 프로그램보다 상대적으로 안전성을 검증하는 작업이 중요하다. 왜냐하면, 첫 번째로 스마트 컨트랙트는 처리 결과에 따라서 개인의 재산 상황을 직접적으로 변경할 수 있는 반면에 누구나 소스 코드를 열람할 수 있으므로 누군가 스마트 컨트랙트 내부의 결함을 발견하여 악용하는 경우 막대한 재산상 피해를 야기할 수 있기 때문이다. 예를 들어, SMT(SmartMesh) 해킹 사건과 같이 스마트 컨트랙트 코드 상에 존재하는 정수 오버플로우(integer overflow) 취약점을 이용하여 토큰을 무한 생성하여 다수인에게 금전적 피해를 입히는 것과 같은 문제점이 발생될 수 있다. 두 번째로 스마트 컨트랙트는 다른 여타의 프로그램들과는 달리 블록체인 등을 통해 한번 배포된 이후에는 수정하는 것이 불가능하다(immutability). 이와 같은 이유들로 인해 스마트 컨트랙트 프로그램은 블록체인 등을 통해 배포되기 전에 프로그램 코드에 문제점이 존재하는지 여부가 더욱 엄밀하게 확인 및 검증되어야 한다.It is important to verify the safety of smart contracts relative to other programs. Because, firstly, smart contracts can directly change an individual's property situation according to the processing result, while anyone can view the source code, so if someone discovers and exploits a defect inside the smart contract, it causes huge property damage because you can For example, such as the SMT (SmartMesh) hacking incident, using an integer overflow vulnerability in the smart contract code to create infinite tokens and inflict financial damage on multiple people may occur. . Second, unlike other programs, smart contracts cannot be modified (immutability) once deployed through blockchain. For these reasons, before the smart contract program is distributed through blockchain, etc., whether there is a problem in the program code should be more strictly checked and verified.

이와 같은 검증을 위해 스마트 컨트랙트 프로그램의 배포 전에 보안 전문가들에게 코드 감사(auditing)를 의뢰하기도 하나, 사람에 의한 안전성 검증은 한계가 명확하다. 따라서, 이와 같은 검증을 자동화하기 위한 도구가 개발 및 안내되어 왔으나, 이들 도구는 프로그램의 일부에 대해서만 검증을 수행하기 때문에 스마트 컨트랙트 프로그램 내의 모든 취약점을 검출할 수 없는 한계가 존재하였다(불건전성, unsoundness). 한편, 이들 도구 중에서는 프로그램의 전부에 대해 검증을 수행하는 도구도 존재하나, 이들은 너무 많은 수의 허위 경보(false positive)를 생성하기 때문에 스마트 컨트랙트에 대한 분석 결과가 부정확해지는 단점이 존재한다.For such verification, code auditing is sometimes requested by security experts before the distribution of the smart contract program, but safety verification by humans has clear limitations. Therefore, tools for automating such verification have been developed and guided, but since these tools only perform verification on a part of the program, there is a limit in which all vulnerabilities in the smart contract program cannot be detected (unsoundness, unsoundness). ). On the other hand, among these tools, there is also a tool for performing verification on all programs, but since they generate too many false positives, there is a disadvantage in that the analysis result for the smart contract is inaccurate.

미합중국 공개특허 US 2018/0183600 A1 (2018.06.28. 공개)US Patent Publication US 2018/0183600 A1 (published on June 28, 2018) 미합중국 등록특허 7,146,352 B2 (2006.12.05. 등록)US registered patent 7,146,352 B2 (registered on Dec. 5, 2006) 일본국 공개특허 특개2001-142937호 (2001.05.25. 공개)Japanese Patent Laid-Open No. 2001-142937 (published on May 25, 2001)

본 발명은 스마트 컨트랙트의 취약점을 누락 없이 정확하게 검증할 수 있는 스마트 컨트랙트 검증 장치 및 방법을 제공하는 것을 해결하고자 하는 과제로 한다.An object of the present invention is to provide a smart contract verification apparatus and method capable of accurately verifying the vulnerabilities of a smart contract without omission.

스마트 컨트랙트 내에 숨어있는 트랜잭션 불변식을 자동으로 유추함으로써 취약점을 정확하게 검증할 수 있는 스마트 컨트랙트 검증 장치 및 방법을 제공하는 것을 또 다른 해결하고자 하는 과제로 한다.Another task to be solved is to provide a smart contract verification device and method that can accurately verify vulnerabilities by automatically inferring the transaction invariants hidden within the smart contract.

상술한 과제를 해결하기 위하여 스마트 컨트랙트 검증 장치 및 방법이 제공된다.A smart contract verification apparatus and method are provided in order to solve the above problems.

스마트 컨트랙트 검증 장치는 적어도 하나의 불변식 후보를 포함하는 불변식 후보군을 생성하는 불변식 처리부 및 컨트랙트의 적어도 하나의 검증 대상을 획득하고, 상기 불변식 후보를 이용하여 상기 적어도 하나의 검증 대상 각각에 대한 검증 조건을 생성하는 검증부를 포함하고, 상기 검증부는 상기 적어도 하나의 검증 대상 중에서 반환 대상을 검출하여 상기 불변식 처리부로 전달하되, 상기 반환 대상은 타당하지 않은 검증 조건에 대응하는 검증 대상을 포함할 수 있다.The smart contract verification apparatus obtains an invariant processing unit that generates an invariant candidate group including at least one invariant candidate and at least one verification target of the contract, and uses the invariant candidate to each of the at least one verification target. a verification unit generating a verification condition for the verification unit, wherein the verification unit detects a return target from among the at least one verification target and transmits it to the invariant processing unit, wherein the return target includes a verification target corresponding to an invalid verification condition can do.

스마트 컨트랙트 검증 방법은 적어도 하나의 불변식 후보를 포함하는 불변식 후보군을 생성하는 단계, 컨트랙트의 적어도 하나의 검증 대상을 획득하는 단계, 상기 불변식 후보를 이용하여 상기 적어도 하나의 검증 대상 각각에 대한 검증 조건을 생성하는 단계 및 상기 적어도 하나의 검증 대상 중에서 반환 대상을 검출하되, 상기 반환 대상은 타당하지 않은 검증 조건에 대응하는 검증 대상을 포함하는 단계를 포함할 수 있다.The smart contract verification method includes the steps of generating an invariant candidate group including at least one invariant candidate, obtaining at least one verification target of the contract, and using the invariant candidate for each of the at least one verification target The method may include generating a verification condition and detecting a return target from among the at least one verification target, wherein the return target includes a verification target corresponding to an invalid verification condition.

상술한 스마트 컨트랙트 검증 장치 및 방법에 의하면, 스마트 컨트랙트의 취약점을 누락 없이 정확하게 검증할 수 있게 되는 효과를 얻을 수 있다.According to the smart contract verification apparatus and method described above, it is possible to obtain the effect of accurately verifying the vulnerabilities of the smart contract without omission.

또한, 스마트 컨트랙트 내에 숨어있는 트랜잭션 불변식을 자동으로 유추함으로써 취약점을 정확하게 검증할 수 있게 되어 종래의 스마트 컨트랙트 분석 또는 검증 기술의 한계를 극복할 수 있는 효과도 얻을 수 있다.In addition, it is possible to accurately verify vulnerabilities by automatically inferring the transaction invariants hidden within the smart contract, thereby achieving the effect of overcoming the limitations of the conventional smart contract analysis or verification technology.

또한, 배포될 스마트 컨트랙트의 안전성이 보다 개선될 수 있으므로, 블록체인 생태계와 같이 스마트 컨트랙트가 이용될 여러 생태계의 안전도가 증가되는 효과도 얻을 수 있다.In addition, since the safety of the smart contract to be distributed can be further improved, it is also possible to obtain the effect of increasing the safety of various ecosystems in which the smart contract will be used, such as a blockchain ecosystem.

본 발명의 상세한 설명에서 인용되는 도면을 보다 충분히 이해하기 위하여 각 도면의 상세한 설명이 제공된다.
도 1은 스마트 컨트랙트 검증 장치의 일 실시예에 대한 블록도이다.
도 2는 컨트랙트의 일례를 설명하기 위한 도면이다.
도 3은 불변식을 설명하기 위한 프로그램 코드의 일례이다.
도 4는 스마트 컨트랙트 검증 장치의 일 실시예에 대한 제어 블록도이다.
도 5는 검증부의 동작의 일례를 설명하기 위한 제1 도이다.
도 6은 검증부의 동작의 일례를 설명하기 위한 제2 도이다.
도 7은 검증부의 다른 실시예에 대한 블록도이다.
도 8은 스마트 컨트랙트 검증 장치의 동작을 프로그램 코드로 표현한 일례를 도시한 도면이다.
도 9는 스마트 컨트랙트 검증 장치의 성능을 다른 종래의 장치와 비교한 결과를 나타낸 제1 도표이다.
도 10은 스마트 컨트랙트 검증 장치의 성능을 다른 종래의 장치와 비교한 결과를 나타낸 제2 도표이다.
도 11은 스마트 컨트랙트 검증 방법의 제1 실시예에 대한 흐름도이다.
도 12는 스마트 컨트랙트 검증 방법의 제2 실시예에 대한 흐름도이다.
도 13은 스마트 컨트랙트 검증 방법의 제3 실시예에 대한 흐름도이다.
In order to more fully understand the drawings recited in the Detailed Description of the Invention, a detailed description of each drawing is provided.
1 is a block diagram of an embodiment of a smart contract verification apparatus.
2 is a diagram for explaining an example of a contract.
3 is an example of a program code for explaining an invariant expression.
4 is a control block diagram of an embodiment of a smart contract verification apparatus.
5 is a first diagram for explaining an example of the operation of the verification unit.
6 is a second diagram for explaining an example of the operation of the verification unit.
7 is a block diagram of another embodiment of the verification unit.
8 is a diagram illustrating an example in which the operation of the smart contract verification apparatus is expressed in program code.
9 is a first chart showing the results of comparing the performance of the smart contract verification device with other conventional devices.
10 is a second chart showing the results of comparing the performance of the smart contract verification device with other conventional devices.
11 is a flowchart of a first embodiment of a smart contract verification method.
12 is a flowchart of a second embodiment of a smart contract verification method.
13 is a flowchart of a third embodiment of a smart contract verification method.

이하 명세서 전체에서 동일 참조 부호는 특별한 사정이 없는 한 동일 구성요소를 지칭한다. 이하에서 사용되는 '부'가 부가된 용어는, 소프트웨어 또는 하드웨어로 구현될 수 있으며, 실시예에 따라 하나의 '부'가 하나의 물리적 또는 논리적 부품으로 구현되거나, 복수의 '부'가 하나의 물리적 또는 논리적 부품으로 구현되거나, 하나의 '부'가 복수의 물리적 또는 논리적 부품들로 구현되는 것도 가능하다.In the following specification, the same reference numerals refer to the same elements unless otherwise specified. The term added with 'unit' used below may be implemented in software or hardware, and depending on the embodiment, one 'unit' may be implemented as one physical or logical part, or a plurality of 'units' may be implemented as one It may be implemented as a physical or logical part, or one 'unit' may be implemented with a plurality of physical or logical parts.

명세서 전체에서 어떤 부분이 다른 부분과 연결되어 있다고 할 때, 이는 어떤 부분과 다른 부분에 따라서 물리적 연결을 의미할 수도 있고, 또는 전기적으로 연결된 것을 의미할 수도 있다. 또한, 어떤 부분이 다른 부분을 포함한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 부분 이외의 또 다른 부분을 제외하는 것이 아니며, 설계자의 선택에 따라서 또 다른 부분을 더 포함할 수 있음을 의미한다.Throughout the specification, when it is said that a part is connected to another part, this may mean a physical connection or an electrically connected part depending on the part and the other part. In addition, when it is said that a part includes another part, it does not exclude another part other than the other part unless otherwise stated, and it means that another part may be further included according to the designer's choice. do.

'제1' 이나 '제2' 등의 용어는 하나의 부분을 다른 부분으로부터 구별하기 위해 사용되는 것으로, 특별한 기재가 없는 이상 이들이 순차적인 표현을 의미하는 것은 아니다. 또한, 단수의 표현은 문맥상 명백하게 예외가 있지 않는 한, 복수의 표현을 포함할 수 있다.Terms such as 'first' or 'second' are used to distinguish one part from another, and unless otherwise specified, they do not mean sequential expressions. Also, the singular expression may include the plural expression unless the context clearly dictates otherwise.

이하, 도 1 내지 도 8을 참조하여 스마트 컨트랙트 검증 장치의 여러 실시예에 대해서 설명하도록 한다.Hereinafter, various embodiments of the smart contract verification apparatus will be described with reference to FIGS. 1 to 8 .

도 1은 스마트 컨트랙트 검증 장치의 일 실시예에 대한 블록도이다.1 is a block diagram of an embodiment of a smart contract verification apparatus.

도 1에 도시된 바에 의하면, 스마트 컨트랙트 검증 장치(100)는 검증부(110, Validator) 및 불변식 처리부(170)를 포함할 수 있으며, 실시예에 따라서 타당성 판단부(180)를 더 포함할 수 있다. 또한, 필요에 따라 입력부(101) 및 출력부(102)를 더 포함하는 것도 가능하다. 검증부(110), 불변식 처리부(170), 타당성 판단부(180), 입력부(101) 및 출력부(102) 중 적어도 둘은 상호 전기적으로 연결되어 정보(데이터)를 송수신할 수 있도록 마련된다. 이 경우, 이들은 케이블, 회로 및/또는 유무선 통신 네트워크를 기반으로 데이터를 송수신할 수 있다.As shown in FIG. 1 , the smart contract verification apparatus 100 may include a verification unit 110 , a Validator, and an invariant processing unit 170 , and may further include a validity determination unit 180 according to an embodiment. can In addition, it is also possible to further include the input unit 101 and the output unit 102 if necessary. At least two of the verification unit 110 , the invariant processing unit 170 , the validity determination unit 180 , the input unit 101 , and the output unit 102 are electrically connected to each other to transmit and receive information (data) . In this case, they may transmit/receive data based on cables, circuits and/or wired/wireless communication networks.

스마트 컨트랙트 검증 장치(100)는 각종 연산 처리 및 신호 생성이 가능한 적어도 하나의 장치를 포함할 수 있으며, 적어도 하나의 장치는 프로세서를 이용하여 구현될 수도 있고, 또는 프로세서가 설치된 컴퓨팅 장치를 이용하여 구현될 수도 있다. 여기서, 프로세서는, 예를 들어, 중앙 처리 장치(CPU, Central Processing Unit), 마이크로 컨트롤러 유닛(MCU, Micro Controller Unit), 마이컴(Micom, Micro Processor), 애플리케이션 프로세서(AP, Application Processor), 전자 제어 유닛(ECU, Electronic Controlling Unit), 그래픽 처리 장치(GPU, Graphic Processing Unit) 및/또는 각종 연산 처리 및 제어 신호의 생성이 가능한 처리 장치 등을 포함할 수 있다. 이들 처리 장치는 예를 들어 하나 또는 둘 이상의 반도체 칩 및 관련 부품을 이용하여 구현될 수 있다. 컴퓨팅 장치는, 예를 들어, 데스크톱 컴퓨터, 랩톱 컴퓨터, 서버용 컴퓨터, 스마트 폰, 태블릿 피씨, 스마트 시계, 두부 장착형 디스플레이(HMD, Head Mounted Display) 장치, 휴대용 게임기, 로봇, 가전 기기, 기계 장치 및/또는 이외 정보 처리 기능을 수행할 수 있는 적어도 하나의 전자 장치를 포함할 수 있다.The smart contract verification apparatus 100 may include at least one device capable of various arithmetic processing and signal generation, and the at least one device may be implemented using a processor, or implemented using a computing device in which the processor is installed. could be Here, the processor is, for example, a central processing unit (CPU, Central Processing Unit), a micro controller unit (MCU), a microcomputer (Micom, Micro Processor), an application processor (AP, Application Processor), electronic control It may include an Electronic Controlling Unit (ECU), a graphic processing unit (GPU), and/or a processing unit capable of processing various calculations and generating control signals. These processing devices may be implemented using, for example, one or more semiconductor chips and related components. Computing devices include, for example, desktop computers, laptop computers, server computers, smart phones, tablet PCs, smart watches, Head Mounted Display (HMD) devices, portable game consoles, robots, home appliances, mechanical devices, and/or Alternatively, it may include at least one electronic device capable of performing other information processing functions.

검증부(110)는 입력부(101)로부터 또는 별도의 저장 매체(미도시)를 통하여 컨트랙트(Contract, 계약 등으로 표현 가능함)를 획득하고, 획득한 컨트랙트의 안전성을 검증할 수 있도록 마련된다. 컨트랙트는 특정 조건이나 상황에 따라 미리 정의된 내용을 자동으로 실행해줄 수 있는 프로그램 코드를 포함할 수 있다.The verification unit 110 is provided to obtain a contract (contract, which can be expressed as a contract, etc.) from the input unit 101 or through a separate storage medium (not shown), and to verify the safety of the obtained contract. A contract may contain program code that can automatically execute predefined contents according to specific conditions or situations.

일 실시예에 의하면, 검증부(110)는 불변식 처리부(170)로부터 불변식 후보군(Group of invariant candidates)을 수신할 수 있으며, 수신한 불변식 후보군을 이용하여 컨트랙트의 안전성을 검증/확인할 수 있다. 여기서, 불변식 후보군은 적어도 하나의 불변식 후보(들)를 포함하는 적어도 하나의 집합을 포함한다. 예를 들어, 검증부(110)는 수신한 불변식 후보군의 적어도 하나의 불변식 후보에 대한 귀납성(inductiveness) 여부와 컨트랙트 내의 모든 검증 대상(예를 들어, 프로그램 코드 내의 쿼리 또는 쿼리 등을 포함하는 기본 경로 등)의 안전성을 검사함으로써 컨트랙트의 안전성을 확인할 수 있다. According to an embodiment, the verification unit 110 may receive a Group of invariant candidates from the invariant processing unit 170, and verify/confirm the safety of the contract using the received invariant candidate group. have. Here, the invariant candidate group includes at least one set including at least one invariant candidate(s). For example, the verification unit 110 includes the inductiveness of at least one invariant candidate of the received invariant candidate group and all verification objects in the contract (eg, a query or query in the program code, etc.). The safety of the contract can be verified by examining the safety of the default path, etc.).

불변식(invariant)은 어떠한 일련의 동작을 수행하는 동안에도 변하지 않고 일정하게 유지되는 조건, 속성, 성질 또는 상태 등을 의미한다. 불변식은 함수(수식이나 명령문 등) 등의 형태로 표현될 수 있다. 불변식은, 예를 들어, 트랜잭션 불변식(transaction invariant) 및 루프 불변식(loop invariant) 중 적어도 하나를 포함할 수 있다. 트랜잭션 불변식은 트랜잭션의 처리 과정에서도 변하지 않는 조건, 속성, 성질 또는 상태 등을 의미한다. 트랜잭션 불변식은 컨스트럭터(constructor) 함수(생성자 함수)의 종료 시나 외부에서 호출 가능한 함수(예를 들어, 컨스트럭터 이외의 함수로써, 함수 접근 제어자가 public 혹은 external인 함수 등)의 실행 전후에도 항상 만족된다. 루프 불변식은 어떠한 루프(Loop, 룹 등으로 표현 가능하다)가 실행되는 동안에도 변하지 않는 상태, 성질 또는 조건 등을 의미한다. 루프 불변식은 각 루프가 실행되기 전(루프 입구 지점)에서 항상 만족된다.An invariant refers to a condition, property, property, or state that remains constant and does not change during any series of operations. An invariant expression can be expressed in the form of a function (expression or statement, etc.). The invariant may include, for example, at least one of a transaction invariant and a loop invariant. Transaction invariance refers to a condition, attribute, property, or state that does not change even in the course of transaction processing. Transaction invariants are always satisfied when the constructor function (constructor function) is terminated or before and after execution of an externally callable function (for example, a function other than a constructor whose function access modifier is public or external, etc.). The loop invariant expression refers to a state, property, or condition that does not change while any loop (which can be expressed as a loop, loop, etc.) is executed. The loop invariant is always satisfied before each loop execution (the loop entry point).

불변식은 프로그램 코드 내에 명시적으로 표현되어 있을 수도 있고 및/또는 프로그램 코드 내에 명시적으로 표현되지 않아 코드로부터 추정 또는 확인해야 할 수도 있다. 불변식 후보는 이와 같이 컨트랙트에서 이용된 불변식을 추정하기 위해 미리 수집, 정의, 설정 또는 정제된 적어도 하나의 불변식(들)을 의미한다. 불변식 후보는 귀납적이면서도 컨트랙트 내의 적어도 하나의 검증 대상의 안전성을 증명할 수 있도록 생성된 것일 수 있다. Invariants may be explicitly expressed in the program code and/or may not be explicitly expressed in the program code and thus have to be inferred or verified from the code. The invariant candidate means at least one invariant expression(s) that has been previously collected, defined, set or refined to estimate the invariant expression used in the contract. The invariant candidate may be generated so as to prove the safety of at least one verification target in the contract while being inductive.

검증부(110)는 컨트랙트의 안전성 검증을 위한 검증 조건(verification condition, 도 4의 113a)을 생성할 수도 있다. 검증 조건(113a)은 컨트랙트의 적어도 하나의 검증 대상(예를 들어, 기본 경로(도 4의 111a) 등) 각각에 대응하여 생성된 것일 수 있다. 실시예에 따라, 컨트랙트의 검증 대상(111a) 모두에 대해 검증 조건(113a)이 각각 생성될 수 있다. 검증 조건(113a)의 생성을 위해 상술한 불변식 후보군이 이용될 수도 있다.The verification unit 110 may generate a verification condition ( 113a in FIG. 4 ) for verifying the safety of the contract. The verification condition 113a may be generated corresponding to each of at least one verification target of the contract (eg, a basic path (111a in FIG. 4 ), etc.). According to an embodiment, the verification conditions 113a may be generated for all verification objects 111a of the contract. The above-described invariant candidate group may be used to generate the verification condition 113a.

보다 구체적으로, 검증부(110)는 불변식 처리부(170)에 의해 생성된 불변식 후보의 귀납성과 쿼리의 안전성에 관한 검증 조건(113a)을 소정의 수식 형태로 구성하고, 구성된 수식의 타당성(validity) 여부를 검사하도록 마련된 것일 수 있다. 여기서, 소정의 수식은 예를 들어, 1차 논리식(FOL: First-Order Logic 또는 first-order formula)을 포함할 수 있으나, 이에 한정되는 것은 아니다.More specifically, the verification unit 110 configures the verification condition 113a related to the inductance of the invariant candidate generated by the invariant expression processing unit 170 and the safety of the query in a predetermined formula form, and the validity ( It may be designed to test whether or not Here, the predetermined formula may include, for example, a first-order logic (FOL) or first-order formula, but is not limited thereto.

생성된 검증 조건(113a)은 검증부(110)에 의해 직접 타당성 여부가 판단될 수도 있고, 또는 타당성 판단부(200)에 의해 판단될 수도 있다. 후자의 경우, 검증 조건(113a)은 타당성 판단부(200)로 전달되고, 타당성 판단부(200)는 수신한 검증 조건(113a)의 타당성 여부를 판단한 후, 판단 결과를 검증부(110)로 전달할 수 있다.The validity of the generated verification condition 113a may be directly determined by the verification unit 110 or may be determined by the validity determination unit 200 . In the latter case, the verification condition 113a is transmitted to the validity determination unit 200 , and the validity determination unit 200 determines whether the received verification condition 113a is valid or not, and then sends the determination result to the verification unit 110 . can transmit

만약, 검증부(110) 또는 타당성 판단부(200)가 검증 조건(113a)이 타당하다고 판단한 경우라면(예를 들어, 모든 쿼리가 안전하다고 증명된 경우 등), 검증부(110)는 컨트랙트가 안전하다고 판단할 수 있다. 이 경우, 검증부(110)는 타당성이 부재한 것으로 판단된 검증 조건 또는 이에 대응하는 검증 대상(이하 반환 대상)이 존재하지 않으면, 컨트랙트가 안전하다고 판단할 수 있다. 판단 결과는 출력부(102)로 전달될 수 있으며, 이에 응하여 출력부(102)는 컨트랙트가 안전하다고 미리 정의된 방식으로 외부에 보고할 수 있다. If the verification unit 110 or the validity determination unit 200 determines that the verification condition 113a is valid (eg, when all queries are proven to be safe, etc.), the verification unit 110 determines that the contract can be considered safe. In this case, the verification unit 110 may determine that the contract is secure if there is no verification condition determined to have no validity or a verification target corresponding thereto (hereinafter referred to as a return target). The determination result may be transmitted to the output unit 102, and in response, the output unit 102 may report to the outside in a predefined way that the contract is secure.

반대로 검증부(110) 또는 타당성 판단부(200)가 검증 조건(113a)이 타당하지 않다고 판단하면(예를 들어, 안전성 검증에 실패한 쿼리가 존재할 경우 등과 같이 반환 대상이 존재하는 경우), 검증부(110)는 반환 대상(즉, 타당성이 부재한 것으로 판단된 검증 조건 또는 이에 대응하는 검증 대상)을 불변식 처리부(170)로 전달할 수 있다.Conversely, if the verification unit 110 or the validity determination unit 200 determines that the verification condition 113a is not valid (eg, when there is a return target such as when there is a query that fails the safety verification), the verification unit 110 may transmit a return target (ie, a verification condition determined to have no validity or a verification target corresponding thereto) to the invariant processing unit 170 .

불변식 처리부(170)는 불변식 후보군을 생성할 수 있으며, 보다 구체적으로는 귀납적이면서도 가능한 한 많은 쿼리들의 안전성을 증명할 수 있는 불변식 후보군을 생성하고 생성된 불변식 후보군을 검증부(110)로 전달할 수 있다. 불변식 처리부(170)는 트랜잭션 불변식을 생성할 수도 있고, 루프 불변식을 생성할 수도 있으며, 또는 양자 모두를 생성할 수도 있다.The invariant processing unit 170 may generate an invariant candidate group, and more specifically, it generates an invariant candidate group that can prove the safety of as many queries as possible while inductively, and uses the generated invariant candidate group as the verification unit 110 . can transmit The invariant processing unit 170 may generate a transaction invariant, a loop invariant, or both.

일 실시예에 의하면, 불변식 처리부(170)는, 도 1에 도시된 바와 같이, 초기화부(171) 및 정제부(173)를 포함 가능하다.According to an embodiment, the invariant processing unit 170 may include an initialization unit 171 and a refiner unit 173 as shown in FIG. 1 .

초기화부(171)는 최초의 불변식 후보군을 생성하고, 생성한 최초의 불변식 후보군을 검증부(110)로 전달함으로써, 검증부(110)가 최초의 불변식 후보군을 이용하여 컨트랙트를 검증하도록 할 수 있다. 초기화부(171)는 사용자의 조작이나 미리 정의된 설정에 따라 동작 가능하다. 예를 들어, 초기화부(171)는 새로운 컨트랙트가 입력될 때마다 최초의 불변식 후보군을 생성하도록 마련될 수 있다. 필요에 따라, 초기화부(171)는 불변식 후보군 내의 적어도 하나의 불변식 후보 중에서 크기가 가장 작은 불변식 후보를 선택한 후, 선택된 불변식 후보를 불변식 후보군에서 제거할 수도 있다.The initialization unit 171 generates the first invariant candidate group and transmits the generated first invariant candidate group to the verification unit 110 so that the verification unit 110 validates the contract using the first invariant candidate group. can do. The initialization unit 171 is operable according to a user's manipulation or a predefined setting. For example, the initialization unit 171 may be provided to generate the first invariant candidate group whenever a new contract is input. If necessary, the initializer 171 may select an invariant candidate having the smallest size from among at least one invariant candidate in the invariant candidate group, and then remove the selected invariant candidate from the invariant candidate group.

정제부(173)는 검증부(110)로부터 반환 대상을 수신하면, 반환 대상을 기반으로 이전에 검증부(110)에 전달된 불변식 후보군(예를 들어, 최초의 불변식 후보군 또는 이후에 새로 정제 및 생성되었던 불변식 후보군 등)을 정제하여, 새로운 불변식 후보군을 생성할 수 있다. 실시예에 따라서, 불변식 처리부(170)는 검증 조건(113a)이 모두 타당하여 안전성이 증명되거나 및/또는 미리 정의된 분석 시간을 경과한 경우에는 더 이상 새로운 불변식 후보군을 생성하지 않을 수 있다.When the refining unit 173 receives a return target from the verification unit 110 , based on the return target, the invariant candidate group previously delivered to the verification unit 110 (eg, the first invariant candidate group or a new invariant type candidate group thereafter) A new invariant candidate group can be generated by refining and refining the generated invariant expression candidate group. According to an embodiment, the invariant processing unit 170 may not generate a new invariant candidate group any more when the safety is proven because all of the verification conditions 113a are valid and/or a predefined analysis time has elapsed. .

검증부(110) 및 불변식 처리부(170)의 동작에 대한 보다 세부적인 내용은 후술하도록 한다.More details on the operations of the verification unit 110 and the invariant processing unit 170 will be described later.

타당성 판단부(200)는 검증부(110)가 생성한 검증 조건(113a)을 수신하고 수신한 검증 조건(113a)에 대한 타당성/비타당성(invalidity) 여부를 판단한 후, 판단 결과를 검증부(110)로 송신할 수 있다. 일 실시예에 의하면, 타당성 판단부(200)는 소정의 해석 프로그램 또는 이를 수행하기 위한 장치를 이용하여 구현될 수 있으며, 여기서 소정의 해석 프로그램은, 예를 들어, SMT 솔버(Satisfiability Modulo Theories Solver) 등을 포함할 수 있다. 설계자의 선택에 따라서, 타당성 판단부(200)는 도 1에 도시된 바와 같이 스마트 컨트랙트 검증 장치(100) 내에 마련될 수도 있고, 및/또는 스마트 컨트랙트 검증 장치(200)와 물리적으로 분리되고 유무선 통신 네트워크를 통해 상호 통신 가능하게 연결된 하나 또는 둘 이상의 다른 컴퓨팅 장치에 마련될 수도 있다. 여기서, 다른 컴퓨팅 장치는, 예를 들어, 데스크톱 컴퓨터, 랩톱 컴퓨터, 서버용 컴퓨터 및/또는 기타 다양한 적어도 하나의 전자 장치 등을 포함할 수 있다.The validity determination unit 200 receives the verification condition 113a generated by the verification unit 110 and determines whether the received verification condition 113a is valid/invalid, and then returns the determination result to the verification unit ( 110) can be sent. According to an embodiment, the feasibility determination unit 200 may be implemented using a predetermined analysis program or an apparatus for performing the same, wherein the predetermined analysis program is, for example, an SMT solver (Satisfiability Modulo Theories Solver). and the like. According to the designer's choice, the feasibility determination unit 200 may be provided in the smart contract verification device 100 as shown in FIG. 1, and/or physically separated from the smart contract verification device 200 and communicated via wired/wireless communication. It may be provided on one or more other computing devices communicatively connected to each other through a network. Here, the other computing device may include, for example, a desktop computer, a laptop computer, a server computer, and/or other various at least one electronic device.

실시예에 따라서, 상술한 검증부(110), 불변식 처리부(190) 및 타당성 판단부(200)는 하나의 처리 장치(예를 들어, 중앙 처리 장치 등)를 이용하여 구현될 수도 있고, 또는 둘 이상의 물리적으로 분리된 처리 장치를 이용하여 구현될 수도 있다. 이들이 둘 이상의 물리적으로 분리된 처리 장치를 이용하여 구현된 경우, 검증부(110), 불변식 처리부(190) 및 타당성 판단부(200) 모두가 각각 물리적으로 분리된 처리 장치를 이용하여 구현될 수도 있고, 또는 이들 중 일부만이 물리적으로 분리된 다른 처리 장치를 이용하여 구현될 수도 있다.According to an embodiment, the above-described verification unit 110, invariant processing unit 190, and validity determining unit 200 may be implemented using one processing unit (eg, central processing unit, etc.), or It may be implemented using two or more physically separate processing units. When these are implemented using two or more physically separate processing devices, the verification unit 110 , the invariant processing unit 190 , and the validity determining unit 200 may all be implemented using physically separate processing devices, respectively. Alternatively, only some of them may be implemented using other physically separate processing devices.

입력부(101)는 외부로부터 스마트 컨트랙트 검증 장치(100)의 동작에 필요한 정보를 수신하고 이를 직간접적으로 검증부(110)로 전달할 수 있다. 예를 들어, 입력부(101)는 스마트 컨트랙트를 입력 받고 이를 검증부(110)에 전달함으로써 검증부(110)가 스마트 컨트랙트에 대한 검증 동작을 수행하도록 할 수도 있다. 이 경우, 스마트 컨트랙트는 솔리디티 언어로 작성된 것일 수 있다. 입력부(101)는, 범용 직렬 버스(USB, Universal serial bus) 단자 등과 같은 데이터 입출력 단자, 키보드 장치, 마우스 장치, 트랙볼, 트랙패드, 화상 촬영 장치 및/또는 각종 센서 등 사용자의 조작에 따라 또는 자동으로 데이터를 입력 받을 수 있는 적어도 하나의 장치를 포함할 수 있다.The input unit 101 may receive information necessary for the operation of the smart contract verification apparatus 100 from the outside and transmit it directly or indirectly to the verification unit 110 . For example, the input unit 101 may receive a smart contract and transmit it to the verification unit 110 so that the verification unit 110 performs a verification operation on the smart contract. In this case, the smart contract may be written in the Solidity language. The input unit 101 may include a data input/output terminal such as a universal serial bus (USB) terminal, a keyboard device, a mouse device, a trackball, a trackpad, an image pickup device, and/or various sensors according to a user's operation or automatically It may include at least one device capable of receiving data.

출력부(102)는 검증부(110)의 최종적인 판단 결과를 외부로 출력할 수 있도록 마련된다. 예를 들어, 출력부(102)는 컨트랙트의 적어도 하나의 검증 대상(즉, 기본 경로) 각각에 대한 안전성 또는 불변식의 귀납성에 대한 검증 결과를 출력할 수 있다. 설계자의 선택에 따라서, 출력부(102)는 검증 결과를 미리 정의된 전자 문서의 형태로 출력할 수도 있다. 출력부(102)는 실시예에 따라서, 데이터 입출력 단자, 모니터 장치, 프린터 장치, 사운드 출력 장치(스피커 등을 포함할 수 있음) 및/또는 이외 정보를 출력할 수 있는 적어도 하나의 장치를 포함할 수 있다.The output unit 102 is provided to output the final determination result of the verification unit 110 to the outside. For example, the output unit 102 may output a verification result for the safety or invariability of the invariant expression for each of at least one verification target (ie, the default path) of the contract. According to the designer's selection, the output unit 102 may output the verification result in the form of a predefined electronic document. The output unit 102 may include a data input/output terminal, a monitor device, a printer device, a sound output device (which may include a speaker, etc.) and/or at least one device capable of outputting other information according to an embodiment. can

도면에서는 생략되어 있으나, 스마트 컨트랙트 검증 장치(100)는 스마트 컨트랙트 검증 장치(100)의 동작에 필요하거나 동작 결과 획득된 적어도 하나의 데이터를 일시적 또는 비일시적으로 저장하기 위한 저장 매체를 더 포함할 수 있다. 예를 들어, 저장 매체는 컨트랙트, 적어도 하나의 불변식 후보, 검증부(110)가 생성한 기본 경로(111a)나 검증 조건(113a), 검증부(110)나 타당성 판단부(180)의 판단 결과, 불변식 처리부(170)가 생성한 불변식 후보군 및/또는 스마트 컨트랙트 검증 장치(100)의 동작/기능에 관한 애플리케이션(프로그램 또는 앱 등으로 지칭 가능함) 등을 저장할 수 있다. 여기서, 스마트 컨트랙트 검증 장치(100)의 동작/기능에 관한 애플리케이션은 설계자 등에 의해 직접 저장 매체에 입력된 것일 수도 있고, 입력부(101) 또는 통신부(미도시) 등을 통해 전달 또는 갱신된 것일 수도 있다. 통신부를 이용하는 경우, 스마트 컨트랙트 검증 장치(100)의 동작/기능에 관한 애플리케이션은 전자소프트웨어 유통망을 통해 전달 또는 갱신된 것일 수 있다. 이와 같은 저장 매체는 롬(ROM) 및/또는 램(RAM) 등과 같은 주기억장치를 포함할 수도 있고, 및/또는 플래시 메모리 장치, 솔리드 스테이트 드라이브(SSD, Solid State Drive) 및/또는 하드 디스크 드라이브(HDD, Hard Disc Drive) 등과 같은 보조기억장치를 포함할 수도 있다.Although omitted from the drawing, the smart contract verification apparatus 100 may further include a storage medium for temporarily or non-temporarily storing at least one data required for the operation of the smart contract verification apparatus 100 or obtained as a result of the operation. have. For example, the storage medium includes a contract, at least one invariant candidate, a basic path 111a or a verification condition 113a generated by the verification unit 110 , and the determination of the verification unit 110 or the validity determination unit 180 . As a result, the invariant candidate group generated by the invariant processing unit 170 and/or the application (which may be referred to as a program or an app, etc.) related to the operation/function of the smart contract verification apparatus 100 may be stored. Here, the application related to the operation/function of the smart contract verification apparatus 100 may be directly input to the storage medium by the designer, etc., or may be transmitted or updated through the input unit 101 or the communication unit (not shown). . In the case of using the communication unit, the application related to the operation/function of the smart contract verification apparatus 100 may be delivered or updated through an electronic software distribution network. Such a storage medium may include a main memory device such as ROM and/or RAM, and/or a flash memory device, a solid state drive (SSD) and/or a hard disk drive ( It may include an auxiliary storage device such as HDD or Hard Disc Drive).

이하, 검증부(110) 및 불변식 처리부(170)에서 이용 또는 처리되는 컨트랙트 및 불변식에 대해 먼저 설명하도록 한다.Hereinafter, contracts and invariants used or processed by the verification unit 110 and the invariant processing unit 170 will be described first.

도 2는 컨트랙트의 일례를 설명하기 위한 도면이다. 도 2는 컨트랙트의 일례를 솔리디티(Solidity) 언어를 기반으로 표현한 것이다. 도 2에서 c는 컨트랙트를, C는 컨트랙트 집합을 G*는 전역 상태 변수(global state variable) 선언의 집합을, F*는 적어도 하나의 함수 정의(f)의 집합을 의미한다. x는 함수 명칭을, S는 명령문을 의미한다. a는 기본 명령문이며, A는 적어도 하나의 기본 명령문(a)을 포함하는 기본 명령문 집합을 의미하고, E는 산술 표현식(예를 들어, a+b)을 의미하고, B는 부울 표현식(예를 들어, a≥b)을 의미한다.2 is a diagram for explaining an example of a contract. 2 is a representation of an example of a contract based on the Solidity language. In FIG. 2, c denotes a contract, C denotes a contract set, G * denotes a set of global state variable declarations, and F * denotes a set of at least one function definition (f). x stands for function name and S stands for statement. a is a base statement, A means a set of base statements containing at least one base statement (a), E means an arithmetic expression (e.g. a+b), and B means a boolean expression (e.g. For example, a ≥ b).

도 2에 도시된 바에 의하면, 컨트랙트(c)는 적어도 하나의 전역 상태 변수 선언(G*)과 적어도 하나의 함수 정의의 집합(F*)을 포함할 수 있다. 집합(F*) 내의 각각의 함수 정의(f)는 함수 명칭(x)과 명령문(S)으로 정의될 수 있다. 여기서, 명령문(S)은 기본 명령문의 집합(A), 조건문(if B S1 S2), while-루프 및 시퀀스(S1; S2) 중 적어도 하나를 포함할 수 있다. 각 while-루프는 루프 입구 지점(loop header)을 뜻하는 루프 레이블(l)을 포함할 수 있다. 기본 명령문 집합(A)의 각각의 기본 명령문(a)은, 예를 들어, 변수 할당문(x := E), 배열 원소 할당문(x [y] := E ), 가정문(assume (B)) 및/또는 단언문(assert (B)) 등을 포함할 수 있다. 여기서, 변수 할당문은 코드 내에서 사용되는 변수에 대한 값을 할당할 수 있도록 마련된다. 배열 원소 할당문은 통상적인 프로그래밍 언어에서 사용되는 배열 변수의 원소들에 대한 값 할당을 모델링하며, 예를 들어 솔리디티 언어에서의 매핑 타입 변수의 원소들에 대한 값 할당을 모델링하도록 마련된다. 가정문은 조건의 성립 여부를 판단할 수 있게 하며, 조건의 성립 여부에 따라 순차적인 명령문의 실행 여부가 결정될 수 있다. 즉, 조건이 성립되면 순차적인 명령문이 계속해서 실행되고, 조건이 성립되지 않으면 현재의 트랜잭션(transaction, 작업 또는 처리 등으로 표현 가능하다)의 실행이 취소되고, 프로그램은 가정문의 실행 전 상태로 회귀된다. 단언문은 검증하려는 대상(이하 검증 대상, 예를 들어, 정수 오버플로우 취약점에 대한 안전성, 정수 언더플로우 취약점에 대한 안전성, 제수(除數)가 0인 경우에서의 취약점 등에 대한 안전성)을 표현할 수 있다. 단언문은 검증 대상을 표현하기 위한 적어도 하나의 쿼리(query, 단언문 내에 표현된 수식)를 포함할 수도 있다. 쿼리는 자동으로 프로그램 내에 삽입될 수도 있고, 또는 프로그래머의 조작에 따라 수동으로 삽입될 수도 있다. 예를 들어, 개발자는 assert 문을 이용하여 쿼리를 프로그램 내에 삽입할 수 있으며, 보다 구체적으로 예를 들어, 덧셈 연산에 대한 정수 오버플로우 취약점을 검증하기 위해, 스마트 컨트랙트 내에 존재하는 모든 덧셈 연산에 대해 하기의 수학식 1을 삽입할 수도 있다. As shown in FIG. 2 , the contract (c) may include at least one global state variable declaration (G * ) and at least one set of function definitions (F * ). Each function definition (f) in the set (F * ) can be defined by a function name (x) and a statement (S). Here, the statement S may include at least one of a set of basic statements (A), a conditional statement (if B S1 S2), a while-loop, and a sequence (S1; S2). Each while-loop may include a loop label (l) indicating a loop header. Each basic statement (a) of the basic statement set (A) is, for example, a variable assignment statement ( x := E ), an array element assignment statement ( x [y] := E ), an assumption statement ( assume (B) )) and/or assert (B)). Here, the variable assignment statement is prepared to assign a value to a variable used in the code. The array element assignment statement models value assignment to elements of an array variable used in a typical programming language, and is provided to model assignment of values to elements of a mapping type variable in, for example, a solidity language. Assume statements enable it to be determined whether a condition is satisfied, and whether or not to execute sequential statements can be determined depending on whether the condition is established. That is, if the condition is met, sequential statements are continuously executed. If the condition is not met, the execution of the current transaction (which can be expressed as a transaction, work or processing, etc.) is canceled and the program returns to the state before the execution of the assumption statement. do. The assertion can express the object to be verified (hereinafter referred to as the verification target, for example, safety against integer overflow vulnerability, safety against integer underflow vulnerability, safety against vulnerability when the divisor is 0, etc.) have. The assertion may include at least one query (query, an expression expressed in the assertion) for expressing the verification target. The query may be automatically inserted into the program, or may be manually inserted according to a programmer's operation. For example, a developer can insert a query into a program by using the assert statement, and more specifically, for all addition operations that exist in the smart contract, for example, to verify the integer overflow vulnerability for the addition operation. Equation 1 below may be inserted.

Figure 112019102129571-pat00001
Figure 112019102129571-pat00001

검증부(110)는 이와 같은 컨트랙트의 특성과 불변식 처리부(170)에서 전달되는 적어도 하나의 불변식을 이용하여 컨트랙트의 안전성을 검증하게 된다.The verification unit 110 verifies the safety of the contract using such characteristics of the contract and at least one invariant expression transmitted from the invariant processing unit 170 .

도 3은 불변식을 설명하기 위한 프로그램 코드의 예시로, 컨트랙트의 일례를 표현한 것이다.3 is an example of a program code for explaining an invariant expression, and represents an example of a contract.

도 3에 도시된 컨트랙트의 경우, 컨스트럭터 함수가 실행되면(제5 줄 참조), 전체 공급량은 10,000으로 설정되고, 송금인(sender)의 계좌 잔액(balance) 역시 10,000으로 초기화되도록 설계되어 있다. 이 경우, 초기화되지 않은 계좌의 잔액은 0이 되고, 모든 계좌의 총합은 10,000의 값과 동일하게 된다. In the case of the contract shown in Fig. 3, when the constructor function is executed (refer to line 5), the total supply is set to 10,000, and the sender's account balance is also designed to be initialized to 10,000. In this case, the balance of the uninitialized account becomes 0, and the total of all accounts becomes equal to the value of 10,000.

컨트랙트의 제10 내지 14 줄을 참조하면, 송금 트랜잭션(function transfer)은 송금인의 계좌의 잔액이 송금할 금액(value)보다 같거나 큰 경우(제11줄)에만, 송금인의 계좌 잔액에서 송금할 금액을 차감하고(제12 줄), 수금인(to)의 계좌 잔액에 송금할 금액을 부가하도록 설계되어 있다(제13 줄). 또한, 제16 내지 20 줄을 참조하면, 수금 트랜잭션(trasnferFrom)은 송금자의 계좌 잔액(balance[from])이 같거나 송금할 금액(value)보다 큰 경우(제17 줄)에만, 송금인의 계좌 잔액에서 송금할 금액을 차감하고(제18 줄), 수금인(to)의 계좌 잔액에 송금할 금액을 부가하도록 기재되어 있다(제19 줄).Referring to lines 10 to 14 of the contract, a function transfer is the amount to be transferred from the sender’s account balance only when the balance of the sender’s account is equal to or greater than the value to be transferred (line 11). It is designed to deduct (line 12) and add the amount to be remitted to the account balance of the recipient (to) (line 13). In addition, referring to lines 16 to 20, the collection transaction (trasnferFrom) is performed only when the sender's account balance (balance[from]) is the same or greater than the amount to be remitted (value) (line 17), the sender's account balance It is written that the amount to be remitted is subtracted from (line 18) and the amount to be remitted is added to the account balance of the recipient (to) (line 19).

이와 같이 설계된 컨트랙트의 코드에서 제12 줄 및 제19 줄의 연산은 보호문이 존재하므로 안전함을 알 수 있다. 그러나, 제13 줄 및 제18 줄의 연산에 대해서는, 각각 함수 내에 직접적인 보호문이 존재하지 않아, 이들의 안전성 여부를 직관적으로 파악하기는 어렵다. 그러나, 명시적 보호문이 부재함에도 불구하고, 제13 줄 및 제18 줄의 연산은 안전하다. 왜냐하면, 트랜잭션의 시작과 종료 시에 하기의 수학식 2와, 수학식 2의 계산 과정에서 정수 오버플로우가 발생하지 않는다는 특성이 일정하게 유지되기 때문이다. 즉, 트랜잭션 불변식이 성립하게 된다.In the code of the contract designed in this way, it can be seen that the operations of lines 12 and 19 are safe because there is a guard statement. However, for the operations of lines 13 and 18, there is no direct protection statement in each function, so it is difficult to intuitively determine whether they are safe or not. However, despite the absence of an explicit guard, the operations in lines 13 and 18 are safe. This is because the characteristic that integer overflow does not occur during the calculation of Equation 2 and Equation 2 below is constantly maintained at the start and end of a transaction. That is, the transaction invariant expression is established.

Figure 112019102129571-pat00002
Figure 112019102129571-pat00002

구체적으로, 수학식 2 에 기재된 바와 같이 전체적인 계좌 총합은 트랜잭션 전후에 동일하게 10,000으로 유지된다. 또한, 송금인의 계좌의 잔액이 충분한 경우에만 송금이 허용되므로(제11 및 17 줄 참조), 정수 오버플로우가 발생하는 비정상적 상황은 발생하지 않게 된다. 다시 말해서, 각 계좌의 최대 값은 10,000이므로, 제11 및 17 줄의 조건문과 결합하였을 때 제12, 제13, 제18 및 제19 줄의 산술 연산은 256bit 연산(최댓값 2256-1)에서 모두 안전하다. 따라서, 상술한 컨트랙트는 안전하다고 판단될 수 있다.Specifically, as described in Equation 2, the total account total is maintained at 10,000 the same before and after the transaction. In addition, since remittance is allowed only when the balance of the sender's account is sufficient (refer to lines 11 and 17), an abnormal situation in which an integer overflow occurs does not occur. In other words, since the maximum value of each account is 10,000, when combined with the conditional statements in lines 11 and 17, the arithmetic operations in lines 12, 13, 18, and 19 are all 256- bit operations (maximum value 2 256 -1). safe. Therefore, the above-described contract can be determined to be safe.

이와 같은 트랜잭션 불변식이 성립함은 귀납적(inductive)으로 확인될 수 있다.It can be confirmed inductively that such a transaction invariant expression holds.

이하, 상술한 컨트랙트 및 불변식에 대한 내용을 기반으로 검증부(110) 및 불변식 처리부(170)의 동작에 대해 보다 구체적으로 설명하도록 한다.Hereinafter, the operations of the verification unit 110 and the invariant processing unit 170 will be described in more detail based on the contents of the above-described contract and invariant expression.

도 4는 스마트 컨트랙트 검증 장치의 일 실시예에 대한 제어 블록도이다.4 is a control block diagram of an embodiment of a smart contract verification apparatus.

도 4에 도시된 바에 의하면, 검증부(110)는 입력부(101) 또는 저장 매체로부터 적어도 하나의 컨트랙트를 수신하고, 동시에 또는 순차적으로 불변식 처리부(170)의 초기화부(171) 및 정제부(173) 중 적어도 하나로부터 불변식 후보군을 수신할 수 있다. 구체적으로 예를 들어, 검증부(110)는 (c, ψ, μ)의 3가지 요소를 입력값으로 수신하여 획득할 수 있다. 여기서, c는 컨트랙트, ψ는 불변식을 의미하고, μ(μ: label → FOL)는 각 루프 레이블마다의 루프 불변식 매핑을 의미한다. 검증부(110)는 수신한 적어도 하나의 컨트랙트 및 불변식 후보군을 기반으로 컨트랙트의 안전성을 검증할 수 있다. 일 실시예에 의하면, 검증부(110)는 불변식 처리부(170)로부터 전달받은 불변식 후보(ψ, μ)의 귀납성 및 컨트랙트(c)에 포함된 적어도 하나의 명령문(쿼리)의 안전성을 확인함으로써, 컨트랙트의 안전성을 검증할 수 있다.As shown in FIG. 4 , the verification unit 110 receives at least one contract from the input unit 101 or the storage medium, and simultaneously or sequentially the initialization unit 171 and the refiner unit ( 173) may receive an invariant candidate group from at least one. Specifically, for example, the verification unit 110 may receive and obtain three elements (c, ψ, μ) as input values. Here, c denotes a contract, ψ denotes an invariant expression, and μ(μ: label → FOL) denotes a loop invariant mapping for each loop label. The verification unit 110 may verify the safety of the contract based on the received at least one contract and the invariant candidate group. According to an embodiment, the verification unit 110 determines the inductiveness of the invariant candidates (ψ, μ) received from the invariant processing unit 170 and the safety of at least one statement (query) included in the contract (c). By confirming, the safety of the contract can be verified.

일 실시예에 의하면, 검증부(110)는 경로 집합 생성부(111), 조건 생성부(113) 및 결과 처리부(119)를 포함할 수 있다.According to an embodiment, the verification unit 110 may include a path set generation unit 111 , a condition generation unit 113 , and a result processing unit 119 .

경로 집합 생성부(111)는 프로그램을 분할하여 적어도 하나의 기본 경로(111a, basic path)(들)을 획득할 수 있다. 기본 경로(111a)는 적어도 하나의 명령문(들)의 실행 경로를 포함한다. 일 실시예에 의하면, 기본 경로(111a)는 함수 입구(function entry), 함수 출구(function exit) 및 함수 입구와 출구 사이의 적어도 하나의 명령문(들)의 시퀀스를 포함하는 경로를 포함할 수도 있고, 및/또는 루프 입구(loop entry) 및 루프 내에 존재하는 적어도 하나의 명령문들의 시퀀스를 포함하는 경로를 포함할 수 있다. 보다 구체적으로 예를 들어, 기본 경로(111a)는 하기의 수학식 3과 같이 정의될 수 있다.The path set generator 111 may acquire at least one basic path 111a (basic path)(s) by dividing the program. The default path 111a includes an execution path of at least one statement(s). According to one embodiment, the default path 111a may include a path comprising a function entry, a function exit, and a sequence of at least one statement(s) between the function entry and exit, and , and/or a path including a loop entry and a sequence of at least one statement present within the loop. More specifically, for example, the basic path 111a may be defined as in Equation 3 below.

Figure 112019102129571-pat00003
Figure 112019102129571-pat00003

여기서, l1은 기본 경로(111a)의 시작 지점(즉, 함수 입구 또는 루프 입구)을, l2는 기본 경로(111a)의 종료 지점(즉, 함수 출구 혹은 루프 입구)을, a1; … ;a2는 기본 명령문들의 시퀀스를 의미한다. φ1은 기본 경로(111a)의 시작 지점(l1)에서의 불변식이고, φ2는 기본 경로(111a)의 종료 지점(l2)에서의 불변식이다. 이 경우, 시작 지점(l1)이 함수의 입구라면, φ1은 트랜잭션 불변식이고(즉, φ1=ψ), 시작 지점(l1)이 루프의 입구라면 φ1은 시작 지점(l1)에서의 루프 불변식이 된다(즉, φ1=μ(l1)). 한편, 함수가 컨스트럭터라면, 임의의 상태를 가정해야 하므로 φ1=true로 주어질 수 있다. 마찬가지로 종료 지점(l2)이 함수 출구이면, φ2는 트랜잭션 불변식이고(즉, φ2=ψ), 루프 입구이면, φ2는 루프 불변식이다(즉, φ2=μ(l2)).Here, l 1 is the starting point (ie, function entrance or loop entrance) of the basic path 111a, l 2 is the ending point (ie, function exit or loop entrance) of the basic path 111a, a1; … ;a2 means a sequence of basic statements. φ 1 is the invariant at the starting point l 1 of the basic path 111a , and φ 2 is the invariant at the ending point l 2 of the basic path 111a. In this case, if the starting point l 1 is the entrance to the function, then φ 1 is transaction invariant (ie φ 1 =ψ), and if the starting point l 1 is the entrance to the loop, then φ 1 is the starting point l 1 ) becomes a loop invariant (ie, φ 1 =μ(l 1 )). On the other hand, if the function is a constructor, it must assume an arbitrary state, so it can be given as φ 1 = true. Similarly, if the exit point l 2 is the function exit, then φ 2 is transaction invariant (ie φ 2 =ψ), and if the loop entry, φ 2 is loop invariant (ie φ 2 =μ(l 2 ) ).

경로 집합 생성부(111)에서 생성된 기본 경로(111a)는 조건 생성부(113)로 전달될 수 있다. 조건 생성부(113)는 각 기본 경로(111a) 별로 검증 조건(113a)을 생성할 수 있다. 보다 구체적으로 예를 들어, 조건 생성부(113)는 각 기본 경로(111a)마다 불변식 후보의 귀납성 여부 및 쿼리의 안전성 여부에 대한 적어도 하나의 식들을 생성함으로써 검증 조건(113a)을 생성할 수 있다. 이 경우, 조건 생성부(113)는 초기화부(171)에서 전달된 초기 불변식 후보군 또는 정제부(173)에서 전달된 새로운 불변식 후보군을 이용하여 검증 조건(113a)을 생성할 수 있다.The basic path 111a generated by the path set generating unit 111 may be transmitted to the condition generating unit 113 . The condition generator 113 may generate a verification condition 113a for each basic path 111a. More specifically, for example, the condition generator 113 generates the verification condition 113a by generating at least one expression for whether the invariant candidate is inductive or not and whether the query is safe for each basic path 111a. can In this case, the condition generator 113 may generate the verification condition 113a using the initial invariant candidate group transmitted from the initializer 171 or the new invariant candidate group transmitted from the refiner 173 .

일 실시예에 의하면, 조건 생성부(113)는 하기의 수학식 4로 표현되는 명령문(함수)을 이용하여 검증 조건(113a)을 생성할 수도 있다.According to an embodiment, the condition generator 113 may generate the verification condition 113a by using a statement (function) expressed by Equation 4 below.

Figure 112019102129571-pat00004
Figure 112019102129571-pat00004

여기서, ∧는 논리 연산자 AND를 의미한다. 또한,

Figure 112019102129571-pat00005
Figure 112019102129571-pat00006
Figure 112019102129571-pat00007
는 하기의 수학식 5와 같이 정의될 수 있다.Here, ∧ means the logical operator AND. Also,
Figure 112019102129571-pat00005
Figure 112019102129571-pat00006
Figure 112019102129571-pat00007
may be defined as in Equation 5 below.

Figure 112019102129571-pat00008
Figure 112019102129571-pat00008

수학식 4에서,

Figure 112019102129571-pat00009
는 불변식 후보의 귀납성에 관한 조건을 표현한 식이고,
Figure 112019102129571-pat00010
는 기본 경로에 존재하는 쿼리들의 안전성에 관한 조건을 나타낸 식이다. 또한, 수학식 5에서 sp는 후조건 변환기(strongest post-condition predicate transformer)를 의미한다. 후조건 변환기(sp)는 각 기본 경로에서 존재하는 기본 명령문(쿼리)들의 영향을 나타내도록 정의된 것일 수 있으며, 예를 들어, 하기의 수학식 6과 같이 정의될 수 있다.In Equation 4,
Figure 112019102129571-pat00009
is an expression expressing the condition for the inducibility of the invariant candidate,
Figure 112019102129571-pat00010
is an expression representing the condition regarding the safety of queries existing in the default path. Also, in Equation 5, sp denotes a strong post-condition predicate transformer. The post-condition converter sp may be defined to indicate the effect of basic statements (queries) existing in each basic path, and may be defined, for example, as in Equation 6 below.

Figure 112019102129571-pat00011
Figure 112019102129571-pat00011

여기서, FOL은 1차 논리식을 의미한다. 다시 말해서, 수학식 4의 검증 조건 생성 함수(GenVC())는 각각의 후조건 변환기(sp)를 합성하여 획득된 함수(명령문)에 미리 정의된 값(

Figure 112019102129571-pat00012
및 true)을 입력하여 나온 결과를 기반으로 귀납성 여부 및 안전성을 판단할 수 있도록 설계된 것일 수 있다.Here, FOL means a first-order logical expression. In other words, the verification condition generating function (GenVC( )) of Equation 4 is a function (statement) obtained by synthesizing each post-condition converter (sp) with a predefined value (
Figure 112019102129571-pat00012
and true) may be designed to determine whether or not it is inductive and safety based on the result of inputting it.

도 5는 검증부의 동작의 일례를 설명하기 위한 제1 도로, 후조건 변환기의 일례를 나타낸 것이다.5 shows an example of a first road and post-condition converter for explaining an example of the operation of the verification unit.

일 실시예에 의하면, 후조건 변환기(sp)는, 도 5에 도시된 바와 같이, 정의될 수 있다. 도 5에서,

Figure 112019102129571-pat00013
Figure 112019102129571-pat00014
에 존재하는 변수 x가 새로운 변수 x'으로 교체된 것을 의미한다.According to an embodiment, the post-condition converter sp may be defined, as shown in FIG. 5 . 5,
Figure 112019102129571-pat00013
silver
Figure 112019102129571-pat00014
It means that the variable x existing in ' is replaced with the new variable x'.

후조건 변환기(sp)는 각각의 기본 명령문(a) 마다 정의될 수 있으며, 기본 명령문(a)의 종류에 따라 서로 상이하게 정의될 수 있다. 예를 들어, 기본 명령문(a)은 변수 할당문(x := E), 배열 원소 할당문(x [y] := E ), 가정문(assume (B)) 및 단언문(assert (B)) 중 적어도 하나일 수 있으며, 각각의 명령문(a)마다 도 5와 같이 상이한 후조건 변환기(sp)가 정의될 수 있다. 후조건 변환기(sp)는 기본 명령문(a), 전제조건(

Figure 112019102129571-pat00015
) 및 현재까지 누적된 쿼리 안전성에 대한 식(
Figure 112019102129571-pat00016
)이 주어졌을 때, a에 의한 영향을
Figure 112019102129571-pat00017
에 추가로 반영하도록 설계된 것일 수 있다. 만약 기본 명령문(a)이 단언문(assert())일 경우 쿼리 안전성에 대한 식을 현재까지 누적된 쿼리 안전성에 대한 식(
Figure 112019102129571-pat00018
)에 추가로 부가하여 누적하는 작업을 수행하도록 설계될 수 있다. The post-condition converter sp may be defined for each basic statement (a), and may be defined differently depending on the type of the basic statement (a). For example, the basic statement (a) consists of a variable assignment statement ( x := E ), an array element assignment statement ( x [y] := E ), an assert statement ( assume (B)), and an assert statement ( assert (B)). ) may be at least one, and a different post-condition converter sp may be defined for each statement (a) as shown in FIG. 5 . The postcondition converter (sp) consists of a basic statement (a), a precondition (
Figure 112019102129571-pat00015
) and the expression for query safety accumulated so far (
Figure 112019102129571-pat00016
), given the effect of a
Figure 112019102129571-pat00017
It may be designed to reflect additionally. If the basic statement (a) is an assertion (assert()), the expression for query safety (
Figure 112019102129571-pat00018
) can be designed to perform an accumulating operation in addition to

조건 생성부(113)는 이와 같은 방식으로 적어도 하나의 기본 경로(111a)에 대해 각각 검증 조건(113a)을 생성한다. 이 경우, 조건 생성부(113)는 경로 집합 생성부(111)가 생성한 기본 경로(111a) 중에서 일부의 기본 경로(111a)에 대해서만 검증 조건(113a)을 생성할 수도 있고, 또는 경로 집합 생성부(111)가 생성한 모든 기본 경로에 대해서 검증 조건(113a)을 생성할 수도 있다. 일 실시예에 의하면, 조건 생성부(113)가 생성한 검증 조건(113a)은 타당성 판단부(180)로 전달될 수 있다. 타당성 판단부(180)는 수신한 검증 조건(113a)의 타당성을 판단할 수 있다.The condition generator 113 generates a verification condition 113a for at least one basic path 111a in this way, respectively. In this case, the condition generation unit 113 may generate the verification condition 113a only for some basic paths 111a among the basic paths 111a generated by the path set generation unit 111 , or generate a path set. The verification condition 113a may be generated for all basic paths generated by the unit 111 . According to an embodiment, the verification condition 113a generated by the condition generating unit 113 may be transmitted to the validity determining unit 180 . The validity determining unit 180 may determine the validity of the received verification condition 113a.

결과 처리부(119)는 컨트랙트의 안전성의 검증 여부를 확인하고, 확인 결과에 따라 소정의 동작을 수행할 수 있다. 이 경우, 결과 처리부(119)는 타당성 판단부(180)로부터 검증 조건(113a)의 타당성에 대한 판단 결과를 수신하고, 수신한 판단 결과를 기반으로 출력부(102) 및/또는 정제부(173)로 필요한 데이터를 전달할 수 있다.The result processing unit 119 may check whether the safety of the contract is verified, and may perform a predetermined operation according to the verification result. In this case, the result processing unit 119 receives the determination result on the validity of the verification condition 113a from the validity determination unit 180, and the output unit 102 and/or the refiner 173 based on the received determination result. ) to pass the required data.

예를 들어, 결과 처리부(119)는 컨트랙트의 안전성 등이 검증이 되지 않은 경우(예를 들어, 불변식 후보가 귀납적이지 않거나 안전성 증명에 실패한 쿼리가 존재하는 경우) 타당하지 않은 검증 조건에 대응하는 검증 대상(즉, 반환 대상)을 불변식 처리부(170)의 정제부(173)로 전달할 수 있다. 반대로 컨트랙트의 안전성이 증명된 경우(예를 들어, 불변식 후보가 귀납적이고 안전성 증명에 실패한 쿼리가 부재한 경우), 결과 처리부(119)는 증명 결과를 출력부(102)로 전달할 수 있다. For example, when the safety of the contract is not verified (for example, when the invariant candidate is not inductive or there is a query that fails to prove safety), the result processing unit 119 responds to an invalid verification condition. The verification target (ie, return target) may be transmitted to the refiner 173 of the invariant processing unit 170 . Conversely, when the safety of the contract is proven (eg, when the invariant candidate is inductive and there is no query that fails the safety verification), the result processing unit 119 may transmit the verification result to the output unit 102 .

실시예에 따라서, 결과 처리부(119)는 현재 이용된 불변식 후보에 의해 각 기준 경로의 안전성(또는 컨트랙트의 안전성)이 검증되지 않은 경우에도, 현재의 불변식 후보들이 귀납적이라고 판단된 경우에는 이와 같은 정보를 불변식 처리부(170)에 전달함으로써 불변식 처리부(170)가 보다 구체적으로 불변식 후보들을 정제할 수 있도록 할 수도 있다.According to the embodiment, the result processing unit 119 determines that the current invariant candidates are inductive even if the safety of each reference path (or the safety of the contract) is not verified by the currently used invariant candidates. By passing the same information to the invariant processing unit 170 , the invariant processing unit 170 may more specifically refine the invariant candidates.

도 6은 검증부의 동작의 일례를 설명하기 위한 제2 도이다. 도 6에서 p는 기본 경로(111a)를 의미하고, GenVC(p).1은 귀납성에 관한 검증 조건을 의미하며, GenVC(p).2는 안전성에 대한 검증 조건을 의미한다. F∈GenVC(p).2은 GenVC(p).2의 각 절(clause)을 나타난 것으로 하나의 쿼리(F)에 대한 안전성 검증 조건을 의미한다. 도 6에서 ∃F∈GenVC(p).2 is invalid는 안전성 검증 조건이 타당하지 않은 모든 쿼리(F)를 의미한다.6 is a second diagram for explaining an example of the operation of the verification unit. In FIG. 6, p denotes a basic path 111a, GenVC(p).1 denotes a verification condition for induction, and GenVC(p).2 denotes a verification condition for safety. F∈GenVC(p).2 indicates each clause of GenVC(p).2, and means the safety verification condition for one query (F). In FIG. 6, ∃F∈GenVC(p).2 is invalid means all queries (F) for which the safety verification condition is not valid.

일 실시예에 의하면, 결과 처리부(119)는, 도 6에 도시된 바와 같은 (inductive, U)의 데이터 쌍을 정제부(117)로 반환할 수도 있다. (inductive, U)에서, inductive는 주어진 불변식 후보가 귀납적인지의 여부를 나타내는 부울 변수(propositional variable)이고, U는 반환 대상의 집합으로, 조건 생성부(113)가 생성한 적어도 하나의 검증 조건(113a) 중에서 타당성이 확인되지 않거나 타당성이 부재한 검증 조건들에 대응하는 검증 대상(예를 들어, 타당성이 확인되지 않은 기본 경로(111a))들의 집합이다. 여기서, 타당성의 판단은 타당성 판단부(180)에 의해 수행된 것일 수 있다.According to an embodiment, the result processing unit 119 may return a data pair of ( inductive, U ) as shown in FIG. 6 to the refiner 117 . In ( inductive, U ), inductive is a boolean variable indicating whether a given invariant candidate is inductive, U is a set of return objects, and at least one verification condition generated by the condition generator 113 . It is a set of verification targets (eg, the basic path 111a for which validity is not confirmed) corresponding to verification conditions in which validity is not confirmed or has no validity among (113a). Here, the validity determination may be performed by the validity determination unit 180 .

도 6의 두 번째 줄에 나타난 바와 같이, 만약 모든 기본 경로(p, 111a)에 대해서 귀납성 검증에 실패한 경우라면(∃p∈GenVC(p).1 is invalid), 세 번째 줄에 기재된 바와 같이, (inductive, U) 각각에는 false 값 및 기본 경로(p, 111a, 여기서, p∈P|GenVC(p).1 is invalid)가 할당 및 기록될 수 있다. 이에 따라 귀납성 검증에 실패한 기본 경로(111a)가 적어도 하나의 집합(U)으로 수집될 수 있게 된다. 반대로 네 번째 줄에 기재된 바와 같이 만약 모든 기본 경로(p, 111a)에 대해서 귀납성 검증에 성공한 경우에는, 변수 inductive에는 true 값이 할당되고, 집합 U에는 안전성 검증이 실패한 기본 경로(p, 111a, 여기서, p∈P|∃F∈GenVC(p).2 is invalid)가 포섭된다. 이에 따라, 귀납성 검증에는 성공하였으나 안전성 검증에는 실패한 기본 경로(111a)가 적어도 하나의 집합(U)으로 수집될 수 있게 된다.As shown in the second line of FIG. 6, if the inductive verification fails for all basic paths (p, 111a) (∃p∈GenVC(p).1 is invalid), as described in the third line , ( inductive, U ) may be assigned and written with a false value and a default path (p, 111a, where p∈P|GenVC(p).1 is invalid), respectively. Accordingly, the basic paths 111a that have failed the inductive verification can be collected as at least one set U. As contrast, according to the fourth line, if all default route if a successful induction validation with respect to (p, 111a), variable inductive has become a true value assignment, set U in the base path, the safety verification fails (p, 111a, Here, p∈P|∃F∈GenVC(p).2 is invalid) is included. Accordingly, the basic paths 111a that have succeeded in the inductive verification but failed in the safety verification can be collected as at least one set U.

도 7은 검증부의 다른 실시예에 대한 블록도이다.7 is a block diagram of another embodiment of the verification unit.

도 7에 도시된 바에 의하면, 검증부(110)는 경로 집합 생성부(111), 조건 생성부(113) 및 결과 처리부(119) 이외에도, 조건 간략화부(115) 및 선행 타당성 판단부(116) 중 적어도 하나를 더 포함할 수도 있다. 경로 집합 생성부(111), 조건 생성부(113) 및 결과 처리부(119)에 대해선 기 설명하였으므로, 이하 자세한 내용은 생략한다.As shown in FIG. 7 , the verification unit 110 includes a condition simplification unit 115 and a preceding validity determination unit 116 in addition to the path set generation unit 111 , the condition generation unit 113 , and the result processing unit 119 . It may further include at least one of Since the path set generating unit 111 , the condition generating unit 113 , and the result processing unit 119 have been described above, detailed descriptions thereof will be omitted.

조건 간략화부(115)는 조건 생성부(113)가 생성한 검증 조건(113a)을 상대적으로 간략하게 수정/변형할 수 있다. 이 경우, 조건 간략화부(115)는 미리 정의된 간략화 규칙(simplification rule)을 기반으로 검증 조건(113a)을 간략할 수 있다. 여기서, 미리 정의된 간략화 규칙은 종래 수학적 또는 논리적으로 정의된 각종 공식, 법칙 및/또는 공리 등을 기반으로 정의된 것일 수 있다. 예를 들어, 조건 간략화부(113a)는 하기의 수학식 7을 수학식 8과 같이 간략화시킬 수 있다.The condition simplification unit 115 may relatively simply modify/transform the verification condition 113a generated by the condition generation unit 113 . In this case, the condition simplification unit 115 may simplify the verification condition 113a based on a predefined simplification rule. Here, the predefined simplification rule may be defined based on various formulas, laws, and/or axioms previously defined mathematically or logically. For example, the condition simplification unit 113a may simplify the following Equation 7 as Equation 8.

Figure 112019102129571-pat00019
Figure 112019102129571-pat00019

Figure 112019102129571-pat00020
Figure 112019102129571-pat00020

이와 같이 검증 조건(113a)의 간략화에 따라, 검증 조건(113a)의 분석이 보다 신속하고 원활하게 처리될 수 있게 된다. 또한, 이와 같은 검증 조건(113a)의 간략화는 검증 조건(113a) 내의 사소한 표현이나 간단한 수식(예를 들어, 수학식 13의

Figure 112019102129571-pat00021
)을 제거함으로써 선행 타당성 판단부(116)의 판단 결과에 오류가 발생하는 것을 방지할 수도 있게 된다.As described above, according to the simplification of the verification condition 113a, the analysis of the verification condition 113a can be processed more quickly and smoothly. In addition, such a simplification of the verification condition 113a is a trivial expression in the verification condition 113a or a simple expression (eg, Equation 13).
Figure 112019102129571-pat00021
), it is also possible to prevent an error from occurring in the determination result of the preceding validity determination unit 116 .

실시예에 따라서, 조건 간략화부(115)에 의해 간략화된 검증 조건은 타당성 판단부(180)로 전달되거나 및/또는 선행 타당성 판단부(116)로 전달될 수도 있다. 타당성 판단부(180)는 간략화된 검증 조건을 수신하고 간략화된 검증 조건에 대한 타당성/비타당성 여부를 판단할 수 있다. 스마트 컨트랙트 내에 복잡한 연산이 존재하는 경우, 타당성 판단부(180)의 검증 조건(113a) 타당성/비타당성 판단 시간이 상대적으로 증가하게 될 수 있다. 그러나, 상술한 바와 같이 조건 간략화부(115)에 의해 검증 조건(113a)이 간략화된 경우, 타당성 판단부(180)의 판단 시간은 상대적으로 단축될 수 있으며, 이에 따라 전체적인 스마트 컨트랙트에 대한 검증 시간 역시 단축될 수 있게 된다. 상술한 바와 같이 타당성 판단부(180)의 판단 결과는 검증부(110)의 결과 처리부(119)로 전달될 수 있다. According to an embodiment, the verification condition simplified by the condition simplification unit 115 may be transmitted to the validity determination unit 180 and/or may be transmitted to the prior validity determination unit 116 . The validity determining unit 180 may receive the simplified verification condition and determine whether the simplified verification condition is valid or not valid. When a complex operation exists in the smart contract, the validity/non-validity determination time of the validity determination unit 180 of the verification condition 113a may be relatively increased. However, when the verification condition 113a is simplified by the condition simplification unit 115 as described above, the determination time of the validity determination unit 180 may be relatively shortened, and accordingly, the verification time for the overall smart contract It can also be shortened. As described above, the determination result of the validity determination unit 180 may be transmitted to the result processing unit 119 of the verification unit 110 .

선행 타당성 판단부(116)는, 타당성 판단부(180)로 검증 조건(113a)이 전달되기 이전에 또는 타당성 판단부(180)가 검증 조건(113a)에 대한 타당성 존재 여부를 판단하기 이전에, 검증 조건(113a)의 타당성 여부를 판단할 수 있다. 실시예에 따라서, 선행 타당성 판단부(116)는 조건 생성부(113)에서 생성된 검증 조건(113a)의 타당성을 선행하여 판단할 수도 있고 및/또는 조건 간략화부(115)에 의해 간략화된 검증 조건의 타당성을 선행하여 판단할 수도 있다.Prior to the validity determination unit 116, before the verification condition 113a is transmitted to the validity determination unit 180 or before the validity determination unit 180 determines whether the validity of the verification condition 113a exists, It may be determined whether the verification condition 113a is valid. According to an embodiment, the prior validity determining unit 116 may determine the validity of the verification condition 113a generated by the condition generating unit 113 in advance and/or simplified verification by the condition simplification unit 115 . The validity of the condition may be judged in advance.

일 실시예에 의하면, 선행 타당성 판단부(116)는 미리 정의된 템플릿을 기반으로 검증 조건(113a) 및/또는 간략화된 검증 조건의 타당성을 판단할 수도 있다. 미리 정의된 템플릿은 스마트 컨트랙트의 분석 과정에서 흔히 생성/검출되는 검증 조건 또는 이와 같은 검증 조건의 패턴 등을 기반으로 정의된 것일 수 있으며, 예를 들어, 특정한 패턴의 검증 조건이 입력되면 타당한 것으로 판단한다는 내용 및/또는 특정한 패턴의 검증 조건이 입력되면 타당하지 않은 것으로 판단한다는 내용 등을 포함할 수 있다. 보다 구체적으로 예를 들어, 선행 타당성 판단부(116)는, 하기의 수학식 9와 같은 형태의 검증 조건이 확인되면, 타당성 판단부(180)의 판단 없이도 타당하다고 판단할 수 있다.According to an embodiment, the prior validity determining unit 116 may determine the validity of the verification condition 113a and/or the simplified verification condition based on a predefined template. The predefined template may be defined based on a verification condition commonly created/detected in the analysis process of a smart contract or a pattern of such verification condition. For example, if a verification condition of a specific pattern is input, it is determined to be valid. It may include the content that it is determined that it is not valid when the verification condition of a specific pattern is input and/or that the verification condition of a specific pattern is input. More specifically, for example, when the verification condition of the form shown in Equation 9 below is confirmed, the prior validity determination unit 116 may determine that it is valid without the determination of the validity determination unit 180 .

Figure 112019102129571-pat00022
Figure 112019102129571-pat00022

여기서 F는 임의의 식이고, n1 및 n2는 n1len2의 관계를 갖는 정수를 의미한다.Here, F is an arbitrary formula, and n 1 and n 2 are integers having a relationship of n 1 len 2 .

이에 따라 스마트 컨트랙트의 안전성의 판단이 보다 신속해질 수 있게 된다.Accordingly, the judgment of the safety of the smart contract can be made more quickly.

또한, 선행 타당성 판단부(116)는 검증 조건의 형태를 기반으로 검증 조건(113a) 및/또는 간략화된 검증 조건의 타당성을 판단할 수도 있다. 구체적으로 조건 생성부(113)에서 생성된 검증 조건(113a)은 다음의 수학식 10과 같은 형태를 가질 수 있다.Also, the prior validity determining unit 116 may determine the validity of the verification condition 113a and/or the simplified verification condition based on the type of verification condition. Specifically, the verification condition 113a generated by the condition generator 113 may have the form of Equation 10 below.

Figure 112019102129571-pat00023
Figure 112019102129571-pat00023

그러므로, 선행 타당성 판단부(116)는, 검증 조건(113a)이 하기의 수학식 11과 같은 형태인 경우, 타당성 판단부(180)에 검증 조건(113a)을 전달하지 않고도, 신속하게 검증 조건(113a)이 타당하지 않다고 판단할 수 있다.Therefore, when the verification condition 113a is in the form of Equation 11 below, the prior validity determination unit 116 quickly performs the verification condition (113a) without transmitting the verification condition 113a to the validity determination unit 180. 113a) may be judged to be inappropriate.

Figure 112019102129571-pat00024
Figure 112019102129571-pat00024

여기서, FV(x)는 x에 대한 자유 변수(free variable)의 집합을 의미한다. 즉, 선행 타당성 판단부(116)는 조건문에서 조건에 대한 자유 변수 집합과 결과에 대한 자유 변수 집합의 포함 관계를 기반으로 검증 조건(113a)을 판단할 수 있다. 이 경우, 수학식 10이 참이기 위해서는 전제 조건이 p가 더 구체적인 개념(하위 개념)이어야 한다. 보다 구체적으로 예를 들어, 하기의 수학식 12와 같은 검증 조건은 타당하지 않다고 신속하게 판단될 수 있다.Here, FV(x) means a set of free variables for x. That is, the prior validity determining unit 116 may determine the verification condition 113a based on the inclusion relationship between the set of free variables for the condition and the set of free variables for the result in the conditional sentence. In this case, in order for Equation 10 to be true, the prerequisite p must be a more specific concept (sub-concept). More specifically, for example, it may be quickly determined that the verification condition as in Equation 12 below is not valid.

Figure 112019102129571-pat00025
Figure 112019102129571-pat00025

각각의 연산이 부호 비트 없는 256bit(unsigned-256bit, uint256)에서 수행된다면, 수학식 12는 하기의 수학식 13과 같이 표현 가능하므로, 수학식 12가 타당하지 않음을 알 수 있다. 또한, 실제로 a에 2255를 대입하고, b에 0을 대입해보면, 수학식 12는 타당성이 부재함이 자명하게 드러난다.If each operation is performed in 256bit without a sign bit (unsigned-256bit, uint256), Equation 12 can be expressed as Equation 13 below, so it can be seen that Equation 12 is not valid. In addition, if 2 255 is actually substituted for a and 0 is substituted for b, Equation 12 is obviously not valid.

Figure 112019102129571-pat00026
Figure 112019102129571-pat00026

Figure 112019102129571-pat00027
Figure 112019102129571-pat00027

이와 같이 선행 타당성 판단부(116)는 검증 조건(113a)의 형태에 따라서, 타당성 판단부(180)의 도움 없이도 검증부(110)가 보다 신속하게 컨트랙트의 타당성 여부를 판단할 수 있게 한다.As such, the prior validity determination unit 116 enables the verification unit 110 to more quickly determine whether the contract is valid without the help of the validity determination unit 180 according to the form of the verification condition 113a.

일 실시예에 의하면, 선행 타당성 판단부(116)는 간략화된 검증 조건을 기반으로 타당성을 판단할 수도 있다. 상술한 바와 같이 선행 타당성 판단부(116)가 검증 조건(113a)이 타당하지 않다고 판단하였어도, 실제로는 타당한 경우가 존재할 수 있다. 예를 들어, 하기의 수학식 14로 표현되는 검증 조건(113a)의 경우, 상술한 바와 같이 자유 변수의 집합을 이용하여 타당성을 판단하면, 결과가 하기의 수학식 15와 같이 나타나므로, 선행 타당성 판단부(116)는 수학식 14가 타당하지 않다고 판단하게 된다.According to an embodiment, the prior validity determining unit 116 may determine the validity based on the simplified verification condition. As described above, even if the prior validity determining unit 116 determines that the verification condition 113a is not valid, there may be a valid case in reality. For example, in the case of the verification condition 113a expressed by Equation 14 below, when validity is determined using the set of free variables as described above, the result is expressed as Equation 15 below, so the preceding validity The determination unit 116 determines that Equation 14 is not valid.

Figure 112019102129571-pat00028
Figure 112019102129571-pat00028

Figure 112019102129571-pat00029
Figure 112019102129571-pat00029

이와 같은 오류는 사소한 표현이나 간단한 수학식을 포함하는 경우에 발생될 수 있다. 이는 상술한 바와 같이 선행하여 조건 간략화부(115)의 검증 조건(113a) 간략화 과정을 수행함으로써 해결 가능하다. 즉, 간략화 과정에서 상술한 사소한 표현이나 간단한 수식은 제거될 수 있다. 예를 들어, 수학식 14를 하기의 수학식 16과 같이 간략화하면, 수학식 17에 따라 선행 타당성 판단부(116)는 보다 정확하게 판단할 수 있게 된다.Such an error may occur when a trivial expression or a simple mathematical expression is included. This can be solved by performing the process of simplifying the verification condition 113a of the condition simplification unit 115 in advance as described above. That is, in the simplification process, the above-mentioned trivial expressions or simple formulas may be removed. For example, if Equation 14 is simplified as Equation 16 below, according to Equation 17, the preceding validity determining unit 116 can make a more accurate determination.

Figure 112019102129571-pat00030
Figure 112019102129571-pat00030

Figure 112019102129571-pat00031
Figure 112019102129571-pat00031

다만, 실제 스마트 컨트랙트 내에선 이와 같은 사소한 표현이나 간단한 수학식이 등장 가능성이 낮으므로, 반드시 조건 간략화(115) 과정이 선행되어야 하는 것은 아니다. 또한, 조건 간략화(115)가 수행되지 않더라도 취약점을 놓치는 경우는 발생하지 않는다. 상술한 바와 같이 타당한 검증 조건(일례로 수학식 15 등)을 타당하지 않은 것으로 판단하더라도, 비타당한 검증 조건을 타당한 것으로 판단한 것이 아니기 때문이다.However, since such trivial expressions or simple mathematical expressions are unlikely to appear in actual smart contracts, the condition simplification 115 process is not necessarily preceded. In addition, even if the condition simplification 115 is not performed, a case of missing a vulnerability does not occur. As described above, even if it is determined that the valid verification condition (eg, Equation 15) is not valid, it is not determined that the invalid verification condition is valid.

일 실시예에 의하면, 선행 타당성 판단부(116)에 의해 검증 조건(113a) 또는 간략화된 검증 조건의 타당성이 판단되지 않으면, 검증 조건(113a) 또는 간략화된 검증 조건은 타당성 판단부(180)로 전달되고, 반대로 선행 타당성 판단부(116)에 의해 검증 조건(113a) 또는 간략화된 검증 조건의 타당성이 판단되면, 검증 조건(113a) 또는 간략화된 검증 조건은 타당성 판단부(180)로 전달되지 않도록 설계될 수도 있다. 또한, 다른 실시예에 의하면, 검증의 정확성을 위해 선행 타당성 판단부(116)에 의해 검증 조건(113a) 또는 간략화된 검증 조건의 타당성이 판단된 경우에도 검증 조건(113a) 또는 간략화된 검증 조건은 타당성 판단부(180)로 전달되는 것도 가능하다. 뿐만 아니라, 또 다른 실시예에 의하면, 선행 타당성 판단부(116)가 검증 조건(113a) 또는 간략화된 검증 조건을 타당하다고 판단한 경우에 한하여, 또는 선행 타당성 판단부(116)가 검증 조건(113a) 또는 간략화된 검증 조건을 타당하지 않다고 판단한 경우에 한하여, 검증부(110)가 검증 조건(113a) 또는 간략화된 검증 조건을 타당성 판단부(180)로 전달하는 것도 가능하다.According to an embodiment, if the validity of the verification condition 113a or the simplified verification condition is not determined by the preceding validity determination unit 116 , the verification condition 113a or the simplified verification condition is transmitted to the validity determination unit 180 . Conversely, when the validity of the verification condition 113a or the simplified verification condition is determined by the preceding validity determination unit 116 , the verification condition 113a or the simplified verification condition is not transmitted to the validity determination unit 180 . may be designed. In addition, according to another embodiment, even when the validity of the verification condition 113a or the simplified verification condition is determined by the preceding validity determination unit 116 for verification accuracy, the verification condition 113a or the simplified verification condition is It is also possible to transmit the information to the validity determination unit 180 . In addition, according to another embodiment, only when the preceding validity determination unit 116 determines that the verification condition 113a or the simplified verification condition is valid, or the preceding validity determination unit 116 determines the verification condition 113a Alternatively, only when it is determined that the simplified verification condition is not valid, the verification unit 110 may transmit the verification condition 113a or the simplified verification condition to the validity determination unit 180 .

상술한 바와 같이, 결과 처리부(119)는 타당성 판단부(180)의 판단 결과 또는 선행 타당성 판단부(116)의 판단 결과를 기반으로 출력부(102) 및/또는 불변식 처리부(170)의 정제부(173)로 반환 대상을 전송할 수 있다. As described above, the result processing unit 119 refines the output unit 102 and/or the invariant expression processing unit 170 based on the determination result of the validity determination unit 180 or the determination result of the prior validity determination unit 116 . The return target may be transmitted to the unit 173 .

불변식 처리부(170)의 정제부(173)는 결과 처리부(119)로부터 전달된 반환 대상 기반으로 이전에 검증부(110)에 제공된 불변식 후보(예를 들어, 초기 불변식 후보)를 정제하여 더 구체적인 정보를 생성함으로써 적어도 하나의 새로운 불변식 후보군을 생성할 수 있다. The refiner 173 of the invariant processing unit 170 refines the invariant candidate (eg, the initial invariant candidate) previously provided to the verification unit 110 based on the return target transmitted from the result processing unit 119 . By generating more specific information, it is possible to generate at least one new invariant candidate group.

일 실시예에 의하면, 정제부(173)는 검증부(110)로부터 전달받은 반환 대상의 집합(U)의 정보를 이용하여(도 6 참조), 기존에 검증부(110)에 제공되었던 불변식(ψ, μ)을 정제함으로써 새로운 불변식 후보들을 생성할 수 있다. 이 경우, 정제부(173)는 반환 대상의 집합(U)을 이용하여 각각의 반환된 기본 경로의 기본 명령문(들)로부터 새로운 불변식을 생성하기 위해 이용될 적어도 하나의 변수와 적어도 하나의 정수 컴포넌트를 추출할 수도 있다. According to an embodiment, the refiner 173 uses the information of the set U of the return target received from the verification unit 110 (see FIG. 6 ), and the invariant expression previously provided to the verification unit 110 . We can generate new invariant candidates by refining (ψ, μ). In this case, the refiner 173 uses at least one variable and at least one integer to be used to generate a new invariant expression from the basic statement(s) of each returned basic path using the set U of return objects. You can also extract components.

정제부(173)는 반환 대상의 집합(U)에 존재하는 적어도 하나의 기본 정보들 각각의 시작 지점((l1)과 종료 지점(l2)에 존재하는 불변식(들)만을 정제하도록 마련된 것일 수도 있다. 구체적으로 예를 들어, 컨트랙트 내에 두 개의 루프 레이블(LL1 및 LL2)이 존재하되, 정제부(173)가 하기의 수학식 18과 같은 반환 대상의 집합을 수신하였다고 가정할 수 있다.The refiner 173 is provided to refine only the invariant expression(s) present at the start point ( ( l 1 ) and the end point ( l 2 ) of each of the at least one basic information present in the set U of the return object. Specifically, for example, it may be assumed that two loop labels LL1 and LL2 exist in the contract, but the refiner 173 has received a set of return targets as shown in Equation 18 below.

Figure 112019102129571-pat00032
Figure 112019102129571-pat00032

여기서, entryf는 함수 f의 입구를 의미한다. 이 경우, 정제부(173)는 반환 대상의 집합(U)의 시작 지점(l1)에 존재하는 두 개의 불변식, 즉 트랜잭션 불변식 n ≤ 100와, 어느 하나의 루프 레이블(LL1)에 대응하는 루프 불변식 x=y를 정제하나, 정제부(173)는 시작 지점에서 정의되지 않은 다른 루프 레이블(LL2)에 대응하는 불변식은 정제하지 않도록 설계된다.Here, entry f means the entrance to the function f. In this case, the refiner 173 may determine two invariants existing at the starting point l1 of the set U of return objects, that is, a transaction invariant expression n ≤ 100, and a loop label corresponding to any one of the loop labels LL1. Although the loop invariant x=y is refined, the refiner 173 is designed not to refine the invariant corresponding to another loop label LL2 that is not defined at the starting point.

정제부(173)는 적절한 정제 규칙(refinement relation)을 기반으로 효과적이면서 효율적으로 불변식 후보군을 생성하도록 구현된 것일 수 있다. 예를 들어, 지나치게 일반적인 불변식을 탐색하여 후보군을 생성하는 경우, 탐색 대상이 지나치게 증가하여 불변식 후보군의 생성에 과도한 시간을 소모하게 될 수도 있고, 반대로 지나치게 제한적인 표현력을 지닌 불변식만을 탐색하여 불변식 후보군을 생성할 경우 증명에 필요한 불변식 후보군을 설정 못하게 될 수도 있다. 따라서, 정제부(173)는 과도하게 일반적이지도 않으면서 과도하게 협소하지 않은 불변식을 탐색하여 컨트랙트의 검증에 적합한 불변식 후보군을 생성할 수 있다.The refiner 173 may be implemented to effectively and efficiently generate an invariant candidate group based on an appropriate refinement relation. For example, if a candidate group is generated by searching for an overly general invariant expression, excessive time may be consumed in generating the invariant candidate group due to an excessive increase in the number of search targets. When generating the invariant candidate group, it may not be possible to set the invariant candidate group required for proof. Accordingly, the refiner 173 may generate an invariant candidate group suitable for contract verification by searching for an invariant that is neither overly general nor overly narrow.

예를 들어, 정제부(173)는 적어도 하나의 미리 정의된 패턴의 식을 포함하는 불변식을 기반으로 불변식 후보를 정제할 수도 있다. 이 경우, 정제부(173)는 미리 정의된 패턴의 원자적 식(atomic formula) 또는 둘 이상의 원자적 식의 결합식(conjunctive formula)으로 형성된 불변식만을 기반으로 불변식 후보군을 생성할 수도 있다. 여기서, 미리 정의된 패턴의 식은 설계자의 임의적 선택이나 경험칙에 따라 결정된 적어도 하나의 식을 포함할 수 있으며, 예를 들어, 스마트 컨트랙트의 안전성 검증을 위해 흔히 요구되는 패턴의 불변식(들)을 포함할 수 있다. For example, the refiner 173 may refine an invariant expression candidate based on an invariant expression including at least one predefined pattern expression. In this case, the refiner 173 may generate an invariant candidate group based only on an invariant formula formed by an atomic formula of a predefined pattern or a conjunctive formula of two or more atomic formulas. Here, the predefined pattern expression may include at least one expression determined according to the designer's arbitrary selection or empirical rule, for example, including the invariant expression(s) of the pattern commonly required for safety verification of smart contracts. can do.

보다 구체적으로 예를 들어, 미리 정의된 패턴의 식은, x≥y, x=y, x=n, x≥n, x≤n, sum(x)=n 및 sum(x)=y 중 적어도 하나를 포함할 수 있다. 여기서 x 및 y는 프로그램의 변수, n은 프로그램의 상수를 의미한다. sum(x)=n 또는 sum(x)=y에서 x는 솔리디티 언어에서 주소를 부호 비트 없는 정수 256bit(uint256)으로 매핑하는 타입 변수를 의미하며, x의 모든 계좌 잔액의 합이 n 또는 y와 동일함을 나타낸다. sum(x)가 포함된 식은, 타당성 판단부(180)가 이해할 수 있는 1차 논리식으로 변형될 수 있다. 이 경우, sum(x)는 유의미한 원소에 대해 표현되고 무의미한 원소에 대해선 하나의 전체로써 요약되어 표현될 수 있다. 유의미한 원소란 식에 등장하는 원소를 포함할 수 있다. 구체적으로 예를 들어, 하기의 수학식 19와 같은 식이 주어진 경우, x는 i 및 j의 인덱스 변수들에 의해 접근 가능하므로, i 및 j를 제외한 잔여 인덱스 접근에 의한 부분은 요약적으로 통합하여 하기의 수학식 20과 같이 표현할 수 있다.More specifically, for example, the expression of the predefined pattern is at least one of x≥y, x=y, x=n, x≥n, x≤n, sum(x)=n, and sum(x)=y may include. Here, x and y are program variables, and n are program constants. In sum(x)=n or sum(x)=y, x means a type variable that maps an address to an unsigned integer 256bit (uint256) in the Solidity language, where the sum of all account balances in x is n or y indicates the same as The expression including sum(x) may be transformed into a primary logical expression that the validity determining unit 180 can understand. In this case, sum(x) may be expressed for a significant element and summarized and expressed as a whole for an insignificant element. Significant elements can include elements that appear in an equation. Specifically, for example, when an expression such as the following Equation 19 is given, since x is accessible by index variables of i and j, the parts by the residual index access excluding i and j are summarized and integrated into the following It can be expressed as Equation 20 of

Figure 112019102129571-pat00033
Figure 112019102129571-pat00033

Figure 112019102129571-pat00034
Figure 112019102129571-pat00034

여기서, F1은 x의 모든 원소의 합이 n과 같음을 나타내는 것으로 하기의 수학식 21과 같이 정의될 수 있고, F2는 x의 모든 원소의 합을 합산하는 과정에서 정수 오버플로우가 발생하지 않음을 나타내는 것으로 하기의 수학식 22와 같이 정의될 수 있다.Here, F1 indicates that the sum of all elements of x is equal to n, and can be defined as in Equation 21 below, and F2 indicates that integer overflow does not occur in the process of summing the sum of all elements of x. It can be defined as in Equation 22 below.

Figure 112019102129571-pat00035
Figure 112019102129571-pat00035

Figure 112019102129571-pat00036
Figure 112019102129571-pat00036

여기서, Rx는 x[i] 및 x[j]를 제외한 나머지 원소들의 합을 표현한 변수이며, Bx는 Rx의 연산 과정에서 정수 오버플로우가 발생하지 않음을 나타내는 부울 변수이다.Here, Rx is a variable expressing the sum of elements other than x[i] and x[j], and Bx is a Boolean variable indicating that integer overflow does not occur during the operation of Rx.

상술한 바와 같은 방법을 통해 정제부(173)는 불변식 후보군을 새로 생성할 수 있다. 보다 구체적으로 예를 들어, 현재의 불변식이 (x=10, μ)이고(μ는 임의의 루프 불변식 매핑), |U|=1이고, 반환 대상에 대한 집합(U)에서 추출된 변수 컴포넌트가 {x, y}이되 정수 컴포넌트는 부재하며, 반환 대상에 대한 집합(U)은 오직 트랜잭션 불변식만 포함한다고 했을 때, 정제부(173)는 하기의 수학식 23과 같은 불변식 후보군을 생성하게 된다.Through the above-described method, the refiner 173 may newly generate an invariant candidate group. More specifically, for example, if the current invariant is (x=10, μ) (where μ is a mapping of any loop invariant), |U|=1, and the variable component extracted from the set (U) for the return target. Assuming {x, y} but no integer component, and the set U for the return target includes only transaction invariants, the refiner 173 generates an invariant candidate group as shown in Equation 23 below. will do

Figure 112019102129571-pat00037
Figure 112019102129571-pat00037

새롭게 생성된 불변식 후보군은, 도 1 및 도 4에 도시된 바와 같이 검증부(110)로 전달되고, 검증부(110)는 새로 수신한 불변식 후보군을 기반으로 상술한 바와 동일하게 또는 일부 변형된 방법으로 검증 조건(113a)을 생성하고, 검증 조건(113a)의 타당성을 판단하여 반환 대상을 검출하거나 및/또는 판단 결과를 출력부(102)로 전달하게 된다.The newly generated invariant candidate group is transmitted to the verification unit 110 as shown in FIGS. 1 and 4 , and the verification unit 110 is the same or partially modified as described above based on the newly received invariant candidate group. The verification condition 113a is generated by the method described above, the validity of the verification condition 113a is determined, a return target is detected, and/or the determination result is transmitted to the output unit 102 .

이하, 상술한 스마트 컨트랙트 검증 장치(100)의 동작을 표현한 프로그램 코드의 일례를 설명하도록 한다.Hereinafter, an example of a program code expressing the operation of the smart contract verification apparatus 100 described above will be described.

도 8은 스마트 컨트랙트 검증 장치의 동작을 프로그램 코드로 표현한 일례를 도시한 도면이다.8 is a diagram illustrating an example in which the operation of the smart contract verification apparatus is expressed in program code.

도 8의 제1 라인의 워크 셋 W는 불변식 후보군들의 집합을 의미한다. 이 경우, 각 불변식 후보는 트랜잭션 불변식(ψ) 및 루프 불변식 매핑(μ)을 포함할 수 있다. 이 경우, 각 불변식 후보는 불변식 쌍 (ψ, μ)으로 표현될 수 있다. The work set W of the first line of FIG. 8 refers to a set of invariant candidates. In this case, each invariant candidate may include a transaction invariant (ψ) and a loop invariant mapping (μ). In this case, each invariant candidate can be expressed as an invariant pair (ψ, μ).

제1 라인에 의하면 먼저 워크 셋 W는 초기화될 수 있다. 이는 상술한 초기화부(171)에 의해 수행될 수 있다. 도 8의 프로그램 코드에서는 워크 셋 W가 가장 부정확한 불변식 정보인 (true, λLL.true)로 초기화된다. 여기서 λLL.true는 모든 루프 레이블 LL이 참(true)으로 매핑되어 있음을 람다 표기법으로 나타낸 것이다. According to the first line, the work set W may be initialized. This may be performed by the above-described initialization unit 171 . In the program code of FIG. 8, the work set W is initialized to (true, λLL.true), which is the most inaccurate invariant information. Here, λLL.true indicates in lambda notation that all loop labels LL are mapped to true.

순차적으로 제3 라인에서는 식의 크기가 가장 작은 불변식 후보가 워크 셋 W에서 선택하여 제거될 수 있다. 크기가 가장 작은 불변식 후보의 제거 역시 초기화부(171)에서 수행될 수 있다.Sequentially, in the third line, an invariant candidate having the smallest expression size may be selected from the work set W and removed. Removal of an invariant candidate having the smallest size may also be performed in the initialization unit 171 .

제4 라인에서는 검증부(110)가 선택된 불변식 후보가 컨트랙트(c)에 대해 귀납적인지 여부를 판단하고 및/또는 컨트랙트(c)에 존재하는 각 명령문(쿼리)가 안전한지 여부를 확인하고, 확인 결과에 따라서 (inductive, U)의 데이터 쌍을 반환하게 된다. 상술한 바와 같이 inductive는 주어진 불변식 후보가 귀납적인지의 여부를 나타내는 부울 변수이고, U는 귀납성 혹은 쿼리 안전성 증명이 실패한 경로들(즉, 반환 대상들)의 집합이다.In the fourth line, the verification unit 110 determines whether the selected invariant candidate is inductive to the contract (c) and/or checks whether each statement (query) present in the contract (c) is safe, According to the verification result, a data pair of ( inductive, U ) is returned. As described above, inductive is a Boolean variable indicating whether or not a given invariant candidate is inductive, and U is a set of paths (ie, return targets) for which inductive or query safety proofs have failed.

제5 라인에 기재된 바와 같이, 반환 대상들의 집합(U)이 공집합이면, 컨트랙트(c)의 안전성 검증이 성공하였다는 것을 의미하며, 이에 따라 컨트랙트(c)의 안전성 검증 알고리즘은 종료된다. 이 경우, 제11 라인에 기재된 바와 같이, 출력부(102)는 컨트랙트(c)의 분석 결과를 출력할 수도 있다.As described in line 5, if the set (U) of return objects is an empty set, it means that the safety verification of the contract (c) is successful, and accordingly, the safety verification algorithm of the contract (c) is terminated. In this case, as described in line 11, the output unit 102 may output the analysis result of the contract (c).

제6 및 제7 라인에 기재된 바와 같이, 만약 귀납성 혹은 안전성 증명에 실패했을 경우, 불변식 처리부(180)의 정제부(183)는 반환 대상들의 집합(U)을 피드백 받아, 현재의 불변식 후보(ψ, μ), 일례로 초기화된 불변식 후보를 정제하여 새로운 불변식 후보군을 생성하고 새로운 불변식 후보군을 워크 셋 W에 추가한다.As described in the 6th and 7th lines, if the induction or safety proof fails, the refiner 183 of the invariant processing unit 180 receives the feedback set U of return objects, and the current invariant expression Candidates (ψ, μ), for example, initialized invariant candidates, are purified to generate new invariant candidates, and new invariant candidates are added to work set W.

일 실시예에 의하면, 프로그램 코드는 제8 및 제9 라인과 같이 현재 불변식 후보(ψ, μ)에 의해 안전성이 검증되지 않았으나, 귀납적이라고 판단된 경우에는(제8 라인), 귀납적이라고 판단되었다는 정보를 워크 셋 W의 모든 후보군들에 전달하여, 불변식 후보군들의 정보를 더 구체화시킬 수도 있다(제9 라인). 제9 라인에서 μ'∧μ는 각 루프 레이블 LL 각각의 루프 불변식에 대해 AND 논리 연산자를 수행하였음을 나타내는 것이다(즉, λLL.μ'(LL)∧μ(LL)). 이는 상술한 결과 처리부(119)에 의해 수행될 수도 있다.According to an embodiment, the safety of the program code has not been verified by the current invariant candidates (ψ, μ) as in the 8th and 9th lines, but when it is determined to be inductive (line 8), it is determined that it is inductive. The information may be transmitted to all candidates of the work set W to further refine the information of the invariant candidates (line 9). In the ninth line, μ′∧μ indicates that an AND logical operator is performed on each loop invariant of each loop label LL (ie, λLL.μ′(LL)∧μ(LL)). This may be performed by the above-described result processing unit 119 .

상술한 라인 제3 내지 제9 라인은 반환 대상들의 집합(U)이 공집합이거나(다시 말해서, 컨트랙트(c)의 안전성이 검증되었거나), 또는 미리 정의된 시간이 종료될 때까지 반복될 수 있다(제2 라인). 이와 같은 과정 중에서 최초에 초기화된 불변식 후보들은 점진적으로 정제되고 구체화되게 된다.The above-mentioned lines 3 to 9 may be repeated until the set U of return objects is an empty set (that is, the safety of the contract c has been verified), or a predefined time expires ( 2nd line). In this process, the initially initialized invariant candidates are gradually refined and specified.

이하 도 9 및 도 10을 참조하여 상술한 스마트 컨트랙트 검증 장치의 효과에 대해 설명하도록 한다.Hereinafter, the effect of the smart contract verification apparatus described above will be described with reference to FIGS. 9 and 10 .

도 9는 스마트 컨트랙트 검증 장치의 성능을 다른 종래의 장치와 비교한 결과를 나타낸 제1 도표로, 구체적으로는 정수 오버플로우, 언더플로우 및 0 나누기 취약점을 검증 대상으로 하여 버그 검출기와의 성능을 비교한 결과에 대한 것이다. 성능 비교를 위해 오버플로우 취약점이 존재하는 것으로 알려진 487개의 스마트 컨트랙트 중 임의의 60개를 선정한 후 30분 이내의 분석 시간 동안, 상술한 스마트 컨트랙트 검증 장치(100), 제1 내지 제4 버그 검출기를 이용하여 스마트 컨트랙트에 대한 검증을 실시하고, 도 9에 도시된 바와 같이 기록 및 정리하였다. 도 9에서 #CVE 취약점 탐지는 각 컨트랙트에 대해 기 알려진 보고된 취약점을 빠짐없이 검출한 경우의 수를 의미하고, #알람은 정수 오버플로우, 정수 언더플로우 및 0 나누기 취약점에 대해 각 분석기가 보고한 전체 알람 개수를 계수한 것이다. #허위 경보는 분석기가 생성한 전체 알람 중에서 실제로는 취약하지 않은 것을 취약한 것으로 오판단한 경우를 계수한 것이다. 9 is a first chart showing the results of comparing the performance of the smart contract verification device with other conventional devices, specifically comparing the performance with the bug detector by verifying integer overflow, underflow, and division by zero vulnerabilities. It's about a result. For performance comparison, after selecting any 60 out of 487 smart contracts known to have overflow vulnerabilities, for an analysis time within 30 minutes, the smart contract verification apparatus 100 and the first to fourth bug detectors described above Verification of the smart contract was performed using the , and recorded and organized as shown in FIG. 9 . In FIG. 9, #CVE vulnerability detection means the number of cases in which all known and reported vulnerabilities are detected for each contract, and #alarm is the number of cases reported by each analyzer for integer overflow, integer underflow, and division by zero vulnerabilities. It counts the total number of alarms. #False alarms are counts of cases in which the analyzer erroneously judges those that are not vulnerable as vulnerable among all the alarms generated by the analyzer.

도 9에 도시된 바를 참조하면, 상술한 스마트 컨트랙트 검증 장치(100)는 종래 알려진 60개의 취약점 중에서 58개를 탐지하였다. 60개의 취약점 중 탐지가 안된 2개의 취약점은 실제로 안전한 부분을 취약점으로 잘못 보고한 것에 해당하였다. 반면에 다른 버그 검출기들은 종래 알려진 60개의 취약점 중에서 41개, 20개, 10개 및 2개의 취약점만을 탐지할 수 있었다. Referring to FIG. 9 , the smart contract verification apparatus 100 described above detected 58 of the previously known 60 vulnerabilities. Of the 60 vulnerabilities, two undetected vulnerabilities actually corresponded to incorrectly reporting the safe part as a vulnerability. On the other hand, other bug detectors were able to detect only 41, 20, 10, and 2 vulnerabilities out of 60 known vulnerabilities.

또한, 이외 다른 잠재적인 취약점들에 대한 분석 결과에서도 상술한 스마트 컨트랙트 검증 장치(100)는 60개의 컨트랙트에서 492개의 취약점을 탐지하였고 오직 2개의 허위 경보만을 출력함으로써, 0.4%의 매우 낮은 허위 경보 비율을 나타내었다. 반면에 종래의 다른 버그 검출기들은 상대적으로 더 적은 수의 취약점을 탐지하였으며 허위 경보 비율 역시 5.4% 내지 10.6%를 보였다.In addition, as a result of analyzing other potential vulnerabilities, the above-described smart contract verification apparatus 100 detected 492 vulnerabilities in 60 contracts and output only two false alarms, so a very low false alarm rate of 0.4% was shown. On the other hand, other conventional bug detectors detected a relatively small number of vulnerabilities, and the false alarm rate was also 5.4% to 10.6%.

이는 스마트 컨트랙트 검증 장치(100)는 종래 버그 검출기에 비해 안전성을 보다 정확하고 우수한 분석력을 가지고 있음을 나타낸다.This indicates that the smart contract verification apparatus 100 has more accurate safety and excellent analysis power compared to the conventional bug detector.

도 10은 스마트 컨트랙트 검증 장치의 성능을 다른 종래의 장치와 비교한 결과를 나타낸 제2 도표로 종래의 검증기와의 성능 비교 결과를 도시한 것이다. 도 10은 종래의 검증기가 정수 오버플로우 취약점에 관해 허위 경보를 생성한 25개의 스마트 컨트랙트를 이용하여 상술한 스마트 컨트랙트 검증 장치(100)와 종래의 제1 검증기 및 제2 검증기의 성능을 상호 비교한 것이다. 도 10에서 검증 성공은 허위 경보 와 탐지하지 못한 취약점이 모두 없는 경우를 의미하고, 검증 실패는 허위 경보 혹은 탐지하지 못한 취약점이 존재한 경우를 의미한다.10 is a second chart showing the results of comparing the performance of the smart contract verification device with other conventional devices, and shows the performance comparison results with the conventional verification device. 10 is a comparison of the performance of the above-described smart contract verification apparatus 100 and the conventional first and second verifiers using 25 smart contracts in which the conventional verifier generated false alarms regarding integer overflow vulnerabilities. will be. In FIG. 10 , verification success means that there are no false alarms and undetected vulnerabilities, and verification failure means that false alarms or undetected vulnerabilities exist.

도 10에 도시된 바에 의하면, 상술한 스마트 컨트랙트 검증 장치(100)는 허위 경보를 생성했던 25개의 컨트랙트 중에서 오직 하나의 컨트랙트에 대해서만 허위 경보를 출력하였을 뿐, 그 외의 컨트랙트에 대해선 허위 경보를 출력하지 않았다. 반면에 제1 검증기는 25개의 컨트랙트 중에서 13개의 컨트랙트에서만 실행 오류를 발생시키지 않았으며, 13개의 컨트랙트 중에서 1개에서만 검증에 성공하였다. 제2 검증기는 검증에 모두 실패하였다.As shown in FIG. 10, the smart contract verification apparatus 100 described above only outputs a false alarm for only one contract among 25 contracts that have generated false alarms, and does not output false alarms for other contracts. didn't On the other hand, the first validator did not generate an execution error in only 13 of the 25 contracts, and only one of the 13 contracts succeeded in verification. The second verifier failed all verification.

상술한 실험 결과는 기존 검증기들보다 상술한 스마트 컨트랙트 검증 장치(100)가 상대적으로 더 정확하게 스마트 컨트랙트 취약점을 검증할 수 있음을 나타낸다.The above-described experimental results indicate that the smart contract verification apparatus 100 described above can verify smart contract vulnerabilities relatively more accurately than existing verifiers.

이와 같이 상술한 스마트 컨트랙트 검증 장치(100)에 의하면, 다른 종래의 버그 검출기나 검증기에 비해서 취약점을 더욱 정확하고 면밀하게 검출하면서도, 건전하고 또한 허위 경보를 거의 출력하지 않는 효과를 얻을 수 있다.As described above, according to the smart contract verification apparatus 100 described above, it is possible to obtain the effect of detecting vulnerabilities more accurately and more closely compared to other conventional bug detectors or verifiers, while sounding and producing almost no false alarms.

이하, 도 11 내지 도 13을 참조하여 스마트 컨트랙트 검증 방법의 여러 실시예에 대해서 설명하도록 한다.Hereinafter, various embodiments of the smart contract verification method will be described with reference to FIGS. 11 to 13 .

도 11은 스마트 컨트랙트 검증 방법의 제1 실시예에 대한 흐름도이다.11 is a flowchart of a first embodiment of a smart contract verification method.

도 11에 도시된 바를 참조하면, 먼저 불변식 후보군이 초기화될 수 있다(300). 불변식 후보의 초기화는 사용자의 조작 또는 미리 정의된 설정에 따라 수행될 수 있다. 예를 들어, 불변식 후보는 가장 부정확한 불변식 정보인 (true, λLL.true)으로 초기화될 수 있다.Referring to FIG. 11 , an invariant candidate group may be initialized ( 300 ). The initialization of the invariant candidate may be performed according to a user's operation or a predefined setting. For example, the invariant candidate may be initialized with (true, λLL.true), which is the most inaccurate invariant information.

분석 및 검증될 스마트 컨트랙트가 획득되고, 스마트 컨트랙트로부터 적어도 하나의 검증 대상(일례로 기본 경로)가 획득된다(302). 검증 대상의 획득은 도 11에 도시된 바와 같이, 불변식 후보군이 초기화된 이후에 수행될 수도 있고, 실시예에 따라서, 불변식 후보군이 초기화되기 이전이나 또는 불변식 후보군의 초기화와 더불어 수행될 수도 있다.A smart contract to be analyzed and verified is obtained, and at least one verification object (eg a default path) is obtained from the smart contract ( 302 ). Acquisition of the verification target may be performed after the invariant candidate group is initialized, as shown in FIG. 11 , or may be performed before the invariant candidate group is initialized or together with initialization of the invariant expression candidate group. have.

적어도 하나의 검증 대상이 생성되면, 적어도 하나의 검증 대상에 대응하는 검증 조건이 생성될 수 있다(304). 검증 조건은 모든 검증 대상에 대해 생성될 수도 있고 또는 일부의 검증 대상에 대해 생성될 수도 있다. 검증 조건은 소정의 수식 형태로 표현될 수 있으며, 예를 들어, 1차 논리식의 형태로 표현될 수도 있다. 일 실시예에 의하면, 검증 조건은 적어도 하나의 기본 경로에 대해 불변식 후보의 귀납성 여부 및 쿼리의 안전성 여부에 대한 적어도 하나의 수식들을 획득함으로써 생성될 수도 있으며, 보다 구체적으로 예를 들어, 상술한 수학식 3 내지 수학식 5의 형태로 생성될 수도 있다.When the at least one verification target is generated, a verification condition corresponding to the at least one verification target may be generated ( 304 ). The verification condition may be generated for all verification targets or may be generated for some verification targets. The verification condition may be expressed in the form of a predetermined formula, for example, may be expressed in the form of a first-order logical expression. According to an embodiment, the verification condition may be generated by obtaining at least one expression for whether an invariant candidate is inductive or not and whether a query is safe for at least one basic path, and more specifically, for example, It may be generated in the form of one of Equations 3 to 5.

검증 조건이 생성되면, 검증 조건에 대한 타당성이 확인 및 판단될 수 있다(306). 이 경우, 검증 조건을 생성한 검증부로부터 SMT 솔버 등과 같은 타당성 판단부로 전달되고, 타당성 판단부는 검증 조건에 대한 타당성을 판단한 후 판단 결과를 검증부로 전송할 수도 있다.Once the verification condition is generated, the validity of the verification condition may be checked and determined (306). In this case, the verification unit generating the verification condition may be transmitted to a validity determination unit such as an SMT solver, and the validity determination unit may determine the validity of the verification condition and then transmit the determination result to the verification unit.

만약 확인 및 판단 결과, 검증 조건이 타당하다면(308의 예), 검증 과정은 종료되고 스마트 컨트랙트가 안전하다는 판단 결과가 출력될 수 있다(314). 이 경우, 이용된 불변식 후보의 귀납성 여부에 대한 판단 결과(즉, 불변식 후보의 귀납성이 인정되었다는 판단 결과)도 함께 출력될 수도 있다.As a result of the confirmation and determination, if the verification condition is valid (YES in 308), the verification process is terminated and a determination result that the smart contract is secure may be output (314). In this case, the result of determining whether the invariability of the used invariant candidate is inductive (ie, the result of determining that the inductance of the invariant candidate is recognized) may also be output.

반대로 확인 및 판단 결과, 검증 조건이 타당하지 않고(308의 아니오), 또한 검증이 종료되지 않는 경우라면(310의 아니오), 타당하지 않은 검증 대상(즉, 반환 대상)에 대한 정보를 기반으로 기존에 이용된 불변식 후보군(즉, 초기화된 후보군)에 대한 정제가 수행되고, 이에 따라 새로운 불변식 후보군이 생성될 수 있다(312). 새로운 불변식 후보군은 적어도 하나의 미리 정의된 패턴을 기반으로 정제될 수 있다. 예를 들어, 특정한 패턴의 원자적 식 또는 둘 이상의 원자적 식이 결합된 결합식으로 형성된 불변식을 이용하여 불변식 후보군을 생성하는 것도 가능하다. 여기서, 예를 들어, 미리 정의된 패턴의 식은, x≥y, x=y, x=n, x≥n, x≤n, sum(x)=n 및 sum(x)=y 중 적어도 하나를 포함할 수 있으나, 이에 한정되는 것은 아니다.Conversely, as a result of verification and judgment, if the verification condition is not valid (No of 308) and the verification is not terminated (No of 310), based on the information on the invalid verification target (ie, return target), Refinement is performed on the invariant candidate group (ie, the initialized candidate group) used in , and thus a new invariant candidate group may be generated ( 312 ). The new invariant candidate group may be refined based on at least one predefined pattern. For example, it is also possible to generate a group of invariant expression candidates by using a specific pattern of an atomic formula or an invariant formula formed by a bonding formula in which two or more atomic formulas are combined. Here, for example, the expression of the predefined pattern is at least one of x≥y, x=y, x=n, x≥n, x≤n, sum(x)=n, and sum(x)=y may be included, but is not limited thereto.

새로운 불변식 후보군이 생성되면, 새로운 불변식 후보군을 기반으로 검증 대상에 대한 새로운 검증 조건이 생성될 수 있다(304). 이 경우, 검증 대상은 기존에 생성된 검증 대상과 동일할 수도 있고, 또는 상이할 수도 있다. 필요에 따라, 검증 대상은 컨트랙트로부터 다시 생성 및 획득될 수도 있다(302). 새로운 검증 조건이 생성되면, 순차적으로 타당성이 확인되고(306), 타당한 경우에는 검증이 종료되고, 결과값이 출력되거나(308의 예 및 314) 또는 여전히 타당하지 않은 경우에는 다시 새로운 불변식 후보군을 생성하게 된다(312). 이에 따라 검증 조건이 모두 타당하거나(308의 예) 또는 검증이 종료될 때까지(310의 예) 상술한 단계(302 내지 314)가 반복되게 된다.When a new invariant candidate group is generated, a new verification condition for a verification target may be generated based on the new invariant candidate group ( 304 ). In this case, the verification target may be the same as or different from the previously generated verification target. If necessary, the verification object may be regenerated and obtained from the contract (302). When a new validation condition is created, the validity is sequentially checked (306), if it is valid, the validation is terminated, and the result is output (examples of 308 and 314), or a new invariant candidate group is generated again if it is still not valid. generated (312). Accordingly, the above-described steps 302 to 314 are repeated until all of the verification conditions are valid (YES in 308) or the verification is finished (YES in 310).

한편, 확인 및 판단 결과, 검증 조건이 타당하지 않으나(308의 아니오) 기 정의된 검증 종료 조건(예를 들어, 검증 시간의 초과 등)의 만족 여부에 따라 검증이 종료될 수도 있다(310의 예). 이 경우, 실시예에 따라서, 검증이 종료된 이유(검증 시간의 초과 등) 등이 외부로 출력될 수도 있다(314).On the other hand, as a result of the verification and determination, the verification condition is not valid (No of 308), but the verification may be terminated depending on whether a predefined verification end condition (eg, the verification time is exceeded) is satisfied (Yes of 310) ). In this case, depending on the embodiment, the reason for the completion of verification (exceeding the verification time, etc.) may be output to the outside ( 314 ).

도 12는 스마트 컨트랙트 검증 방법의 제2 실시예에 대한 흐름도이다.12 is a flowchart of a second embodiment of a smart contract verification method.

다른 실시예에 의하면, 스마트 컨트랙트 검증 방법은 먼저 상술한 바와 동일하게 불변식 후보군이 초기화되고, 분석 및 검증될 스마트 컨트랙트가 획득되고, 스마트 컨트랙트로부터 적어도 하나의 검증 대상(일례로 기본 경로)이 획득될 수 있다(320). 이들 과정은 동시에 또는 이시에 수행될 수 있다.According to another embodiment, in the smart contract verification method, the invariant candidate group is initialized as described above, the smart contract to be analyzed and verified is obtained, and at least one verification target (eg, the default path) is obtained from the smart contract. may be (320). These processes may be performed simultaneously or at the same time.

순차적으로 적어도 하나의 검증 대상의 전부 또는 일부에 대해 검증 조건이 생성될 수 있다(322).Verification conditions may be sequentially generated for all or a part of at least one verification target ( 322 ).

검증 조건이 생성되면, 생성된 검증 조건에 대한 간략화가 더 수행될 수 있다(324). 검증 조건은, 예를 들어, 미리 정의된 간략화 규칙을 기반으로 간략하게 수정 또는 변경될 수 있다. 여기서, 미리 정의된 간략화 규칙은, 기 상술한 바와 같이, 종래 수학적 또는 논리적으로 정의된 각종 공식, 법칙 및/또는 공리 등을 기반으로 정의된 것일 수 있다.When the verification condition is generated, simplification may be further performed on the generated verification condition ( 324 ). The verification condition may be briefly modified or changed, for example, based on a predefined simplification rule. Here, the predefined simplification rule may be defined based on various formulas, laws, and/or axioms previously defined mathematically or logically, as described above.

검증 조건이 간략화되면, 간략화된 검증 조건에 대한 타당성이 확인 및 판단될 수 있다(326). 이 경우, 간략화된 검증 조건의 타당성 판단은, 검증 조건의 생성 및 간략화를 수행한 검증부가 아닌, 타당성 판단부에 의해 수행될 수 있다. 타당성 판단부는 판단 결과를 검증부로 전송한다.If the verification condition is simplified, validity of the simplified verification condition may be checked and determined ( 326 ). In this case, the validity determination of the simplified verification condition may be performed by the validity determination unit, not the verification unit that generated and simplified the verification condition. The validity determination unit transmits the determination result to the verification unit.

만약 확인 및 판단 결과, 검증 조건이 타당하다면(328의 예), 검증 과정은 종료되고 스마트 컨트랙트가 안전하다는 판단 결과가 외부로 시각적 또는 청각적 형태로 출력될 수 있다(334). 상술한 바와 같이, 현재 사용된 불변식 후보의 귀납성이 인정되었다는 판단 결과도 함께 출력 가능하다.As a result of the confirmation and determination, if the verification condition is valid (YES in S328), the verification process is terminated and the determination result that the smart contract is safe may be output in a visual or auditory form (334). As described above, it is also possible to output the result of the determination that the inductiveness of the currently used invariant expression candidate is recognized.

반대로 확인 및 판단 결과, 검증 조건이 타당하지 않고(328의 아니오), 또한 검증 종료 조건이 만족되지 않는 경우라면(330의 아니오), 상술한 바와 같이 타당하지 않은 검증 대상(즉, 반환 대상)에 대한 정보를 이용하여 불변식 후보군(즉, 초기화된 후보군)이 정제되어, 새로운 불변식 후보군이 생성될 수 있다(332).Conversely, as a result of confirmation and determination, if the verification condition is not valid (No in 328) and the verification termination condition is not satisfied (No in 330), as described above, the verification target (ie, return target) is not valid. The invariant candidate group (ie, the initialized candidate group) may be refined using the information about the invariant expression candidate group to generate a new invariant expression candidate group ( 332 ).

새로운 불변식 후보군이 생성되면, 새로운 불변식 후보군을 기반으로 검증 대상에 대한 새로운 검증 조건이 생성되고(322), 컨트랙트에 대한 검증이 성공하거나(328의 예) 또는 기 정의된 검증 종료 조건이 만족될 때(330의 예)까지 상술한 과정(322 내지 334)는 반복될 수 있다. 한편, 검증 조건이 타당하지 않으나(328의 아니오) 기 정의된 검증 종료 조건에 따라 검증이 종료될 수도 있다(330의 예).When a new invariant candidate group is generated, a new verification condition for the verification target is generated based on the new invariant candidate group (322), the verification of the contract is successful (Yes in 328), or a predefined verification termination condition is satisfied The above-described processes 322 to 334 may be repeated until (Yes in 330). Meanwhile, although the verification condition is not valid (No of 328), the verification may be terminated according to a predefined verification termination condition (Yes of 330).

도 13은 스마트 컨트랙트 검증 방법의 제3 실시예에 대한 흐름도이다.13 is a flowchart of a third embodiment of a smart contract verification method.

도 13에 도시된 스마트 컨트랙트 검증 방법의 제3 실시예에 의하면, 도 11 및 도 12에서 설명한 바와 같이 먼저 불변식 후보군이 초기화되고, 분석 및 검증될 스마트 컨트랙트가 획득되며, 스마트 컨트랙트로부터 적어도 하나의 검증 대상(일례로 기본 경로)이 획득된다(320).According to the third embodiment of the smart contract verification method shown in FIG. 13, as described in FIGS. 11 and 12, an invariant candidate group is first initialized, a smart contract to be analyzed and verified is obtained, and at least one A verification target (eg, a default path) is obtained ( 320 ).

이어서 적어도 하나의 검증 대상의 전부 또는 일부에 대해 적어도 하나의 검증 조건이 생성될 수 있다(322).Subsequently, at least one verification condition may be generated for all or part of the at least one verification target ( 322 ).

적어도 하나의 검증 조건이 생성되면, 검증부는 검증 조건을 타당성 판단부로 전송할지 여부를 먼저 결정할 수 있다(344). 즉, 검증부가 타당성을 선행해서 확인할지 여부를 결정할 수 있다. 예를 들어, 검증 조건이 미리 정의된 템플릿에 대응하는 경우, 검증부는 타당성을 선행하여 확인할 것을 결정할 수도 있다. 다른 예를 들어, 검증부는 검증 조건의 형태에 따라서 타당성의 선행 확인 여부를 결정할 수도 있다. When at least one verification condition is generated, the verification unit may first determine whether to transmit the verification condition to the validity determination unit ( 344 ). That is, the verification unit may determine whether to check validity in advance. For example, when the verification condition corresponds to a predefined template, the verification unit may determine to check validity in advance. For another example, the verification unit may determine whether to confirm validity in advance according to the type of verification condition.

만약 검증부가 타당성 판단부로 전송할 것으로 결정하면(344의 아니오), 상술한 바와 같이 타당성 판단부로 검증 조건이 전달되고(348) 타당성 판단부는 적어도 하나의 검증 조건 각각에 대해 타당성을 판단할 수 있다(350).If the verification unit determines to transmit to the validity determination unit (No in 344), the verification condition is transmitted to the validity determination unit as described above (348), and the validity determination unit may determine the validity of each of the at least one verification condition (350). ).

반대로 검증부가 타당성 판단부로 검증 조건을 전달하지 않고, 직접 타당성을 선행하기로 결정한 경우(344의 예), 검증부가 타당성을 선행하여 확인할 수 있다(346). 예를 들어, 검증부는 미리 정의된 템플릿을 이용하여 검증 조건의 타당성을 판단할 수 있다. 여기서, 미리 정의된 템플릿은 스마트 컨트랙트의 분석 과정에서 흔히 생성/검출되는 검증 조건 또는 이와 같은 검증 조건의 패턴 등을 기반으로 정의된 것일 수 있다. 보다 구체적으로 예를 들어, 미리 정의된 템플릿은 특정한 패턴의 검증 조건에 따라 타당한 것으로 또는 타당하지 않은 것으로 판단하는 내용을 포함할 수 있다. 다른 예를 들어, 검증부는 검증 조건의 형태를 기반으로 검증 조건의 타당성을 판단할 수도 있다. 구체적으로 검증부는 자유 변수의 집합을 기반으로 전제 조건과 결과의 관계를 검토함으로써 컨트랙트의 타당성 여부를 신속하게 판단할 수도 있다.Conversely, if the verification unit does not transmit the verification condition to the validity determining unit and directly decides to precede the validity (Yes in 344), the verification unit may precede the validity check (346). For example, the verification unit may determine the validity of the verification condition by using a predefined template. Here, the predefined template may be defined based on a verification condition commonly generated/detected in the analysis process of a smart contract or a pattern of such verification condition. More specifically, for example, the predefined template may include content that is determined to be valid or not valid according to a verification condition of a specific pattern. As another example, the verification unit may determine the validity of the verification condition based on the type of verification condition. Specifically, the verification unit can also quickly determine the validity of the contract by examining the relationship between the prerequisites and the result based on the set of free variables.

실시예에 따라서, 타당성의 선행 확인(344) 이전에 도 12에 도시된 바와 같이 검증 조건에 대한 간략화(324)가 더 수행되는 것도 가능하다. 이 경우, 검증부는 간략화된 검증 조건을 기반으로 타당성을 선행하여 판단하게 된다.Depending on the embodiment, it is also possible that the simplification 324 of the verification condition is further performed as shown in FIG. 12 before the prior validation 344 of validity. In this case, the verification unit determines the validity in advance based on the simplified verification conditions.

검증부의 타당성 판단 결과 또는 타당성 판단부의 판단 결과에 따라, 만약 검증 조건이 타당하다면(352의 예), 검증 과정은 종료되고 스마트 컨트랙트가 안전하다는 판단 결과가 외부로 출력될 수 있으며, 현재의 불변식 후보의 귀납성 여부에 대한 판단 결과도 출력될 수 있다(358).According to the validity determination result of the verification unit or the determination result of the validity determination unit, if the verification condition is valid (Yes in 352), the verification process is terminated and the determination result that the smart contract is safe may be output to the outside, and the current invariant A result of determining whether the candidate is inductive or not may also be output ( 358 ).

검증부의 타당성 판단 결과 또는 타당성 판단부의 판단 결과, 만약 검증 조건이 타당하지 않고(352의 아니오), 또한 검증이 종료되지 않는 경우라면(354의 아니오), 상술한 바와 같이, 반환 대상(즉, 타당하지 않은 검증 대상)에 대한 정보를 기반으로 기존에 이용된 불변식 후보군에 대한 정제가 수행된다(356). 정제 결과에 따라 생성된 새로운 불변식 후보군을 기반으로, 기존의 검증 대상에 대한 또는 새로운 검증 대상에 대한 새로운 검증 조건이 생성될 수 있다(342).As a result of the validity determination of the verification unit or the determination result of the validity determination unit, if the verification condition is not valid (No in 352) and the verification is not completed (No in 354), as described above, the return target (that is, the validity Refining of the previously used invariant candidate group is performed based on the information on the verification target that has not been verified (356). Based on the new invariant candidate group generated according to the purification result, a new verification condition for an existing verification target or a new verification target may be generated ( 342 ).

마찬가지로 상술한 과정(342 내지 358)은, 컨트랙트에 대한 검증이 성공하거나(352의 예) 또는 기 정의된 검증 종료 조건이 만족될 때(354의 예)까지 반복될 수 있다. 또한, 제3 실시예에 경우에서도, 검증 조건이 타당하다고 판단되지는 않으나(352의 아니오), 사용자 또는 설계자에 의해 미리 정의된 검증 종료 조건(예를 들어, 검증 시간의 초과 등)에 따라 컨트랙트에 대한 검증이 종료될 수도 있다(354의 예).Similarly, the above-described processes 342 to 358 may be repeated until the verification of the contract is successful (Yes in 352) or a predefined verification termination condition is satisfied (Yes in 354). In addition, even in the case of the third embodiment, although the verification condition is not judged to be valid (No in 352), the contract according to the verification termination condition predefined by the user or designer (for example, exceeding the verification time, etc.) Verification may be finished (Yes of 354).

상술한 실시예에 따른 스마트 컨트랙트 검증 방법은, 컴퓨터 장치에 의해 구동될 수 있는 프로그램의 형태로 구현될 수 있다. 여기서 프로그램은, 프로그램 명령, 데이터 파일 및 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 프로그램은 기계어 코드나 고급 언어 코드를 이용하여 설계 및 제작된 것일 수 있다. 프로그램은 상술한 방법을 구현하기 위하여 특별히 설계된 것일 수도 있고, 컴퓨터 소프트웨어 분야에서 통상의 기술자에게 기 공지되어 사용 가능한 각종 함수나 정의를 이용하여 구현된 것일 수도 있다. 또한, 여기서, 컴퓨터 장치는, 프로그램의 기능을 실현 가능하게 하는 프로세서나 메모리 등을 포함하여 구현된 것일 수 있으며, 필요에 따라 통신 장치를 더 포함할 수도 있다.The smart contract verification method according to the above-described embodiment may be implemented in the form of a program that can be driven by a computer device. Here, the program may include program instructions, data files, and data structures alone or in combination. The program may be designed and manufactured using machine code or high-level language code. The program may be specially designed to implement the above-described method, or may be implemented using various functions or definitions that are known and available to those skilled in the art of computer software. In addition, here, the computer device may be implemented including a processor or memory that enables the function of the program to be realized, and may further include a communication device if necessary.

상술한 스마트 컨트랙트 검증 방법을 구현하기 위한 프로그램은, 컴퓨터에 의해 판독 가능한 기록 매체에 기록될 수 있다. 컴퓨터에 의해 판독 가능한 기록 매체는, 예를 들어, 하드 디스크나 플로피 디스크와 같은 자기 디스크 저장 매체, 자기 테이프, 콤팩트 디스크나 디브이디와 같은 광 기록 매체, 플롭티컬 디스크와 같은 자기-광 기록 매체 및 롬, 램 또는 플래시 메모리 등과 같은 반도체 저장 장치 등 컴퓨터 등의 호출에 따라 실행되는 특정 프로그램을 저장 가능한 다양한 종류의 하드웨어 장치를 포함할 수 있다. A program for implementing the smart contract verification method described above may be recorded in a computer-readable recording medium. The computer-readable recording medium includes, for example, a magnetic disk storage medium such as a hard disk or a floppy disk, a magnetic tape, an optical recording medium such as a compact disk or DVD, a magneto-optical recording medium such as a floppy disk, and a ROM. , a semiconductor storage device such as a RAM or a flash memory, and the like, may include various types of hardware devices capable of storing a specific program executed in response to a computer call.

이상 스마트 컨트랙트 검증 장치 및 방법의 여러 실시예에 대해 설명하였으나, 장치 및 방법은 오직 상술한 실시예에 한정되는 것은 아니다. 해당 기술 분야에서 통상의 지식을 가진 자가 상술한 실시예를 기초로 수정 및 변형하여 구현 가능한 다양한 장치나 방법 역시 상술한 스마트 컨트랙트 검증 장치 및 방법의 일례가 될 수 있다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 시스템, 구조, 장치, 회로 등의 구성 요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나 다른 구성 요소 또는 균등물에 의하여 대치되거나 또는 치환되더라도 상술한 스마트 컨트랙트 검증 장치 및 방법의 일 실시예가 될 수 있다.Although several embodiments of the smart contract verification apparatus and method have been described above, the apparatus and method are not limited only to the above-described embodiments. Various devices or methods that can be implemented by a person skilled in the art by modifying and modifying based on the above-described embodiment may also be an example of the smart contract verification device and method described above. For example, the described techniques are performed in an order different from the described method, and/or the described components of a system, structure, apparatus, circuit, etc. are combined or combined in a different form than the described method, or other components or Even if it is replaced or substituted by an equivalent, it may be an embodiment of the smart contract verification apparatus and method described above.

100: 스마트 컨트랙트 검증 장치
110: 검증부
111: 경로 집합 생성부
113: 조건 생성부
119: 결과 처리부
190: 불변식 처리부
191: 초기화부
193: 정제부
200: 타당성 판단부
100: smart contract verification device
110: verification unit
111: path set generator
113: condition generator
119: result processing unit
190: invariant processing unit
191: initialization unit
193: refining unit
200: feasibility judgment unit

Claims (14)

적어도 하나의 불변식 후보를 포함하는 불변식 후보군을 생성하는 불변식 처리부; 및
컨트랙트의 적어도 하나의 검증 대상을 획득하고, 상기 불변식 후보를 이용하여 상기 적어도 하나의 검증 대상 각각에 대한 검증 조건을 생성하는 검증부를 포함하고,
상기 검증부는 상기 적어도 하나의 검증 대상 중에서 반환 대상을 검출하여 상기 불변식 처리부로 전달하되, 상기 반환 대상은 타당하지 않은 검증 조건에 대응하는 검증 대상을 포함하고,
상기 불변식 처리부는 상기 적어도 하나의 반환 대상을 기반으로 상기 불변식 후보를 정제하여 새로운 불변식 후보군을 생성하고, 상기 새로운 불변식 후보군을 상기 검증부에 전달하는,
스마트 컨트랙트 검증 장치.
an invariant processing unit for generating a group of invariant candidates including at least one invariant candidate; and
A verification unit for obtaining at least one verification target of a contract and generating verification conditions for each of the at least one verification target using the invariant candidate,
The verification unit detects a return target from among the at least one verification target and transmits it to the invariant processing unit, wherein the return target includes a verification target corresponding to an invalid verification condition,
The invariant processing unit generates a new invariant candidate group by refining the invariant candidate based on the at least one return target, and delivers the new invariant candidate group to the verification unit,
Smart contract verification device.
삭제delete 제1항에 있어서,
상기 불변식 처리부는 미리 정의된 패턴의 수식을 포함하는 불변식을 검출하여 상기 불변식 후보로 결정함으로써 상기 불변식 후보를 정제하는,
스마트 컨트랙트 검증 장치.
According to claim 1,
The invariant processing unit purifies the invariant expression candidate by detecting an invariant expression including an expression of a predefined pattern and determining it as the invariant expression candidate,
Smart contract verification device.
제1항에 있어서,
상기 검증부는 상기 검증 조건을 타당성 판단부로 전달하고, 상기 타당성 판단부는 상기 검증 조건에 대한 타당성을 판단한 후 판단 결과를 상기 검증부로 전달하고, 상기 검증부는 상기 판단 결과를 기반으로 상기 반환 대상을 검출하는 스마트 컨트랙트 검증 장치.
According to claim 1,
The verification unit transmits the verification condition to the validity determination unit, the validity determination unit determines the validity of the verification condition and then transmits the determination result to the verification unit, and the verification unit detects the return target based on the determination result Smart contract verification device.
제1항에 있어서,
상기 검증부는 자유 변수 집합의 포함 관계 또는 미리 정의된 템플릿을 기반으로 상기 검증 조건의 타당성을 판단하는,
스마트 컨트랙트 검증 장치.
According to claim 1,
The verification unit determines the validity of the verification condition based on the inclusion relationship of the set of free variables or a predefined template,
Smart contract verification device.
제4항 또는 제5항에 있어서,
상기 검증부는 상기 검증 조건을 타당성 판단부로 전달하기 전에 또는 상기 검증 조건의 타당성을 판단하기 전에 상기 검증 조건을 간략화하는,
스마트 컨트랙트 검증 장치.
6. The method according to claim 4 or 5,
The verification unit simplifies the verification condition before transmitting the verification condition to the validity determining unit or before determining the validity of the verification condition,
Smart contract verification device.
제1항에 있어서,
상기 검증부는 상기 반환 대상이 부재한 경우 검증이 성공한 것으로 판단하는,
스마트 컨트랙트 검증 장치.
According to claim 1,
The verification unit determines that verification is successful when the return target is absent,
Smart contract verification device.
적어도 하나의 불변식 후보를 포함하는 불변식 후보군을 생성하는 단계;
컨트랙트의 적어도 하나의 검증 대상을 획득하는 단계;
상기 불변식 후보를 이용하여 상기 적어도 하나의 검증 대상 각각에 대한 검증 조건을 생성하는 단계;
상기 적어도 하나의 검증 대상 중에서 반환 대상을 검출하되, 상기 반환 대상은 타당하지 않은 검증 조건에 대응하는 검증 대상을 포함하는 단계; 및
상기 적어도 하나의 반환 대상을 기반으로 상기 불변식 후보를 정제하여 새로운 불변식 후보군을 생성하는 단계를 포함하는 스마트 컨트랙트 검증 방법.
generating a group of invariant candidates including at least one invariant candidate;
obtaining at least one verification target of the contract;
generating a verification condition for each of the at least one verification target by using the invariant candidate;
detecting a return target from among the at least one verification target, wherein the return target includes a verification target corresponding to an invalid verification condition; and
and generating a new group of invariant candidates by refining the invariant candidates based on the at least one return target.
삭제delete 제8항에 있어서,
상기 적어도 하나의 반환 대상을 기반으로 상기 불변식 후보를 정제하여 새로운 불변식 후보군을 생성하는 단계는 미리 정의된 패턴의 수식을 포함하는 불변식을 검출하여 상기 불변식 후보로 결정하는 단계를 포함하는,
스마트 컨트랙트 검증 방법.
9. The method of claim 8,
The step of generating a new invariant candidate group by refining the invariant candidate based on the at least one return target includes detecting an invariant expression including an expression of a predefined pattern and determining the invariant candidate as the invariant candidate ,
Smart contract verification method.
제8항에 있어서,
상기 적어도 하나의 검증 대상 중에서 반환 대상을 검출하는 단계는,
상기 검증 조건에 대한 타당성을 판단하는 단계; 및
상기 타당성의 판단 결과를 기반으로 상기 반환 대상을 검출하는 단계를 포함하는,
스마트 컨트랙트 검증 방법.
9. The method of claim 8,
The step of detecting a return target from among the at least one verification target includes:
determining the validity of the verification condition; and
Comprising the step of detecting the return target based on the determination result of the validity,
Smart contract verification method.
제8항에 있어서,
자유 변수 집합의 포함 관계 또는 미리 정의된 템플릿을 기반으로 상기 검증 조건의 타당성을 판단하는 단계를 더 포함하는,
스마트 컨트랙트 검증 방법.
9. The method of claim 8,
Further comprising the step of determining the validity of the verification condition based on the inclusion relationship of the set of free variables or a predefined template,
Smart contract verification method.
제11항 또는 제12항에 있어서,
상기 검증 조건을 간략화하는 단계를 더 포함하는,
스마트 컨트랙트 검증 방법.
13. The method of claim 11 or 12,
Further comprising the step of simplifying the verification condition,
Smart contract verification method.
제8항에 있어서,
상기 반환 대상이 부재한 경우 검증이 성공한 것으로 판단하는 단계를 더 포함하는,
스마트 컨트랙트 검증 방법.
9. The method of claim 8,
Further comprising the step of determining that the verification is successful when the return target is absent,
Smart contract verification method.
KR1020190123850A 2019-10-07 2019-10-07 Appratus and method for verification of smart contracts KR102269174B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020190123850A KR102269174B1 (en) 2019-10-07 2019-10-07 Appratus and method for verification of smart contracts

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020190123850A KR102269174B1 (en) 2019-10-07 2019-10-07 Appratus and method for verification of smart contracts

Publications (2)

Publication Number Publication Date
KR20210041310A KR20210041310A (en) 2021-04-15
KR102269174B1 true KR102269174B1 (en) 2021-06-24

Family

ID=75440779

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020190123850A KR102269174B1 (en) 2019-10-07 2019-10-07 Appratus and method for verification of smart contracts

Country Status (1)

Country Link
KR (1) KR102269174B1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114048464B (en) * 2022-01-12 2022-03-15 北京大学 Ether house intelligent contract security vulnerability detection method and system based on deep learning
KR102664072B1 (en) * 2022-11-25 2024-05-09 고려대학교 산학협력단 Method and apparatus for fixing vulnerable smart contract

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018128723A (en) 2017-02-06 2018-08-16 株式会社日立製作所 Credibility management system and credibility management method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6745160B1 (en) 1999-10-08 2004-06-01 Nec Corporation Verification of scheduling in the presence of loops using uninterpreted symbolic simulation
US7146352B2 (en) 2003-06-23 2006-12-05 Microsoft Corporation Query optimizer system and method
US10715331B2 (en) 2016-12-28 2020-07-14 MasterCard International Incorported Method and system for providing validated, auditable, and immutable inputs to a smart contract

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018128723A (en) 2017-02-06 2018-08-16 株式会社日立製作所 Credibility management system and credibility management method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
COMPLUTENSE UNIVERSITY OF MADRID 외 1
Elvira Albert외 4, ‘SAFEVM: A Safety Verifier for Ethereum Smart Contracts’, ISSTA19, 2019.07.15.*
Yuepeng Wang외 6, ‘Formal Specification and Verification of Smart Contracts in Azure Blockchain’, 2019.04.29.*

Also Published As

Publication number Publication date
KR20210041310A (en) 2021-04-15

Similar Documents

Publication Publication Date Title
JP5992622B2 (en) Malicious application diagnostic apparatus and method
CN103262088B (en) The method and apparatus of the downgrader code in evaluate application code
CN110532176A (en) A kind of formalization verification method, electronic device and the storage medium of intelligence contract
KR102269174B1 (en) Appratus and method for verification of smart contracts
JP2015041167A (en) Evaluation apparatus for evaluating a security threat and method thereof
WO2019180701A1 (en) A method and system for detecting and preventing issues in smart contracts based on historical behavior analysis
CN103577323A (en) Dynamic key command sequence birthmark-based software plagiarism detecting method
US8473882B2 (en) Method and system for scalable reduction in registers with SAT-based resubstitution
Duan et al. Towards automated safety vetting of smart contracts in decentralized applications
JP5868515B2 (en) Signature verification apparatus, signature verification method and program
US20140366146A1 (en) Interactive analysis of a security specification
KR102378377B1 (en) Apparatus and method for obtaining vulnerable transaction sequence in smart contract
US9998495B2 (en) Apparatus and method for verifying detection rule
JP7008879B2 (en) Information processing equipment, information processing methods and information processing programs
Pan et al. Automated generation of security-centric descriptions for smart contract bytecode
WO2019142335A1 (en) Security design device, security design method, and security design program
JP6818568B2 (en) Communication device, communication specification difference extraction method and communication specification difference extraction program
Zhioua et al. Framework for the formal specification and verification of security guidelines
CN115809466B (en) Security requirement generation method and device based on STRIDE model, electronic equipment and medium
CN115022002B (en) Verification mode determining method and device, storage medium and electronic equipment
US20240045955A1 (en) Identifying security events in programming code for logging
CN109064308B (en) Credit classification method, apparatus, computer device and storage medium
Del Carmen Framework of Hardware Trojan Detection Leveraging Structural Checking Tool
CN117725594A (en) Multiple composite detection method, device, equipment and storage medium of intelligent contract
CN106650445B (en) A kind of rogue program recognition methods

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right