Giter VIP home page Giter VIP logo

walrus-cli's Introduction

walrus-cli

walrus-cli is a client for walrus. It makes it easy to check your balance, generate addresses, and sign and broadcast transactions using either a "cold" Ledger Nano S hardware wallet or a traditional "hot" wallet.

Setup

You will need a synchronized walrus server. You can specify the address of the server with the -a flag.

If you are using a Nano S, the Sia app must be installed and open when walrus-cli commands are run.

If you want to use walrus-cli as a hot wallet, run walrus-cli seed to generate a new seed, and pass the -hot flag to all future commands. Each command will prompt you to enter your seed. You can bypass these prompts by setting the WALRUS_SEED environment variable.

Generating an Address

Run walrus-cli addr to generate a new address and add it to your walrus server. By default, addr uses the seed index reported by the server's /seedindex endpoint. You can generate a specific address with walrus-cli addr [index].

Creating a Transaction

Use the walrus-cli txn command to construct a transaction. Transactions are specified in comma-sparated address:amount pairs. For example, to send 100 SC to one address and 0.1 SC to another, you would write:

$ export DEST_ADDR_1=2ce86e0f5c4b282b51508a798ab8f1091c1cfcc0ee0feaa840e514f37af8dd2f3078fa83f125
$ export DEST_ADDR_2=62e4b26fd772a25029b92b4f06e87202b97bd9a214ff458154bb96e350fda2991b4afb1ff8ed
$ walrus-cli txn $DEST_ADDR_1:100,$DEST_ADDR_2:0.1 txn.json

walrus-cli will figure out which UTXOs to use, select an appropriate fee, and send any change back to an address you control. If you are using walrus-cli with a narwal server, a donation will also be added: either 1% of the transaction value, or 10 SC, whichever is greater. The resulting transaction will be written to disk as JSON.

Signing a Transaction

Run walrus-cli sign txn.json to sign the transaction stored in txn.json. The details of the transaction will appear on your Nano S screen, and you will be prompted to approve signatures for each input you are spending. Unfortunately, you must scroll through the transaction details for each signature. The signed transaction will be written to txn-signed.json.

Broadcasting a Transaction

Broadcasting a transaction is as simple as walrus-cli broadcast txn-signed.json.

All Together Now

For convenience, you can merge these three steps (creating, signing, broadcasting) into one. Just pass the --sign and --broadcast flags to the txn command (or just --sign if you don't want to broadcast immediately). The transaction will be constructed, signed, and broadcast without ever touching disk. You can also pass the --broadcast flag to the sign command for the same effect.

walrus-cli's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

walrus-cli's Issues

Transaction summary copy changes

Current Language

Transaction summary:

  • 1 input, totalling 100 SC
  • 1 output, totalling 79.98 SC
    (plus a donation of 10 SC to the narwal server
    (plus a change output, sending 17.59 mS back to your wallet)
  • A miner fee of 2.41 mS, which is 10 uS/byte

Suggested Language

Transaction summary:

  • 1 input, totalling 100 SC
  • 1 output, totalling 79.98 SC
  • A donation of 10 SC to the narwal server (thank you!)
  • A change output, sending 17.59 mS back to your wallet
  • A miner fee of 2.41 mS, which is 10 uS/byte

We may want to also consider calling it a "fee" instead of a "donation"

Add sendmax feature

Allow users to send the max amount of Siacoins in their wallet, to avoid the dreaded Could not create transaction: insufficient funds message.

Add Siafund support

Many people will likely want to use walrus-cli with Siafunds, especially with Ledger hardware wallets. Would be prudent to add Siafund support!

Missed go.mod file for posibillity to compile

I tried to add next go.mod file - after this was compiled

module lukechampine.com/walrus-cli

go 1.13

require (
github.com/julienschmidt/httprouter v1.3.0
github.com/karalabe/hid v1.0.0 // indirect
gitlab.com/NebulousLabs/Sia v1.4.1
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
lukechampine.com/flagg v1.1.1
lukechampine.com/sialedger v0.0.0-20190804211231-0e9955f04f66
lukechampine.com/us v0.11.1
)

replace github.com/coreos/bbolt => ../../gitlab.com/NebulousLabs/Sia/vendor/github.com/coreos/bbolt

Transaction logs

It'd be nice if this has a subcommand that prints transaction logs.

split panics

I got this panic error:

panic: runtime error: index out of range [1] with length 1

It looks like the usage is not correct and the second parameter is used for two purposes:

per := parseCurrency(args[1])

writeTxn(args[1], txn)

wrong number of words in seed phrase

I am used

./walrus-cli -a http://127.0.0.1:9999 seed

have answer 12 words

then use in terminal for walrus and in terminal for walrus-cli

export WALRUS_SEED=<12 words>

and then try to generate address

./walrus-cli -a http://127.0.0.1:9999 addr

No index specified; using lowest unused index (0)
Using WALRUS_SEED environment variable
wrong number of words in seed phrase

Could not create split transaction

I got Could not create split transaction: insufficient funds when I tried to split an output.

It looks like balance calculation has a problem. It says it only has 5SC

$ ./walrus-cli -a http://localhost:9380/ balance
5SC

but I think it should have 5K SC

$ curl http://localhost:9380/utxos
[
        {
                "value": "5000000000000000000000000000",
                "unlockhash": "...",
                "ID": "..."
        }
]

Are split outputs going to the same address?

Does it really split outputs? It looks like all split funds are going to the same output again.

Please verify the transaction details:
    28d80dc058e0766110c2c4c2aae67cfcc4bb1fed41e4740e949244adb20c5dcbb13c7d50232f receiving 99 SC
    28d80dc058e0766110c2c4c2aae67cfcc4bb1fed41e4740e949244adb20c5dcbb13c7d50232f receiving 99 SC
    ...
    28d80dc058e0766110c2c4c2aae67cfcc4bb1fed41e4740e949244adb20c5dcbb13c7d50232f receiving 49.99759 SC

Reword txn description

Currently confusing, as it made me think that address and amount of Siacoins should be separated by commas, rather than by colons.
Creates a transaction sending containing the provided outputs, which are specified as a comma-separated list of address:value pairs, where value is specified in SC. The inputs are be selected automatically, and a change address is generated if needed.

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.