A decentralized application for creating and managing digital Totems on the Minato blockchain network.
Totem Factory allows users to create unique digital assets (Totems) with associated metadata and images stored on IPFS. Each Totem is represented by an ERC-20 token on the Minato blockchain. The application provides a user-friendly interface for creating, viewing, and managing these digital assets.
- Create Totems: Create unique digital assets with custom names, symbols, and images
- View Totems: Browse and view all created Totems with their details
- Wallet Integration: Connect with MetaMask wallet for blockchain interactions
- IPFS Storage: Store Totem metadata and images on IPFS via Pinata
- Blockchain Explorer: View transactions and contracts on Blockscout explorer
- Responsive Design: Modern UI with dark theme optimized for all devices
- Real-time Data: Fast data retrieval using The Graph protocol
- Frontend: Next.js, React, Chakra UI
- Blockchain: Ethereum/Minato, ethers.js
- Data Storage: IPFS (Pinata)
- Indexing & Querying: The Graph (GraphQL)
- Wallet: MetaMask integration
- Styling: Chakra UI with custom theme
- Node.js (v14 or later)
- npm or yarn
- MetaMask browser extension
- Access to a Graph node or The Graph hosted service
-
Clone the repository:
git clone https://github.com/azhlbn/totem-factory.git cd totem-factory -
Install dependencies:
npm install # or yarn -
Create a
.envfile in the root directory with the following variables (see.env.examplefor reference):NEXT_PUBLIC_PINATA_API_KEY=your_pinata_api_key NEXT_PUBLIC_PINATA_SECRET_API_KEY=your_pinata_secret_key NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt -
Start the development server:
npm run dev # or yarn dev -
Open http://localhost:3000 in your browser to see the application.
This project uses The Graph protocol to efficiently query blockchain data. The Graph is a decentralized protocol for indexing and querying blockchain data, making it much faster and more efficient than direct RPC calls.
The subgraph for this project is located in the mytho-minato directory. It indexes Totem creation events from the TotemFactory contract.
-
Navigate to the subgraph directory:
cd mytho-minato -
Install dependencies:
npm install # or yarn -
Generate types from the GraphQL schema:
npm run codegen # or yarn codegen -
Build the subgraph:
npm run build # or yarn build -
Deploy the subgraph (requires access to a Graph node or The Graph hosted service):
# For a local Graph node npm run deploy-local # For The Graph hosted service npm run deploy
The application uses Apollo Client to query the subgraph. The main queries are defined in utils/graphql.js. For example, to fetch all Totems:
export const GET_ALL_TOTEMS = gql`
query GetAllTotems($first: Int!, $skip: Int!) {
totemCreateds(first: $first, skip: $skip, orderBy: blockTimestamp, orderDirection: desc) {
id
totemAddr
totemTokenAddr
totemId
}
}
`;- Click the "Connect" button in the top-right corner of the application.
- Approve the connection request in your MetaMask wallet.
- Ensure you're connected to the Minato network (the app will prompt you to switch if needed).
- Click the "Create Totem" button in the navigation bar.
- Fill in the required information:
- Totem Name: A name for your Totem
- Totem Symbol: A short symbol (like ETH, BTC)
- Description (optional): A description of your Totem
- Collaborators (optional): Comma-separated list of Ethereum addresses
- Image: Upload an image for your Totem
- Click "Create Totem" and confirm the transaction in MetaMask.
- Wait for the transaction to be confirmed on the blockchain.
- The new Totem will be indexed by The Graph and appear in the UI shortly after confirmation.
- All created Totems are displayed on the home page, retrieved via The Graph.
- Click "View Details" on any Totem card to see more information.
- You can view the Totem on the Blockscout explorer by clicking the link in the details.
- Network Name: Minato
- Block Explorer: Soneium Minato Blockscout
- Chain ID: 1946
- Subgraph Endpoint: [Your subgraph endpoint URL]