{"id":16787110,"url":"https://github.com/ygboucherk/duino-coin-c-lib","last_synced_at":"2025-03-16T23:41:07.653Z","repository":{"id":136087784,"uuid":"336592326","full_name":"ygboucherk/duino-coin-C-lib","owner":"ygboucherk","description":"A C library for interacting with Duino-Coin network","archived":false,"fork":false,"pushed_at":"2021-02-11T12:17:43.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T09:43:02.899Z","etag":null,"topics":["c","cryptocurrency","duino-coin","library"],"latest_commit_sha":null,"homepage":"","language":"C","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/ygboucherk.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":"2021-02-06T17:14:49.000Z","updated_at":"2021-02-11T12:17:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"4c196ecf-a037-40d1-89e3-3b37224c89af","html_url":"https://github.com/ygboucherk/duino-coin-C-lib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2Fduino-coin-C-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2Fduino-coin-C-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2Fduino-coin-C-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ygboucherk%2Fduino-coin-C-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ygboucherk","download_url":"https://codeload.github.com/ygboucherk/duino-coin-C-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950792,"owners_count":20373664,"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":["c","cryptocurrency","duino-coin","library"],"created_at":"2024-10-13T08:14:15.680Z","updated_at":"2025-03-16T23:41:07.624Z","avatar_url":"https://github.com/ygboucherk.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# duino-coin-C-lib\nA C library for interacting with Duino-Coin network\n\n## Usage\n### Importing library\nFirst put both `ducolib.h` and `ducolib.c` in the directory where's ur C program stored.\nFor compiling, you should also select `ducolib.c` function\n\nThen include it within program using :\n```c\n#include \"ducolib.h\"\n```\n\n### Library functions\n#### Connecting to DUCO server\n`connectDuco()` returns a socket object that can be reused (and is used by next functions)\n\nExample of code using it :\n```c\nint socket;\nsocket = connectDuco();\n```\n\n\n#### Logging in\n`ducologin(socket,username,password)` takes 3 arguments.\n\n`socket` is the previously used socket, `username` is DUCO username and `password` is DUCO password.\n\nexample :\n```c\nint socket;\nsocket = connectDuco();\nducologin(socket,\"test\",\"test\");\n```\n\n#### Registering\n`ducoregister(socket,email,username,password)` takes 4 arguments.\n\n`socket` is (still) the previously used socke. `username` is desired DUCO username, `password` is desired DUCO password. Email is the email used for registering.\n\nIf operation succeeds, it returns `0`. Else, it returns `1` ! \n\nexample (without `int main()`) :\n```c\nint socket;\nint registerfeedback;\nsocket = connectDuco();\nregisterfeedback = ducoregister(socket,\"aNewUsername\",\"aStrongPasswordThatLeakedOnGithub\",\"DucoTest@testmail.xyz\");\nif (registerfeedback == 0) {\n  printf(\"Registration success\");\n}\nelse {\n  printf(\"Registration failed...\");\n}\n\n```\n\n\n#### Getting balance\n`ducobalance(socket)` returns balance as `double` (floating point), and `socket` is socket ID\n*note : user should have logged in previously*\n\nexample :\n```c\nint socket;\ndouble balance;\nsocket = connectDuco();\nducologin(socket,\"test\",\"test\");\nbalance = ducobalance(socket);\n```\n\n#### Sending a transaction\n`sendduco(socket,amount,recipient)` requires 3 arguments (socket,amount and recipient).\n\nIf transaction's successful, it returns `0`. Else it returns `1`.\n\nexample :\n```c\nint socket;\nint feedback;\nsocket = connectDuco();\nducologin(socket,\"test\",\"test\");\nsendduco(socket,10,\"Yanis\");\n```\n\n\n### Full example\nHere's a little (but functionnal) example that gets (and shows on screen) balance, and then sends 10 DUCO to user Yanis (me xD) ! Feel free of running it (and giving me 10 Duino-Coins lol) !\n```c\n#include \"ducolib.h\"\n#include \u003cstdio.h\u003e\n\nint main() {\n  int socket;\n  int feedback;\n  double balance;\n  socket = connectDuco();\n  ducologin(socket,\"test\",\"test\");\n  balance = ducobalance(socket);\n  printf(\"Your DUCO balance is %f\", balance);\n  feedback = sendduco(socket,10,\"Yanis\");\n  if (feedback == 0) {\n    printf(\"Successfully sent 10 DUCO to Yanis\");\n  }\n  else {\n    printf(\"Something went wrong\")\n  }\n}\n```\n\n### Why all these `socket` ?\nIf you tried understanding code, you has seen there was many occurences of `socket`. \nI've used them because if each socket is treated separately, so it allows having multiple threads at the same time (each one having its socket), instead of disconnecting/reconnecting if we want to switch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fygboucherk%2Fduino-coin-c-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fygboucherk%2Fduino-coin-c-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fygboucherk%2Fduino-coin-c-lib/lists"}