How to use Ancon Protocol Hybrid Smart Contracts

You will see there are 4 files in contracts/metadata/src example :

  • lib.rs — main entry
  • host.rs — host entry
  • contract.rs — here is where graphql dag contracts are implemented

Eg metadata retrieval and mutation looks like this:

DID accounts

Before being able to work with smart contracts, create a DID accounts. This account will be anchored in a blockchain and stored as DAG in ipfs. Ancon Protocol relies on DID to manage L2 and cross chain ownership of data, ie non fungible tokens.

Creating and enrolling a DID will have a cost once the platform is enabled.

Uploading contracts

To upload a rust wasm smart contract, sign a payload message with your did account private key and attached message with signature. You can follow the deployer-contract.ts example in playground folder 📂.

You will get a cid which is where the smart contract is stored.

Executing contracts

Similar to deployer-contract.ts, there is a execute-contract.ts, this will send a JSON-RPC request with the following properties:

  • from — the sender DID cid address (later releases will support both cid and did)
  • data — graph ql query
  • signature — payload signature

If everything goes well, convert the results to plain text from hex and parse with JSON.parse.

In the next post we’ll go through the proof implementation using vector commitments with ICS23 and using L1 consensus to validate proofs.

--

--

--

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,

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

{UPDATE} 逆転裁判4 Hack Free Resources Generator

{UPDATE} Blocky Roads Winterland Hack Free Resources Generator

Cyber Security Trends of 2018 Every Corporate Leader Needs to Know

ACTIVE — HackTheBox WriteUp

Sessionless Authentication using JWTs (with Node + Express + Passport JS)

ForTube Security Vulnerability Fix

{UPDATE} Color Roll Hack Free Resources Generator

Publish Java Artifacts to Maven Central

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
IFESA

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,

More from Medium

User Dashboard, PlutButton Game; let me give you a double doses of goodness as Plutos Network…

Arseeding server design

Redes descentralizadas y Prueba de Existencia (Proof of Exi

The anatomy of the block (head) Pt. 2