Giter Site home page Giter Site logo

offline-signer's Introduction

Offline Signer

minimum rustc 1.75

This is an unofficial CLI wallet application for the Chia blockchain. It's built from the ground up using the wallet SDK library, and allows you to create transactions using only your public key, and sign them offline on a different machine, using only the private key and no full node.

This does not run against the official Chia light wallet, but rather is itself a custom light wallet implementation that connects to a trusted full node. This means you will either have to run a full node yourself or connect to one that you can trust. Peer discovery and validation have not yet been implemented but may be added in the future, to make it as easy to use as the Chia wallet.

Disclaimer

This project is experimental and a work in progress. It has not yet been rigorously tested in a production environment. Use on mainnet only at your own risk, and verify transactions before submitting them to the network.

I am not to be held responsible for any misuse of this application. Please do not use it, if you are not okay with things breaking.

That said, contributions and any help testing it are appreciated.

Limitations

Currently this wallet has the following limitations:

  • It only supports the Standard Transaction (XCH coins).
  • No support for hardened keys (non-observer keys, for example used by the simulator's prefarm).
  • It syncs the wallet's coin state from zero every time you run a command, which could potentially be slow in some cases.
  • It's very early in development and the wallet sdk is very new. Expect things to not be perfect!
  • It does not keep track of pending transactions, so you could potentially create duplicate spends on accident (though due to blockchain and mempool validation, this would only be annoying, rather than causing an actual issue).
  • There isn't support for Replace By Fee (RBF), although I do plan on adding this in a future release.
  • It's a bit too verbose to use if you are creating, signing, and submitting transactions all on the same machine.
  • It's not very user friendly or flexible. Interested in feedback for this!

Prerequisites

You must have the Chia full node installed and running on the network of your choice.

You will need to install the Rust toolchain, by running the command on the Rustup website.

Installation

Run the following command to install the offline signer CLI:

cargo install --git https://github.com/Rigidity/offline-signer

You can see a list of commands with:

offline-signer help

Setup Wallet

You can find your wallet's root public key using this command:

chia keys show

The configuration is stored in ~/.offline-signer by default.

To set up the cold wallet, connected to your local mainnet full node:

offline-signer config --public-key '<pk>' --node-uri localhost:8444

To set it up using the simulator (using your own port):

offline-signer config --public-key '<pk>' --node-uri localhost:54939 --network-id simulator0

Note that the --agg-sig-data is the same as the mainnet genesis challenge when using the simulator, and you will not need to override it. However on testnet, you will need to set it to the appropriate genesis challenge found with chia show -s.

Setup Signer

You can find your wallet's mnemonic using this command:

chia keys show --show-mnemonic-seed

To set up the signer, offline from the network:

offline-signer config --mnemonic '<phrase>'

You can also use your root secret key instead of the mnemonic if you prefer:

offline-signer config --secret-key '<sk>'

Note that you cannot create new transactions using this setup, since you have not connected a node.

Generate New Mnemonic

You can generate a new mnemonic using this command:

offline-signer config --generate

Create Transaction

You can create a transaction with:

offline-signer send <address> <amount> --fee <fee>

Note that this will use amounts formatted in XCH by default, unless you specify --mojos explicitly.

You can pipe this to a spend bundle file:

offline-signer send ... > spend.json

Keep track of the derivation index, so that you know how many keys need to be derived when signing the transaction.

Sign Transaction

You can sign an unsigned spend bundle file:

offline-signer sign spend.json --derivation-index <index>

Note that this will update the spend bundle file in place with the new signature.

The derivation index is required, because the wallet cannot sync against the full node directly to figure it out on its own.

Submit Transaction

Once you've signed the spend bundle, you can submit it to the network's mempool:

offline-signer push spend.json

This can take a while to complete, depending on the fee you used when creating the transaction.

offline-signer's People

Contributors

rigidity 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.