It was only a matter of time before attempts at combining artificial intelligence (AI) and the blockchain appeared. The immutability of data, security of the trustless environment, and decentralized power provided by blockchain technology can be perfectly united with the power of AI to process huge datasets, optimize processes, and make predictions upon request.

AI and blockchain applications are widely used in the Internet of Things (IoT). Massive amounts of data — produced by IoT devices and saved on-chain — can be processed by artificial intelligence. Also, a lot of AI marketplaces are developed and tokenized on the blockchain. There are even some blockchain and AI projects that combine decentralized neural network learning with a blockchain consensus protocol.

One of the most popular ways to combine AI and blockchain is AI as a Service. It combines the predictive power of AI with the decentralized security of the blockchain. And AI as a Service has found its rightful place in the financial sphere.

In this article, we analyze the advantages of AI and the blockchain for banking and how these technologies can complement each other. We also provide a use case and the architecture of our own solution for ensuring data security in lending. 

This article will be useful for developers who want to know more about the possibilities of combining AI and the blockchain.


How can AI and the blockchain improve lending services?

Benefits of AI and blockchain

Application architecture

Creating an AI model

Developing a smart contract


How can AI and the blockchain improve lending services?

The financial sphere has always used the most innovative technologies, as it needs to ensure process security and data protection. The blockchain has already found its rightful place in financial institutions. As evidenced by an impressive number of cryptocurrencies, blockchains allow financial operations to be conducted safely, consistently, and verifiably.

AI can effectively deal with massive amounts of data. AI helps us to analyze, filter, and structure massive streams of data and then make predictions and conclusions based on it.

One of the most popular use cases for combining AI and the blockchain into a single application is related to loan services. Thousands of loans are accepted or declined every day. A bank should keep records of all the requests to form a customer’s banking history. Thus, a loaning service requires:

  • Reliable data storage
  • Security of personal data
  • An unbreakable data–client connection
  • The ability to process large numbers of requests

This scenario looks like a perfect candidate for blockchain and AI collaboration.

Let’s see how this collaboration might work in practice. Clients will be able to check their ability to get a loan, the amount they can borrow, available loan repayment periods, access to particular financial services, etc. Such requests can be saved on-chain, serving as request proof for banks and other financial organizations, and can be used for processing loan requests. Hashing and cryptography techniques provide the necessary level of privacy and security. 

Using a system built on AI and the blockchain, a bank can deterministically regulate the service parameters, set validity periods for client requests, and treat those requests as official since they’re saved on-chain. 

AI will allow banks to process all loan requests, simplify loan acceptance algorithms, and make their loan approval systems more flexible.

A possible use case for loaning service looks like this:

Use case for loaning service
  1. A client accesses an application (for example, a web form or mobile app), gets an ID, chooses a banking service, and inputs data.
  2. The application sends this request to the blockchain (a smart contract or its analog). This request is stored on-chain, so the client and bank can easily track it. Due to security and privacy requirements, the blockchain stores a hash of the information, not the information itself. This hash creates a connection between the client’s information and the client’s ID, but the information itself stays private.
  3. Simultaneously, the application sends data to the backend, where it’s processed in the AI module. This module contains pretrained neural networks for each banking service. The backend waits for confirmation from the AI and analyzes information to predict the result.
  4. Information about the request or part of the data from the application can be backed up in the database. This provides the bank with additional instruments for processing the request.
  5. The AI module returns the result to the blockchain, where it’s saved on-chain and becomes unbreakable evidence. Both the client and the bank can see the loan decision. For security reasons, only the client ID is saved on-chain.
  6. A client application stores the request, request ID, and official response so it can easily be sent to the banking application for confirmation.

Related services

Artificial Intelligence Development Services

After the official response is saved on-chain, it can be used by a bank employee to get confirmation and provide the requested service — in our case, give a loan to the customer. The process looks like this:

  1. Since the client application keeps IDs and requests, it can be used to redirect the service response to the banking application for further actions.
  2. A bank employee can easily check the validity of a client’s data by accessing it on the blockchain. Saving data on-chain protects both sides from redundant checks, simplifies the process of loan approval, and prevents fraud and misbehavior (on both sides).
Confirming and providing the requested service

As you can see, combining the blockchain and AI can make loan acceptance simpler, faster, and more convenient for clients while keeping it secure and easily manageable for banks.

Read also:
How to Speed Up Blockchain Development with DevOps Tools

So far, we’ve discussed how blockchain and AI convergence improves lending procedures. But in fact, both technologies bring many more advantages. Let’s take a look at other benefits of AI and blockchain.

Benefits of AI and blockchain

The blockchain and artificial intelligence are completely different technologies that used to act in different areas. The blockchain is a decentralized technology that works with open data that’s immutable and unbreakably linked. On the contrary, AI is a highly centralized service that works with private data that can’t be accessed or recreated. 

Their collaboration brings a lot of advantages, especially for lending services. In our case, we’ll use a set of pretrained neural networks and an Ethereum-based platform with support for smart contracts.

Let’s take a look at the benefits of these technologies.

Advantages of AI for financial services

Flexibility. A neural network model is more flexible than a statically coded algorithm. A model can be easily trained on a specific dataset. You need to spend a lot more time creating the architecture for a static algorithm than you do training a neural network. While a neural network needs just another dataset to change the model, a static algorithm may need a lot of corrections. Also, you can easily reuse the same neural network model with different data for different services.

Customization. There can be a lot of AI models for each kind of loan service. With AI, we aren’t limited to providing a service for a single type of loan. We can create models (based on the same dataset) to check the maximum number of loans for a client, the loan period, the services available for the client, and so on.

Key benefits of AI for financial services

Modularity. The training of a neural network is separated from its usage. This means we can train our model in one program and use it in another. We can easily change models in our AI module without making any changes to the code. So if a bank changes the conditions for their loan service, e can just train a new model.

Upgradability. We can upgrade our model with new data received from client requests or provided by clients from other services. This keeps the model up-to-date and may give additional depth to its algorithm.

Independence. Since a neural network model can be kept separately from the code, it’s easy to track changes to the model (through hashing or checksums), make backups, and migrate to other services.

Read also:
Using Data Mining Techniques in Cyber Security Solutions

Benefits of blockchains with smart contract support

Unbreakable evidence. Once saved on-chain, loan requests and decisions can’t be changed. This way, blockchain data can serve as unbreakable proof for banking services in order to process clients’ loan requests.

Unified data. The blockchain guarantees that both clients and banks use the same information in a similar way. Since all information saved on-chain is publically accessible and unchangeable, it can be easily checked.

Verification. Every request, response, and service parameter change (e.g. duration and amount of a loan) can be found on-chain and checked for authenticity and validity. Since data on the blockchain can’t be lost, transaction history is always available and can be verified.

Security and privacy. Every ID and piece of data saved on-chain can be reconstructed from its hash. This creates a strong connection between pieces of data but keeps the information itself private. Only clients and authorized bank employees have access to the information behind the hashes and IDs.

Key benefits of the blockchain for financial services

Control. Basic information such as the loan terms, access rights, and number of loan applications are saved in a smart contract. They can be changed only by authorized persons, and every change is tracked and verified. This allows a bank to control the system in a safe manner.

Applications. The blockchain allows for developing decentralized applications (dApps). You can build dApps for different services, loan programs, and credit history. dApps can be both client- and bank-oriented. There’s even the potential for interoperability between blockchains and different external services — and even between different banks. All these features share the security and reliability of the blockchain.

The best features of the blockchain and AI technologies can be combined to create products that offer the advantages of both. Now we can take a look at the architecture for our loan application.

Related services

Blockchain-based Solution Development

Application architecture

Let’s take a look at a possible implementation of a loan system based on the blockchain and AI. Its architecture should cover our use case for a loaning service and provide the required level of security. Here’s what we came up with:

Application architecture

Now let’s take a closer look at the main components of the applications that make up this system.

Client application

This application gives all the functionality a client might need: 

  • Forms for entering credentials
  • Ability to enter personal information
  • Ability to choose a service type/loan program
  • Ability to choose conditions for the loan or service
  • And more

A client application can be developed as a website, mobile application, or desktop application. It should allow a client to access the blockchain and get their transaction history. The client application is connected with the backend, so these two applications can share processed data. But the main purpose of the client application is to provide banking services in the fastest way possible and to get a response that will simplify the loan process. 

Let’s see how a client interacts with our application:

Inputs credentials to get an ID. This can be easily achieved by hashing — for example, by hashing the client’s full name (or other identifying information) and a random seed. This hash can then be used as a client ID. The hash is secure enough so that personal information can’t be revealed while allowing that information to easily be recreated by clients themselves.

Chooses a loan program and loan conditions. Service ID and service data are formed out of it. Since loan information must can treated as private, the application hashes this data. Hashes of both the service ID and service data are sent to a smart contract to form an official request that’s saved on-chain. Confirmation of the request creation is sent to the backend. By that time, our client application has sent the client ID and service data to the backend, where it’s redirected to the AI module.

In general, a client’s request is processed in four steps:

  1. The client enters their credentials, personal information, the type of loan they would like to apply for, and their desired loan conditions.
  2. The application generates a client ID, loan service ID, service data, and service data hash.
  3. The application sends:
    • the client ID, loan service ID, and service data hash to the smart contract
    • the loan service ID and service data to the backend
    • the client ID and request ID to the banking application
  4. The application gets:
    • a request ID from the smart contract
    • a confirmation and response from the AI module (through the smart contract event)

If necessary, client information can be securely saved in the bank database to make it easier to identify clients.

Sensitive information is saved only in the client’s application, and the public blockchain contains only IDs and hashes. When the blockchain needs to connect with a banking application, the information stored in the blockchain can be re-sent from the client application.

Banking application

The banking application helps authorized banking personnel interact with the blockchain. It has two main purposes: 

  • Verify clients’ requests 
  • Control smart contract parameters

In order to get a loan, a client sends the banking application their credentials, request, and loan confirmation from the AI module. All this information is saved on-chain, so it can easily be found and verified. This can even be done automatically by getting the IDs and hashes and checking transactions containing this data in the blockchain. 

A smart contract contains service parameters such as the term of request validity, number of allowed requests, etc. A banking application should be able to check these parameters against the client’s request. At the same time, authorized employees should be able to change smart contract parameters if necessary.

One of the most important functions of banking applications is to keep track of the integrity of AI models. As we mentioned, each model is saved as a separate file. We can get its hash and save it on-chain, so we can check if a model is valid. The hash of a model can also be used as a change log identifier: if the model changes, its hash also changes, and we should update its on-chain identifier.

Let’s see how our banking application works:

  1. The application gets information from the client to be checked in the blockchain.
  2. The application:
    • makes changes to the smart contract parameters
    • updates and checks the IDs of AI models saved in the smart contract.

Backend application

The backend is what connects the blockchain and the AI module. This application accomplishes three main tasks:

  • Receives requests from the client application
  • Replicates them to the AI module
  • Translates responses from the AI to the blockchain

When a client sends a request, the backend application collects data from the client application. After that, the backend application waits for confirmation from the event generated by the smart contract while at the same time checking the integrity of the requested AI service. 

The AI model is saved separately, and its hash is used as a model ID and proof of integrity. Since the model hash is saved on-chain and the service’s ID is replicated through the request, the backend can check if the model matches its hash. This procedure guarantees the integrity of the system and protects clients from unauthorized changes to the AI model.

When all checks are passed, the backend calls the AI module, which makes a prediction based on the client data and the chosen neural network. This prediction is sent to the blockchain, and the smart contract creates an event directed to the client application.

Some bank services require saving client requests and data. In order to do so, we can connect our application with a database and copy the required information to it.

To sum up, a backend application performs these actions:

  • Receives an AI service ID, data for processing, and confirmation from the blockchain
  • Checks the integrity of AI models communicating with the smart contract
  • Communicates with the AI module and forwards its response to the blockchain

Though the backend application seems to be the center of the system, it only facilitates communication between the smart contract and AI models and passes along received data. All of the main system logic is concentrated in the AI module and smart contract. Let’s take a look at these components.

AI module

The AI module contains functionality for:

  • Loading neural network models (or other AI models)
  • Training networks
  • Updating networks
  • Making predictions and conclusions

As we mentioned, every model can be saved separately, substituted with a new model, and loaded when needed. Such functionality gives a lot of flexibility, though it creates a security issue because an unauthorized person can change models. We solved this issue by saving the hash of the model in the smart contract so we can access it on-chain and compare it with the currently used model.

We can even have a specific pretrained model for each supported service.

Modules work in a simple way: they get new data to analyze and make a prediction. The main part of the module consists of training data. Financial organizations accumulate a lot of information about approved and denied loans, which can be used to train a neural network. New data received by the service can be used for additional training.

To review, an AI module:

  • Contains neural network models, each connected to a particular service
  • Gets loan service data and service IDs
  • Provides decisions from the neural network regarding the chosen service
  • Saves the model hash on-chain to ensure system integrity

The blockchain and smart contracts

We’ll create an Ethereum-based platform for our loaning service. An Ethereum smart contract is the true heart of the system. It accomplishes three key tasks:

  • Ensures all requests and AI responses are saved on-chain
  • Keeps IDs and hashes of all AI models
  • Stores all loan service parameters 

Clients can access their transaction history through a smart contract. Authorized bank employees can change loan conditions (such as the amount and term of a loan or the interest rate) in the smart contract.

For our use case, we’ll use a permissioned Ethereum-based blockchain within a separate network. It gives us the functionality of smart contracts and access to the block history, though trusted entities can validate the chain.

Read also:
How to Develop an Ethereum Smart Contract for Application Licensing

A blockchain may serve as the foundation for dApps developed upon the described service. For example, you can create a separate application for checking clients’ loan histories. Moreover, a simple token system can make a platform more attractive for clients and banking services. But the main purpose of the blockchain is to keep evidence of clients’ requests and AI decisions.

In our use case, a smart contract:

  • Creates request IDs from the client data
  • Keeps client IDs, request IDs, service data hashes, and AI responses
  • Sends events to confirm received requests and loan decisions
  • Keeps loan service IDs, hashes of models, and parameters of services
  • Allows parameters to be changed only by authorized employees

We’ve discussed key elements of our architecture. Now we can start working on our AI model and smart contract.

Creating an AI model

The foundation of any AI model is data. In our case, we use a free dataset that contains a massive amount of data on accepted and declined loan requests. It allows banks to check if a loan is risky or has a high probability of being fully paid.

The first step in creating a model is preparing data. Our dataset contains records for 36- and 60-month loans. Since we can create separate models for different banking services, we may choose a single type of loan — for example, loans with a 60-month repayment period. Currently, the dataset contains over 100 parameters for each loan record. To develop a deep and accurate AI model, you'll need as many parameters as possible, nevertheless, we’ll narrow our choice to the most valuable:

  • loan_amnt — The loan amount requested by the client
  • int_rate — The interest rate (monthly or annual), which сan be provided in the client application by a bank  as part of the service settings
  • installment — The monthly payment owed by the borrower; also a part of the service settings
  • grade — The loan grade calculated by the bank based on the client’s loan history and other data
  • emp_length — Employment length in years, as provided by the client
  • home_ownership — Home ownership information, as provided by the client
  • annual_inc — Annual income of the client
  • purpose — The purpose of the loan, as stated by the client in their application
  • inq_last_12m — The number of open credit lines, which can be calculated by the bank based on the client’s credit history
  • delinq_2yrs — The number of credit inquiries in the past 2 years, which can be calculated based on the number of requests already saved on-chain
  • loan_status — The loan status (approved or declined), as decided by the AI

The original dataset contains almost 1 million records. We’ll narrow our data to 20,000 records that meet specific criteria, without empty or undetermined columns. Also, we have to normalize the data so it’s ready for use in the neural network. 

We’ll use the Python pandas (Panel Dataframe) library to handle this data:

import pandas as pd
#Reading dataset
start_df = pd.read_csv('loan.csv', low_memory=False)
df = start_df.copy(deep=True)
#Initial parsing
df = df[lambda dd: dd['term'] == ' 60 months']
df = df[lambda dd: dd['loan_status'] != 'Current']
df = df[lambda dd: dd['loan_status'] != 'In Grace Period']
df = df[lambda dd: dd['annual_inc'] >= 1000.0]
df = df[lambda dd: dd['annual_inc'] <= 1000000.0]
df = df[lambda dd: dd['home_ownership'] != 'ANY']
df = df[['loan_amnt', 'int_rate', 'installment', 'grade', 'emp_length', 'home_ownership',
         'annual_inc', 'purpose', 'inq_last_12m', 'delinq_2yrs', 'loan_status']]
df = df.dropna()
df = df.reset_index(drop = True)
df = df.loc[:19999,:]
df['loan_amnt'] /= df['loan_amnt'].max()
df['int_rate'] /= df['int_rate'].max()
df['installment'] /= df['installment'].max()
df['annual_inc'] /= df['annual_inc'].max()
df['inq_last_12m'] /= df['inq_last_12m'].max()
df['delinq_2yrs'] /= df['delinq_2yrs'].max()
#Non-digit data normalizing
grade_dict = {'A' : 1.0, 'B' : 0.75, 'C' : 0.5, 'D' : 0.25, 'E' : 0.1, 'F' : 0.05, 'G' : 0.0}
df['grade'] = [ 0.0 if (grade not in grade_dict) else grade_dict[grade] for grade in df['grade']]
df['emp_length'] = [0.0 if emp == '< 1 year' else 1.0 if emp == '10+ years' else float(emp.split(' ')[0]) / 10.0 for emp in df['emp_length']]
ownership_dict = {'MORTGAGE' : 0.75, 'RENT' : 0.5, 'OWN' : 1.0}
df['home_ownership'] = [ 0 if (home not in ownership_dict) else ownership_dict[home] for home in df['home_ownership']]
purpose_dict = {'debt_consolidation' : 1, 'credit_card' : 0.92, 'major_purchase' : 0.84, 
                'home_improvement' : 0.75, 'moving' : 0.68, 'small_business' : 0.6,
                'medical' : 0.5, 'car' : 0.4, 'vacation' : 0.32, 'house' : 0.25, 
                'renewable_energy' : 0.16, 'other' : 0.08}
df['purpose'] = [0 if (purp not in purpose_dict) else purpose_dict[purp] for purp in df['purpose']]
df['loan_status'] = [0 if (stat == 'Default' or stat == 'Charged Off') else 1 for stat in df['loan_status']]
df.to_csv('loan_parsed.csv', index=False)

After that procedure, we get a normalized dataset prepared for training. We have 20,000 records, of which we’ll use 80% for training (16,000 records) and 20% for testing (4,000 records). 

The next step is to train the neural network based on this data. We’ll use the Keras Python library to build a neural network based on the Keras Sequential model

After a bit of experimenting, we built a model that consists of five layers

  • The input layer contains 10 neurons, one per parameter.
  • The first and second hidden layers have “relu” activation functions and contain 10 neurons each. 
  • The second hidden layer also provides a regularization for the input data as a form of model optimization. 
  • The third hidden layer has a hyperbolic tangent activation function and contains 5 neurons. 
  • The output layer consists of a single output neuron that provides the loan decision: 0 (loan declined) or 1 (loan accepted).

Here’s what our training model looks like:

import pandas as pd
from keras import Sequential
from keras.layers import Dense, Dropout
from keras.models import model_from_json
dataset = pd.read_csv('loan_parsed.csv', low_memory=False)
input_data = dataset.iloc[:,0:10].values
output_class = dataset.iloc[:,10].values
X_train = input_data[-16000:]
X_test = input_data[:4000]
y_train = output_class[-16000:]
y_test = output_class[:4000]
model = Sequential()
#First Hidden Layer
model.add(Dense(10, activation='relu', kernel_initializer='random_normal', input_dim=10))
#Second Hidden Layer
model.add(Dense(10, activation='relu', kernel_initializer='random_normal'))
#Third Hidden Layer
model.add(Dense(5, activation='tanh', kernel_initializer='random_normal'))
#Output Layer
model.add(Dense(1, activation='sigmoid', kernel_initializer='random_normal'))
#Compile the neural network
model.compile(optimizer ='adam',loss='binary_crossentropy', metrics =['accuracy'])
#Train the network
model.fit(X_train, y_train, batch_size=10, epochs=100)
#Evaluate test data
score = model.evaluate(X_test, y_test)
#Serialize model to JSON
model_json = model.to_json()
with open("model.json", "w") as json_file:
#Serialize weights to HDF5

Our model has been trained and saved to separate files: model.json and model.h5. We had 100 training epochs, and the neural network model showed 94% successful predictions on the test dataset. Now it’s ready to work with data from the client application:

import pandas as pd
from keras.models import model_from_json
#Data example. It should be received from the client application.
df = pd.DataFrame({
    'loan_amnt': [35000],
    'int_rate': [10.9],
    'installment': [759.25],
    'grade': ['B'],
    'emp_length': ['< 1 year'],
    'home_ownership': ['OWN'],
    'annual_inc': [30000],
    'purpose': ['debt_consolidation'],
    'inq_last_12m': [0],
    'delinq_2yrs': [0]
#Use the same normalization functions here as in dataset preparation
#Load and prepare model
json_file = open('model.json', 'r')
loaded_model_json = json_file.read()
model = model_from_json(loaded_model_json)
model.compile(optimizer ='adam',loss='binary_crossentropy', metrics =['accuracy'])
#Make a prediction
X_test = df.iloc[:].values
y_pred = model.predict(X_test)

The calculated result is sent to the appropriate request of the smart-contract.

At this point, we’ve described the complete process of creating the AI model: preparing the dataset, training the neural network, saving the model to a file, using the saved model on the received data. Now let’s move to the process of creating the smart contract.

Developing a smart contract

A smart contract is the true center of our system. It contains all the connecting data, system control parameters, and evidence of requests and responses. Since we’re building an Ethereum-based system, we’ll write our smart contract in the Solidity language. 

The smart contract should correspond with the architecture of our solution. It will have the following functionality:

  1. Allow the client to create a request. A request contains the ID of the AI service to be called and the data hash that service will analyze. We also need to include a request ID for request identification and integrity checks. For simplicity, we’ll use a request number as request ID. Requests will be represented as data structures. The smart contract will keep these structures in a mapping (clientRequests), so every user ID will be connected with an array of structures.
  2. Allow the AI service to pass a response. We’ll create a separate structure for making loan decisions. It will store AI responses and valuable parameters such as the term of validity and timestamp. All predictions are connected to requests and clients by their IDs in the second mapping (clientPredictions).
  3. Generate an appropriate event for the backend service and client application after a request is created and a prediction is made.
  4. Keep the connection between the model ID and its hash in the third mapping (aiModels) for data integrity.
  5. Provide security so only authorized employees can change global parameters and update AI model hashes.

Read also:
5 Security Tips for Writing Smart Contracts

Our full smart contract looks like this:

pragma solidity ^0.5.1;
contract ownable {
  address owner;
  mapping (address => bool) authorized;
  constructor() public {
    owner = msg.sender;
	authorized[msg.sender] = true;
  modifier onlyOwner {
    require(msg.sender == owner);
  modifier isAutorized {
  function transferOwnership(address newOwner) onlyOwner public {
    owner = newOwner;
	authorized[newOwner] = true;
  function addAutorized(address _addr) onlyOwner public {
    authorized[_addr] = true;
  function removeAutorized(address _addr) onlyOwner public {
    authorized[_addr] = false;
contract AskLoanAI is ownable {
//Common parameters
  uint public predictionValid;
  struct Request {
    uint256 requestId;
	bytes32 serviceData;
	uint256 serviceId;
  struct Prediction {
    bool result;
	uint256 timestamp;
	uint validityTerm;
//AI model file hash AI model id
  mapping (uint256 => bytes32) aiModels;
//Request to client ID
  mapping (bytes32 => Request[]) public clientRequests;
//AI response to request ID to client ID
  mapping (bytes32 => mapping (uint256 => Prediction)) public clientPredictions;
  event RequestConfirmed(bytes32 clientId, uint256 requestId);
  event PredictionReceived(bytes32 clientId, uint256 requestId);
  constructor() public {
    predictionValid = 2 days;
//Client requests AI module from the application. This function may be set as payable
  function CreateRequest(bytes32 clientId, uint256 serviceId, bytes32 serviceData) public returns (uint256 requestId) {
    Request memory req = Request(clientRequests[clientId].length + 1, serviceData, serviceId);
    emit RequestConfirmed(clientId, req.requestId);
    return req.requestId;
//Check client data integrity
  function CheckRequestData(bytes32 clientId, uint256 requestId, bytes32 requestData) public view returns (bool isTrue) {
    for (uint ind = 0; ind < clientRequests[clientId].length; ++ind) {
      if (clientRequests[clientId][ind].requestId == requestId) {
        return clientRequests[clientId][ind].serviceData == requestData;
//AI module sends its prediction
  function SetAiPrediction(bytes32 clientId, uint256 requestId, bool result, uint256 timestamp) public isAutorized {
    clientPredictions[clientId][requestId].result = result;
    clientPredictions[clientId][requestId].timestamp = timestamp;
    clientPredictions[clientId][requestId].validityTerm = predictionValid;
    emit PredictionReceived(clientId, requestId);
//Check AI models integrity
  function CheckAiModel(uint256 serviceId, bytes32 modelHash) public view isAutorized returns (bool isTrue) {
    return aiModels[serviceId] == modelHash;
//Methods for changing SC parameters from the banking application
  function AddAiModel(uint256 serviceId, bytes32 modelHash) public isAutorized {
    aiModels[serviceId] = modelHash;
  function RemoveAiModel(uint256 serviceId, bytes32 modelHash) public isAutorized {
    require(aiModels[serviceId] == modelHash);
    delete aiModels[serviceId];
  function UpdateAiModel(uint256 serviceId, bytes32 oldModelHash, bytes32 newModelHash) public isAuthorized {
    require(aiModels[serviceId] == oldModelHash);
    aiModels[serviceId] = newModelHash;
  function SetPredictionValid(uint value) public isAutorized {
    predictionValid = value;


The blockchain and AI are the two extremes of the technology spectrum, but their collaboration brings us the advantages of both technologies. Flexible AI solutions allow for different approaches to analyzing data and architecting banking services. A blockchain ecosystem with smart contracts provides security and reliability, especially when storing data.

In this article, we described a use case of blockchain and AI convergence for lending services. We used the blockchain for storing data and confirming requests, and used an AI module for making lending predictions.

Our team always stays up-to-date with technological innovations. Our developers are experts in both artificial intelligence and blockchain solutions. If your project requires AI and blockchain skills, challenge us with it!


Let's talk

4000 chars left
Attach a file
By clicking Send you give consent to processing your data

Book an Exploratory Call

Do not have any specific task for us in mind but our skills seem interesting? Get a quick Apriorit intro to better understand our team capabilities.

Book time slot

Contact Us

P: +1 202-780-9339
E: [email protected]

8 The Green, Suite #7106, Dover, DE 19901
United States

D-U-N-S number: 117063762