get_required_keys

The get_required_keys method is an EOSIO RPC call used to determine which keys are required to sign a given transaction. This ensures that only the correct and authorized keys are used during transaction signing, improving both security and accuracy. This method is especially useful when preparing transactions for signing—whether locally, programmatically, or through external signing tools—and helps prevent unauthorized or incomplete transaction signatures. Although unrelated to Bitcoin, this RPC method is commonly used in EOSIO-compatible blockchains and applications.

Example use cases:

Secure Transaction Signing Users and developers can use the get_required_keys method to identify the specific keys required to sign a transaction, enhancing the security and accuracy of the signing process and avoiding unauthorized or faulty transactions.

Blockchain Interaction This method is crucial for interactions and operations on the EOS blockchain where transactions are involved, ensuring that only the correct keys are utilized to sign the transactions, maintaining the validity and authenticity of the transactions.

Smart Contract Execution Developers interacting with smart contracts on the EOS blockchain can leverage this method to determine the appropriate keys to sign transactions related to smart contract execution, thereby maintaining the correctness and reliability of contract interactions.


Parameters

The getRequiredKeys method mandates the following parameters in the request body:

parameter
type
description
transaction
object
Represents the transaction that is set to be signed.
expiration
string
The timestamp indicating when the transaction expires.
refBlockNum
number
The reference block number.
refBlockPrefix
number
The reference block prefix.
maxNetUsageWords
string | number
The maximum net usage in words.
maxCpuUsageMs
string | number
The maximum CPU usage allowed in milliseconds.
delaySec
number
The delay before the transaction is executed, in seconds.
contextFreeActions
Array<Action>
A list of context-free actions.
account
string
EOSIO account name for the action.
name
string
The name of the action.
authorization
Array<object>
Authorization list for this action.
actor
string
EOSIO account name acting in the authorization.
permission
string
Permission level for the actor (e.g., 'active', 'owner').
data
object
Decoded JSON data for the action.
hexData
string
Hexadecimal-encoded representation of the action data.
actions
Array<object>
List of standard EOSIO actions included in the transaction.
account
string
EOSIO account name for the action.
name
string
The name of the action.
authorization
Array<object>
Authorization list for the action.
actor
string
EOSIO account name acting in the authorization.
permission
string
Permission level for the actor.
data
object
Decoded JSON data for the action.
hexData
string
Hexadecimal representation of the action data.
availableKeys
string[]
List of available public keys to evaluate and determine which are required to sign the transaction.

Action Object Structure

Each action within contextFreeActions or actions contains:

field
type
description
account
string
The EOSIO account name executing the action.
name
string
The name of the action (e.g., transfer, vote).
authorization
Array<object>
Authorization list for the action.
actor
string
Account executing the action.
permission
string
Permission level required (e.g., 'active', 'owner').
data
object
Decoded JSON action data.
hexData
string
Hex-encoded action data.

Returns

The method returns an object containing only the keys required to sign the transaction.

field
description
required_keys
Array of public keys needed to sign the transaction.

JSON-RPC Request Example

get_required_keys Request
Response Example
get_required_keys Response

Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?