{"id":18031503,"url":"https://github.com/rezzecup/fractal-cat-token-pumpfun-backend","last_synced_at":"2026-01-28T06:37:42.301Z","repository":{"id":259194551,"uuid":"860913410","full_name":"Rezzecup/Fractal-CAT-token-pumpfun-backend","owner":"Rezzecup","description":"The backend for the Cat Protocol's pump.fun on the Fractal Bitcoin Network utilizes Node.js and sCrypt. Serving as a launchpad for CAT20 tokens, it facilitates the minting, trading, and transferring of CAT20 tokens.  ","archived":false,"fork":false,"pushed_at":"2024-10-22T07:16:16.000Z","size":31,"stargazers_count":12,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-23T04:23:01.682Z","etag":null,"topics":["bitcoin","cat-protocol","cat20","fractal","nodejs","pumpfun"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rezzecup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-21T13:59:12.000Z","updated_at":"2024-12-25T07:12:20.000Z","dependencies_parsed_at":"2024-10-23T11:55:26.262Z","dependency_job_id":null,"html_url":"https://github.com/Rezzecup/Fractal-CAT-token-pumpfun-backend","commit_stats":null,"previous_names":["rezzecup/fractal-cat-token-pumpfun-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rezzecup%2FFractal-CAT-token-pumpfun-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rezzecup%2FFractal-CAT-token-pumpfun-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rezzecup%2FFractal-CAT-token-pumpfun-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rezzecup%2FFractal-CAT-token-pumpfun-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rezzecup","download_url":"https://codeload.github.com/Rezzecup/Fractal-CAT-token-pumpfun-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791270,"owners_count":20672664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","cat-protocol","cat20","fractal","nodejs","pumpfun"],"created_at":"2024-10-30T10:09:25.063Z","updated_at":"2026-01-28T06:37:42.253Z","avatar_url":"https://github.com/Rezzecup.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fractal-CAT-token-pumpfun-backend\nThe backend for the Cat Protocol's pump.fun on the Fractal Bitcoin Network utilizes Node.js and sCrypt. Serving as a launchpad for CAT20 tokens, it facilitates the minting, trading, and transferring of CAT20 tokens.  \n \n**Installation:**\n\n```bash\n# Clone the repository \ngit clone https://github.com/Rezzecup/Fractal-CAT-token-pumpfun-backend.git\n\n# Install dependencies \ncd Fractal-CAT-token-pumpfun-backend \nnpm install \n```\n\n### Core Functionality \n\n**Token Minting API Fetching:**\n```javascript\nconst { mintToken } = require('./services/tokenService');\n\n(async () =\u003e {\n  try {\n    const result = await mintToken('tokenName', 'tokenSymbol', 1000);\n    console.log('Token minted:', result);\n  } catch (error) {\n    console.error('Error minting token:', error);\n  }\n})();\n```\n\nThis function utilizes a service to mint CAT20 tokens, specifying the token details.\n\n**Trading Tokens:**\n```javascript\nconst { tradeToken } = require('./services/tradeService');\n\n(async () =\u003e {\n  try {\n    const result = await tradeToken('tokenId', 'toAddress', 100, 'traderPrivateKey');\n    console.log('Token traded:', result);\n  } catch (error) {\n    console.error('Error trading token:', error);\n  }\n})();\n```\n\nThis snippet is a demonstration of trading tokens using a specified trading service.\n\n**Retrieving Token Information:**\n```javascript\nconst fetch = require('node-fetch');\n\nasync function getTokenInfo(tokenId) {\n  const response = await fetch(`https://api-pump.fun/info?token_id=${tokenId}`, {\n    method: 'GET',\n    headers: {\n      'Content-Type': 'application/json',\n      'x-api-key': process.env.API_KEY,\n    },\n  });\n  const data = await response.json();\n  return data;\n}\n\n(async () =\u003e {\n  try {\n    const info = await getTokenInfo('tokenId');\n    console.log('Token Info:', info);\n  } catch (error) {\n    console.error('Error fetching token info:', error);\n  }\n})();\n```\n\nThis is guide on structuring the Node.js backend for launching and trading CAT20 tokens on the Fractal Bitcoin Network. This will include examples for the model, controller, and router components using JavaScript and Express.js. \n\n## Backend Infrastructure Codebase Parts\n\n### 1. Model\n\nThe model is responsible for defining the CAT20 token structure and any methods associated with it. Below is an example using a simple class-based approach.\n\n**models/CAT20Token.js:**\n```javascript\nclass CAT20Token {\n  constructor(name, symbol, totalSupply, owner) {\n    this.name = name;\n    this.symbol = symbol;\n    this.totalSupply = totalSupply;\n    this.owner = owner; // Address of the token owner/creator\n    this.balances = { [owner]: totalSupply }; // Track token balances\n  }\n\n  transfer(from, to, amount) {\n    if (this.balances[from] \u003e= amount) {\n      this.balances[from] -= amount;\n      if (this.balances[to]) {\n        this.balances[to] += amount;\n      } else {\n        this.balances[to] = amount;\n      }\n      return true;\n    }\n    throw new Error('Insufficient balance');\n  }\n}\n\nmodule.exports = CAT20Token;\n```\n\n### 2. Controller\n\nControllers handle the business logic and interact with models to process requests. Below is an example of a controller handling token minting and trading.\n\n**controllers/CAT20TokenController.js:**\n```javascript\nconst CAT20Token = require('../models/CAT20Token');\n\n// In-memory storage of tokens for demonstration\nconst tokens = {};\n\nexports.createToken = (req, res) =\u003e {\n  const { name, symbol, totalSupply, owner } = req.body;\n  if (tokens[symbol]) {\n    return res.status(400).json({ message: 'Token symbol already exists' });\n  }\n  const token = new CAT20Token(name, symbol, totalSupply, owner);\n  tokens[symbol] = token;\n  res.status(201).json({ message: 'Token created', token });\n};\n\nexports.tradeToken = (req, res) =\u003e {\n  const { symbol, from, to, amount } = req.body;\n  const token = tokens[symbol];\n  if (!token) {\n    return res.status(404).json({ message: 'Token not found' });\n  }\n  try {\n    token.transfer(from, to, amount);\n    res.status(200).json({ message: 'Tokens transferred successfully', token });\n  } catch (error) {\n    res.status(400).json({ message: error.message });\n  }\n};\n```\n\n### 3. Router\n\nThe router handles the HTTP requests and is used by the Express app to call the appropriate controller methods.\n\n**routes/CAT20TokenRoutes.js:**\n```javascript\nconst express = require('express');\nconst router = express.Router();\nconst CAT20TokenController = require('../controllers/CAT20TokenController');\n\nrouter.post('/create', CAT20TokenController.createToken);\nrouter.post('/trade', CAT20TokenController.tradeToken);\n\nmodule.exports = router;\n```\n\n### 4. Server Setup\n\nFinally, ensure that these components are tied together within your Express application. \n\n**server.js:**\n```javascript\nconst express = require('express');\nconst bodyParser = require('body-parser');\nconst CAT20TokenRoutes = require('./routes/CAT20TokenRoutes');\n\nconst app = express();\napp.use(bodyParser.json());\n\napp.use('/api/tokens', CAT20TokenRoutes);\n\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () =\u003e {\n  console.log(`Server running on port ${PORT}`);\n});\n```\n\n### Detailed Explanation\n\n- **Model (`CAT20Token`)**: Represents the CAT20 token structure. This includes properties like `name`, `symbol`, `totalSupply`, and methods for transferring tokens between users.\n\n- **Controller (`CAT20TokenController`)**: Manages the creation and transfer actions. It directly interacts with the token model, managing in-memory token data for simplicity in this example.\n\n- **Router (`CAT20TokenRoutes`)**: Maps incoming HTTP requests to the controller methods, allowing operations for creating and trading tokens via POST requests.\n\n\n### Contact Information\n\nI've shared some sections of the code, but not the entire codebase due to an NDA and security considerations. If you require technical support or have development inquiries, please feel free to reach out to me.\n\n- Telegram: https://t.me/rizz_cat/  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezzecup%2Ffractal-cat-token-pumpfun-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frezzecup%2Ffractal-cat-token-pumpfun-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezzecup%2Ffractal-cat-token-pumpfun-backend/lists"}