Auth module: Endpoint reference

This page summarizes all available API endpoints of the Auth module.

Endpoints can be invoked as explained in the Connecting via endpoints guide.

auth_getAuthAccount

This endpoint returns the nonce of an account, and lists the required keys for signing transactions. For multi-signature accounts, the value of numberOfSignatures is always > 1.

  • Specification

  • Node CLI

  • cURL

Table 1. Parameters
Name Type Description Sample

address

string

The Klayr32 address to query.

kly24cd35u4jdq8szo3pnsqe5dsxwrnazyqqqg5eu

klayr-core endpoint:invoke auth_getAuthAccount '{ "address": "kly24cd35u4jdq8szo3pnsqe5dsxwrnazyqqqg5eu" }' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "auth_getAuthAccount",
    "params": {
         "address": "kly24cd35u4jdq8szo3pnsqe5dsxwrnazyqqqg5eu"
    }
}'
Response
Example output
{
  "nonce": "0",
  "numberOfSignatures": 0,
  "mandatoryKeys": [],
  "optionalKeys": []
}

If there is no entry corresponding to address, it throws an error.

auth_getMultiSigRegMsgSchema

Returns the params schema for the registerMultisignature command of the Auth module.

  • Specification

  • Node CLI

  • cURL

No parameters.

klayr-core endpoint:invoke auth_getMultiSigRegMsgSchema --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "auth_getMultiSigRegMsgSchema",
    "params": {}
}'
Response
Example output
{
  "schema": {
    "$id": "/auth/command/regMultisigMsg",
    "type": "object",
    "required": [
      "address",
      "nonce",
      "numberOfSignatures",
      "mandatoryKeys",
      "optionalKeys"
    ],
    "properties": {
      "address": {
        "dataType": "bytes",
        "fieldNumber": 1,
        "minLength": 20,
        "maxLength": 20
      },
      "nonce": {
        "dataType": "uint64",
        "fieldNumber": 2
      },
      "numberOfSignatures": {
        "dataType": "uint32",
        "fieldNumber": 3
      },
      "mandatoryKeys": {
        "type": "array",
        "items": {
          "dataType": "bytes",
          "minLength": 32,
          "maxLength": 32
        },
        "fieldNumber": 4
      },
      "optionalKeys": {
        "type": "array",
        "items": {
          "dataType": "bytes",
          "minLength": 32,
          "maxLength": 32
        },
        "fieldNumber": 5
      }
    }
  }
}

auth_getMultiSigRegMsgTag

Returns the tag required for signing and validating multi-signature transactions and related objects with Klayr Elements.

  • Specification

  • Node CLI

  • cURL

No parameters.

klayr-core endpoint:invoke auth_getMultiSigRegMsgTag
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "auth_getMultiSigRegMsgTag",
    "params": {}
}'
Response
Example output
{"tag":"KLY_RMSG_"}

auth_isValidNonce

Validates the nonce of the provided transaction.

  • Specification

  • Node CLI

  • cURL

Table 2. Parameters
Name Type Description Sample

transaction

string(hex)

The transaction as a hex string.

08021000180420c0843d2a205133af 7944acf5278b0310a11c06134f80ab 4546d77d1b0e027c8430a7d2bb9232 2d088090bcfd0212149bd82e637d30 6533b1e1ad66e19ca0047faa1a6a1a 0f4861707079206269727468646179 213a4098a9ee2cde8354d014cfe636 7d430be2713e102f37d92ab91f03db 780407e5bf6d818a45c21c9f551863 8dfc3c5365fc2d497b928e0b9d6337 988df46a663a02

klayr-core endpoint:invoke auth_isValidNonce '{ "transaction": "0a05746f6b656e12087472616e7366657218042080c2d72f2a203972849f2ab66376a68671c10a00e8b8b67d880434cc65b04c6ed886dfa91c2c32370a080400000000000000108090bcfd021a149bd82e637d306533b1e1ad66e19ca0047faa1a6a220f4861707079206269727468646179213a40c06cd0ef375911528d491971296532dbd58725f0fccc0f23e6c0656c43e75ecd12635616117e64d005f1c9f2a55de7cf2d8f5cb961927d839d141a18faa80e08" }' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "auth_isValidNonce",
    "params": {
         "transaction": "0a05746f6b656e12087472616e7366657218042080c2d72f2a203972849f2ab66376a68671c10a00e8b8b67d880434cc65b04c6ed886dfa91c2c32370a080400000000000000108090bcfd021a149bd82e637d306533b1e1ad66e19ca0047faa1a6a220f4861707079206269727468646179213a40c06cd0ef375911528d491971296532dbd58725f0fccc0f23e6c0656c43e75ecd12635616117e64d005f1c9f2a55de7cf2d8f5cb961927d839d141a18faa80e08"
    }
}'
Response

It returns true if the transaction object contains a valid nonce, false otherwise.

Example output
{
  "verified": true
}

auth_isValidSignature

Validates signatures of the provided transaction, including transactions from multi-signature accounts.

  • Specification

  • Node CLI

  • cURL

Table 3. Parameters
Name Type Description Sample

transaction

string(hex)

The transaction as a hex string.

08021000180420c0843d2a205133af 7944acf5278b0310a11c06134f80ab 4546d77d1b0e027c8430a7d2bb9232 2d088090bcfd0212149bd82e637d30 6533b1e1ad66e19ca0047faa1a6a1a 0f4861707079206269727468646179 213a4098a9ee2cde8354d014cfe636 7d430be2713e102f37d92ab91f03db 780407e5bf6d818a45c21c9f551863 8dfc3c5365fc2d497b928e0b9d6337 988df46a663a02

klayr-core endpoint:invoke auth_isValidSignature '{ "transaction": "08021000180420c0843d2a205133af7944acf5278b0310a11c06134f80ab4546d77d1b0e027c8430a7d2bb92322d088090bcfd0212149bd82e637d306533b1e1ad66e19ca0047faa1a6a1a0f4861707079206269727468646179213a4098a9ee2cde8354d014cfe6367d430be2713e102f37d92ab91f03db780407e5bf6d818a45c21c9f5518638dfc3c5365fc2d497b928e0b9d6337988df46a663a02" }' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "auth_isValidSignature",
    "params": {
         "transaction": "08021000180420c0843d2a205133af7944acf5278b0310a11c06134f80ab4546d77d1b0e027c8430a7d2bb92322d088090bcfd0212149bd82e637d306533b1e1ad66e19ca0047faa1a6a1a0f4861707079206269727468646179213a4098a9ee2cde8354d014cfe6367d430be2713e102f37d92ab91f03db780407e5bf6d818a45c21c9f5518638dfc3c5365fc2d497b928e0b9d6337988df46a663a02"
    }
}'
Response

It returns true if the transaction object contains a valid signature, false otherwise.

Example output
{
  "verified": true
}

auth_sortMultisignatureGroup

Sorts provided keys and signatures lexicographically.

This endpoint can be used to prepare the correct format for the parameters of the multi-signature registration command.

  • Specification

  • Node CLI

  • cURL

Table 4. Parameters
Name Type Description Sample

mandatory

array

The list of mandatory keys of the multi-signature account and their corresponding signatures.

{ publicKey: string(hex), signature: string(hex) }[]

optional

array

The list of optional keys of the multi-signature account and their corresponding signatures.

{ publicKey: string(hex), signature: string(hex) }[]

klayr-core endpoint:invoke auth_sortMultisignatureGroup '{ "mandatory": [{ "publicKey": "dfbe4e3999138d62047c23f61f222a91b24d9d056db055be24f9ab6d95d7aa78", "signature": "e17d67b24c1f0ab207a194bd1a1781b1c8c3110bcb427cd26f84f3034afc567583e021df575881c396e286198f4a36749055e717eaa56cd3f1fd2f3d7835b70d"},{ "publicKey": "61d320f822fcc163489499200ae6c99a66296513b1ca1066e49a37a026434ac0", "signature": "85ac61c373218cdf5e0e58a22c9b9ae71cfaf1450062d0302166b60a1cdc3b638eb747ba87c43af20d66b8e9d7513fb1d4cd3800a82debd30f0dc41937cef70e" }], "optional": []}' --pretty
curl --location --request POST 'http://localhost:7887/rpc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "auth_sortMultisignatureGroup",
    "params": {
	"mandatory": [
		{ "publicKey": "dfbe4e3999138d62047c23f61f222a91b24d9d056db055be24f9ab6d95d7aa78", "signature": "e17d67b24c1f0ab207a194bd1a1781b1c8c3110bcb427cd26f84f3034afc567583e021df575881c396e286198f4a36749055e717eaa56cd3f1fd2f3d7835b70d"},
		{ "publicKey": "61d320f822fcc163489499200ae6c99a66296513b1ca1066e49a37a026434ac0", "signature": "85ac61c373218cdf5e0e58a22c9b9ae71cfaf1450062d0302166b60a1cdc3b638eb747ba87c43af20d66b8e9d7513fb1d4cd3800a82debd30f0dc41937cef70e" }
	],
	"optional": []
}
}'
Response
Example output
{
  "mandatoryKeys": [
    "61d320f822fcc163489499200ae6c99a66296513b1ca1066e49a37a026434ac0",
    "dfbe4e3999138d62047c23f61f222a91b24d9d056db055be24f9ab6d95d7aa78"
  ],
  "optionalKeys": [],
  "signatures": [
    "85ac61c373218cdf5e0e58a22c9b9ae71cfaf1450062d0302166b60a1cdc3b638eb747ba87c43af20d66b8e9d7513fb1d4cd3800a82debd30f0dc41937cef70e",
    "e17d67b24c1f0ab207a194bd1a1781b1c8c3110bcb427cd26f84f3034afc567583e021df575881c396e286198f4a36749055e717eaa56cd3f1fd2f3d7835b70d"
  ]
}