Ancon Protocol v0.4.0 — Hybrid offchain / onchain

IFESA
3 min readNov 29, 2021

We ditch Cosmos SDK blockchain. That was the huge news. Main reason is that once we got closed to called it done, we did a REST API inventory and found out that most could be offchain features.

Whatever integration with onchain by this time now, can be done with EIP-3668 or Durin , so we did our homework and Durin together with latest APIs from go-ipld-prime and go-graphsync made sense to do the migration to a hybrid model.

This is not new. Chainlink has a nice post about Hybrid Smart Contracts and we mention Chainlink et al in our Filecoin grant proposal.

Now that we manage to release a working product, plus pending bridges, let’s go through the features at a glance.

Ancon IPLD Router Sync

We revived this source code and polish it, and will be getting most of the features for offchain (DID, IPLD, Graphsync, Durin Gateway). It works in tandem with a forked IPFS with Graphsync enabled (beta still, but works). These two are working open source that syncs to public IPFS.

fsstore from go-ipld-prime

We are using this to see if we get streaming features for NFTs. Like before, beta software, needs more testing and benchmarks.

How to secure offchain DAG changes to blockchain

This research actually took a few days, but in fact has been discussed and PoCs since the days of PAID Network.

Imagine this use case where an insurance company needs to update some data, say dates on an insurance. If we had a legal tech contract signed and set in stone, with some of these blobs of data in IPFS or some subgraph, how do we in a trusted way apply these changes to a new immutable cid hash?

Before Durin, you will had to use oracles, with these oracles you are able to update offchain sources trustless. And it will cost you of course.

Using Durin, is a bit cheaper, not trustless but “trusted”, kind of a poor man’s solution for securing offchain data sources.

But it seems for using it with DAGs like IPLD, by letting the proofs be managed by blockchains and immutable decentralized DAGs/Data by IPFS, we get:

  • We are no longer tight to a single chain, in fact, we can be agnostic. The first adapter for Ancon Protocol is for EVM chains.
  • A bit complex, but it might be also doable, a cross chain messaging through secure offchain gateways.
  • And we get all sorts of features for NFT, eg batch metadata updates.

Expression Languages

To make this more complex, a rules engine might be needed to expect events and then process these and execute the data changes. There are nice tools like Parsiq and OpenZepellin but these are mostly for chain devops.

While working for PAID, we had in mind JEXL. This time I tried CEL. But eventually after a few days, neither JEXL, Starlark or CEL will have made the cut because one thing only matters, developer experience and tooling support.

I knew The Graph uses GraphQL extensively so I thought maybe it will work for my now call Ancon DAG Contracts (or hybrid because of its nature). Making tooling for hybrid smart contract is tough, first do Solidity and think about proofs and signatures and then GraphQL and think about how to fit the immutable of IPLD Dag blocks.

GraphQL DAG Designer

Now we can query and mutate using Ancon DAG Designer. The developer experience is similar to creating a Polkadot Substrate chain, fork off the repo, and customize schemas, adapters and contracts. The DAG designer is in /query and can be accessed online in https://ancon.did.pa/api/v0/query

What’s next

We will maintain these technology and grow the features with time. I think once we get demos online I’ll get more to share. Thanks!

— Rogelio

--

--

IFESA

Industrias de Firmas Electrónicas, S.A. (IFESA) es la primera empresa panameña dedicada a tecnologías basadas en algoritmos criptográficos, firmas electrónicas,