Comments (7)
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.
@yashasvi-ranawat would you have an idea?
from bitcash.
Also, @dinno-invis1ble would you be able to give a minimal reproducible example?
from bitcash.
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.
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.
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.
Thanks for addressing this! Closing.
from bitcash.
Related Issues (20)
- send() no longer pulls in unspents HOT 5
- ValueError: "0" is an invalid base58 encoded character. on PrivKeyTestnet HOT 2
- Remove hex_to_wif() from documentation HOT 1
- ConnectionError: All APIs are unreachable HOT 6
- How to sweep all BTC from wallet HOT 1
- ERROR: Could not build wheels for coincurve HOT 1
- Unsupported hash type ripemd160 HOT 9
- Cash Tokens support CHIP-2022-02-CashTokens HOT 1
- wallet balance not accurate HOT 1
- wallet balance not synced (same error as closed ticket) HOT 3
- Difference from `bit` HOT 5
- Cash address contains uppercase and lowercase characters HOT 3
- Unable to send more than one transaction within a block HOT 2
- Upgrade CI workflow actions
- How can you sign multiple inputs originating from various addresses? HOT 4
- Chain verification missing HOT 2
- Bitcash not creating valid transactions despite returning a TxID HOT 4
- APIs out of date HOT 6
- Chaining unconfirmed transactions does not work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitcash.