Image for post
Image for post

Sentinel Chain State Monitor

Sebastián Ponti
Aug 20, 2019 · 9 min read

Sidechain is a new and revolutionary concept. It is basically a separate blockchain attached to the main one which allows tokens or digital assets from one chain to be used in another through the use of a two-way peg. The benefits of using sidechain are many. For example, faster transactions, better privacy or, in the case of RSK smart contract functionality using Bitcoin as an underlying asset. Sentinel Chain is one such sidechain based on Ethereum Virtual Machine (EVM) that utilises a SENC-pegged cryptocurrency called SENI (Sentinel Chain Internal Token) as transaction payments within the Sentinel Chain itself. However, in order to do this, we implement a Sentinel Chain Bridge — this bridge is a fork of the work done by members of the POA Network, the POA Token Bridge.

Image for post

The Sentinel Bridge acts as an intermediary between Ethereum Mainnet and Sentinel Chain. This bridge uses a set of contracts to make the cross-chain transactions and regulate the balance between SENC and SENI. In order to convert SENC to SENI, it is necessary to lock the desired amount of SENC in the Foreign Chain (Ethereum). The user must send the tokens to the Foreign Contract address. Once this happens, the Bridge Validators are in charge of validating the transaction, sending the signal to the Home Contract to mint (create) the same amount of SENI in Sentinel Chain, before sending it to the user who performed the cross-chain transaction. As we can see the relation between SENC and SENI is 1:1 and the user can go back and forth to Ethereum following similar steps in reverse order. As it appears in the diagram below, a whitelist contract is used to restrict users and other contracts to charge a toll for the service, you can find the detailed description of this contracts in the Sentinel Chain Network repository.

Image for post
Cross-chain transaction diagram from Mainnet to Sentinel Chain

Problems

1. Problems with the bridge

For example, to detect slow performance or component failure, one measurement could be the time it takes to process a cross-chain transaction in each of the components of the bridge. Another measurement could be the price of the toll charged when performing a cross-chain transaction, and adjust the toll based on the fluctuations in the price of the Ether and SENC. It should be noted that the toll is charged so as to enable the execution of transactions required by bridge validators. Therefore, the validators should always have a balance in Ether to pay for the release of SENI currencies. This is another real-time metric to take into account.

2. Problems with the network

Let’s suppose that one of our users wishes to convert SENI to SENC, and a fork occurs. The cross-chain validation process is performed without any problem and the SENC is released in Ethereum. After this, a re-organization takes place in the Sentinel Chain. The transaction that was executed to perform the conversion occurred in the shortest chain. This will result in an imbalance between SENI and SENC.

Sentinel Chain Monitor

Image for post
A general overview of the monitoring architecture

All information processed and consumed from the blockchain layer will be stored in a time series database designed for this type of solution. Time series databases are used to store logs in a period of time and it is used to solve the challenge of millions of events coming in. For our monitoring system, we are going to use InfluxDB because it is open-source, it has good performance and uses InfluxQL (the query language).

On the front-end, Grafana will be used as part of the view layer to visualize, filter and analyse the data. It is an open-source with powerful features such as real-time viewing. It also supports native connection to various backend systems that store time series data, including InfluxDB. With it, we can create comprehensive charts with smart axis formats using Grafana’s fast client-side rendering, even over long ranges of time.

Currently to read data from the blockchain in the Sentinel Chain, we are using an internal API. But this data is obtained in real-time and we do not have any feature to get the history of these events. So to create this new monitoring system, we need to make some modifications in the code of this API to send the data in a proper way to the time series database. To solve this, we will create two instances of this new API within the metrics agent layer, one for each chain to divide the reading load.

The proposed monitor system is one of the best ways of being able to peek into the internals of the product and to quietly find out what’s going on. Also, it is a necessary tool for data input within the life cycle of a program, particularly for the stages of requirements analysis, maintenance and support. For these reasons, it will be of exclusive use by the Sentinel Chain team.

Below, we describe the features and functionalities that of the two proposed monitors that will be included in the system.

Bridge monitor

These cases can be:

  • The number of transactions that a bridge validator can execute fall below a set level (based on the Ether balance).
  • Stalled transaction (withdrawal and deposits).
  • Incorrect parity in the token total supply on both chains.
  • The differences in the list of validators between the chains.
  • The difference in the number of signatures required between the chains.

For the alert system, we are going to use Kapacitor. This tool is a native data processing engine for InfluxDB and is an integrated component in the InfluxDB platform. It also has integration capabilities with multiple alerts destinations like Telegram or Slack. In addition, we can store the alert history as time series data in InfluxDB.

Image for post
Connection of alert system components

Fork monitor

When a fork happens, Kapacitor will process this event and sends the respective notification to the administrators. Based on the information of the notification and the dashboards alerts from Grafana, the administrators will analyse the compatibility of the forks and choose which one is the right one. To quicken the process of re-establishing the normal functionality of the blockchain, we are going to create a set of automated actions that prevent the creation of more forks or lost of transactions.

For example, before a chain re-organization happens:

  • A backup of the old chains will be created.
  • A comparison should always be made between forks and if the result of a supposed chain re-organization is incompatible (with lost transactions), the service that provides a connection to the blockchain will be closed.

Conclusion

As we mentioned earlier, we are using open source code in part of the components that make up the Monitor, so the final product will also be open source and can be found in the Sentinel Chain Network repositories.


InfoCorp Technologies Pte. Ltd. Founded in 2015 with headquarters in Singapore, InfoCorp Technologies’ aim as an integrated FinTech and AgriTech company is to bring inclusive financial services to the livestock industry in emerging markets via its blockchain-based platform, FarmTrek. Bringing together best talent across the globe, InfoCorp has staff in Rwanda, Myanmar, India, Vietnam, Argentina, and the US. FarmTrek was successfully piloted with two Myanmar government agencies and launched in 2019. Its innovation has been acknowledged as one of 10 winning business models for women entrepreneurs, co-funded by the United Nations to improve access to finance for Women micro, small and medium enterprises (MSMEs) via the UN FinTech Innovation Fund.

Sentinel Chain is a blockchain-based international marketplace for cross-border financial services and the world’s first platform to accept the use of livestock as collateral. Taking a unique approach to the last mile problem of financial inclusion, the Sentinel Chain model establishes livestock provenance through the creation of livestock insurance on blockchain — the registration of livestock provenance on blockchain provides the unbanked with a new opportunity: the real possibility of accepting livestock as ‘collateral’ for loans. Sentinel Chain is a project by InfoCorp Technologies.

Website: https://sentinel-chain.org
Website (InfoCorp): https://infocorp.io
Website (InfoCorp) (Spanish): https://infocorp.io/es/
Medium: https://medium.com/sentinelchain
Medium (Chinese): https://medium.com/sentinelchain-cn
Twitter: https://twitter.com/sentinelchain
Reddit: https://www.reddit.com/r/SentinelChain/
Facebook: https://www.facebook.com/SentinelChain/
LinkedIn: https://www.linkedin.com/company/sentinelchain/
YouTube: https://www.youtube.com/sentinelchain
Announcements: https://t.me/sentinel_ANN
Telegram: https://t.me/sentinelchain

Sentinel Chain

The Blockchain for Global Financial Inclusion

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

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