How to read / write to smart contracts

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

This guide assumes you have already added the code found in Getting Started to your project.

To read or write to a smart contract, you'll first need to set up the relevant deployed contract asset. After you've done that, you can call the method you want to use on it with either ReadMethod or WriteMethod. If a method mutates the data on the blockchain, its a "write" method. If it only returns data, its a "read" method. See the image below for a blueprint example of a Read method:

Keep in mind that WriteMethod requires either: a) The player to be logged in with WalletConnect (for clients), or b) The server to be logged in with a LocalWallet (and the name of this local wallet needs to be passed as a param into "LocalAccountName" on ReadMethod and WriteMethod).

Last updated