Get in touch

Have a question? Let our experts guide you

Get in touch

Engineering

Supercharge your Thought Machine Vault Core Smart Contract API v4 upgrades

Thought Machine

Nov 17, 2023

5 min read

Supercharge your Thought Machine Vault Core Smart Contract API v4 upgrades

Background

Vault Core is a digital core banking system providing a real time ledger that maintain the current state of the bank’s account. Smart Contracts are internal code assets that run inside the Vault Core, containing the rules and logic of a financial product. They are self-executing, meaning that they run automatically when certain conditions are met, and to govern the product behaviour and the rules for modifying balances. They greatly enhanced flexibility through configuration updates without altering the underlying ledger platform code and allows banks to efficiently and safely create, test, and deploy new products into the market.

Inline image

Benefit of Contract Language API 4

Since late 2022, Contract Language API 4 has been officially released and integrated into Vault Core 4.5. It represents a major update offering several key advantages for smart contract engineers:

  1. Improved Performance: This update significantly enhances the execution speed of the Smart Contract code, resulting in much faster performance. For instance, the get_balance_timeseries now executes almost twice as fast, and get_posting_instructions is almost three times faster compared to API 3.
  2. Enhanced Developer Experience: The Contracts Language API Python implementation code is now accessible through the contracts_api package. Developers can use it as regular Python modules, making them easy to import. Common coding tools like autocompletion, type annotations and linters are now supported during contrNact code development.
  3. Accelerate Financial Product Development : The updated feature library in API 4 provide a richer and more powerful toolkit for contract writers, enhance code standardisation, promote reusability and improve testability of your code.

Considerations and Tips

To ensure a smooth transition of your smart contract to Contract Language API 4, there are several key considerations to keep in mind:

ConsiderationsTips

Separate code migration work from BAU feature changes

  • Establish a clear scope and purpose for code migration. This will improve the team focus and leading to a more reliable timeline.
  • For BAU changes, we recommend a separate branch to allow parallel development

Invest in testing automation to streamline future upgrades

  • To enhance testing automation and the robustness of your test cases, we recommend adopting Behaviour-Driven Development (BDD) approach.
  • The test cases are written in a business-friendly language, such as Gherkin, that remain independent and reusable of the Language version after every upgrade.
  • At Ikigai Digital, we know how to leverage BDD to automate your behaviour testing and de-risk your delivery. For more details about our experience and offering, please visit this article.

Proactively managed Contract Language version to ensure continuous support and alignment to Vault Core releases

  • Thought Machine publish a compatibility matrix to describe the relation of Vault version against the Contract Language version. Therefore, it's essential to establish a broader strategy to guarantee the compatibility and continued support of their versions.
  • Traditionally, Vault Core ships a major release in every calendar year, and those marked as deprecated in the previous release are subsequently removed. Therefore, by the time Vault Core 7.x is released, v3 support will be discontinued. As a result, we recommend to perform the upgrade promptly to take advantage of the benefits of v4 early and to reduce potential stress if done in a later cycle.

Common Smart Contract Upgrade Patterns

Smart Contract upgrade is similar to other application upgrade projects, and below are some common patterns for considerations:

PatternDescriptionProsConsEffort Estimates

Selective Rewrite

Make changes to API 3 code on a need basis. Focus on replacing unsupported method to API 4 equivalent

Smallest rewrite effort compare to other two patterns

Not fully realising the benefits of API 4, including enhanced code structure, reusability and testability.

Low

Function Wrapper

Implement a function wrapper to act as an adapter to the retired API 3 functions. The wrapper will translate the API 3 request and response to API 4 format.

Reduce the risk of changing the Smart Contract behaviour, as it retain the existing code structure

Mixing API 3 and 4 style formatting, could lead to code complexity and increased long term maintenance efforts

Medium

Full Rewrite

Develop a new Smart Contract following API 4 best practice

Take full advantage of API 4 by embracing the new structure, better performance through utilisation of prebuilt libraries and guarantee compatibility for future upgrades

Higher effort to analyse the legacy code and refactor to API 4, for ensuring the same functional quality after the rewrite.

High

What is Ikigai Digital Smart Contract Upgrade Accelerator?

Our accelerator aims to de-risk your delivery based on your needs and pattern selected.

We collaborate closely with our clients, prioritising a co-development strategy with their engineers, as we believe that knowledge transfer is fundamental for their long-term success.

In addition to that, we also provide a conversion package that contains:

  • a standard project structure
  • a comprehensive checklist with changes required for meta-data, import, data fetcher, hooks, internal functions and postings conversion
  • an example function wrapper library
  • a sample project plan and effort estimates

We consider Smart Contract upgrade is an opportunity to enhance development skillsets and align closer to the latest best practices.

How can we help?

Ikigai Digital has invested in technologies that enable us to deliver the latest Vault Core and Smart Contract version from planning to execution.

With a variety of engagement and service options, we can provide client with light touch for rapid delivery, through to establishing a Centre of Excellence (Vault Core CoE) to foster continuous engineering improvement and product innovation.

Find out more about how Ikigai Digital can help you with your next core banking adventure.

References

[1] Smart Contract and Vault Version Compatibility

[2] Smart Contract Conversion Guide

[3] Smart Contract Testing with BDD and Gherkin

Stay up to date

Every few weeks we share the latest insights and news from the world of fintech.

Enjoyed this post? Join our team

Join our team and help build the next generation of digital banks

Have questions? Get in touch

Our team of experts can help you get the ball rolling.