Stake Solana Tutorial
Requirements :
- Ledger Enteprise with the Solana Release
- LAM setup
- Admin access to the Ledger Enteprise Application
How to start :
- Create your API users
- Create a SOLANA Account as Reserve Cold Storage
- Create a SOLOANA Account to Perform Staking operations
- Add API user to the SOLANA Account
import requests
import json
CONSTANTES
LAM_URL = "https://split-merge-sol.minivault.ledger-sbx.com/lam"
API_USER_NAME = "bluestar"
HEADER = {'X-Ledger-API-User': API_USER_NAME}
Test LE-API connection
To see if your can reach your LAM URL.
You should get an API call code : 400, and the LAM should not know your user for now.
r = requests.get(LAM_URL + "/_health", headers=HEADER)
r.json()
MANDATORY - Create your LAM Operator
You will need to login as an Admin using the Ledger PSD to perfom this action since we will add a new operator on your HSM workspace.
This user can then be managed as any operator and can be added in your governance rules.
Login as Admin and go to the user section
Click Invite User
Select API and insert username and userId
Inside this section set the username as API_USER_NAME
for the constant section
Generate a User ID via API on your LAM via the /api_users endpoint
payload = {
"name": API_USER_NAME
}
r = requests.post(LAM_URL + "/api_users", json=payload, headers=HEADER)
r.json()
You should get this type of response :
{
'device_id': '6832c1a93806fca9',
'name': 'redstar',
'role': 'OPERATOR',
'type_': 'SOFT_PSD',
'workspace': 'your_workspace_name'
}
Use this your generated device Id to create the operator in the web application
For example 6832c1a93806fca9
need to be added under the User Id Section
Then register your operator via API
Copy past the UUID generated in by the web application 8436297b-962d-4e43-8a58-07b9ce84c1bc
Once done you should see {'success': True}
uuid = "97f90489-2b65-437c-9bf6-09ecd27e1723"
payload = {
"name": API_USER_NAME
}
r = requests.post(LAM_URL + "/api_users/" + API_USER_NAME + "/register/" + uuid , json=payload, headers=HEADER)
r.json()