-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Research on Light Client for Mobile #393
Comments
There may be two approaches to running a light client on Mobile
Here is the reference: I will try to see which approach works best. Update 06-11: |
Recording the compilation process:
export OPENSSL_LIB_DIR=OpenSSL-for-iPhone/bin/iPhoneSimulator17.4-x86_64.sdk/lib
export OPENSSL_INCLUDE_DIR=OpenSSL-for-iPhone/bin/iPhoneSimulator17.4-x86_64.sdk/include
|
Please share the solution of the compilation for iOS, because there's a community team interested in running the light client on mobile. Maybe we can push it together. |
#393 (comment) |
Currently, the light client was called by the iOS app, but the light client run failed with some exceptions. It may be caused by the ckb-rocksdb because I have removed the |
Major progress: The light client can now run successfully on iOS. Here is the demo 2024-08-01.21.37.36.movHere is the full process:
export OPENSSL_LIB_DIR=OpenSSL-for-iPhone/bin/iPhoneSimulator17.4-x86_64.sdk/lib
export OPENSSL_INCLUDE_DIR=OpenSSL-for-iPhone/bin/iPhoneSimulator17.4-x86_64.sdk/include
[patch.crates-io]
rocksdb = { package = "ckb-rocksdb", path="the ckb-rocksdk that fork and edit in previous", version ="=0.21.1" }
[lib]
name = "ckb_light_client"
crate-type = ["staticlib", "cdylib"]
#![allow(clippy::mutable_key_type)]
#[cfg(test)]
#[macro_use]
mod tests;
mod config;
mod error;
mod protocols;
mod service;
mod storage;
mod subcmds;
mod types;
mod utils;
mod verify;
use ckb_app_config::HeaderMapConfig;
use ckb_app_config::NetworkConfig;
use ckb_app_config::SyncConfig;
use config::RunConfig;
use config::parse_config_file;
use env_logger::{Builder, Env, Target};
use types::RpcConfig;
use types::RunEnv;
use types::StoreConfig;
use std::path::PathBuf;
use std::path::Path;
use ckb_types::U256;
use std::os::raw::c_char;
use std::ffi::{CString, CStr};
#[no_mangle]
pub extern fn run_light(to: *const c_char) -> anyhow::Result<()> {
let mut builder = Builder::from_env(Env::default());
builder.target(Target::Stdout);
builder
.try_init()
.expect("env_logger builder init should be ok");
let c_str = unsafe { CStr::from_ptr(to) };
let recipient = match c_str.to_str() {
Err(_) => "there",
Ok(string) => string,
};
println!("Starting run light client ..., config path is {}", recipient.to_string());
let run_env = parse_config_file::<RunEnv>(recipient)?;
match (RunConfig{ run_env }).execute() {
Ok(_) => {
println!("start light client success");
}
Err(e) => {
println!("start light client failed ERROR: {:?}", e)
}
};
println!("Done.");
Ok(())
}
cargo build --target x86_64-apple-ios |
Nowadays, mobile has become the main use of the user's scene, we need to complete the light client mobile adaptation to develop mobile Neuron.
The text was updated successfully, but these errors were encountered: