Table of Contents
EthGlobal Bangkok is one of the largest hackathons by EthGlobal, With $775k in prizes, 69 partners are on board giving developers a wide variety of choices on which protocol to build. We at Metaschool have shortlisted 7 protocols to write about everything that would help you developers prepare for the Hackathon. The second one in the series is Gnosis.
It has a lot to offer in the web3 ecosystem, it just doesn’t stop at Gnosis Chain but also offers Gnosis Studio, Gnosis Chain, Gnosis VC, and Gnosis DAO from building to funding they are a one-stop solution. It is a community-owned EVM-based network operated by a diverse set of validators around the world. Creating dApps and integrating with Gnosis Chain products is similar to any other EVM-based blockchain.
Key Points to consider before building
Fees
Each transaction on the chain is associated with the fee in xDai stablecoin. This approach reduces the volatility risks and simplifies the development experience. It is one of the main differences from other EVM chains where users pay in a native token of that network.
Network
We have two networks – chiado(testnet) and Gnosis(mainnet)
Network Name | Gnosis (mainnet) | Chiado (testnet) |
---|---|---|
Native (fee) token | xDAI | Chiado xDAI |
Chain ID | 100 | 10200 |
EL RPC | https://rpc.gnosischain.com | https://rpc.chiadochain.net |
EL Explorer | https://gnosisscan.io | https://blockscout.com/gnosis/chiado |
CL Explorer | https://gnosischa.in/ | https://beacon.chiadochain.net |
Fork monitor | https://forkmon.gnosischain.com | https://forkmon.chiadochain.net |
EthStats | https://ethstats.gnosischain.com | https://ethstats.chiadochain.net |
Faucet | https://faucet.gnosischain.com/ | https://faucet.chiadochain.net/ |
Token
The chain uses a unique dual-token model xDai and GNO. xDai is a stable token used for any transactions, payments, and fees done on the chain to reduce volatility, unlike any other EVM-compatible chains where the transaction fees are in the native token whereas staking & protocol protection, and community governance are provided by GNO within the consensus-layer of Gnosis Chain.
Pre-requisites
- Solidity
- Wallet – Metamask or choose one here.
- Install Hardhat or Foundry
- Install Node Package Manager: npm/yarn
- Install Waffle
- Install Ether.js
Steps for Development
Initialize the project
mkdir gnosis-full-stack-dapp
cd gnosis-full-stack-dapp
npm init -y
npm install --save-dev hardhat@2.9.9
Run hardhat
npx hardhat
This is what you should see:
888 888 888 888 888
888 888 888 888 888
888 888 888 888 888
8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
888 888 "88b 888P" d88" 888 888 "88b "88b 888
888 888 .d888888 888 888 888 888 888 .d888888 888
888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888
Welcome to Hardhat v2.9.9
? What do you want to do? …
▸ Create a basic sample project
Create an advanced sample project
Create an advanced sample project that uses TypeScript
Create an empty hardhat.config.js
Quit
We will create a basic sample project. It will further ask you for a option – select yes as the option.
Do you want to install this sample project's dependencies with npm (@nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers)? (Y/n) ‣ y
We will be using Waffle and Ethers.js while writing and testing smart contarcts as well as interacting with EVM respectively.
To ensure hardhat is running fine, run these commands:
npx hardhat compile
npx hardhat test
If it is installed correctly, you should see an output like:
Deploying a Greeter with greeting: Hello, world!
Changing greeting from 'Hello, world!' to 'Hola, mundo!'
✔ Should return the new greeting once it's changed (1612ms)
1 passing (2s)
Writing your smart contract
This section shall include your smart contract implementation, implementing the logic of your dApp.
Deploying your Contract
To deploy your contract to Gnosis, let’s update your config file at hardhat.config.js
. For a complete configuration check the hardhat config guide.
require("@nomiclabs/hardhat-waffle");
require('dotenv').config();
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.4",
defaultNetwork : 'chiado',
networks: {
gnosis: {
url: 'https://rpc.chiadochain.net',
gasPrice: 1000000000,
accounts: [process.env.PRIVATE_KEY],
},
},
};
These are pretty simple, right? Let’s look into the steps if you want to build something related to Account Abstraction. Gnosis offers a wide range of account abstraction (AA) providers so that users can do on-chain activities and transactions cheaply and leverage the power of the AA stack with different provider solutions for non-web3 users.
Three providers to let a developer build a AA focussed dApp on Gnosis are:
- Safe – It provides a variety of Account Abstraction stacks for developers to integrate and build Account Abstraction on top of Safe. Under Safe Core we have three possible options available:
- Particle Network – It provides a Smart Wallet-as-a-Service, leveraging modular and customizable wallet components. It also supports native ERC-4337 AA capabilities, streamlining user onboarding and transaction processes. It provides integration with Gnosis Mainnet and Testnet, simplifying the user onboarding via Web2 accounts while also providing native support for ERC-4337 AA.
- ZeroDev – It is a smart, white-labeled, and modular embedded wallet for building user-friendly Web3 experiences, particularly for DeFi applications. For building account abstraction powered dApps check the detailed guide here.
Ideas to build on Gnosis
Here are a few ideas to potentially build during the hackathon:
- Stable Payment Gateway – A business-focused payment processor that leverages the stable fee value for predictable transaction fees and instant settlements.
- Cross-Border Payroll System – An automated payroll platform enabling companies to pay international employees instantly.
- Recurring Payment Platform – Subscription management system utilizing Gnosis Chain’s low fees to handle high-volume micro-transactions efficiently.
- Supply Chain Finance Platform – A DeFi platform connecting suppliers with financing options using invoices as collateral on the chain.
- Stable-Asset Yield Aggregator – A yield optimization platform that automatically routes stable assets across DeFi protocols for maximum returns.
- Stable Token Streaming Service – Real-time payment streaming platform for contractors and service providers.
- Cross-Chain Liquidity Aggregator – DeFi tool that finds and executes the best stable-token trades across multiple chains via bridges.
- Vendor Payment Automation – Smart contract system automating vendor payments with built-in approval workflows and accounting integration.
- Impact Finance Platform – Platform connecting impact investors with social projects using transparent fund tracking and impact metrics.
Conclusion
This article is a part of the Hackathon series for developers participating at EthGlobal Bangkok and interested in building on Gnosis. Feel free to add idea suggestions and let us know what are you planning to build. But if you are starting to learn how to build in web3 start with our Ethereum Track. WAGMI!