Skip to main content

Prerequisites

Connected API

Read the section on Creating an API instance if you haven't done so already. The following examples assume you are connected to a compatible chain.

For development purposes it's generally preferred to use a local development network, that way you can swap and purge contracts while developing. We recommend running the latest Substrate Contracts Node binary.

Web3 accounts

You will need a Substrate account to sign messages. Check the docs section on Keyring in order to get access to dev accounts (Alice, Bob, Charlie, ..etc.) or create new ones. Alternatively, check out the Extension package docs in order to retrieve all injected accounts.

Contract build artifacts

The contract metadata and the wasm code are generated by building the contract with a tool like cargo-contract or solang. These tools also generate a <name>.contract file which contains the metadata and includes the wasm code under metadata.source.wasm.

As metadata, all api-contract helpers accept either a JSON string, a parsed JSON or an Abi instance.

To understand everything fits together, let's deploy a WASM contract and start using it.