Side Protocol is a modular framework designed to facilitate seamless cross-chain transactions and decentralized applications. This guide will help you set up, interact with the protocol, and understand its key functionalities.
To work with Side Protocol, ensure you have the following:
Operating System: Linux, macOS, or Windows with WSL.
Programming Language: Node.js v16+.
Package Manager: Yarn or npm.
Blockchain Tools:
hardhat,ethers.js.
Install Node.js from nodejs.org.
Install Yarn globally:
npm install -g yarnVerify installation:
node -v yarn -v
Clone the repository to your local machine:
git clone https://github.com/sideprotocol/side.git
cd side
Run the following to install dependencies:
If the project uses Solidity smart contracts, compile them with Hardhat:
yarn hardhat compile
Ensure everything works by running the tests:
yarn test
Deploy a contract using the Hardhat framework:
deploy.js:
const { ethers } = require("hardhat");
async function main() {
const MyContract = await ethers.getContractFactory("MyContract");
const myContract = await MyContract.deploy();
await myContract.deployed();
console.log("Contract deployed to:", myContract.address);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Run the script:
yarn hardhat run scripts/deploy.js --network localhost
Use ethers.js to interact with deployed contracts.
const { ethers } = require("ethers");
// Connect to the network
const provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
// Define contract details
const contractAddress = "0xYourDeployedContractAddress";
const abi = [
"function getValue() public view returns (uint256)",
"function setValue(uint256 _value) public"
];
// Create a signer
const signer = provider.getSigner();
// Connect to the contract
const myContract = new ethers.Contract(contractAddress, abi, signer);
// Read data
async function readData() {
const value = await myContract.getValue();
console.log("Value:", value.toString());
}
// Write data
async function writeData() {
const tx = await myContract.setValue(42);
await tx.wait();
console.log("Value updated!");
}
readData();
writeData();
The protocol facilitates cross-chain operations using relayers. To configure:
Update
config.jsto specify supported chains and relayer endpoints.Use provided SDKs for cross-chain messaging:
const { SideProtocol } = require("side-sdk");
async function crossChainTransfer() {
const sdk = new SideProtocol({ network: "mainnet" });
const tx = await sdk.transfer({
fromChain: "Ethereum",
toChain: "Polygon",
token: "0xTokenAddress",
amount: ethers.utils.parseUnits("10", 18),
recipient: "0xRecipientAddress"
});
console.log("Transaction Hash:", tx.hash);
}
crossChainTransfer();
Debugging Tips:
Use
console.log()or Hardhat's built-in debugging tools.Check logs in
logs/or transaction receipts.
Testing: Use Hardhat to write unit tests for smart contracts. Example:
test/MyContract.test.js:
const { expect } = require("chai");
describe("MyContract", function () {
it("Should set the correct value", async function () {
const MyContract = await ethers.getContractFactory("MyContract");
const myContract = await MyContract.deploy();
await myContract.deployed();
await myContract.setValue(42);
expect(await myContract.getValue()).to.equal(42);
});
});
Run tests:
yarn hardhat test

