Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand

Downloads:

1,702

Downloads of v 0.8.18:

386

Last Update:

14 Apr 2020

Package Maintainer(s):

Software Author(s):

  • Input Output HK Limited

Tags:

jormungandr

jormungandr (Install)

  • 1
  • 2
  • 3

0.8.18 | Updated: 14 Apr 2020

Downloads:

1,702

Downloads of v 0.8.18:

386

Software Author(s):

  • Input Output HK Limited

Tags:

jormungandr

jormungandr (Install) 0.8.18

  • 1
  • 2
  • 3

All Checks are Passing

3 Passing Tests


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Successful:

No detections found in any package files

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install jormungandr (Install), run the following command from the command line or from PowerShell:

>

To upgrade jormungandr (Install), run the following command from the command line or from PowerShell:

>

To uninstall jormungandr (Install), run the following command from the command line or from PowerShell:

>

Deployment Method:

NOTE

This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade jormungandr -y --source="'INTERNAL REPO URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade jormungandr -y --source="'INTERNAL REPO URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install jormungandr
  win_chocolatey:
    name: jormungandr
    version: '0.8.18'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'jormungandr' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '0.8.18'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller jormungandr
{
    Name     = "jormungandr"
    Version  = "0.8.18"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'jormungandr':
  ensure   => '0.8.18',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved as a trusted package on 14 Apr 2020.

Description

This package will install IOHK's Jormungandr compiled binaries which provide Cardano Blockchain node capability running on Rust.

Jormungandr is a node implementation with the initial aim to support the Ouroboros type of consensus protocol. A node is a participant of a blockchain network, continuously making, sending, receiving, and validating blocks. Each node is responsible to make sure that all the rules of the protocol are followed.

Once this chocolatey package is installed, jcli.exe and jormungandr.exe binaries will be available on the command line. See the documentation for usage. A jtools script will also be available which simplifies activities such as wallet creation, fund transfer, fund delegation, stake pool creation and more.


tools\chocolateybeforemodify.ps1
$CLI="jcli"
$NODE="jormungandr"

function Stop-Jormungandr {
	[CmdletBinding(SupportsShouldProcess)]
	param ($NAME)

	[System.Diagnostics.Process[]]$PROCESSLIST = Get-Process -Name $NAME -ErrorAction SilentlyContinue
	if ($PROCESSLIST) {
		Write-Output "Found $NAME running.  Shutting down $NAME..."
		ForEach ($Process in $PROCESSLIST) {
			$Process | Stop-Process -Force -Confirm:$false
		}
	}
}

Write-Output "Stopping any running jormungandr processes before upgrading or uninstalling..."
Stop-Jormungandr $CLI
Stop-Jormungandr $NODE
tools\chocolateyinstall.ps1
$ErrorActionPreference = 'Stop'; # stop on all errors
$toolsDir   = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Get-ChocolateyUnzip "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\\release.zip" $toolsDir
$jtoolsFile = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)\\jtools.ps1"
Install-ChocolateyPowershellCommand -PSFileFullPath $jtoolsFile
Write-Output "`n`n**********`n`n"
Write-Output "The following executables are now in the path:`n  jcli.exe`n  jormungandr.exe`n  jtools.bat"
Write-Output "`n`n**********`n`n"
tools\jtools.ps1
# jtools version 0.1.1 (powershell port)
#
# based on scripts from @Gufmar, @NicolasDP, @disassembler

[CmdletBinding()]
Param (
  [Parameter(Mandatory=$false, Position = 1)] [string] $OPERATION,
  [Parameter(Mandatory=$false, Position = 2)] [string] $SUBCOMMAND = $null,
  [Parameter(Mandatory=$false, Position = 3)] [string] $3 = $null,
  [Parameter(Mandatory=$false, Position = 4)] [string] $4 = $null,
  [Parameter(Mandatory=$false, Position = 5)] [string] $5 = $null,
  [Parameter(Mandatory=$false, Position = 6)] [string] $6 = $null,
  [Parameter(Mandatory=$false, Position = 7)] [string] $7 = $null,
  [Parameter(Mandatory=$false, Position = 8)] [string] $8 = $null,
  [Parameter(Mandatory=$false, Position = 9)] [string] $9 = $null,
  [Parameter(Mandatory=$false, Position = 10)] [string] $10 = $null,
  [Parameter(Mandatory=$false, Position = 11, ValueFromRemainingArguments=$true)] [string[]] $LISTARGS = $null,
  [Parameter(Mandatory=$false)] [string] $a,
  [Parameter(Mandatory=$false)] [string] $l,
  [Parameter(Mandatory=$false)] [string] $r,
  [Parameter(Mandatory=$false)] [string] $f,
  [Parameter(Mandatory=$false)] [switch] $o,
  [Parameter(Mandatory=$false)] [switch] $p
)

### Parameters ####################################################

$OPT_PARAMS=0
$ALL_PARAMS=$PSBoundParameters.count
foreach($boundParam in $PSBoundParameters.GetEnumerator()) {
  #"Key={0} Value={1}" -f $boundParam.Key,$boundParam.Value
  switch($boundParam.key) {
    "a"        { $OPT_PARAMS++ }
    "l"        { $OPT_PARAMS++ }
    "r"        { $OPT_PARAMS++ }
    "f"        { $OPT_PARAMS++ }
    "o"        { $OPT_PARAMS++ }
    "p"        { $OPT_PARAMS++ }
    "LISTARGS" { $OPT_PARAMS++ }
  }
}

$PARAMS=$ALL_PARAMS - $OPT_PARAMS

$CLI="jcli"
$NODE="jormungandr"
$NODE_REST_URL=if ($Env:NODE_REST_URL) { $Env:NODE_REST_URL } else { "http://127.0.0.1:3001/api" }
$BASE_FOLDER=$Env:USERPROFILE + "\jormungandr\"
$WALLET_FOLDER=$BASE_FOLDER + "wallet"
$POOL_FOLDER=$BASE_FOLDER + "pool"
$JTOOLS_LOG=$BASE_FOLDER + "\jtools.log"
$CURL="curl.exe"
$JQ="jq.exe"

###################################################################

function version() {
  Write-Output "`njtools Version:        0.2.0"
  Write-Output "jormungandr Version:   $(& $NODE --version | ForEach-Object { $_ -replace `"jormungandr `", `"`" })"
  Write-Output "jcli Version:          $(& $CLI --version | ForEach-Object { $_ -replace `"jcli `", `"`" })"
  Write-Output "PS Version:            $($PSVersionTable.PSVersion)"
  Write-Output "Base Folder:           $BASE_FOLDER"
  Write-Output "Node Rest Url:         $NODE_REST_URL`n"
  Exit 1
}


function usage() {
  Write-Output "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
  Write-Output "Usage:"
  Write-Output ""
  Write-Output "    jtools wallet new    <WALLET_NAME>"
  Write-Output "    jtools wallet show   <WALLET_ADDRESS|WALLET_NAME>"
  Write-Output "    jtools wallet remove <WALLET_NAME>"
  Write-Output ""
  Write-Output "    jtools funds send <SOURCE_WALLET> <AMOUNT> <DEST_ADDRESS|DEST_WALLET>"
  Write-Output "            Note: Amount is an Integer value in Lovelaces"
  Write-Output ""
  Write-Output "    jtools pool show"
  Write-Output "    jtools pool register <POOL_NAME> <WALLET_NAME> <POOL_TICKER> <POOL_URL> [-a <REWARD_ACCOUNT>] [-l <TAX_LIMIT>] [-r <TAX_RATIO>] [-f <TAX_FIXED>]"
  Write-Output "            Note: The <WALLET_NAME> wallet is only used to pay the registration fee"
  Write-Output "                  The <POOL_TICKER> must be limited to 5 uppercase alphanumeric characters or less"
  Write-Output "                  The <REWARD_ACCOUNT> will default to the pool account if not specified"
  Write-Output "                  The <TAX_*> parameters will default to 0 if not specified"
  Write-Output ""
  Write-Output "    jtools stake delegate <POOL_NAME> <WALLET_NAME> [-o] [-p]"
  Write-Output "            Note: Entire Wallet balance, less the fee, is delegated"
  Write-Output "                  The optional -o switch will overwrite any preexisting staking certificate"
  Write-Output "                  The optional -p switch will utilize a pledge address from a pool with name <WALLET_NAME>"
  Write-Output ""
  Write-Output "    jtools check tx   <TX_ID>"
  Write-Output "    jtools check node stats"
  Write-Output "    jtools check node settings"
  Write-Output ""
  Write-Output "    jtools version"
  Write-Output ""
  Write-Output "    jtools update"
  Write-Output ""
  Write-Output "REST-API:"
  Write-Output ""
  Write-Output "    The rest API in use is ${NODE_REST_URL}."
  Write-Output "    This can be changed by setting a Powershell environment variable."
  Write-Output "    An example command would be:"
  Write-Output "            `$Env:NODE_REST_URL=`"http://127.0.0.1:3001/api`""
  Write-Output "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
  Exit 1
}

function need_cmd([string]$cmd) {
  if (!(check_cmd $cmd)) {
    $chocoPkg=$cmd -replace "\..*", ""
    Write-Output "`nERROR: The command '$cmd' is needed but not found"
    Write-Output "       Try 'choco install $chocoPkg' from an administrative PowerShell`n"
    Exit 1
  }
}

function check_cmd([string]$cmd) {
  Get-Command $cmd -ErrorAction SilentlyContinue | Out-Null
  return $?
}

function say([string]$out, [string]$method) {
  Write-Output $out
  if ($method -eq "log") {
    Add-Content $JTOOLS_LOG "$(Get-Date -UFormat "%Y-%m-%dT%H:%M:%S%Z") - $out"
  }
}

function wallet() {
  if ($PARAMS -lt 3) {
    usage
  }

  $WALLET_NAME=$3

  Switch($SUBCOMMAND) {
    # jtools wallet new <WALLET_NAME>
    "new" {
      if (Test-Path -Path "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key") {
        Write-Output "`nERROR: A wallet named `"$WALLET_NAME`" already exists"
        Write-Output "       Choose another name or remove the existing one`n"
        Exit 1
      }
      New-Item -ItemType Directory -Force -Path "${WALLET_FOLDER}\$WALLET_NAME" | Out-Null

      # Create a personal wallet key
      $MY_ED25519_file="${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key"
      & $CLI key generate --type=Ed25519 | Tee-Object -Variable MY_ED25519_key |  Out-File -Encoding Default $MY_ED25519_file

      $MY_ED25519_pubfile="${WALLET_FOLDER}\${WALLET_NAME}\ed25519.pub"
      $MY_ED25519_key | & $CLI key to-public | Tee-Object -Variable MY_ED25519_pub | Out-File -Encoding Default $MY_ED25519_pubfile

      # Extract account address from wallet key
      $MY_ED25519_addrfile="${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account"
      & $CLI address account --prefix addr $MY_ED25519_pub --testing | Tee-Object -Variable MY_ED25519_address | Out-File -Encoding Default $MY_ED25519_addrfile

      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      say "New wallet named `"$WALLET_NAME`":" "log"
      say "  public key:  $MY_ED25519_pub" "log"
      say "  address:     $MY_ED25519_address" "log"
      say "" "log"
      say "Stored at path: ${WALLET_FOLDER}\$WALLET_NAME" "log"
      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      Break
    }
    # jtools wallet show <WALLET_ADDRESS|WALLET_NAME>
    "show" {
      # The wallet name parameter appears to match an address
      if (($WALLET_NAME.length -eq 62) -or ($WALLET_NAME.length -eq 64)) {
        $WALLET_ADDRESS=$WALLET_NAME
      }
      # Look for a local wallet account address
      elseif (Test-Path -Path "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account") {
        $WALLET_ADDRESS=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account"
      }
      else {
        Write-Output "`nERROR: No wallet `"$WALLET_NAME`" found (${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account)`n"
        Exit 1
      }
      $RESULT=& $CLI rest v0 account get $WALLET_ADDRESS --host $NODE_REST_URL 2> $null
      $WALLET_BALANCE=$RESULT | Select-String -Pattern "^value:" | ForEach-Object { $_ -replace "value: ", "" } 2> $null
      $WALLET_BALANCE_NICE=$WALLET_BALANCE -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      say "Address: $WALLET_ADDRESS" "log"
      say "Balance: $WALLET_BALANCE_NICE" "log"
      if ($null -eq $WALLET_BALANCE) {
        say "Balance not (yet) found on the blockchain for this address" "log"
      }
      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      Write-Output "Raw wallet info:`n"
      if ($null -ne $RESULT) {
        Write-Output $RESULT
        Write-Output ""
      }
      else {
        Write-Output "ERROR: Not available`n"
      }
      Break
    }
    # jtools wallet remove <WALLET_NAME>
    "remove" {
      if (Test-Path -Path "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account") {
        $WALLET_ADDRESS=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account"
        $RESULT=& $CLI rest v0 account get $WALLET_ADDRESS --host $NODE_REST_URL 2> $null
        $WALLET_BALANCE=$RESULT | Select-String -Pattern "^value:" | ForEach-Object { $_ -replace "value: ", "" } 2> $null
        $WALLET_BALANCE_NICE=$WALLET_BALANCE -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
        if ($null -eq $WALLET_BALANCE) {
          Write-Output "`nINFO: Found local wallet file but cannot (yet) verify its balance on blockchain`n"
        }
        elseif ($WALLET_BALANCE -eq "0") {
          Write-Output "`nINFO: Found local wallet file with current balance 0`n"
        }
        else {
          Write-Output "`nWARN: This wallet file has a balance of $WALLET_BALANCE_NICE`n"
        }

        $Readhost = Read-Host "Are you sure to delete secret/public key pairs (y/N)?"
        Switch -CaseSensitive ($ReadHost) {
          "y" {
            Remove-Item -Path ${WALLET_FOLDER}\$WALLET_NAME -Confirm:$false -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
            say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
            say "Removed wallet: `"${WALLET_NAME}`"" "log"
            say "Deleted directory: `"${WALLET_FOLDER}\$WALLET_NAME`"" "log"
            say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
            Break
          }
          Default {
            Write-Output "`nSkipped removal process for `"$WALLET_NAME`"`n"
            Break
          }
        }
      }
      else {
        Write-Output "`nINFO: No wallet `"$WALLET_NAME`" found`n"
        Exit 1
      }
      Break
    }
    Default {
      Write-Output "`nNo such subcommand: $SUBCOMMAND`n"
      usage
      Break
    }
  }
}

function funds() {
  if ($PARAMS -lt 5) {
    usage
  }

  $WALLET_NAME=$3
  $AMOUNT=$4 -as [uint64]
  $DEST=$5

  Switch($SUBCOMMAND) {
    # jtools funds send <SOURCE_WALLET> <AMOUNT> <DEST_WALLET|DEST_ADDRESS>
    "send" {
      if (Test-Path -Path "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account") {
        $SOURCE_ADDRESS=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account"
        $SOURCE_KEY=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key"
      }
      else {
        Write-Output "`nINFO: No wallet `"$WALLET_NAME`" found`n"
        Exit 1
      }

      if ($null -ne $AMOUNT) {
        $AMOUNT_NICE=$AMOUNT -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      }
      else {
        Write-Output "`nINFO: $4 is not a valid unsigned integer amount`n"
        Exit 1
      }

      # The destination parameter appears to match an address
      if (($DEST.length -eq 62) -or ($DEST.length -eq 64)) {
        $DEST_ADDRESS=$DEST
      }
      # Look for a local wallet account address
      elseif (Test-Path -Path "${WALLET_FOLDER}\${DEST}\ed25519.account") {
        $DEST_ADDRESS=Get-Content "${WALLET_FOLDER}\${DEST}\ed25519.account"
      }
      else {
        Write-Output "`nERROR: No wallet `"$WALLET_NAME`" found (${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account)`n"
        Exit 1
      }

      # Get the source wallet's state
      $RESULT=& $CLI rest v0 account get $SOURCE_ADDRESS --host $NODE_REST_URL 2> $null
      $SOURCE_BALANCE=$RESULT | Select-String -Pattern "^value:" | ForEach-Object { $_ -replace "value: ", "" }
      $SOURCE_BALANCE_NICE=$SOURCE_BALANCE -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      if ($null -eq $SOURCE_BALANCE) {
        Write-Output "`nERROR: Cannot (yet) verify the source address balance on the blockchain`n"
        Exit 1
      }
      elseif ($SOURCE_BALANCE -eq "0") {
        Write-Output "`nERROR: The source address balance is 0`n"
        Exit 1
      }
      else {
        Write-Output "`nINFO: This wallet file has a balance of $SOURCE_BALANCE_NICE`n"
      }

      $SOURCE_COUNTER=$RESULT | Select-String -Pattern "^counter:" | ForEach-Object { $_ -replace "counter: ", "" }

      # Read the node's blockchain settings (parameters are required for the next transactions)
      $SETTINGS=& $CURL -s ${NODE_REST_URL}/v0/settings
      $FEE_CONSTANT=$SETTINGS | jq -r .fees.constant | ForEach-Object { $_ -as [uint64] }
      $FEE_COEFFICIENT=$SETTINGS | jq -r .fees.coefficient | ForEach-Object { $_ -as [uint64] }
      $BLOCK0_HASH=$SETTINGS | jq -r .block0Hash
      $FEES=$FEE_CONSTANT + 2 * $FEE_COEFFICIENT
      $FEES_NICE=$FEES -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      $AMOUNT_WITH_FEES=$AMOUNT + $FEES

      if ($AMOUNT_WITH_FEES -gt $SOURCE_BALANCE) {
        Write-Output "`nERROR: Source wallet `"$WALLET_NAME`" has a balance of: $SOURCE_BALANCE_NICE"
        Write-Output "ERROR: This is not enough to send $AMOUNT_NICE and pay $FEES_NICE in fees`n"
        Exit 1
      }

      $STAGING_FILE=New-TemporaryFile
      $WITNESS_SECRET_FILE=New-TemporaryFile
      $WITNESS_OUTPUT_FILE=New-TemporaryFile
      & $CLI transaction new --staging $STAGING_FILE
      & $CLI transaction add-account $SOURCE_ADDRESS $AMOUNT_WITH_FEES --staging $STAGING_FILE
      & $CLI transaction add-output $DEST_ADDRESS $AMOUNT --staging $STAGING_FILE
      & $CLI transaction finalize --staging $STAGING_FILE
      $TRANSACTION_ID=& $CLI transaction data-for-witness --staging $STAGING_FILE

      $SOURCE_KEY | Out-File -Encoding Default $WITNESS_SECRET_FILE

      & $CLI transaction make-witness $TRANSACTION_ID `
        --genesis-block-hash $BLOCK0_HASH `
        --type "account" --account-spending-counter $SOURCE_COUNTER `
        $WITNESS_OUTPUT_FILE $WITNESS_SECRET_FILE
      & $CLI transaction add-witness $WITNESS_OUTPUT_FILE --staging $STAGING_FILE

      # Finalize the transaction and send it
      & $CLI transaction seal --staging $STAGING_FILE
      $TXID=& $CLI transaction to-message --staging $STAGING_FILE | & $CLI rest v0 message post --host $NODE_REST_URL

      Remove-Item -Path $STAGING_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null
      Remove-Item -Path $WITNESS_SECRET_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null
      Remove-Item -Path $WITNESS_OUTPUT_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null

      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      say "Send transaction with wallet `"$WALLET_NAME`"" "log"
      say "  From:       $SOURCE_ADDRESS" "log"
      say "  Balance:    $SOURCE_BALANCE_NICE" "log"
      say "  Amount:     $AMOUNT_NICE" "log"
      say "  To:         $DEST_ADDRESS" "log"
      say "  Fees:       $FEES_NICE" "log"
      say "  TX-ID:      $TXID" "log"
      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      Break
    }
    Default {
      Write-Output "`nNo such subcommand: $SUBCOMMAND`n"
      usage
      Break
    }
  }
}

function stake() {
  if ($PARAMS -lt 4) {
    usage
  }

  $POOL_NAME=$3
  $WALLET_NAME=$4

  Switch($SUBCOMMAND) {
    # jtools stake delegate <POOL_NAME> <WALLET_NAME> [-o] [-p]
    "delegate" {
      $POOL_ID_file="${POOL_FOLDER}\${POOL_NAME}\stake_pool.id"
      if (Test-Path -Path $POOL_ID_file) {
        $POOL_ID=Get-Content $POOL_ID_file
      }
      else {
        Write-Output "`nERROR: No pool `"$POOL_NAME`" found ($POOL_ID_file)`n"
        Exit 1
      }

      if ((Test-Path -Path "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account") -And ($p -eq $false)) {
        $SOURCE_ADDRESS=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account"
        $SOURCE_KEY=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key"
        $SOURCE_KEY_FILE="${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key"
        $SOURCE_PUB=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.pub"
        $STAKE_DLG_certfile="${WALLET_FOLDER}\${WALLET_NAME}\${POOL_NAME}_stake_delegation.cert"
        $STAKE_DLG_signedfile="${WALLET_FOLDER}\${WALLET_NAME}\${POOL_NAME}_stake_delegation.signcert"
      }
      elseif ((Test-Path -Path "${POOL_FOLDER}\${WALLET_NAME}\stake_pool_owner_wallet.address") -And ($p -eq $true)) {
        $SOURCE_ADDRESS=Get-Content "${POOL_FOLDER}\${WALLET_NAME}\stake_pool_owner_wallet.address"
        $SOURCE_KEY=Get-Content "${POOL_FOLDER}\${WALLET_NAME}\stake_pool_owner_wallet.key"
        $SOURCE_KEY_FILE="${POOL_FOLDER}\${WALLET_NAME}\stake_pool_owner_wallet.key"
        $SOURCE_PUB=Get-Content "${POOL_FOLDER}\${WALLET_NAME}\stake_pool_owner_wallet.pub"
        $STAKE_DLG_certfile="${POOL_FOLDER}\${WALLET_NAME}\${POOL_NAME}_stake_delegation.cert"
        $STAKE_DLG_signedfile="${POOL_FOLDER}\${WALLET_NAME}\${POOL_NAME}_stake_delegation.signcert"
      }
      else {
        Write-Output "`nINFO: No wallet `"$WALLET_NAME`" found"
        Write-Output "Did you intend to specify a pledge address from a pool?  If so, re-run with ``-p```n"
        Exit 1
      }

      # Get the source wallet's state
      $RESULT=& $CLI rest v0 account get $SOURCE_ADDRESS --host $NODE_REST_URL 2> $null
      $SOURCE_BALANCE=$RESULT | Select-String -Pattern "^value:" | ForEach-Object { $_ -replace "value: ", "" }
      $SOURCE_BALANCE_NICE=$SOURCE_BALANCE -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      if ($null -eq $SOURCE_BALANCE) {
        Write-Output "`nERROR: Cannot (yet) verify the source address balance on the blockchain`n"
        Exit 1
      }
      elseif ($SOURCE_BALANCE -eq "0") {
        Write-Output "`nERROR: The source address balance is 0`n"
        Exit 1
      }
      else {
        Write-Output "`nINFO: This wallet file has a balance of $SOURCE_BALANCE_NICE`n"
      }

      $SOURCE_COUNTER=$RESULT | Select-String -Pattern "^counter:" | ForEach-Object { $_ -replace "counter: ", "" }

      # Read the node's blockchain settings (parameters are required for the next transactions)
      $SETTINGS=& $CURL -s ${NODE_REST_URL}/v0/settings
      $FEE_CONSTANT=$SETTINGS | jq -r .fees.constant | ForEach-Object { $_ -as [uint64] }
      $FEE_COEFFICIENT=$SETTINGS | jq -r .fees.coefficient | ForEach-Object { $_ -as [uint64] }
      $FEE_CERTIFICATE_STAKE_DELEGATION=$SETTINGS | jq -r .fees.per_certificate_fees.certificate_stake_delegation | ForEach-Object { $_ -as [uint64] }
      $BLOCK0_HASH=$SETTINGS | jq -r .block0Hash
      $FEES=$FEE_CONSTANT + $FEE_COEFFICIENT + $FEE_CERTIFICATE_STAKE_DELEGATION
      $FEES_NICE=$FEES -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      $AMOUNT_WITH_FEES=$FEES
      $AMOUNT_WITH_FEES_NICE=$FEES_NICE

      if ($AMOUNT_WITH_FEES -gt $SOURCE_BALANCE) {
        Write-Output "`nERROR: Source wallet `"$WALLET_NAME`" has a balance of: $SOURCE_BALANCE_NICE"
        Write-Output "ERROR: This is not enough to pay the delegation fee: $FEES_NICE in fees`n"
        Exit 1
      }

      # Test for a pre-existing stake delegation certificate and warn if needed
      if ((Test-Path -Path $STAKE_DLG_certfile) -And ($o -eq $false)) {
        Write-Output "`nERROR: A pre-existing stake delegation certification for this wallet exists at:"
        Write-Output "  $STAKE_DLG_certfile"
        Write-Output "`nRe-run this command with the ``-o`` option to overwrite to create and submit a new delegation certificate`n"
        Exit 1
      }

      # Build stake delegation certificate
      & $CLI certificate new stake-delegation $SOURCE_PUB $POOL_ID | `
        Tee-Object -Variable STAKE_DLG_cert | Out-File -Encoding Default $STAKE_DLG_certfile

      # The signed delegation certificate is only used if including the delegation in the genesis block
      $STAKE_DLG_cert | & $CLI certificate sign -k $SOURCE_KEY_file | `
        Tee-Object -Variable STAKE_DLG_signed | Out-File -Encoding Default $STAKE_DLG_signedfile

      $STAGING_FILE=New-TemporaryFile
      $WITNESS_SECRET_FILE=New-TemporaryFile
      $WITNESS_OUTPUT_FILE=New-TemporaryFile
      & $CLI transaction new --staging $STAGING_FILE
      & $CLI transaction add-account $SOURCE_ADDRESS $AMOUNT_WITH_FEES --staging $STAGING_FILE
      & $CLI transaction add-certificate --staging $STAGING_FILE $STAKE_DLG_cert
      & $CLI transaction finalize --staging $STAGING_FILE
      $TRANSACTION_ID=& $CLI transaction data-for-witness --staging $STAGING_FILE
      $SOURCE_KEY | Out-File -Encoding Default $WITNESS_SECRET_FILE

      & $CLI transaction make-witness $TRANSACTION_ID `
        --genesis-block-hash $BLOCK0_HASH `
        --type "account" --account-spending-counter $SOURCE_COUNTER `
        $WITNESS_OUTPUT_FILE $WITNESS_SECRET_FILE
      & $CLI transaction add-witness $WITNESS_OUTPUT_FILE --staging $STAGING_FILE

      # Finalize the transaction and send it
      & $CLI transaction seal --staging $STAGING_FILE
      & $CLI transaction auth --staging $STAGING_FILE -k $SOURCE_KEY_FILE
      $TXID=& $CLI transaction to-message --staging $STAGING_FILE | & $CLI rest v0 message post --host $NODE_REST_URL

      Remove-Item -Path $STAGING_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null
      Remove-Item -Path $WITNESS_SECRET_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null
      Remove-Item -Path $WITNESS_OUTPUT_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null

      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      say "Delegate wallet `"${WALLET_NAME}`" to pool `"${POOL_NAME}`"" "log"
      say "  Pool-ID:    $POOL_ID" "log"
      say "  Source:     $SOURCE_ADDRESS" "log"
      say "  Stake:      $SOURCE_BALANCE_NICE" "log"
      say "  Fees:       $AMOUNT_WITH_FEES_NICE" "log"
      say "  TX-ID:      $TXID" "log"
      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      Break
    }
    Default {
      Write-Output "`nNo such subcommand: $SUBCOMMAND`n"
      usage
      Break
    }
  }
}

function pool() {
  Switch($SUBCOMMAND) {
    # jtools pool register <POOL_NAME> <WALLET_NAME> <POOL_TICKER> <POOL_URL> [-a <REWARD_ACCOUNT>] [-l <TAX_LIMIT>] [-r <TAX_RATIO>] [-f <TAX_FIXED>]"
    "register" {
      if ($PARAMS -lt 6) {
        usage
      }

      $POOL_NAME=$3
      $WALLET_NAME=$4
      $POOL_TICKER=$5
      $POOL_URL=$6

      $POOL_OPTIONS=""
      if ($a -ne "") { $POOL_OPTIONS+=" --reward-account $a" }
      if ($l -ne "") { $POOL_OPTIONS+=" --tax-limit $l"      }
      if ($r -ne "") { $POOL_OPTIONS+=" --tax-ratio $r"      }
      if ($f -ne "") { $POOL_OPTIONS+=" --tax-fixed $f"      }

      if (Test-Path -Path "${POOL_FOLDER}\${POOL_NAME}\stake_pool.id") {
        Write-Output "`nERROR: Pool `"$POOL_NAME`" already exists (${POOL_FOLDER}\${POOL_NAME}\stake_pool.id)`n"
        Exit 1
      }

      if (Test-Path -Path "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account") {
        $SOURCE_ADDRESS=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account"
        $SOURCE_KEY=Get-Content "${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key"
        $SOURCE_KEY_FILE="${WALLET_FOLDER}\${WALLET_NAME}\ed25519.key"
      }
      else {
        Write-Output "`nINFO: No wallet `"$WALLET_NAME`" found (${WALLET_FOLDER}\${WALLET_NAME}\ed25519.account)`n"
        Exit 1
      }

      # Get the source wallet's state
      $RESULT=& $CLI rest v0 account get $SOURCE_ADDRESS --host $NODE_REST_URL 2> $null
      $SOURCE_BALANCE=$RESULT | Select-String -Pattern "^value:" | ForEach-Object { $_ -replace "value: ", "" }
      $SOURCE_BALANCE_NICE=$SOURCE_BALANCE -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      if ($null -eq $SOURCE_BALANCE) {
        Write-Output "`nERROR: Cannot (yet) verify the source address balance on the blockchain`n"
        Exit 1
      }
      elseif ($SOURCE_BALANCE -eq "0") {
        Write-Output "`nERROR: The source address balance is 0`n"
        Exit 1
      }
      else {
        Write-Output "`nINFO: This wallet file has a balance of $SOURCE_BALANCE_NICE`n"
      }

      $SOURCE_COUNTER=$RESULT | Select-String -Pattern "^counter:" | ForEach-Object { $_ -replace "counter: ", "" }

      # Read the node's blockchain settings (parameters are required for the next transactions)
      $SETTINGS=& $CURL -s ${NODE_REST_URL}/v0/settings
      $FEE_CONSTANT=$SETTINGS | jq -r .fees.constant | ForEach-Object { $_ -as [uint64] }
      $FEE_COEFFICIENT=$SETTINGS | jq -r .fees.coefficient | ForEach-Object { $_ -as [uint64] }
      $FEE_POOL_REGISTRATION=$SETTINGS | jq -r .fees.per_certificate_fees.certificate_pool_registration | ForEach-Object { $_ -as [uint64] }
      $BLOCK0_HASH=$SETTINGS | jq -r .block0Hash
      $FEES=$FEE_CONSTANT + $FEE_COEFFICIENT + $FEE_POOL_REGISTRATION
      $FEES_NICE=$FEES -as [uint64] | ForEach-Object { '{0:N0} Lovelaces' -f $_ }
      $AMOUNT_WITH_FEES=$FEES
      $AMOUNT_WITH_FEES_NICE=$FEES_NICE

      if ($AMOUNT_WITH_FEES -gt $SOURCE_BALANCE) {
        Write-Output "`nERROR: Source wallet `"$WALLET_NAME`" has a balance of: $SOURCE_BALANCE_NICE"
        Write-Output "ERROR: This is not enough to pay the registration fee: $FEES_NICE in fees`n"
        Exit 1
      }

      New-Item -ItemType Directory -Force -Path "${POOL_FOLDER}\$POOL_NAME" | Out-Null

      # Create pool owner wallet
      $POOL_ED25519_file="${POOL_FOLDER}\${POOL_NAME}\stake_pool_owner_wallet.key"
      & $CLI key generate --type=Ed25519 | Tee-Object -Variable POOL_ED25519_key |  Out-File -Encoding Default $POOL_ED25519_file

      $POOL_ED25519_pubfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool_owner_wallet.pub"
      $POOL_ED25519_key | & $CLI key to-public | Tee-Object -Variable POOL_ED25519_pub | Out-File -Encoding Default $POOL_ED25519_pubfile

      # Extract account address from wallet key
      $POOL_ED25519_addrfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool_owner_wallet.address"
      & $CLI address account --prefix addr $POOL_ED25519_pub --testing | Tee-Object -Variable POOL_ED25519_address | Out-File -Encoding Default $POOL_ED25519_addrfile

      # Generate pool KES keys
      $POOL_KES_file="${POOL_FOLDER}\${POOL_NAME}\stake_pool_kes.key"
      & $CLI key generate --type=SumEd25519_12 | Tee-Object -Variable POOL_KES_key |  Out-File -Encoding Default $POOL_KES_file

      $POOL_KES_pubfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool_kes.pub"
      $POOL_KES_key | & $CLI key to-public | Tee-Object -Variable POOL_KES_pub | Out-File -Encoding Default $POOL_KES_pubfile

      # Generate pool VRF keys
      $POOL_VRF_file="${POOL_FOLDER}\${POOL_NAME}\stake_pool_vrf.key"
      & $CLI key generate --type=Curve25519_2HashDH | Tee-Object -Variable POOL_VRF_key |  Out-File -Encoding Default $POOL_VRF_file

      $POOL_VRF_pubfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool_vrf.pub"
      $POOL_VRF_key | & $CLI key to-public | Tee-Object -Variable POOL_VRF_pub | Out-File -Encoding Default $POOL_VRF_pubfile

      # Build stake pool certificate
      $POOL_CRT_certfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool.cert"
      $CMD_STRING="$CLI certificate new stake-pool-registration"
      $CMD_STRING+=" --kes-key $POOL_KES_pub"
      $CMD_STRING+=" --vrf-key $POOL_VRF_pub"
      $CMD_STRING+=" --owner $POOL_ED25519_pub"
      $CMD_STRING+=" --management-threshold 1"
      $CMD_STRING+=" --start-validity 0"
      $CMD_STRING+=" $POOL_OPTIONS"
      Invoke-Expression $CMD_STRING | Tee-Object -Variable POOL_CRT_cert | Out-File -Encoding Default $POOL_CRT_certfile

      # Sign the stake pool certificate with the pool owner wallet
      # Note that the signed certificate is only needed if the stake pool will be used directly in a genesis block
      $POOL_CRT_signedfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool.signcert"
      $POOL_CRT_cert | & $CLI certificate sign -k $POOL_ED25519_file | Tee-Object -Variable POOL_CRT_signed | Out-File -Encoding Default $POOL_CRT_signedfile
      # Get the stake pool ID
      $POOL_ID_file="${POOL_FOLDER}\${POOL_NAME}\stake_pool.id"
      $POOL_CRT_cert | & $CLI certificate get-stake-pool-id | Tee-Object -Variable POOL_ID | Out-File -Encoding Default $POOL_ID_file
      # Note pool-ID, vrf and KES keys into a secret file
      $SECRET_YAML_file="${POOL_FOLDER}\${POOL_NAME}\secret.yaml"
      & $JQ -n ".genesis.node_id = \`"$POOL_ID\`" | .genesis.vrf_key = \`"$POOL_VRF_key\`" | .genesis.sig_key = \`"$POOL_KES_key\`"" | `
        Tee-Object -Variable SECRET_YAML | Out-File -Encoding Default $SECRET_YAML_file
      $POOL_JSON_file="${POOL_FOLDER}\${POOL_NAME}\stake_pool_owner_wallet.json"
      $POOL_JSON_signedfile="${POOL_FOLDER}\${POOL_NAME}\stake_pool_owner_wallet.sig"
      & $JQ -n ".owner = \`"$POOL_ED25519_pub\`" | .name = \`"$POOL_NAME\`" | .ticker = \`"$POOL_TICKER\`" | .homepage = \`"$POOL_URL\`" | .pledge_address = \`"$POOL_ED25519_address\`"" | `
        Tee-Object -Variable POOL_JSON | Out-File -Encoding Default $POOL_JSON_file
      & $CLI key sign --secret-key $POOL_ED25519_file --output $POOL_JSON_signedfile $POOL_JSON_file
      $STAGING_FILE=New-TemporaryFile
      $WITNESS_SECRET_FILE=New-TemporaryFile
      $WITNESS_OUTPUT_FILE=New-TemporaryFile
      & $CLI transaction new --staging $STAGING_FILE
      & $CLI transaction add-account $SOURCE_ADDRESS $AMOUNT_WITH_FEES --staging $STAGING_FILE
      & $CLI transaction add-certificate --staging $STAGING_FILE $POOL_CRT_cert
      & $CLI transaction finalize `
        --fee-constant $FEE_CONSTANT `
        --fee-coefficient $FEE_COEFFICIENT `
        --fee-pool-registration $FEE_POOL_REGISTRATION `
        --staging $STAGING_FILE
      $TRANSACTION_ID=& $CLI transaction data-for-witness --staging $STAGING_FILE
      $SOURCE_KEY | Out-File -Encoding Default $WITNESS_SECRET_FILE
      & $CLI transaction make-witness $TRANSACTION_ID `
        --genesis-block-hash $BLOCK0_HASH `
        --type "account" --account-spending-counter $SOURCE_COUNTER `
        $WITNESS_OUTPUT_FILE $WITNESS_SECRET_FILE
      & $CLI transaction add-witness $WITNESS_OUTPUT_FILE --staging $STAGING_FILE

      # Finalize the transaction and send it
      & $CLI transaction seal --staging $STAGING_FILE
      & $CLI transaction auth --staging $STAGING_FILE -k $POOL_ED25519_file
      $TXID=& $CLI transaction to-message --staging $STAGING_FILE | & $CLI rest v0 message post --host $NODE_REST_URL

      Remove-Item -Path $STAGING_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null
      Remove-Item -Path $WITNESS_SECRET_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null
      Remove-Item -Path $WITNESS_OUTPUT_FILE -Confirm:$false -Force -ErrorAction SilentlyContinue | Out-Null

      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      say "Registered a new pool: `"$POOL_NAME`"" "log"
      say "  Pool-ID:    $POOL_ID" "log"
      say "  Fees:       $AMOUNT_WITH_FEES_NICE" "log"
      say "  TX-ID:      $TXID" "log"
      say "" "log"
      say "Upload the following files to the stake pool registry:" "log"
      say "  `"$POOL_JSON_file`"" "log"
      say "  `"$POOL_JSON_signedfile`"" "log"
      say "`n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`n"
      Break
    }
    "show" {
      if ($PARAMS -lt 2) {
        usage
      }
      $RESULT=& $CLI rest v0 stake-pools get --host $NODE_REST_URL --output-format json 2> $null
      Write-Output "`nRegistered stake pools are:`n"
      Write-Output ($RESULT | Out-String)
      Break
    }
    Default {
      Write-Output "`nNo such subcommand: $SUBCOMMAND`n"
      usage
      Break
    }
  }
}

function check() {
  Switch($SUBCOMMAND) {
    "tx" {
      if ($PARAMS -lt 3) {
        usage
      }
      $TX_ID = $3
      $RESULT=& $CLI rest v0 message logs --host $NODE_REST_URL --output-format json 2> $null
      $TX_STATUS=$RESULT | jq  ".[] | select (.fragment_id == \`"$TX_ID\`")" 2> $null
      Write-Output "`nStatus of TX_ID `"$TX_ID`" is:`n"
      if ($null -ne $TX_STATUS) {
        Write-Output ($TX_STATUS | Out-String)
      }
      else {
        Write-Output "ERROR: TX_ID not found`n"
      }
      Break
    }
    "node" {
      if ($PARAMS -lt 3) {
        usage
      }
      Switch($3) {
        "stats" {
          $RESULT=& $CLI rest v0 node stats get --host $NODE_REST_URL --output-format json 2> $null
          Write-Output "`nStatus of this node is:`n"
          if ($null -ne $RESULT) {
            Write-Output ($RESULT | Out-String)
          }
          else {
            Write-Output "ERROR: Node status not found`n"
          }
          Break
        }
        "settings" {
          $RESULT=& $CLI rest v0 settings get --host $NODE_REST_URL --output-format json 2> $null
          Write-Output "`nSettings of this node are:`n"
          if ($null -ne $RESULT) {
            Write-Output ($RESULT | Out-String)
          }
          else {
            Write-Output "ERROR: Node settings not found`n"
          }
          Break
        }
        Default {
          Write-Output "`nNo such `"check node`" subcommand: $3`n"
          usage
          Break
        }
      }
    }
    Default {
      Write-Output "`nNo such subcommand: $SUBCOMMAND`n"
      usage
      Break
    }
  }
}

function update() {
  Write-Output "`nTo update jtools and jormungandr on Windows, from an administrative PowerShell:`n"
  Write-Output "  choco upgrade jormungandr`n"
}

function main() {
  if ($PARAMS -lt 1) {
    usage
  }

  # Check for required command line tools
  need_cmd $CURL
  need_cmd $JQ

  Switch ($OPERATION) {
    "wallet"  { wallet; Break }
    "funds"   { funds;  Break }
    "check"   { check;  Break }
    "pool"    { pool;   Break }
    "stake"   { stake;  Break }
    "update"  { update;  Break }
    "version" { version; Break }
    Default {
      Write-Output "`nNo such operation: $OPERATION`n"
      usage
      Break
    }
  }
}

main
Exit
tools\LICENSE.txt
From: https://github.com/input-output-hk/jormungandr/blob/master/LICENSE-APACHE

                              Apache License
                        Version 2.0, January 2004
                     http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

   "License" shall mean the terms and conditions for use, reproduction,
   and distribution as defined by Sections 1 through 9 of this document.

   "Licensor" shall mean the copyright owner or entity authorized by
   the copyright owner that is granting the License.

   "Legal Entity" shall mean the union of the acting entity and all
   other entities that control, are controlled by, or are under common
   control with that entity. For the purposes of this definition,
   "control" means (i) the power, direct or indirect, to cause the
   direction or management of such entity, whether by contract or
   otherwise, or (ii) ownership of fifty percent (50%) or more of the
   outstanding shares, or (iii) beneficial ownership of such entity.

   "You" (or "Your") shall mean an individual or Legal Entity
   exercising permissions granted by this License.

   "Source" form shall mean the preferred form for making modifications,
   including but not limited to software source code, documentation
   source, and configuration files.

   "Object" form shall mean any form resulting from mechanical
   transformation or translation of a Source form, including but
   not limited to compiled object code, generated documentation,
   and conversions to other media types.

   "Work" shall mean the work of authorship, whether in Source or
   Object form, made available under the License, as indicated by a
   copyright notice that is included in or attached to the work
   (an example is provided in the Appendix below).

   "Derivative Works" shall mean any work, whether in Source or Object
   form, that is based on (or derived from) the Work and for which the
   editorial revisions, annotations, elaborations, or other modifications
   represent, as a whole, an original work of authorship. For the purposes
   of this License, Derivative Works shall not include works that remain
   separable from, or merely link (or bind by name) to the interfaces of,
   the Work and Derivative Works thereof.

   "Contribution" shall mean any work of authorship, including
   the original version of the Work and any modifications or additions
   to that Work or Derivative Works thereof, that is intentionally
   submitted to Licensor for inclusion in the Work by the copyright owner
   or by an individual or Legal Entity authorized to submit on behalf of
   the copyright owner. For the purposes of this definition, "submitted"
   means any form of electronic, verbal, or written communication sent
   to the Licensor or its representatives, including but not limited to
   communication on electronic mailing lists, source code control systems,
   and issue tracking systems that are managed by, or on behalf of, the
   Licensor for the purpose of discussing and improving the Work, but
   excluding communication that is conspicuously marked or otherwise
   designated in writing by the copyright owner as "Not a Contribution."

   "Contributor" shall mean Licensor and any individual or Legal Entity
   on behalf of whom a Contribution has been received by Licensor and
   subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   copyright license to reproduce, prepare Derivative Works of,
   publicly display, publicly perform, sublicense, and distribute the
   Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   (except as stated in this section) patent license to make, have made,
   use, offer to sell, sell, import, and otherwise transfer the Work,
   where such license applies only to those patent claims licensable
   by such Contributor that are necessarily infringed by their
   Contribution(s) alone or by combination of their Contribution(s)
   with the Work to which such Contribution(s) was submitted. If You
   institute patent litigation against any entity (including a
   cross-claim or counterclaim in a lawsuit) alleging that the Work
   or a Contribution incorporated within the Work constitutes direct
   or contributory patent infringement, then any patent licenses
   granted to You under this License for that Work shall terminate
   as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
   Work or Derivative Works thereof in any medium, with or without
   modifications, and in Source or Object form, provided that You
   meet the following conditions:

   (a) You must give any other recipients of the Work or
       Derivative Works a copy of this License; and

   (b) You must cause any modified files to carry prominent notices
       stating that You changed the files; and

   (c) You must retain, in the Source form of any Derivative Works
       that You distribute, all copyright, patent, trademark, and
       attribution notices from the Source form of the Work,
       excluding those notices that do not pertain to any part of
       the Derivative Works; and

   (d) If the Work includes a "NOTICE" text file as part of its
       distribution, then any Derivative Works that You distribute must
       include a readable copy of the attribution notices contained
       within such NOTICE file, excluding those notices that do not
       pertain to any part of the Derivative Works, in at least one
       of the following places: within a NOTICE text file distributed
       as part of the Derivative Works; within the Source form or
       documentation, if provided along with the Derivative Works; or,
       within a display generated by the Derivative Works, if and
       wherever such third-party notices normally appear. The contents
       of the NOTICE file are for informational purposes only and
       do not modify the License. You may add Your own attribution
       notices within Derivative Works that You distribute, alongside
       or as an addendum to the NOTICE text from the Work, provided
       that such additional attribution notices cannot be construed
       as modifying the License.

   You may add Your own copyright statement to Your modifications and
   may provide additional or different license terms and conditions
   for use, reproduction, or distribution of Your modifications, or
   for any such Derivative Works as a whole, provided Your use,
   reproduction, and distribution of the Work otherwise complies with
   the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
   any Contribution intentionally submitted for inclusion in the Work
   by You to the Licensor shall be under the terms and conditions of
   this License, without any additional terms or conditions.
   Notwithstanding the above, nothing herein shall supersede or modify
   the terms of any separate license agreement you may have executed
   with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
   names, trademarks, service marks, or product names of the Licensor,
   except as required for reasonable and customary use in describing the
   origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
   agreed to in writing, Licensor provides the Work (and each
   Contributor provides its Contributions) on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   implied, including, without limitation, any warranties or conditions
   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
   PARTICULAR PURPOSE. You are solely responsible for determining the
   appropriateness of using or redistributing the Work and assume any
   risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
   whether in tort (including negligence), contract, or otherwise,
   unless required by applicable law (such as deliberate and grossly
   negligent acts) or agreed to in writing, shall any Contributor be
   liable to You for damages, including any direct, indirect, special,
   incidental, or consequential damages of any character arising as a
   result of this License or out of the use or inability to use the
   Work (including but not limited to damages for loss of goodwill,
   work stoppage, computer failure or malfunction, or any and all
   other commercial damages or losses), even if such Contributor
   has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
   the Work or Derivative Works thereof, You may choose to offer,
   and charge a fee for, acceptance of support, warranty, indemnity,
   or other liability obligations and/or rights consistent with this
   License. However, in accepting such obligations, You may act only
   on Your own behalf and on Your sole responsibility, not on behalf
   of any other Contributor, and only if You agree to indemnify,
   defend, and hold each Contributor harmless for any liability
   incurred by, or claims asserted against, such Contributor by reason
   of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

   To apply the Apache License to your work, attach the following
   boilerplate notice, with the fields enclosed by brackets "[]"
   replaced with your own identifying information. (Don't include
   the brackets!)  The text should be enclosed in the appropriate
   comment syntax for the file format. We also recommend that a
   file or class name and description of purpose be included on the
   same "printed page" as the copyright notice for easier
   identification within third-party archives.

Copyright (c) 2018-2019 Input Output HK

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.Insert License Here>
tools\release.zip
md5: 1D95B0F93C641A526EB34623580FD264 | sha1: FA7DCE3209CFD17E5B0C8CA9723112F830629FCD | sha256: 68D38A87B0F929B85F4127EC62CAD0DF00823FF2CDBE33B52FC97C7B8F3560EC | sha512: A2DEC0069B2390C548253AC5488D3E310CEC186B6C5E3D7B475FFC63D377732A8438FC3954F9F485FE92411F88225F9F0FAC4942E75B7C0235997FA63A03D2F6
tools\VERIFICATION.txt
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

This package is published by Input Output HK Limited.  The binaries included
in this Chocolately package are compiled from source and released from the
Jormungandr github repo:

https://github.com/input-output-hk/jormungandr

These binaries are then digitally signed by Input Output HK Limited using
a certificate issued by DigiCert EV Code Signing CA.

To verify these Jormungandr Chocolatey binaries are authentic, use the
following procedure to verify the digital signature on each:

1) Navigate to the path of the Jormungandr binaries from the Chocolatey
package.  For example:
C:\ProgramData\chocolatey\lib\jormungandr\tools

2) For each of the Jormungandr binaries (jcli.exe and jormungandr.exe),
complete the following:

a) Right click on the binary and select "Properties" from the context menu

b) Select the "Digital Signatures" tab of the Properties menu by left
clicking

c) Verify in the signature list the name of the signer is
"Input Output HK Limited"

d) Left click on the "Input Output HK Limited" signer and then left click
the "Details" button

e) Verify the statement "This digital signature is OK" is present under
"Digital Signature Information"

f) Left click the "View Certificate" button

g) Under the "General" tab, verify the certificate "Issued by" field is
"DigiCert EV Code Signing CA (SHA256)"

h) Left click the "Details" tab of the Certficate menu

i) In the list of fields, scroll down to find the "Thumbprint" field and
verify it matches: "dcfd5ae14fcf6c13f7f7fc59d005dd7cfedfa212"

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
jormungandr (Install) 0.6.5 316 Monday, October 21, 2019 Approved
jormungandr (Install) 0.6.1 103 Thursday, October 17, 2019 Approved
jormungandr (Install) 0.5.6 127 Monday, October 7, 2019 Approved
jormungandr (Install) 0.5.5 105 Wednesday, October 2, 2019 Approved
jormungandr (Install) 0.5.2 121 Friday, September 27, 2019 Approved
jormungandr (Install) 0.3.3 162 Thursday, August 22, 2019 Approved
jormungandr (Install) 0.3.2 125 Thursday, August 8, 2019 Approved
jormungandr (Install) 0.3.1 124 Monday, July 22, 2019 Approved
jormungandr (Install) 0.2.4 133 Friday, July 19, 2019 Approved

This package has no dependencies.

Discussion for the jormungandr (Install) Package

Ground Rules:

  • This discussion is only about jormungandr (Install) and the jormungandr (Install) package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or jormungandr (Install), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus