Case Study. Getting Transaction Data and Scaling Blockchain Infrastructure for Calypso Pay

Calypso Pay is a payment service provider that allows any business to accept payments and make settlements in crypto.

Summary

The Calypso Pay team is developing a payment service for cryptocurrencies and faced the problem of receiving notifications from the blockchain about completed transactions.

Initially, the team tried to develop and maintain the infrastructure for blockchain monitoring on their own, but faced with a few problems with the infrastructure and being on the verge of losing a key customer, they turned to WatchData.

WatchData developed an API for receiving notifications, which was quickly implemented and has worked stable to this day.

Problem

Calypso Pay needs to get data on the status of transactions, which requires constant monitoring of the blockchain for new transactions.

There have been many problems with the in-house infrastructure to retrieve data from the blockchain:

  • When using their in-house infrastructure, there were missed transactions received and delays in the blockchain update. The in-house infrastructure was several blocks behind and it took up to three hours to update balances. Calypso Pay users did not understand the status of the transfer, and such problems risked the loss of a key client.
  • Owning its in-house infrastructure required maintaining its blockchain nodes, the team had expenses because in-house support required a lot of effort and resources of administrators and developers.
  • It was necessary to connect new blockchains. The connected blockchains needed to give their data in a single unified format. At the same time, it is possible to flexibly customize each blockchain. For example, a different number of transaction confirmations depends on the blockchain.

The challenge was that Calypso Pay needed to receive information from multiple blockchain addresses in a short time.

The internal infrastructure of the payment service does not allow for external requests. Therefore it was decided to provide information in a long-polling format. When there is constant communication between systems, only really interesting transactions are sent for processing.

After analyzing the market it became clear that there are no solutions that support the full list of requirements, so Calypso Pay turned to WatchData to develop such an API.

Solution

The WatchData team quickly responded to the request and in no time at all developed an API to meet Calypso Pay’s requirements.

They made lists of events taking into account the specifics of the task, set up constant monitoring of the blockchain, and created an API that allows getting all the relevant transactions data with a single request.

Example of a query that creates two filters that track transactions for specific contracts and wallet addresses:

/calypso/last_block_number
IN:
{
"blockchain": "TRON"
}
OUT:
{
"block_number": 38212529,
"blockchain": "TRON"
}
/calypso/filters/add
IN:
{
"blockchain": "TRON",
"address": "TEnxtXJhMXXgPrchm8Qv6F7m4WQ4vRhSJ1", - wallet adress
"contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t" - contract adress (USDT)
}
OUT:
{
"filter_id": "bc3d3ee1-3fbd-479e-aaf8-b7885b890602"
}
IN:
{
"blockchain": "TRON",
"address": "TMpFZy1vCv3xmtJDQp9dnxX8aaK8hgAUyc",
"contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
}
OUT:
{
"filter_id": "11af35c3-27e8-497c-b098-f8b0276980e1"
}

Example of applying filters to a specific block:

/calypso/filters/check
IN:
{
"block_number": 38212506,
"blockchain": "TRON"
}
OUT:
{
"filters": [
{
"from_address": [
"TEnxtXJhMXXgPrchm8Qv6F7m4WQ4vRhSJ1"
],
"to_address": [
"TNHK9ygsDPjeCikL9RR9AmNJDAps4osYKk"
],
"contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"type": "trc20",
"value": 1128,
"currency": "USDT",
"transaction": {
"hash": "55dddcebf4207a9a33649c3c541b62adf6d45364aa5f1f7b48878716055f71ec",
"fee_value": 4.44168,
"fee_symbol": "TRX"
},
"filter_id": "bc3d3ee1-3fbd-479e-aaf8-b7885b890602",
"filter_target": {
"address": "TEnxtXJhMXXgPrchm8Qv6F7m4WQ4vRhSJ1",
"direction": "withdrawal"
},
"block": {
"hash": "000000000247139a8c6e637b7d7daf20193f574d99dfb296ff4d2fb2df1c59b9",
"number": 38212506,
"created_at": "2022-02-18T11:17:00+00:00"
}
},
{
"from_address": [
"TPgtDGXdFvEaG23JVSH5Ra9tpp8mh24LXZ"
],
"to_address": [
"TMpFZy1vCv3xmtJDQp9dnxX8aaK8hgAUyc"
],
"contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"type": "trc20",
"value": 29.7,
"currency": "USDT",
"transaction": {
"hash": "b504ebb33e82297a3f80b221a05b5a616d5d9d5bcf25bd525ee7889e1106c942",
"fee_value": 4.09668,
"fee_symbol": "TRX"
},
"filter_id": "11af35c3-27e8-497c-b098-f8b0276980e1",
"filter_target": {
"address": "TMpFZy1vCv3xmtJDQp9dnxX8aaK8hgAUyc",
"direction": "deposit"
},
"block": {
"hash": "000000000247139a8c6e637b7d7daf20193f574d99dfb296ff4d2fb2df1c59b9",
"number": 38212506,
"created_at": "2022-02-18T11:17:00+00:00"
}
}
]
}

The data for all addresses can be received in a single request, which takes on average 90 ms, while for one of our competitors this data could only be obtained by requesting each of the blockchain addresses separately and with an average speed of 200 ms for each of the requests.

The system works stably and without interruptions, completely covering Calypso Pay’s tasks. Data accuracy is ensured by the proper processing of blockchain forks.

The problem of transaction data loss was successfully solved.

After switching to WatchData infrastructure the company stopped spending money for the maintenance of its in-house infrastructure. This allowed saving over 300 hours of development time.

A unified dataset for all connected blockchains was implemented, which allowed the team to easily input data into the product and reduce development time.

Different blockchains have different data structures within them and many peculiarities. The variability of data in different blockchains cannot be completely ignored, but WatchData offers an abstraction that makes working with transactions in different networks similar to each other.

The scaling problem is being successfully solved right now; the Tron blockchain has already been added, and transaction data is already being tracked in it as well. New blockchains are in the process of being connected.

The quick addition of new blockchains allows Calypso Pay to give its customers new payment methods with minimal effort to connect them.

The WatchData infrastructure is easy to scale, as the current technical developments and system architecture allow new blockchains to be added quickly.

Transaction history in the Calypso Pay personal account interface. The data is provided by WatchData.

After a long search for a solution on the market, we found that good, reliable APIs for retrieving basic information from the blockchain were simply not available. Some of the solutions on the market were unstable, and once we encountered an API that returned a transaction that didn’t really exist.

So we decided to make the solution ourselves. But it turned out to be a very difficult task, especially considering the level of reliability we needed.

Then we came across the WatchData solution, which pleasantly surprised us in several aspects at once:

1. Universal interface for different blockchains.

2. Reliable operation without interruptions, even for test networks.

3. Comfortable work for real cases. For example, we need to get only a transaction that is guaranteed to pass, which means the different number of confirmations for different blockchains.

4. The team’s commitment to meet us and improve their API. The polling mechanism we needed was non-standard, but WatchData quickly adapted their interfaces to our decision.

5. Active development and addition of new blockchains.

That is why we now use the WatchData solution exclusively. Which covers almost all blockchain interaction tasks. And we are very happy to continue cooperating with them.

Maxim Zhizhin

CTO in Calypso Pay

HELPFUL LINKS

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
WatchData

WatchData

WatchData — API service for WEB 3.0.