Verify Hive Engine NFT Ownership and Profile Pictures

in HiveDevs2 years ago

In the latest PeakD update (read more about it here) we introduced the option to have "verified" profile pictures backed by Hive Engine NFTs.

This is a short overview of how the validity and the ownership of those NFTs can be verified.

peakd_tech_tales_profile_pictures.png

In this post I'm going to focus on Hive Engine and PunksOnHive as those are the first NFTs supported as verified profile pictures, but I'm looking forward on having more projects integrated into PeakD.


How to verify the NFT image

Most NFTs on Hive Engine store the image URL in the NFT metadata. But this is usually not enough for a verification because that link can easily be copied by multiple users and used by all of them as their profile picture.

To solve this issue @themarkymark provided a separate endpoint for @punksonhive that include both the user (owner) and the punkid. The link looks like: https://punks.usehive.com/api/avatar?user=asgarth&punkid=7781

The above URL will resolve to this image: https://files.usehive.com/file/hivepunks/7781.png

But if you try to change the owner account the link will resolve in a 404 error. You can try it yourself with: https://punks.usehive.com/api/avatar?user=asgarth&punkid=1. You will get an error because I don't own the punk 1.

This image URL format allows to easily verify the validity of both the image and the NFT because on a user profile it's easy to match the account name with the user parameter in the image URL.

How to check NFT ownership

Verify the ownership of a NFT on Hive Engine requires a little bit of code. As far as I know there is no UI to view all NFTs associated with a Hive account (yet 😊).

Good news is that the script is pretty simple and only require to install the sscjs library.

Install
npm install @hive-engine/sscjs
Script
const SSC = require('@hive-engine/sscjs')
const ssc = new SSC('https://api.hive-engine.com/rpc')

ssc.find('nft', 'PUNKinstances', { account: 'asgarth', _id: 7781 }).then((result) => {
  if (result.length === 1)
    console.log('Verified')
  else
    console.log('Not found')
})

The above script can be used for other NFT projects too, just remind to change PUNKinstances with the correct name/table.


That's all for now, see you next time 👋

If you like what we do and you would like to get in touch feel free to reach out in our Discord server or if you are a developer and you are interested in working on Hive related projects have a look at this post.

Sort:  

Contact telos eos and wax and @dan for his #edenos hive eos wax if system to maybe be used with @peakd so we can have a system where no one needs any keys and your faceid or a video chat = a login

Maybe we can use the nfts as identity with faces for people who want a public hive account

Congratulations @asgarth! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You distributed more than 29000 upvotes.
Your next target is to reach 30000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Day - June 1st 2022

Gratz, ty for the functionality. :)