How to read / write to smart contracts

Check out the tutorial below for a tutorial of reading and writing to smart contracts.

An example of this can be found in the Emergence Sample Project, check it out here!

To read or write to a smart contract, you’ll first need to set up the relevant deployed contract asset, or use the CreateEmergenceDeployment function as an input to either ReadMethod or WriteMethod.

If a method mutates the data on the blockchain, its a “write” method. If it returns data, its a “read” method. When interacting with a smart contact that has functions with parameters, you must send the correct amount of parameters for the function you’re talking to in the parameters array.

Additionally, keep in mind that WriteMethod requires the player to be already logged in with WalletConnect, or Futureverse web login flow (for clients), or the write method must be sent with a private key (intended for game servers).