Skip to content
Simple Google Cloud function to ping TurtleCoin daemons for their /info
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.

TurtleCoin logo on wall


Simple Google Cloud Function to ping TurtleCoin daemons for their /info

Once deployed simply POST a JSON blob at the function's URL like so

curl -X POST \ \
  -H 'Content-Type: application/json' \
  -d '{"url": ""}'

The script will add /info to the end so don't specify that.

Two extra helpful items will also be added to the response blob

    "pingerInfo": {
        "gcpRegion": "asia-east2",
        "time": 76

time is how long the request took in ms. Provided the ENV variable FUNCTION_REGION is set will give the gcpRegion where the function was run from:

  • node.js 8 runtime sets this automatically
  • node.js 10 runtime doesn't set this, needs to be done when deploying

The script is set to timeout after 4 seconds, so if daemon is down the longest the script will run is 4 seconds. It can run longer in certain circumstances so best to limit the script runtime via the --timeout param when deploying


Using the Google Cloud SDK can issue this one liner to deploy it. Make sure you've done a gcloud init, setup prompts to do that.

gcloud functions deploy getInfo --runtime nodejs10 --trigger-http --memory=128M --timeout 5 --region=us-east4 --set-env-vars=FUNCTION_REGION=us-east4 --max-instances=5 --entry-point=getInfo

Can also deploy via the web console.

These are the regions currently available

  • europe-west2 - England
  • europe-west1 - Belgium
  • us-east4 - Northern Virginia
  • us-central1 - Iowa
  • us-east1 - South Carolina
  • asia-east2 - Hong Kong
  • asia-northeast1 - Tokyo


Copyright 2019 Nicholas Orr. All Rights Reserved.
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file

Photo by Damon Lam on Unsplash

You can’t perform that action at this time.