Skip to content

Commit

Permalink
chore: update readme with instruction to send wasm to consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
shanithkk committed Mar 25, 2024
1 parent 99ca3c1 commit 18ebb59
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 13 additions & 3 deletions runtime/lite/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,26 @@ This runtime harnesses the capabilities of Secure Scuttlebutt, a decentralized m

cargo run

7. Run a local polakdot chain for test purpose
7. Send workflows to the consumer

let mut stream = TcpStream::connect("127.0.0.1:8080").unwrap();
let wasm = fs::read("<wasm-path>").unwrap();
let buf = RequestBody{wasm: wasm,invite: "text".to_string(),pub_id: "<pub-id>".to_string(),input: serde_json::json!({"test": "test"}),allowed_hosts: None,};
let data = serde_json::to_vec(&buf).unwrap();stream.write_all(&data).unwrap();`
stream.shutdown(std::net::Shutdown::Write).unwrap();

*Note:* Get the pub address using script `./ssb-up.sh pub-whoami`

8. Run a local polakdot chain for test purpose

docker run -p 9944:9944 parity/polkadot:v1.0.0 --dev --rpc-external

8. Run the basic example for producer with required environment variables
9. Run the basic example for producer with required environment variables

PUB_ADDRESS="@pjrBmtifFU9P9NhoHRiPbn3O3xGUXtsLWJXhxLEpkug=.ed25519"
PRODUCER_SECRET=./runtime/lite/scripts/secret/consumer_secret
PRODUCER_PORT=8014
*Note:* Get the pub address using script `./ssb-up.sh pub-whoami`

cargo run --example basic-producer
9. Make transfer event on the chain manually.
10. Make transfer event on the chain manually.
6 changes: 3 additions & 3 deletions runtime/lite/src/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ async fn main() {
dotenv().ok();
let db = CoreStorage::new("runtime").unwrap();
let context = Arc::new(Mutex::new(Context::new(
CoreLogger::new(Some("./workflow")),
CoreLogger::new(Some("./runtime.log")),
db,
)));

let secret = std::env::var("SECRET").unwrap_or_else(|_| {
let secret = std::env::var("CONSUMER_SECRET").unwrap_or_else(|_| {
let home_dir = dirs::home_dir().unwrap();
std::format!("{}/.ssb/secret", home_dir.to_string_lossy())
});
let port = std::env::var("PORT").unwrap_or_else(|_| 8008.to_string());
let port = std::env::var("CONSUMER_PORT").unwrap_or_else(|_| 8008.to_string());
let mut file = async_std::fs::File::open(secret).await.unwrap();
let key = read_patchwork_config(&mut file).await.unwrap();

Expand Down

0 comments on commit 18ebb59

Please sign in to comment.