I am trying to deploy a simple program on a local solana-test-validator
I start the validator
docker run -it --entrypoint solana-test-validator -p 8899:8899 -p 8900:8900 -p 9900:9900 solanalabs/solana:v1.8.11
Then I create an account with a wallet with some SOL in it
solana config set --url http://localhost:8899
KEYPAIR_ACCOUNT1="/root/.config/solana/id1.json"
solana-keygen new -o $KEYPAIR_ACCOUNT1 --force
PUBKEY_ACCOUNT1=`solana-keygen pubkey $KEYPAIR_ACCOUNT1`
solana-keygen verify $PUBKEY_ACCOUNT1 $KEYPAIR_ACCOUNT1
solana balance $PUBKEY_ACCOUNT1
solana airdrop 10 $PUBKEY_ACCOUNT1
I am building this simple program:
https://gitlab.com/rahasak-labs/solana-localnet/-/tree/master/contract
I make sure the the local solana is also 1.8.11 (I tried with 1.9.2 as well)
cd solanaworkspace/contract_helloworld
# lib for building smartcontract
cargo install rustfilt
# build helloworld
cargo build-bpf --dump
to deploy the program I do:
I use the --keypair $KEYPAIR_ACCOUNT1 to deploy /solanaworkspace/contract_helloworld/target/deploy/helloworld.so
which is going to use the default .json key pair at $KEYPAIR_PROGRAM1
KEYPAIR_PROGRAM1=/solanaworkspace/contract_helloworld/target/deploy/helloworld-keypair.json
PUBKEY_PROGRAM1=`solana-keygen pubkey $KEYPAIR_PROGRAM1`
# solana account $PUBKEY_PROGRAM1
solana program deploy --keypair $KEYPAIR_ACCOUNT1 /solanaworkspace/contract_helloworld/target/deploy/helloworld.so
This is going to try to submit it 5 times until it fails with Blockhash expired
While it is trying to deploy I see logs like this one:
Waiting for next block, 60 pending... [block height 693; re-sign in 285 ]
It also says up until 60 but then reset to Waiting for next block
:
Sending 36/60 transactions
What am I doing wrong?
It's pretty easy to replicate with the docker container I guess. Thanks a lot.
EDIT: hmmmmm it works when it's not running in a docker container. I am still wondering with is wrong.
Program deploys are done through the TPU (transaction processing unit) of the validator, which listens to a different port, 8003
. If that port isn't accessible, then sending the program deploy transactions will fail.
You can start by adding port 8003
in your startup, and if it's still failing, open up every port listed in the Dockerfile: https://github.com/solana-labs/solana/blob/005592998dd107b3d54d9203babe24da681834f5/sdk/docker-solana/Dockerfile#L3