ConsensusUtils
Generate Oasis wallets for use with staking at the consensus level.
State Variables
ADDRESS_V0_CONTEXT_IDENTIFIER
The unique context for v0 staking account addresses.
Note: @oasisprotocol/oasis-core :: go/staking/api/address.go
string private constant ADDRESS_V0_CONTEXT_IDENTIFIER = "oasis-core/address: staking";
ADDRESS_V0_CONTEXT_VERSION
uint8 private constant ADDRESS_V0_CONTEXT_VERSION = 0;
Functions
generateStakingAddress
Generate a random Ed25519 wallet for Oasis consensus-layer staking.
function generateStakingAddress(bytes memory personalization)
internal
view
returns (StakingAddress publicAddress, StakingSecretKey secretKey);
Parameters
Name | Type | Description |
---|---|---|
personalization | bytes | Optional user-specified entropy. |
Returns
Name | Type | Description |
---|---|---|
publicAddress | StakingAddress | Public address of the keypair. |
secretKey | StakingSecretKey | Secret key for the keypair. |
_stakingAddressFromPublicKey
Derive the staking address from the public key.
function _stakingAddressFromPublicKey(bytes32 ed25519publicKey) internal view returns (bytes21);
Parameters
Name | Type | Description |
---|---|---|
ed25519publicKey | bytes32 | Ed25519 public key. |
_addressFromData
Derive an Oasis-style address.
function _addressFromData(string memory contextIdentifier, uint8 contextVersion, bytes memory data)
internal
view
returns (bytes21);
Parameters
Name | Type | Description |
---|---|---|
contextIdentifier | string | Domain separator. |
contextVersion | uint8 | Domain version. |
data | bytes | Public point of the keypair. |