Skip to content

Instantly share code, notes, and snippets.

@mattlord
Last active July 10, 2021 00:29
Show Gist options
  • Save mattlord/5b9931b6ea710a9cdd6e804d4b4ebb3e to your computer and use it in GitHub Desktop.
Save mattlord/5b9931b6ea710a9cdd6e804d4b4ebb3e to your computer and use it in GitHub Desktop.
❯ echo "${RANDOM}:${RANDOM}:${RANDOM} -- cat beer mustang mountain noway -- you are the owner of Matt's art, congrats" > /tmp/nft-input.txt
❯ cat /tmp/nft-input.txt
4303:3459:12817 -- cat beer mustang mountain noway -- you are the owner of Matt's art, congrats
❯ shasum -a 256 /tmp/nft-input.txt | awk '{print $1}' > /tmp/mattsart-nft.txt
❯ cat /tmp/mattsart-nft.txt
3bcbd498e57d4bcd85abeeb79fb006f483801043517d555902939bd70c85f925
❯ cat /tmp/mattsart-nft.txt | tr b a > /tmp/mattsfakeart-nft.txt
❯ VALID_TOKEN=$(shasum -a 256 /tmp/nft-input.txt | awk '{print $1}')
❯ for file in $(ls /tmp/*-nft.txt); do TOKEN=$(cat ${file}); echo "Checking ownership validity using ${file}..."; if [[ ${TOKEN} == ${VALID_TOKEN} ]]; then echo " -- Provider of ${file} is verified as an owner"; else echo " -- Provider of ${file} is lying"; fi; done
Checking ownership validity using /tmp/mattsart-nft.txt...
-- Provider of /tmp/mattsart-nft.txt is verified as an owner
Checking ownership validity using /tmp/mattsfakeart-nft.txt...
-- Provider of /tmp/mattsfakeart-nft.txt is lying
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment