Delegation of participation
An account can delegate sending messages on its behalf to another account. This means that the second option to participate in the consensus is delegation - by delegating the right to issue messages to an account that is authorized on the node, you can receive a part of the reward for the message that was issued on behalf of your account.
Delegate ID can be found in account object. The ID will be located at options.delegating_account.
CLI Wallet
echojs-lib
1
unlocked >>> get_account myacc
2
{
3
"id": "1.2.503",
4
"membership_expiration_date": "1970-01-01T00:00:00",
5
"registrar": "1.2.8",
6
"referrer": "1.2.8",
7
"lifetime_referrer": "1.2.8",
8
"lifetime_referrer_fee_percentage": 3000,
9
"referrer_rewards_percentage": 7500,
10
"name": "myacc",
11
"active": {
12
"weight_threshold": 1,
13
"account_auths": [],
14
"key_auths": [[
15
"ECHOB3uKK5kjHrKSszvxpCjrHf9yMzXEfWXwyWmHyFENaVux",
16
1
17
]
18
]
19
},
20
"echorand_key": "ECHOB3uKK5kjHrKSszvxpCjrHf9yMzXEfWXwyWmHyFENaVux",
21
"options": {
22
"voting_account": "1.2.5",
23
"delegating_account": "1.2.8",
24
"num_committee": 0,
25
"votes": [],
26
"extensions": []
27
},
28
"statistics": "2.6.503",
29
"whitelisting_accounts": [],
30
"blacklisting_accounts": [],
31
"whitelisted_accounts": [],
32
"blacklisted_accounts": [],
33
"active_special_authority": [
34
0,{}
35
],
36
"top_n_control_flags": 0,
37
"extensions": []
38
}
39
unlocked >>>
Copied!
1
const { default: echo } = require('echojs-lib');
2
3
const connect = async () => {
4
await echo.connect('ws://127.0.0.1:6311');
5
};
6
7
connect().then(async () => {
8
const account = await echo.api.getAccountByName('myacc');
9
console.log(account);
10
});
Copied!
1
{
2
"id": "1.2.503",
3
"membership_expiration_date": "1970-01-01T00:00:00",
4
"registrar": "1.2.8",
5
"referrer": "1.2.8",
6
"lifetime_referrer": "1.2.8",
7
"lifetime_referrer_fee_percentage": 3000,
8
"referrer_rewards_percentage": 7500,
9
"name": "myacc",
10
"active": {
11
"weight_threshold": 1,
12
"account_auths": [],
13
"key_auths": [
14
[
15
"ECHOB3uKK5kjHrKSszvxpCjrHf9yMzXEfWXwyWmHyFENaVux",
16
1
17
]
18
]
19
},
20
"echorand_key": "ECHOB3uKK5kjHrKSszvxpCjrHf9yMzXEfWXwyWmHyFENaVux",
21
"options": {
22
"voting_account": "1.2.5",
23
"delegating_account": "1.2.8",
24
"num_committee": 0,
25
"votes": [],
26
"extensions": []
27
},
28
"statistics": "2.6.503",
29
"whitelisting_accounts": [],
30
"blacklisting_accounts": [],
31
"whitelisted_accounts": [],
32
"blacklisted_accounts": [],
33
"active_special_authority": [
34
0,
35
{}
36
],
37
"top_n_control_flags": 0,
38
"extensions": []
39
}
Copied!
Based on the information above, we conclude that account 1.2.8 may issue messages on behalf of account 1.2.503.
Delegate ID can be changed:
1
const privateKey = PrivateKey.fromWif(YOUR_WIF);
2
const newDelegatingAccount = '1.2.500';
3
const options = {
4
fee: {asset_id: '1.3.0'},
5
account: '1.2.503',
6
new_options: {
7
voting_account: '1.2.5',
8
num_committee: 0,
9
votes: [],
10
delegating_account: newDelegatingAccount,
11
}
12
};
13
14
echo.createTransaction()
15
.addOperation(constants.OPERATIONS_IDS.ACCOUNT_UPDATE, options)
16
.addSigner(privateKey)
17
.broadcast();
Copied!
As a result, the account to which it will be delegated to issue messages is account 1.2.500.
Last modified 1yr ago
Copy link