Skip to main content

Fetch neuron info

Intermediate
Tutorial

Overview

Since version1.5.0
Idempotent?yes
Minimal access levelhotkey

In this section of the staking tutorial you will learn how to fetch information about an existing neuron. There are a few variations to this that depend on whether you are the controller of the neuron or whether you are using a hotkey.

Calling NeuronInfo as a controller

Assuming that you are the controller of the neuron with the neuron_id 3094748712371737240 and you are not using a hotkey, the corresponding payloads call would resemble the following:

curl --location '0.0.0.0:8081/construction/payloads'  --header 'Content-Type: application/json' --data '{
"network_identifier": {
"blockchain": "Internet Computer",
"network": "00000000000000020101"
},
"public_keys": [
{
"hex_bytes": "047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c757367",
"curve_type": "secp256k1"
}
],
"operations": [
{
"operation_identifier": {
"index": 0
},
"type": "NEURON_INFO",
"account": {
"address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4"
},
}
],
"metadata": null
}'

Calling NeuronInfo with a hotkey

curl --location '0.0.0.0:8081/construction/payloads'  --header 'Content-Type: application/json' --data '{
"network_identifier": {
"blockchain": "Internet Computer",
"network": "00000000000000020101"
},
"public_keys": [
{
"hex_bytes": "047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c757367",
"curve_type": "secp256k1"
}
],
"operations": [
{
"operation_identifier": {
"index": 0
},
"type": "NEURON_INFO",
"account": {
"address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4"
},
}
],
"metadata": {
"neuron_index": 0,
"controller": {
"public_key": {
"hex_bytes": "047a83e378053f87b49aeae53b3ed274c8b2ffbe59d9a51e3c4d850ca8ac1684f7131b778317c0db04de661c7d08321d60c0507868af41fe3150d21b3c6c757367",
"curve_type": "secp256k1"
}
}
}
}'

The result of the NeuronInfo call would resemble the following:

{
"transaction_identifier": {
"hash": "0000000000000000000000000000000000000000000000000000000000000000"
},
"metadata": {
"operations": [
{
"account": {
"address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4"
},
"metadata": {
"controller": "iowfl-yzooa-br3dt-77erl-nlm7f-kplhq-php75-hw3an-aeqn2-swh4t-3qe",
"followees": {},
"hotkeys": [],
"kyc_verified": true,
"maturity_e8s_equivalent": 0,
"neuron_fees_e8s": 0,
"neuron_id": 3094748712371737240,
"neuron_index": 0,
"staked_maturity_e8s": null,
"state": "DISSOLVED"
},
"operation_identifier": {
"index": 0
},
"status": "COMPLETED",
"type": "NEURON_INFO"
}
]
}
}

Right now the neuron is `DISSOLVED` as it has not yet been locked up. This will be done in the next step.

Currently, ICP Rosetta does not support fetching neuron info of a neuron that you are not either the controller of or have a hotkey for.