Giter Site home page Giter Site logo

Comments (4)

huths0lo avatar huths0lo commented on July 30, 2024

In fact to add to this, I just did another test. I went back and set my output with the assets (the ones being minted in the tx) to the same policy id hash that gets generated, and this time the tx went through. The big challenge here, is that even if I use the same keys, every time I restart my python interpreter, the policy hash changes.

Without restarting my interpreter, I was able to burn the same assets I created. So I just need to find a way to either extract the policy id from the keys correctly, or just be able to load my policy id directly, instead of using the pycardano functions.

aka policy_id = 'abcede'
instead of policy_id = policy.hash() (of which policy was generated with pycardano functions)

from pycardano.

huths0lo avatar huths0lo commented on July 30, 2024

I was able to work around it by skipping all the steps that generate the policy info, and instead use this single command to read in the json contents of the policy script.

policy = InvalidHereAfter.from_dict(raw_tx['mint_script'])

from pycardano.

cffls avatar cffls commented on July 30, 2024

Hi @huths0lo , in most cases, minting policy should be generated only once, after which the policy id should be loaded from somewhere deterministic, e.g. file, environment variable. It is better to separate the code into two parts, where the first part generates the policy, and the second uses that policy to mint and burn tokens. You can use to_dict function of a native script policy to convert it to a dictionary that could be saved as a json file, and use from_dict to restore the policy from a json.

from pycardano.

cffls avatar cffls commented on July 30, 2024

Closing this issue since the question has been answered.

from pycardano.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.