π Deploying Smart Contracts Using Truffle with GSMC (Gasless)
Last updated
Before deploying the smart contracts, ensure that you have the following set up:
Node.js & npm are installed on your system.
Truffle is installed globally using:
npm install -g truffleA configured Truffle project with the necessary contracts and migration scripts.
A properly configured truffle-config.js file.
Your private Ethereum network (myPOSNetwork) set up and accessible.
β οΈ Developer Note: You will require a one-time transfer of 0.01 ETH to sign the GSMC approval transaction. This approval enables the use of GSMC as gas for smart contract deployments. Once approved, you can deploy contracts using GSMC according to the approved amountβno need to use ETH for every deployment. On the private PoS network, this ETH is faucet-based and free. On mainnet, however, the Relayer will handle ETH payments on behalf of users.
Before deploying contracts using GSMC, you must approve the relayer to spend GSMC on your behalf. This step uses ETH to sign the approval and is required only once.
π‘ Tip: The approval amount is set to 1000 GSMC, allowing you to deploy multiple contracts without needing to re-approve.
node scripts/approveGSMC.jsIf successful, your address will be approved to use GSMC for deployment fees.
After approving GSMC, sign the smart contract deployment request.
An example request is available in the project.
Ensure the request includes:
This sets the deployment cost to 10 GSMC (minimum GSMC Gas Fee).
Replace contractArtifact with your compiled contract JSON (e.g., SimpleContract.json).
π οΈ You can compile the contract using:
Upon success, a file named deployRequest.json will be generated.
Use the following curl command to send the signed deployment request to the network relayer:
After a successful deployment, the API response will include a transaction hash (tx). You can use this hash to track the contract deployment status on your private network.
Happy Building with GSMC! π οΈβ¨
Last updated
const gsmcFee = ethers.utils.parseUnits("10", 18);truffle compilenode scripts/signDeployRequest.jscurl -X POST http://34.46.205.31:6060/deploy \
-H "Content-Type: application/json" \
--data-binary @deployRequest.json