XMTP Contracts
⚠️ Experimental: This software is in early development. Expect frequent changes and unresolved issues.
This repository contains all the smart contracts that underpin the XMTP decentralized network.
Messages Contracts
The messages contracts manage the blockchain state for GroupMessages
and IdentityUpdates
sent by clients to the network.
These contracts ensure transparency and provide a historical record of state changes.
XMTP Node Registry
The XMTP Node Registry
maintains a blockchain-based record of all node operators participating in the XMTP network. This registry serves as a source of truth for the network's active node participants, contributing to the network's integrity.
The registry is currently implemented following the ERC721 standard.
Usage
The project is built with the Foundry
framework, and dependency management is handled using soldeer
.
Additionally, it uses slither
for static analysis.
Prerequisites
Install foundry
Install slither
Install
As the project uses soldeer
, update the dependencies by running:
forge soldeer update
Build the contracts:
forge build
Test
To run the unit tests:
forge test
Run static analysis
Run the analysis with slither
:
slither .
Scripts
The project includes deployer and upgrade scripts.
Messages contracts
- Configure the environment by creating an
.env
file, with this content:
### Main configuration
PRIVATE_KEY=0xYourPrivateKey # Private key of the EOA deploying the contracts
### XMTP deployment configuration
XMTP_GROUP_MESSAGES_ADMIN_ADDRESS=0x12345abcdf # the EOA assuming the admin role in the GroupMessages contract.
XMTP_IDENTITY_UPDATES_ADMIN_ADDRESS=0x12345abcdf # the EOA assuming the admin role in the IdentityUpdates contract.
- Run the desired script with:
forge script --rpc-url <RPC_URL> --broadcast <PATH_TO_SCRIPT>
Example:
forge script --rpc-url http://localhost:7545 --broadcast script/DeployGroupMessages.s.sol
The scripts output the deployment and upgrade in the output
folder.
Node registry
⚠️: The node registry hasn't been fully migrated to forge scripts.
- Deploy with
forge create
:
forge create --broadcast --legacy --json --rpc-url $RPC_URL --private-key $PRIVATE_KEY "src/Nodes.sol:Nodes"