npx soprox -n my-app
cd my-app
A template will be generated. In the current template, you can start/stop your devnet as well as your programs. First of all, you need to to install and start your devnet,
npm run localnet:updatenpm run localnet:up
Make sure you did install Docker and start it on your machine. The devnet will run on port 8899, so you need to free this port in case occupied.
The devnet will run in background that means you cannot see the stream of logs. To stream the logs on terminal, you must run npm run localnet:logs
.
Then, we need to create an account with SOL to run our application. Fortunately, SoproX support you to create one.
A new account with 100 will be created in devnet. Do not reuse the example account below to store your SOL.
npx soprox --payer
You will see logs printed out,
Connection to cluster established: http://localhost:8899 { 'solana-core': '1.3.12 64af7127' }Current balance of D9QcD94LhSp5FhSgQNRpjL8q9qH1cfgCfbh9R4RhGc3c is 100 SOLA new payer is created. Details:Address: D9QcD94LhSp5FhSgQNRpjL8q9qH1cfgCfbh9R4RhGc3cPublic key: b47395094a278fa7f6f5ba63f81da754925ad2c2db54477faea8f2503aaad51bSecret key: 4b900b96d2f11f906edf9d9486194b8d9cfa85df3f520f76a4956fe18ca37b6fb47395094a278fa7f6f5ba63f81da754925ad2c2db54477faea8f2503aaad51b
Add the information to soprox.config.js
like this.
{"network": {"devnet": "http://localhost:8899","testnet": "","mainnet": ""},"payers": [{"address": "D9QcD94LhSp5FhSgQNRpjL8q9qH1cfgCfbh9R4RhGc3c","secretKey": "4b900b96d2f11f906edf9d9486194b8d9cfa85df3f520f76a4956fe18ca37b6fb47395094a278fa7f6f5ba63f81da754925ad2c2db54477faea8f2503aaad51b"}]}
Next, build your SRP and deploy it,
npm run buildnpm run deploynpm start
Your terminal should show something like
Let's say hello to a Solana account...Connection to cluster established: http://localhost:8899 { 'solana-core': '1.3.12 64af7127' }Current data: { numGreets: 2, toggleState: false }Saying hello to 5Jstqgn4PeeZ1doPgD3XiNxBuK524Bmv6jvez7HZH8SwNew data: { numGreets: 3, toggleState: true }Success
โ๐ Hooray! You did it well.