Giter VIP home page Giter VIP logo

forc-wallet's Introduction

forc-wallet

A forc plugin for managing Fuel wallets.

Quickstart

Installation through fuelup (recommended)

forc-wallet is packaged alongside the default distributed toolchains when installed using fuelup. If you have the latest toolchain installed, you should already have forc-wallet available:

$ fuelup toolchain install latest
$ forc-wallet --version
forc-wallet 0.2.2

For usage in custom toolchains:

fuelup component add forc-wallet

Installation through cargo

Otherwise, you may use cargo:

cargo install forc-wallet

Create a wallet

Before creating accounts and signing transactions with them you need to create a wallet. To do so:

forc-wallet new

This will require a password for encrypting the wallet. After the wallet is created you will be shown the mnemonic phrase.

Note: You will need your password for signing and account derivation, and you will need your mnemonic phrase if you wish to recover your wallet in the future.

Import a wallet

To import a wallet from an existing mnemonic phrase, use:

forc-wallet import

Note: forc-wallet adheres to the Web3 Secret Storage Definition and accepts paths to wallet files that adhere to this standard.

Create an account

To create an account for the wallet, you can run:

forc-wallet account new

This will require your wallet password (the one that you chose during creation). This command will always derive the next account that has not yet been derived locally.

To list all accounts derived so far, use the following:

forc-wallet accounts

Note: When we "create" an account, we are really just revealing it. All accounts are derived deterministically based on the wallet's mnemonic phrase and derivation path. forc-wallet will cache the public addresses of derived accounts within ~/.fuel/wallets/accounts.

Sign a transaction

To sign a transaction, you can provide the transaction ID. You can generate a transaction and get its ID using forc-client. Signing the transaction once you have the ID is simple:

forc-wallet account <account_index> sign tx-id <transaction_id>

Sign arbitrary data

You may sign a string directly:

forc-wallet account <account_index> sign string "Blah blah blah"

Or the contents of a file:

forc-wallet account <account_index> sign file <path>

You may also sign a hex-encoded byte string:

forc-wallet account <account_index> sign hex 0x0123456789ABCDEF

You can also use the sign subcommand directly, e.g. the following is the same:

forc-wallet sign --account <account_index> hex 0x0123456789ABCDEF

Using the sign subcommand, you can choose to sign directly with a private key (rather than a wallet account):

forc-wallet sign --private-key hex 0x0123456789ABCDEF

Other useful commands

Get address of an account

To derive the address of a specific account, you can use:

forc-wallet account <account_index>

Get private key of an account

To retrieve the private key of a specific account, you can use:

forc-wallet account <account_index> private-key

Get public key of an account

To retrieve the public key of a specific account, you can use:

forc-wallet account <account_index> public-key

forc-wallet's People

Contributors

kayagokalp avatar mitchmindtree avatar voxelot avatar bingcicle avatar iqdecay avatar braqzen avatar dentosal avatar digorithm avatar crypdoughdoteth avatar sarahschwartz avatar smuueth avatar

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.