Machine Learning in the World Of Blockchain
Why do they need to work together
Blockchain technology has been very popular in recent years. This
technology allows people to deal directly with each other in a secure way
via a highly secure and decentralized system, without intermediaries. It
may seem that, because of their different approaches to data, Blockchain
and Machine learning are purely independent disciplines. However, machine learning can help deal with the many limitations of blockchain-
based systems. The combination of these two technologies (Machine Learning and Blockchain Technology) can provide powerful and useful results.
Disclaimer: this medium was originally written in a report for a Dublin City University’s course.
1.1 Introduction to blockchain technologies
Blockchains let you store and exchange value on the internet without a centralized intermediary. They are the technological engine of crypto-currencies, the decentralized web and its corollary, decentralized finance.
A blockchain is a database that contains the history of all exchanges made between its users since its creation. This database is secure and distributed: it is shared by its various users, without intermediaries, which allows everyone to check the validity of the chain.
The transactions made between the users of the network are grouped into blocks. Each block is validated by nodes in the network called “miners”, using techniques that depend on the type of blockchain. In the Bitcoin blockchain this technique is called “Proof-of-Work” and consists of solving algorithmic problems.
Once the block is validated, it is time stamped and added to the blockchain. The transaction is then visible to the receiver and the entire network.
1.2 Introduction to machine learning
Machine Learning is a branch of science, and more specifically a sub-category of artificial intelligence. It consists in letting algorithms discover “patterns”, i.e. recurring models in data sets. This data can be numbers, words, images, statistics…
Anything that can be stored digitally can be used as data for Machine Learning. By detecting patterns in this data, the algorithms learn and improve their performance in performing a specific task.
In short, Machine Learning algorithms autonomously learn to perform a task or make predictions from data and improve their performance over time. Once trained, the algorithm will be able to find the patterns in new data.
1.3 Machine learning in the world of blockchain
To be effective, many artificial intelligence algorithms, and in particular Machine Learning, require large volumes of data whose value depends on its quality. It is in this sense that data defined as “the oil, some say the gold, of the 21st century” by Joe Kaeser, CEO of Siemens, on a recent tech forum in Stockholm (Shannon Tellis, 2018)¹. It is the indispensable fuel for AI models that are mainly aimed at classification or prediction.
In fact, the two main challenges faced by organisations that want to implement an AI solution are access to data and the quality of that data for training AI models. This lack of quality data means that some AI solutions do not have a sufficient training dataset and therefore perform poorly or not at all.
Blockchain is a technology that allows information to be stored and transmitted transparently, securely and without a central control authority.
Given these elements, in order to respond to the essential problem of access to quality data to train an AI model, it is quite possible to imagine a smart contract that would propose to a data owner to share its data within an eco-system via a blockchain. Indeed, many data owners refuse to sell their data to intermediaries or platforms but would not be opposed to sharing it with other organisations as long as this data sharing is done in a secure manner and in return for a fair remuneration linked to the use and quality of their data, which the blockchain allows.
This use case is just one example of what could be put in place. This is what we will study in the rest of this report.
2. Uses and Challenges
Cryptocurrencies operate on the same principle as the stock market. Just as the stock market can quickly fall or rise, the value of crypto currencies is highly volatile from one day to the next. Whether it’s a change in legislation, an emerging potential player or mining problems, the reasons for the rise or fall of blockchain assets are varied. Indeed, there are so many parameters to consider that it is impossible to make an accurate prediction of price changes at any given time. Also determining the market sentiment for crypto-currencies requires processing a large amount of different data. This includes articles, blogs, forums and even comments underneath them.
Artificial intelligence systems can collect millions of data per minute, or even per second, and offer a sophisticated predictive analysis of any given transaction on the blockchain. To do this, they use a number of technical indicators that can influence changes in market trend lines. Finally, this analysis is detached from any human sentiment and is therefore completely neutral.
The main prediction algorithm has a model that takes predictors, or inputs, and outputs (the daily price change of Bitcoin) and tries to learn a model from all the data. It keeps testing its models until it reaches an optimal point where further testing is redundant. These advanced models are the core of many AI learning programs used in business and engineering.
A few companies already use different AI learning programs to invest in crypto-currencies. Indeed, Helder Sebastião and Pedro Godinho examines, in 2021, the predictability of three major cryptocurrencies — bitcoin, ethereum, and litecoin — and the profitability of trading strategies devised upon machine learning techniques (e.g., linear models, random forests, and support vector machines)². They found positive results that support the claim that machine learning provides robust techniques for exploring the predictability of cryptocurrencies and for devising profitable trading strategies in these markets, even under adverse market conditions and If the model doesn’t work and Bitcoin (a cryptocurrency) remains unpredictable, then the model should still be a little more accurate than random.
2.2 Optimizing Mining Strategies
In a blockchain using a proof-of-work protocol, an equation must be solved in order to validate transactions. Miners compete for validation and test many possibilities. Once a transaction block is validated, the miner who has found the answer to the equation will be rewarded for his work with crypto-currency tokens. Depending on the period, this reward is more or less high and it therefore becomes more or less interesting to mine a particular crypto-currency because the material and electrical cost must be included.
In 2021, Taotao Wang, Soung Chang Liew, and Shengli Zhang presented the application of reinforcement learning(RL) for optimising blockchain mining strategy for cryptocurrencies like Bitcoin³.
Their research showed that it is possible to use reinforcement learning techniques to alternate crypto-currencies and adopt mining strategies that are more efficient than traditional strategies.
Miners can maximise the rewards they obtain in an environment.
The authors of the paper designed a multidimensional RL algorithm that uses Q Learning (model-free algorithm) to optimize crypto-currency mining.
2.3 Secure Blockchain
Among the problems that the blockchain sector still has to face, malware and other cyber attacks are at the top of the list. Despite the importance of this problem and the measures taken by many of the players involved, attacks on the blockchain are still mostly successful.
So far, cybersecurity systems based on artificial intelligence have proven to be the most effective in protecting the blockchain. They can instantly identify the nature of a threat. Then they blacklist it to prevent another intrusion. Better still, the AI evolves over time, multiplying its effectiveness with each threat.
Scicchitano et al. further described a research based on a Deep Learning Approach for Detecting Security Attacks on Blockchain (2020)⁴. They defined an anomaly detection system based on an encoder-decoder deep learning model that is trained to exploit aggregate information extracted by monitoring blockchain activities. Experiments on complete historical logs of Ethereum Classic network prove the capability of the model to effectively detect the publicly reported attacks.
Blockchain technology is robust, secure, trustworthy and private. It ensures security through robust architecture, secure design practices and effective workflow strategies. But any system has vulnerabilities, and AI could be a second line of defence against these flaws.
2.4 Futures usages
The simultaneous development of these two core technologies is reaching maturity. Used together, they have the potential to “Uberise” the platforms, to directly link the user and the producer.
A smart contract is an automated program or literally a “smart contract”. These contracts or programmes are computer protocols that aim to automate an action when the preconditions are met. The purpose of the smart contract is to allow the execution of all types of transactions, financial but not only. In addition to defining the rules of an agreement between several parties, it freezes the rules of the agreement in the blockchain by ensuring the transfer of an asset when the contractual conditions are met.The entire contractualisation process is therefore automated, from the drafting to the end of the contract, ensuring a certified process.
The opportunities for this new technology are vast. The sectors are varied, for example: insurance, logistics For example, if the owner stops making payments, the smart contract can invoke a protocol that automatically returns control of the vehicle key to the bank.
The pairing of a smart contract and an advanced AI could in theory be autonomous. The smart contract rewards with tokens any server that proves to it that it is hosting the AI, which allows the AI to stay “alive” and to continuously improve. The AI performs tasks that users pay for by sending tokens to the Smart Contract with which it is coupled.
Thus, for example, thanks to a blockchain, a hotelier could conclude a transaction directly with a customer in a transparent and secure manner (saving the commission of a platform). And also to conclude a “smart contract” with him, which will guarantee all the conditions to be respected between the two parties for the payment to be made or providing for compensation, thus avoiding the long and tedious stages of complaints for customers. Blockchain brings security and predictability, artificial intelligence, simplicity in the interaction.
According to the book ‘Legal Tech, Smart Contracts and Blockchain’, “There is a broad consensus amongst law firms that next generation “Legal Tech” — particularly in the form of Blockchain-based technologies and Smart Contracts — will have a profound impact on the future operations of all legal service providers.” (Corrales M. et al, 2019)⁵.
By adding Artificial Intelligence to the already established Blockchain-enabled smart contracts, the efficiency of the latter is exponentially increased. Thus, the need for human analysis, intervention and verification, is greatly reduced and a range of use cases could open up.
Just like humans, this combination could allow different machines to collaborate with each other. Multiple AIs could learn from each other, sharing databases, algorithms and paying each other for their services. While dealing with the real world through their financial resources.
Blockchain is expected to play a decisive role in the development of Artificial Intelligence and vice versa. Firstly, by facilitating the mutualisation of the databases needed to train AIs. Then by allowing the coupling of AIs to autonomous Smart Contracts.
3. Legal and ethical issues
3.1 Data protection
As all new technologies, the areas of application are not yet covered by the law and contain many ethical and legal issues. Not having a legal framework is in some cases a good thing, it allows a technology to mature and find its scope on its own.
In the context of crypto-currencies, issues such as how to deal with the case of organisations being used for illicit purposes? Who is responsible for the activities of an organisation that has no administrator? The problem is double: the creators are often anonymous; and stopping them would not block the operations of these organisations since they act completely autonomously on the blockchain. A machine learning algorithm that detects transactions with an illicit background could be a first obstacle.
It is also known that machine learning technology raises a number of ethical and legal issues, particularly as it requires a huge amount of data to operate. And unfortunately, many machine learning and AI algorithms are centralised, without any transparency in the process. The rapid increase in the adoption of AI globally has raised concerns about privacy, fairness and transparency.
3.2 Futures challenges
However, blockchain could solve the ethical and partiality problems in AI. It can be a ways to identify the sources and address the effects of data bias in the context of AI, and introduce a proportionate risk assessment and management framework. It can become an integral element in the ethics-by-design approach. This concept has been proposed
repeatedly by the European Parliament in a Framework of ethical aspects of artificial intelligence, robotics and related technologies (Kritikos M., 2020)⁶. These AIs would be decentralised and focused on privacy, including data collection, annotation, tagging and analysis which are all recorded in the blockchain.
It is therefore easy to imagine that these two technologies could help each other to solve their respective problems, whether technical, ethical or legal.
But the regulations in the field of blockchain are still in their infancy. Blockchain raises hopes because it is seen as a technology capable of escaping the rules currently in force and the domination of states. It is neither possible nor desirable to apply the rules of traditional law to the digital environment, seeking to regulate blockchain with traditional rules would be risky as it could limit or even eliminate its potential. But for that it is still necessary to wait, because we do not yet know fully where it is leading us, what the fields of exploitation are, and what the dangers are.
Blockchain and machine learning are both new and fast-growing technologies. Although they are very different, they are areas that will be closely linked in the future. We can already see breakthroughs and changes in our lives as a result of their application. The adoption curves of these technologies follow the same pattern as the internet curve in the early 2000s, and there is no doubt that they will shape our future. Decisions taken at the technical level will have an impact on society. They can be liberating and emancipating technologies as well as being taken over by the authorities to reinforce the current system. Therefore, it is essential to start thinking about the ethical implications. The decisions taken today will define the future of our society.
- Shannon Tellis. Data is the 21st century’s oil, says siemens ceo joe kaeser.
- H. Sebastião and P. Godinho. Forecasting and trading cryptocurrencies
with machine learning under changing market conditions. Financ Innov,
7(3), 2021. https://doi.org/10.1186/s40854-020-00217-x.
- Taotao Wang, Soung Chang Liew, and Shengli Zhang. When
blockchain meets ai: Optimal mining strategy achieved by ma-
chine learning. International Journal of Intelligent Systems, 36(5), 2021.
- Francesco Scicchitano, Angelica Liguori, M. Guarascio, E. Ritacco, and
G. Manco. A deep learning approach for detecting security attacks on blockchain. ITASEC, 2020. https://www.semanticscholar.org/paper/A-Deep-Learning-Approach-for-Detecting-Security-on-Scicchitano-Liguori/5ea74277289f4b1637a0d66a28c05af4308c67c8.
- Marcelo Corrales, Mark Fenwick, and Helena Haa-
pio. Legal tech, smart contracts and blockchain. 2019.
- Mihalis Kritikos and Scientific Foresight Unit (STOA). What if blockchain
could guarantee ethical ai? European Parliamentary Research Service, 2020. https://www.europarl.europa.eu/thinktank/en/document/EPRS_ATA(2020)656334.
- What if blockchain could guarantee ethical ai? Scientific Foresight (STOA),
- Ai, iot, and blockchain: Business models, ethical issues, and legal perspec-
tives. 2021. https://link.springer.com/chapter/10.1007/978-3-030-74150-1_4.
- Eileen Brown. Blockchain aims to solve ai ethics and bias issues.
- YUGESH VERMA. How machine learning can be used with blockchain
technology? 2021. https://analyticsindiamag.com/how-machine-learning-can-be-used-with-blockchain-technology/.