Zhuang's Diary

言之有物,持之以恒

CDP(前称为碳信息披露项目):

  • 网站:cdp.net
  • CDP是一个国际非营利组织,提供一个系统化的平台,让公司、城市、州和地区能够测量、披露、管理和分享关键的环境信息。

Verra

  • 网站:https://verra.org/
  • Verra sets the world’s leading standards for climate action and sustainable development.
    →  We build standards for activities as diverse as reducing deforestation, to improving agricultural practices, to addressing plastic waste, and to achieving gender equality.
    →  We manage programs to certify that these activities achieve measurable high-integrity outcomes.
    →  And we work with governments, businesses, and civil society to advance the use of these standards, including through the development of markets.

张志军 - 国际清算银行创新中心顾问 / 世界银行集团首席信息安全架构师 / 马里兰大学计算机博士 / 北京大学计算机学士

分享题目《跨境支付的量化目标和实施方案》
观点如下:

  1. 关于本题目,达到目标的重点 - 1)通过换汇服务的多样性来降低成本;2)通过系统互联或者央行数字货币来缩短延长。
  2. 对数字货币的安全界定?数字货币的安全需基于法定货币。
  3. 对digital asset在中国的发展建议?香港作为很好的试验田可以先行先试。
  4. 区块链在当前的最佳用例?各大银行间清算。如Onyx 在 J.P.Morgan 内部的使用。
  5. 区块链在国际汇款用例可否使用?目前国际汇款的国际标准是 ISO20022,区块链还不是。

继续讨论 https://github.com/0xPolygonID/polygonid-flutter-sdk ,其中使用了c-polygonid / witnesscalc / rapidsnark / babyjubjub 这4个外部lib库,有c,golang,rust等编译后得到的 .a 文件。那么Flutter开发的部分内容,如手机DB存储等如何重用呢?

Flutter 开发的代码,通过如下方式可以被原生App重用

打包多个静态原生库成为一个xcframework库:

1
xcodebuild -create-xcframework -library <path/to/lib1> -headers <header directory for lib1> -library <path/to/lib2> -headers <header directory for lib2> -output <path/to/output.xcframework>

但是,一个.xcframework 文件在每一个平台中,如macOS,iOS中,只能含有一个静态库。所以可以如下。
第一步,https://www.unix.com/man-page/OSX/1/lipo/

1
2
3
4
lipo -info
lipo -create <path/to/lib1> <path/to/lib2> -output <path/to/combineLib>
lipo <path/to/Fatlib> -thin arm64 -output <path/to/arm64Lib>
lipo <path/to/Fatlib> -thin x86_64 -output <path/to/x86_64Lib>

在 arm64 iOS 设备中,.xcframework / thin lib / fat lib 绝可以调试开发;在 arm64 iOS Simulators仿真中,目前尚无法调试开始 fat lib。

第二步,得到FlutterEngine,即Flutter.framework文件。运行 flutter builld ios-framework 命令后, 从 dart 库编译为 ios framework 的时候,在本地 flutter 电脑中,安装好的工具链目录里在直接 copy 得到 Flutter.framework 文件。

从该命令来看, Flutter.xcframework 是直接 copy 的,app.xcframework 是编译的(从dart),Build plugins 是编译 Flutter SDK 项目用到的第三方库的 framework文件。

总体来看,调用链条如下

App <--> Polygon SDK <--> FlutterEngine(Flutter.framework) <--> PolygonFlutterChannel(dart) <--> UsercaseClass(dart) <--> NativeLibs(swift/c/golang/rust)

React Native 开发的代码,通过如下方式可以被原生App重用

https://github.com/facebook/hermes - A JavaScript engine optimized for running React Native. Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode.
第一步,https://reactnative.dev/docs/hermes, 在该文档中,pod install 执行之后,如iOS开发端,hermes.xcframework 即已经被拉到本地,如下图。

第二步,从 Reactnative 项目代码打包到 jsbundle 资源文件。具体流程是放在了 Xcode 工程里的一个自定义脚本这里,每次Xcodes编译 App 的时候,就会根据情况来对 js 打包。

总体来说,native swift/OC 通过调用 hermes 来调用 React-Native 中的JS 代码逻辑。