The service provides an opportunity to pledge (delegate) a predetermined amount (stake) of tokens to the wallet address, the private key of which will sign further events in the system. All such events containing transactions are automatically deducted from the commission and sent to the address specified by the delegate. The delegate has the opportunity to return the deposit to himself at any time. Other operations with a pledge are not provided.
To avoid malicious actions, a stake request is created by the owner of the certificate, the key of which will later serve as a marker for deducting the commission. The request is created as an order signed with the same key. The address of the delegator in the current implementation must be written in the same order (although in theory the pledge can be accepted from any address, and this parameter will probably be discarded in the future).
./cellframe-node-cli srv_stake order create -net <net name> -from_addr <addr> -token <ticker> -coins <value> -cert <name> -fee_percent <value>
Example:
./cellframe-node-cli srv_stake order create -net kelvin-testnet -from_addr RpiDC8c1T1Phj39naR4zcYha1YcNXoF2c8ycwP3RCykQvBh8GAZEhqRbbLMwznLrphmFj5K8Q6WGZfKjmV4SvwyyGuJKAmUMZeownn2q
-token KELT -coins 10000 -cert stake_cert -fee_percent 10.0
Successfully created order 0x4D70ADF579ECAA12D55596FFE997BCB6C72F3ADE75FA3C534AB092C6CC43D008
The creator of the order can delete it if the stake request is no longer relevant.
./cellframe-node-cli srv_stake order remove -net <net name> -order <order hash>
Example:
./cellframe-node-cli srv_stake order remove -net kelvin-testnet -order 0x4D70ADF579ECAA12D55596FFE997BCB6C72F3ADE75FA3C534AB092C6CC43D008
Stake order successfully removed
A previously created order can be changed at any time.
./cellframe-node-cli srv_stake order update -net <net name> -order <order hash> -cert <name> {-from_addr <addr> | -token <ticker> -coins <value> | -fee_percent <value>}
Example:
./cellframe-node-cli srv_stake order update -net kelvin-testnet -order 0x4D70ADF579ECAA12D55596FFE997BCB6C72F3ADE75FA3C534AB092C6CC43D008 -cert stake_cert -fee_percent 5.0
Successfully created order 0x6F3C6830ED87D5DAC5ADC1002F8B01617CB39748051947B85231534AC8773559
At any time, you can view the list of orders with requests for a stake.
./cellframe-node-cli srv_stake order list -net <net name>
Example:
./cellframe-node-cli srv_stake order list -net kelvin-testnet
0x6F3C6830ED87D5DAC5ADC1002F8B01617CB39748051947B85231534AC8773559
For the delegation of funds, it must be present on the balance of the delegator's wallet. An order with delegation parameters must also be created in advance. The delegation takes place in the form of a conditional transaction, the output of which cannot be used by anyone other than the owner of the funds. As in other conditional transactions, the balance of the wallet of the signer of the transaction is reduced by the amount of the stake, while the debited funds are not reflected in any other balance. They, as it were, "hang in the void." Funds will appear on the balance only after the "closing" of the conditional transaction, that is, when a transaction appears with a normal output and an input that fulfills the condition.
./cellframe-node-cli srv_stake delegate -order <order hash> -net <net name> -wallet <wallet_name> -fee_addr <addr>
Example:
./cellframe-node-cli srv_stake delegate -order 0x6F3C6830ED87D5DAC5ADC1002F8B01617CB39748051947B85231534AC8773559 -net kelvin-testnet -wallet mywallet -fee_addr RpiDC8c1T1Phj39nZHW7cLEbgJX7zz2DEdLt3rR9LgDHL8r7dc3UWVDUYxCSta6zsLm9xzeKcBEe4vrDZehrgPB469bJcugbt5C5o8qK
Stake transaction has done
At any time, you can view the list of active conditional delegation transactions, with their parameters.
./cellframe-node-cli srv_stake transactions -net <net name> {-addr <addr from>}
Example:
./cellframe-node-cli srv_stake transactions -net kelvin-testnet
0xF1BB196E9F83F605000872E55D5ED1149C471312319E31B74F9BBF67258187E2 KELT 10000 RpiDC8c1T1Phj39naR4zcYha1YcNXoF2c8ycwP3RCykQvBh8GAZEhqRbbLMwznLrphmFj5K8Q6WGZfKjmV4SvwyyGuJKAmUMZeownn2q RpiDC8c1T1Phj39nb3TmvuAEpKhCGTvQoCGziQnLjZ5cNrNyqouv2PQouMjpasj7dwXavwzVB2cGiLzuNbA67o9kTEgG8Fc3T63oSU3P RpiDC8c1T1Phj39nZHW7cLEbgJX7zz2DEdLt3rR9LgDHL8r7dc3UWVDUYxCSta6zsLm9xzeKcBEe4vrDZehrgPB469bJcugbt5C5o8qK 5.0
At any time, the owner of the stake can cancel the conditional transaction of the stake and return it to himself.
./cellframe-node-cli srv_stake invalidate -net <net name> -tx <transaction hash> -wallet <wallet name>
Example:
./cellframe-node-cli srv_stake invalidate -net kelvin-testnet -tx 0xF1BB196E9F83F605000872E55D5ED1149C471312319E31B74F9BBF67258187E2 -wallet mywallet
Stake successfully returned to owner