INTRODUCTION

First of all, I would never recommend running a powershell script from any untrusted source on the internet. And if you decide to run any powershell script, I recommend that you closely inspect it. If you still feel unsafe about it, join the Pulsar Discord and ask questions about it. You can also run the code through ChatGPT and ask the AI what the code does.

I have posted the full code to my powershell script here for public evaluation and transparency. And while I do not claim to be an expert coder in powershell, this code accomplishes its primary task: it auto-abandons orphaned transactions in the Pulsar Desktop Wallet.  Upon inspecting the code I have provided, you will see that it does not and will not send any coin to any address whatsoever. Notice: Even though I use this same code on my computer to manage my Pulsar Wallet without any negative effects, I will not guarantee how it will operate on your computer.

PULSAR CLI COMMANDS USED IN MY SCRIPT

  1. getwalletinfo
    • Returns an object containing various wallet state info
  2. listtransactions
    • Returns up to ‘count’ most recent transactions skipping the first ‘from’ transactions for account ‘account’.
  3. abandontransaction
    • Mark in-wallet transaction as abandoned
    • This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace “stuck” or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.

HOW TO USE

Copy and paste the code and save it with a file name using a .ps1 extension. For example, on my machine this code is saved with the filename ToE_WaLLeT_MoNiToR_v1.1.ps1 … Once saved, I use Windows Task Scheduler to call it once per hour. This ensures that my orphans never stack up.

  • In Windows Task Scheduler, create a task using whatever name for your task. In my task scheduler, the name is _Clean Pulsar
  • In the “General” tab, I use the “Administrators” account, “Run only when user is logged on” and “Run with highest privileges”.
  • In the “Triggers” tab, I begin the task “on a schedule,” “daily,” I make a trigger for each hour (12AM, 1AM, 2AM, 3AM …. 8PM 9PM 10PM, 11PM), and set each trigger to “recur every 1 days” — this ensures that the code is called once per hour each day no matter what.
  • In “Actions” tab, I “Start a progran” with the program/script as “C:\Program Files\PowerShell\7\pwsh.exe” and in “Add arguments (optional)” I have -c Powershell -ExecutionPolicy Unrestricted -WindowStyle Hidden -File “C:\Users\–USER–\AppData\Roaming\Pulsar\Pulsar-Scripts\ToE_WaLLeT_MoNiToR_v1.1.ps1
    • Note: you will have to change –USER– to whatever your username is and/or you’ll have to specify the path to where the .ps1 is located.
    • Note: Each hour, a small window will quickly appear and disappear each time the task is called. This might be annoying, but I have not found a better way for this script to work in a pure silent mode. If you discover a better way, please share it in the discord and I’ll update this post.

MY HUMBLE POWERSHELL SCRIPT

Copy to Clipboard