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

Daily Report: A New Form of Censorship in App Stores

Unified Threat and Security Program Management Closing The Skills Gap

Unified Threat and Security Program Management Closing The Skills Gap

Topmost Reasons That make Android Oreo a Perfect OS for Android App Developers

PowerShell Script: find GPO by policy.

CYBERSECURITY INTEGRATED WITH ITSM

A non-technical explanation for Asymmetric Encryption and Public-Key Cryptography

{UPDATE} Spider Solitaire Hack Free Resources Generator

The Current State of DeFi Security

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

Extreme Integrity in Decentralized World

Solution Of Maze using A-Star Algorithm

Web3 is dead! Long live Web 3.1.

AMA Recap — Hashtagger