Redgold Documentation

Redgold Documentation

Wallet

Welcome to the Redgold Wallet Guide. This guide will walk you through the process of setting up a wallet, sending and receiving transactions, and other common wallet operations. If you have not yet installed Redgold, please see the installation guide in the Getting Started section.

For general security background information, please also read the Security Procedures Intro

For more advanced cold laptop passwording mixing, you can also optionally reference the Cold Password Mixing Guide

GUI Usage

While advanced users may wish to use the CLI (discussed below,) the most common usage of Redgold will be through the native GUI. This is packaged into the installed binary and can be run through instructions in the getting-started section. It can be invoked directly with redgold gui or just by running redgold with no arguments.

Before getting started, we strongly recommend using a cold hardware wallet for all transactions. The GUI currently supports only Trezor hardware wallets, and to use this you must install an additional dependency manually besides the Redgold software called trezorctl which is available as a python module. This is not nececessary to install if only using a hot wallet

Please follow the Trezor Setup Guide to get started. The main command from this guide that you'll need to install trezor cli is:

pip3 install trezor

If you should get an error like this:

WARNING: The script trezorctl is installed in '/Users/user/Library/Python/3.9/bin' which is not on PATH.

Error: DataError: Forbidden key path

Please see this guide for a solution.

Hot Wallet Mnemonic Loading

By default, all invocations of the GUI will attempt to load keys from both ~/.rg/all/mnemonic and $REDGOLD_SECURE_DATA_PATH/.rg/all/mnemonic.

We recommend using export REDGOLD_SECURE_DATA_PATH=/path/to/secure/data to locate to a Cryptomator E2EE cloud backup folder. This mnemonic can still be mixed with a passphrase and offset in the GUI for extra security, but will be useful for node deployment as well.

The GUI can be used for generating keys which can be saved in plaintext to either disk location, and you can also import generate and save or import keys directly from the GUI.

Getting Started

When starting, first navigate to the Keys tab on the left side panel, and you should see a screen like this:

The keys section will allow you to see and manage existing keys, generate new ones, import then, and manage XPubs. XPubs are extended public keys, each representing an 'account' as seen in other wallet software. By default, hot keys will be either loaded from default paths listed above or automatically generated. You can import more, and use these to generate XPubs, but it is recommended to use the Request XPub button to request one from a cold device.

For usage of hot keys, you can enter a passphrase, modify the derivation path, or use an 'offset' to generate a derived mnemonic from the original. This is useful for generating multiple mnemonics from a single source.

All fields should change immediately upon update, and you after selecting a key and a particular derivation path, you can store the XPub for that hot key.

Request XPub screen will require you to enter a derivation path to request a cold XPub. This is deliberately defaultly formatted to m/44'/0'/50'/0/0 to match the default derivation path of the Trezor hardware wallet. Because we're using the Bitcoin message signing API as a work-around to cold wallet support, this path is recommended.

The 44 purpose corresponds to BIP-44, which is the standard for non-segwit Bitcoin addresses. Since the witness data is preserved in Redgold transactions, this is the most appropriate. It is also deliberately chosen so that it will not overlap with standard Purpose 84 keys used for normal BTC hardware interactions (to keep addresses separate.)

It is REQUIRED that you choose an XPub account below 100 as trezorctl considers any account above that invalid and will not work for the CLI. 50 is chosen to be high enough to avoid overlap with your other accounts as a default.

0/0 are not required to be entered, but just act as default change and index, you can adjust them on the XPub screen to view different addresses.

Right now, the only supported hardware wallet is Trezor. You will need to connect your Trezor and unlock it with your PIN. Once you have done so, the indicator icon for 'Connected' will show green and your Trezor device name and id will be listed in the GUI.

You will be prompted to enter your passphrase on the device, and you can inspect the logs or code to verify the command being issued follows the proper get-public-node API. Due to the nature of the Trezor device, this should be considered a safe and secure operation to perform.

After requesting, you should see a screen like this:

This will allow you to save the XPub under a given name, for later usage in the Transact screen. You can also export and view the full XPub string directly.

The main reason for this, is that the Redgold wallet is not yet an officially supported application of Trezor, as it takes many years to get an application approved by Trezor. However, Redgold transactions are unique in the sense that they support a signature done through the Bitcoin Message Signing API supported by almost all hardware wallets. This makes it extremely straightforward to add support for additional hardware wallets in the future.

By default, trezorctl only works with accounts with an index below 100, so the default key derivation path is set to m/44'/0'/50'/0/0. If you are confused about what this syntax means:

  • the 'm' is a prefix indicating that this is a path to a derived key.
  • The 44' indicates that this is a BIP44 path. BIP-44 is used to indicate keys that are derived with a non-segwit derivation path. If you are using your Trezor typically, it would use an 84' derivation path corresponding to BIP-84 Segwit addresses.
  • These keys do not overlap with the standard Bitcoin keys (deliberately.)
  • Redgold uses signatures in the calculation of it's transaction hash, like Ethereum, making it non-segwit it's own transaction type.
  • For external integrations with Bitcoin (native swaps / AMMs, Redgold nodes use BIP-84
  • The 0' indicates that this is a Bitcoin account type, and this is required to invoke the Bitcoin Message
  • Signing API for trezorctl.
  • The 50' indicates that this is account #50, as trezorctl sets the max at 100, we have chosen a high account number to avoid any potential overlap with your other accounts.

The reason for all of this is to be able to make use of the Trezor Bitcoin Message Signing API, which is the only mechanism to add immediate Trezor support without waiting years for approvals.

In order to start the sending process, please navigate to the Transact tab on the left side panel. You should see a selection box to select an XPub (account) by name. Once selected, if it's a hot key, you can optionally input the passphrase to make the public key match, if it's a cold Trezor key, do not enter a passphrase as it's required to enter it on the device.

After selecting an XPub the Send button and provide a destination address and an amount. After you have entered values in both fields, you will be able to click the Prepare transaction button to inspect and view the json of the transaction that was generated, as well as view the hash that you will compare against the viewscreen on the hardware device. (Note some screenshots may be out of date but the process is identical to newest version):

Here we see a transaction that has been prepared and is ready to be signed. You can see the transaction hash at the bottom below the json which you will need to verify on the Trezor screen. When you click the Sign Transaction button you should be prompted to enter a passphrase again on your hardware device, and then see a window indicating that it is requesting to sign a Bitcoin Message with a value of Redgold <your transaction hash here>

After you have verified the transaction hash on your device, you can click the checkmark button and the transaction will be signed by your device and the signature returned to the GUI before the transaction is actually ready to be broadcast.

You should see the JSON update to include your signature:

You can now click the Broadcast button to broadcast the transaction to the network. The software will automatically poll the network until the transaction has been accepted or rejected, and you should see a message indicating the transaction has been accepted by the network or a rejection message if something went wrong.

To view transaction history, please rely on the Explorer and search for your address.

CLI Wallet Example Testing Usage

This example will show the full flow with a newly generated mnemonic / keys in order to allow you to quickly test the network, for more secure CLI operations please use the later CLI commands that include hardware flags.

Before issuing following commands, set your current desired network environment (for testing transactions you may wish to use a lower environment tier such as dev, staging, or test)

main for mainnet

test for testnet

dev for dev branch

export REDGOLD_NETWORK='test'

To generate a random mnemonic as a word string which writes to stdout:

redgold generate-words > words

Example output: spray vicious advice area best device arrange federal payment remind host light cat defy soda festival song help hurt luggage police reopen myth wear wage worry egg acquire emotion occur slender wagon steel hero endless tattoo south better outside slow spice sister abandon slim surprise guide better candy

For later commands, export the mnemonic as an environment variable

export REDGOLD_WORDS="$(cat words)"

To create a sample address from this mnemonic

redgold address --index 0 > address

To request some sample currency for testing (default 5.0 returned)

redgold faucet --to "$(cat address)" > faucet_tx_hash

To check the faucet transaction for acceptance:

redgold query --hash "$(cat faucet_tx_hash)"

To send currency to someone else (create and broadcast a transaction)

redgold send --to <destination_address> --amount <float amount>

As an example, generate a second address locally and send to it:

redgold address --index 1 > address2

redgold send --to "$(cat address2)" --amount 2.0 > send_tx_hash

To check the transaction for acceptance:

redgold query --hash "$(cat send_tx_hash)"

To check the balance of an address:

Either query for all information on the address:

redgold query --hash "$(cat address2)"

Or look at the balance only:

redgold balance --address "$(cat address2)"

Secure Hardware CLI Transactions

WARNING: Not fully implemented

As before, please see the first section for details on installing trezorctl, as below commands require it as a dependency to function correctly.

redgold --trezor send --address <DESTINATION_ADDRESS>