Giter Club home page Giter Club logo

cli's Introduction

Oasis CLI

CI tests status CI lint status

This is the official command-line interface (CLI) for interacting with the Oasis Network, both the consensus layer and ParaTimes built with the Oasis Runtime SDK.

Building

To build the CLI, run the following:

make

This will generate a binary called oasis which you are free to put somewhere in your $PATH.

NOTE: The rest of the README assumes the oasis binary is somewhere in your $PATH.

Quickstart

You can interact with the Oasis CLI by invoking it from the command line as follows:

oasis --help

Each (sub)command has a help section that shows what commands and arguments are available.

The Oasis CLI also comes with a default set of networks and ParaTimes configured. You can see the list by running:

oasis network list
oasis paratime list

Initial configuration currently defaults to mainnet and the emerald ParaTime but this can easily be changed using the corresponding set-default subcommand as follows:

oasis network set-default testnet
oasis paratime set-default testnet sapphire

To be able to sign transactions you will need to first create or import an account into your wallet. File-based (storing keys in an encrypted file) and Ledger-based (storing keys on a Ledger device) backends are supported. To create a new file-backed account run:

oasis wallet create myaccount

It will ask you to choose and confirm a passphrase to encrypt your account with. You can see a list of all accounts by running:

oasis wallet list

To show the account's balance on the default network/ParaTime, run:

oasis account show

The account command also allows you to transfer tokens, deposit or withdraw to and from ParaTimes, delegate your assets to validators etc.

Check out the complete User's guide in [docs/README.md] and example invocations of the CLI in examples folder to learn more.

Configuration

All configuration is stored in the $XDG_CONFIG_HOME/oasis directory (e.g. $HOME/.config/oasis on Linux).

License

This software is licensed under Apache 2.0.

The content of the documentation (the /docs folder) including the media (e.g. images and diagrams) is licensed under Creative Commons Attribution 4.0 International.

cli's People

Contributors

abukosek avatar amela avatar buberdds avatar dependabot[bot] avatar jberci avatar kostko avatar matevz avatar nhynes avatar peternose avatar pro-wh avatar ptrus avatar tjanez avatar yawning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

karthiks416

cli's Issues

Further denomination-related improvements

Further denomination-related improvements:

  • oasis paratime list should have another column DENOMINATION(S) containing comma-separated currencies, number of decimals and the default one marked with (*). For example EUROe[18] (*), TEST[18]
    Issue: #236
  • new subcommand oasis paratime denom with
    • add <network> <paratime> <denomination> <number_of_decimals>
      Issue: #241
    • remove <network> <paratime> <denomination>
      Issue: #241
    • in the future, other ERC-20 related operations will also be covered by the denom subcommand
  • the list of registered denominations. This should probably go inside the oasis paratime show <paratime>

Originally posted by @matevz in #206 (review)

Support removal of multiple accounts

Allow mulitple account names to be removed, for example

oasis wallet remove test1 test2 test3 test4

For each wallet, Oasis CLI would then ask you for confirmation.

In combination with #120, this comes very handy when you want to quickly remove a bunch of test accounts locally.

`oasis wallet import` add non-interactive mode

Currently, the only way to import an existing account is using the interactive mode. Sometimes you poses a bunch of private keys you would like to import and examine. In this case something similar to oasis wallet create would be useful. e.g.

oasis wallet import my_imported_raw_account --algorithm secp256k1-raw --secret 0x123456890abcdef1234569abcdef
oasis wallet import my_imported_mnemonic_account --algorithm secp256k1-bip44 --number 2 --secret "test test test test test test test test test junk"

The secret flag could also be omitted perhaps oasis wallet import <name> [secret] [flags]?

Related #120

ci: Speed up ci-tests workflow

At the time of writing, the Build code and Run tests steps take in the order of 45-60 seconds:
Screenshot from 2023-01-04 13-47-06

Figure out if we could speed this up.

Some ideas:

  • Caching to speed up building (most unchanged) Go code.
  • Re-using built Go code for tests. Do tests compile all the Go code again?

Add withdrawal/deposit/transfer check if destination is ParaTime or other non-withdrawable address

One could do the following stupidity, which is not very obvious

oasis accounts deposit 10 paratime:emerald

because to is an optional argument to deposit cmd and paratime:emerald is a built-in address, instead of

oasis accounts deposit 10 --paratime emerald

This would lock the tokens forever. Same goes for transfers or withdrawals, although less likely. Add a check similar to CheckLocalAccountIsConsensusCapable() which would prevent you from moving tokens to reserved addresses for ParaTimes, common staking pool, the new burn pool etc.

Add new subcmds `denom set` and `denom set-native` and `denom remove`

  • oasis paratime denom set <network> <paratime> <denomination> <number_of_decimals> --symbol <symbol> (if someone sets denomination to _ it does not allow them to change denom, if symbol is not specified defaulting to <denomination>)
  • oasis paratime denom set-native <network> <paratime> <denomination> <number_of_decimals>
  • oasis paratime denom remove <network> <paratime> <denomination>

Show ParaTime transaction details

For ParaTime transactions (deposit, withdrawal, transfers), we're currently just showing the base64 cbor-encoded transaction body:

$ oasis accounts transfer 10 test:alice
Unlock your account.
? Passphrase: 
You are about to sign the following transaction:
{
  "v": 1,
  "call": {
    "method": "accounts.Transfer",
    "body": "omJ0b1UA84957B5s/pe0/gbHiYtSqPrbR4NmYW1vdW50gkUCVAvkAEA="
  },
  "ai": {
    "si": [
      {
        "address_spec": {
          "signature": {
            "ed25519": "MJ2XCjkj132C9YWpDUSQFjkCTI8bSw8bi0w9EwwE1Bg="
          }
        },
        "nonce": 3
      }
    ],
    "fee": {
      "amount": {
        "Amount": "651535",
        "Denomination": ""
      },
      "gas": 130307
    }
  }
}

Account:  test
Network:  testnet
Paratime: cipher
? Sign this transaction? (y/N)

Compared to consensus transactions:

$ oasis accounts transfer 10 test:alice --no-paratime
Unlock your account.
? Passphrase: 
You are about to sign the following transaction:
Method: staking.Transfer
Body:
  To:     oasis1qrec770vrek0a9a5lcrv0zvt22504k68svq7kzve
  Amount: 10.0 TEST
Nonce:  7
Fee:
  Amount: 0.0 TEST
  Gas limit: 1265
  (gas price: 0.0 TEST per gas unit)

Account:  test
Network:  testnet
Paratime: none (consensus layer)
? Sign this transaction? (y/N)

Decode the body and show transaction details for known transaction types.

Something similar was already done for the ParaTime test vectors.

Crash when sending ParaTime transaction to consensus

Using 849aceb I'm getting a CLI crash, if submitting ParaTime tx to consensus by accident:

$ cat testtx2.json 
{
  "Body": "o2F2AWJhaaJic2mBomVub25jZQFsYWRkcmVzc19zcGVjoWlzaWduYXR1cmWhZ2VkMjU1MTlYIDXD8zVt2FNk/roDVLVFraEJ0b2zi/XWEmgX24xyz9aRY2ZlZaJjZ2FzAWZhbW91bnSCQEBkY2FsbKJkYm9keaJidG9VAMjQ9FnbOOXMMcp35m0sRFbcvrUCZmFtb3VudIJIDeC2s6dkAABAZm1ldGhvZHFhY2NvdW50cy5UcmFuc2Zlcg==",
  "AuthProofs": [
    {
      "signature": "mxOARaaRkHrHiUObGO2KbUXZhmbIS2h3hsRM+3Y/DzvMtbVdwcZm2EZ7oP7dR5XHKkrQnjMwZnkT0mdZUsLIBw=="
    }
  ]
}

$ oasis tx submit testtx2.json --network mainnet  --no-paratime
Broadcasting transaction...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xc3aa5f]

goroutine 1 [running]:
github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection.(*connection).Runtime(0xc000014278, 0x0?)
        /home/oa/go/pkg/mod/github.com/oasisprotocol/oasis-sdk/client-sdk/[email protected]/connection/connection.go:65 +0x5f
github.com/oasisprotocol/cli/cmd/common.BroadcastTransaction({0x13f8f50, 0xc000120000}, 0x0?, {0x13f71a0, 0xc000014278}, {0xf74340?, 0xc0007b47b0}, {0x0, 0x0}, {0x0, ...})
        /home/oa/cli/cmd/common/transaction.go:369 +0x127
github.com/oasisprotocol/cli/cmd.glob..func40(0x1a9ee40?, {0xc000161400, 0x1, 0x4?})
        /home/oa/cli/cmd/tx.go:66 +0x359
github.com/spf13/cobra.(*Command).execute(0x1a9ee40, {0xc0001613c0, 0x4, 0x4})
        /home/oa/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0x1a9e880)
        /home/oa/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/oa/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/oasisprotocol/cli/cmd.Execute(...)
        /home/oa/cli/cmd/root.go:36
main.main()
        /home/oa/cli/main.go:6 +0x25

Make network status output cleaner

oasis network status currently dumps complete status of the network (and the node). Simplify it and print out only relevant information, for example:

  • Oasis Core version
  • Consensus block:
    • Consensus version x.y.z
    • status
    • latest height (with time)
    • latest epoch
    • number of peers
  • for each runtime, a section with its name (+runtime ID)
    • active runtime version (+ old and upcoming versions)
    • status
    • runtime active version
    • latest round (with time)
    • number of peers

Add --json switch for existing behavior.

Add support for sr25519 accounts

Oasis CLI currently supports ed25519 and secp256k1 wallets. Add suport for sr25519 as well. Also test, if signing with Ledger works (implemented in #11).

Set up additional golangci-lint linters

Currently, only golangci-lint's default linters are enabled:

Running [/home/runner/golangci-lint-1.50.1-linux-amd64/golangci-lint run --out-format=github-actions --verbose] in [] ...
  level=info msg="[config_reader] Config search paths: [./ /home/runner/work/cli/cli /home/runner/work/cli /home/runner/work /home/runner /home /]"
  level=info msg="[lintersdb] Active 7 linters: [errcheck gosimple govet ineffassign staticcheck typecheck unused]"
  
... trimmed ...

Add .golangci.yml to the repo and consider enabling additional linters from the vast number of golangci-lint's supported linters.

Add -y flag

Add -y flag for non-interactive mode which takes all proposed values and answers YES to y/n questions. This is useful for CI when spinning up Oasis stack and Oasis CLI needs to register the chain and fund some accounts in non-interactive mode.

--config not always considered

Steps to reproduce:

  1. oasis wallet create test123
  2. cp -r ~/.config/oasis ~/.config/oasis2
  3. oasis wallet rm test123 --config ~/.config/oasis2/cli.toml

Expected behavior:
File ~/.config/oasis2/test123.wallet is removed and ~/.config/oasis2/cli.toml updated.

Actual behavior:
File ~/.config/oasis/test123.wallet is removed (!) and ~/.config/oasis2/cli.toml updated.

Support paratime:some_paratime_name in oasis network show

Currently, paratime:some_paratime_name is always transformed into Oasis native address. oasis network show expects the Runtime ID as a parameter. I suggest we make an exception here and transform paratime:emerald to its runtime ID.

Add command for fetching compute committees

Currently, you can do oasis net show nodes, but you cannot determine which of those are actually elected in the (compute) committee for each ParaTime. Add something like oasis net show committee <ParaTimeID> which dumps the list of nodes in the given compute committee (and optionally for the specific block height).

Trim 0x when importing secp256k1 private key

  1. oasis wallet import
  2. select raw private key
  3. select sep256k1
  4. paste private key
  5. if the key starts with 0x which is often in Eth world, CLI complains that it's not a valid hex value.

Expeceted behavior:
Automatically trim the leading 0x characters, if they exist, and then import the private key without complaining.

Pretty print for Cipher txes

Currently, data field is Base64-encoded when showing:

$ oasis contracts instantiate 286 '{instantiate: {initial_counter: 43}}' --paratime cipher
Unlock your account.
? Passphrase: 
You are about to sign the following transaction:
Format: plain
Method: contracts.Instantiate
Body:
  {
    "code_id": 286,
    "upgrades_policy": {
      "address": "oasis1qrpaguksger8dqq8pn0vcnu8kr4m29ssvqk7kn0y"
    },
    "data": "oWtpbnN0YW50aWF0ZaFvaW5pdGlhbF9jb3VudGVyGCs=",
    "tokens": []
  }
Authorized signer(s):
  1. MJ2XCjkj132C9YWpDUSQFjkCTI8bSw8bi0w9EwwE1Bg= (ed25519)
     Nonce: 3
Fee:
  Amount: 0.001417535 TEST
  Gas limit: 283507
  (gas price: 0.000000005 TEST per gas unit)

Network:  testnet
ParaTime: cipher
Account:  test

Decode it and show it as JSON.

CLI docs for node operators

In preparation for 23.x, tidy up Oasis CLI docs for existing node operators:

  • mention in wallet import how to import ed25519-raw type from the existing .pem file
  • mention in wallet list that ed25519-raw is the type for node operators
  • add to network governance cast-vote the standard NPA disclaimer

Add subcmds `oasis network operators`

It would be nice to have a cli function that lists data regarding operators and optionally stores it in the CSV. Examples of cmds:

  • oasis network operators < validators | sapphire | cipher | ... > -> it would list operators metadata and addr with their emails
  • oasis network operators nodes -> it would list node versions with their operator's metadata, addr and emails

Alias: opers

Support relative amount for tokens and shares

Currently, there is no simple way to empty your account apart from copying and pasting the amount and subtracting the fee. One way to solve this is to support both the absolute number of tokens to transfer or the relative share of your account:

oasis account transfer <amount|share%> <to> [flags]

CLI would compute the correct amount by querying the account balance, compute the relative amount, compute the fee and subtract the fee from the relative amount.

In the case above, one could empty the account by invoking:

oasis account transfer 100% my_cold_wallet

The relative amount could as well be implemented for deposits, withdrawals, allowances, delegations and the same for the ParaTime-layer transactions. The undelegate command could also use the relative amount of shares.

Name addresses, if found in wallet/addressbook/test/paratime entries

Currently, there are places such as --show-delegations and other consensus transactions where the address is not associated with the entry in your wallet or addressbook. For example oasis acc show my_account --show-delegations yields:

Delegations:
      - To:       oasis1qrydpazemvuwtnp3efm7vmfvg3tde044qg6cxwzx
        Amount:   100.0 TEST (100000000000 shares)
        End Time: epoch 29127

Where oasis1qrydpazemvuwtnp3efm7vmfvg3tde044qg6cxwzx is infact test:bob.

The same goes for allowances, for example to oasis1qrd3mnzhhgst26hsp96uf45yhq6zlax0cuzdgcfc which should in fact be paratime:sapphire:

  Allowances for this Account:
    Total: 1000.0 ROSE
    Allowances:
      - Beneficiary: oasis1qrd3mnzhhgst26hsp96uf45yhq6zlax0cuzdgcfc
        Amount:      1000.0 ROSE

Add more descriptive error when depositing if you forget allowance

If you forget allowance and just deposit, you get a weird error regarding staking module. It would be nice, if more descriptive suggestion like Did you forget to set allowance? is printed as well.

Also document module error 9: staking: amount is lower than the minimum transfer amount.

Merge `inspect` and `registry` commands with `network`, `paratime`, `account` commands

Current inspect and registry platform-specific commands seem out of place compared to account, paratime and network commadns which are user-centric. As a rule-of-thumb, entity and validator operations go under account, consensus operations go under network and runtime operations go under paratime. I suggest we merge those accordingly:

  • oasis registry runtime-register -> oasis paratime register
  • oasis registry entity-register, oasis registry entity-deregister, oasis registry node-unfreeze could go under oasis account entity register, oasis account entity deregister, oasis account node-unfreeze
  • oasis registry show -> oasis network show
  • oasis inspect native-token -> oasis network info (in the future, this could also be added to oasis paratime for querying ParaTime-native tokens, but currently this is not supported yet anyway)
  • oasis inspect node-status -> oasis network status
  • oasis inspect runtime-stats -> oasis paratime stats
  • oasis inspect governance-proposal -> oasis network governance-proposal
  • oasis inspect block -> oasis paratime show

QoL: `oasis paratime show` should support Ethereum transaction IDs (with optional `0x` prefix)

To improve quality of life it would be good if either the Oasis transaction hash or Ethereum transaction hash can be specified, with optional 0x prefix for the oasis paratime show command.

These both work:

oasis paratime show 2781982 985ab24c970a7901b864a89f26e54d14223e65d4edecca861cba8ec00becffc9 --network testnet
oasis paratime show 2781982 0 --network testnet

But, passing the 'Eth Hash' (0x4fcd824e3ca229b9703bf5887d70a99901268fe262bff1037929a1f4e708f860) doesn't work.

$ ./oasis paratime show 2781982 0x4fcd824e3ca229b9703bf5887d70a99901268fe262bff1037929a1f4e708f860 --network testnet 
Error: malformed tx hash: encoding/hex: invalid byte: U+0078 'x'

and

$ ./oasis paratime show 2781982 4fcd824e3ca229b9703bf5887d70a99901268fe262bff1037929a1f4e708f860 --network testnet 
...
Error: failed to find transaction with hash 4fcd824e3ca229b9703bf5887d70a99901268fe262bff1037929a1f4e708f860

Crash when depositing tokens

Using 6fdd7a1, when doing a batch of 150 deposits to Sapphire on Mainnet, I encountered the following crash. This occurred in 5-10% of deposits.

You are about to sign the following transaction:
Format: plain
Method: consensus.Deposit
Body:
  To: oasis1qrhq0ud0f7w70x445wkp760vdfz2agqcev3jl9r7
  Amount: 200.0 ROSE
Authorized signer(s):
  1. A2Mrg5uHLGnLkCErHgPtRJwvM8/w4lzGIZylfcWDrgI= (ed25519)
     Nonce: 76
Fee:
  Amount: 0.0 ROSE
  Gas limit: 11312
  (gas price: 0.0 ROSE per gas unit)

Network:  mainnet
ParaTime: sapphire
Account:  rtk
? Sign this transaction? Yes
(In case you are using a hardware-based signer you may need to confirm on device.)
Broadcasting transaction...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc65081]

goroutine 42 [running]:
github.com/oasisprotocol/cli/cmd/common.WaitForEvent.func1()
        /home/oa/cli/cmd/common/transaction.go:440 +0x121
created by github.com/oasisprotocol/cli/cmd/common.WaitForEvent
        /home/oa/cli/cmd/common/transaction.go:431 +0x26c

cli: Use import instead of create to open Ledger account

Term "create" should be used if the CLI generates a new keypair. When adding a Ledger account into the wallet, CLI doesn't generate or overwrite anything, but just registers existing Ledger account to the CLI.

Use oasis wallet import to add the Ledger account instead of oasis wallet create. In this case importing would also be done interactively so the user can see the Ledger option and easily provide the key derivation index (no need for non-obvious --kind ledger and --number x flags). This also makes the CLI flow consistent with Oasis wallet web and extension.

Crash when viewing ParaTime block

Using 8928f4e:

$ oasis pt show 1602725 0
Network:        testnet
ParaTime:       sapphire
Round:          1602725
Version:        0
Namespace:      000000000000000000000000000000000000000000000000a6d1e3ebf60dff6c
Timestamp:      2023-06-19T15:08:06+02:00
Type:           1
Previous:       77f3a18e6a833ae0cb090c7e6442095c51b4f83c20d9ae3fec38378404abf6c9
I/O root:       64c79e51885644b1e2d29e49c0ecdb68a8a1da362da0e0061cf362c4189224c9
State root:     eb61f4f3274f9e6eb8ca5cb60421732a34aac5f56cf98650394178369d82130b
Messages (out): c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a
Messages (in):  c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a
Transactions:   1

=== Transaction 0 ===
Kind: oasis
Hash: 2e2b5c517208f780cde67a06c6c2837d3896d37188d004ebcc81c5c70b6b0fa9
Signer(s):
  1. 1CSsKQujFkB3X+8ch/+umC7+uNL/4sSzPWJfbAHxlG0=
     (signature: /ggcT9IkAsnSzE+oaWHEMrv4yUTiDwKVckyrd5KG7ygQ8KJ/JtIMZrkAcT1DtZ/kuHEQAHYvhEdlsEjXof8ZgA==)
Content:
  Format: plain
  Method: accounts.Transfer
  Body:
    To: test_ledger_secp256k1 (oasis1qrmw4rhvp8ksj3yx6p2ftnkz864muc3re5jlgall)
    Amount: 0.9 TEST
  Authorized signer(s):
    1. 1CSsKQujFkB3X+8ch/+umC7+uNL/4sSzPWJfbAHxlG0= (sr25519)
       Nonce: 0
  Fee:
    Amount: 0.000231 TEST
    Gas limit: 2310
    (gas price: 0.0000001 TEST per gas unit)

=== Result of transaction 0 ===
Status: ok
Data:
panic: reflect: call of reflect.Value.Interface on zero Value

goroutine 1 [running]:
reflect.valueInterface({0x0?, 0x0?, 0x1?}, 0x0?)
        /home/oa/go/src/reflect/value.go:1485 +0x10e
reflect.Value.Interface(...)
        /home/oa/go/src/reflect/value.go:1480
github.com/oasisprotocol/cli/cmd/paratime.convertPrettyStruct({0x0?, 0x0?})
        /home/oa/cli/cmd/paratime/show.go:315 +0x27f
github.com/oasisprotocol/cli/cmd/paratime.prettyPrintStruct({0x10a1551, 0x2}, {0x10a44bb, 0x6}, {0xc0002cf3c6, 0x1, 0x1}, {0x0?, 0x0?})
        /home/oa/cli/cmd/paratime/show.go:326 +0x68
github.com/oasisprotocol/cli/cmd/paratime.prettyPrintCBOR({0x10a1551, 0x2}, {0x10a44bb, 0x6}, {0xc0002cf3c6, 0x1, 0x1})
        /home/oa/cli/cmd/paratime/show.go:234 +0x125
github.com/oasisprotocol/cli/cmd/paratime.glob..func6(0x1af75c0?, {0xc00058e920, 0x2, 0x2?})
        /home/oa/cli/cmd/paratime/show.go:199 +0x152a
github.com/spf13/cobra.(*Command).execute(0x1af75c0, {0xc00058e8e0, 0x2, 0x2})
        /home/oa/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0x1aee320)
        /home/oa/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /home/oa/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/oasisprotocol/cli/cmd.Execute(...)
        /home/oa/cli/cmd/root.go:34
main.main()
        /home/oa/cli/main.go:6 +0x25

Oasis CLI v0.8.0-gitc2cd406 has "panic: assignment to entry in nil map"

Oasis CLI v0.8.0-gitc2cd406 shows next error:

oasis network list
panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/oasisprotocol/cli/config.(*Config).migrateNetworks(0xc00001dc08?)
        github.com/oasisprotocol/cli/config/config.go:240 +0x459
github.com/oasisprotocol/cli/config.(*Config).Migrate(0x1c1b160)
        github.com/oasisprotocol/cli/config/config.go:179 +0x1c
github.com/oasisprotocol/cli/cmd.initConfig()
        github.com/oasisprotocol/cli/cmd/root.go:83 +0x34a
github.com/spf13/cobra.(*Command).preRun(...)
        github.com/spf13/[email protected]/command.go:1017
github.com/spf13/cobra.(*Command).execute(0x1b7cc60, {0x1c7e060, 0x0, 0x0})
        github.com/spf13/[email protected]/command.go:927 +0x5a2
github.com/spf13/cobra.(*Command).ExecuteC(0x1b78a40)
        github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:1039
github.com/oasisprotocol/cli/cmd.Execute(...)
        github.com/oasisprotocol/cli/cmd/root.go:35
main.main()
        github.com/oasisprotocol/cli/main.go:6 +0x1b

v0.7.1-gitbcbf421 on the same system works fine.

Generate wallet with desired suffix by randomizing mnemonics

Add --suffix <some_literal> parameter to wallet create command which randomizes mnemonics until the desired some_literal end of the address occurs. This could work both for Oasis native addresses as well as the Ethereum hex-encoded ones. My educated guess would say it should be possible to generate around 5 characters-long desired suffix on an average Core 7 CPU.

Support ethereum public key in `oasis account from-public-key`

Using test:alice and test:dave public keys:

$ oasis acc from-public-key NcPzNW3YU2T+ugNUtUWtoQnRvbOL9dYSaBfbjHLP1pE=
oasis1qrec770vrek0a9a5lcrv0zvt22504k68svq7kzve
$ oasis acc from-public-key AwF6GNjbybMzhi3XRj5R1oTiMMkO1nAwB7NZAlH1X4BE
Error: signature: malformed public key

Support the Ethereum public key too as

ethereum public key โ†’ ethereum address โ†’ oasis native address

examples: Make examples run in parallel

The make examples target takes quite some time and it will take even more in the future. Fix the Makefile rule so that -j flag will work. scripts/gen_example.sh already supports parallelism, but steps inside the same scenario need to be run sequentially. All scenarios shall be run in parallel, but all steps inside each of it sequentially. Some refactoring can also be done (e.g. examples/network.01.in ... examples/network.07.in could be moved into examples/network/01.in along with its config file and any other assets).

CLI: add autocomplete for arguments

Would be useful to add autocomplete for arguments such as wallet names, account names, paratime names, network names to the oasis-sdk CLI.

Offline signing: Store public keys in address book

Currently, there is no way to prepare an unsigned transaction using CLI without having the signer's private key. You can only store and use the private key from your wallet and in the address book, only addresses are stored.

I suggest the following: When adding an entry to the address book, one accepted format could also be a public key. In this case the address would be derived from the public key so it is consistent with other address book entries, but the public key would also be stored along. Then, to generate an unsigned transaction with that public key, --account <some_address_book_entry_pubkey> can be passed.

Alternatively, we could support importing accounts with public keys as accounts instead of address book entries. But this would break the current behavior of the wallet (accounts which you can sign tx with) and address book (accounts which you cannot sign txes with).

Improve oasis wallet show and export outputs

Print two more things when calling show and export:

  1. wallet kind (file, ledger), algorithm and number (secp256k1-raw, ed25519-adr8:0, secp256k1-bip44:2) - similar to KIND column in wallet list
  2. for mnemonic accounts, print the derived private key in Base64/Hex format

Prevent consensus transfers to eth addresses

Things like

oasis accounts transfer 10 0xDce075E1C39b1ae0b75D554558b6451A226ffe10 --no-paratime
oasis accounts withdraw 10 0xDce075E1C39b1ae0b75D554558b6451A226ffe10

should be prevented (behind --force flag?). Ethereum address on consensus layer is always unspendable.

The check already works for local ethereum addresses in addressbook and secp256k1 wallets. But if you enter the eth address directly, it will just silently be converted into native address.

Order gas costs

oasis network show gas-costs returns key-values in non-deterministic order which is annoying for running the examples, for example:

Gas costs for network mainnet:
  - reclaim_escrow:            1000
  - amend_commission_schedule: 1000
  - burn:                      1000
  - allow:                     1000
  - transfer:                  1000
  - withdraw:                  1000
  - add_escrow:                1000
Gas costs for network mainnet:
  - add_escrow:                1000
  - amend_commission_schedule: 1000
  - burn:                      1000
  - allow:                     1000
  - transfer:                  1000
  - withdraw:                  1000
  - reclaim_escrow:            1000

Sort it alphabetically or so.

Wrong warning for consensus transfer txes

Running the following

oasis account transfer 1.0 test:bob --account test:alice --network testnet  --no-paratime

the safety check complains about the invalid recepient:

Error: signer for address '0x0000000000000000000000000000000000000000' will not be able to sign transactions on consensus layer
Use --force to ignore this check

This is a perfectly valid transaction though.

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.