Lock a neuron
Overview
Since version | 1.1.0 |
Idempotent? | yes |
Minimal access level | controller |
In this section of the staking tutorial you will learn how to lock your neuron. The amount of rewards you can expect to receive are amongst other factors dependent on the amount of time a neuron is locked up for. If the dissolve timestamp is set to a value that is before 6 months in the future you will not be getting any rewards for the locked period. This is because the last 6 months of a dissolving neuron, the neuron will not get any rewards. If you set the dissolve timestamp to 1 year in the future and start dissolving the neuron right away, you will receive rewards for the next 6 months.
The dissolve timestamp always increases monotonically.
If the neuron is in the
DISSOLVING
state, this operation can move the dissolve timestamp further into the future.If the neuron is in the
NOT_DISSOLVING
state, invokingSET_DISSOLVE_TIMESTAMP
with time T will attempt to increase the neuron’s dissolve delay (the minimal time it will take to dissolve the neuron) toT - current_time
.If the neuron is in the
DISSOLVED
state, invokingSET_DISSOLVE_TIMESTAMP
will move it to theNOT_DISSOLVING
state and will set the dissolve delay accordingly.
An example call to the construction/payloads
endpoint resembles 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": 4
},
"type": "SET_DISSOLVE_TIMESTAMP",
"account": {
"address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4"
},
"metadata": {
"neuron_index": 0,
"dissolve_time_utc_seconds": 1712156627
}
}
],
"metadata": null
}'
The response will confirm that the dissolve timestamp has been changed.
{
"transaction_identifier": {
"hash": "0000000000000000000000000000000000000000000000000000000000000000"
},
"metadata": {
"operations": [
{
"account": {
"address": "8b84c3a3529d02a9decb5b1a27e7c8d886e17e07ea0a538269697ef09c2a27b4"
},
"metadata": {
"dissolve_time_utc_seconds": 1712156627,
"neuron_index": 0
},
"operation_identifier": {
"index": 0
},
"status": "COMPLETED",
"type": "SET_DISSOLVE_TIMESTAMP"
}
]
}
}
If you then check the neuron you will see that it changed state from DISSOLVED
to NOT_DISSOLVING
. If you set the timestamp to a sufficiently far time in the future you can now start to collect rewards for with your neuron.