GithubHelp home page GithubHelp logo

Comments (7)

 avatar commented on May 20, 2024

Can you give some more code examples? key.address should return an address properly.

>>> key = bitcash.PrivateKeyTestnet.from_hex('da2876b3eb31edb4436fa4650673fc6f01f90de2f1793c4ec332b2387b09726f')
>>> key.address
'bchtest:qq9gh20y2vur63tpe0xa5dh90zwzsuxagynn6xtttd'
>>> key.balance
0

The test cases should cover testnet as well. You can run nosetests -vx to run those.

I have been doing this on Python 3.5, possible there's something that breaks in Python 3.6.

from bitcash.

l4zygreed avatar l4zygreed commented on May 20, 2024

sorry, expected legacy (shorter) type of address, like in original git repo

key.get_unspets still cryshing until first confirmation on network
and key.balance still 0

>>> key.get_unspents()
[Unspent(amount=200000000, confirmations=8, script='76a9141944c73fec145bd87f3e427921568d21a95694ea88ac', txid='eabf0b3e4d4d806c1a0f4dd111cbc5c1dbfe6a7a6fdbcbfe760c709c23e9b079', txindex=1)]
>>> key.balance
0

founded another problem, I can't transfer funds

>>> key.create_transaction([], leftover='mqFJqi8SMevMdALqDdUsgiW3FEjVXYqWsv')
'010000000179b0e9239c700c76fecbdb6f7a6afedbc1c5cb11d14d0f1a6c804d4d3e0bbfea010000006a47304402201f3d47f09710d9b556d3175694637dfef838a1fb3cddcdcee1ec37870f3e352e022031eb23a8cdbeb249e1355badef19aff5a68f967f9987385dc2f8e660601015984121039990a14e6b7ad0237e1dd5801e277938d9642794b900a8e8fcec220417496b81ffffffff0100bfeb0b000000001976a9146abbc0d28291128f3b70460a3c0e02e2393bd3cd88ac00000000'
>>> key.transactions
[]

key.send returns error

>>> key.send([('mqFJqi8SMevMdALqDdUsgiW3FEjVXYqWsv', 100000000, 'satoshi')])
ERROR:root:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/l4zygreed/Templates/btc_py/venv/lib/python3.6/site-packages/bitcash/wallet.py", line 587, in send
    NetworkAPI.broadcast_tx_testnet(tx_hex)
  File "/home/l4zygreed/Templates/btc_py/venv/lib/python3.6/site-packages/bitcash/network/services.py", line 366, in broadcast_tx_testnet
    raise ConnectionError('Transaction broadcast failed, or '
ConnectionError: Transaction broadcast failed, or Unspents were already used.

from bitcash.

 avatar commented on May 20, 2024

key.get_unspets still cryshing until first confirmation on network

This is going to depend on the behavior of the one (or two?) upstream testnet APIs in use.

founded another problem, I can't transfer funds

key.transactions will only show a list of transactions that have been on the network. I could be wrong on that, but creating a transaction (which only returns the hex and nothing else) definitely won't update that. You'll have to send to expect any change there. Even then, that feature could be broken, not really sure.

ConnectionError: Transaction broadcast failed, or Unspents were already used.

This error usually comes upstream. I want to improve logging here so that there's at least some warning with what happened.

I'm going to dig into this some more. I would try to stick with the cashaddr format if you can, it's what the API is designed around.

I use bitcash heavily on mainnet but some features are untested by me. If you see insufficient testing you can push up a PR with more test cases.

from bitcash.

 avatar commented on May 20, 2024

KeyError: 'scriptPubKey'

This is coming from tbch.blockdozer.com. I am making a change to ignore keys without 'scriptPubKey'.

Example:

> GET /insight-api/addr/bchtest:qzvsaasdvw6mt9j2rs3gyps673gj86flev3z0s40ln/utxo HTTP/1.1
> Host: tbch.blockdozer.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Tue, 10 Jul 2018 16:42:39 GMT
< Content-Type: application/json; charset=utf-8
< Server: Kestrel
< Cache-Control: public,max-age=30
< Transfer-Encoding: chunked
< Set-Cookie: blockdoza=8d24278ea9a95d8500d820ffcaa835d226acd425; path=/; domain=blockdozer.com
< 
[{"address":"muUFbvTKDEokGTVUjScMhw1QF2rtv5hxCz","txid":"102f4862300fc2388bdf69d42f572e6d083a0246de6bd28b71cfe11aff750b8a","vout":1,"scriptPubKey":"76a914990ef60d63b5b5964a1c2282061af45123e93fcb88ac","amount":0.79069138,"satoshis":79069138,"height":1245981,"confirmations":1},{"address":"muUFbvTKDEokGTVUjScMhw1QF2rtv5hxCz","txid":"0dabf31a8806c230b8cd92f0699228315900e6560e311ec7230d95b4383b2327","vout":1,"amount":0.79058234,"satoshis":79058234,"height":-1,"confirmations":0},{"address":"muUFbvTKDEokGTVUjScMhw1QF2rtv5hxCz","txid":"0dabf31a8806c230b8cd92f0699228315900e6560e311ec7230d95b4383b2327","vout":0,"amount":-0.79069138,"satoshis":-79069138,"height":-1,"confirmations":0}]

from bitcash.

 avatar commented on May 20, 2024

Alright, I just pushed a commit (but no release) with some improvements. The Blockdozer API made some changes, breaking TX sends for testnet, and changing the unspent format. They don't have pubscripthash on unconfirmed transactions now. We could allow that to be set to None, but may cause other problems.

You may want to contact Blockdozer and get them in the loop on this thread. Not sure how much of this affects mainnet and not just testnet.

from bitcash.

 avatar commented on May 20, 2024

Also, key.balance is only accurate after getting unspents. Or maybe doing a send. It starts at 0, maybe not the best behavior.

from bitcash.

 avatar commented on May 20, 2024

Pushed one more commit. Tests can pass now if the timing is right.

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.