ประเภทหนัง
ตัวอย่างหนัง Solana: What to do with recovered account from failed deployment / deployment 2nd signer?
Restoration of won accounts with Solana: a step-by-step instructions
As Solana developers, you probably have pushed scenarios in which your anchor provision fails, which means that an intermediate account is deleted or lost. Fortunately, the “Solana Keygen” tool has provided a powerful solution for restored recovery accounts.
In this article, we go from a failed provision through the process of restoring a restored account and use it as a second signator.
Step 1: Restoration of the germ phrase keyboard
First you have to restore the germ phrase keyboard used for the original use. You can use the “Solana Keygen” tool with the following command:
`Bash
Solana keygen recovers.json
Replace
by the path to your restored Seedphrase file.
Step 2: Restoration of the short -lived keyboard
Next you have to restore the short -lived keyboard from the intermediate account. The short -lived keyboard is a random key that is used to sign transactions and interaction with the Solana network.
You can use the “Solana Keygen” tool again to restore the short-lived keyboard:
`Bash
Solana keygen Recare recover.json
Replace .
Step 3: Reuse of the restored keyboards
Now that you have both the seeds and the short-lived keyboards, you can reuse them as the second signatories in your anchor provision.
To do this, create a new provision script that uses these keyboards:
Python
By Solana.publisy Import Pubkey
Import Solana
Def Main ():
Download the seed phrase from the file
With Open ('rehreed_sephras_file.json') as F:
Recoteed_sephras = json.load (f)
Create a new provision script that uses the short -lived keyboard as a second signator
Program_id = 'your_program_id'
Account_Keyid = Pubrkey.From_secret_KEY (recoteed_sephras ['Second_sinner'] ['Secret'])
args = {
"Program_id": Program_ID,
"Accounts": [
(Account_Keyid, 0),
(Recoteed_sephras ['seed_phrase'], 1)
]
}
Provide the script to provide the script
print (f "provision in {program_id} with seed phrase: {roleed_sephras ['seed_phrase']} and ephemeral tastair: {recovered_sephras ['second_signer'] ['Public_Key']}")
Replace your_program_id
with your actual Solana program -id.
Example uses
Here is an example of how you can use this provision script in your anchor provision:
`Yaml
Version: ‘3’
Services:
insert:
Image: $ image_name
Volumes:
-.:/App
Command: SH -C “$ shell -scripte/diply.sh”
`
This uses the program with the seed phrase and short -lived keyboard with the restored account.
Diploma
The restoration of a restored account in Solana can be a powerful way to regain access to your anchor insert. If you follow these steps, you can use the recovered seed and short-lived keyboard as a second signatories in your anchor provision to ensure that your program remains safe and functional.