I am trying to implement this staking program but I don't understand how to deploy it, do I have to deploy the program first?
This the frontend:
https://github.com/SmartCodeBlockchainDev/Nelson-NFT-stacking-frontend
and the program associated:
https://github.com/SmartCodeBlockchainDev/Nelson-NFT-stacking
I make the following:
I've created a anchor project:
anchor init staking --javascript
then I put inside staking/programs the https://github.com/SmartCodeBlockchainDev/Nelson-NFT-stacking/tree/335688dfffb08e0920c394c835aa0afa29a85574 content
and I tried to build ( anchor build
) but it gave me the following error:
failed to read \staking\programs\*\Cargo.toml
and
Caused by: El nombre de archivo, el nombre de directorio o la sintaxis de la etiqueta del volumen no son correctos. (os error 123)
and this:
Failed to obtain package metadata: `cargo metadata` exited with an error: error: failed to load manifest for workspace member `\\?\C:\staking\programs\*`
In order to interact with a program, it must be deployed to the network. For example, if you're trying to use Serum, the Serum program must be deployed somewhere, be it testnet, devnet, mainnet-beta, or even a local network.
The program has an id of 7zR41kNXcdLoyj3yDgEZVmEPR1euvRkrFW1jSqR1Y7ri
declared in the code: https://github.com/SmartCodeBlockchainDev/Nelson-NFT-stacking/blob/335688dfffb08e0920c394c835aa0afa29a85574/src/lib.rs#L9
Unfortunately, this program hasn't been deployed on any network: https://explorer.solana.com/address/7zR41kNXcdLoyj3yDgEZVmEPR1euvRkrFW1jSqR1Y7ri which you can see since the account has 0 SOL. A deployed program will give more information, such as the owner and SOL in the account: https://explorer.solana.com/address/SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy
To deploy a program, you'll need to:
sh -c "$(curl -sSfL https://release.solana.com/v1.10.8/install)"
npm i -g @project-serum/anchor-cli
anchor build
anchor deploy
More information about deploying a program at https://docs.solana.com/cli/deploy-a-program and about Anchor commands at https://project-serum.github.io/anchor/cli/commands.html
First, the error occurred because of the cargo.toml file is not pointing to your program's workspace. an easy way to fix this is to run anchor init on the root directory the copy the initial src folder into the one generated by anchor init inside the programs folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.