{"id":13746877,"url":"https://github.com/district0x/ethlance","last_synced_at":"2025-05-15T04:07:55.394Z","repository":{"id":37445142,"uuid":"74309016","full_name":"district0x/ethlance","owner":"district0x","description":"Ethlance is the first job market platform built entirely on the Ethereum blockchain. Free to use forever!","archived":false,"fork":false,"pushed_at":"2025-04-28T10:56:41.000Z","size":24852,"stargazers_count":706,"open_issues_count":5,"forks_count":125,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-04-28T11:48:31.685Z","etag":null,"topics":["blockchain","clojurescript","district","ethereum","freelance","solidity"],"latest_commit_sha":null,"homepage":"http://ethlance.com","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/district0x.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,"zenodo":null}},"created_at":"2016-11-20T23:18:10.000Z","updated_at":"2025-03-22T18:57:14.000Z","dependencies_parsed_at":"2023-10-13T12:19:24.559Z","dependency_job_id":"9c676637-75c3-4d09-9b85-fc4f0987e329","html_url":"https://github.com/district0x/ethlance","commit_stats":{"total_commits":1246,"total_committers":16,"mean_commits":77.875,"dds":0.6276083467094703,"last_synced_commit":"ac158952bba05b5ea8585dee524acf92e1dd80bd"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fethlance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fethlance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fethlance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/district0x%2Fethlance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/district0x","download_url":"https://codeload.github.com/district0x/ethlance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270656,"owners_count":22042860,"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":["blockchain","clojurescript","district","ethereum","freelance","solidity"],"created_at":"2024-08-03T06:01:03.460Z","updated_at":"2025-05-15T04:07:50.380Z","avatar_url":"https://github.com/district0x.png","language":"Clojure","readme":"# Ethlance V.2 (Newlance)\n\n[![CircleCI](https://circleci.com/gh/district0x/ethlance/tree/newlance.svg?style=svg)](https://circleci.com/gh/district0x/ethlance/tree/newlance)\n\n*Ethlance Version 2 is Currently in Development and is subject to\nchange before final release*\n\n# Development\n\n## Prerequisites\n\n1. Node.js \u003e= 20.18.1 (it's defined in `.tool-versions` and [asdf](https://github.com/asdf-vm/asdf-nodejs) is a good way to install it)\n2. Java JDK \u003e= 18 (for Clojure)\n3. [Babashka](https://github.com/babashka/babashka#installation)\n4. PostgreSQL (tested with 17.3)\n5. IPFS daemon\n6. Ethereum testnet (e.g. ganache)\n\n## Running the system\n\nClojure gets its missing dependencies automatically during compilation.\nNode.js dependencies need to be installed manually. There are 3 places for it:\n1. Testnet \u0026 smart contract node deps at the project root:\n  - `yarn install`\n2. UI node dependencies\n  - `cd ui \u0026\u0026 yarn install`\n3. Server node dependencies\n  - `cd server \u0026\u0026 yarn install`\n\nAlso a database needs to exist (configured in `config/server-config-dev.edn` under `:district/db` key).\nHere's some SQL to do it (via the `psql` command)\n```sql\nCREATE DATABASE ethlance_new;\nCREATE USER ethlanceuser_new WITH PASSWORD 'pass_new';\nGRANT ALL PRIVILEGES ON DATABASE ethlance_new TO ethlanceuser_new;\n\\c ethlance_new\nGRANT ALL ON SCHEMA public TO ethlanceuser_new;\nALTER DATABASE ethlance_new OWNER TO ethlanceuser_new; -- Optional\n```\n\n\u003e _The database schema gets created automatically when server is started._\n\nAfter this you can start all necessary services at once from the terminal with `overmind start`\n  - the processes to be started are defined in `Procfile`\n  - [Overmind](https://github.com/DarthSim/overmind)\n  - *TIP* for development it's better to run the `bb run-server` separately because although shadow-cljs recompiles the code on file saves, the node process doesn't reload it and for that manual restart is required to reload the updated code.\n\nOr you can start them one by one (check the `Procfile` for respective commands):\n1. Start IPFS\n  - this is optional if the `:ipfs` config points to external node\n2. Start ganache `bb testnet-dev`\n3. Migrate Solidity contracts to testnet: `npx truffle migrate --network ganache --reset`\n4. Start server build `bb watch-server`\n5. Start server (to serve the API) `bb run-server`\n6. Start UI build `bb watch-ui`\n  - this also starts serving the UI assets \u0026 smart contract assets on port `6500`\n\n### IPFS Server\n\nMight require additional configuration for CORS if IPFS is running on a different host\n\n```bash\nipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"GET\", \"POST\", \"OPTIONS\"]'\nipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '[\"*\"]'\nipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Headers '[\"X-Requested-With\"]'\nipfs config --json Gateway.Writable true\n```\n\n# Building \u0026 deployment\n\n## 1. Smart contracts\nThe ethlance smart contracts should (for now) be deployed manually. As a result of the compilation process, the environment specific clojure files with contract addresses get written (e.g. `shared/src/ethlance/shared/smart_contracts_qa.cljs` for QA) and must be committed to git to make them available for deployment of browser \u0026 server applications.\n\nDuring clojure application deployment (browser, server), the contracts must only be compiled, which will generate JSON ABI files under `\u003cethlance-root\u003e/resources/public/contracts/build/`\n\nCompilation:\n1. `ETHLANCE_ENV=qa npx truffle compile` (replacing the network with one suitable for the env)\n2. This generates ABI JSON files under `\u003cethlance-root\u003e/resources/public/contracts/build/`\n3. Server app needs to access them during runtime:\n  - configured via `[:smart-contracts :contracts-build-path]`\n4. UI (browser app) needs them available: should be served by Nginx (or your web server of choice)\n  - get loaded from urls like `http://d0x-vm:6500/contracts/build/TestToken.json`\n\n## 2. Server (\u003cethlance-root\u003e/server)\nTo build Server (consists mainly of graphql API):\n1. The following ENV variables need to be set:\n  - `export ETHLANCE_ENV=qa`\n2. Compile with `clj -A:dev:shadow-clj release dev-server`\n  - will result a single file in `out/ethlance_server.js` (and accompanying `ethlance_server.js.map` source map)\n3. Before running it the smart contract ABI JSON files need to be in a location defined in the EDN file `ETHLNCE_CONFIG_PATH` at EDN path `[:smart-contracts :contracts-build-path]`\n  - if it's a relative path, it gets resolved in relation to where the server process gets started\n\nRunning server:\n1. Earlier the server config was compiled into the generated JS file. Now it will be loaded during runtime (at application startup) from the variable specified under `:config :env-name`. As for now it is `ETHLANCE_CONFIG_PATH`.\n2. Also earlier the UI (browser app) config was baked into the compiled JS file for the UI. Now it gets served via `/config` endpoint from a location pointed to ENV variable `UI_CONFIG_PATH` (contents loaded at run time from the file system). Thus, starting the server:\n  - `export ETHLANCE_ENV=qa`\n  - `export SERVER_CONFIG_PATH=/path/to/server-config-qa.edn `\n  - `export UI_CONFIG_PATH=/path/to/ui-config-qa.edn`\n  - `node out/ethlance_server.js`\n\n## 3. Browser (\u003cethlance-root\u003e/ui)\n1. The following ENV variables need to be set:\n  - `export ETHLANCE_ENV=qa`\n2. Compile with `clj -A:dev:shadow-clj release dev-ui`\n  - the generated JS file (single) will be under `\u003cethlance-root\u003e/ui/resources/public/main.js`\n3. To serve the web page, configure the web server to serve the files under `\u003cethlance-root\u003e/ui/resources/public`\n  - there are some other files, like CSS, JS and index.html that the web server needs to serve too\n4. The web server must also serve the ABI JSON files generated in _1. Smart contracts_\n  - for that, they can be copied from the build step or re-compiled and moved to where the web server can serve them\n  - the expected HTTP path will be `/contracts/build/\u003cABI JSON FILE\u003e.json` (e.g. `/contracts/build/Ethlance.json`)\n\n# Contributing\n\nAnyone is welcome to contribute to the ethlance project, here are some brief guidelines:\n\n* Make sure to squash your commits\n* Reference issue numbers in your pull request\n* Rebase your changes on upstream (`git remote add upstream\n  https://github.com/madvas/ethlance.git`) master before pushing  (`git pull --rebase upstream master`)\n* Make changes in a separate well-named branch in your forked repo\n  like `improve-readme`\n\n# Overview of workflows\n\nHere's a brief overview of the sequence of actions that different user types can take to create, find and arbiter jobs.\n\n1. User arrives to the home page\n  - http://d0x-vm:6500\n  - picks which profile to create (freelancer = candidate, employer, arbiter)\n2. This takes the user to the sign-up page\n  - http://d0x-vm:6500/me/sign-up?tab=candidate\n  - user fills in details for the roles they want to participate (candidate, employer, arbiter)\n3. **Employer** (having first filled in employer data)\n  - http://d0x-vm:6500/jobs/new\n  - user can create new job by filling in the form\n  - creating a new job requires sending a signed transaction together with the initial funds\n  - smart contract method `Ethlance#createJob` is called and a new copy of `Job` contract gets deployed\n4. In case the employer invited arbiters during job creation `/jobs/new`\n  - First: **arbiter** must send their quote (how much they want for their service for this job)\n    + ... where can they do it (one or more pages)?\n    + script helper: `tx-workflow-fns-server-repl/set-quote-for-arbitration`\n  - Second: **employer** must accept the quote\n    + ... where can they do it (one or more pages)?\n    + script helper: `tx-workflow-fns-server-repl/accept-quote-for-arbitration`\n5. **Employer** can now invite candidates to participate in the new job\n  - **NB!** implement \u0026 provide link\n  - results in `Job#addCandidate` contract send\n    + script helper: `tx-workflow-fns-server-repl/add-candidate`\n6. **Candidate** can search for available jobs\n  - http://d0x-vm:6500/jobs\n7. **Candidate** chooses a job of interest from search results. To work on it, needs to send proposal\n  - http://d0x-vm:6500/jobs/detail/0x1A2f3f7739A52F5bDCc909A8d42e96Cd8f9f4D30\n  - as a result `JobStory` is created (DB model to track this user's interaction with this job)\n8. All users can view job contract page at\n  - http://d0x-vm:6500/jobs/contract/1\n  - send messages(all), raise disputes(candidate), resolve disputes(arbiter), leave feedback(all)\n9. **Candidate** can create invoices (for any of their jobs)\n  - http://d0x-vm:6500/invoices/new\n10. **Candidate** can then raise dispute\n  - after raising dispute, arbiter can resolve it on the same page (http://d0x-vm:6500/invoices/new)\n    + resolving dispute results in tokens getting transferred according to the resolution amount\n11. **Employer** can pay invoices\n  - ... (add link, implement if needed)\n","funding_links":[],"categories":["Others","Clojure"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict0x%2Fethlance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistrict0x%2Fethlance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistrict0x%2Fethlance/lists"}