External Staker
This is a very simple external staker designed to be used with Aion's Unity Hybrid Consensus Protocol. The staker can be used to interact with a Unity-enabled node over RPC.
The staker is largely built on top of the RPC functionality provided by the Node Test Harness.
Launching the staker
The staker can be used directly from the terminal by launching
java -jar external_staker.jar <args>
The staker takes the following arguments when launched:
- (required) the 32-bit private key of a rich Aion account without
0x
.
e.g. "cc76648ce8798bc18130bc9d637995e5c42a922ebeab78795fac58081b9cf9d4"
-
(optional) the address where the Staking Registry contract is deployed. If this argument isn't provided, OR if the value provided is
0
, the staker will deploy the contract itself. Note that this might not be the latest version of the Staking Contract. -
(optional)) the IP address of a Unity-enabled node accepting RPC requests. If this argument isn't provided,
127.0.0.1
is used as default. -
(optional)) the port on which this node is accepting RPC requests. If this argument isn't provided,
8545
is used as default.
Using the staker
The staker runs an endless loop reading commands from standard input. It takes the following arguments:
createParticipant
: This creates a newParticipant
, which is an account that can be registered with the Staking Registry. This command also funds the account from the rich account provided in step 1 of the launch process.
The staker assigns an ID to the participant, which is printed to standard output.
-
register <participantId
>: This registers the givenparticipantId
as a staker by calling theregister()
method in the Staking Registry contract. -
vote <senderId> <recipientId> <amount>
: This transfersamount
fromsenderId
's as stake forrecipientId
by calling thevote()
method in the Staking Registry contract. -
unvote <senderId> <recipientId> <amount>
: This unvotesamount
fromrecipientId
's stake, returning the balance tosenderId
by calling theunvote()
method in the Staking Registry contract. -
getVote <participantId>
: This returns the current total stake ofparticipantId
by calling thegetVote()
method in the Staking Registry contract. -
exit
: Quits the program.