Author Topic: BUG: uptick + pybitshares dosen't work with testnet / keys not starting with 5  (Read 2252 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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/.

Offline runestone

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?
Br, Rune
~ Please vote on blockbasis-witness
~ https://www.blockbasis.com

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
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"?

Offline clockwork

  • Committee member
  • Sr. Member
  • *
  • Posts: 376
    • View Profile
  • BitShares: clockwork
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

Offline runestone

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?
« Last Edit: March 03, 2018, 01:42:05 am by runestone »
Br, Rune
~ Please vote on blockbasis-witness
~ https://www.blockbasis.com