You are viewing a single comment's thread:

RE: Opening a NFT card shop in Splinterlands for $25+

(edited)

Hey buynano,

interesting tutorial, was also looking into buying card sets with python right now. There's just two thing which are puzzling me a bit:

1

Add owner.key
Make a new file called owner.key and place your hive owner key for the wallet you want to use. This is your private key so don't share it with anyone and make sure it's not network accessible.

By owner key, do you mean the private owner key of the account ? Or the Private posting key ? Because for neither operation you need the owner key. Active and posting are more than enough.

2 Is there a reason you are using the transaction builder instead of the custom json function on the hive instance itself ?

0E-8 BEE
1 comments
(edited)

Thanks, good questions.

  1. You might need the active key? I just used owner because I'm lazy :)

  2. Hey there's a custom_json function https://beem.readthedocs.io/en/latest/beem.blockchaininstance.html#beem.blockchaininstance.BlockChainInstance.custom_json

I haven't tried this either but it looks legit. I was scared of messing up those transactions so I went straight API. I bet custom_json would work.

Edit: After thinking about it, (1) could be considered security issue so I issued an update.

0E-8 BEE
(edited)

about 1. yes, you absolutely shouldn't use the owner key unless necessary. its exposing the account to a small but unnecessary risk. unless someone gets a hold of your script and you stored it in the script itself. then your account is lost. since you can change the master password with your owner key. and with that all the other private keys.

about 2. it does essentially exactly what you are doing if you look at the beem source code. for examples just take a look at some of my tutorials. the lastest about submitting battles uses a lot of custom json stuff, the rental tutorial as well.

but essentially it works like this (you can load the keys through various other means, that is just the easiest for explaining):
hive: Hive = Hive(keys=[posting_privatekey,active_privatekey])

hive_id: str = "sm_stake_tokens"
request = {"token": "SPS", "qty": qty}
hive.custom_json(hive_id, json_data=request, required_posting_auths=["user"])

0E-8 BEE