Build a Smart Gate that only allows members of a specific tribe to use it
- Introduction
- Deployment and Testing in Local Environment
- Deployment To The Game (Stillness)
- Troubleshooting
This example will show you how to deploy and configure contracts for a Smart Gate that only allows members of a specific tribe to use it.
Before starting make sure you've installed all required tools from the main README
The Smart Gate allows players to create player-made transport gates, connecting systems and regions. It also features configuration options to allow specific players to use it.
You can test everything locally first using the Local Environment Guide, and when ready, deploy to the live game using the Deployment Guide.
For additional details on the Smart Gate, see our Documentation.
To deploy the example to your local world hosted on Docker, follow the below steps.
First, copy the World Contract Address from the Docker logs obtained in the previous steps:
Then, run the following commands:
-
Navigate to the example directory:
cd smart-gate -
Install the Solidity dependencies for the contracts:
pnpm install
-
Create your environment file:
cp packages/contracts/.envsample packages/contracts/.env
-
Deploy to your local test environment
pnpm dev
Note
This will deploy the contracts to a forked version of your local world for testing.
Generate the test data by:
Step 2.2. To generate mock data for testing the Smart Gate logic on the local world, run the following command.
pnpm mock-dataNote
This will create the on-chain Gates, fuel them, bring them online, and create a test smart character.
To configure which smart gates will be used and the allowed tribe ID, run:
pnpm configureNote
You can adjust the values for the SMART_GATE_ID and ALLOWED_TRIBE_ID in the .env file as needed, though they are optional.
To use the smart gates, you need to link them together to create a connection. To link the source and destination gates through a script use:
pnpm link-gatesTo test the smart gate and check the canJump, use the following command:
pnpm can-jumpYou can also test the smart gate using the unit tests with:
pnpm testThis will run a series of pre-defined tests, and should display the results like: ![../readme-imgs/tests-gate.png]
To deploy the example to the game server which is named Stillness, follow the below steps.
Move to the example directory with:
cd smart-gate/packages/contractsThen install the Solidity dependencies for the contracts:
pnpm installThen, if you haven't already copy the .envsample file to a .env file with:
cp .envsample .envNext, set the following values in the .env file to direct the scripts to use Stillness:
WORLD_ADDRESS=0xcdb380e0cd3949caf70c45c67079f2e27a77fc47
RPC_URL=https://pyrope-external-sync-node-rpc.live.tech.evefrontier.com
CHAIN_ID=695569You can also automatically point to Stillness with current values using:
pnpm env-stillnessA namespace is a unique identifier for deploying your smart contracts. Once you deploy to a namespace, it will set you as the owner and only you will be able to deploy smart contracts within the namespace.
Namespace Rules:
- ✅ Use letters (a-z, A-Z)
- ✅ Use numbers (0-9)
- ✅ Use underscores (_)
- ❌ No special characters
- ❌ No spaces
Change the namespace from test to your own custom namespace.
Tip
Consider using your username or tribe name as your namespace.
First, edit packages/contracts/mud.config.ts to include your new namespace:
import { defineWorld } from "@latticexyz/world";
export default defineWorld({
namespace: "new_namespace",
tables: {
...Then, edit packages/contracts/src/systems/constants.sol:
bytes14 constant DEPLOYMENT_NAMESPACE = "new_namespace";You can also use the below command and then input your new namespace to change it automatically:
pnpm set-namespaceImport your game wallet recovery phrase into EVE Wallet to get your private key:
Then, set the PRIVATE_KEY in your .env file:
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80You can also use the below command and then input your private key to change it:
pnpm set-keyThen deploy the SSU contracts using:
pnpm run deploy:pyropeOnce the deployment is successful, you'll see a screen similar to the one below.
Next, replace the following values in the .env file with the below steps.
For Stillness, the smart gate id is available once you have deployed an Smart Gate in the game. Right click your Smart Gate, click Interact and open the dapp window and copy the smart gate id.
For Stillness, the Smart Gate ID is available once you have deployed an Smart Gate in the game.
-
Right click your Source Smart Gate and press Interact
-
Copy the smart gate id.
-
Set the SOURCE_GATE_ID in the .env file.
SOURCE_GATE_ID=34818344039668088032259299209624217066809194721387714788472158182502870248994
-
Repeat the above steps for the DESTINATION_GATE_ID value.
Now set the ALLOWED_TRIBE_ID variable.
-
Retrieve your character address from searching your username here: Smart Characters World API
-
Use this link: https://world-api-stillness.live.tech.evefrontier.com/v2/smartcharacters/ADDRESS and replace "ADDRESS" with the address from the previous step.
-
Use the "tribeId" value which should be in:
{ "address": "0x9dcd62f5c02e7066a3154bc3ba029e85345a5ce9", "id": "27968150122480120904130498262405934486185445355744041492535994892832439518842", "tribeId": "98000002", "name": "CCP Red Dragon", ... -
Set the ALLOWED_TRIBE_ID variable in the .env file.
ALLOWED_TRIBE_ID=98000002
You can also set these values automatically using the below command:
pnpm set-configTo configure which smart gates will be used, run:
pnpm configureNote
You can alter the gate ID's and the allowed tribe in the .env file as needed.
If you encounter any issues, refer to the troubleshooting tips below:
-
World Address Mismatch: Double-check that the
WORLD_ADDRESSis correctly updated in thecontracts/.envfile. Make sure you are deploying contracts to the correct world. -
Anvil Instance Conflicts: Ensure there is only one running instance of Anvil. The active instance should be initiated via the
docker compose up -dcommand. Multiple instances of Anvil may cause unexpected behavior or deployment errors. -
Not able to jump even though it's the correct tribe: Ensure you have set the correct tribe ID set in the
contracts/.envfile.
If you are still having issues, then visit the Documentation or join the Discord Community for support.




