A peer-to-peer marketplace for the exchange of names registered via the Ethereum Name Service.
See at https://namebazaar.io
Smart-contracts can be found here.
In a terminal, start a ganache blockchain
./run-ganache.sh
Note that this uses docker and will try to pull trufflesuite/ganache-cli:v6.12.1
image if you don't have it.
Alternatively, you can connect directly to one of ethereum testnet networks - e.g. goerli. In order to do this, specify correct smart contract addresses and :web3
properties in the ./config.edn
file. Example config file can be found in docker-builds/server/config.example.edn
.
Open another terminal, start a repl and build the dev server (with figwheel repl)
lein repl
(start-server!)
Figwheel will prompt for a connection for the repl instance.
Open another terminal, run the compiled server script, which should connect to the figwheel repl.
node dev-server/name-bazaar.js
(If you have problems re-running this command, try removing dev-server
folder and try to start the server again)
You can (re)deploy contracts with
truffle migrate --reset
and (optionally) generate some samle dev data from the clojurescript REPL by running the following command:
(generate-data)
Redeployment / generation can take a long time, please be patient.
If you wish to connect to the dev server discussed above, open a separate terminal, and build the client-side ui
lein repl
(start-ui!)
You can then connect to the server through a web browser at http://localhost:4541
To build the Semantic UI pieces of the app you need to have gulp
installed.
Note that gulp 4.x
does not work, you need a 3.x
version.
npm install gulp@^3.9.0 --save
Then use our handy script:
./semantic.sh build
or
./semantic.sh watch
Depending upon how you'd like to work.
If you're only focusing on working with the UI, you can start a UI interface which connects to the production server using mainnet.
lein repl
(start-ui! :ui-only? true)
In separate terminal, start the supplied docker nginx server
docker-compose build nginx
docker-compose up nginx
# Visit website at http://localhost:3001
Note: using this client is using the main ethereum network, it is ill-advised to carry out transactions unless you know what you are doing!
lein doo node "server-tests"
(If you have problems running the tests, try to remove server-tests
directory
and try re-running the tests again)
The doo runner will autobuild the test and re-run them as the watched files change. Alternatively:
lein cljsbuild once server-tests
node server-tests/server-tests.js
To run browser tests use the following command:
lein npm run cypress-open
Tests connect to a running app on http://localhost:4541
. It is recommended to run the
tests with clear ganache network, otherwise the tests will be slower or fail.
docker-compose build nginx
docker-compose up nginx
and start (start-ui!), (start-server!) as usual, but open the site on http://localhost:3001
Following commands are used to build system for production
lein build-prod-server
lein build-prod-ui
lein build-css
# To build all 3 in parallel use
lein build-prod
# To run prod server
node server/name-bazaar.js
To run server in docker container use image district0x/namebazaar-server
, e.g.:
docker run --name=namebazaar-server \
--net=host \
-v /path/to/config.edn:/configs/namebazaar.config.edn \
district0x/namebazaar-server:latest
You can choose between tags dev
, latest
(intended for QA deploys) and release
(intended for production deploy). As for the config file, you can find an example in docker-builds/server/config.example.edn
. Of particular interest is providing correct addresses of smart contracts on the blockchain you'll link the app to.
For UI use the district0x/namebazaar-ui
image:
docker run --name=namebazaar-ui \
--net=host \
district0x/namebazaar-ui:latest
Note that there is no passing of config file for UI: currently for any change of UI config you need to build a new image (see the next section). The hardcoded configuration is at src/name_bazaar/ui/config.cljs
.
First, you need to specify deployments secrets in config.edn
. For example:
{:truffle {:goerli {:privateKeys ["0x0000..."]
:infuraKey "0000...."
:ensAddress "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
:registrarAddress "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85"
:publicResolverAddress "0xE264d5bb84bA3b8061ADC38D3D76e6674aB91852"
:reverseRegistrarAddress "0xD5610A08E370051a01fdfe4bB3ddf5270af1aA48"}}}
ENS address are not in documentation, but in some random post on forum https://discuss.ens.domains/t/deployment-of-new-contracts-inc-namewrapper-to-testnet-goerli/14505
Then, you can use truffle
to deploy the contracts just by running the following command in bash:
# you can also use `--network mainnet` - see truffle-config.js for deployment details for more information.
truffle migrate --network goerli
We use ethlint for linting solidity files. You
can use lein npm run ethlint
and lein npm run ethlint-fix
to run the linter.
You can use lein run-slither
to run slither to
statically analyze the smart contracts. However, this tool reports many false positives.