Documentation
¶
Index ¶
- Constants
- Variables
- func GetNodesetStatus(pubKey beacon.ValidatorPubkey, ...) swtypes.NodesetStatus
- func IsUploadedToNodeset(pubKey beacon.ValidatorPubkey, registeredPubkeys []beacon.ValidatorPubkey) bool
- type DepositDataData
- type DepositDataManager
- func (m *DepositDataManager) ComputeMerkleRoot(data []types.ExtendedDepositData) (common.Hash, error)
- func (m *DepositDataManager) GenerateDepositData(keys []*eth2types.BLSPrivateKey) ([]*types.ExtendedDepositData, error)
- func (m *DepositDataManager) GetDepositData() ([]byte, error)
- func (m *DepositDataManager) UpdateDepositData(data []types.ExtendedDepositData) error
- type DepositDataMetaData
- type ExitData
- type ExitMessage
- type ExitMessageDetails
- type LoginData
- type LoginRequest
- type NodeSetClient_v1
- func (c *NodeSetClient_v1) GetNodeRegistrationStatus(ctx context.Context) (swapi.NodesetRegistrationStatus, error)
- func (c *NodeSetClient_v1) GetRegisteredValidators(ctx context.Context) ([]ValidatorStatus, error)
- func (c *NodeSetClient_v1) GetServerDepositData(ctx context.Context) (int, []types.ExtendedDepositData, error)
- func (c *NodeSetClient_v1) GetServerDepositDataVersion(ctx context.Context) (int, error)
- func (c *NodeSetClient_v1) Login(ctx context.Context) error
- func (c *NodeSetClient_v1) Logout()
- func (c *NodeSetClient_v1) RegisterNode(ctx context.Context, email string, nodeWallet common.Address) error
- func (c *NodeSetClient_v1) UploadDepositData(ctx context.Context, depositData []byte) error
- func (c *NodeSetClient_v1) UploadSignedExitData(ctx context.Context, exitData []ExitData) error
- type NodeSetResponse
- type NonceData
- type RegisterNodeRequest
- type StakeWiseServiceProvider
- func (s *StakeWiseServiceProvider) GetDepositDataManager() *DepositDataManager
- func (s *StakeWiseServiceProvider) GetModuleConfig() *swconfig.StakeWiseConfig
- func (s *StakeWiseServiceProvider) GetNodesetClient() *NodeSetClient_v1
- func (s *StakeWiseServiceProvider) GetResources() *swconfig.StakewiseResources
- func (s *StakeWiseServiceProvider) GetWallet() *Wallet
- func (sp *StakeWiseServiceProvider) RequireStakewiseWalletReady(ctx context.Context, status wallet.WalletStatus) error
- func (sp *StakeWiseServiceProvider) WaitForNodeSetRegistration(ctx context.Context) bool
- func (sp *StakeWiseServiceProvider) WaitForStakewiseWallet(ctx context.Context) error
- type ValidatorStatus
- type ValidatorsData
- type Wallet
- func (w *Wallet) CheckIfStakewiseWalletExists() (bool, error)
- func (w *Wallet) DerivePubKeys(privateKeys []*eth2types.BLSPrivateKey) ([]beacon.ValidatorPubkey, error)
- func (w *Wallet) GenerateNewValidatorKey() (*eth2types.BLSPrivateKey, error)
- func (w *Wallet) GetAllPrivateKeys() ([]*eth2types.BLSPrivateKey, error)
- func (w *Wallet) GetLatestDepositDataVersion() int
- func (w *Wallet) GetPrivateKeyForPubkey(pubkey beacon.ValidatorPubkey) (*eth2types.BLSPrivateKey, error)
- func (w *Wallet) Reload() error
- func (w *Wallet) SaveStakewiseWallet(ethKey []byte, password string) error
- func (w *Wallet) SetLatestDepositDataVersion(version int) error
Constants ¶
const ( // Stakewise validators deposit a full 32 ETH StakewiseDepositAmount uint64 = 32e9 )
Variables ¶
var ( ErrUnregisteredNode error = errors.New("node hasn't been registered with the NodeSet server yet") ErrAlreadyRegistered error = errors.New("node has already been registered with the NodeSet server") ErrNotWhitelisted error = errors.New("node address hasn't been whitelisted on the provided NodeSet account") ErrVaultNotFound error = errors.New("deposit data has withdrawal creds that don't match a StakeWise vault") ErrInvalidPermissions error = errors.New("deposit data can't be uploaded to Mainnet because you aren't permitted to use Mainnet yet") )
Functions ¶
func GetNodesetStatus ¶ added in v1.0.0
func GetNodesetStatus(pubKey beacon.ValidatorPubkey, registeredPubkeysStatusMapping map[beacon.ValidatorPubkey]string) swtypes.NodesetStatus
func IsUploadedToNodeset ¶ added in v0.1.2
func IsUploadedToNodeset(pubKey beacon.ValidatorPubkey, registeredPubkeys []beacon.ValidatorPubkey) bool
Types ¶
type DepositDataData ¶ added in v0.2.0
type DepositDataData struct {
Version int `json:"version"`
DepositData []types.ExtendedDepositData `json:"depositData"`
}
Response to a deposit data request
type DepositDataManager ¶
type DepositDataManager struct {
// contains filtered or unexported fields
}
DepositDataManager manages the aggregated deposit data file that Stakewise uses
func NewDepositDataManager ¶
func NewDepositDataManager(sp *StakeWiseServiceProvider) (*DepositDataManager, error)
Creates a new manager
func (*DepositDataManager) ComputeMerkleRoot ¶
func (m *DepositDataManager) ComputeMerkleRoot(data []types.ExtendedDepositData) (common.Hash, error)
Compute the Merkle root of the aggregated deposit data using the Stakewise rules NOTE: reverse engineered from https://github.com/stakewise/v3-operator/blob/fa4ac2673a64a486ced51098005376e56e2ddd19/src/validators/utils.py#L207
func (*DepositDataManager) GenerateDepositData ¶
func (m *DepositDataManager) GenerateDepositData(keys []*eth2types.BLSPrivateKey) ([]*types.ExtendedDepositData, error)
Generates deposit data for the provided keys
func (*DepositDataManager) GetDepositData ¶
func (m *DepositDataManager) GetDepositData() ([]byte, error)
Read the deposit data file
func (*DepositDataManager) UpdateDepositData ¶
func (m *DepositDataManager) UpdateDepositData(data []types.ExtendedDepositData) error
Save the deposit data file
type DepositDataMetaData ¶ added in v0.2.0
type DepositDataMetaData struct {
Version int `json:"version"`
}
Response to a deposit data meta request
type ExitData ¶
type ExitData struct {
Pubkey string `json:"pubkey"`
ExitMessage ExitMessage `json:"exit_message"`
}
Data for a pubkey's voluntary exit message
type ExitMessage ¶
type ExitMessage struct {
Message ExitMessageDetails `json:"message"`
Signature string `json:"signature"`
}
Voluntary exit message
type ExitMessageDetails ¶
type ExitMessageDetails struct {
Epoch string `json:"epoch"`
ValidatorIndex string `json:"validator_index"`
}
Details of an exit message
type LoginData ¶ added in v0.2.0
type LoginData struct {
Token string `json:"token"`
}
Response to a login request
type LoginRequest ¶ added in v0.2.0
type LoginRequest struct {
Nonce string `json:"nonce"`
Address string `json:"address"`
Signature string `json:"signature"` // Must be 0x-prefixed hex encoded
}
Request to log into the NodeSet server
type NodeSetClient_v1 ¶ added in v0.2.0
type NodeSetClient_v1 struct {
// contains filtered or unexported fields
}
Client for interacting with the Nodeset server
func NewNodeSetClient_v1 ¶ added in v0.2.0
func NewNodeSetClient_v1(sp *StakeWiseServiceProvider) *NodeSetClient_v1
Creates a new Nodeset client
func (*NodeSetClient_v1) GetNodeRegistrationStatus ¶ added in v1.0.0
func (c *NodeSetClient_v1) GetNodeRegistrationStatus(ctx context.Context) (swapi.NodesetRegistrationStatus, error)
Returns whether the node is registered with the NodeSet server
func (*NodeSetClient_v1) GetRegisteredValidators ¶ added in v0.2.0
func (c *NodeSetClient_v1) GetRegisteredValidators(ctx context.Context) ([]ValidatorStatus, error)
Get a list of all of the pubkeys that have already been registered with NodeSet for this node
func (*NodeSetClient_v1) GetServerDepositData ¶ added in v0.2.0
func (c *NodeSetClient_v1) GetServerDepositData(ctx context.Context) (int, []types.ExtendedDepositData, error)
Get the aggregated deposit data from the server
func (*NodeSetClient_v1) GetServerDepositDataVersion ¶ added in v0.2.0
func (c *NodeSetClient_v1) GetServerDepositDataVersion(ctx context.Context) (int, error)
Get the current version of the aggregated deposit data on the server
func (*NodeSetClient_v1) Login ¶ added in v1.0.0
func (c *NodeSetClient_v1) Login(ctx context.Context) error
Logs into the NodeSet API server, grabbing a new authentication token
func (*NodeSetClient_v1) Logout ¶ added in v1.0.0
func (c *NodeSetClient_v1) Logout()
Logs out of the NodeSet service, resetting the registration status in the process.
func (*NodeSetClient_v1) RegisterNode ¶ added in v0.2.0
func (c *NodeSetClient_v1) RegisterNode(ctx context.Context, email string, nodeWallet common.Address) error
Registers the node with the NodeSet server. Assumes wallet validation has already been done and the actual wallet address is provided here; if it's not, the signature won't come from the node being registered so it will fail validation.
func (*NodeSetClient_v1) UploadDepositData ¶ added in v0.2.0
func (c *NodeSetClient_v1) UploadDepositData(ctx context.Context, depositData []byte) error
Uploads deposit data to Nodeset
func (*NodeSetClient_v1) UploadSignedExitData ¶ added in v0.2.0
func (c *NodeSetClient_v1) UploadSignedExitData(ctx context.Context, exitData []ExitData) error
Submit signed exit data to Nodeset
type NodeSetResponse ¶ added in v0.2.0
type NodeSetResponse[DataType any] struct { OK bool `json:"ok"` Message string `json:"message,omitempty"` Data DataType `json:"data,omitempty"` Error string `json:"error,omitempty"` }
All responses from the NodeSet API will have this format `message` may or may not be populated (but should always be populated if `ok` is false) `data` should be populated if `ok` is true, and will be omitted if `ok` is false
type RegisterNodeRequest ¶ added in v0.2.0
type RegisterNodeRequest struct {
Email string `json:"email"`
NodeAddress string `json:"node_address"`
Signature string `json:"signature"` // Must be 0x-prefixed hex encoded
}
Request to register a node with the NodeSet server
type StakeWiseServiceProvider ¶ added in v1.0.0
type StakeWiseServiceProvider struct {
*services.ServiceProvider
// contains filtered or unexported fields
}
func NewStakeWiseServiceProvider ¶ added in v1.0.0
func NewStakeWiseServiceProvider(sp *services.ServiceProvider) (*StakeWiseServiceProvider, error)
Create a new service provider with Stakewise daemon-specific features
func NewStakeWiseServiceProviderFromCustomServices ¶ added in v1.0.0
func NewStakeWiseServiceProviderFromCustomServices(sp *services.ServiceProvider, cfg *swconfig.StakeWiseConfig, resources *swconfig.StakewiseResources) (*StakeWiseServiceProvider, error)
Create a new service provider with Stakewise daemon-specific features, using custom services instead of loading them from the module service provider.
func (*StakeWiseServiceProvider) GetDepositDataManager ¶ added in v1.0.0
func (s *StakeWiseServiceProvider) GetDepositDataManager() *DepositDataManager
func (*StakeWiseServiceProvider) GetModuleConfig ¶ added in v1.0.0
func (s *StakeWiseServiceProvider) GetModuleConfig() *swconfig.StakeWiseConfig
func (*StakeWiseServiceProvider) GetNodesetClient ¶ added in v1.0.0
func (s *StakeWiseServiceProvider) GetNodesetClient() *NodeSetClient_v1
func (*StakeWiseServiceProvider) GetResources ¶ added in v1.0.0
func (s *StakeWiseServiceProvider) GetResources() *swconfig.StakewiseResources
func (*StakeWiseServiceProvider) GetWallet ¶ added in v1.0.0
func (s *StakeWiseServiceProvider) GetWallet() *Wallet
func (*StakeWiseServiceProvider) RequireStakewiseWalletReady ¶ added in v1.0.0
func (sp *StakeWiseServiceProvider) RequireStakewiseWalletReady(ctx context.Context, status wallet.WalletStatus) error
func (*StakeWiseServiceProvider) WaitForNodeSetRegistration ¶ added in v1.0.0
func (sp *StakeWiseServiceProvider) WaitForNodeSetRegistration(ctx context.Context) bool
Wait until the node has been registered with NodeSet. Returns true if the context was cancelled and the caller should exit.
func (*StakeWiseServiceProvider) WaitForStakewiseWallet ¶ added in v1.0.0
func (sp *StakeWiseServiceProvider) WaitForStakewiseWallet(ctx context.Context) error
type ValidatorStatus ¶
type ValidatorStatus struct {
Pubkey beacon.ValidatorPubkey `json:"pubkey"`
Status string `json:"status"`
ExitMessageUploaded bool `json:"exitMessage"`
}
Validator status info
type ValidatorsData ¶ added in v0.2.0
type ValidatorsData struct {
Validators []ValidatorStatus `json:"validators"`
}
Response to a validators request
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet manager for the Stakewise daemon
func (*Wallet) CheckIfStakewiseWalletExists ¶
Check if the Stakewise wallet and password files exist
func (*Wallet) DerivePubKeys ¶
func (w *Wallet) DerivePubKeys(privateKeys []*eth2types.BLSPrivateKey) ([]beacon.ValidatorPubkey, error)
Get the private validator key with the corresponding pubkey
func (*Wallet) GenerateNewValidatorKey ¶
func (w *Wallet) GenerateNewValidatorKey() (*eth2types.BLSPrivateKey, error)
Generate a new validator key and save it
func (*Wallet) GetAllPrivateKeys ¶
func (w *Wallet) GetAllPrivateKeys() ([]*eth2types.BLSPrivateKey, error)
Gets all of the validator private keys that are stored in the Stakewise keystore folder
func (*Wallet) GetLatestDepositDataVersion ¶
Get the version of the aggregated deposit data from the NodeSet server that's stored on disk
func (*Wallet) GetPrivateKeyForPubkey ¶
func (w *Wallet) GetPrivateKeyForPubkey(pubkey beacon.ValidatorPubkey) (*eth2types.BLSPrivateKey, error)
Get the private validator key with the corresponding pubkey
func (*Wallet) SaveStakewiseWallet ¶
Saves the Stakewise wallet and password files
func (*Wallet) SetLatestDepositDataVersion ¶
Set the latest deposit data version and save the wallet data