a simple HTML, CSS & JS test kit for Dash Mate
A lot of the work that went in to making this repo has been streamed and is available in this Dash Chum YouTube Playlist
The instructions below are meant to give you a working local Dash testnet / devnet. The purpose of which is to allow building on the Dash platform without needing to use real Dash (Ð).
This gives you a siloed Dash network and generates a wallet unique to your locally running network. You fund it via the Seed Node generated from Dashmate (see Usage).
The purpose of this project is to test Dashmate and the Dash Platform, centered around implementing functional examples of the tutorials at https://dashplatform.readme.io/docs/tutorials-introduction
Once your system is setup with Docker, Node.js & Dashmate running correctly, Dash Chum should allow testing the following functionality:
- Generating a Wallet (automatically happens on page load)
- Funding the new wallet via
dash-cli
- Generate Identity (appears once wallet is funded)
- Generate Contract (appears once Identity is created)
- Submit Document (appears once contract is created)
You will need to install Docker, Node.js & dashmate
, which can be achieved with the instructions below.
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh
# adds the docker group to your user
sudo usermod -aG docker $USER
# a workaround, alternatively logout / restart
newgrp docker
# Install Node.js
curl -sS https://webi.sh/node@16 | sh
source ~/.config/envman/PATH.env
If you skip the steps above (perhaps you already have them installed) and run into any issues with the dashmate
setup, you may need to re-install Docker or Node.js.
# Install Dashmate
npm i -g [email protected]
# Setup Dashmate
# won't work if newgrp / logout step is skipped
# if either of these steps fail,
# try re-running each once or twice
dashmate setup local
# generates a new wallet and returns
# public and private keypair and adds funds
dashmate wallet:mint 10 --config=local_seed
# If you already have a wallet you can fund it like this
dashmate wallet:mint 10 --address=REPLACE_WITH_DASH_ADDRESS --config=local_seed
dashmate group start
The official method from the Testnet Masternode Dash Docs also works, but was a little outdated at time of writing (Oct 2022).
WARNING DO NOT USE snap
to install Docker on Ubuntu. See references 12
You have two options for this stage. You can...
- Open up
config.js
and replace all occurences ofdashmate
with the IP address (Eg.127.0.0.1
or192.168.1.1
),localhost
or a domain pointing to wherever you're running Dashmate.
- Modify your
hosts
file and add an alias fordashmate
sudo vim /etc/hosts
# add a line to the bottom of the file like so
127.0.0.1 dashmate
# save and quit (:wq)
git clone https://github.com/dashhive/dashchum.git
cd dashchum # change to this repo
npm install # install packages
npm start # run test server
Navigate to http://localhost:5555/
Once your wallet is setup (which should happen just by loading http://localhost:5555/ in your browser) you will need to add funds to it to generate an identity, a contract or submit a document.
That can be accomplished with the commands below.
# Get the balance of the dashmate seed node
docker exec -it dash_masternode_local_seed-core-1 dash-cli getbalance
# Send 100 dash from the seed node to your wallet
# Copy the Address from the first row in the table (in your browser)
docker exec -it dash_masternode_local_seed-core-1 dash-cli sendtoaddress "REPLACE_WITH_ADDRESS_FROM_BROWSER" 100
# replace "REPLACE_WITH_ADDRESS_FROM_BROWSER" with the address from http://localhost:5555
# it should look like "yMbdOiNzOCNKlJwj530ir7aJ4DtjFqVejz"
You will likely find the need to reset 3 your dashmate (perhaps daily), this is a helper script that should get you a fresh version.
#!/bin/sh
# dashmate group stop
#docker stop $(docker ps -q) # in some scenarios this may be needed
docker rm -f -v $(docker ps -a -q) || true
docker system prune -f --volumes
rm -rf ~/.dashmate
dashmate setup local
dashmate wallet:mint 10 --config=local_seed # optional
dashmate wallet:mint 10 --address=REPLACE_WITH_DASH_ADDRESS --config=local_seed # optional
Dashmate can take up a bit of system resources and can begin throwing errors the longer it runs. Consider stopping the services while its not in use.
# this should stop all the docker services
dashmate group stop
# just run this when you want to get going again
dashmate group start
Footnotes
-
DO NOT USE
snap
to install Docker on Ubuntu. It may be hard / impossible to get docker working properly withdashmate
without formatting your system and re-installing. ↩ -
Snap was a bad choice. https://youtu.be/V-0vEbE_INU?t=188 ↩
-
if you see PoSe Penalty errors, you may need to reset your
dashmate
setup ↩