Polkadot Summit - XC Smart Contracts Notes

Polkadot Summit, Copenhagen 2023

XC Smart Contracts

Estimated # of attendees: 20

Attendees/key participants:


  • Miguel Santafé (Composable)
  • Jafar Azam (Composable)
  • Zoe Mekbach (Phala)

Sacha Lansky (moderator)
Urban Osvald (note taker)

Parachains team reps present: Watr protocol, Moonbeam (Aaron), Apillon (Matjaz), Astar (Dino), Pendulum (Torsten), Phala (Ruby), Unique (Alex), Kilt (Dudley)

High level discussion points:

  • Overview of CosmoWasm and its role in XC execution for smart contracts
  • Explanation of CosmWasm VM architecture and its capabilities
  • Interoperability features of CosmWasm and the use of XCVM
  • Brief on Phala’s Phat Contract and its omnichain interoperability through off chain rollup architecture
  • Tooling and use cases for Phala and Composable
  • Open discussion covering
    • Composable and Phala tech
    • dApp-level use cases using Composable and Phala
    • How cross-ecosystem composability could be put to use in gaming
    • How to create and build more such use cases


  • Questions to discuss that were proposed at the beginning of the session
    • What smart contract tooling do you find the most valuable?
    • Why do you think the most successful smart contract tooling has such adoption?
    • What kind of smart contract tooling is missing for Substrate?

Presentation from Composable

  • CosmWasm overview
    • A smart contract tool built on Cosmos, implemented in Rust and compiles to WASM
    • Implemented it as a pallet
    • Many benefits of CosmWasm
      • Best framework for cross-chain execution for smart contracts
      • About 30 projects using it
        • Composable is speaking to them, giving out grants, driving adoption
      • CosmWasm as a pallet is different to the original version, which is written in half Rust and half Go
      • Live on the Composable Rococo parachain
      • Composable has XCVM
  • CosmWasm VM architecture
    • It allows to abstract the VM, pure logic of the VM to a Rust smart contact
    • Can call into the CosmWasm VM and execute based on the logic in the chain
    • You can plug it into a game, plug it into any other parachian
  • CosmWasm was built with IBC in mind
    • IBC is live on Composable, connecting to Cosmos soon
    • Bringing assets from Cosmos to Polkadot
    • In addition also bridge between DOT and KSM
  • CosmWasm was built with XC smart contacts in mind
  • XCM messaging is not limited to Polkadot
    • Composable will run XCM messages on Cosmos
    • Envisioning that XCM will be used on Cosmos
    • Smart contract execution outside of Polkadot, Cosmos is perfect for that
  • XCVM Architecture
    • It allows multiple chains to support the execution of assets across chains
    • Solidity and Rust supported
    • Interpreted on different chains
      • Can have an interpreter on Eth, e.g. user wants to lend from Aave and it can also spawn the funds back to the original chain
      • Composable doesn’t expect users to know what chains they are on
      • Want to aggregate the functions like liquid staking
    • XCVM is available to provide finality across multi instruction function calling
      • NEAR now the only to have XC SC going
      • NEAR has a bridge to Eth, but have not attracted masses
    • XCVM Vision
      • Abstract away what is going on under the hood
      • XCVM is a layer that provides instructions and facilitates it
    • XCVM components
      • Intention focused
        • The interface would ask you what you would like to do
        • Establishes a program of execution
        • Would recommend the best route based on the intention
        • The idea is to give the freedom to the user, all this infrastructure will tell you what is the best execution
      • Solvers will be able to execute
    • XCVM components: problem
      • The idea is to take away the decisions away from the user
      • Users want something that is fast, secure, not risk their assets
    • Many different components, but the vision hopefully makes sense

Presentation from Phala

  • Phat Contract: omnichain interoperability through off chain rollup architecture
  • XC DEX aggregator
  • Phat contract is ink! based, but it also has off chain capabilities
    • Access to http requests
    • Web2 APIs, RPC nodes,…
  • Stake an amount of PHA after the contract
    • Executing queries
    • Computation is verifiable
  • Rollup architecture
    • Request-response programing model to interact with Phat smart contract
    • Compatibility with EVM (Solidity)
    • Working on ink!
    • CosmWasm, can do off chain rollup to be able to do XC DEX aggregation
  • Embedded quick JS engine
    • Easily connect to other Phat contracts using simple Javascript
    • Run some compute but you are just running javascript
  • Tooling
    • DevPHAse
      • Community member developed (100k)
      • Swanky Phala CLI tool, plugs into Astars swanky tool (flipper, http endpoint, connect to s3 buckets, use cache, signing)
    • Phat UI
      • Interactive console to deploy and debug contracts
    • Low code Phat Bricks
  • Use cases
    • DAO/contract to be able to connect to different APIs
      • Manage different services
    • Self owned oracle
    • XC DEX

What else can be deployed aside from ink?

  • Phat contracts supports ink!, modified it to Pink (Phala ink!)
  • Crates to interact with Substrate based chains
  • Javascript, you have to upload indeterministic code (js code), to be able to execute it over the data you have
  • Uses WASM (limited js engine, not gonna have full capabilities). It can be a WASM blob but needs to be interpreted

Open discussion

  • How do Phala and Composable work together
    • Don’t actually have a common use case yet. Held jointly because of the joint topic proposals
  • What is an “Off chain rollup”? Where does it live?
    • You can integrate it into e.g. Kilt
    • Connect Phat contracts ID so that its not a bunch of smart contracts spamming
    • E.g. query some balance
    • That uses the Phala clusters. Phala has one that is controlled by the council
  • How do you see it work with other chains?
    • You can customise it based on what you need for your chain
    • Does not have to adhere to all different chains
  • Does it use XCM?
    • No, not using XCM
    • Using HTTP requests
  • What other use cases are people thinking about aside from DeFi
    • Getting XCM integrated into the Cosmos protocol
      • To do what?
        • Cross chain swaps, DEX,…
      • Could you send a message to Akash network on Cosmos to do some app specific chain stuff
        • Coposable is leaning towards DeFi
      • Can the composable architecture be used for generic things or is it geared towards DeFi?
        • Now for DeFi
        • Cisco: Its very generic, what Parity considers XCVM
  • How are you handling instructions on the Cosmos side
    • Can build precompiles that call extrinsics on their chain
      • Only CosmWasm for now, need to build XCM
  • If a game is built on another chain, can it be used to e.g. pay players?
    • Phala: Yes, it can be used for that
      • Building out generic templates to serve user demands better
      • Phat contracts are ideal for games (e.g. updating characters (for example like WOW), balancing characters, etc.) - do this in the secure enclave
      • How to build this game
        • Phala secure enclave to update characters
        • Kilt’s identity
        • Putting files on IPFS
        • NFTs
    • There is nobody (aside from Apillon) to connecting these use cases together
      • It would be great if we had people that are doing this
      • Protolcs are figuring out protocols. DeFi is an obvious one
    • Gaming is hot right now. What would it look like to build use cases in the gaming area?
      • Valve model, but that takes a lot of time and resources
        • Game developers are generally not keen on giving out control of their game via token based governance models and similar
        • Similar to loyalty programs, less control over their products
    • A possible solution: Parachain matchups
      • Weekly matchups
      • Each are separate experts in their fields
      • What is missing is the layer above, the developers/projects that build out an application layer
      • Have bounties to attract developers
      • Hackathons (advanced hackathon use case)
      • Recipes for the Polkadot webpage
      • Information about use cases provided, explaining architecture using existing parachins

Thanks for the recap, Urban.

Joshua Waller from Phala was also one of the leads in this workshop.

You can find our slides here: XC Smart Contract Execution - Google Slides

1 Like