Blockchain Intelligence
Blockchain Intelligence
Abstract—Blockchain is gaining extensive attention due to its overcome shortcomings of AI, such as security and privacy
provision of secure and decentralized resource sharing manner. vulnerabilities [14]), this article mainly concentrates on im-
However, the incumbent blockchain systems also suffer from proving blockchain systems by applying AI technologies. In
a number of challenges in operational maintenance, quality summary, the main contributions of this article are summarized
assurance of smart contracts and malicious behaviour detection as follows:
of blockchain data. The recent advances in artificial intelligence
• We first give an overview of blockchain technology and
arXiv:1912.06485v3 [[Link]] 3 Apr 2020
Although blockchain and blockchain-enabled smart con- general purpose computer hardware such as graphic processing
tracts are promising in reshaping various industrial sectors, units (GPUs) have greatly driven the development of AI.
the intrinsic limitations of blockchain systems also lead to the Consequently, we have witnessed the proliferation of diverse
following challenges. AI applications such as computer vision, natural language
1) Operational maintenance. Due to the decentralization and processing, speech recognition, sentimental analysis. Big data
heterogeneity of blockchain systems, it is difficult to identify plays a critical role in propelling AI as well as AI applications.
the potential factors affecting the performance of blockchain. For example, deep learning mainly based on deep neural
For example, the transaction throughput bottleneck of Hyper- networks (DNNs) has achieved superior performance thanks
ledger Fabric is different from that of Bitcoin and Ethereum to the availability of massive data so that DNNs can extract
since different consensus algorithms are adopted. Moreover, (or learn) enough features from large volume of data.
like other software systems, smart contracts consist of a num- The appearance of diverse blockchain systems has generated
ber of computer programs, which may suffer from software the enormous volumes of blockchain data, which are publicly
bugs, malicious codes and incompatibility of running environ- available to everyone. Take Bitcoin as an example. As reported
ments. Consequently, it is crucial to achieve the intelligent by Statista ([Link] at the end of the third
and robust operational maintenance of complex blockchain quarter of 2019, Bitcoin contains nearly 242 GB data. Data
systems. analytics on the massive blockchain data cannot only extract
2) Quality assurance of smart contracts. Smart contracts huge business values but also bring great opportunities to
suffer from a number of software vulnerabilities such as re- overcome the aforementioned challenges of blockchain sys-
entrancy vulnerability [1], overcharging issue [3], randomness tems. The recent advances in AI have also greatly driven the
controlling [4] and Decentralized Autonomous Organization development of big data analytics [7]. Thus, the integration
(DAO) attack [5]. In addition, contract correctness is also of AI and blockchain technologies can potentially overcome
crucial to smart contracts since it is nearly impossible to make the aforementioned challenges of blockchain systems, thereby
any revisions once they are deployed on top of blockchains. forming intelligent blockchain systems. We name such inte-
However, like software systems, smart contracts often contain gration of blockchain with AI as blockchain intelligence. It is
programming bugs which may lead to crashes or misbe- worth mentioning that there are several research efforts [14],
haviours while it is challenging to detect and identify these [15] on integrating blockchain with AI while most of them
bugs due to the complexity of smart contracts. are mainly concentrated on exploiting blockchain for AI so as
3) Malicious behaviour detection. Besides legal businesses, to overcome the emerging security and privacy vulnerabilities
blockchain may be exploited for malicious activities which are of AI. In contrast to these studies, our work in this paper is
nevertheless difficult to be detected due to the pseudonymity mainly focused on solving the intrinsic issues of blockchains
of blockchain (i.e., anonymous blockchain addresses). On the by using AI technologies.
other hand, the encrypted blockchain data also leads to the
We summarize the opportunities brought by AI to enhance
difficulty of detecting and identifying malicious behaviours
incumbent blockchain systems as follows (as shown in Fig. 2).
via simply data analytics. Moreover, the massive volume and
heterogeneity of blockchain data as well as diversity of user 1) Intelligent operational maintenance of blockchain.
behaviours make the problem even worse. As a result, con- Blockchain generates huge amount of data in a real-time
ventional classification-based methods (e.g., machine learning manner. Analyzing blockchain data, we can detect the pos-
methods) cannot be directly applied. sible faults, forecast the failures and identify the perfor-
mance bottleneck so as to tune or adjust the performance of
blockchain systems. There are four different levels of data
III. O PPORTUNITIES BROUGHT BY A RTIFICIAL analytics including: descriptive analytics, diagnostic analytics,
I NTELLIGENCE predictive analytics and prescriptive analytics. In particular,
Artificial intelligence (AI) as a broad discipline covering the work of [8] presents a common platform to evaluate
machine learning and cognitive computing is an ability of intel- the performance of three representative blockchain systems:
ligent agents conducting intellectual tasks. The recent advances Ethereum, Parity and Hyperledger Fabric via descriptively
in big data, AI technologies (such as deep neural networks) and analyzing blockchain data. Meanwhile, the descriptive analyt-
3
1 Operational maintenance
of blockchain
Machine learning Data visualization Data mining
Real-time
Monitoring
Anomaly
detection
Intelligent
restoring
2 Quality assurance of
smart contracts
Anomaly detection Federated ML Data
preprocessing
contracts
Defect auto-
correction
Code auto-
optimization
ics of blockchain log data can help to monitor the real-time account addresses. The massive blockchain data brings the
performance of blockchain systems and identify the possible opportunities in auditing and detecting malicious behaviours.
faults [6]. In addition to diagnostic analytics on blockchain Big data analytics on massive blockchain data can help to
data, predictive analytics is also necessary to anticipate the per- identify malicious users, recognize behaviour pattern, analyze
formance bottleneck of blockchain systems. Unlike diagnostic market manipulation, detect scams. The work of [12] presents
and predictive analytics, prescriptive analytics can simulate and a cross-graph analysis on Ethereum data and identify several
optimize blockchain systems so as to improve the reliability major activities occurring on Ethereum blockchain platforms.
of blockchain systems. As in [10], a machine learning based approach was proposed to
2) Intelligent quality assurance of smart contracts. Like detect and capture Ponzi schemes that took place in Ethereum.
computer software, smart contracts may contain bugs or faulty The work of [13] analyzes the leaked transaction history of
programming codes, which are vulnerable to crashes and Mt. Gox Bitcoin exchange and identify a number of mar-
malicious attacks. It is crucial to detect and identify bugs ket manipulation patterns via singular value decomposition
in smart contracts so as to achieve the ultimate goal of (SVD) method. Moreover, malicious users may exploit multi-
intelligent quality assurance of smart contracts. The work ple anonymous accounts to form a criminal gang to conduct
of [9] presents a symbolic-execution platform namely Oyente illegal activities on blockchain systems. New machine learning
to detect and recognize potential bugs. Meanwhile, smart approaches as well as association analysis on multiple accounts
contracts are essentially program codes that are sensitive to are expected to address this issue.
execution cost (e.g., the execution of smart contracts is charged The advances in AI, machine learning and big data analytics
by gas in Ethereum). Thus, it is a necessity to identify the gas- bring numerous opportunities to address the aforementioned
costly patterns and correct these vulnerable smart contracts. blockchain challenges. We next present a case study to demon-
In [3], Chen et al. developed a tool namely GASPER to strate the feasibility of blockchain intelligence.
identify and locate seven gas-costly patterns via analyzing
bytecodes of Ethereum smart contracts. Machine learning
methods can be used to detect and recognize vulnerable bugs in IV. C ASE STUDY
smart contracts automatically. Moreover, the growing number Big data analytics of blockchain data is beneficial to fraud
of smart contracts also brings the opportunities to automate recognition of transactions and vulnerability detection of smart
the composition of multiple contracts. In particular, we can contracts. However, it is also challenging to conduct big
find and identify contracts that fulfill users’ requirements data analytics of blockchain data. 1) It is extremely time
and composite them together to realize more comprehensive consuming to download the entire blockchain data due to
applications. Different from conventional distributed software the bulky blockchain size, e.g., it took more than one week
systems such as web services [11], smart contracts lack of and over 500 GB storage space to fully synchronize (i.e.,
semantic description and Quality-of-Service (QoS) evaluation download) the entire Ethereum at a newly-joined peer. 2)
metrics. As a result, new AI-based approaches are expected It requires substantial efforts in extracting and processing
to automate labeling semantics of smart contracts and offer blockchain data. First, blockchain data is stored at clients in
data-driven QoS evaluation of smart contracts. heterogeneous and complex data structures, which cannot be
3) Automated malicious behaviour detection. The decentral- directly analyzed. Meanwhile, the underlying blockchain data
ized blockchain systems result in the difficulty in auditing is either binary or encrypted. Thus, it is a necessity to extract
malicious behaviours such as money laundering, phishing, and process binary and encrypted blockchain data so as to
gambling and scams that occurred in blockchain platforms. obtain valuable information while this process is non-trivial as
Blockchain systems have generated massive transaction data, conventional data analytic methods may not work for this type
which are essentially available to everyone, whereas the histor- of data. 3) There is no general data extract tool for blockchain
ical transaction data are pseudonymous through anonymizing data. Although several open source tools for blockchain data
4
log(GasPrice)
Receipt Contract B
GasPrice
24 2.0
22 1.5
Block Receipt Trace
Trace 1.0
20 0.5
(b) Processed 180 100 200 300 400 500 600 700 800 0.00 200 400 600 800 1000
Datasets Per 10000 Block Per 20 Block
Block and Internal Ether Contract Contract ERC20 Token ERC721 Token
Transaction Transaction Info Calling Transaction Transaction (a) Macro view of GasPrice (b) Micro view of GasPrice
● 120th ●
● ●
●
●
●
● ●
●●●
●●●
20th ●
●
●● ● ●
●●
● 105th
●●
●
●
●
●
●● ● ● ● ●●● ● ●
●● ● ●● ●● ● ●
●●
● ● ●●● ●
● ●
● ● ● ●
●
●
●
●●
● ●
●● ● ●●●●
●● ● ●●● ● ● ●● ●●
●● ●
●●
● ● ● ● ●● ● ●
● ● ●●
Amount 90th ● ●●●
●●
●● ●
● ● ● ● ●
● ●
● ● ● ● ●● ● ● ● ●●● ● ●●●●● ● ● ●● ● ●
●
● ●
● ●●
●● ●● ● ●
Direction
●● ● ●
No. of participants
No. of participants
●● ● ● ●
● ●● ●
● ● ●● ● ●
● ●
● ● ●● ● ●●● ● ●
● ● ●
● ● ● ● ●● ● ● ● ● ● ● ● 0.5 ●●
●
●
●● ● ●
●●
●
Investment
● ● ●
15th ●● ● ●● ● ●● ●● ● ● ●
●
●● ● ●● ● ●● ● ●●
● ● ● ● ● ●●
1.0 75th ●●●
●●
● ●
● ●● ● ● ●●● ●● ● ● ● ● ●●●
●●●● ●
● ● ● ●
● ●●
●
● ●●●●
● ● ● ●● ●●
● 1.5 ●●
●●
●
●
●
●
● Payment
●● ●● ●●
● ● ●●
●● ● ● ● ● ●●
●● ●●
● ● ●● ●
●●●
● ● ● ●●● ●●
● ● ● ●●
● ●● ●●
● ● ●● ●●
●
●● ● ●● ●● ●● ●● ● ●● ● ● ●● ● ● ● ●
● ● ● ●● ●
● ● 2.0 60th
●
●
●
●
●●
● ● ●● ● ●
● ●● ● ●● ●
●● ● ● ●● ● ●● ● ●● ●●
●
●● ●
●● ● ●
●●●
● ●● ●
● ● ●● ●●● ●
●●
●● ● ● ●
●● ●● ● Amount
●
10th ●● ● ●●●● ●●●● ●● ●
●
● ● ●● ● ●● ●
● ● ● ●●● ● ●●● ●
●● ● ● ●
Direction 45th
●
●
●●
● 50
● ●● ● ●
● ● ● ● ● ●● ●● ● ● ● ● ●●●● ● ● ●
● ● ● ● ● ●● ●
●●
● ● ●● ● ●● ●●● ●●
●
●
●● ● ● ● ●● ● ● ●
● ● ● ● ● ●● ●● ●●
● ● ●
● ● ●●● ● ● ● ● ●● ●● ● ●
● Investment ●●
●
●
● ● 100
●● ● ●
● ●
●●● ● ●
● ● ●●●
●● ●
● ● ●● ●● ● ●● ● ● ● ● ● ●● ● ●● ●
● Payment 30th ●
●●
●
●
●
●
● 150
● ●●
● ●●
●● ● ●● ● ●
●● ●● ● ●● ● ● ● ●● ● ●● ● ● ●
● ● ●
●● ●●
●
●
5th ●● ●
● ● ● ● ● ●●● ●● ●
● ● ●● ●
● ●● ● ●●● ●● ●● ● ●
● ●●●
● ●● ●● ●● ● ● ● ● ●●●● ●
●
●
●●
●
●●
● ● ●
●● ●
●
●
● ● ● ● ● ●● ● ● ● ● ● ●● ● ●●● ●
●
● ● ● ●● ● ●● ●● ●●●
●●●● ● ●● ● ●● ● ● ● ●
15th ●●
●
●
●●
●
●●●
●
●
●
●
●●●
●
●
●
●
●
●● ● ●●●
●
●
●
● ● ● ●● ●
●● ● ● ● ●
●
●● ● ●● ● ● ● ●● ●●●
●
●● ● ● ●●
●● ●●
● ● ●●
● ●
●
●
●
●●
●●
●
●●
● ●
●●●
●
●●
●
● ●
● ● ● ●●
●● ●
● ●●● ●● ● ● ●● ●
●
●● ● ●
● ●●● ● ● ●●● ● ●● ● ● ●
● ● ●
●
●
●
●
●● ●
●●●● ● ●
●
●● ●● ●
●●●●
●
● ●
● ● ● ●● ● ● ● ● ●
●
1th ● ● 0th
2016−02−18 02−19 02−20 02−22 02−23 02−24 02−25 02−27 2016−03−14 2016−03−20 2016−04−05 2017−08−19
Time Time
(a) LooneyLottery contract (i.e., normal contract) (b) Rubixi contract (i.e., Ponzi scam contract)
blockchain system so as to offer a trustworthy and [8] T. T. A. Dinh, R. Liu, M. Zhang, G. Chen, B. C. Ooi and J. Wang, “Un-
intelligent provision of blockchain services. tangling Blockchain: A Data Processing View of Blockchain Systems,”
IEEE Transactions on Knowledge and Data Engineering, vol. 30, no. 7,
• Integrating multiple machine learning approaches to pp. 1366-1385, 1 July 2018
monitor and supervise blockchain data. Decentralization [9] L. Luu, D.-H. Chu, H. Olickel, P. Saxena, and A. Hobor, “Making Smart
of blockchain brings the difficulty in monitoring and Contracts Smarter,”Proceedings of the 2016 ACM SIGSAC Conference
supervising transactions in blockchain platforms, con- on Computer and Communications Security (CCS ’16), 2016
sequently resulting in a number of illegal behaviours. [10] W. Chen, Z. Zheng, J. Cui, E. Ngai, P. Zheng, and Y. Zhou, “Detecting
Meanwhile, both heterogeneity and pseudonymity of Ponzi Schemes on Ethereum: Towards Healthier Blockchain Technol-
blockchain data make this situation even worse. In the ogy,” Proceedings of the 2018 World Wide Web Conference (WWW ’18),
1409-1418.
future, multiple machine learning approaches should be
[11] P. Rodriguez-Mier, C. Pedrinaci, M. Lama and M. Mucientes, “An Inte-
integrated together to extract key features from different grated Semantic Web Service Discovery and Composition Framework,”
types of blockchain data. In addition, a dynamic graph IEEE Transactions on Services Computing, vol. 9, no. 4, pp. 537-550, 1
(or network) of transactions is also expected to identify July-Aug. 2016.
the association between different accounts so as to [12] T. Chen et al., “Understanding Ethereum via Graph Analysis,”IEEE
recognize the malicious behaviours. INFOCOM 2018 - IEEE Conference on Computer Communications,
2018, pp. 1484-1492.
[13] W. Chen et al., “Market Manipulation of Bitcoin: Evidence from Min-
R EFERENCES ing the Mt. Gox Transaction Network”,IEEE Conference on Computer
Communications, 2019, pp. 964-972.
[1] X. Li, P. Jiang, T. Chen, X. Luo, Q. Wen, “A survey on the security [14] T. N. Dinh and M. T. Thai, “AI and Blockchain: A Disruptive Integra-
of blockchain systems”, Future Generation Computer Systems, 2017, tion”, Computer, vol. 51, no. 9, pp. 48-53, September 2018.
[Link] [15] Nassar, M, Salah, K, ur Rehman, MH, Svetinovic, D., “Blockchain for
[2] N. Szabo, “The idea of smart contracts”, Nick Szabo’s Papers explainable and trustworthy artificial intelligence”, WIREs Data Mining
and Concise Tutorials. [Link] Knowl Discov, 2020; 10:e1340. [Link]
InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.
[Link]/smart contracts [Link]
[3] T. Chen, X. Li, X. Luo, X. Zhang, “Under-optimized smart contracts
devour your money”, Proceedings of 24th International Conference on
Software Analysis, Evolution and Reengineering (SANER), 2017, pp.
442–446.
[4] J. Bonneau, J. Clark, S. Goldfeder, “On bitcoin as a public randomness
source”, IACR Cryptology ePrint Archive, 1015, 2015
[5] The DAO, The Hack, The Soft Fork and The Hard
Fork (2017). [Link]
the-dao-the-hack-the-soft-fork-and-the-hard-fork/
[6] P. Zheng, Z. Zheng, X. Luo, X. Chen, X. Liu, “A detailed and real-
time performance monitoring framework for blockchain systems,” 2018
IEEE/ACM 40th International Conference on Software Engineering:
Software Engineering in Practice Track, pp. 134–143, 2018. (conference
proceedings)
[7] H.-N. Dai et al., “Big data analytics for large-scale wireless networks:
Challenges and opportunities,”, ACM Computing Surveys, vol. 52, no. 5,
2019