Saltar al contenido principal
Version: 4.x

TODO: Translate to Spanish.

Please see this file, some content can be recycled.

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 polakdot-js browser extension). See here for a detailed guide.

(2) Get Testnet Tokens

As a second step, you have to get ROC testnet tokens through the Rococo Faucet. This is a chat room in which you need to write:

!drip YOUR_SS_58_ADDRESS:1002

The number 1002 is the parachain id of Contracts on Rococo, by supplying it the faucet will teleport ROC tokens directly to your account on the parachain. Teleport is a term

If everything worked out, the teleported ROC tokens will show up in your account. In case you are using the polkadot-js fronted, 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.