dashhive / DashJoin.js

Dash CoinJoin JavaScript (Browser & Node) SDK
https://dashhive.github.io/DashJoin.js/
MIT License
2 stars 0 forks source link

doc: How to use the new, in-progress dashjoin.js #19

Open coolaj86 opened 5 months ago

coolaj86 commented 5 months ago

Install DashCore

curl https://webi.sh/dashcore | sh
source ~/.config/envman/PATH.env

dash-cli --version
dashd --version

Create a Test Wallet

pushd /tmp/ &&
    npm install --location=global dashphrase-cli dashkeys-cli dashhd-cli &&
popd
dashphrase generate -o ./seed-phrase.txt
dashphrase seed ./seed-phrase.txt '' -o ./seed.hex
road smile until phone wise inject unhappy slogan glove debris anger survey

d63d988a5aa597bc9e288745586be1d4473c7dc9bfb3900b01a6a6b95bfd52f8e377cd1d7a7c97df74e98bc42cf89ec3de50108b671ff0844810bbce61b4c8cc

testnet is m/44'/1', mainnet is m/44'/5'

# generate a few receive addresses in the range `<account>/<usage/addr>` to `<usage/addr>`
dashhd --testnet ./seed.hex "m/44'/1'/0'/0/0" "0/5"

# generate a few change addresses
dashhd --testnet ./seed.hex "m/44'/1'/0'/1/0" "1/5"
m/44'/1'/0'/0/0:
cUeUEgRQWfKiYPBeRZsYsrvvSZiKHbUNqiQE2AdKA4s7ymycdVxc
yTw3SFk9PbQ1kikMgJBRA7CFyLfNt2G6QD

m/44'/1'/0'/0/1:
cN28SZpmmuVFmmBQBHCNdwa6a14kWZM8VVpZETjzk47aGNvVGXK7
yb4zn8MSW4hHsvmP6PxX2tUPDb9bvmxSrS

...

m/44'/1'/0'/0/5:
cSnDDXRTQbj7Ya3PsnMaEAfomwo3zLSZfzKikkfX3KNU2B9GS2Mu
ydhfU4GPojriBbaAnmKgRdVJco3dFgBrz3
m/44'/1'/0'/1/0:
cUPCzcqpyiCLSiu2FKwGR4cQ1StJYtukqrWPb8xtpirWeYg1FkWW
ySvcDBcz5MVWqkA12wFW8PxCMBL3HwVN6J

m/44'/1'/0'/1/1:
cRZjpqso7XcE5dNctZpKfraP8BdypuuK3o4GhdAzb8dZuY9xxUZc
yXqvZJAiKhZ3rUy3eiThWor9uELLpY4R2b

...

m/44'/1'/0'/1/5:
cUQruX5RRgPvp8c1qbtqeMcSU8aFoe6j5nVZpYyfYK2JM9yCUHdK
yXTdKjfU1Lnju7HjycwPNA54ZRxc7eYFG8

Load some Dash onto the Test Wallet

Use generatetoaddress on some of the receive (usage=0) addresses:

dash-cli -conf="$HOME"/.dashmate/local_seed/core/dash.conf \
    generatetoaddress 10 yTw3SFk9PbQ1kikMgJBRA7CFyLfNt2G6QD

dash-cli -conf="$HOME"/.dashmate/local_seed/core/dash.conf \
    generatetoaddress 1 yb4zn8MSW4hHsvmP6PxX2tUPDb9bvmxSrS
dash-cli -conf="$HOME"/.dashmate/local_seed/core/dash.conf \
    getaddressdeltas '{ "addresses": [
        "yTw3SFk9PbQ1kikMgJBRA7CFyLfNt2G6QD"
    ] }'
dash-cli -conf="$HOME"/.dashmate/local_seed/core/dash.conf \
    getaddressmempool '{ "addresses": [
        "yTw3SFk9PbQ1kikMgJBRA7CFyLfNt2G6QD"
    ] }'

dash-cli -conf="$HOME"/.dashmate/local_seed/core/dash.conf \
    getaddressdeltas '{ "addresses": [
        "yb4zn8MSW4hHsvmP6PxX2tUPDb9bvmxSrS"
    ] }'
dash-cli -conf="$HOME"/.dashmate/local_seed/core/dash.conf \
    getaddressmempool '{ "addresses": [
        "yb4zn8MSW4hHsvmP6PxX2tUPDb9bvmxSrS"
    ] }'

Denominate Coins

dash-cli -testnet createrawtransaction '''
  [
    {
      "txid": "061ec99eb641ffdeaa05a1a724a255103bebc445b15c6c8c028b19c08608496b",
      "vout" : 1
    }
  ]''' \
  '''
  [
    {
      "ySutkc49Khpz1HQN8AfWNitVBLwqtyaxvv": 800
    },
    {
      "yY6AmGopsZS31wy1JLHR9P6AC6owFaXwuh": 74.99
    }
  ]''' \
  0
dash-cli -testnet signrawtransactionwithkey 020000000121f39228a11ddf197ac3658e\
93bd264d0afd927f0cdfc7caeb760537e529c94a0100000000ffffffff01809698000000000019\
76a914fe64a96d6660e30c433e1189082466a95bdf9ceb88ac00000000 \
[\"cSxm6ji1SQ7vF1r8QhcsE1AZ42ZJqs5CEAAnD18iV18ZCQ2u3gGa\"]