forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SVM: add a sample stand-alone application based on SVM
- Loading branch information
Showing
17 changed files
with
15,336 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This is an example application using SVM to implement a tiny subset of | ||
Solana RPC protocol for the purpose of simulating transaction | ||
execution without having to use the entire Solana Runtime. | ||
|
||
The exmample consists of two host applications | ||
- json-rpc-server -- the RPC server that accepts incoming RPC requests | ||
and performs transaction simulation sending back the results, | ||
- json-rpc-client -- the RPC client program that sends transactions to | ||
json-rpc-server for simulation, | ||
|
||
and | ||
|
||
- json-rpc-program is the source code of on-chain program that is | ||
executed in a transaction sent by json-rpc-client. | ||
|
||
To run the example, compile the json-rpc-program with `cargo | ||
build-sbf` command. Using solana-test-validator create a ledger, or | ||
use an existing one, and deploy the compiled program to store it in | ||
the ledger. Using agave-ledger-tool dump ledger accounts to a file, | ||
e.g. `accounts.out`. Now start the json-rpc-server, e.g. | ||
``` | ||
cargo run --manifest-path json-rpc-server/Cargo.toml -- -l test-ledger -a accounts.json | ||
``` | ||
|
||
Finally, run the client program. | ||
``` | ||
cargo run --manifest-path json-rpc-client/Cargo.toml -- -C config.yml -k json-rpc-program/target/deploy/helloworld-keypair.json -u localhost | ||
``` | ||
|
||
The client will communicate with the server and print the responses it | ||
recieves from the server. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
json_rpc_url: http://127.0.0.1:8899 | ||
websocket_url: '' | ||
keypair_path: svm/examples/test.json | ||
address_labels: | ||
'11111111111111111111111111111111': System Program | ||
commitment: confirmed |
Oops, something went wrong.