Skip to content

Commit 4050e13

Browse files
shurli recent dev updates
1 parent b2d03c3 commit 4050e13

2 files changed

Lines changed: 98 additions & 1 deletion

File tree

602 KB
Loading

index.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,101 @@
22
layout: default
33
---
44

5-
# shurli.io
5+
6+
### [Dev Update: June 30, 2020 (NZST)](#update-june-30-2020)
7+
8+
```shell
9+
➜ go_dart_ffi_c_shared git:(master) ✗ dart client.dart
10+
awesome.Add(12, 99) = 111
11+
➜ go_dart_ffi_c_shared git:(master) ✗ ls -lha
12+
total 5376
13+
drwxr-xr-x 10 satinder staff 320B 30 Jun 01:49 .
14+
drwxr-xr-x@ 29 satinder staff 928B 29 Jun 20:20 ..
15+
-rw-r--r-- 1 satinder staff 614B 29 Jun 20:25 awesome.go
16+
-rw-r--r-- 1 satinder staff 1.7K 29 Jun 20:25 awesome.h
17+
-rw-r--r-- 1 satinder staff 2.6M 30 Jun 01:49 awesome.so
18+
-rwxr-xr-x 1 satinder staff 13K 29 Jun 22:44 client
19+
-rw-r--r-- 1 satinder staff 354B 30 Jun 01:50 client.dart
20+
-rw-r--r-- 1 satinder staff 780B 29 Jun 22:14 client1.c
21+
-rwxr-xr-x 1 satinder staff 13K 29 Jun 22:43 client2
22+
-rw-r--r-- 1 satinder staff 1.8K 29 Jun 22:43 client2.c
23+
➜ go_dart_ffi_c_shared git:(master)
24+
```
25+
26+
okay, fixed it to understand it better
27+
I just removed all other unnecessary example function codes to minimise the scope to test and verify the process of executing a function from a library file using Dart
28+
just included Add function from .so file which was compiled from go 🙂
29+
and called it from .dart file, and it seem to work as expected
30+
my requirement is just that small as I see
31+
I only need to execute the main() function of my gRPC server go code, and I guess just calling a single function to execute should be enough to start gRPC as the Dart based flutter app starts
32+
will do that test next, with a simple hello greeter gRPC example code, again keeping it's scope less for this testing 😁
33+
34+
right now, I'm only trying to solve the challenges I have in mind to make sure I don't get stuck too long on those
35+
so made gRPC with 2 APIs to make sure I understand and it works as expected
36+
then tested FFI code of go, called the functions from compiled library in C language file
37+
and then in Dart
38+
Also, followed up Flutter's documentation to test the Add function in flutter for both iOS and Android
39+
so at least these steps I have tested and validated that I can at least do something and what kind of challenges there are further
40+
so, adding more further APIs to gRPC seems easy now, since I have experienced and tested that
41+
the challenge after testing FFI I identified is to make the gRPC server start by calling the main function which will start the gRPC server within App!
42+
it is a challenge, since if just starting the `go run server.go` it stops the stdout on the command prompt and waits for the keyboard input signal like CTRL+C to cancel or kill the process
43+
so this behaviour I need to manage with the Dart code
44+
but I have already tried this earlier 🙂
45+
with Shurli
46+
when I made it a daemon and just gave it a start/stop command over command line
47+
so I can just make the start/stop argument for the library file too, and let the gRPC server run in the background process and also kill it
48+
so this whole mindmap of problems and solutions been a long trail of efforts in last few months
49+
I still expect challenges, since Dart's FFI is in beta stage! and I found that advanced Go to Dart interaction a bit tricky, which I'll need to wrap my head around to properly fix any issues if arise in future
50+
51+
52+
### [Dev Update: June 29, 2020 (NZST)](#update-june-29-2020)
53+
54+
Dart language only interoperable with C language, so any language exports it's functions and datatypes for C and those are called in Dart.
55+
I just tried Golang code and called the functions in C language code, with Dynamic library linking and Dynamically loading the .so library. Read the C code from sample code where I learned it from, and can understand the C language code part fine.
56+
Also got the Dart sample code to use FFI, but it did not work as expected:
57+
https://github.com/vladimirvivien/go-cshared-examples/issues/21
58+
59+
Gonna try sorting this out first before I move ahead....
60+
61+
62+
### [Dev Update: June 28, 2020 (NZST)](#update-june-28-2020)
63+
64+
a little update:
65+
Since I'm doing gRPC, I see that my existing RPC API is pretty much as is being ported to gRPC, since all the logic code is written in the existing API.
66+
and gRPC is too easy to define and work as I learned and practicing now.
67+
68+
But I found there is some pointer error which is thrown if any single coin's RPC Is busy while other coins' RPC is responding.
69+
For example if KMD is doing `importprivkey` command and busy doing the rescan, and all other coins like PIRATE, DEX, MCL etc are responding, my gRPC code throws that pointer error and ends the process.
70+
71+
I tried to solve that, but feels lacking in my debugging skills with `dlv` which is similar to `gdb`.
72+
will try to solve that sooner or later coz it's kind of critical bug to fix.
73+
Right now, I'm checking on FFI ( foreign function interface) so that I can compile my gRPC code to a library and call it's functions/methods/variables etc from Dart Language.
74+
looking at latest developments happening in Flutter, at the moment, it's Desktop rendering engine is experimental, but really hoping that by the end of 2020, or early 2021, this Desktop Rendering engine will be mature enough to be out in public use with some level of stability.
75+
I'd prefer to use the official Desktop Rendering engine instead of going the unofficial Hover Go, the Flutter's unofficial Desktop rendering engine
76+
It's known that Flutter's official Desktop rendering engine is good enough state for Linux, and is in development for Mac and Windows. I need to check on it's latest development updates.
77+
But as I suspect since Apple is now moving to Apple's own Silicon Chips, I suspect it won't take long enough for Flutter team to support Mac with full support for Desktops too
78+
that means new Mac machines will have full support of official Desktop app rendering engines
79+
since Flutter is already stable and supported on mobile devices, and Apple Silicon will be on same chipset/framework for desktops
80+
EDITED
81+
feeling like I'm playing with a lot and lots of new technologies in their development state 😅
82+
so, using FFI, and calling Golang library from Dart, I'll be able to execute the gRPC on the device itself where the application will run.
83+
and since on iOS it is not supported to bundle an executable on iOS Apps, using FFI is the only route as I understand, so being already future ready with the code architecture
84+
so, this Dart code of Flutter will always invoke the main function from Golang library code to start gRPC server and Dart will act as a client, where the purpose of golang's gRPC server will be interact with Native coins' RPC or nSPV or Electrum or etc etc.
85+
Kind clearing my mind to a debugging duck here if anyone reads 😅
86+
87+
88+
### [Dev Update: June 25, 2020 (NZST)](#update-june-25-2020)
89+
90+
things are progressing slowly but consistently in Shurli development.
91+
I did start Flutter front-end code and made stub front end for testing. it's just very basic so far.
92+
Thought it would be better if I instead use existing data than stub values and doing the gRPC API to finish first, where I'm at right now.
93+
In progress Flutter UI of Shurli looks like this:
94+
95+
![flutter_shurli_ui_test](https://github.com/meshbits/shurli.github.io/blob/master/images/20200625/flutter_shurli_ui_test.png?raw=true)
96+
97+
98+
When @khatana will have the designs for frontend ready, I'll do the GUI code according to those designs
99+
I think it's best until then I finish up on the gRPC work
100+
hopefully by then the Shurli Logo will be finalised and we will be then working on the GUI design work
101+
thought I give couple of you guys some update here. been long time 🙂
102+

0 commit comments

Comments
 (0)