PHPH1 elephant logo

Description

Parameters

  • No Parameters Required

Returns

  • Object:
  • blocks-per-epoch - Number:
    Number of blocks per epoch (only available on Shard 0)
  • blskey - Array:
    List of BLS keys on the node
  • chain-config - Object
    :
    • aggregated-reward-epoch - Number:
      FIXME
    • chain-id - Number:
      Chain ID for the network
    • commission-promo-period - Number:
      FIXME
    • cross-link-epoch - Number:
      Epoch at which cross links were enabled
    • cross-tx-epoch - Number:
      Epoch at which cross cross shard transactions were enabled
    • data-copy-fix-epoch - Number:
      FIXME
    • eip155-epoch - Number:
      Epoch at with EIP155 was enabled
    • epos-bound-35-epoch - Number:
      FIXME
    • eth-compatible-chain-id - Number:
      FIXME
    • eth-compatible-epoch - Number:
      FIXME
    • five-seconds-epoch - Number:
      FIXME
    • hip6_8-epoch - Number:
      FIXME
    • istanbul-epoch - Number:
      FIXME
    • min-commission-rate-epoch - Number:
      FIXME
    • min-delegation-100-epoch - Number:
      FIXME
    • no-early-unlock-epoch - Number:
      FIXME
    • prestaking-epoch - Number:
      Epoch at which pre-staking began
    • prev-vrf-epoch - Number:
      FIXME
    • quick-unlock-epoch - Number:
      Epoch at which undelegations unlocked in one epoch
    • receipt-log-epoch - Number:
      Epoch at which receipt logs were enabled
    • redelegation-epoch - Number:
      FIXME
    • s3-epoch - Number:
      Epoch at which Mainnet V0 was launched
    • sha3-epoch - Number:
      FIXME
    • sixty-percent-epoch - Number:
      FIXME
    • staking-epoch - Number:
      Epoch at which staking was enabled
    • staking-precompile-epoch - Number:
      FIXME
    • two-seconds-epoch - Number:
      FIXME
    • vrf-epoch - Number:
      FIXME
  • consensus - Array
    • blocknum - Number:
      FIXME
    • finality - Number:
      FIXME
    • mode - String:
      FIXME
    • phase - String:
      FIXME
    • viewChangeId - Number:
      FIXME
    • viewId - Number:
      FIXME
  • current-block-number - Number:
    Current block number
  • current-epoch - Number:
    Current epoch
  • dns-zone - String:
    Name of the DNS zone
  • is-archival - Bool:
    Whether the node is currently in state pruning mode or not
  • is-backup - Bool:
    FIXME
  • is-leader - Bool:
    Whether the node is currently leader or not
  • network - String:
    Network name that the node is on (Mainnet or Testnet)
  • node-unix-start-time - Number:
    Start time of node in Unix time
  • p2p-connectivity - Object:
    • total-known-peers - Number:
      Number of known peers
    • connected - Number:
      Number of connected peers
    • not-connected - Number:
      Number known peers not connected
  • peerid - String:
    FIXME
  • role - String:
    Node type (Validator or ExplorerNode)
  • shard-id - Number:
    Shard that the node is on
  • version - String:
    Harmony binary version
{"jsonrpc":"2.0","id":1,"method":"hmyv2_getNodeMetadata","params":[]}			

<script>
// In a production environment this function should probably be expanded with response and error checks etc.
async function getHMYV2Data(){
	// This URL is for mainnet shard 0
  let response = await fetch('https://a.api.s0.t.hmny.io/', {
    method: "POST",
    body: '{"jsonrpc":"2.0","id":1,"method":"hmyv2_getNodeMetadata","params":[]}',
    headers: { "Content-type": "application/json" }
  });

  let mydata = await response.json();

  // Check the console for output
  console.log("method data:" + JSON.stringify(mydata));
  // What you do with the returned data after this is up to you
}

// Run the getHMYV2Data function
getHMYV2Data();
</script>
	

<script>
// You can reuse this function with multiple methods
// In a production environment this function should probably be expanded with response and error checks etc.
async function getPHPH1Data(url, formdata){
  let response = await fetch(url, {
    method: "POST",
    body: formdata,
    headers: { "Content-type": "application/x-www-form-urlencoded" }
  });

  let mydata = await response.json();

  // Check the console for output
  console.log("method data:" + JSON.stringify(mydata));
  // What you do with the returned data after this is up to you
}

// This is the call URL. It will always require the method being used to be sent in the URL
// Depending on your setup, you may need to adjust the path to this url
// For example: /your/path/to/phph1/phph1_call.php?method=hmyv2_getNodeMetadata
var url = "phph1_call.php?method=hmyv2_getNodeMetadata";

// The formdata variable is always set
// Even if there is no form data we need the dorequest sent
var formdata = "dorequest=1";

// Run the getPHPH1Data function
getPHPH1Data(url, formdata);
</script>