Pushing technology the hard way (Part4)

This blog is about creating a demo application using the open-source data database immudb. As described in previous blog series our backend is running on kubernetes. The huge advantage of immudb is combining immutability with scalability. It is capable to process up to 1,6 Mio writes per second with verification. A great use case should take advantage of that.

Finding a use case in organizations

Large organization have a lot of guide lines in place that will restrict the project quite a bit. For example you get some specific recommendations for the technology that you should use to develop your app. In this case spring boot is the standard for developing backend services. Luckily immudb has integrations for almost all widely used programming languages. Building our app will be much easier using the immudb integration immudb4j. Simply add the dependency to your pom.xml:

<dependency>  
 <groupId>io.codenotary</groupId>  
 <artifactId>immudb4j</artifactId>  
 <version>0.9.0.6</version>  
</dependency>

Now that we know our technology stack, we have to look out for a proper use case. While looking into the services for tax consultants I found something interesting. Tax consultants are uploading receipts, many thousands receipts. They have to be processed up to a certain deadline and should never be changed/manipulated. immudb would be the perfect database for that.

What do we need

To replicate that service we need to be able to upload files and store them or their hash in immudb. The app has to support uploading, file metadata extraction, notarization and a verification service.

Technical Details

Uploading files is very good described at this example: Uploading files with Spring MVC. It is almost exactly what we need. We just have to add hash generation for the file metadata.

File file = new File(url);  
MessageDigest shaDigest = MessageDigest.getInstance("SHA-256");  
this.shaChecksum = getFileChecksum(shaDigest, file);

Now the filename and the hash as a key has to be saved in immudb. While working on a slow lab system, we found out about session pooling. Using immudb4j we can create gRPC Sessions. Our app will create some sessions and assign them to requests. The requests are giving their sessions back into the pool when they are finished. That boosted performance quite a bit. The session pooling was developed by following this guide.

public class ImmudbConnectionPool
implements ConnectionPool {

    private String url;
    private String user;
    private String password;
    private List < ImmuClient > connectionPool;
    private List < ImmuClient > usedConnections = new ArrayList < > ();
    private static int INITIAL_POOL_SIZE = 2;
    private static int MAX_POOL_SIZE = 20;

    private ImmudbConnectionPool(String url, String user, String password, List < ImmuClient > pool) {
        this.connectionPool = pool;
        this.url = url;
        this.user = user;
        this.password = password;
    }

    public static ImmudbConnectionPool create(
        String url, String user,
        String password) throws IOException {
        List < ImmuClient > pool = new ArrayList < > (INITIAL_POOL_SIZE);
        for (int i = 0; i < INITIAL_POOL_SIZE; i++) {
            pool.add(createConnection(url, user, password));
        }
        return new ImmudbConnectionPool(url, user, password, pool); //url, user, password, pool  
    }

Using sessions from the pool will be invoked by requests from the home controller of our Spring Boot app. We will save the hash of the file as key and the name as value. Of Course we could add more information in the value section but that’s it for the demo:

// Obtaining a connection
ImmuClient attestClient = connectionPool.getConnection();  
attestClient.useDatabase("test");
// Setting (adding) a key-value.  
attestClient.set(key, name.getBytes());  
// Getting it back, by key (in a verified way  
// that reports any tampering if it happened).  
Entry entry = attestClient.verifiedGet(key);
// Releasing a connection
connectionPool.releaseConnection(attestClient);

The tax receipts hash is now stored immutably in immudb and they can be verified by querying with the hash of a file. Changes made to the receipts can be immediately recognized. Manipulating immudb in order to hide evidence is not possible without detection either.

Summary

This is the final of the Pushing technology blogs. We started a project to promote innovation. Installed the fastest immutable database in kubernetes. Created a demo application and presented the project. Here are the things learned from it: essentially fellow employees in your rank will always be the most skeptical. It takes a lot of courage to promote something you believe in. It is a long and hard way with slim chances of quick results. Atleast most executives will appreciate initiative and courage in their staff. Timing is very important for innovation. Even if your project isn’t an immediate success, it might be in some weeks, months or years.

CNIL Metrics & Logs

Self-Hosted performance monitoring and compliant log analysis for VMware vSphere, container and much more.

immudb

Built on the fastest immutable ledger technology. Open Source and easy to use and integrate into existing application.

Codenotary Cloud

Trusted CI/CD, SBOM and artifact
protection with cryptographic proof.
One CLI to manage all.

Subscribe to Our Newsletter

Get the latest product updates, company news, and special offers delivered right to your inbox.

Subscribe to our newsletter

Use Case - Tamper-resistant Clinical Trials

Goal:

Blockchain PoCs were unsuccessful due to complexity and lack of developers.

Still the goal of data immutability as well as client verification is a crucial. Furthermore, the system needs to be easy to use and operate (allowing backup, maintenance windows aso.).

Implementation:

immudb is running in different datacenters across the globe. All clinical trial information is stored in immudb either as transactions or the pdf documents as a whole.

Having that single source of truth with versioned, timestamped, and cryptographically verifiable records, enables a whole new way of transparency and trust.

Use Case - Finance

Goal:

Store the source data, the decision and the rule base for financial support from governments timestamped, verifiable.

A very important functionality is the ability to compare the historic decision (based on the past rulebase) with the rulebase at a different date. Fully cryptographic verifiable Time Travel queries are required to be able to achieve that comparison.

Implementation:

While the source data, rulebase and the documented decision are stored in verifiable Blobs in immudb, the transaction is stored using the relational layer of immudb.

That allows the use of immudb’s time travel capabilities to retrieve verified historic data and recalculate with the most recent rulebase.

Use Case - eCommerce and NFT marketplace

Goal:

No matter if it’s an eCommerce platform or NFT marketplace, the goals are similar:

  • High amount of transactions (potentially millions a second)
  • Ability to read and write multiple records within one transaction
  • prevent overwrite or updates on transactions
  • comply with regulations (PCI, GDPR, …)


Implementation:

immudb is typically scaled out using Hyperscaler (i. e. AWS, Google Cloud, Microsoft Azure) distributed across the Globe. Auditors are also distributed to track the verification proof over time. Additionally, the shop or marketplace applications store immudb cryptographic state information. That high level of integrity and tamper-evidence while maintaining a very high transaction speed is key for companies to chose immudb.

Use Case - IoT Sensor Data

Goal:

IoT sensor data received by devices collecting environment data needs to be stored locally in a cryptographically verifiable manner until the data is transferred to a central datacenter. The data integrity needs to be verifiable at any given point in time and while in transit.

Implementation:

immudb runs embedded on the IoT device itself and is consistently audited by external probes. The data transfer to audit is minimal and works even with minimum bandwidth and unreliable connections.

Whenever the IoT devices are connected to a high bandwidth, the data transfer happens to a data center (large immudb deployment) and the source and destination date integrity is fully verified.

Use Case - DevOps Evidence

Goal:

CI/CD and application build logs need to be stored auditable and tamper-evident.
A very high Performance is required as the system should not slow down any build process.
Scalability is key as billions of artifacts are expected within the next years.
Next to a possibility of integrity validation, data needs to be retrievable by pipeline job id or digital asset checksum.

Implementation:

As part of the CI/CD audit functionality, data is stored within immudb using the Key/Value functionality. Key is either the CI/CD job id (i. e. Jenkins or GitLab) or the checksum of the resulting build or container image.

White Paper — Registration

We will also send you the research paper
via email.

CodeNotary — Webinar

White Paper — Registration

Please let us know where we can send the whitepaper on CodeNotary Trusted Software Supply Chain. 

Become a partner

Start Your Trial

Please enter contact information to receive an email with the virtual appliance download instructions.

Start Free Trial

Please enter contact information to receive an email with the free trial details.