{"id":26848950,"url":"https://github.com/piyushxcoder/cnft_elixir","last_synced_at":"2026-04-16T19:44:03.620Z","repository":{"id":281694001,"uuid":"946119713","full_name":"PiyushXCoder/cnft_elixir","owner":"PiyushXCoder","description":"An attempt to make nif for solana and mpl_bubblegum","archived":false,"fork":false,"pushed_at":"2025-03-25T17:42:37.000Z","size":3401,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T15:03:45.665Z","etag":null,"topics":["elixir","rust","solana"],"latest_commit_sha":null,"homepage":"https://youtu.be/BH28dq-KfZY","language":"Rust","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/PiyushXCoder.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":"2025-03-10T16:33:56.000Z","updated_at":"2025-03-25T17:42:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"6eb59a56-9c59-4e53-a7ed-2e546d946739","html_url":"https://github.com/PiyushXCoder/cnft_elixir","commit_stats":null,"previous_names":["piyushxcoder/cnft_elixir"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PiyushXCoder/cnft_elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiyushXCoder%2Fcnft_elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiyushXCoder%2Fcnft_elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiyushXCoder%2Fcnft_elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiyushXCoder%2Fcnft_elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PiyushXCoder","download_url":"https://codeload.github.com/PiyushXCoder/cnft_elixir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PiyushXCoder%2Fcnft_elixir/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262614457,"owners_count":23337277,"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":["elixir","rust","solana"],"created_at":"2025-03-30T21:23:49.324Z","updated_at":"2026-04-16T19:44:03.559Z","avatar_url":"https://github.com/PiyushXCoder.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CnftElixir\n\nAn attempt to make `nif` for `Solana` and `mpl_bubblegum`.\n\n\u003e Since it is still a proof of concept and experimental. It is not recommended to be used in production. \n\n## How to use?\n\nThe library is made in a way to look and feel quite similar to `@solana/web3.js`\n\n### Steps\n\n- Import or generate all the Keypair or public key you need\n``` elixir\n    {:ok, keypair} = Solana.keypair_read_from_file(\"/home/piyush/.config/solana/id.json\")\n    merkle_tree = Solana.new_keypair()\n\n    {:ok, merkle_tree_rogram_id} =\n      Solana.pubkey_from_string(\"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\")\n```\n- Connect to the RPC \n``` elixir\n    client =\n      Solana.new_rpc_client(\"https://api.devnet.solana.com\")\n```\n- Create the instructions\n``` elixir\n    size = 4024\n    {:ok, lamports} = Solana.get_minimum_balance_for_rent_exemption(client, size)\n\n    create_account_instruction =\n      Solana.create_account_instruction(\n        Solana.keypair_to_public_key(keypair),\n        Solana.keypair_to_public_key(merkle_tree),\n        lamports,\n        size,\n        merkle_tree_rogram_id\n      )\n\n    tree_config = Solana.tree_config_find_pda(Solana.keypair_to_public_key(merkle_tree))\n\n    create_tree_config_instruction =\n      Solana.cnft_create_tree_config_instruction(\n        tree_config,\n        Solana.keypair_to_public_key(merkle_tree),\n        Solana.keypair_to_public_key(keypair),\n        Solana.keypair_to_public_key(keypair),\n        6,\n        16\n      )\n```\n- Get recent block hash\n``` elixir\n    {:ok, latest_block_hash} = Solana.get_latest_blockhash(client)\n```\n- Create a transaction. Note that we add all instructions in the transaction as an array\n``` elixir\n    transaction =\n      Solana.new_signed_transaction_with_payer(\n        [create_account_instruction, create_tree_config_instruction],\n        Solana.keypair_to_public_key(keypair),\n        [keypair, merkle_tree],\n        latest_block_hash\n      )\n```\n- Send and confirm the transaction\n``` elixir \n    {:ok, signature} = Solana.send_and_confirm_transaction(client, transaction)\n```\n\n### Putting all Together\nCheck the test script to see it all together. [cnft_elixir_test.exs](test/cnft_elixir_test.exs)\n\n## Contribution \nThe code is open for the contributions. Feel free to Connect me on x at [@piyushxcoder](https://x.com/PiyushXCoder) for questions.\n\nTry your best to handle errors as much as possible because the panic to `nif` can panic `erlang`!\n\nI might make a comprehensive guide on migrating  rust functions and structs, but for the time being you may refer [native/solana/src/pubkey.rs](native/solana/src/pubkey.rs) and [lib/cnft_elixir.ex](lib/cnft_elixir.ex) for getting started. \n\nThe project is based on [rustler](https://github.com/rusterlium/rustler), so it might be a good idea to check their repository too.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyushxcoder%2Fcnft_elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyushxcoder%2Fcnft_elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyushxcoder%2Fcnft_elixir/lists"}