From 18ebb5923f7e0f97246eff724d4924f004663360 Mon Sep 17 00:00:00 2001 From: Shanith K K Date: Tue, 26 Mar 2024 01:21:58 +0530 Subject: [PATCH] chore: update readme with instruction to send wasm to consumer --- runtime/lite/Readme.md | 16 +++++++++++++--- runtime/lite/src/consumer.rs | 6 +++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/runtime/lite/Readme.md b/runtime/lite/Readme.md index 9eb6ea6a..160c8d5e 100644 --- a/runtime/lite/Readme.md +++ b/runtime/lite/Readme.md @@ -44,11 +44,21 @@ 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("").unwrap(); + let buf = RequestBody{wasm: wasm,invite: "text".to_string(),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 @@ -56,4 +66,4 @@ This runtime harnesses the capabilities of Secure Scuttlebutt, a decentralized m *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. \ No newline at end of file +10. Make transfer event on the chain manually. \ No newline at end of file diff --git a/runtime/lite/src/consumer.rs b/runtime/lite/src/consumer.rs index 22c8b765..86a297c9 100644 --- a/runtime/lite/src/consumer.rs +++ b/runtime/lite/src/consumer.rs @@ -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();