Skip to main content

Substrate With A WASM Smart Contract Environment

Acurast can be used to fulfill directly to smart contracts deployed on Substrate chains with a pallet-contracts integration.

Example integration with a WASM smart contract

The following example shows simple WASM smart contracts implemented with ink!.

Keep in mind that you can do much more with Acurast and get access to all modules besides these examples.

This example contract receives a result of the "Price Feed" template on the Acurast Console.
#![cfg_attr(not(feature = "std"), no_std)]

use ink;

mod receiver {
pub struct Receiver {
price: u128,

impl Receiver {
pub fn default() -> Self {
Self {
price: Default::default(),

pub fn fulfill(&mut self, price: u128) {
self.price = price;

pub fn get_price(&self) -> u128 {

Job Specification

Now that the contract has been deployed, we can prepare the script that will get executed by the Processor to provision the price feed or entropy.

Go to the Acurast Console to test and deploy your script, these templates can also be found there.

const callIndex = "0x4606"; // the call index for the 'call' extrinsic
const destination = "<MY_WASM_CONTRACT_ADDRESS>"; // replace with a contract address that will receive the 'fulfill' call.
_STD_.chains.substrate.signer.setSigner("SECP256K1"); // the type of signer used for sign the extrinsic call, possible values are SECP256K1 or SECP256R1. What to use depends on what type of address is supported by the chain.
const entropy = generateSecureRandomHex();
refTime: "3951114240",
proofSize: "629760",
(opHash) => {
print("Succeeded: " + opHash);
(err) => {
print("Failed fulfill: " + err);

Job Registration

Check out How to get started with the Acurast Console to register your Job.