Skip to main content
Version: 5.x

Contracts on Rococo

Rococo is a testnet for Polkadot and Kusama parachains. We have a live testnet named Contracts as a parachain online there.

Smart contracts parachain on Rococo

What is the Contracts parachain?

It's a Substrate parachain for smart contracts. We configured it to use Substrate's smart contracts module – the contracts pallet – in a default configuration.

The code for this parachain can be found in the cumulus repository. Our parachain uses the Rococo relay chain's native token (ROC) instead of having its own token. Due to this you'll need ROC in order to deploy contracts on our testnet.

How can I use it?

(1) Create an Account

As a first step, you should create an account. This can be done via command-line tools (e.g. subxt) or via a wallet (e.g. with the polkadot-js browser extension). See here for a detailed guide.

(2) Get Testnet Tokens

image of a treasure chest

As a second step, you have to get ROC testnet tokens through the Rococo Faucet.

Alternatively, you can use the Element chat room. You must send a message like this (Note the :1002 after the wallet address):

!drip YOUR_SS_58_ADDRESS:1002

The number 1002 is the parachain ID of Contracts on Rococo, by supplying it you instruct the faucet to teleport ROC tokens directly to your account on the parachain. If you have some tokens on the Rococo relay chain, you can teleport them to the Contracts parachain on your own. Read more on teleporting assets here.

If everything worked out, the teleported ROC tokens will show up in your account. In case you are using the polkadot-js frontend, you can see them under the "Accounts" tab for Contracts.

Rococo testnet tokens in wallet

(3) Deploy Your Contract

Once you have ROC on Contracts you can deploy a contract nearly as you would with a local developer node. The only difference is that you can't use pre-endowed accounts like Alice or Bob, you have to use the one you generated instead.

Deploy a smart contract on Rococo/Polkadot

You can also deploy your contract from the command-line via cargo-contract. Make sure you are in the folder of your contract and that it has been built recently. Then execute:

cargo contract upload --suri "your twelve or twenty-four words"
cargo contract instantiate --suri … --constructor new --args true

new in this case would be a constructor method exposed by the contract, --args would be any arguments the constructor expects.

See the cargo-contract docs for a more detailed documentation.