hiveengine - improved NFT handling

in HiveDevs4 years ago (edited)

Repository

https://github.com/holgern/hiveengine

pypi header

hiveengine

hiveengine is a python library for working with hive-engine.com tokens and NFTs.

I released version 0.2.2 which can be installed by

pip install hiveengine

hiveengine is using beem for broadcasting transfers and custom_json to the HIVE blockchain. hiveengine is only working when using HIVE nodes. You can check the currently set nodes with

beempy config

Hive nodes can be set with

beempy updatenodes --hive

Using the beem wallet for key storage simplifies broadcasting. You can use

beempy createwallet

and

beempy addkey

for this. Whenever you want to broadcast something with beempy/hiveengine, you can now enter your wallet password.

Changelog

  • fix hiveengine info for NFT symbols
  • add min-hive parameter to nftsellbook
  • add cheapest-only parameter to nftsellbook
  • Read groupBy when grouping is empty in nftsellbook
  • update_url, update_metadata, update_name, update_org_name, update_product_name, add_authorized_issuing_accounts,
    add_authorized_issuing_contracts, remove_authorized_issuing_accounts, remove_authorized_issuing_contracts,
    transfer_ownership, add_property, set_property_permissions, set_properties, set_group_by,
    update_property_definition, issue, issue_multiple, enable_delegation added to Nft
  • New nft command to view properties of an NFT object
  • Fix nfttrades command and lists a trades summary when now symbol was given
  • Add interactive mode to nftsellbook for buy, cancel or change price

How to use the hiveengine to sell cards

We need at first the nft-id of the cards:
nft id example

hiveengine nftsell -a holger80 star 9081 9290 750 STARBITS

There will be always a confirm dialog:
output of ntfsell
When continue, the operation will be broadcasted and a trx_id is returned:
broadcasted op
I can now copy the trx-id and check if the putting my nfts to the market was successfully:

hiveengine info 13441d81fbf462cb31d7fec3de690069e224158c

How to use hiveengine to cancel all entries at once

Currently, when I want to cancel offers on the market for risingstar, I have to do it for every nft one by one.
market example
hiveengine can be used to simplify this:
First I need the correct property name:

hiveengine nftsellbook -a holger80  star

output of nftsellbook
I can find out the current cheapest price with:

hiveengine nftsellbook -g type -v "i3 Cheap Keyboard" -i star

now I can cancel all my offers at once:

hiveengine nftsellbook -a holger80 -g type -v "i3 Cheap Keyboard" -i star

The --interactive or -i parameter adds the possibility to broadcast a buy, cancel or change price operation on all shown entries:
output of nftsellbook with interactive

hiveengine collection holger80 shows now
nft collection
and I select all nftIds but the first entry and copy/paste it into the following command:

hiveengine nftsell -a holger80 --fee 100 star  7247 7670 8229 8232 8235 1490 STARBITS

I could now improve my position:
result

Buying cards with the interactive mode

The following command allows it to buy the cheapest Can of Patrol card with STARBITS:

hiveengine nftsellbook  -g type -v "Can Of Petrol"  -s starbits -l 1 -i star

output of nftsellbook

Check how many NFT were bought the last 24 hours

 hiveengine nfttrades star

returns all trades of the last 24 hours for the given symbol.
output of nfttrades
A summary is also given.

The following command

hiveengine nfttrades

returns a summary for all NFT symbols:
summary

Checking a single NFT

The following commands can be used to check the newest generated NFT:

hiveengine nftinfo nftsr

nftinfo
shows that the newest NFT has the ID 443.

hiveengine nft nftsr 443

info about nft id
You can view the NFT on nftshowroom by adding the artSeries parameter to https://nftshowroom.com/market/. For this ID, is is https://nftshowroom.com/market/barbarabezina_gif_awake link.

More NFT related custom_json commands have been added

Move NFT related commands have been added to Nft

from hiveengine.nft import Nft
from beem import Hive
active_wif = "5xxxx"
posting_wif = "5xxxx"
hive = Hive(keys=[active_wif, posting_wif])
nft = Nft("TESTNFT", blockchain_instance=hive)

Please read the official documentation NFT-Contracts.md and check the output with Hive(no_broadcast=True).

The names and parameter have been changed from camelcase to underscore: updateMetadata -> update_metadata and isReadOnly -> is_read_only.

The following custom_json that have to be broadcasted by the owner have added:

nft.update_url("https://new_url.com")
metadata = {"url": "https://mycoolnft.com",
            "icon": "https://mycoolnft.com/token.jpg",
            "desc": "This NFT will rock your world! It has features x, y, and z. So cool!"}
nft.update_metadata(metadata)
nft.update_name("My Awesome NFT")
nft.update_org_name("Nifty Company Inc")
nft.update_product_name("Acme Exploding NFTs")
nft.add_authorized_issuing_accounts(["satoshi","aggroed","cryptomancer"])
nft.add_authorized_issuing_contracts(["mycontract","anothercontract","mygamecontract"])
nft.remove_authorized_issuing_accounts(["aggroed","cryptomancer"])
nft.remove_authorized_issuing_contracts(["mycontract","mygamecontract"])
nft.transfer_ownership("aggroed")
nft.add_property("color", "string")
nft.set_property_permissions("color", accounts=["cryptomancer","marc"])
nft.set_group_by(["level", "isFood"])
nft.update_property_definition("color", new_name="Color")

It is also possible to issue new NFTs and change properties of an issued NFT:

nft.issue("user_a", "PAL")
nft.set_properties([{ "id":"573", "properties": {"color": "red", "level": 2}}], authorized_account="satoshi")

If you like what I do, consider casting a vote for me as witness on Hivesigner or on PeakD

Sort:  

What is the drawback of having smart contracts and NFTs on a second layer versus first layer?

I suppose it is less secure or decentralized in some way but why exactly?

Hi @holger80, you have received a small bonus upvote from MAXUV.
This is to inform you that you now have new MPATH tokens in your Hive-Engine wallet.
Please read this post for more information.
Thanks for being a member of both MAXUV and MPATH!

Awesome! Gonna dig into hive engine next week! looking forward to it! Thanks for the post

we love improvements ehehe

Posted using Dapplr

Wow, hive engine this brought us new experience...

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

Your post got the highest payout of the day

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

Support the HiveBuzz project. Vote for our proposal!