BitShares Forum

Main => Technical Support => Topic started by: runestone on March 03, 2018, 01:29:19 am

Title: BUG: uptick + pybitshares dosen't work with testnet / keys not starting with 5
Post by: runestone on March 03, 2018, 01:29:19 am
Uptick is only working with WIF keys pre-fixed with 5.
Code: [Select]
uptick --node wss://node.testnet.bitshares.eu addkey 6PR...
Current Wallet Passphrase:
Invalid Private Key Format. Please use WIF!

uptick --node wss://node.testnet.bitshares.eu addkey 5JV...
Current Wallet Passphrase:

Similarly, pybitshares will also fail here:
Code: [Select]
from bitshares import BitShares
bitshares = BitShares("wss://node.testnet.bitshares.eu", nobroadcast=False)
bitshares.wallet.unlock("wallet-password")
accName = bitshares.wallet.getAccountFromPrivateKey("6PR...")

Where should a bug like this be reported?
Title: Re: BUG: uptick + pybitshares dosen't work with testnet / keys not starting with 5
Post by: clockwork on March 03, 2018, 06:38:09 am
Bitshares doesn't make a distinction for keys between testnet and mainnet...."6P..." is the bitcoin testnet format

Bitshares uses normal WIF keys for testnet as well
Title: Re: BUG: uptick + pybitshares dosen't work with testnet / keys not starting with 5
Post by: xeroc on March 03, 2018, 12:08:14 pm
The reason for this limitation is that the bitshares backend only knows keys in that particular format.
Even though there is only a version flag different, I don't know if those keys would actually help you in any way.

What are you trying to do with pybitshares/uptick with that "key"?
Title: Re: BUG: uptick + pybitshares dosen't work with testnet / keys not starting with 5
Post by: runestone on March 07, 2018, 01:17:36 am
In this case specifically, I'm just playing around with pybitshares, to get a better understanding on how BitShares and the python lib works. To solve the issue below, I decided to setup a private testnet instead, which will solve the issue with WIF keys starting with 6.

But, then I got another issue when connecting to my testnet using uptick/pybitshares:
Code: [Select]
Connecting to unknown network!
My best guess here was that its because uptick/pybitshares is not using the correct chain-id. To solve this, I did this:
Code: [Select]
./cli_wallet --wallet-file=my-wallet.json --chain-id=e08d...12c0 --server-rpc-endpoint=ws://127.0.0.1:8090 --rpc-endpoint=0.0.0.0:8092 --rpc-http-endpoint=0.0.0.0:8093 -d
Now, I'm able to reach the rpc-endpoint through cli_wallet (without specifying the chain-id). But, then my code returned another error:
Code: [Select]
from bitshares import BitShares
bitshares = BitShares("ws://testnet:8092", nobroadcast=False, debug=True)

raise exceptions.UnhandledRPCError(msg)
    bitsharesapi.exceptions.UnhandledRPCError: Assert Exception: _local_apis.size() > api_id:

What's going wrong here?
Title: Re: BUG: uptick + pybitshares dosen't work with testnet / keys not starting with 5
Post by: xeroc on March 12, 2018, 02:27:20 pm
The BitShares() instance is not supposed to connect to the CLI-wallet.
If you need your node added, you need to get your own copy of pybitshares and modify/extend the chains.py file in bitsharesbase/.