Human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection

Through the human-machine collaborative visual analysis method, using technical means such as SegRank and time series view, the problem of discovering anomalies in ERC-20 smart contracts has been solved, multi-dimensional and multi-angle analysis of smart contracts has been achieved, and the efficiency and accuracy of anomaly supervision has been improved.

CN116257665BActive Publication Date: 2025-09-26BEIJING INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310106523.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-13
Publication Date
2025-09-26
Estimated Expiration
2043-02-13

AI Technical Summary

Technical Problem

Existing technologies make it difficult to effectively monitor and detect anomalies in ERC-20 smart contracts. There is a possibility of loopholes and anomalies, and they are difficult to modify and verify, which affects the economic operations in the Industrial Internet.

Method used

A human-computer collaborative visual analysis method is adopted to analyze the similarities and specificities by constructing monthly indicators between smart contract overviews, and SegRank visualization technology is used to analyze absolute and relative fluctuation patterns. Combined with time series view and news view, abnormal fluctuations and event factors of smart contracts are explored.

Benefits of technology

It realizes multi-angle and multi-dimensional analysis of ERC-20 smart contracts, can detect abnormal fluctuations and explore the event factors behind them, support users to understand the overall changes and fine-grained characteristics of smart contracts, and improve the efficiency and accuracy of anomaly detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257665B_ABST
    Figure CN116257665B_ABST
Patent Text Reader

Abstract

The present invention discloses a human-machine collaborative visual analysis method for detecting anomalies in ERC-20 smart contracts, including: constructing monthly indicator analysis similarities and specificities between smart contract overviews; visually comparing the local and overall distributions of multiple time-series indicators of filtered smart contracts to identify abnormal intervals of the indicators; mapping news events related to associated smart contracts through a circular filling optimization algorithm to understand the development context of the news events; accurately associating fluctuation patterns with events to understand the event factors behind abnormal fluctuations; and obtaining the relationship between events in the news view and the mutual communication between smart contracts. The method has the ability to analyze the evolution patterns of multiple smart contracts. The analysis system needs to present an overview of the overall changes in smart contracts, supporting users to establish a holistic understanding of the evolution patterns of all smart contracts. The method can identify objects of interest for comparison.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of blockchain visualization and human-computer interaction technology, and specifically relates to a human-computer collaborative visual analysis method for anomaly detection in ERC-20 smart contracts. Background Art

[0002] A smart contract is a special agreement that can be automatically executed, that is, it automatically executes, controls or records events and actions according to the terms of the contract or agreement. The purpose is to reduce the need for trusted intermediaries, arbitration costs and fraud losses, as well as reduce malicious and unexpected exceptions. Smart contracts are usually customized for use in blockchains. The specific content is the relevant code that describes the transaction rules and transaction processes of multi-party collaboration in the blockchain. These rules and processes are deployed in the blockchain nodes of the relevant participants in the form of code. Smart contracts are provided by the blockchain to verify and execute the conditions stipulated in the contract. It is the foundation for the formation of "Blockchain 2.0". The new technical system has brought huge challenges to the use of smart contracts. First of all, because smart contracts are software programs written and operated in a "Turing complete" computer programming language, although Turing completeness makes one While all computable problems can be calculated, smart contracts present challenges for analysis and fault tolerance. Smart contracts are difficult to modify, making altering smart contract processes nearly impossible. Correcting any errors in the code is extremely time-consuming and expensive. Furthermore, ensuring that agreed-upon terms are met using smart contracts is difficult, leading to the potential for vulnerabilities and anomalies. The difficulty of modifying smart contracts and their lack of third-party verification magnify the impact of these vulnerabilities and anomalies. Some smart contracts are based on the ERC-20 standard, currently the most widely used. Within the Industrial Internet, ERC-20 smart contracts play a crucial role in integrating digitalization, networking, and standardization across various industrial sectors. Analysis of these smart contracts offers valuable insights into the future economic operations of blockchain-based industrial Internet. Vulnerabilities and anomalies in ERC-20 smart contracts exhibit diverse patterns. Therefore, for effective oversight of ERC-20 smart contracts, identifying anomalies through visual analysis and human-computer interaction is a crucial approach.

[0003] Based on the above technical problems existing in the prior art, the present invention proposes a human-machine collaborative visual analysis method for anomaly detection of ERC-20 smart contracts. Summary of the Invention

[0004] The purpose of this invention is to address the deficiencies of the existing technology and provide a human-machine collaborative visual analysis method for detecting anomalies in ERC-20 smart contracts, including:

[0005] Step 1: Build monthly indicators to analyze similarities and specificities between smart contract overviews, find abnormal smart contract objects, and present the filtered smart contracts in the evolution pattern view;

[0006] Step 2: Visually compare the local and overall distributions of the filtered smart contract's various time series indicators to identify abnormal intervals of the indicators. View the specific details of the indicators and display the degree of change in the smart contract, and change the news object mapped in the time series view.

[0007] Step 3: Observe the smart contract volatility pattern in the Evolution Mode view and display the abnormal differences between the daily indicator fluctuations of the smart contract of interest and the overall smart contract volatility in the Time Series view. Use the circle filling optimization algorithm to map news events related to the associated smart contract to understand the development context of the news events. Combine the Evolution Mode view and the Overview view to find the news events corresponding to the abnormal fluctuations, select the relevant news, and display the corresponding news information in the News view.

[0008] Step 4: Obtain news event trends in the time series view. Combined with fluctuation patterns, use the news view to understand the details of the news events corresponding to abnormal fluctuations. Accurately associate the fluctuation patterns with the events to understand the event factors behind the abnormal fluctuations.

[0009] Step 5: Accurately associate the fluctuation pattern with the event, analyze the status changes of the mutual flow between smart contracts through the relationship view, and reveal the relationship between the events in the news view and the mutual communication between smart contracts.

[0010] Furthermore, in step 1:

[0011] Statistical indicators of smart contracts include total recognition, unit recognition, and usage. Total recognition is the value of the smart contract determined by user usage in the form of US dollars. Unit recognition is a basic unit of measurement in each ERC-20 smart contract. Usage includes the average monthly number of users, the average monthly number of sender users, the average monthly number of recipient users, monthly usage, the monthly number of exchange units, and transaction costs.

[0012] Furthermore, in step 2:

[0013] According to the large data size gap between smart contracts, their absolute and relative fluctuations are compared, and SegRank visualization technology is used to analyze the absolute and relative fluctuation patterns of smart contracts. SegRank segments the indicator sequence data of each smart contract and records the i-th smart contract as Token i , record time period j as Slotj , Token i In Slot jThe pointer inside is Seg ij , where the scale of each segment of the line graph visualization is based on Seg ij The indicator value range is calculated based on the average value of the smart contract indicator calculated by segment, and the segments are arranged vertically and sorted according to the size of the average value.

[0014] Furthermore, in step 2:

[0015] Add connecting lines of different shapes between segments, and use the width ratio difference at both ends of the connecting line to map the growth or decrease ratio of the smart contract between adjacent months. The calculation method of the width at both ends of the connecting line is as follows:

[0016] W l =h×d l / max(d l , d r ), W r =h×d r / max(d l , d r )……(1),

[0017] Among them, W l Indicates the width of the left side of the connection, W r Indicates the width of the right side of the line, h indicates the maximum width of the line, that is, the strip width, d l Indicates the size of the current statistical indicator for the month on the left side of the line, d r Indicates the size of the current statistical indicator for the month on the right side of the line;

[0018] The layout mode of each strip with the same height in the visualization is defined as equal height mode. The comparison view is switched to geometric mode. In geometric mode, the height of different smart contract strips is positively correlated with the proportion of each month's statistical data in the sum of all smart contract statistical data. The greater the proportion of smart contracts in that month, the greater the height of the corresponding strip. In geometric mode, the width of the line between two strips reflects the change between the two months. The calculation formula of strip width is (2):

[0019] W l =min(h l , h r )×d l / max(d l , d r ), W r =min(h l , h r )×d r / max(d l , d r )……(2),

[0020] Among them, W l Indicates the width of the left side of the connection, W r Indicates the width of the right side of the line, h l Indicates the width of the month strip on the left side of the line, h r Indicates the width of the strip to the right of the line for the month, d l Indicates the size of the current statistical indicator for the month on the left side of the line, d r Indicates the size of the current statistical indicator for the month on the right side of the line;

[0021] The height-conforming mode and ratio-conforming mode allow users to understand the evolution trend of smart contracts. By hovering the mouse and clicking interactively, users can view the specific details of the indicator and the degree of change of the smart contract, obtain the abnormal range of the indicator, and understand the event factors behind the abnormal fluctuation through the time series view.

[0022] Furthermore, in step 3:

[0023] The time-series news view uses a line chart to visualize the changes in the sum of daily statistics of all smart contracts, and another line chart maps the changes in the sum of daily statistics of the selected smart contract. The scales of the data behind the two line charts in the time-series news view are different. The time-series news view is associated with news data, and the news layout is filled using circle filling. News about the selected smart contract is laid out on the time-series view using a circle filling algorithm. Each circle maps a piece of news about the smart contract. The size of the circle reflects the number of views of the news, and the color of the circle reflects the sentiment of the news.

[0024] To ensure that users clearly understand the temporal development trend of news, the positions of the circles corresponding to the news should maintain the order of the corresponding news as much as possible. To prevent the corresponding time of the circles on the timeline from misleading users about the news release time, the news should be arranged within the timeline range of the corresponding month as much as possible, that is, the news of each month is directly mapped to the space corresponding to that month. The circle layout problem is abstracted to the problem of arranging the circles one by one in the corresponding rectangular space without overlapping each other, and at the same time, making the news time correspond to the horizontal position of the circles. The circles of each month's news are arranged in the rectangular area, and the news layout problem is defined as follows:

[0025] enter:

[0026] (x' i ,r i ),i=1,…,N……(3),

[0027] Solution:

[0028]

[0029] Among them, δ ij∈ {0, 1}, i < j = 1, …, N, if x' i -x’ j ≥ 0 and x i -x j ≥ 0 then δ ij = 0 otherwise δ ij = 1;

[0030] Constraint: r i ≤ x i ≤ A - r i ……(5),

[0031]

[0032] where, x' i is the position of the news corresponding time on the time axis, r i maps to the radius of the circle representing the news. To find the optimal position (x i , y i ) of the circular layout, set the following two constraints: The abscissa x i of the final circular layout cannot exceed the interval of the month where the news is located; The circles cannot overlap with each other. Among them, the optimization objectives of the optimal circular layout include three aspects: The offset between the abscissa x i of the optimal circular layout and the initial abscissa x' i is as small as possible; The difference between the maximum ordinate and the minimum ordinate of the circles within each month is as small as possible, so as to improve the space utilization rate; The relative order change of the abscissa x i size between the final layouts of the circles within each month and the relative order of the initial abscissa x' i size is as small as possible. The weights among the three can be modified by the weight coefficients α, β, γ, and the default values of the three weight coefficients are 1;

[0033] After determining the definition requirements of the news layout, in order to solve the news layout problem, the idea of an optimization algorithm is adopted to determine the final layout of the news. The optimization algorithm called COBYLA is used. COBYLA is a gradient-free optimizer that creates a linear approximation of the objective and constraints for points in the design space, enabling it to find the optimal value within the trust region. As the algorithm moves towards the optimal direction, the radius of the trust region is modified. The COBYLA optimization algorithm has relatively strong spatial search ability and is not prone to overfitting in spatial search problems compared to the SLSQP gradient optimizer. In addition, in order to prevent local overfitting, the initial value of y is randomly generated. To prevent the distance constraints between news from not being effectively exerted due to overfitting.

[0034] Furthermore, in step 4:

[0035] Each news item in the news view includes the news release date, title, number of views, and number of shares.

[0036] The beneficial effects of the present invention are:

[0037] 1. The human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection described in this invention has the ability to analyze the evolution patterns of multiple smart contracts. The analysis system needs to present an overview of the overall changes in smart contracts, supporting users to establish a holistic understanding of the evolution patterns of all smart contracts. Through this method, it is possible to identify objects of interest for comparison.

[0038] 2. The human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection described in this invention is capable of presenting the specific details of each smart contract. After establishing an overview of the overall situation, it is necessary to understand the change pattern of the smart contract in a fine-grained manner. This method analyzes the characteristics of smart contracts in detail from the overall to the local.

[0039] 3. The human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection described in this invention has the ability to analyze smart contract fluctuations from multiple angles. In addition to the absolute changes in multiple indicators of the smart contract itself, it is necessary to analyze the relative fluctuations between smart contracts and reflect the changes in the market position of smart contracts. This method analyzes smart contract fluctuations from multiple angles.

[0040] 4. The human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection described in this invention has the ability to explore smart contracts in multiple dimensions.

[0041] 5. The human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection described in this invention has the ability to explore changes in smart contract indicators.

[0042] 6. The human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection described in this invention has the ability to explore the communication between smart contracts. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 This is a schematic diagram of a visualization analysis of smart contract fluctuations in an embodiment of the present invention;

[0044] Figure 2 This is the design idea and flow chart of the SegRank visualization form in the embodiment of the present invention;

[0045] Figure 3 A schematic diagram showing a comparison of the effects of the optimization algorithm in an embodiment of the present invention with the Fluxflow algorithm, the D3 force-directed algorithm, and the greedy algorithm;

[0046] Figure 4Schematic diagram of data analysis comparison between the optimization algorithm in an embodiment of the present invention and the Fluxflow algorithm, D3 force-directed algorithm, and greedy algorithm;

[0047] Figure 5 Schematic diagram of an overview of the analysis method in an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other unless there is a conflict.

[0049] Example

[0050] In this embodiment, a human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection is proposed to help users understand the fluctuations of various indicators such as the number of smart contract users and usage, as well as the correlation between different smart contracts, and provide explanations from a news perspective. For the discovery of smart contract anomalies, it is necessary to review their evolution, such as Figure 1 As shown, the evolution pattern of smart contracts is divided from two aspects: analysis object and pattern type. The analysis of a single smart contract emphasizes the change of indicators over time, and the analysis of multiple smart contracts emphasizes the comparison between them; according to the pattern type, it is divided into absolute change pattern and relative change pattern. The absolute change pattern emphasizes the absolute numerical difference of indicators, and the relative change pattern emphasizes the relative size relationship of indicators. In view of the correlation between the fluctuation of smart contract indicators and news, the present invention proposes a time series attribute driven circular filling optimization algorithm. The news of the selected smart contract is arranged on the time series view through the circular filling optimization algorithm, which can obtain the abnormal change information of the smart contract over time and determine the cause of the abnormality.

[0051] Specifically, the method includes:

[0052] Step 1: Use the monthly indicators of the smart contract overview constructed by the bar chart to analyze similarities and specificities, find smart contract objects that may have anomalies by interactively adding and deleting selections, and present the filtered smart contracts in the evolution pattern view;

[0053] Step 2: In the Evolution Mode view, use SegRank visualization technology to analyze the absolute and relative volatility patterns of the smart contract. Visually compare the local and overall distributions of the filtered smart contract's various time series indicators to identify abnormal intervals. Hover the mouse to view the specific details of the indicator and click the mouse to display the degree of change in the smart contract. Change the news object mapped in the time series view.

[0054] Step 3: Based on the observation of the smart contract volatility pattern in the Evolution Mode view, use a line chart in the Time Series view to display the abnormal differences between the daily indicator fluctuations of the smart contract of interest and the overall volatility of the smart contract. Use a circle filling optimization algorithm to map news events related to the associated smart contract to understand the development context of the news events. Combine the Evolution Mode view and the Overview view to find news events corresponding to the abnormal fluctuations, select the relevant news by clicking, and then display the corresponding news information in the News View;

[0055] Step 4: Understand the development trend of news events in the time series view and further understand the details of the news events corresponding to abnormal fluctuations through the news view in combination with the fluctuation pattern. Accurately associate the fluctuation pattern with the event to understand the event factors behind the abnormal fluctuation.

[0056] Step 5: After accurately associating the fluctuation pattern with the event, the status changes of the mutual flow between smart contracts are analyzed through the relationship view, revealing the relationship between the events in the news view and the mutual communication between smart contracts.

[0057] In step 1, to analyze the overview of multiple smart contract metrics, this embodiment calculates smart contract statistical metrics at a monthly granularity and uses bar charts for visualization. The overview view of multiple ERC-20 smart contracts is arranged vertically and aligned horizontally in a list format. Smart contract statistical metrics include total recognition, unit recognition, and usage. Total recognition is the value of the smart contract determined by user usage in the form of US dollars. Unit recognition is the value of the basic unit of measurement in each ERC-20 smart contract. Usage metrics include monthly average users, monthly average sender users, monthly average receiver users, monthly usage, monthly number of exchange units, and transaction costs. The color of each smart contract's bar indicates the continent where the smart contract's issuer is located. Due to the significant difference in values ​​between different smart contracts and the focus on identifying anomalies in metrics, the bar height is scaled based on the smart contract's own data. Bar charts for different smart contracts only reflect the trend of change, and their heights are not comparable. The list overview view allows users to switch between different metrics and select smart contracts with potential anomalies based on their attributes and trends for further analysis in other views.

[0058] In step 2: A typical feature of smart contract indicators is their wide fluctuation range and significant differences between different smart contract indicators. Using traditional line charts to visualize multiple indicators will greatly compress the vertical space occupied by most smart contracts due to extreme values. Line charts cannot clearly present the local relative change patterns of indicators with lower values. Using a sorting view completely loses the absolute change pattern of smart contract indicators and the local change characteristics of individual smart contract indicators. Indicators also include total recognition, unit recognition, and usage.

[0059] In response to the discovery of abnormal fluctuations in smart contract indicators, this embodiment proposes a SegRank visualization form. In order to present the relative change pattern of indicators, SegRank segments the indicator sequence data of each smart contract and records the i-th smart contract as Token i , record time period j as Slot j Token i In Slot j The inner mark is Seg ij , where the scale of each segment of the line graph visualization is based on Seg ij The indicator value range is calculated to avoid the spatial compression problem caused by extreme values ​​in the indicator data. Furthermore, SegRank visualization arranges the segments vertically according to the average value of the smart contract indicator calculated by segment and sorts them according to the size of the average value, which supports the analysis of relative changes between multiple smart contracts. The problem after splitting the smart contract indicator is that the absolute change pattern of the indicator is lost. Therefore, based on the above visualization form, connecting lines of different shapes are added between the segments, and the width ratio difference at both ends of the connecting line is used to map the growth or decrease ratio of the smart contract between adjacent months. The calculation method of the width at both ends of the connecting line is as follows, where W l Indicates the width of the left side of the connection, W r Indicates the width of the right side of the line:

[0060] W l =h×d l / max(d l , d r ), W r =h×d r / max(d l , d r ),

[0061] In order to analyze the absolute change patterns between multiple smart contracts, SegRank visualization adds different colored rectangles behind the line chart to map the changes in absolute values. The rectangular strips avoid the space waste caused by extreme values ​​in the indicators and improve space utilization efficiency. The strips of each month in SegRank use color to map the indicator values ​​of each day. Due to the huge gap between the indicator values ​​of smart contracts, SegRank normalizes the indicators in the range of (0, 1) and uses (0, 1 / 10 4 ], (1 / 10 4 , 1 / 10 3 ], (1 / 10 3 , 1 / 10 2 ], (1 / 10 2, 1 / 10] and (1 / 10, 1] five scale intervals nonlinear mapping method, the visualization form supports users to analyze the fluctuation of multiple smart contracts in the entire time interval;

[0062] In this embodiment, the layout mode in which each strip in the above visualization has the same height is defined as the equal height mode. In addition, the comparison view supports switching to the geometric ratio mode. In the geometric ratio mode, the height of different smart contract strips is positively correlated with the proportion of each month's statistical data in the sum of all smart contract statistical data. That is, the greater the proportion of the smart contract in that month, the greater the height of its corresponding strip. The advantage of the geometric ratio mode is that it supports users to analyze the weight of the corresponding indicators of smart contracts in each month, thereby helping users select smart contracts of interest as objects based on the proportion. In the geometric ratio mode, the width of the connecting line between the two strips still reflects the changes between the two months. The specific calculation formula for the strip width is as follows:

[0063] W l =min(h l , h r )×d l / max(d l , d r ), W r =min(h l , h r )×d r / max(d l , d r ),

[0064] Use the height and ratio modes to find abnormal intervals of indicators. Hover the mouse to view specific indicator details and click to display the degree of change in the smart contract. Identify abnormal intervals of indicators and explore the factors behind abnormal fluctuations through the time series view.

[0065] Among them, such as Figure 2 As shown in the figure, the construction process of the SegRank visualization starts from the original time series visualization, and constructs the SegRank visualization through four steps: splitting according to fixed time intervals, extracting local fluctuation patterns of smart contracts, using width to map numerical changes, and color to map absolute values.

[0066] In Step 3: To identify abnormal fluctuations from overall fluctuations, the Temporal News View first presents the changes in the sum of all smart contract daily statistics using a line chart visualization. To compare the change trends of the selected smart contract and the sum of statistics of all smart contracts in the List Overview View and the Evolution Mode View, the Temporal News View uses another line to map the changes in the sum of daily statistics of the selected smart contract. Users can locate special changes in smart contracts through this visual comparison method. The scales of the data behind the two line charts in the Temporal News View are different, so the two lines are only used to compare the change trends. When there are different or even opposite change situations between the two lines, it is of great significance for the discovery of abnormalities;

[0067] To explore the reasons for abnormal fluctuations in smart contracts, it is necessary to associate views with news data. Therefore, the Temporal View layouts the news of the selected smart contract on the Temporal View through a circular packing algorithm, using the way of circular packing to fill the news layout. The news of the selected smart contract is laid out on the Temporal View through the circular packing algorithm. Each circle maps a piece of news of the smart contract. The size of the circle reflects the number of views of the news of the smart contract, and the color can reflect the sentiment of the news of the smart contract. For example, blue represents a positive attitude, and red represents a negative attitude. The depth of the color reflects the intensity of the sentiment;

[0068] To ensure that the news of each month does not overflow into other months, causing the news to not correspond to its time attributes, the space occupied by each month is defined, and the news of each month is directly mapped into the corresponding space of each month. The problem of circular layout is abstracted as the problem of laying out circles non-overlappingly one by one in the corresponding rectangular space, while ensuring that the news time corresponds as much as possible to the horizontal position of the circle;

[0069] The problem of news layout is abstracted as an optimization problem, that is, laying out the circles of news of each month in a rectangular area. The optimization problem is defined as follows:

[0070] Input:

[0071] (x’, i ,r i ), i = 1, …, N;

[0072] Solve:

[0073]

[0074] where, δ ij ∈ {0, 1}, i < j = 1, …, N, if x' i - x' j ≥ 0 and x i - x j ≥ 0 then δ ij = 0 otherwise δij =1;

[0075] Constraint: r i ≤x i ≤Hr i ;

[0076]

[0077] Among them, x' i is the position of the news on the timeline, r i Mapping the radius of the circle representing the news, in order to find the best position of the circle layout (x i ,y i ), set the following two constraints: (1) The horizontal coordinate x of the final circular layout i The optimization objectives of the optimal circular layout include three aspects: the horizontal coordinate x of the circle i With the initial horizontal coordinate x' i The offset between the circles is as small as possible; the difference between the maximum vertical coordinate and the minimum vertical coordinate of the circle in each month is as small as possible, so as to improve space utilization; the horizontal coordinate x between the final layout of the circles in each month is as small as possible. i The relative order of size and the initial horizontal coordinate x' i The relative order of size changes as little as possible, and the weights between the three can be modified by weight coefficients α, β, and γ. The default value of the three weight coefficients is 1;

[0078] To solve the news layout problem, the COBYLA optimization algorithm is used. COBYLA is a gradient-free optimizer that creates linear approximations of the objective and constraints for points in the design space, allowing it to find the optimal value within a trust region. As the algorithm moves toward the optimal direction, the radius of the trust region is modified. The COBYLA optimization algorithm has relatively strong spatial search capabilities and is less prone to overfitting in spatial search problems than the SLSQP gradient optimizer. In addition, to prevent local overfitting, the initial value of y is randomly generated to prevent the distance constraint between news items from being ineffective due to overfitting.

[0079] By constructing a news layout in the above way, the temporal distribution trend of news is effectively maintained, helping users to more quickly identify the events corresponding to abnormal fluctuations after finding them, and supporting fine-grained exploration of specific events through the news view.

[0080] In step 4: To support users in analyzing the causes of abnormal fluctuations, the news view displays the specific content of other news items on the same date as the selected news item. The news item corresponding to the circle selected by the user is placed first in the news view to prevent users from confusing the correspondence between the circle and the news item. Each news item in the news view includes the news release date, title, number of views, and number of shares. By focusing on the corresponding title, a brief content of each news item can be displayed. If you need to further read the specific content of the news item, you can further click the title link to the corresponding news website to read the specific news and understand the reasons behind the abnormal fluctuations.

[0081] In step 5: To explore the exchange between smart contracts, the monthly exchange value flow between smart contracts is used. The relationship view is divided into two modes: node-link graph mode and chord graph mode.

[0082] Based on the monthly exchange volume between smart contracts, the node-link graph model helps to clearly reflect whether there is exchange between smart contracts and the size of the exchange volume. The size of each node maps the exchange volume of each smart contract, and the width of each line maps the exchange volume generated by the exchange between two smart contracts.

[0083] The chord diagram model further maps the exchange direction between smart contracts and clearly reflects the proportion of the smart contract exchange volume each month. In the chord diagram visualization, color is used to map the exchange direction. For example, red represents inflow and blue represents outflow. The red and blue colors in the central ring reflect the exchange direction of each smart contract. The red and blue arcs in the outer circle of the chord diagram visualize the exchange volume between the smart contract and other smart contracts and sort them.

[0084] In order to further verify the technical effect of the method described in this embodiment, Figure 3-4 As shown, the optimization algorithm described in this embodiment is compared with the Fluxflow algorithm, the D3 force-directed algorithm and the greedy algorithm. Figure 3 In the example, the circles with black borders represent news within the September timeframe. The circular layout results from the Fluxflow and D3 force-directed algorithms exceed their corresponding timeframes, causing visual misleading to users. The greedy algorithm's circular layout, while maintaining its timeframe, has news primarily distributed at the beginning and end of the month, making it difficult to discern the distribution of news within the month. Furthermore, the space utilization is low. The optimization algorithm designed in this example ensures that the circular layout results are within their corresponding timeframes and improves the space utilization of the layout results.

[0085] exist Figure 4We randomly selected 25-400 news items and compared them by quantity classification. We compared four indicators: crossing the limit, time offset, relative order, and centering. The lower the four indicators, the better the layout effect. Figure 4 It can be seen that the size of these indicators is positively correlated with the number of news. The out-of-bounds amount is the most concerned indicator in the layout. Since locking news often requires monthly accuracy, news from different months should try not to cross each other's boundaries. The larger the out-of-bounds amount, the more out-of-bounds news there are. The greedy algorithm and the optimization algorithm both have better effects on the out-of-bounds amount indicator; the time offset reflects the degree of change between the horizontal coordinate of the final layout of the news and the initial position. The optimization algorithm has the best effect among the four algorithms; in addition to the time offset, the relationship between the relative order of the horizontal coordinate position of the news in the layout and the time order also reflects the time trend. The larger the relative order value, the worse the relative time order between the news. The optimization algorithm has the best effect among the four algorithms; the centering degree reflects the distance between the vertical coordinate of the news layout and the central axis of the vertical coordinate. The centering degree reflects the compactness and space utilization of the layout. The optimization algorithm, Fluxflow algorithm and D3 force-directed algorithm have better effects. The optimization algorithm has good results under the four indicators and different numbers of news.

[0086] Figure 5 This is an overview diagram of the method described in this embodiment. Step 1 uses a bar chart to construct a monthly indicator analysis of similarity and specificity between smart contract overviews, as shown in View A. Step 2 uses SegRank visualization technology to analyze the absolute and relative fluctuation patterns of smart contracts, and visually compares the local and overall distributions of multiple time series indicators of the filtered smart contracts, as shown in View B. Step 3 uses a line chart in the time series view to display the abnormal differences between the fluctuations of the daily indicators of the smart contracts of interest and the overall fluctuations of the smart contracts, and maps the news events related to the associated smart contracts through a circle filling optimization algorithm, as shown in View C. Step 4 grasps the development trend of news events in the time series view and further understands the details of the news events corresponding to the abnormal fluctuations through the news view in combination with the fluctuation pattern, as shown in View D. Step 5 After accurately associating the fluctuation pattern with the event, the relationship view is used to analyze the changes in the status of the mutual flow between smart contracts, as shown in View E.

[0087] The present invention is not limited to the above-described embodiments. The above-described embodiments and descriptions are merely illustrative of the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the present invention. The scope of protection claimed in the present invention is defined by the appended claims.

Claims

1. A human-machine collaborative visual analysis method for ERC-20 smart contract anomaly detection, characterized by: include: Step 1: Build monthly indicators to analyze similarities and specificities between smart contract overviews, find abnormal smart contract objects, and present the filtered smart contracts in the evolution pattern view; Step 2: Visually compare the local and overall distributions of the filtered smart contract’s various time series indicators, find the abnormal intervals of the indicators, view the specific details of the indicators and display the degree of change of the smart contract, change the news object mapped by the time series view, and use SegRank visualization technology to analyze the absolute and relative fluctuation patterns of the smart contract. SegRank segments the indicator sequence data of each smart contract and records the i-th smart contract as Toekn i , record time period j as Slot j Token i In Slot j The inner mark is Seg ij , where the scale of each segment of the line graph visualization is based on Seg ij The indicator value range is calculated. According to the average value of the smart contract indicator calculated by segment, the segments are arranged vertically and sorted according to the size of the average value. Connecting lines of different shapes are added between the segments. The difference in the width ratio at both ends of the connecting line is used to map the growth or decrease ratio of the smart contract between adjacent months. The calculation method of the width at both ends of the connecting line is as follows: W l =h×d l / max(d l ,d r ),W r =h×d r / max(d l ,d r )……(1), Among them, W l Indicates the width of the left side of the connection, W r Indicates the width of the right side of the line, h indicates the maximum width of the line, that is, the strip width, d l Indicates the size of the current statistical indicator for the month on the left side of the line, d r Indicates the size of the current statistical indicator for the month on the right side of the line; The layout mode of each strip with the same height in the visualization is defined as equal height mode. The comparison view is switched to geometric mode. In geometric mode, the height of different smart contract strips is positively correlated with the proportion of each month's statistical data in the sum of all smart contract statistical data. The greater the proportion of smart contracts in that month, the greater the height of the corresponding strip. In geometric mode, the width of the line between two strips reflects the change between the two months. The calculation formula of strip width is (2): W l =min(h l ,h r )×d l / max(d l ,d r ),W r =min(h l ,h r )×d r / max(d l ,d r )……(2), Among them, W l Indicates the width of the left side of the connection, W r Indicates the width of the right side of the line, h l Indicates the width of the month strip on the left side of the line, h r Indicates the width of the strip to the right of the line for the month, d l Indicates the size of the current statistical indicator for the month on the left side of the line, d r Indicates the size of the current statistical indicator for the month on the right side of the line; The height and ratio modes are used to help users understand the evolution trend of smart contracts. By hovering the mouse and clicking interactively, users can view the specific details of the indicators and the degree of change of the smart contracts, obtain the abnormal interval of the indicators, and understand the event factors behind the abnormal fluctuations through the time series view. Step 3: Observe the volatility pattern of the smart contract in the evolution pattern view and display the abnormal difference between the volatility of the daily indicators of the smart contract of interest and the overall volatility of the smart contract in the time series view. Use the circle filling optimization algorithm to map the news events related to the associated smart contract to understand the development context of the news events. Combine the evolution pattern view and the overview view to find the news events corresponding to the abnormal volatility. Select the relevant news and display the corresponding news information on the news view. The time series news view uses a line chart to visualize the changes in the sum of the daily statistical data of all smart contracts. Another line chart maps the changes in the sum of the daily statistical data of the selected smart contract. The scales of the data behind the two line charts in the time series news view are different. Associate the time series news view with the news data and fill the news layout using circle filling. The news of the selected smart contract is laid out on the time series view using the circle filling algorithm. Each circle maps a piece of news about the smart contract. The size of the circle reflects the number of views of the news, and the color of the circle reflects the sentiment of the news. Map the monthly news directly to the space corresponding to that month, and abstract the circular layout problem into the problem of placing the circles one by one in the corresponding rectangular space without overlapping each other, while making the news time correspond to the horizontal position of the circles. Layout the circles of each month's news in the rectangular area, and then define the layout problem of the news as follows: enter: (x′ i ,r i ),i=1,…,N……(3), Solution: where, δ ij ∈ {0, 1}, i < j = 1, …, N, if x′ i - x′ j ≥ 0 and x i - x j ≥ 0 then δ ij = 0 otherwise δ ij = 1; Constraint: r i ≤x i ≤Ar i ……(5), Where x′ i is the position of the news on the timeline, r i Mapping the radius of the circle representing the news, in order to find the best position of the circle layout (x i ,y i ), set two constraints: the horizontal coordinate x of the final circular layout i The circle cannot exceed the interval of the month in which the news is located; the circles cannot overlap with each other. The optimization objectives of the optimal layout of the circle include three aspects: the horizontal coordinate x of the circle i With the initial horizontal coordinate x′ i The offset between the two circles is as small as possible; the difference between the maximum vertical coordinate and the minimum vertical coordinate of the circle in each month is as small as possible, so as to improve the space utilization; the horizontal coordinate x between the final layout of the circles in each month is i The relative order of size and the initial horizontal coordinate x′ i The relative order of size changes as little as possible, and the weights between the three are modified by weight coefficients α, β, and γ. The default value of the three weight coefficients is 1; Solve the news layout problem and use optimization algorithms to determine the final layout of the news. Create linear approximations of the objectives and constraints for points in the design space to find the optimal value within the trust region. As the algorithm moves towards the optimal direction, the radius of the trust region is modified. Step 4: Obtain news event trends in the time series view. Combined with fluctuation patterns, use the news view to understand the details of the news events corresponding to abnormal fluctuations. Accurately associate the fluctuation patterns with the events to understand the event factors behind the abnormal fluctuations. Step 5: Accurately associate the fluctuation pattern with the event, analyze the status changes of the mutual flow between smart contracts through the relationship view, and reveal the relationship between the events in the news view and the mutual communication between smart contracts.

2. The human-machine collaborative visual analysis method for detecting anomalies in ERC-20 smart contracts according to claim 1 is characterized in that: In step 1: Statistical indicators of smart contracts include total recognition, unit recognition, and usage. Total recognition is the value of the smart contract determined by user usage in the form of US dollars. Unit recognition is a basic unit of measurement in each ERC-20 smart contract. Usage includes the average monthly number of users, the average monthly number of sender users, the average monthly number of recipient users, monthly usage, the monthly number of exchange units, and transaction costs.

3. The human-machine collaborative visual analysis method for detecting anomalies in ERC-20 smart contracts according to claim 1 is characterized in that: In step 4: Each news item in the news view includes the news release date, title, number of views, and number of shares.

Citation Information

Patent Citations

  • Medical alliance chain lightweight dynamic autonomous cross-chain interaction method

    CN110993044A

  • Parallel blockchain fragmentation method based on intelligent contract optimization model

    CN111294234A