Welcome to the exciting journey of setting up Ethlance Version 2, also known as Newlance! This guide will walk you through the necessary prerequisites, how to run the system, troubleshoot common issues, and deploy your server with seamless ease. So roll up your sleeves, and let’s dive in!
Prerequisites
Before you fire up your engines, ensure you have the following tools installed and ready:
- Node.js = 16.15.1
- Java JDK = 18 (required for Clojure)
- Babashka
- PostgreSQL (version 14.6 preferred)
- An IPFS daemon
- An Ethereum testnet environment (for example, Ganache)
Running the System
Now that you’ve set the stage, let’s bring Ethlance to life:
- Start your IPFS daemon.
- Launch Ganache.
- Migrate Solidity contracts to the testnet by executing:
npx truffle migrate --network ganache --reset
- To build and start the server, run:
bb watch-server
- Finally, to serve the UI, execute:
bb watch-ui
Getting Started with Example Data
In order to work with the front-end effectively, you need to have a valid JWT token. Here’s how to create one:
- Open the REPL for UI:
lein repl :connect 54200 (shadowrepl :dev-ui) (in-ns ethlance.ui.event.sign-in) (redispatch [:user/sign-in])
- A pop-up will appear; using MetaMask, create a transaction.
- Upon successful completion, the UI should now be able to make GraphQL requests with the correct
Authorization: Bearer ...
header.
Next, generate example data using the server REPL:
lein repl :connect 54100 (shadowrepl :dev-server) (in-ns tests.graphql.generator) (generate-for-address 0xafcf1a2bc71acf041c93012a2e552e31026dfeab)
Understanding the Code: An Analogy
Think of the Ethlance setup as preparing a gourmet meal. Each ingredient you gather corresponds to the tools and prerequisites needed:
- Node.js is the flour, the base for most dishes.
- Java JDK is like sugar, enhancing the flavor (necessary for Clojure).
- PostgreSQL acts as your oven, creating the perfect environment for baking your dish (storing your data).
Every step from setting the oven to gathering ingredients mirrors the commands needed to run the Ethlance system. Each command adds flavor to your final product or, in this case, your working application!
Troubleshooting
If you encounter any issues during your setup, here are some common troubleshooting tips:
PostgreSQL Setup
To set up PostgreSQL, run the following commands in your console:
psql -d postgresql
CREATE USER ethlanceuser WITH ENCRYPTED PASSWORD pass;
CREATE DATABASE ethlance WITH OWNER ethlanceuser;
Alternatively, if the database has been created previously, you can grant access with:
GRANT ALL PRIVILEGES ON DATABASE ethlance TO ethlanceuser;
IPFS Server Configuration
If you’re running IPFS on a different host, you might need to configure CORS:
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods [PUT, GET, POST, OPTIONS]
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin [*]
ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Headers [X-Requested-With]
ipfs config --json Gateway.Writable true
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Building and Deployment
Once your system is up and running, you’ll want to build and deploy your smart contracts and servers:
1. Smart Contracts
Deploy your smart contracts manually. The following steps outline the process:
- Compile contracts:
ETHLANCE_ENV=qa npx truffle compile
- During clojure application deployment, ensure the contracts compile correctly to generate the necessary ABI JSON files.
2. Server Setup
To build the server, set the necessary ENV variables:
export ETHLANCE_ENV=qa
- Compile using:
clj -A:dev:shadow-clj release dev-server
3. Browser Setup
To set up the browser, remember to:
- Set the ENV variables:
export ETHLANCE_ENV=qa
- Compile using:
clj -A:dev:shadow-clj release dev-ui
- Ensure that your web server is configured correctly to serve all necessary files.
Conclusion
Congratulations! You’ve successfully navigated the setup process for Ethlance V2: Newlance. As you dive deeper into its functionalities, remember that enhancements and contributions are always welcome in this vibrant community!
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.