Block

All block commands are below and detailed on related sections.

Get blocks

post

This endpoint lists the blocks created on the PIRI network, based on the skip and limit parameters provided to it.

Body
skipnumberOptional

Page count for skip according to limit value.

Default: 0
limitnumber · max: 100Optional

Record count for per page

Default: 10
Responses
200

OK

application/json; charset=utf-8
post
POST /getBlocks HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 21

"skip=0&limit=10"
200

OK

{
  "data": [
    {
      "confirmed": true,
      "_id": "632c4c52dfdaed5ef81c03a9",
      "validators": [
        {
          "_id": "632c4c53dfdaed5ef81c03b0",
          "dateTime": "2022-09-22T11:51:47.123Z",
          "nodeName": "CELEBI",
          "nodeAddress": "PRTMQiQLHuZQvtzgp89yf6U7UjXu8eNDMddLztYGzq8",
          "result": 1
        }
      ],
      "producerAddress": "PRTMQYA88SNPwNjZVegDNE1PKi1ijxRLXWfZ6xMQSx6",
      "totalFee": 0,
      "blockHeight": 1,
      "previousHash": "0000000000000000000000000000000000000000000000000000000000000000",
      "hash": "ed74d06294ad76bf1420a433e5b2b06903785f42f7c55a4e77485cb389c41a7e",
      "checkSum": "daf417057bdafa89b25cea9d6d197c01e8b039565415c3b1fcecba0105f120ef",
      "timeStamp": 1663847506859,
      "__v": 3,
      "confirmCount": 3
    }
  ],
  "count": 3391000
}

Get blocks with transaction count

post

This endpoint lists the blocks created in the PIRI network, similar to the getBlocks endpoint, but the resulting schema also includes the trxCount information for each block.

Body
skipnumberOptional

Page count for skip according to limit value.

Default: 0
limitnumber · max: 100Optional

Record count for per page

Default: 10
Responses
200

OK

application/json; charset=utf-8
post
POST /getBlocksWithTransactionCount HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 21

"skip=0&limit=10"
200

OK

{
  "data": [
    {
      "confirmed": true,
      "_id": "632c4d24dfdaed5ef81c0624",
      "validators": [
        {
          "_id": "632c4d25dfdaed5ef81c062b",
          "dateTime": "2022-09-22T11:55:17.041Z",
          "nodeName": "BIRUNI",
          "nodeAddress": "PRTMRfynW6oXR1VuY8hsdpazd7nVR49X1NhGHyrnUxi",
          "result": 1
        }
      ],
      "producerAddress": "PRTMQYA88SNPwNjZVegDNE1PKi1ijxRLXWfZ6xMQSx6",
      "totalFee": 0,
      "blockHeight": 22,
      "previousHash": "318b11bca1bf894c09af91618264944d2e43aedb869813f7b5c05040459f8dcb",
      "hash": "c27b29e00c160637dc0fa3a5b101287cc8abd5b6a9a0e7e9ddaf0b72277879a7",
      "checkSum": "741ae211965a59dd39a5e6a0608201785c61bdc056091b2318d5a029d26d6ae0",
      "timeStamp": 1663847716864,
      "__v": 4,
      "confirmCount": 4,
      "trxCount": 0
    }
  ],
  "count": 3488380
}

Get last blocks with block height

post

This endpoint uses the limit & blockHeight parameters instead of the skip & limit parameters to list blocks created on the PIRI network. The purpose here is to achieve faster results when page control is provided by the application.

Body
limitnumber · max: 100Optional

Record count for per page

Default: 10
blockHeightnumber · max: 100Optional

Block Height (Block Count) to start.

Default: 5
Responses
200

OK

application/json; charset=utf-8
post
POST /getLastBlocksWithBlockHeight HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 28

"limit=10&blockHeight=5"
200

OK

{
  "data": [
    {
      "confirmed": false,
      "_id": "633cc4c0b3e6e20fe85c819d",
      "validators": [],
      "producerAddress": "PRTMQYA88SNPwNjZVegDNE1PKi1ijxRLXWfZ6xMQSx6",
      "totalFee": 0,
      "blockHeight": 10,
      "previousHash": "2b150fbeaba43792c113ebbba53ea2494d6dc80064ce362ad8d7f8b35b880aef",
      "hash": "a983aff0bc072dd13c8d553f041c630cfba71dc295584245ecaf95bce99f7672",
      "checkSum": "fd8efb84cbf46a93945b6dc3b2858fa10727c7b224c46871f0278ea323db18c2",
      "timeStamp": 1664926912761,
      "__v": 0
    }
  ],
  "count": 3346216
}

Get blocks in descending order

post

This endpoint lists the blocks created in the PIRI network in reverse order, based on the skip and limit parameters provided to it. In other words, this endpoint is more convenient for listing newly created blocks.

Body
skipnumberOptional

Page count for skip according to limit value.

Default: 0
limitnumber · max: 100Optional

Record count for per page

Default: 10
Responses
200

OK

application/json; charset=utf-8
post
POST /getBlocksDesc HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 21

"skip=0&limit=10"
200

OK

{
  "data": [
    {
      "confirmed": true,
      "_id": "632b15bc1ca0c3ae24ec3039",
      "validators": [
        {
          "_id": "632b15bd1ca0c3ae24ec3040",
          "dateTime": "2022-09-21T13:46:37.079Z",
          "nodeName": "HAREZMI\n",
          "nodeAddress": "PRTMQYb6BUsVZvXgxXCAucLU4LVxomtudsnJwxfbdF8",
          "result": 1
        }
      ],
      "producerAddress": "PRTMPCMvnDqqABUpmtEBvoPZzhjC8JrLxgAfkb94skM",
      "totalFee": 0,
      "blockHeight": 708569,
      "previousHash": "0b1164cf04f08058c483a2acd5cf57a4d47d732326ad2fe0bb9a636b17483ba0",
      "hash": "9da1ed079bf14e3c48c9db779ce3cd9b818086e838f0b4d8ed6756f8197c9b62",
      "checkSum": "e3265108f41b81f0c2bc5df9612ee1287579b2767d13315246c7243f6dfeff52",
      "timeStamp": 1663767996304,
      "__v": 5,
      "confirmCount": 5
    }
  ],
  "count": 708729
}

Get last blocks

post

This endpoint lists the blocks created in the PIRI network based on the limit parameter provided to it. The value given to the limit parameter signifies listing the last x number of blocks.

Body
limitnumber · min: 5 · max: 100Optional

Record count (descending order)

Default: 10
Responses
200

OK

application/json; charset=utf-8
post
POST /getLastBlocks HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 12

"limit=10"
200

OK

{
  "data": [
    {
      "confirmed": true,
      "_id": "637362168bf56c1f461f8dc6",
      "validators": [
        {
          "_id": "637362168bf56c1f461f8dcd",
          "dateTime": "2022-11-15T09:55:34.956Z",
          "nodeName": "BIRUNI",
          "nodeAddress": "PRTMRfynW6oXR1VuY8hsdpazd7nVR49X1NhGHyrnUxi",
          "result": 1
        }
      ],
      "producerAddress": "PRTMQYA88SNPwNjZVegDNE1PKi1ijxRLXWfZ6xMQSx6",
      "totalFee": 0,
      "blockHeight": 464319,
      "previousHash": "fe9c3e1c1bcc7356c34695704e7cbaf1a30e4dda65dd4c43661ade4faabf8353",
      "hash": "c51ac3ac1203c33a9f558fa7031ef649d1471f5b906d201adda7e8d37fea4142",
      "checkSum": "99f807203ad7b9c38515f629de0873848da77aada85ee92cd4b8cb5e6ba2c1ca",
      "timeStamp": 1668506134478,
      "__v": 4,
      "confirmCount": 4
    }
  ],
  "count": 464321
}

Get only blocks

post

This endpoint lists the blocks created on the PIRI network, based on the skip and limit parameters provided. However, the returned result does not include validatorNodes and transaction information. This makes it suitable for quickly browsing the block list.

Body
skipnumberOptional

Page count for skip according to limit value.

Default: 0
limitnumber · max: 100Optional

Record count for per page

Default: 10
Responses
200

OK

application/json; charset=utf-8
post
POST /getOnlyBlocks HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 21

"skip=0&limit=10"
200

OK

{
  "data": [
    {
      "confirmed": true,
      "_id": "653289c6b92ae195e9336027",
      "validators": [
        {
          "_id": "653289c8b92ae195e933607b",
          "dateTime": "2023-10-20T14:08:08.186Z",
          "nodeName": "FARABI\n",
          "nodeAddress": "PRTMQtUGEN59a3ahBj8W8CSMrRwGkZH8MqpTGZJTqAA",
          "result": 1
        }
      ],
      "producerAddress": "PRTMQYA88SNPwNjZVegDNE1PKi1ijxRLXWfZ6xMQSx6",
      "totalFee": 0,
      "blockHeight": 3391019,
      "previousHash": "31ef240341d11064760343000b44f5beab855c1023e4bebe374b86a22b482b70",
      "hash": "db5165b0e855fde109ade034edfd5e24ebdeb11c7ea08d642cd8294ed7b7a617",
      "checkSum": "57fea802d41fbf02f2209b1a916205d35f3046c883bc222fda5375e4da7365bb",
      "timeStamp": 1697810886177,
      "__v": 11,
      "confirmCount": 11
    }
  ],
  "count": 3391020
}

Get block

post

This endpoint returns the most detailed information related to a block created on the PIRI network. The returned object may include validator nodes, transactions, and custom data information.

Body
blockNumbernumberRequired

Block Number

Responses
200

OK

application/json; charset=utf-8
post
POST /getBlock HTTP/1.1
Host: core.pirichain.com
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 17

"blockNumber=1"
200

OK

{
  "confirmed": true,
  "_id": "6328fcd1f79196bb9585a731",
  "validators": [
    {
      "_id": "6328fcd2f79196bb9585a742",
      "dateTime": "2022-09-19T23:35:46.337Z",
      "nodeName": "CELEBI",
      "nodeAddress": "PRTMQiQLHuZQvtzgp89yf6U7UjXu8eNDMddLztYGzq8",
      "result": 1
    }
  ],
  "producerAddress": "PRTMPCMvnDqqABUpmtEBvoPZzhjC8JrLxgAfkb94skM",
  "totalFee": 0.187,
  "blockHeight": 694837,
  "previousHash": "ee6763d4570f8cfb870b6a0132315594dea5d5d39203a2f91642c97662d9e9b1",
  "hash": "8003d78f5d2b9edc1804a20c860370742cd285eb8d1796e864be3d8f0536538a",
  "checkSum": "9587b3987bbbd649d4f2b06b20f4b0a1a21c5295ea5ff7001d923765e7db69b3",
  "timeStamp": 1663630545430,
  "__v": 4,
  "confirmCount": 4,
  "lastBlock": 708769,
  "trxs": [
    {
      "type": -1,
      "confirmed": true,
      "confirmationCount": 4,
      "_id": "6328fcd1d12279f0098f883a",
      "transactionHash": "0785f48b3c881951cf784c194a264bd31fb94919c978e9f4cec7f2499541f3e2",
      "__v": 4,
      "amount": 0,
      "assetID": -1,
      "blockHeight": 694837,
      "fee": 0.187,
      "from": "PRTMPUAV2mTGq6Dpu9ZBYmJyXWdt9RYiiouvRaZ8xUR",
      "pub": "0413e62afdf947f3d6035ab6afce222e7e5bab394549d6c10b74118578971a264b",
      "signature": "3045022100e4516f2b10bd1858cac3e0f8f56ed26eb7ed23698361e36ae1120ddb82f1f5a3",
      "symbol": "PIRI",
      "timeStamp": 1663630509881,
      "validatorNodes": [
        {
          "_id": "6328fcaef79196bb95859947",
          "nodeName": "BIRUNI",
          "message": "Success",
          "dateTime": "2022-09-19T23:35:10.028Z",
          "result": 1
        }
      ],
      "customDocs": [
        {
          "_id": "6328fcadf79196bb9585992c",
          "txID": "0785f48b3c881951cf784c194a264bd31fb94919c978e9f4cec7f2499541f3e2",
          "key": "courseGrade",
          "value": "98",
          "timeStamp": 1663630509881,
          "from": "PRTMPUAV2mTGq6Dpu9ZBYmJyXWdt9RYiiouvRaZ8xUR",
          "enc": 0,
          "__v": 0,
          "blockHeight": 694837
        }
      ]
    }
  ]
}

Was this helpful?