Giter VIP home page Giter VIP logo

cypherstack / flutter_libsparkmobile Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 2.0 741 KB

firo-org/sparkmobile for cross-platform Flutter applications.

License: MIT License

C++ 42.59% C 9.07% Dart 30.33% Swift 0.80% Kotlin 0.07% Objective-C 0.02% CMake 13.92% Ruby 2.15% Shell 0.81% Batchfile 0.24%
android blockchain cross-platform cryptocurrency cryptography finance firo ios lelantus linux

flutter_libsparkmobile's Introduction

flutter_libsparkmobile

SparkMobile wrapped as a Flutter plugin for cross-platform mobile and desktop apps. Supports Android, iOS, Linux, Mac, and Windows platforms.

Build

Use flutter build to build or flutter run the example app.

Note that the example app requires Coinlib's secp256k1 lib to be built (use dart run coinlib:build_linux for Linux, dart run coinlib:build_windows for Windows, etc.).

Example

See the example directory for a Flutter app that uses flutter_libsparkmobile.

Integration tests

example/test/integration_test.dart tests various vectors for correctness. Run it from example as in flutter test integration_test/plugin_integration_test.dart.

Development

Bindings generation (dart run ffigen --config ffigen.yaml)

Bindings are generated using ffigen. After bindings are generated, wrap the bound functions in flutter_libsparkmobile.dart.

sparkmobile troubleshooting

If you need to test changes in sparkmobile itself, you may need to install Boost development libraries as in sudo apt install libboost-all-dev.

flutter_libsparkmobile's People

Contributors

julian-cstack avatar rehrar avatar sneurlax avatar

Watchers

 avatar  avatar

flutter_libsparkmobile's Issues

macOS build error in Boost

When building for macOS on Sonoma, I get

Installing flutter_libsparkmobile (0.0.1)
[!] /bin/bash -c 
set -e
"./run_build.sh"

-- Fetching Boost
-- Fetching Boost - done
-- Boost found: 1.71.0 /Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build/_deps/boost-src
-- The following ICU libraries were not found:
--   uc (required)
--   dt (required)
--   i18n (required)
-- Failed to find all ICU components (missing: ICU_LIBRARY _ICU_REQUIRED_LIBS_FOUND) (found version "72.1")
-- Found iconv library: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/libiconv.tbd
-- Checking for module 'mpi-c'
--   No package 'mpi-c' found
-- Checking for module 'mpi-cxx'
--   No package 'mpi-cxx' found
-- OpenSSL version 1.1.1w
-- Configuring done (1.0s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build
[  0%] Built target Boost_chrono
[  0%] Building CXX object deps/boost-cmake/CMakeFiles/Boost_thread.dir/__/__/_deps/boost-src/libs/thread/src/pthread/thread.cpp.o
[  0%] Building C object deps/openssl-cmake/crypto/CMakeFiles/crypto.dir/cversion.c.o
[  0%] Linking C static library libcrypto.a
[ 86%] Built target crypto
[ 94%] Built target ssl
[ 95%] Built target secp256k1_spark
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.28.3/share/cmake/Modules/FetchContent.cmake:1331 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  deps/boost-cmake/CMakeLists.txt:10 (FetchContent_Declare)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at deps/openssl-cmake/CMakeLists.txt:26 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at deps/sparkmobile/secp256k1/CMakeLists.txt:3 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


In file included from /Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build/_deps/boost-src/libs/thread/src/pthread/thread.cpp:11:
In file included from /Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build/_deps/boost-src/boost/thread/thread_only.hpp:22:
In file included from /Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build/_deps/boost-src/boost/thread/detail/thread.hpp:41:
In file included from /Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build/_deps/boost-src/boost/functional/hash.hpp:6:
/Users/user/.pub-cache/git/flutter_libsparkmobile-3f986ca1a94bdac5d31373454c989cc2f5842de8/scripts/macos/build/_deps/boost-src/boost/container_hash/hash.hpp:130:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^
1 error generated.
make[2]: *** [deps/boost-cmake/CMakeFiles/Boost_thread.dir/__/__/_deps/boost-src/libs/thread/src/pthread/thread.cpp.o] Error 1
make[1]: *** [deps/boost-cmake/CMakeFiles/Boost_thread.dir/all] Error 2
make: *** [all] Error 2

Do not rebuild tor via gradle by default for speed

When working on Android, rebuilding tor for every platform every flutter run or build can slow development pace. Not rebuilding tor by default would save some time, especially for Android.

We might consider using debug mode to force rebuilds, and a full build should always happen the first time from a clean slate.

Reduce or eliminate prebuild.sh

  • Instead of copying CMakeLists to where they should go, restructure and/or refactor the process so that they're where they're needed.

Might as well leave it in with the git submodule update bit, though.

Update documentation

Current documentation says to run build scripts, but builds are accomplished by CMake now, so you run flutter build/flutter run it.

Transparent spends

createSparkSpendTransaction just needs wrapping at this point

The CSparkMintMeta is a sticking point at the moment due to the need to serialize a spark::Coin to FFI, which apparently isn't possible using the same method as the other toFFI/fromFFI functions we use for other structs (can't get nonce Scalar k from K or other available properties), however it appears there are serialization/deserialization methods available for a Coin, so I need to use those (at least insofar as for CSparkMintMeta's toFFI).

Then we need to wrap spark::CoverSetData and CAmount (maybe).

Reproduce firoorg/firo/tree/spark and/or firoorg/sparkmobile vectors

  • 24 word seed
  • 12 word seed

firoorg/firo#spark vector:

  • jazz settle broccoli dove hurt deny leisure coffee ivory calm pact chicken flag spot nature gym afford cotton dinosaur young private flash core approve
  • testnet: st15lm2xft9vy9wr4z8tc7m2l58agcjgzudwdrwxyw5fre4mnn6ttx4kqrqx6numsz7yy9n4z93t8qj8jdc3ks7r36ykl9p3cf2gkne5taw82c6xcd2agythz8g27074zkky0qlpssfpjjec
  • mainnet: sm1shqukway59rq5nefgywyrrmmt8eswgjqdgnsdn4ysrsfl2rna60l2drelf6nfe0pamyxh3w8ypa7y35znhf4c6w44d7lw8xu3kjra4sg2v0zn508hawuul5596fm2h4e2csa9egk4ks3a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.