GithubHelp home page GithubHelp logo

Comments (7)

yashasvi-ranawat avatar yashasvi-ranawat commented on June 12, 2024 1

I am fetching UTXO from bitcore and then signing inputs using bitcash.

bitcash, since version 1.0, has different Unspent format. The Unspents also have cashtokens. You'll need to append the missing cashtoken data to your "unspents":

def unspent_core2cash(tx_data):
    unspents = tx_data["unspents"]
    for unspent in unspents:
        for i in ["category_id", "nft_capability", "nft_commitment", "token_amount"]:
            unspent[i] = unspent.get(i)
    return tx_data
tx_data = unspent_core2cash(tx_data)
signed_hex = private_key.sign_transaction(tx_data)

In the code, I noticed that Unspent.from_dict expects a second argument. However, based on the references I initially mentioned, this second argument isn't provided.

That's a class function construct, the first argument is the class itself (like "self", but @classmethods have "cls" convention). Its a python thing.

You may ask further, but close the issue if this resolves it. :)

from bitcash.

merc1er avatar merc1er commented on June 12, 2024

@yashasvi-ranawat would you have an idea?

from bitcash.

merc1er avatar merc1er commented on June 12, 2024

Also, @dinno-invis1ble would you be able to give a minimal reproducible example?

from bitcash.

yashasvi-ranawat avatar yashasvi-ranawat commented on June 12, 2024

That should not happen. Unspent class is slotted, so Unspent will always have "nft_commitment". When Unspent.to_dict() is used, the dictionary will have "nft_commitment" as None if its not defined. I'm not sure how you managed to feed a dictionary with undefined "nft_commitment". Perhaps in an extended use-case there's a bug which causes it!

Also, @dinno-invis1ble would you be able to give a minimal reproducible example?

would be much appreciated.

from bitcash.

dinno-invis1ble avatar dinno-invis1ble commented on June 12, 2024

I am fetching UTXO from bitcore and then signing inputs using bitcash.

signed_hex = private_key.sign_transaction(tx_data)

Example of 'tx_data' variable:

{ "unspents": [ { "amount": 1982163, "script": "76a914ac850b8d9340cc1e1fd2921a15a52d8ba7fb4e1288ac", "txid": "a983b764947b4a8fa6d08ef08cd46629242a8fcf916f09703e6f17375adddefb", "txindex": 1, "confirmations": 1 } ], "outputs": [ [ "bitcoincash:qp8xlkvxxwase8dzsfvrn8x2ewyn44cx4uum45ggx3", 384986 ], [ "bitcoincash:qzkg2zudjdqvc8sl62fp59d99k96076wzgtfuyhz22", 1595425 ] ] }

from bitcash.

dinno-invis1ble avatar dinno-invis1ble commented on June 12, 2024

In the code, I noticed that Unspent.from_dict expects a second argument. However, based on the references I initially mentioned, this second argument isn't provided.

from bitcash.

merc1er avatar merc1er commented on June 12, 2024

Thanks for addressing this! Closing.

from bitcash.

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.