bitshares / bitshares/bitshares-core

Ability to use cli_wallet built from master or develop at the public testnet.

Open
#1,412 8 comments 0 reactions 0 assignees View on GitHub
1b User Story 2a Discussion Needed 3b Feature 4a Low Priority 6 CLI 6 UX
Dominant language
C++
Stars
1.2k
Forks
660
Avg merge
8h 17m
Merged PRs (30d)
26

Description

When doing some research for https://github.com/bitshares/bitshares-core/issues/1408 i found that a `cli_wallet` built for the mainnet(bracnhes: master, develop, hardfork) can not be used for the public testnet.

The `cli_wallet` haves the `--chain-id` option that will work when the network is a private testnet, for the public testnet it is not enough to use this argument, commands will fail as:

```
new >>> get_account faucet
get_account faucet
10 assert_exception: Assert Exception
base58str.substr( 0, prefix_len ) == prefix:
{"base58str":"TEST5yYohX9UaBhq4kKEYvqgKdQY9jF5zSZth5rKtCmSUANdxX4Jvc"}
th_a types.cpp:49 public_key_type
new >>> get_account 1.2.3564
get_account 1.2.3564
10 assert_exception: Assert Exception
base58str.substr( 0, prefix_len ) == prefix:
{"base58str":"TEST7H976gDkY4PkUTpLTDNjYL8u7n9fP9X4qgi4rbArYRS7srxUqE"}
th_a types.cpp:49 public_key_type
new >>> get_account special-account
get_account special-account
10 assert_exception: Assert Exception
base58str.substr( 0, prefix_len ) == prefix:
{"base58str":"TEST7H976gDkY4PkUTpLTDNjYL8u7n9fP9X4qgi4rbArYRS7srxUqE"}
th_a types.cpp:49 public_key_type
new >>>
```

This is because the prefix is hardcoded here: https://github.com/bitshares/bitshares-core/blob/testnet/libraries/chain/include/graphene/chain/config.hpp#L26 for the testnet and here for the mainnet: https://github.com/bitshares/bitshares-core/blob/develop/libraries/chain/include/graphene/chain/config.hpp#L26

As consequence wallet built for the mainnet can only be used to connect to mainnet(or private testnet) and wallet built from testnet can only be used to connect to to testnet.

I am not sure if this is important enough to research how to solve it. I am thinking on an argument `--core-token-prefix` into the `cli_wallet` as a possible way to make the same binary work in both places.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with libraries/chain/include/graphene/chain/config.hpp on the testnet and develop branches, then trace how cli_wallet handles --chain-id and public-key prefixes. Reproduce the shown get_account failures against the public testnet and determine how one binary could select the correct prefix. Done means a mainnet-built cli_wallet can perform these public-testnet commands without prefix errors, with tests covering both network configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
blockchain, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.