Skip to content

Instantly share code, notes, and snippets.

@fionn
Last active May 27, 2021 11:08
Show Gist options
  • Save fionn/4522a418e42b2d64753cab7b604d0d3c to your computer and use it in GitHub Desktop.
Save fionn/4522a418e42b2d64753cab7b604d0d3c to your computer and use it in GitHub Desktop.
Cashing out the Handshake Airdrop

Handshake Airdrop Withdrawal

Copied mostly from hs-airdrop/issues/2.

Warning

This assumes that the hs-airdrop code is not (necessarily) trustworthy, but also that it:

  • is not capable of escaping the docker container; and
  • does not leak your SSH private key material in its proof output.

It also assumes that Namebase won't steal your HNS in the time between claim and withdrawal.

Steps

Build the Container

Clone this repository.

mkdir keys
export KEY=id_ed25519  # Change the value of KEY as necessary
cp ~/.ssh/$KEY ~/.ssh/$KEY.pub keys/
ssh-keygen -p -f keys/$KEY  # Enter a new passphrase for your SSH key

We re-encrypt the SSH key because we don't want to disclose our current passphrase to the hs-airdrop code.

Start the docker daemon (e.g. sudo systemctl start docker.service).

sudo docker build -t hs-airdrop .

This downloads the entire airdrop Merkel tree. It's required because we don't know where in the tree the nonce corresponding to our key is. Expect it to take ~10 minutes to build this layer.

Note that we're using hs-airdrop at master, so it is possible that it might break in future. A known good commit is b7c92aea05ab6ac3d40f362bf5a6a4804f41e5d3.

We're also taking hs-tree-data at master, which seems safer. The initial commit and cca7714 are both good.

Register with the Exchange

Note: there are a few exchanges that offer HNS/BTC, but to use them you have to set up hnd (or some other local wallet), which seems painful.

Make an account on namebase.io.

You have to do KYC to sell, so might as well get that over with now.

Visit namebase.io/airdrop and jump to §4 ("Generate your airdrop claim"). Click on "Click to show your Handshake wallet address" twice to copy the address.

Claim the Airdrop

sudo docker run --rm -it --network none --name no-net --volume=$(pwd)/keys:/ssh hs-airdrop bash

In the container shell, run

./bin/hs-airdrop /ssh/id_ed25519 $wallet_address

replacing the SSH key file as necessary, where $wallet address is the address from the previous step. Enter the password for your private key. Copy the base-64 output at the end into the relevant field in §5. I'd like to think that this would fail if you used the wrong value of $wallet_address, but haven't tested that.

You can kill and delete the docker container now.

Cash Out

Wait ~16 hours, then visit namebase.io/sell.

FROM node
RUN git clone https://github.com/handshake-org/hs-airdrop.git /hs-airdrop
WORKDIR /hs-airdrop
RUN yarn
RUN mkdir -p /root/.hs-tree-data/nonces
RUN curl -Lo /root/.hs-tree-data/tree.bin https://github.com/handshake-org/hs-tree-data/raw/master/tree.bin
RUN curl -Lo /root/.hs-tree-data/faucet.bin https://github.com/handshake-org/hs-tree-data/raw/master/faucet.bin
RUN curl -Lo /root/.hs-tree-data/proof.json https://github.com/handshake-org/hs-tree-data/raw/master/proof.json
COPY get_tree.sh get_tree.sh
RUN ./get_tree.sh
#!/bin/bash
for i in {000..255}; do
curl -Lo "/root/.hs-tree-data/nonces/$i.bin" \
"https://raw.githubusercontent.com/handshake-org/hs-tree-data/master/nonces/$i.bin"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment