4

I got this message after a anchor deploy:

Deploying workspace: https://api.mainnet-beta.solana.com
Upgrade authority: /Users/mcesbron/.config/solana/id.json
Deploying program "unidouble"...
Program path: /Users/mcesbron/Desktop/work/unidouble/target/deploy/unidouble.so...
=======================================================================
Recover the intermediate account's ephemeral keypair file with
`solana-keygen recover` and the following 12-word seed phrase:
=======================================================================
this is a fake phrase habit east news noble husband more where
=======================================================================
To resume a deploy, pass the recovered keypair as the
[BUFFER_SIGNER] to `solana program deploy` or `solana program write-buffer'.
Or to recover the account's lamports, pass it as the
[BUFFER_ACCOUNT_ADDRESS] argument to `solana program close`.
=======================================================================
Error: Deploying program failed: error sending request for url (https://api.mainnet-beta.solana.com/): connection closed before message completed
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.

I know how to close the account but I would like to resume it and I am not sure how I am supposed to do it.

First I know I need to get the keypair, I do solana-keygen recover -o recover.json. I have the keypair in recover.json now.

but after that I am not sure how I should use the solana program deploy or solana program write-buffer with the recover.json.

1 Answer 1

6

solana program deploy will deploy a new program or upgrade an existing program if used with the --program-id and --upgrade-authority flags, while solana program write-buffer will just write to a buffer to be used for an eventual upgrade.

The error message says to use the recovered keypair as the [BUFFER_SIGNER] to solana program deploy, so let's see the help text:

$ solana program deploy -h
solana-program-deploy
Deploy an upgradeable program

USAGE:
    solana program deploy [FLAGS] [OPTIONS] [PROGRAM_FILEPATH]

FLAGS:
        --allow-excessive-deploy-account-balance
            Use the designated program id even if the account already holds a large balance of SOL

        --final                                     The program will not be upgradeable
    -h, --help                                      Prints help information
        --no-address-labels                         Do not use address labels in the output
        --skip-seed-phrase-validation
            Skip validation of seed phrases. Use this if your phrase does not use the BIP39 official English word list

    -V, --version                                   Prints version information
    -v, --verbose                                   Show additional information

OPTIONS:
        --buffer <BUFFER_SIGNER>
            Intermediate buffer account to write data to, which can be used to resume a failed deploy [default: random
            address]
        --commitment <COMMITMENT_LEVEL>
            Return information at the selected commitment level [possible values: processed, confirmed, finalized]

    -C, --config <FILEPATH>
            Configuration file to use [default: /home/jon/.config/solana/cli/config.yml]

    -u, --url <URL_OR_MONIKER>
            URL for Solana's JSON RPC or moniker (or their first letter): [mainnet-beta, testnet, devnet, localhost]

    -k, --keypair <KEYPAIR>                               Filepath or URL to a keypair
        --max-len <max_len>
            Maximum length of the upgradeable program [default: twice the length of the original deployed program]

        --output <FORMAT>
            Return information in specified output format [possible values: json, json-compact]

        --program-id <PROGRAM_ID>
            Executable program's address, must be a keypair for initial deploys, can be a pubkey for upgrades [default:
            address of keypair at /path/to/program-keypair.json if present, otherwise a random address], one of:
              * a base58-encoded public key
              * a path to a keypair file
              * a hyphen; signals a JSON-encoded keypair on stdin
              * the 'ASK' keyword; to recover a keypair via its seed phrase
              * a hardware wallet keypair URL (i.e. usb://ledger)
        --upgrade-authority <UPGRADE_AUTHORITY_SIGNER>    Upgrade authority [default: the default configured keypair]
        --ws <URL>                                        WebSocket URL for the solana cluster

ARGS:
    <PROGRAM_FILEPATH>    /path/to/program.so

You'll see <BUFFER_SIGNER> in the --buffer argument, so you should do:

$ solana program deploy --buffer recover.json --upgrade-authority <YOUR_UPGRADE_AUTHORITY> --program-id <YOUR_PROGRAM_ID> /Users/mcesbron/Desktop/work/unidouble/target/deploy/unidouble.so
2
  • Thanks for this, it helped me arrive at the right combination of flags/args. Here was my command structure from my anchor project directory for posterity: $ solana program deploy --buffer ~/path/to/recovered/keypair.json --upgrade-authority ~/.config/solana/my-authority-keypair.json --program-id target/deploy/program-keypair.json target/deploy/my_program.so
    – pwbred
    Commented Apr 30 at 19:16
  • Thanks. Here is my simplified command: $ solana program deploy --buffer ~/.config/solana/id.json --upgrade-authority ~/.config/solana/id.json --program-id target/deploy/counter-keypair.json target/deploy/counter.so
    – Russo
    Commented Jun 17 at 9:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.