DEV Community

Loïc Coenen
Loïc Coenen

Posted on

Deploying a WASM file on Fluence network

Hey guys!

Today, in order to get the Gitcoin bounty, I will deploy our very own Koos backend to the Fluence network.

Fluence logo

Fluence is a decentralised cloud platform based on Ethereum, that incentatize miners to run webassembly code. Even better, they compiled SQLite and Redis into a SQL and provide a SDK in Rust, C and Assemblyscript. Given our proficiency in Typescript, we decided to go for the later.

Not gonna lie, the experience have been bumpy for the least. The JSON library needed updates, I suspect some .trim() calls just sucked up some chars at the end of my string, and so on. On the other hand, shoutout to the Fluence team as they were really reactive and supportive. What you guys are doing is really innovative, keep it up! <3 <3

So, it turns out they implemented multimodule directly into the dashboard. All I had to do is to connect Metamask and upload the two WASM file under the dashboard.

Fluence dashboard

Then, after a little while, just like that, my app got deployed and I could have access to the AppId and the contract address! All I had to do to communicate with the backend is to copy-paste those value in my front-end config and call the fluence-js library as seen below:

    return fluence
      .connect(
        config.FLUENCE_CONTRACT_ADDRESS,
        config.FLUENCE_APP_ID,
        config.FLUENCE_ETHEREUM_URL
      )

/// ...

    const request = this.fluence.request({my request})

    return request
      .result()
      .then(answer => answer.asString())
      .then(answer => JSON.parse(answer))
      .then(answer => {
      // Do something with the answer

Enter fullscreen mode Exit fullscreen mode

Top comments (0)