Skip to content
PIVX Emergency Tool for Ledger - Spend PIV from a seemingly "Stuck" Ledger wallet
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE.txt Porting to latest SPMT code May 14, 2019


PET4L [PIVX Emergency Tool For Ledger] is a tool to spend PIVs that are "trapped inside" the Ledger Nano S when Ledger Wallet Chrome App acts crazy.

How does it work?

  1. it fetches addresses from the device
  2. asks to the block explorer the UTXOs related to each address
  3. it creates the raw TX and signs the new inputs on the Nano S device
  4. finally uses the sendrawtransaction RPC call of the Core wallet to broadcast the TX.

NOTE: In the current implementation, utxo data is pulled from the BE ( Check that this block explorer is online and properly works before using the tool.


This application does not require installation.
If you are using a binary version, just unzip the folder anywhere you like and use the executable to start the application:

  • Linux: double-click pet4l file inside the app directory
  • Windows: double-click pet4l.exe file inside the app directory
  • Mac OsX: double-click application folder

If you are running PET4L from the source-code instead, you will need Python3 and several libraries installed.
Needed libraries are listed in requirements.txt.
From the PET4L directory, launch the tool with:


To make binary versions from source, PyInstaller can be used with the specPet4l.spec file provided.


Setting up the RPC server

In order to interact with the PIVX blockchain, PET4L needs a local PIVX wallet running alongside (any empty pivx-cli wallet will do). Edit your local pivx.conf inserting rpcuser, rpcpassword, rpcport and rpcallowip. Example:


Configure the RPC server by clicking on the menu

and inserting the same data. You can leave ip if the wallet is on the same machine as the pet4l.
Otherwise set the IP address of the machine running the Core PIVX wallet.


If the IP and the credentials of the PIVX wallet are correct, it should connect with pet4l instantly.
Otherwise use the Connect button next to "PIVX server: Local Wallet".
Connect the hardware device to USB and open the PIVX-App on it.
Click the button Connect next to "HW device: Ledger Nano S" to connect to the hardware device.

Once successfully connected, it gives a confirmation message and the led turns purple.


Loading Addresses And UTXOs

Adjust the fields as needed:

  • Account HW : insert the account number you wish to recover funds from (default: 0)
  • spath from : insert the n. of the first address to search (default: 0)
  • spath to : insert the n. of the last address to search (default: 10)
  • internal/external : insert 0 for normal addresses and 1 for change addresses (default: 0)

Click on Scan Ledger Device to retrieve the addresses and load the UTXOs

Open the menu to select an address and check related UTXOs

Spending UTXOs

Once loaded, select those UTXOs you wish to spend.
Insert the destination address.
Check the suggested fee and adjust as preferred.
Then click on Send

Verify the details of the TX both on screen and on the display of the Nano S. If everything checks out, click "yes" (right button) on the device.

The transaction is now assembled and signed.
Pet4l asks one more time to check the details before broadcasting the transaction (thus spending the selected UTXOs).

Click Yes to finally broadcast the transaction to the PIVX network.
Click Show Details to get the TX-id that identify the transaction.

It should appear on the Block Explorers after a few minutes.

You can’t perform that action at this time.