Lock a staking for your guarantor node

Although Kujua does not require staking to operate, staking is an optional part of the consensus mechanism. Staking in Kujua is used to guarantee the passage of a transaction through to confirmation before it reaches there, by putting your node's funds at stake should your node deviate from the rules and fail to prevent a double spend attack. This portion is given back by the smart contract if no double spend succeeded on your watch. Locking of two days minimum is required. See whitepaper for more details. Below is an example of how to create a stake pool for your node.


from kujuaOnChain.Client import inputs, functions

fees = functions.calculate_fees(inputs.dummy.amount,
                                inputs.node.node_url,
                                inputs.dummy.recipient_address)

broadcast = functions.broadcast(inputs.wallet.wallet_address,
                                inputs.wallet.private_key_encrypted,  # only use a dummy address's private key until we make kujuaOffChainRelay public
                                inputs.wallet.passphrase,
                                inputs.dummy.amount,
                                fees['content']['full_fee'],
                                inputs.node.node_url,
                                str(),
                                inputs.dummy.recipient_address,
                                str(),
                                0,
                                2,
                                str(),
                                'stake_pool',
                                (None,),
                                {},
                                True,
                                inputs.node.gt_node_url,
                                False)
print(broadcast)
									

We use the on chain method by importing kujuaOnChain. Meaning the functions run directly on the node and return results. Off chain will be available with the full Github release. You can find the code for kujuaOnChain on GitHub