Inspiration

I wanted to learn how bridges and external adapters interact with smart contracts, and I also wanted to do this with a real world application using open banking apis.

What it does

TinkLock is a decentralized escrow contract that is inspired by an escrow contract built by Pierre @Moralis, but where the escrow is settled once the smart contract reads that the sellers bank account has received the fiat amount agreed between the two parties.

How we built it

This is a simple project just utilizing two solidity smart contracts, one for the api consumer and one for the escrow contract. The bridge was built in python and is deployed as a lambda function. The main novelty of the project is the bridge and its interaction with a commercial bank, allowing the smart contract to read the fiat account balance of the seller through a Chainlink node.

Challenges we ran into

The main problem was figuring out how the open banking api worked, as well as the nuances of the oauth client/user authentication flow and its application inside the bridge.

Accomplishments that we're proud of

I'm especially happy with the way the open banking bridge turned out, as I haven't seen anyone else do something like it before.

What we learned

I learned how to work with bridges and external adapters, as well as hosting jobs on a node myself. I also learned how to work with the open banking api of Tink.

What's next for tinklock

I would like to work more on the smart contracts and add the features that I initially wanted to have, such as buyer depositing collateral and a time lock functionality using keepers. It would be nice to also try building a front end and move the user and credential ids to a database instead of them being manually added to the .env file of the bridge.

This is only the most minimal working implementation of this technology. In a more realistic scenario, you would have the buyer also register with the Tink bridge to first verify his account balance and later to initiate payments. This payment being fulfilled could then be the trigger for evaluating the escrow instead of polling the sellers bank account balance. This would remove the assymetry (in favor of the seller) in the trade, where the reputation of the node operator would become the main security guarantee for both escrow parties.

Built With

Share this project:

Updates