dashhive / DashJoin.js

Dash CoinJoin JavaScript (Browser & Node) SDK
MIT License
1 stars 0 forks source link

Prereqs for Local RegTest Network => Build Tools, Docker, Dashmate #12

Open coolaj86 opened 3 months ago

coolaj86 commented 3 months ago

If you already have a group of configs in ~/.dashmate/, you can destroy the nodes and begin anew with:

./dashmate/bin/dashmate group stop
./dashmate/bin/dashmate group reset
./dashmate/bin/dashmate group start
  1. Install updates and prereqs

    sudo apt update &&
      sudo apt install -y build-essential curl git
    
    curl https://webi.sh/ | sh
    source ~/.config/envman/PATH.env
    
    webi dashcore@20.1.0 jq pathman serviceman
    source ~/.config/envman/PATH.env
    
    mkdir -p ~/bin/
    pathman add ~/bin/
    source ~/.config/envman/PATH.env

    And reduce the amount of logging to something reasonable so that it doesn't fill up the disk from all the docker container messages: /etc/systemd/journald.conf:

    [Journal]
    Compress=yes
    SystemMaxUse=500M
    SystemKeepFree=4G
    SystemMaxFileSize=50M
    SystemMaxFiles=100
    RuntimeMaxUse=1G
    RuntimeKeepFree=500M
    RuntimeMaxFileSize=1G
    RuntimeMaxFiles=1000
    sudo systemctl daemon-reload
    sudo systemctl restart systemd-journald
  2. Install docker as per https://github.com/webinstall/webi-installer-requests/issues/28#issuecomment-1982087878 \ with special attention to the sections including:
    • groupadd docker
    • --groupname=docker
    • and nesting=1 (if already running within a container, such as docker)
  3. Install dashmate as per https://github.com/dashpay/platform/issues/1736#issue-2170387832: ~/bin/dashmate-install:

    #!/bin/sh
    set -e
    set -u
    
    # NOTE: the latest version doesn't work with dash-cli v20.1.1
    #g_rel="v1.0.0-pr.1902.1"
    #g_file="dashmate-v1.0.0-pr.1902.1-f5fc6d074-linux-x64.tar.gz"
    g_rel="v1.0.0-dev.9"
    g_file="dashmate-v1.0.0-dev.9-d6688bef2-linux-x64.tar.gz"
    if ! test -f "${g_file}"; then
       curl -L -O 'https://github.com/dashpay/platform/releases/download'/"${g_rel}"/"${g_file}"
    fi
    echo "Extracting ${g_file}"
    tar xf "${g_file}"
  4. Create a regtest (a.k.a. "local") network ~/bin/dashmate-regtest-init:

    #!/bin/sh
    set -e
    set -u
    
    (
       cd ./dashmate/
       ./bin/dashmate setup --verbose --node-count=3 --debug-logs --miner-interval=0.5m local
    
       ./bin/dashmate group start
    
       ./bin/dashmate status core --config=local_seed
       ./bin/dashmate status core --config=local_1
       ./bin/dashmate status core --config=local_2
       ./bin/dashmate status core --config=local_3
    )
coolaj86 commented 1 month ago

Cruft

Just in case I need this later:

  1. Create some wallets (these names are part of the test code, not arbitrary yet):

    git clone https://github.com/dashhive/DashJoin.js.git
    pushd ./DashJoin.js/
    npm ci
    #!/bin/sh
    set -e
    set -u
    
    for b_username in foobar psend luke han chewie; do
       ./bin/wallet-create "${b_username}"
    done
    ./bin/dboot --make-junk-user
    
    ./bin/dboot --instance=base --create-wallets
    
    ./bin/dboot --instance=base --list-users
    
    # creates immature balances
    #for b_username in foobar psend luke han chewie; do
    #    ./bin/dboot --instance=base --generate-to="${b_username}"
    #done 
    
    # takes a few minutes
    ./bin/dboot --dash-for-all
    
    # takes a few seconds
    ./bin/dboot --create-denoms
    
    # matures balances of the other test fixture users
    ./bin/dboot --grind-junk-user
    
    # creates more coins, matures the previous balances, and imports the mature addresses
    for b_username in foobar psend luke han chewie; do
       #./bin/dboot --instance=base --generate-to="${b_username}"
       ./bin/dash-cli-wallet "${b_username}" getbalances
       ./bin/dboot --instance=base --import-addresses="${b_username}"
    done
    
    # creates some denominated coins for each user
    ./utils/denominate --users=foobar,psend,luke,han,chewie
    
    ./bin/dboot --instance=base --all-utxos
  2. Attempt a coinjoin. Supposed the minimum number of participants is only 2: \ Spork 22 introduced in Dash Core 0.16.0 expanded the maximum number of participants to 20 and also reduced the minimum number of participants to 2 for testnet/devnet/regtest networks. The spork was removed in Dash Core 0.17.0 which made the change permanent.

    # in one screen
    ./src/demo.js --instance=base --username=luke
    
    # in a second screen
    ./src/demo.js --instance=base --username=han

This should work to denominate in the way that ./src/demo.js expects:

./bin/dboot --split-utxos=luke

Limits: