Coder Social home page Coder Social logo

cardano-byron-cli's Introduction

Deprecated Note:

⚠️ This project is deprecated, and only supports the first version of cardano (Byron). do not use anymore, it is here for historical purpose.

cardano-cli

The Cardano command line interface provides the following features:

  • powerful blockchain manager: with download, explore, verify, and analyze functions
  • ability to manage multiple wallets: Daedalus', Icarus' or custom wallets
  • flexible transaction build engine

This command line interface is built upon the Rust Cardano SDK.

Warning

  • The software is currently still in alpha phase, please do not use for any other purpose than debugging and testing, until stable releases are available.
  • While most of the operations in the CLI is in a reading state, and are thus relatively safe even in the presence of bugs, do take special note that transaction send will permanently change your state.
  • It ia advisable to trial testnet operations (depending on testnet availability), prior to completing mainnet operations.
  • If you think something is suspicious, it may very well be the case. Check the documentation, or ask for help.
  • Do not share your wallet mnemonics, passwords, cryptographic material, or pending signatures.

Installation guide

While it is recommended to wait for official releases, it is also possible to build the executable yourself by following these steps:

  1. install rust toolchain;
  2. clone the project repository (with the dependencies)
    git clone https://github.com/input-output-hk/cardano-cli.git --recursive
  3. build and install the binary:
    cd cardano-cli
    cargo install
  4. enjoy

Usage

Quick start

$ cardano-cli blockchain new mainnet
$ cardano-cli blockchain pull mainnet
$ cardano-cli wallet create "My Wallet"
$ cardano-cli wallet attach "My Wallet" mainnet
$ cardano-cli wallet sync   "My Wallet"
$ cardano-cli wallet status "My Wallet"

Complete documentation

Command line documentation

Supported platforms

Target test
aarch64-unknown-linux-gnu
arm-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
i686-unknown-linux-gnu
i686-unknown-linux-musl
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
i686-apple-darwin
x86_64-apple-darwin
x86_64-apple-darwin
i686-unknown-freebsd
x86_64-unknown-freebsd

Supported compiler versions

Rust test
stable
beta
nightly

We aim to support compiler versions as far as version 1.30. However, this is not a contract. Support of older compiler versions may be dropped in the future as we see fit.

License

This project is licensed under either of the following licenses:

Please choose your appropriate license.

cardano-byron-cli's People

Contributors

amias-iohk avatar clacke avatar drozdziak1 avatar edolstra avatar gazhayes avatar mzabaluev avatar nahern avatar nicolasdp avatar oldcryptogeek avatar qnikst avatar rooooooooob avatar vincenthz avatar

Stargazers

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

Watchers

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

cardano-byron-cli's Issues

Offline Transactions

Using Web3 for Ethereum at the command line it is possible to create and send offline transactions from an airgapped computer without syncing to the blockchain.

This video shows how to create the offline transaction on an airgapped device using the CLI:

This video shows how to send the offline transaction to the blockchain without needing to sync up or even have a copy of the blockchain.

This video shows an airgapped device created for making offline transactions.

I need this level of security before I can seriously invest in Cardano.
Can I create and send offline transactions from an airgapped device using the Cardano-CLI?
Thanks, John

verbiage

~/cardano-cli/target/debug$ ./cardano-cli wallet detach clean
Wallet successfully attached to blockchain.

builds on Appveyor are not working

Description
Builds for cardano-cli have been failing on appveyor for several months.

Data
a build where this failed
https://ci.appveyor.com/project/vincenthz/cardano-cli/builds/20287440

another build with the session
https://ci.appveyor.com/project/vincenthz/cardano-cli/builds/18736307/job/s4m92wofd0hhkrf7

history of builds , only merges pass
https://ci.appveyor.com/project/vincenthz/cardano-cli/history

Suggestions
looks like the submodules might not be updated

[FEATURE REQUEST] Add Quality of Life Commands

This is just some suggestion but i think it will really help everyone that will be using this tool

  • wallet address balance 0 0 "My Wallet" - this command will output the wallet balance of the speific account / wallet index.

  • transaction currentFee - returns the current (minimum?) fee in LOVELACE to send a transaction

blockchain new command of an existing blockchain name should fail

Currently it does not but it should.

$ cardano-cli blockchain new blockchain --template=mainnet
$ cardano-cli blockchain new blockchain --template=testnet
local blockchain 'blockchain' created
$ echo $?
0

we should have an error instead:

$ cardano-cli blockchain new blockchain --template=mainnet
$ cardano-cli blockchain new blockchain --template=testnet
local blockchain 'blockchain' already exist
$ echo $?
1

feature request: make blockchain status parseable

The output from cardana-cli blockchain status mainnet could be YAML parseable with little modifications and still remain human readable.

for example this is the current output of blockchain status :

Blockchain:
   * last forward:    2018-09-25 (10h 50m 54s ago)
   * local tip hash:  deb33c62c7f5c49c13157376eab21da2dfaaf52f7ba5b130a062ecbb2b1f268e
   * local tip date:  73.8570
Peers:
 1. iohk-hosts (native: relays.cardano-mainnet.iohk.io:3000)
     * last fetch:      2018-09-25 (10h 50m 54s ago)
     * local tip hash:  deb33c62c7f5c49c13157376eab21da2dfaaf52f7ba5b130a062ecbb2b1f268e
     * local tip date:  73.8570
 2. hermes (http: http://hermes.dev.iohkdev.io/mainnet)
     * last fetch:      2018-09-24 (2days 3h 52m 42s ago)
     * local tip hash:  89d9b5a5b8ddc8d7e5a6795e9774d97faf1efea59b2caf7eaf9f8c5b32059df4
     * local tip date:  0.GENESIS

and this is how it would look being YAML :

--- # three dashes to be able to join documents
Blockchain:
   last_forward:    2018-09-25 (10h 50m 54s ago) #eliminated whitespace from keys
   local_tip_hash:  deb33c62c7f5c49c13157376eab21da2dfaaf52f7ba5b130a062ecbb2b1f268e
   local_tip_date:  73.8570
Peers:  #peers becomes a list, that you can later go over with a loop
  - peer: iohk-hosts
    protocol: native
    uri: relays.cardano-mainnet.iohk.io:3000
    last_fetch:      2018-09-25 (10h 50m 54s ago)
    local_tip_hash:  deb33c62c7f5c49c13157376eab21da2dfaaf52f7ba5b130a062ecbb2b1f268e
    local_tip_date:  73.8570

  - peer: hermes
    protocol: http
    uri: http://hermes.dev.iohkdev.io/mainnet
    last_fetch:      2018-09-24 (2days 3h 52m 42s ago)
    local_tip_hash:  89d9b5a5b8ddc8d7e5a6795e9774d97faf1efea59b2caf7eaf9f8c5b32059df4
    local_tip_date:  0.GENESIS

the yaml version was validated with: https://codebeautify.org/yaml-to-json-xml-csv#

Demo files for your reference:
blockchain_status_improved.yml.txt
blockchain_status.txt

command line tests

the idea is to have a scenario model based:

  1. user derfines the expected inputs or state
  2. we run the command line
  3. we see what we have received (files created/deleted, diff as expected, output of the command line is correct...)

deprecates the issue in the old repository input-output-hk/rust-byron-cardano#173

Audit use of unsafe

There are methods declared as unsafe without real language reason for it, e.g. Wallet::destroy. The intent was to designate unsafe operations from the UX standpoint. However, misuse of the language feature allows real unsafe code inside the functions to be used without "speed bumps".

A proper fix would be to create an API for designating prompt-guarded actions. This would also help centralize the uses of std::process::exit(0), currently buried inside command handlers.

Cannot find inputs within the local UTxOs

on C: import the file, sent it to network

when I use command

"cardano-cli transaction add-input 25Ab2p01affa1bc8f35efeb7eea54e2ac1113f80d8628502c0f5a87f3295634f6df53f 2 "

01affa1bc8f35efeb7eea54e2ac1113f80d8628502c0f5a87f3295634f6df53f 2 is one address's utxo but not exist in I machine.

Errror:Cannot find inputs within the local UTxOs

so it is mean when create a transaction. input addr must in local machine ????

I just want use one addr utxo then create transaction. then send transaction to another machine which not connect internet to sign it .

Sign a text (proof you own the address)

I'm developing software for a Cardano pool, and I need some way to identify which account contributed to the pool.

Therefore having a possibility to sign some text (proof you own the address) would be very helpful. Similar to feature Bitcoin has.

Cheers

wallet sync command not working

Hi guys

I try to issue these commands

cardano-cli blockchain pull mainnet

image

and then I sync my wallet to the blockchain

cardano-cli wallet sync "My Wallet"

image

but it seems its not writing the updates to the wallet data file
image

its always stuck to the first point when i attached the wallet

but this is fixed when i detach / attach but then i get the error again, so it takes a very long time to get updates to the wallet by doing "detach/attach"

but maybe I'm doing something wrong.

OS: Windows Sub-System for Linux, Ubuntu 18

Thank you!

Generate Keys by Flipping Coin or By Method Known is Truly Random And Unhackable

Hi All,
Crazy as it may sound - I generate my private keys on the Ethereum block chain by flipping a coin.

This way even if someone were to place malware into my client which will produce a predictable private key my funds can not be stolen by this attack.

Before I can seriously invest in Cardano, I must be able to use my own private key which has been produced by some manner that is known to be truly random and unhackable.

Is it possible using the Cardano-CLI to create a wallet from a private key which has been generated by some offline method such as flipping a coin?

Thanks, John

`wallet detach` fails

Steps to reproduce:

Expected behaviour

  • wallet successfully detaches

Actual behaviour

Error with the wallet log
  |-> I/O Error
  |-> No such file or directory (os error 2)

`blockchain list` fails until `blockchain new` is used

This is a minor quirk likely to catch new users who follow USAGE.md.

$ RUST_BACKTRACE=1 cardano-cli blockchain list
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:475
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::result::unwrap_failed
   9: cardano_cli::blockchain::commands::list
  10: cardano_cli::main
  11: std::rt::lang_start::{{closure}}
  12: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  13: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  14: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  15: main
  16: __libc_start_main
  17: _start
             at ../sysdeps/x86_64/start.S:120

$ cardano-cli blockchain new mainnet-copy-1
local blockchain `mainnet-copy-1' created.

$ RUST_BACKTRACE=1 cardano-cli blockchain list
mainnet-copy-1

sign transaction with an offline wallet

currently it is not possible to sign the transaction with a wallet that does not have access to the network as it needs to know the unspent output (and the associated derivation path).

This is a follow up on issue discussed in #42

blockchain log causes a crash

Platform: Ubuntu 18.10 Linux i686
Version: https://github.com/input-output-hk/cardano-cli/releases/tag/v1.0.0-alpha3

Expected Behaviour: cardano blockchain log should be printed and the program should exit.
Actual Behaviour: cardano blockchain log is printed by program crashes.

Output:

RUST_BACKTRACE=1 ./cardano-cli blockchain log mainnet

< snipped lots of hashes >
65904a89e6d0e5f881513d1736945e051b76f095eca138ee869d543d
af2800c124e599d6dec188a75f8bfde397ebb778163a18240371f2d1

thread 'main' panicked at 'block location', libcore/option.rs:1000:5>
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::panicking::default_hook::{{closure}}
at libstd/sys_common/backtrace.rs:71
2: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:227
at libstd/panicking.rs:477
3: std::panicking::continue_panic_fmt
at libstd/panicking.rs:391
4: rust_begin_unwind
at libstd/panicking.rs:326
5: core::panicking::panic_fmt
at libcore/panicking.rs:77
6: core::option::expect_failed
at libcore/option.rs:1000
7: <cardano_storage::iter::reverse::ReverseIter<'a> as core::iter::iterator::Iterator>::next
8: cardano_cli::main
9: std::rt::lang_start::{{closure}}
10: main
11: __libc_start_main
12:

Notes:

  • From a UX point of view It might help to have timestamps or some kind of sequence data with the hashes
  • The blockchain seemed to be fully synced

blockchain remote-fetch and pull crash on locally nonexistent blockchain

This command fails when the blockchain is not initialized with new or has been destroyed:

cardano-cli blockchain remote-fetch mainnet hermes

The backtrace excerpt:

   9: <core::option::Option<T>>::unwrap
             at libcore/macros.rs:20
  10: cardano_cli::blockchain::Blockchain::load
             at src/blockchain/mod.rs:97
  11: cardano_cli::blockchain::commands::remote_fetch
             at src/blockchain/commands.rs:165
  12: cardano_cli::subcommand_blockchain
             at src/main.rs:300
  13: cardano_cli::main
             at src/main.rs:77

Blockchain list

Main blockchain NodeM7 isn't showing when calling 'list':

RUST_BACKTRACE=1 /cardano-cli blockchain list
testnet-1
thread 'main' panicked at 'called Option::unwrap() on a None value', libcore/option.rs:345:21
stack backtrace:
0: std::sys::unix::backtrace::tracing:: imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:475
5: std::panicking::continue_panic_fmt
at libstd/panicking.rs:390
6: rust_begin_unwind
at libstd/panicking.rs:325
7: core::panicking::panic_fmt
at libcore/panicking.rs:77
8: core::panicking::panic
at libcore/panicking.rs:52
9: cardano_cli::blockchain::Blockchain::load
10: cardano_cli::blockchain::commands::list
11: cardano_cli::main
12: std::rt::lang_start::{{closure}}
13: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
14: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
15: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:392
at libstd/rt.rs:58
16: main
17: __libc_start_main
18: _start
at ../sysdeps/x86_64/start.S:120

Should of have a 'NodeM7' blockchain copy showing up but nothing.

  • When I use 'status' all the info is shown
  • The wallet attached to the NodeM7 blockchain is present with everything
  • Using 'log' list all the blocks of NodeM7 blockchain
    Then I tried this:
  • /cardano-cli blockchain new nodeM7: local blockchain `nodeM7' created.
  • /cardano-cli blockchain list
    testnet-1
    thread 'main' panicked at 'called Option::unwrap() on a None value', libcore/option.rs:345:21
    I did play around with 'remote-add' and 'remote-rm' a couple of times for peer connection purposes.

Daedalus wallet recovery: address payload of infinite size bug make cardano-cli crash

Running cardano-cli wallet sync mywallet

syncing wallet from 82.13 to 85.2368
⠙ [00:00:00] [###>------------------------------------] 6064/67155 (3s)
memory allocation of 18446744073709551613 bytes failed

Looks like a bit too much memory.

* wallet model RandomIndex2Levels
 * derivation scheme V1
 * synced to block  9eab5304cc7a5d8106606f99966b14f458e99798d38e547da37e30740a7936f2 (82.13)

Respect use case where multiple wallets and one is not on blockchain

Operation "transaction add-inputs" fails with "Wallet is not attached to any blockchain" with multiple wallets if wallet "previous" to wallet containing the UTxO is not attached to blockchain.

./target/debug/cardano-cli transaction add-input 3hrnAF 60540befd34211b88888dd216410ec8772d25645ad7826e69cb20662411e8a2a 1
Wallet is not attached to any blockchain

It is correct that UTxO inputs can come from different wallets, but should skip non-attached wallets.

Recreate: Make a wallet AAA, do not attach. Make a wallet BBB attach mainnet. Send coin to BBB. Create new transaction on mainnet, attempt to add-input from BBB. Will exit because it looks at AAA first, sees it is not attached and quits.

The function is load_attached_blockchain in /wallet/utils.rs which will process::exit if called with unattached wallet. Called by create_wallet_state_from_logs, which is called from multiple places. Where called for a wallet /wallet/commands.rs it is ok to exit I think because it is only called for one wallet. However, function is called from places in /transaction/commands.rs for ALL wallets, in this case should not exit, but move on to next wallet.

Eg. add-inputs, function find_input_in_all_utxos (probably same issue with sign() func, maybe others). So for add-inputs could fix in find_input_in_all_utxos with a continue maybe.

    for (_, wallet) in Wallets::load(root_dir.clone()).unwrap() {

        let blockchainname = wallet.config.attached_blockchain().unwrap();
        if !blockchainname.is_some() {
            // wallet is not attached to a blockchain
            continue;
        } 

sync is creating duplicate UTxO in the LOG file

This issue puts the wallet into a bad state. Once in this bad state the wallet will report the below error for many functions:

./target/debug/cardano-cli wallet status my_magic_wallet
Wallet clean on blockchain mainnet
 * wallet model BIP44
 * derivation scheme V2
ERROR 2018-11-06T02:06:49Z: cardano_cli::wallet::state::state: This UTxO was already in the UTxOs collection `Ae2tdPwUPEZZZZZinWnudbNtHQddCyc6bCwLVoQx4GfH1NvwztGRpRkewTe (0.0.0) received 1.000000Ada in transaction id `60540befd34211b88888dd216410ec8772d25645ad7826e69cb20662411e8a2a.1''
thread 'main' panicked at 'The Wallet LOG file seems corrupted', src/wallet/state/state.rs:32:25

The bad state is that the last UTxO is stored twice in the LOG file. The bad state comes about by performing a second sync operation on the wallet. To recreate, recover a wallet that has a UTxO, sync the wallet (you can see the state is correct by doing strings LOG which will show the UTxO), then sync again (again strings LOG will show the last UTxO is now stored twice).

./target/debug/cardano-cli wallet sync my_magic_wallet
Enter the wallet password.
wallet password: : 
syncing wallet from 0.GENESIS to 81.13276
  [00:28:06] [########################################] 1762876/1762876 (0s)
ubuntu@ip-172-31-21-95:~/cardano-cli$ ./target/debug/cardano-cli wallet sync clean
Enter the wallet password.
wallet password: : 
syncing wallet from 81.11021 to 81.13276
  [00:00:05] [########################################] 1255/1255 (0s)
ubuntu@ip-172-31-21-95:~/cardano-cli$ ./target/debug/cardano-cli wallet status my_magic_wallet
Wallet clean on blockchain mainnet
 * wallet model BIP44
 * derivation scheme V2
ERROR 2018-11-06T02:06:49Z: cardano_cli::wallet::state::state: This UTxO was already in the UTxOs collection `Ae2tdPwUPEZZZZZinWnudbNtHQddCyc6bCwLVoQx4GfH1NvwztGRpRkewTe (0.0.0) received 1.000000Ada in transaction id `60540befd34211b88888dd216410ec8772d25645ad7826e69cb20662411e8a2a.1''
thread 'main' panicked at 'The Wallet LOG file seems corrupted', src/wallet/state/state.rs:32:25

It looks like the second sync, instead of starting where the last sync finished (81.13276) instead starts from the block time of the last UTxO in the log (81.11021), I am guessing this causes that UTxO to be picked up again, or maybe it is something about the reading/writing of the LOG. Not sure.

More here:
https://forum.cardano.org/t/cardano-cli/16654/19

cargo install error

warning: value assigned to out_total_min is never read
--> cardano-deps/cardano/src/txbuild.rs:149:21
|
149 | let mut out_total_min = Coin::zero();
| ^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_assignments)] on by default

Compiling tokio-core v0.1.17
warning: unused std::result::Result which must be used
--> cardano-deps/cardano/src/block/verify_chain.rs:282:9
|
282 | mem::replace(res, err);
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_must_use)] on by default

Compiling tokio-proto v0.1.1
Compiling hyper v0.11.27
Compiling protocol v0.1.0 (file:///home/ec2-user/cardano-cli/cardano-deps/protocol)
Compiling cardano-storage v0.1.0 (file:///home/ec2-user/cardano-cli/cardano-deps/storage)
Compiling exe-common v0.1.0 (file:///home/ec2-user/cardano-cli/cardano-deps/exe-common)
error[E0658]: use of unstable library feature 'assoc_unix_epoch' (see issue #49502)
--> cardano-deps/exe-common/src/parse_genesis_data.rs:36:9
|
36 | SystemTime::UNIX_EPOCH + unix_displacement
| ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try rustc --explain E0658.
error: failed to compile cardano-cli v1.0.0-alpha2 (file:///home/ec2-user/cardano-cli), intermediate artifacts can be found at /home/ec2-user/cardano-cli/target

Caused by:
Could not compile exe-common.

To learn more, run the command again with --verbose.

blockchain cat generates invalid YAML

When running:

LASTBLOCK=deb33c62c7f5c49c13157376eab21da2dfaaf52f7ba5b130a062ecbb2b1f268e
cardano-cli blockchain cat mainnet $LASTBLOCK > example_block.yml

In example_bolck.yml there will be several issues.
Here is the annotated version:

# the document should start with: --- this will make it joining files easier
header:
    # removed for brevity
body:
            tx: # wrong level of indentation tx should be a child of body and a parent of inputs,outputs and witnesses. Also it should be a list since a slot can have multiple txs 
            inputs:
                e1d1236d63033bd92e0fe3c1cf4fcf8b9d0624b4165f906ff42336cd926baf51@0 #This element should be a list since there can be more than 1 input

            outputs: #Outputs should be a list, and a dicionary to be able to separate address from amount
                DdzFFzCqrhtBe58URbj5XirGeiN4xnubfT4TUFuikp3zZC9m8HteTvdmskeknvYvaV3DsSTaJbGYjvHE3F9YkkjPNjqCgVzXLzyFKg7H 3516485.071535
                DdzFFzCqrhsuD9P4nbdTYFCjo5Lrc7fNh5Qdc76eR3SbKtrL2pnwM4qzQhTa7jgfC3Emg6aGmWfq7Mta1vTT55VQkYoi79jAbN6F71WD 10000.000000


        witnesses: # witnessess has the wrong level of indentation it's a child of tx:  and maybe should be a list
            ec177ab1a6ceb8a982d1f83b964e4ccfefe00bd677dc6fa13e447320f90e450fa2ed53ab66357e9167ff9bf945bb5970eb1bbde36f1dcc3f2df35c564462d3c6 27dd767adda7bf99c33c87f849b3f9b720a98f0821b95e524169cc68085feae8271c48d6ea25ec19a85551d32f926567b25a758b6e1d4d400ac34fcb13e0cc09 (Public Key)

The following files show the errors and a improved version.
example_block_improved.yml.txt
example_block.yml.txt

the improved version was validated with: https://codebeautify.org/yaml-to-json-xml-csv#

debug block check

display from raw input (hexadecimal, base64) and validate proofs. related to #47 #46

$ cardano-cli blockchain cat <chain> --output-raw 123456789ABCD | cardano-cli debug block-cat ...
...

wallet detach

Wrong success message after using wallet detach.

  • cardano-cli wallet detach "wallet-name"
    Message: Wallet successfully attached to blockchain.

`blockchain query` command

add a way to query the blockchain, the idea is to bootrstap the query mechanism with something rather simple and to build up from there.

The most needed type of queries are lookup for addresses and for transaction ids.

An example of the command would be to ask for expecific addresses and to return the list of block hash where we found occurrences of the useful values.

> cardano-cli blockchain query mainnet --address="Aa23456789abcdef..." --or --address="Aa210..."
abcedf...
0129345...

Storage::init issue.

Expected Behavior

When I mistype the name in any blockchain related command that requires blockchain name, that command should return with an error message that informs that the specified blockchain does not exist.

Current Behavior

It returns with a panic and would not allow to list the blockchains correctly anymore.

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21

Failure Information (for bugs)

The issue is related to the cardano-cli's Blockchain::load function, that always calls the rust-cardano's Storage::init.
That init function always creates the top level blockchain directories /w its subdirectories (blob, epoch pack etc.) but does not create the config.yml, that causes issues in cardano-cli.

The optimal solution would be to have a new function in rust-cardano's Storage struct (e.g. load), which similar to the Stroage::init's but does not have the directory creation part of it.

Steps to Reproduce

Provide a non-existing blockchain name for any blockchain related command that requires a name.
For example:

bug$ ./cardano-cli blockchain list
staging
testnet
bug$ ./cardano-cli blockchain status testnetX
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
bug$ ./cardano-cli blockchain list
staging
testnet
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Workaround

If the wrong blockchain name is known then just simply create a new blockchain /w the misspelt name and then delete it, see details below:

bug$ ./cardano-cli blockchain list
staging
testnet
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
bug$ ./cardano-cli blockchain new testnetX
local blockchain `testnetX' created.
bug$ ./cardano-cli blockchain list
staging
testnet
testnetX
bug$ ./cardano-cli blockchain destroy testnetX
You are about to destroy the local blockchain testnetX.
This means that all the blocks downloaded will be deleted and that the attached
wallets won't be able to interact with this blockchain.
Are you sure? [y/N] y
blockchain successfully destroyed
bug$ ./cardano-cli blockchain list
staging
testnet

If the name is not known then delete the stalled directory from the OS related directory:

  • MacOS: /Users/<username>/Library/Application\ Support/cardano-cli/blockhains/
  • Linux: the XDG_DATA_HOME i.e. ~/.local/shares/cardano-cli/blockchain/

UPDATE: The #285 PR is created to fix this issue.

Should specify install visual studio 2017 and c++ during cargo install

Hello. Once again i wanted to play with cardano-cli on WINDOWS 10 (this time)
with :

  • cargo 1.33.0 (f099fe94b 2019-02-12)
  • rustc 1.33.0 (2aa4c46cf 2019-02-28)

I had the following FATAL error (stopping all compilations) at first

please ensure that VS 2013, VS 2015 or VS 2017 was installed with the Visual C++ option

Maybe somewhere in the process install of the README could be mentionned the requirement of these softwares

Github solution

I had no problem with installing the 2017 version + the WINDOWS UCRT SDK extension

revspec not found for `dialoguer`

Problem

$ cargo install
warning: Using `cargo install` to install the binaries for the project in current working directory is deprecated, use `cargo install --path .` instead. Use `cargo build` if you want to simply build the package.
  Installing cardano-cli v1.0.0-alpha3 (/home/jake/src/cardano-cli)
    Updating crates.io index
    Updating git repository `https://github.com/primetype/dialoguer`                                                                                                                                                   
error: failed to compile `cardano-cli v1.0.0-alpha3 (/home/jake/src/cardano-cli)`, intermediate artifacts can be found at `/home/jake/src/cardano-cli/target`                                                          

Caused by:
  failed to load source for a dependency on `dialoguer`

Caused by:
  Unable to update https://github.com/primetype/dialoguer?rev=bcd067b454bfc03b2a3dc5d4be314c9852265fac#bcd067b4

Caused by:
  revspec 'bcd067b454bfc03b2a3dc5d4be314c9852265fac' not found; class=Reference (4); code=NotFound (-3)

Context

Initialized Rust using rustup default stable.

$ git rev-parse HEAD
fd9cadd0d46487665a5cdb18fd04a67eecd46178

$ rustup --version
rustup 1.11.0 ( )

$ cargo --version
cargo 1.30.0 (a1a4ad372 2018-11-02)

$ rustc --version
rustc 1.30.1 (1433507eb 2018-11-07)

Improve error handling for all subcommands

There is usage of std::process::exit(1) and panicky code in some subcommand handlers, e.g. wallet. These should be converted to the good standard set in transaction.

Tasks

  • #59 Make create_wallet_state_from_logs non-panicky
  • Convert subcommand modules other than transaction and wallet to error-returning style. To be broken into per-module issues.

wallet recovery daedalus debug tools

  • debug hdkey: take daedalus mnemnonic and generate a hdpayload key from the public key (this can potentially be shared for recovery debugging purposed)
  • blockchain query --hdkey-match <hdkey>: take the hdpayload key and return all payload matching

Several warnings during cargo install

Hello. I wanted to play a little with the cardano rust cli on a macOS mojave 10.14.3 system
but had the following warnings after (or during?) Compiling cardano-cli v1.0.1 (/Users/art/Documents/cardano-cli)
using :

  • cargo 1.33.0 (f099fe94b 2019-02-12)
  • rustc 1.33.0 (2aa4c46cf 2019-02-28)

(surely not something important but wanted to warn in case of...)

warning: use of deprecated item 'cardano_storage::iter::Iter'
   --> src/blockchain/mod.rs:256:26
    |
256 |     ) -> storage::Result<storage::iter::Iter<'a>> {
    |                          ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(deprecated)] on by default

warning: use of deprecated item 'cardano_storage::iter::Iter'
   --> src/blockchain/mod.rs:257:9
    |
257 |         storage::iter::Iter::new(&self.storage, from, to)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::Iter'
   --> src/blockchain/mod.rs:263:26
    |
263 |     ) -> storage::Result<storage::iter::Iter<'a>> {
    |                          ^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::Iter'
   --> src/blockchain/commands.rs:569:16
    |
569 |     for res in storage::iter::Iter::new(&blockchain.storage, from, to)? {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::Iter'
 --> src/wallet/state/iter.rs:8:21
  |
8 |     block_iterator: storage::iter::Iter<'a>,
  |                     ^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::Iter'
  --> src/wallet/state/iter.rs:49:55
   |
49 |     pub fn new(progress: ProgressBar, block_iterator: storage::iter::Iter<'a>) -> Self {
   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting
   --> src/utils/term/mod.rs:174:37
    |
174 |         while let Some(err) = error.cause() {
    |                                     ^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/mod.rs:234:36
    |
234 |                 let header = block.get_header();
    |                                    ^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::Iter::new'
   --> src/blockchain/mod.rs:257:9
    |
257 |         storage::iter::Iter::new(&self.storage, from, to)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::ReverseIter::from': use Storage::reverse_from
   --> src/blockchain/commands.rs:253:18
    |
253 |     for block in storage::iter::ReverseIter::from(&blockchain.storage, from)? {
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/commands.rs:467:24
    |
467 |         let hash = blk.get_header().compute_hash();
    |                        ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/commands.rs:470:24
    |
470 |                 if blk.get_header().get_blockdate().is_boundary() {
    |                        ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/commands.rs:484:25
    |
484 |                     blk.get_header().get_blockdate()
    |                         ^^^^^^^^^^

warning: use of deprecated item 'cardano_storage::iter::Iter::new'
   --> src/blockchain/commands.rs:569:16
    |
569 |     for res in storage::iter::Iter::new(&blockchain.storage, from, to)? {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/commands.rs:571:26
    |
571 |         let hash = block.get_header().compute_hash();
    |                          ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/peer.rs:175:33
    |
175 |                 let hdr = block.get_header();
    |                                 ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/peer.rs:198:38
    |
198 |                     let date = block.get_header().get_blockdate();
    |                                      ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/peer.rs:356:36
    |
356 |                 let header = block.get_header();
    |                                    ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
   --> src/blockchain/peer.rs:425:29
    |
425 |             let hdr = block.get_header();
    |                             ^^^^^^^^^^

warning: use of deprecated item 'cardano::block::Block::get_header': use header() instead
  --> src/wallet/state/iter.rs:16:29
   |
16 |             let hdr = block.get_header();
   |                             ^^^^^^^^^^

warning: use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting
  --> src/wallet/state/lookup/error.rs:28:57
   |
28 |             AddressLookupError::RandomIndex(err) => err.cause(),
   |                                                         ^^^^^

warning: use of deprecated item 'std::error::Error::cause': replaced by Error::source, which can support downcasting
  --> src/wallet/state/lookup/error.rs:29:61
   |
29 |             AddressLookupError::SequentialBip44(err) => err.cause(),
   |                                                             ^^^^^

warning: use of deprecated item 'cardano::tx::TxInWitness::new': use new_extended_pk method instead
   --> src/wallet/utils.rs:387:17
    |
387 |                 TxInWitness::new(protocol_magic, &*xprv, txid)
    |                 ^^^^^^^^^^^^^^^^

warning: use of deprecated item 'cardano::tx::TxInWitness::new': use new_extended_pk method instead
   --> src/wallet/utils.rs:396:17
    |
396 |                 TxInWitness::new(protocol_magic, &xprv, txid)
    |                 ^^^^^^^^^^^^^^^^

warning: unused variable: `term`
 --> src/utils/prompt/mnemonics.rs:6:30
  |
6 | fn interactive_input_word<D>(term: &mut Term, dic: &D, idx: usize, count: usize) -> String
  |                              ^^^^ help: consider using `_term` instead
  |
  = note: #[warn(unused_variables)] on by default

warning: unused variable: `term`
   --> src/utils/prompt/mnemonics.rs:129:33
    |
129 | pub fn input_mnemonic_phrase<D>(term: &mut Term, dic: &D, size: bip39::Type) -> PromptedMnemonics
    |                                 ^^^^ help: consider using `_term` instead

warning: unused variable: `changes`
  --> src/transaction/commands.rs:76:21
   |
76 |     let (finalized, changes) = staging
   |                     ^^^^^^^ help: consider using `_changes` instead

warning: unused variable: `finalized`
   --> src/transaction/commands.rs:121:10
    |
121 |     let (finalized, changes) = staging
    |          ^^^^^^^^^ help: consider using `_finalized` instead

warning: unused variable: `changes`
   --> src/transaction/commands.rs:121:21
    |
121 |     let (finalized, changes) = staging
    |                     ^^^^^^^ help: consider using `_changes` instead

warning: unused variable: `changes`
   --> src/transaction/commands.rs:181:19
    |
181 |     let (builder, changes) = staging
    |                   ^^^^^^^ help: consider using `_changes` instead

warning: unused variable: `term`
   --> src/transaction/commands.rs:234:5
    |
234 |     term: &mut Term,
    |     ^^^^ help: consider using `_term` instead

warning: unused variable: `term`
   --> src/transaction/commands.rs:395:5
    |
395 |     term: &mut Term,
    |     ^^^^ help: consider using `_term` instead

warning: static item is never used: `PACKAGE`
 --> src/utils/term/emoji.rs:5:1
  |
5 | pub static PACKAGE: Emoji = Emoji("📦", " ");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default

warning: static item is never used: `WARN`
 --> src/utils/term/emoji.rs:6:1
  |
6 | pub static WARN: Emoji = Emoji("⚠️", " ");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant item is never used: `DEFAULT_TERM_WIDTH`
  --> src/utils/term/mod.rs:20:1
   |
20 | pub const DEFAULT_TERM_WIDTH: usize = 80;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant item is never used: `DEFAULT_TERM_HEIGHT`
  --> src/utils/term/mod.rs:21:1
   |
21 | pub const DEFAULT_TERM_HEIGHT: usize = 24;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `prompt`
  --> src/utils/term/mod.rs:84:5
   |
84 |     pub fn prompt(&mut self, prompt: &str) -> io::Result<String> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: `ForwardHashDoesNotExist`
  --> src/blockchain/error.rs:19:5
   |
19 |     ForwardHashDoesNotExist(HeaderHash),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: `GetBlockDoesNotExist`
  --> src/blockchain/error.rs:21:5
   |
21 |     GetBlockDoesNotExist(HeaderHash),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: `GetInvalidBlock`
  --> src/blockchain/error.rs:22:5
   |
22 |     GetInvalidBlock(HeaderHash),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `load_peer_local_tip`
   --> src/blockchain/peer.rs:325:5
    |
325 |     pub fn load_peer_local_tip(&self) -> HeaderHash {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `operations`
   --> src/transaction/core/staging_transaction.rs:126:5
    |
126 |     pub fn operations(&self) -> &[Operation] {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `is_finalized`
   --> src/transaction/core/staging_transaction.rs:136:5
    |
136 |     pub fn is_finalized(&self) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: `DoubleSpend`
  --> src/transaction/core/transaction.rs:32:5
   |
32 |     DoubleSpend,
   |     ^^^^^^^^^^^

warning: method is never used: `signature`
   --> src/transaction/core/transaction.rs:205:5
    |
205 |     pub fn signature<'a>(&'a self) -> &'a [TxInWitness] {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `lookup_input`
   --> src/transaction/core/transaction.rs:218:5
    |
218 |     pub fn lookup_input(&self, txin: TxoPointer) -> Option<usize> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: variant is never constructed: `CannotReportStatusInvalidTx`
  --> src/transaction/error.rs:27:5
   |
27 |     CannotReportStatusInvalidTx(cardano::txbuild::Error),
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `map`
   --> src/wallet/state/log.rs:194:5
    |
194 | /     pub fn map<F, U>(self, f: F) -> Log<U>
195 | |     where
196 | |         F: FnOnce(A) -> U,
197 | |     {
...   |
202 | |         }
203 | |     }
    | |_____^

warning: field is never used: `log_path`
   --> src/wallet/state/log.rs:241:5
    |
241 |     log_path: PathBuf,
    |     ^^^^^^^^^^^^^^^^^

warning: method is never used: `release_lock`
   --> src/wallet/state/log.rs:253:5
    |
253 |     pub fn release_lock(self) -> LogLock {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `new`
  --> src/wallet/state/lookup/randomindex.rs:20:5
   |
20 | /     pub fn new(
21 | |         generator: rindex::AddressGenerator<hdwallet::XPrv>,
22 | |         network_magic: NetworkMagic,
23 | |     ) -> Self {
...  |
27 | |         }
28 | |     }
   | |_____^

warning: unused `std::result::Result` that must be used
   --> src/utils/term/mod.rs:173:9
    |
173 |         writeln!(&mut self.term, "{}", self.style.error.apply_to(formated));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unused_must_use)] on by default
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

warning: unused `std::result::Result` that must be used
   --> src/utils/term/mod.rs:177:13
    |
177 | /             writeln!(
178 | |                 &mut self.term,
179 | |                 "  |-> {}",
180 | |                 self.style.warning.apply_to(formated)
181 | |             );
    | |______________^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

warning: unused `std::result::Result` that must be used
   --> src/blockchain/commands.rs:572:9
    |
572 |         writeln!(term, "{}", style!(hash));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

warning: unused `std::result::Result` that must be used
   --> src/wallet/commands.rs:452:5
    |
452 |     writeln!(term, "{}", style!(addr));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this `Result` may be an `Err` variant, which should be handled
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Build error "could not find `parse` in `genesisdata`"

I got the next build error from the master version "20310a75386b0d0dc100902f9c87956be199dffe".

rustup update and cargo update haven't resolved this build issue. I can build "rust-cardano" without any issue.

Compiling cardano-cli v1.0.1 (C:\Git\Blockchain\IOHK\cardano-cli)
error[E0433]: failed to resolve: could not find parse in genesisdata
--> src\blockchain\mod.rs:129:41
|
129 | let genesis_data = genesisdata::parse::parse(fs);
| ^^^^^ could not find parse in genesisdata

error[E0433]: failed to resolve: could not find parse in genesisdata
--> src\debug\mod.rs:60:31
|
60 | print!("{}", genesisdata::parse::canonicalize_json(json.as_bytes()));
| ^^^^^ could not find parse in genesisdata

warning: use of deprecated item 'cardano_storage::iter::Iter'
--> src\blockchain\mod.rs:256:26
|
256 | ) -> storage::Result<storage::iter::Iter<'a>> {
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(deprecated)] on by default

image

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.