OpenLaw has integrated Chainlink’s decentralized oracle service to denominate agreements in USD and settle them in ether, creating the first real-world link between traditional agreements and fiat currencies.

Image from Blockonomi

Blockchains struggle to interact with traditional fiat currencies. Without the ability to obtain information about the real world outside a closed blockchain system, smart contracts are limited by the data available to them when they execute. These limitations create practical limitations to mainstream adoption. That’s why we’ve been working with the team at Chainlink to bring mainstream, real-world integrations to our legally enforceable, automated, and blockchain-based contracts.

In our latest demo, we show how you can integrate our legally binding smart contract platform with the Chainlink off-chain oracle middleware service, ushering in next generation legal agreements where payment terms and asset transfers execute automatically, with less room for error.

Chainlink Oracle Integration is a Game Changer

When smart contracts execute on blockchains, including Ethereum, they only have access to limited, transaction-based data. This limitation makes it difficult to fully automate common contractual relationships, which today are denominated in traditional fiat currencies. To solve this problem, it becomes necessary to expand the universe of data available to Ethereum-based smart contracts through oracle services like Chainlink. The combination is nothing short of a game changer.

As we described in our recent announcement, Chainlink makes this possible through its blockchain middleware — a middleware enabling smart contracts to access off-chain data such as feeds, web APIs, and traditional bank account payments. By providing smart contracts with trustworthy access to these key resources, Chainlink allows smart contracts to mimic real world agreements.

A Real World Use Case: Converting Ether Into Fiat Currency

In this demo, we explore a use case many can relate to: receiving an hourly wage for work. In prior demonstrations, we have shown how an employee and an employer could create an employment relationship on the OpenLaw platform. In that relationship, one of the key employment terms was that the employee was to be paid a certain amount of ether per minute.

There are some legal and practical challenges with that approach, however, because the price of cryptocurrencies fluctuates, which may slow mainstream adoption. First, a steep drop in ether’s price against a fiat currency like the U.S. dollar could cause the employee’s wages to fall below statutory minimum wage requirements.

Second, since most employees still rely on fiat currencies to pay for basic goods and services, employees may be unwilling to continue working for the employer if the value of the ether drops too significantly. And of course, the contrary is true for the employer as well — the value of ether against fiat currencies may rise to levels too high to warrant continuing to pay at the contracted-for rate.

One solution to that problem (short of turning to a stablecoin solution) is to tie the employee’s earnings to the exchange rate from ether to the employee’s fiat currency of choice. Unfortunately, the Ethereum blockchain does not natively store exchange rates.

Thus, being able to pay an employee an amount of ether equivalent to the current exchange value of the fiat currency is impossible without an external data point or, more powerfully, an oracle technology like Chainlink. And this is true for almost any contract where the parties want to leverage the power of the blockchain and smart contracts to exchange value while maintaining the reliability of traditional fiat currencies.

How We Did It

We thought through how to change the ether per minute salary term in the prior demonstration to describe and implement the salary payment in dollars. One choice would be to “fix” the exchange rate at time of contracting such that the employee and employer define the precise exchange rate at the time they enter the employment relationship. While this may solve the problem temporarily, the exchange rate may prove wildly inaccurate over time.

Another solution would be to give the employer, employee, or other party the ability to manually adjust the exchange rate periodically, which introduces the same trust problems that the blockchain aims to solve. A third choice relies on a trustworthy oracle solution, through Chainlink, to decentralize and increase trust in the USD/ETH conversion rates between the parties. This is, of course, the path we chose to follow in this demonstration.

Having settled on the Chainlink oracle middleware, we then revisited our prior demonstrations contracting for employment relationship. In those demos, we documented the legal agreement using OpenLaw’s powerful markup language and also engineered a Solidity-based smart contract to bring certain aspects of the legal prose to life.

Consistent with our Chainlink-based design choice, we modified the smart contract in two ways. First, we integrated Chainlink and, second, changed the payments to be hourly, which we anticipate is more consistent with mainstream expectations, as we described above.

The new smart contract accepts a U.S. dollar hourly rate instead of an amount of ether per minute. At the time of payment, the smart contract calls the Chainlink service, retrieves a USD to ETH conversion rate, calculates the amount of ether earned for the hour, and then holds the ether for the employee to come and withdraw at his or her leisure. This latter change was thought to be consistent with the withdrawal pattern and to save some gas costs for the employer.

For demonstration purposes, we also developed a rudimentary user interface using React, the MetaMask plugin, and Truffle to allow the employee to view his or her wages available for withdrawal as well as to transfer the earnings to his or her own account when ready.

Conclusion

The power of the OpenLaw platform and markup language, combined with smart contract and Chainink’s middleware technology come together to make the Employee Offer Letter much more useful for a mainstream audience. We plan to work with multiple oracle providers in the future but are proud to show the capability of Chainlink’s current integration.

We look forward to showing you more features available via OpenLaw over the upcoming months. If you want to learn more send us a note at hello@openlaw.io.