
# Cardano Example Dapp

## **Write registration to join Dandelion Network (GCFS)**

Register your Dandelion Node Group on-chain with GCFS. Writes a json file with your Node Group definition on-chain for backend peer discovery on Dandelion, the decentralized API service for Cardano. Set the URL of your node in 'node-url'.


## Try it online: 

-  Visit [HTML+JS Dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS).html)
-  Visit [HTML+React Dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS)_react.html)
-  Visit [Native HTML dapp](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS)_nolib.html)
-  Run [Standalone URL dapp connection](https://wallet.gamechanger.finance/api/2/run/1-H4sIAAAAAAAAA5VUbW_aMBD-K1a-ABKEbpMmjW8VVV-mrqsK0z5MU2XiI7g4dmQ7Kxniv-_OTiCItd3aL-TenrvnufM28dIrSCbJdys9MAu5dN5yL41m3rAnIzW74FqAIssd-Gdj16x_Nb2cDZJhIsBlVpYUjjUeQjZYVpvKdtOMAHZlTVUyo0fZimPRZ-lXjMqkLEA7xtmTw-ClVBC9oUonV8BSahla25dZGssWPFuDFqwEhBbSZeYX2BpjDi0MmV8BFshA43RK_gbBzu9vmAP7S2YQyky5FVyblM3Ah_BvD7fMLGMbmtpAvB79GFVW9VIc39clcRc5wG9uc5dMtonmBdnn4Hzs_YSqr-0AOLmXOj9mHlELHOC5y_0t6UPohCtxYotlKBu_26bQsvK-dJPxmNuzDzzNsRHE0TnYFMnjOoPJ-7NPH8fUrHPgR02rosVBBykwKrlfoX08zoxeynxMOoRRUlIp2Q0T2JTG-nMXsj3HRAu-spoIKKjPSaI4toehtgpWKZB-6Wv63VCXg_-CNNy0nl2E70QUPLMmaWr82CZC-TnP0ZFFvWj8uJbRXGA5NJA5jrZFjH6PpEnJ0hvsTtTohHQcMXLPdSco2qI_D_q27oxnK0jbQdNY65q71TVsGmTp-EKBSCZLrhxE8VwYLSrY7bddtr9l7n7i_zBZVFKJ-cZ1KAumS0fGPQu4cNOwcOGgHv7pzk94OkTg8Th2cXRPU1MUFd5njQd0clXtvt2daHJYwzhlIbWfRdpg8wavLacWSiUzTqv4Dj8Vr8FGSjtA-7WmHCRrLTVSGdctbl0DiMTMDf7um8XT3HzGde93eqDA3mCANXaBfydz3dAvwHP0inuwhXQOeXJ7ldunoomOutxzj88lMUsv4eMMnSAet2uow-ZR1aP5W61Tv7lF_WgQ6qBaFNIfr8DBNmyPseSolAL1AnZI8K_CN803sPSeKFW_dKrbV-_vras6epxe2ZZwIeEERzcX_3GF3TfupR3Z4d8fVMKhyyEHAAA)

## Source code:

- dapp connection code: [GCScript DSL](Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS).gcscript)
- frontend (using @gamechanger-finance/gc): [HTML+JS dapp](Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS).html)
- frontend (using @gamechanger-finance/gc): [HTML+React dapp](Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS)_react.html)
- frontend (without official library): [Native HTML dapp](Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS)_nolib.html)

Dapp code was autogenerated by [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground)

## GCScript code (dapp connection):
```json
{
  "title": "Write registration to join Dandelion Network (GCFS)",
  "description": "Register your Dandelion Node Group on-chain with GCFS. Writes a json file with your Node Group definition on-chain for backend peer discovery on Dandelion, the decentralized API service for Cardano. Set the URL of your node in 'node-url'.",
  "type": "script",
  "args": {
    "name": "Test Group",
    "description": "On-chain testing registration of my own Dandelion Lite node",
    "ticker": "test",
    "node-url": "https://ar03a.gamechanger.finance:2096/",
    "asset-name": "dandelion",
    "file-path": "//config/NodeGroup.json"
  },
  "exportAs": "data",
  "return": {
    "mode": "last"
  },
  "run": {
    "identity": {
      "type": "getMainIdentity"
    },
    "file": {
      "type": "macro",
      "run": [
        {
          "dltTag": "cardano",
          "networkTag": "mainnet",
          "name": "{get('args.name')}",
          "description": "{get('args.description')}",
          "ticker": "{get('args.ticker')}",
          "group": "{get('cache.identity.scriptHashHex')}",
          "disabled": false,
          "nodes": [
            {
              "url": "{get('args.node-url')}",
              "disabled": false
            }
          ]
        }
      ]
    },
    "buildTxs": {
      "type": "buildFsTxs",
      "name": "On-Chain Node Registration to join Dandelion Network",
      "description": "Dandelion APIs Decentralized Community Service for Cardano",
      "assetName": "{get('args.asset-name')}",
      "mintScriptHex": "{get('cache.identity.scriptHex')}",
      "replicas": "1",
      "layers": [
        {
          "{get('args.file-path')}": {
            "kind": "file",
            "fileHex": "{strToHex(objToJson(get('cache.file')))}"
          }
        }
      ]
    },
    "signTxs": {
      "detailedPermissions": false,
      "type": "signTxs",
      "namePattern": "GCFS_Signed_{key}",
      "txs": "{get('cache.buildTxs.txList')}"
    },
    "submitTxs": {
      "type": "submitTxs",
      "mode": "parallel",
      "namePattern": "GCFS_Submitted_{key}",
      "txs": "{get('cache.signTxs')}"
    },
    "finally": {
      "type": "macro",
      "run": {
        "name": "{get('args.name')}",
        "ticker": "{get('args.ticker')}",
        "asset-name": "{get('args.asset-name')}",
        "node-group-ID": "{get('cache.identity.scriptHashHex')}",
        "file-path": "{get('args.file-path')}"
      }
    }
  }
}
```

## Run standalone QR dapp connection: 

You can use [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground) in `QR URL Transport` mode to capture results

[![This GCScript/URL is too large! make it shorter uploading parts to GCFS. Unable to generate QR code](Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS).png)](https://gamechangerfinance.github.io/gamechanger.wallet/examples/Write%20registration%20to%20join%20Dandelion%20Network%20(GCFS).png)

## Resources
- [How to connect?](https://www.npmjs.com/package/@gamechanger-finance/gc)
- [Docs and examples on Github](https://github.com/GameChangerFinance/gamechanger.wallet/)
- [GCScript documentation](https://wallet.gamechanger.finance/doc/api/v2)
- [Playground IDE in GameChanger Wallet ](https://wallet.gamechanger.finance/playground)
- [Tutorials on Youtube](https://www.youtube.com/@gamechanger.finance)
- [Support on Discord](https://discord.gg/vpbfyRaDKG)
- [News on Twitter](https://twitter.com/GameChangerOk)
- [Website](https://gamechanger.finance)

## License
MIT 
    
