Some helpful commands, when running rippled. Posted here as a reminder to myself.

Commands shown here should work when installed on RHEL or Centos.

Alias for rippled

alias rippled="/opt/ripple/bin/rippled --conf=/opt/ripple/etc/rippled.cfg"

Check the status

rippled server_info is essential. Watch this command to see when the server manages to sync:

watch  "/opt/ripple/bin/rippled server_info | egrep 'load_|complete|peers|status|server_state'"

Use ctrl-c to stop.

Run in standalone mode

Create a copy of systemd unit file

sudo cp /usr/lib/systemd/system/rippled.service /etc/systemd/system/rippled-standalone.service

Edit these lines:

Description=Ripple Daemon Standalone mode

ExecStart=/opt/ripple/bin/rippled --conf /etc/opt/ripple/rippled.cfg -a --load

(Use --load if you have run in network mode and synced already. Use --start for an empty ledger.)

As shown above, rippled-standalone uses the same config file as original rippled service, so that we can load a previously synced image of the ledger. Note that it will open the same ports as the regular networked rippled service. Meaning you can only run in networked mode or standalone mode. Not both at the same time.

sudo systemctl stop rippled
sudo systemctl start rippled-standalone

To advance ledgers every 10 seconds in standalone mode, try

watch -n 10 /opt/ripple/bin/rippled --conf=/opt/ripple/etc/rippled.cfg ledger_accept

(Based on this redhat documentation.)

Purging data

Stop rippled then

sudo rm -r /var/lib/rippled/db/rocksdb
sudo rm -r /var/lib/rippled/db/state*

Create a wallet

The wallet_propose command works in either standalone or networked mode. It’s an admin command, so it will work on your local rippled but generally not one hosted by anyone else.

rippled wallet_propose

Copy the account_id and master_seed from “result”.

Command line trick to create a wallet without showing the secret:

rippled wallet_propose | tee master.json | grep status

Get the address and secret key (still without seeing the secret):

ACCOUNT=$(sed -n -e 's/.*"account_id" : "\(.*\)".*/\1/p' master.json)
SECRET=$(sed -n -e 's/.*"master_seed" : "\(.*\)".*/\1/p' master.json)

(Don’t store anything of value in a wallet where you haven’t safely stored the secret!)

Transactions

Fee is in drops (1000000 drops == 1 XRP)

FEE=20000

A new account_id will have sequence 1. You can use online rippled to look up the sequence otherwise.

SEQUENCE=1

regular key

rippled wallet_propose | tee regular.json | grep status
REGULAR=$(sed -n -e 's/.*"account_id" : "\(.*\)".*/\1/p' regular.json)

Make a transaction authorizing the regular key.

TRANSACTION='{"Account": "'$ACCOUNT'", "Sequence": "'$SEQUENCE'", "Fee": "'$FEE'", "TransactionType": "SetRegularKey", "RegularKey": "'$REGULAR'"}'

Sign that transaction.

rippled sign $SECRET "$TRANSACTION" offline | tee tx-$SEQUENCE.json | sed -n -e 's/.*"tx_blob" : "\(.*\)".*/\1/p'

The output (the “tx_blob” field) can be passed to rippled submit (https://ripple.com/build/rippled-apis/#submit).

Troubleshooting

Insufficient number of file descriptors

2017-Jun-20 18:37:44 Application:FTL Insufficient number of file descriptors: 4672 are needed, but only 1024 are available.
Insufficient number of file descriptors: 4672 are needed, but only 1024 are available.

Edit /etc/security/limits.conf

rippled soft nofile 65536
rippled hard nofile 65536

Run in standalone mode (i.e. for air-gapped offline operation)

https://ripple.com/build/stand-alone-mode/

sudo systemctl edit rippled

Then add these lines:

[Service]
ExecStart=
ExecStart=/opt/ripple/bin/rippled --conf /etc/opt/ripple/rippled.cfg -a --start

(use --load if you have run in network mode and synced already. Used --start if not.)

The systemctl edit command will save a snippet to /etc/systemd/system/rippled.service.d. To undo this change, delete that file.