{"id":19831769,"url":"https://github.com/mateolafalce/subecrypto","last_synced_at":"2026-05-19T06:02:23.016Z","repository":{"id":150402420,"uuid":"541809968","full_name":"mateolafalce/SubeCrypto","owner":"mateolafalce","description":"This payment system for public transport aims to eliminate intermediations in card charges, reduce the economic risk of loss and internationally adopt a decentralized payment system","archived":false,"fork":false,"pushed_at":"2024-01-09T13:22:08.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T07:31:23.881Z","etag":null,"topics":["blockchain","buses","decentralized","payment","rust","solana","transport"],"latest_commit_sha":null,"homepage":"https://github.com/mateolafalce/SubeCrypto","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mateolafalce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-09-26T22:36:10.000Z","updated_at":"2024-01-04T14:07:14.000Z","dependencies_parsed_at":"2024-01-04T15:26:17.186Z","dependency_job_id":"00327f50-9c9b-4da0-953b-a4c9a415df28","html_url":"https://github.com/mateolafalce/SubeCrypto","commit_stats":null,"previous_names":["mateolafalce/subecrypto"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mateolafalce/SubeCrypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateolafalce%2FSubeCrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateolafalce%2FSubeCrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateolafalce%2FSubeCrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateolafalce%2FSubeCrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mateolafalce","download_url":"https://codeload.github.com/mateolafalce/SubeCrypto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateolafalce%2FSubeCrypto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33204001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T09:27:30.708Z","status":"online","status_checked_at":"2026-05-19T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["blockchain","buses","decentralized","payment","rust","solana","transport"],"created_at":"2024-11-12T11:34:26.524Z","updated_at":"2026-05-19T06:02:22.977Z","avatar_url":"https://github.com/mateolafalce.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![sube-crypto](sube-crypto.png)\n\n\n# SUBE CRYPTO\n\nA public transport system payment 🚍\n\n\u003c/div\u003e\n\n---\n\nInspired by the Argentine public transport payment system, this project aims to solve an ongoing issue in the system, which is the slow loading of physical data (which still exists in Argentina today), as well as allowing for decentralized payment, without the need for payment distributors, which are often far from users living outside of major cities.\n\nThe program is designed to scale nationally for any nation willing to accept blockchain technology in its public transport system, so if necessary, a function could be created to attach specific user data, but as a demo, it was not considered necessary. This comment also applies to price modifications by bus lines or specific transportation providers.\n\nThe program logic allows for the creation of decentralized bus lines (although it could be focused on any other public/private transportation), incentivizing the widespread adoption of new travel lines around the city. On the user side, the means of payment is a specific key pair that anyone can create and credit without the need to go to an official provider, which charges fees for loading. So every time a trip is taken, it is recorded on the Solana blockchain.\n\nLike any blockchain technology, it is not yet in the bidding or practical application process due to regional legislation, but this project aims to establish the foundations of what could be a decentralized and simplified transport system in favor of the consumer and not in favor of the monopolistic bus lines regulated by law.\n\n## Initialize a bus line\n\n```rust\npub fn initialize_bus_line(\n    ctx: Context\u003cInitializeBusLine\u003e,\n    to3km: u64,\n    to6km: u64,\n    to12km: u64,\n    to27km: u64,\n    more27km: u64,\n) -\u003e Result\u003c()\u003e {\n    let signer: Pubkey = ctx.accounts.signer.key();\n    let program_id: \u0026Pubkey = ctx.program_id;\n    let (_services_pda, bump): (Pubkey, u8) =\n        Pubkey::find_program_address(\u0026[signer.as_ref()], program_id);\n    let sube: \u0026mut Account\u003cSubeAdminAccount\u003e = \u0026mut ctx.accounts.sube;\n    sube.authority = signer;\n    sube.bump_original = bump;\n    sube.prices = [to3km, to6km, to12km, to27km, more27km].to_vec();\n    Ok(())\n}\n\n#[derive(Accounts)]\npub struct InitializeBusLine\u003c'info\u003e {\n    #[account(init, seeds = [signer.key().as_ref()], bump, payer = signer, space = 8 + SubeAdminAccount::SIZE)]\n    pub sube: Account\u003c'info, SubeAdminAccount\u003e,\n    #[account(mut)]\n    pub signer: Signer\u003c'info\u003e,\n    pub system_program: Program\u003c'info, System\u003e,\n}\n```\n\nThis function called initialize_bus_line, is used to initialize a bus line and set the prices to be charged for different travel legs.\n\nIt takes as arguments a Context InitializeBusLine structure that contains relevant contextual information, as well as the prices to set for different travel legs. The prices are passed as parameters to the function and are assigned to an array of prices in the SubeAdminAccount that is created or initialized in the function.\n\nThe first step of the function is to use the provided signer's public key to calculate a derived public key and a \"bump\" (an offset value used to protect against key collision attacks). The derived public key is used to seed a SubeAdminAccount, which is set as a seed account. The space argument is used to set the storage space required for the account.\n\nAfter the account is initialized, the signatory is set as the account authority and the original \"bump\" is set. The prices are assigned to a price array in the SubeAdminAccount that was just initialized.\n\n\n## Take a trip\n\n```rust\npub fn take_a_trip(ctx: Context\u003cTakeATrip\u003e, km: u8) -\u003e Result\u003c()\u003e {\n    let amount: u64 = ctx.accounts.sube.prices[km as usize];\n    let sube: Pubkey = ctx.accounts.sube.key();\n    let to: Pubkey = ctx.accounts.to.key();\n    let from: Pubkey = ctx.accounts.from.key();\n    // validations\n    require_gte!(4, km);\n    require_keys_eq!(sube, to);\n    let transfer = transfer(\u0026from, \u0026to, amount);\n    invoke(\n        \u0026transfer,\n        \u0026[\n            ctx.accounts.from.to_account_info(),\n            ctx.accounts.to.to_account_info().clone(),\n        ],\n    )\n    .expect(\"Error\");\n    msg!(\"Paid bus ticket!\");\n    Ok(())\n}\n\n#[derive(Accounts)]\npub struct TakeATrip\u003c'info\u003e {\n    #[account(\n        mut,\n        seeds = [sube.authority.key().as_ref()],\n        bump = sube.bump_original\n    )]\n    pub sube: Account\u003c'info, SubeAdminAccount\u003e,\n    /// CHECK: This is not dangerous\n    #[account(mut, signer)]\n    pub from: AccountInfo\u003c'info\u003e,\n    /// CHECK: This is not dangerous\n    #[account(mut)]\n    pub to: AccountInfo\u003c'info\u003e,\n    pub system_program: Program\u003c'info, System\u003e,\n}\n```\n\nThe first argument is a ctx context object, which contains information about the current transaction. ctx is also expected to have a TakeATrip structure that defines the accounts involved in the transaction.\n\nThe second argument is the number of kilometers the user wishes to travel on the bus.\n\nIt is verified that the number of kilometers is valid and that the sender of the transaction and the receiver of the transaction are the same accounts that are defined in the TakeATrip structure. The sube account is accessed and the amount of money that must be paid for the ticket is obtained, according to the distance that the user wishes to travel.\n\nAn instruction is created to transfer the cryptocurrency or token from the sending account to the receiving account, with the previously calculated amount of money. The function program::invoke is called to execute the transfer statement.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateolafalce%2Fsubecrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateolafalce%2Fsubecrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateolafalce%2Fsubecrypto/lists"}