8

I am attempting to run the HelloWorld Solana program. I started the project with

solana-test-validator

I ran npm install and then was able to build the rust project. I can see the .so file in the directory /dist/program/helloworld.so. When I try to deploy the program to Solana, I run

solana program deploy dist/program/helloworld.so

And here is the error I get

Error: Dynamic program error: No such file or directory (os error 2)

What else should I try?

1
  • If you are sure you can view the .so directory, perhaps you could check if your wallet is configured correctly, if not you could try running solana-keygen new to create a new file wallet in your local machine Commented Sep 21, 2022 at 22:24

2 Answers 2

3

First, use the 

npm run build:program-rust(or any file that contains your rust src)

 command to compile your program to a file with the so file extension. (Run 

solana-keygen new

 to create and save a solana keypair locally.) Set up your localnet with the command (that should now be in your PATH) 

solana-test-validator

When calling 

solana config get

your "RPC URL" should now equal http://localhost:8899. If not, run 

solana config set --url http://localhost:8899

Running 

solana balance

 will show your balance which should NOT be 0. If it is, stop the validators, make sure you have created a key with solana-keygen new and start it again from genesis with solana-test-validator -r. Then, run

solana logs 

to see all the interactions with your local cluster. Use the 

solana program deploy /(your project name)/dist/program/helloworld.so 

to deploy your program to localnet

0

Assuming solana-test-validator is running

  • cargo build-bpf --manifest-path=./Cargo.toml --bpf-out-dir=dist/program

this will create the output in dist/program

  • solana-keygen new -o ./wallets/Owner.json this will spit an address like "Be4PYPjaKFYsZN847SFBEPm6UNErfRD8qrCZ1rfn6rUw" on terminal

  • solana airdrop 2 Be4PYPjaKFYsZN847SFBEPm6UNErfRD8qrCZ1rfn6rUw

  • solana deploy dist/program/directoryName_program.so - this will spit out this on terminal: "Program Id: 7zkE9MbN4yDybYP9j19kmZjTA855SMh2kFW2C1Pj8EHN"

.so stands for 'shared object'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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