Перейти к основному содержанию

Local development

Setting up a local development environment

You can always set up a local network to test and deploy your smart contract!

To establish a full local network, you need to run a local node, a Core-EVM domain, and a farmer.

First, visit the Autonomys releases page and download the most up-to-date stable versions of the node and farmer.

tip

For each release, there are two versions:

  1. skylake: for newer processors from around 2015 and onwards
  2. x86-64-v2: for older processors from around 2009 and some older VMs

Older processors/VMs are no longer supported by official releases, but they can still be compiled manually if desired.

After downloading both files that suit your system, start a node using your preferred terminal. If you want to start an EVM domain on your local machine, you need to specify:

  • Порт Вашего локального RPC сервера
  • Локальный web-socket RPC порт. Вы можете сделать это с помощью следующей команды:
./your_subspace_node_path run --dev --rpc-listen-on 127.0.0.1:9944 -- --domain-id 3 --dev --rpc-listen-on 127.0.0.1:8545

Таким образом будет настроен локальный RPC на порту 8545.

Во-вторых, Вам нужно запустить фармер, выполнив следующую команду:

 ./your_subspace_farmer_path farm --reward-address [ВАШ АДРЕС ДЛЯ НАГРАД] path=tmp-farm,size=100M

Вы можете указать желаемый размер плота, но 100M должно быть достаточно.

Вот и все! После запуска локальной ноды и фармера, у Вас есть локальный RPC, готовый к тестированию и развертыванию Ваших смарт-контрактов! Вы можете легко подключить свой аккаунт MetaMask к локальной сети разработки, а также использовать Remix или Foundry для тестирования и развертывания смарт-контрактов в локальной сети!