Created
February 28, 2019 01:23
-
-
Save tynes/e18585e51175e6ff85cfe0c63e1ef3f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set an env var to the path to a config | |
export REGTEST_CONFIG=$HOME/.config/hsd/regtest.conf | |
# this assumes you have git cloned and npm installed handshake | |
# be sure to start your handshake node with the same config | |
# ./bin/hsd --config=$REGTEST_CONFIG | |
# the cli tools live in node_modules/.bin | |
# also depends on jq | |
# get a random name that is available | |
name=$(./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG grindname 10) | |
# get a receive address | |
receive=$(./node_modules/.bin/hsw-cli --config=$REGTEST_CONFIG account default | jq -r .receiveAddress) | |
# see the name info, can see the state of the auction | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG getnameinfo "$name" | |
# open a bid then mine a block | |
./node_modules/.bin/hsw-rpc --config=$REGTEST_CONFIG sendopen "$name" | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress 1 "$receive" | |
# mine enough blocks to enter the bidding period | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG getnameinfo "$name" \ | |
| jq -r .info.stats.blocksUntilBidding \ | |
| xargs -I{} ./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress {} "$receive" | |
# check for yourself that its in the bidding period | |
./node_modules/.bin/hsw-rpc --config=$REGTEST_CONFIG getauctioninfo "$name" | |
# send a bid and mine a block so the tx is confirmed | |
./node_modules/.bin/hsw-rpc --config=$REGTEST_CONFIG sendbid "$name" 100 1000 | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress 1 "$receive" | |
# mine enough blocks to start the reveal period | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG getnameinfo "$name" \ | |
| jq -r .info.stats.blocksUntilReveal \ | |
| xargs -I{} ./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress {} "$receive" | |
# send a reveal tx and mine a block to confirm it | |
./node_modules/.bin/hsw-rpc --config=$REGTEST_CONFIG sendreveal "$name" | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress 1 "$receive" | |
# mine enough blocks to close the auction | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG getnameinfo "$name" \ | |
| jq -r .info.stats.blocksUntilClose \ | |
| xargs -I{} ./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress {} "$receive" | |
# set a record | |
./node_modules/.bin/hsw-rpc --config=$REGTEST_CONFIG sendupdate "$name" "$name" \ | |
'{"ttl":172800,"ns":["[email protected]"]}' | |
./node_modules/.bin/hsd-rpc --config=$REGTEST_CONFIG generatetoaddress 1 "$receive" | |
# can change the records again by submitting another sendupdate transaction to the same name | |
# we really should be generating new addresses each time, but good thing this is regtest =) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment