AI Making Smart Contracts Smarter

By John Impellizzeri & Connor Sullivan

Over the past 20 years, the world has seen rapid evolution in the development of the global economy and the underlying technologies that drive it, but every so often a new emerging technology stands out amongst the rest and captures mass attention. Among these, blockchain and artificial intelligence are arguably the most notable — having shown immense potential in revolutionizing various industries, many organizations are now looking to adopt these technologies.

Blockchain has been recognized as a means for organizations and individuals alike to facilitate trust, authenticity, and security in transactions, while artificial intelligence has recently gained more attention due to its ability to analyze massive amounts of data and make intelligent decisions quickly and on its own.

Though each technology is unique and possesses its own strengths and weaknesses, their combination can often help to create smarter and more efficient systems. By using blockchain and AI together, companies may find reason to adopt them sooner, as they each make up for each other’s shortcomings in their own core competencies. To effectively understand the synergistic potential of these two technologies, it is crucial to first examine their individual advantages and limitations.

Blockchain

A blockchain is a digital technology that functions as a decentralized ledger that securely records transactions and data across a network of computers. It is called the blockchain because each transaction is recorded on a “block” in the digital ledger and connected, or “chained” together, with the previous block in that blockchain and recorded across the network of computers. This creates a transparent, tamperproof, and traceable ledger of transactions. Once a new transaction is validated and added to a block, any changes in the block will cause a mismatch between the individual copies of the digital ledger on the computers in the network, making it very easy to spot and trace where an entry was changed.

Blockchain technology has potential to transform the way we store and transact information, both on a personal and organizational level. The immutable and traceable nature of blockchain technology makes it an ideal candidate to store information that benefits from increased transparency and traceability. These can range from small pieces of information such as the output of a particular piece of machinery to more sensitive information such as legal contracts.

Despite these advantages over a traditional data storage system, blockchain technology isn’t what would be categorized as “smart.” The value from a blockchain comes from being able to securely facilitate transactions in a way that is traceable and tamperproof. At their core, blockchain systems aren’t much more than secure digital ledgers, until you bring in smart contracts.

“Smart contracts” are self-executing pieces of code that automatically execute when certain conditions are met. Smart contracts are made of up of two main parts — its code which stores the function of the contract and the data it uses as inputs to determine the appropriate course of action. An organization may want to automatically distribute information to a number of different parties involved in a transaction, but not until they have paid their fair share of the transaction. This could be done through a smart contract that will automatically distribute information from the transaction as a party’s payments are received. But, despite their name, smart contracts aren’t inherently “smart” either, they function by:

1. Storing rules

2. Verifying rules

3. Self-executing rules

Often compared to vending machines, smart contracts facilitate trust and authenticity, but are not inherently “smart” as they do not have the capabilities to act outside of their pre-defined set of rules. Smart contracts can even create new smart contracts when they are executed, but this still must be programmed into the original contract and would not be able to easily adapt to any changes that may be needed with human-like flexibility. This is where artificial intelligence comes into play.

Artificial Intelligence

Artificial intelligence is a technology that utilizes unique systems that can perform tasks that normally require a human level of intelligence to accomplish — this includes pattern recognition, learning from experience, decision-making, and many more. The inner workings of AI are accomplished through processing large data sets and utilizing algorithms that allow the AI system to learn and adapt over time from those data sets. When new data is introduced, the system can refine its understanding of said data to make more informed decisions to draw more accurate conclusions.

A good example of this is in a simple computer program playing chess. When a simple computer program successfully makes a move in a chess game, it remembers that this is a good move to make and stores this information for the next time it is in this exact position, an artificial intelligence will likely make the same move, but when it stores the solution it will have a greater understanding of why that move worked and be able to apply this understanding to future moves, even if the pieces are in completely different spots on the board.

The AI learns why something worked and will draw more widely applicable reasoning for why it worked, whereas a simple computer program would simply store A + B = C and know in the future when it encounters A+B that C is the answer but will not understand the deeper reasoning as to why.

Artificial intelligence’s ability to act in a manner that can closely simulate human intelligence gives AI the capabilities to go far beyond the constraints of smart contracts, and when paired with smart contracts can allow them to be used in more complex tasks such as learning, problem-solving, reasoning, and pattern recognition. This enables companies to automate activities of their choosing, but, comes with the drawback of not allowing a high level of control over what the AI does, and also does not provide a high level of insight into why it does what it does.

Combining Artificial Intelligence and Blockchain

While it may not be immediately obvious on the surface, upon looking closely at the applications of these two technologies, you may start to notice they do a fantastic job of making up for each other’s weaknesses.

Blockchain
Blockchain can provide the users of artificial intelligence with safeguards through smart contracts that can prevent undefined behavior or immutable logs of the actions the AI has taken previously, while also giving control over the data that the AI functions on back to users.

Artificial Intelligence
Artificial intelligence can further enhance the value delivered by blockchain applications through the use of automated decision-making or processing data that has been stored on a blockchain.

The combination of these two technologies opens the realm of possibilities of the other. To implement these in a meaningful way, it is important to understand not only the application of these technologies, but also the constraints and parameters that could be setup around these systems to keep them from acting in undefined ways. A few examples of these include:

Automatic Drafting and Execution

AI’s ability to “think” in more complex and adaptive ways compared with normal computer systems gives it an advantage when it comes to creating smart contracts. AI could draft smart contracts based on pre-defined parameters input by users, automatically using data sets from past contracts to help form better contracts as time goes on. Once the contract has been generated by the AI, it can self execute based on the rules it was given, or require a user’s authorization to execute. As the contract executes, the AI can store identifying and relevant information regarding the contract and record the execution of the smart contract onto a blockchain, making a detailed entry that can be referenced at a later point.

Example: Automating monthly purchases of non-critical items based on demand forecast data. AI can utilize past data such as vendor fill rate, order size and current market conditions to determine the probability of the order being fulfilled by the vendor. Based on this analysis and additional data sets, the AI could draft a purchase order and corresponding smart contract(s) to facilitate and track the purchase, as well as release funds at set waypoints in the order process. AI’s adaptability to new information could enable the possibility of flagging a transaction if the vendor is underperforming during execution or if there is a change elsewhere that could prevent the order from being fulfilled.

Constraints: maximum budget, maximum / minimum order quantity, order time frame (weekly monthly, etc)

This streamlines the ordering process for simple or non-critical items in a company. This could be applied to basic items ordered every month, such as physical items like paper for printers, or even services and utilities, such as automatically paying a power bill if it matches the power usage data available to the AI for a given period.

Negotiating and Enforcing Terms

An AI assisted blockchain system could have the ability to assist in or independently conduct negations between parties and then be used to enforce the terms of the agreement.

Example: Negotiating terms for a purchase order can be streamlined through the use of AI-backed smart contracts. Companies can leverage AI to gain insight into the level in which they have room to negotiate. This could include information pertaining to the supplier’s production capacities, past orders and relationship with supplier, current market price trends, etc. The AI could then generate a completed but unsigned contract for the parties to sign and a matching smart contract that executes once both parties have signed and uploaded the contract.

Constraints: Max price, Max and Min quantity needed, maximum acceptable lead time, minimum acceptable payment terms, Max probability of non-performance.

Through the use of AI in drafting contracts and generating corresponding smart contracts, companies can reduce the amount of time and resources spent on negotiating and receive suggestions for amendments to the contract if it detects an inability for either party to fully execute the contract both before and during contract execution. This helps both parties enforce each other’s obligations regarding the contract and gives the parties involved advanced warring of a possible issues. Though the above example is from a buyer’s perspective, this can be used by both parties in a contract, as the AI could provide the suppliers with an estimated willingness to pay to the sellers and ensure that they are getting the most for their goods.

Recommending Recalls

By storing production information on a blockchain, artificial intelligence can recognize less obvious patterns in defects across production lines and suggest recalls based on the information it receives.

Example: An auto manufacturer notices that their cars are suffering from an O2 sensor failure across their full range of models. The parts that fail are noted to have failed by dealership service centers through entries onto the company’s parts blockchain under the corresponding purchase order. From here, the AI can start to utilize pattern recognition across the O2 sensor failures and pinpoint the potential source of the failure to a single manufacture. From here, additional information could be used to narrow down other possible factors, such as the date range that the defective O2 sensors were delivered. Once the affected sensors have been properly identified, a recall could be put out based on the VIN’s of the vehicles affected and a purchase order for the replacement parts could be drafted by the AI.

Constraints: The only constraint that could be placed on this type of system would be one for manual human approval between steps, such as before a recall is put out.

While the above examples have been focused more around the use of AI actively in processes, this use acts more as a passive monitoring system on a blockchain, constantly scanning available data for patterns. Because of a blockchain’s ability to provide a high level of traceability for the data it stores, an AI system would be able to back track any defective components to their source faster than a human would likely be able to using a traditional database.

This also highlights the more complex uses of a blockchain AI integration, as it can utilize the automatic drafting and execution framework from above to draft purchase orders for the replacement parts and utilize smart contracts to contact owners of these vehicles when the recall is issued, and again when the parts needed for the repair are available at a local service center.

Controlling AI

While the above examples have focused on using AI to enhance the utility of blockchain technology, blockchain technology can also be used to enhance the security and a user’s understanding of the operations of AI systems. Blockchain systems utilizing self-generating smart contracts can be used to control and interpret the actions of artificial intelligence. The secure nature of the blockchain makes it a viable option for recording data related to the actions taken by AI. Through this, companies can create boundaries for their AI to operate within through smart contracts and create a predefined course of action if the AI begins to act outside of these boundaries.

In purchasing, a user may place a constraint on the time intervals between orders, so that they do not receive orders they do not have the capacity to warehouse, or receive too few orders, making them unable to meet demand.

Let’s take a look at how this would play out based on the smart contract example above.

1. Storing rules

a. If an order was placed <14 days ago, another order cannot be placed

b. If an order was placed ≥14 days ago, a new order must be drafted within 3 days

2. Verifying rules

a. Every day, the AI would calculate (current date) – (date of last order) = (days since order)

b. If days since order <14, nothing will happen, and it will run the same logic tomorrow

3. Self-executing rules

a. Eventually, when (days since last order) = 14, a new purchase order will be drafted and submitted

If the AI tried to act outside of these pre-defined rules and tried to submit a purchase order, it would be rejected as the smart contract logic would fail to execute. This allows organizations to place greater trust in their AI systems and enable them to be used with significantly less human oversight.

Current Limitations

Currently, scalability, integration, and lack of expertise are the main pieces holding back the widespread adoption of both blockchain and AI.

Current popular blockchain adoptions such as Bitcoin and Ethereum use an energy intensive algorithm to validate transactions known as proof of work. This requires a large amount of computing power to process transactions and thus requires a large amount of power to operate, especially as the scale of the blockchain grows.

Companies often rely on outdated legacy systems to manage various parts of their business, and these systems are often difficult to interface with more modern technology.

Finally, due to the emerging and rapidly evolving nature of blockchain and artificial intelligence, it is difficult for companies to find expertise on blockchain technology and artificial intelligence that fully suits their specific needs.

Conclusion

The integration of artificial intelligence with blockchain technology has the potential to revolutionize the way companies operate and interact with one another. Through their combination, blockchain and artificial intelligence can help strengthen each other’s weaknesses and help companies adopt these technologies sooner.

Blockchain’s proficiency in keeping verifiable and immutable data paired with the capabilities of smart contracts positions it as a possible control mechanism for artificial intelligence. Inversely, artificial intelligence presents a promising potential to enhance the capabilities of blockchains and their native smart contracts through its high-level thinking. Together, they can create an ecosystem that streamlines processes, optimizes decision-making, and ensures trust and security between parties.

Despite their challenges, the future looks to be promising for these two technologies. As the underlying technology behind blockchain and artificial intelligence improves, their use will continue to grow, unlocking new possibilities and driving innovation across multiple sectors. The examples provided in this article demonstrate the potential of the symbiotic relationship between these technologies, and as these technologies continue to develop, we can expect to see it used in more groundbreaking ways in the years to come.

Scroll to Top

Enroll Now and Get 100 Bonus STRATs!

Start earning extra STRATs, gain access to exclusive events, and enjoy special discounts on all your purchases.

No spam, just rewards.

image