Node commands for work with STAKES

There are also some SRV_STAKE сommands for operating with ORDERS: SRV_STAKE ORDER. JSON-RPC Requests

JSON-RPC Request - SRV_STAKE DELEGATE

Delegates public key from the specified certificate or the Locked Token Delegated Key Order (LTDKO) in the network. Payment is made with a specified amount of delegated tokens (m-tokens).

CLI Example

Command syntax:

srv_stake delegate 
{[-cert <pub_cert_name> | -pkey <pkey> -sign_type <sign_type>] -value <datoshi> | -order <order_hash> {[-tax_addr <wallet_addr_for_tax_collecting>] | -cert <priv_cert_name> [-node_addr <for_validator_node>]}} 
-net <net_name> 
-w <wallet_name> 
-fee <value>

Options:

Common parameters:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-w - name of the wallet
-fee - validator's commission

Case 1: if you want to delegate m-tokens using your public certificate or public key

-cert - name of the public certificate 
-value - m-tokens sum (in datoshi) which is used for key delegation
or
-pkey - hash of the certificate
-sign_type - type of signature (for example "sig_dil")
-value - m-tokens sum (in datoshi) which is used for key delegation

Case 2: you have a hash of the validator or staker order to delegate m-tokens

-order - hash of the order (validator or staker)
validator order:
-tax_addr - wallet address for tax collecting (optional)
staker order:
-cert - name of the staker's private certificate for delegation
-node_addr - address of the node which will be participated in consensus (optional)

Example:

Command:

cellframe-node-cli srv_stake delegate 
-cert mastercert 
-net foobar 
-w foobar_root_0 
-value 10.0e+18 
-node_addr ABCD::0000::0000::0000 
-fee 5.0e+18

Response:

SAVE TO TAKE ===>>> Stake transaction 0xC026FF57F4CCD376B6E00C1DE842988B9DD3F1366B61DBBE28ADFE272391C7C4 has done

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;delegate;-cert;mastercert;-net;foobar;-w;foobar_root_0;-value;10.0e+18;-node_addr;ABCD::0000::0000::0000;-fee;5.0e+18"], "id":"1"}'

Response:


"type": 0,
"result": "SAVE TO TAKE ===>>> Stake transaction 0x6253453196BB5CEEA7CAF1E7C4D5B45608442881555850A741FB831E413DC84A has done",
"errors": null,
"id": 1
}
Link to original

JSON-RPC Request - SRV_STAKE INVALIDATE

Invalidates delegated stake transaction either by hash, cert name or cert public key hash and returns locked m-tokens to the wallet if specified

CLI Example

Command syntax:

srv_stake invalidate -net <net_name> {-tx <transaction_hash> -w <wallet_name> -fee <value> | -siging_pkey_hash <pkey_hash> -signing_pkey_type <pkey_type> -poa_cert <cert_name>}

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
 
-tx - hash of the delegation transaction
-w - the name of the wallet where funds will be returned
-fee - commission sum
 
*** or
 
-siging_pkey_hash - public key hash of the signer
-signing_pkey_type - type of the public key of a signer
-poa_cert - root node certificate

If -w,-fee were specified, a transaction will be created

Command:

cellframe-node-cli srv_stake invalidate 
-net foobar 
-tx 0x908DAC21FD62DD1CE8DA2A4F41DE2550A05A6EE6C85ED582C231E2CB976AD776 
-w foobar_master_1 
-fee 5.0e+18

Response 1:

Transaction 0x908DAC21FD62DD1CE8DA2A4F41DE2550A05A6EE6C85ED582C231E2CB976AD776 has active delegated key 0x332EE135EB8D38045AFECD0E261AC1EE6CFCA6A3B171A3E67259709253AA4303, need to revoke it first

Response 2:

All m-tokens successfully returned to owner. Returning tx hash 0xD5E031714476D78C0CD59E5250BC9C7D4C7FDBFC2CAADF49154D021A822AB3B6.

If -poa_cert was specified then decree of key recall will be created

Command:

cellframe-node-cli srv_stake invalidate -net foobar -signing_pkey_hash 0x332EE135EB8D38045AFECD0E261AC1EE6CFCA6A3B171A3E67259709253AA4303 -signing_pkey_type sig_dil  -poa_cert foobar.root.pvt.0

Response:

Specified delegated key invalidated. Created key invalidation decree 0x6A692BCC1186E138B971870A1DE738AE680341538B2163980D2D4378CC538BCB.Try to execute this command with -w to return m-tokens to owner

JSON-RPC Example

With wallet.

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;invalidate;-net;foobar;-tx;0x908DAC21FD62DD1CE8DA2A4F41DE2550A05A6EE6C85ED582C231E2CB976AD776;-w;foobar_master_1;-fee;5.0e+18"], "id":"1"}'

Response 1:


"type": 0,
"result": "Transaction 0x908DAC21FD62DD1CE8DA2A4F41DE2550A05A6EE6C85ED582C231E2CB976AD776 has active delegated key 0x332EE135EB8D38045AFECD0E261AC1EE6CFCA6A3B171A3E67259709253AA4303, need to revoke it first",
"errors": null,
"id": 1
}

Response 2:


"type": 0,
"result": "All m-tokens successfully returned to owner. Returning tx hash 0xD5E031714476D78C0CD59E5250BC9C7D4C7FDBFC2CAADF49154D021A822AB3B6.",
"errors": null,
"id": 1
}

With certificate.

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;invalidate;-net;foobar;-signing_pkey_hash;0x332EE135EB8D38045AFECD0E261AC1EE6CFCA6A3B171A3E67259709253AA4303;-signing_pkey_type;sig_dil;-poa_cert;foobar.root.pvt.0"], "id":"1"}'

Response:


"type": 0,
"result": "Specified delegated key invalidated. Created key invalidation decree 0x4D7A33DE3D98F78E7A7D287C57225D0CB7AA067F3A39D454BC3AFF494585DA78.Try to execute this command with -w to return m-tokens to owner",
"errors": null,
"id": 1
}
Link to original

JSON-RPC Request - SRV_STAKE APPROVE

 Approves stake transaction by root node certificate within specified net name  

CLI Example

Command syntax:

srv_stake approve 
-net <net_name> 
-tx <transaction_hash> 
-poa_cert <priv_cert_name>

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-tx - hash of the transaction
-poa_cert - certificate of the root node (proof of authority)
 

Example:

Command:

cellframe-node-cli srv_stake approve 
-net foobar 
-tx 0xC7C41EE4DD07879E1625CE66E2010B9CAD928A41764A54A1EC1A72E658332D8E 
-poa_cert foobar.root.pvt.0

Response:

Approve decree 0xE6F36A62F010576AD90DECB13939EB2247B5C5C27D6984C9188E9C3469B67AE2 successfully created

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;approve;-net;foobar;-tx;0xC7C41EE4DD07879E1625CE66E2010B9CAD928A41764A54A1EC1A72E658332D8E;-poa_cert;foobar.root.pvt.0"], "id":"1"}'

Response:


"type": 0,
"result": "Approve decree 0x54AA403D43C10C35781899681168A1E6FAA8D8DDCEF31F61208546080ACF1B4E successfully created",
"errors": null,
"id": 1
}
Link to original

JSON-RPC Request - SRV_STAKE LIST KEYS

Lists active delegated keys and their parameters (optional - keys delegated with specified cert)

CLI Example

Command syntax:

srv_stake list keys 
-net <net_name> 
[-cert <delegated_cert> | -pkey <pkey_hash_str>]

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-cert/-pkey - name of the delegated certificate/ hash of the public key (optional)

Example:

Command:

cellframe-node-cli srv_stake list keys 
-net foobar

Response:

Pkey hash: 0x89B17A82EB5EC2E6192F9F5353B3C89F6995E4D12004A40515FD4E4C2D143A8E
            Stake value: 1.0
            Related weight: 33.333333333333333333%
            Tx hash: 0x0000000000000000000000000000000000000000000000000000000000000000
            Node addr: ABCD::EF00::0000::0000
            Sovereign addr: N/A
            Sovereign tax: 0.0%
Pkey hash: 0xC18BDA090E342709E95F556F80BF6D1104C6F8E16E4FA3E010557D85AA89FF7F
            Stake value: 2.0
            Related weight: 66.666666666666666666%
            Tx hash: 0x696B2ACF794C48281C500586EAAC9AD5C4F51DD2C301BE685F486DAB4EB2CB84
            Node addr: FA66::CE4F::4BD1::7BAD
            Sovereign addr: N/A
            Sovereign tax: 0.0%
            
Total keys count: 2
Total weight: 3.0 (3000000000000000000)
Minimum value for key delegating: 1.0 mBUZ

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;list;keys;-net;foobar"], "id":"1"}'

Response:


"type": 0,
"result": "same as cli response",
"errors": null,
"id": 1
}
Link to original

JSON-RPC Request - SRV_STAKE LIST TX

Lists all key-delegation transactions

CLI Example

Command syntax:

srv_stake list tx 
-net <net_name>

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list

Example:

Command:

cellframe-node-cli srv_stake list tx 
-net foobar

Response:

Fri Feb 16 13:17:40 2024
tx_hash: 0xC7C41EE4DD07879E1625CE66E2010B9CAD928A41764A54A1EC1A72E658332D8E
signing_addr: ptV4n68gTebdUTcbkL5iVbJ3s8tLFWXqxrzosKV7zJCC5wrqxRF4e7HyxfHtspErJyPW1jU9ybnxxQRUM1SSzuXzwGLzyfufWbR6PuvF
signing_hash: 0x26B17A851A9ECD8A0DCE7116725A9A6405DA75404EE2C2EC6C0E9D50A893C629

node_address:            ABCD::0000::0000::0000

value:              10.0 (10000000000000000000)

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;list;tx;-net;foobar"], "id":"1"}'

Response:


"type": 0,
"result": "-------------------------------------------------------------------------------------------------------------------- \nFri Feb 16 13:17:40 2024\n \ntx_hash:\t0xC7C41EE4DD07879E1625CE66E2010B9CAD928A41764A54A1EC1A72E658332D8E \nsigning_addr:\tptV4n68gTebdUTcbkL5iVbJ3s8tLFWXqxrzosKV7zJCC5wrqxRF4e7HyxfHtspErJyPW1jU9ybnxxQRUM1SSzuXzwGLzyfufWbR6PuvF \nsigning_hash:\t0x26B17A851A9ECD8A0DCE7116725A9A6405DA75404EE2C2EC6C0E9D50A893C629 \nnode_address:\tABCD::0000::0000::0000 \nvalue:\t\t10.0 (10000000000000000000) \n",
"errors": null,
"id": 1
}
Link to original

JSON-RPC Request - SRV_STAKE MIN_VALUE

Sets the minimum stake value

CLI Example

Command syntax:

srv_stake min_value 
-net <net_name> 
-cert <cert_name> 
-value <value>

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-cert - name of the certificate
-value - stake value (in datoshi)

Example:

Command:

cellframe-node-cli srv_stake min_value 
-net foobar 
-cert foobar.root.pvt.0 
-value 20.0e+18

Response:

Minimum stake value has been set. Decree hash 0x3C14ED115BE3E7A380C144C3D1811DC05327619AAFFACE47E082F063FFFD96E3

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect  -d '{"method":"srv_stake", "params":["srv_stake;min_value;-net;foobar;-cert;foobar.root.pvt.0;-value;20.0e+18"], "id":"1"}'

Response:


"type": 0,
"result": "Minimum stake value has been set. Decree hash 0xA1518C0B2E257164D82943C4D6BFF8E5C28712393AB22CF663B66C5E4C062A7E",
"errors": null,
"id": 1
}
Link to original

JSON-RPC Request - SRV_STAKE CHECK

Checks validator parameters which allow to participate in consensus

Parameters:

VERSION - node version AUTO_PROC - transactions autoprocessing ORDER - availability of order AUTO_ONLINE - regime of automatic network connection AUTO_UPDATE - regime of automatic update DATA_SIGNED - data should be signed FOUND CERT - availability of certificate for signing SIGN CORRECT - signing must be provided by the key which was delegated SUMMARY- if everything is ok - displays “Validator ready”, if not - “There are unresolved issues

All parameters must be enabled for proper work.

CLI Example

Command syntax:

srv_stake check 
-net <net_name> 
-tx <tx_hash>

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-tx - hash of the transaction

Example:

Command:

cellframe-node-cli srv_stake check 
-tx 0x696B2ACF794C48281C500586EAAC9AD5C4F51DD2C301BE685F486DAB4EB2CB84 
-net foobar

Response:

VERSION        |  5.2-463
AUTO_PROC              |  true
ORDER                       |  true
AUTO_ONLINE           |  true
AUTO_UPDATE         |  false
DATA_SIGNED          |  true
FOUND CERT            |  true
SIGN CORRECT        |  true
SUMMARY      |  There are unresolved issues

JSON-RPC Example

Command:

curl -X POST http://rpc.cellframe.net/connect -d '{"method":"srv_stake", "params":["srv_stake;check;-tx;0x696B2ACF794C48281C500586EAAC9AD5C4F51DD2C301BE685F486DAB4EB2CB84;-net;foobar"], "id":"1"}'

Response:


"type": 0,
"result": "-------------------------------------------------\nVERSION \t |  5.2-463 \nAUTO_PROC \t |  true \nORDER \t\t |  true \nAUTO_ONLINE \t |  true \nAUTO_UPDATE \t |  false \nDATA_SIGNED \t |  true \nFOUND CERT \t |  true\nSIGN CORRECT \t |  true\nSUMMARY \t |  There are unresolved issues\n",
"errors": null,
"id": 1
}
Link to original