A Quick Introduction to æternity’s Middleware

Stoyan Vlahovski
7 min readDec 3, 2019

--

æternity is one of the blockchain infrastructure providers that have focused heavily on both R&D and user-friendliness of decentralized apps. The æternity community is striving to not only provide the best experience for users, but also for developers who create this new type of applications (called æpps). That’s the reason why the æternity ecosystem enjoys a number of useful tools including:

The focus of this piece will be the Middleware. Let’s jump in.

æternity’s Middleware — What is it and Why You Should Care?

The easier it is to interact with æternity, the more developers will use it, increasing the chances of wider mainstream adoption. Deliberating on the ways to achieve this John Newby, the SDK team lead, came up with the idea of the Middleware. The developer community quickly adopted it.

A “middleware” is a server process which sits in front of a node. As a result, one can query the chain without affecting the work of the node. The node is anyway much less efficient in providing the queried information which negatively affects the dev user-experience.

The four main reasons for developing æternity’s Middleware include:

  • Faster access to node information — yes, one could query the node directly, but the process will be much quicker with the help of a middleware.
  • Additional queries — not only will it save time but it will also enable you to run further queries (meaning lots of helpful new information at your disposal).
  • Store blockchain history in a PostgreSQL database — there is nothing more annoying than a complex dump/import into other systems. The Middleware will make this as easy as possible.
  • Explore transactions, generations, state channels, oracles, names, contracts and more.

So what can the Middleware offer æternity’s users and developer community?

How Can You Use It (and Make Your Life Easier)

Get Notifications (Don’t Waste Time)

If you are a developer, you probably wouldn’t want to poll the blockchain all the time. That could be tedious and annoying at times. There is a solution. The Middleware offers a WebSocket API which makes it possible to subscribe to events of interest. You will automatically receive a notification every time a particular event happens.

Use cases include, but are not limited to:

  • looking for queries to an oracle, possibly to generate responses,
  • being notified of calls to a smart contract,
  • finding payments from and to a particular account.

Developers can visit the “Websocket Interface” section and learn how to subscribe.

Running the Middleware (Trustlessly)

The Middleware is very light and has minimal hardware requirements. Anyone can run it. There are two modes of operation available:

  • population — loading the blockchain into the database
  • serving — exposing the database

In view of making it effortless to use the Middleware, æternity hosts its own instances which you are more than welcome to use. However, if you are reluctant to trust what is provided, you can run it and verify the data yourself.

If you want to know more about the installation of the Middleware, go to the guide in GitHub.

The Interface: So Good a Child Could Use It

As Leonardo Da Vinci once said, “Simplicity is the ultimate sophistication”.

This quote perfectly describes the Middleware’s interface. You can access the blockchain explorer by going to https://mainnet.aeternal.io/.

If you are not familiar with the concept, a blockchain explorer is like a blockchain browser. You can use it to get a graphical representation of information delivered as code.

Most people use blockchain explorers to track transactions. However, since the æternity protocol features 23 different types of those, there is much more information to be considered.

Transactions

With the help of the Middleware, users can easily see the sender, recipient, the block height, amount and the transaction fee for any transfer of AE tokens that takes place on æternity’s Mainnet.

Generations

In the generations section, one can check the current Key Block height, together with the number of transactions, Microblocks, Key Block age and target data are also available.

[State] Channels

The Middleware also enables users to receive information about the currently open state channels. State channels significantly improve scalability and privacy of AE token transfers and smart contract execution by moving them off-chain. Once a channel is open, users can initiate free and immediate token transfers. They can also run smart contracts completely privately.

The channels section of the Middleware shows the respective channel ID and, in case you are curious, you can click on it to see further information (such as Initiator, Responder, Nonce and more).

Contracts

æternity is famous for its functional smart contracts and highly efficient virtual machine (FATE) that runs them. Thanks to the Middleware anyone can inspect all available on-chain smart contracts. Clicking on the Contract ID opens up a screen with even more information, including Hash, Signatures, Call Data, Code, VM Version, ABI Version and Version.

Names and Name Auctions

As I mentioned at the beginning of this article, æternity wants to provide the best experience for users and developers. That’s where the protocol-integrated Naming System or AENS comes into play. Typically, entities on most blockchains are identified by hashes. Those are n-bit numbers and tend to be rather unfriendly to the human eye.

æternity recently announced the launch of the AENS on the Mainnet. To get a specific name, users participate in fully decentralized, trustless, and secure auctions through æternity’s mobile Base account manager (an AE token wallet and more). All names feature the .chain extension and can be pointed to wallets, smart contracts, oracles, state channels, and really anything that is shorter than 256 bits.

The Middleware displays information about all names that are currently owned in æternity.

The process of acquiring a name is similar to buying a domain for a website. However, in æternity, if another user also wants the name you are trying to register, they can offer a higher price for it by initiating an auction. Auctions are time-based and the duration of phases depends on the length of the name. Long names are registered almost immediately, while short names take much longer. Once the time elapses, the name is registered with the account of the highest bidder. All names must be renewed after 100 days with a single on-chain transaction. If a name is not renewed, it becomes available again.

The Middleware features information about all ongoing auctions, the winning bid for a specific name, names that will expire soon and more.

Here is an infographic dedicated to the AENS.

Oracles

Finally, æternity’s Middleware has a section dedicated to another protocol-integrated feature - oracles.

Blockchain technology promises to cut out intermediaries through the use of smart contacts which automatically execute when certain conditions are met. One of the main challenges in this endeavour is to provide smart contacts with accurate real-world data.

Oracles solve this problem by connecting the physical and the virtual world of blockchain platforms. For example, oracles can be used in supply chain management to trigger a smart contract when a package reaches a specific location.

æternity has included oracle services in the core blockchain protocol, giving æternity’s oracles several unique advantages:

  • scalability — æternity’s blockchain has no scaling limits.
  • data format — oracles have published APIs which allow interaction with smart contracts written in a wide variety of languages.
  • cost — protocol integration and low on-chain fees make it cheap to create, query and reply to oracles.

æternity’s Middleware provides an uncomplicated way to explore the different oracle queries. The interface enables a user to check the query fee, the query/ response format, and when it expires. One can find out more information about the query and the response itself by clicking on the Query ID.

æternity’s Middleware is an elegant solution to many issues. It was created out of necessity and will make querying the blockchain remarkably easier.

Please feel free to visit GitHub, propose feature requests and submit bug reports.

Interested in æternity? Get in touch:

GitHub | Forum | Reddit | Bitcointalk | Telegram | Twitter | YouTube

--

--