Giter Club home page Giter Club logo

lib-ledger-core's Introduction

Ledger Core Library

Core library which will be used by Ledger applications.

This project is considered "legacy", and no new coin support will arrive in the repo; only updates related to currently supported protocols.

Clone project

git clone --recurse-submodules https://github.com/LedgerHQ/lib-ledger-core.git

If you had already forked / cloned the repository before issuing that command, it’s okay. You can initiate the submodules with the following commands:

cd lib-ledger-core
git submodule init
git submodule update

Dependencies

You can skip this dependencies step if you have nix installed.

Build

This project is based on cmake as a build system so you should install it before starting (at least version 3.7).

External dependencies:

  • OpenSSL is needed to build tests of the library.
  • Generation of binding is automated with Djinni.
  • Build on multiple Operating Systems is based on polly toolchains.

Build of C++ library

Nix build

If you have remote builders you can use them with the nix derivation bundled in the repo

Architecture

Utilities/Libraries
  • pkgs.nix holds the packages to use in all the other functions
  • pinned.nix controls the pins of nixpkgs and gitignoreSrc to clean the tree
  • config.nix controls the overrides for packages, most notably sbt
  • secp256k1.nix is a function to build the fork of SECP256K1 used in libcore
Shells
  • libcore-jar.nix is a shell used to build the JAR locally, or in github actions
Local development
  • default.nix holds the function to build libcore derivation, and allows to enter a shell for development or running tests

Using nix-shell

The repository provides a default.nix that allows to get into an environment ready for build. A hook sets the CMAKE_LIBCORE_FLAGS environment variable in the shell that has all the CMake flags you need to build libcore

# To be able to run tests
nix-shell --arg runTests true --arg jni false
# To be able to build a JAR from your local build
nix-shell

mkdir _build
cd _build
cmake .. $CMAKE_LIBCORE_FLAGS
make
ctest

Using nix-build

If you just need the artifact you can build the derivation directly

nix-build

Otherwise to run tests locally against your changes

nix-build --arg runTests true --arg jni false

Building a JAR locally

You can always build the JAR using this command

nix-shell --run "bash nix/scripts/build_jar.sh" nix/libcore-jar.nix --arg useLibcoreDerivation true

Non nix builds

cmake is building out of source, you should create a build directory (e.g. lib-ledger-core-build):

.                           # Directory where clone command was launched
├── lib-ledger-core         # Source files directory
├── lib-ledger-core-build   # Build directory

If you respect this folder structure (and naming), after cd lib-ledger-core-build, you can build the library by running:

cmake -DSYS_OPENSSL=ON -DOPENSSL_ROOT_DIR=<path-to-openssl-root-dir>  -DOPENSSL_INCLUDE_DIR=<path-to-openssl-include-files>  -DOPENSSL_SSL_LIBRARIES=<path-to-openssl-libraries> -DOPENSSL_USE_STATIC_LIBS=TRUE ../lib-ledger-core && make

NB. if you want to build on Windows with Visual Studio by adding the argument -G "Visual Studio 16 2019" in the above cmake command, instead of using make to build the project, you should open the 'ledger-core.sln' solution file with Visual Studio and build the solution with it

If you struggle with how openssl is installed, for example, on macOSX, openssl can be installed with

brew install openssl

you can then use the argument -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl in the above cmake command "DOPENSSL_INCLUDE_DIR" and "DOPENSSL_SSL_LIBRARIES" are not necessary on mac.

On Linux,

apt-get install libssl-dev

you can then use the argument -DOPENSSL_SSL_LIBRARIES=/usr/lib/x86_64-linux-gnu -DOPENSSL_INCLUDE_DIR=/usr/include/openssl in the above cmake command "DOPENSSL_ROOT_DIR" is not necessary on linux.

On Windows, Openssl can be downloaded and installed from https://slproweb.com/products/Win32OpenSSL.html "DOPENSSL_ROOT_DIR" is then the installed path of Openssl in the above cmake command "DOPENSSL_INCLUDE_DIR" and "DOPENSSL_SSL_LIBRARIES" are not necessary on windows.

Several CMake arguments might interest you there:

  • -DCMAKE_BUILD_TYPE=Debug: you should always set that when testing as you will get DWARF debug symbols and debugging instruments support.
  • -DCMAKE_EXPORT_COMPILE_COMMANDS=YES: useful when you’re using a C++ linter, such as cquery.
  • -G "Visual Studio 16 2019": build libcore with Visual Studio on Windows
  • -G Xcode: build libcore with Xcode on Mac
  • -DBUILD_TESTS=OFF: build libcore without unit tests. In this case, openssl arguments are not needed

Building for JNI

Building with JNI (Java Native Interface), allows you to use the library with Java based software. In order to enable JNI mode use

cmake -DTARGET_JNI=ON

This will add JNI files to the library compilation and remove tests. You need at least a JDK 7 to build for JNI (OpenJDK or Oracle JDK)

Build library with PostgreSQL

Dependencies

Make sure that your have PostgreSQL installed on your machine, otherwise the CMake command find_package(PostgreSQL REQUIRED) will fail during configuration.

All Nix builds currently build with Postgres support by default.

Build

You need to add -DPostgreSQL_INCLUDE_DIR=path/to/include/dir in your configuration as a hint for headers' location (e.g. /usr/include/postgresql).

All Nix builds currently build with Postgres support by default.

Wallet Pool Configuration

To use with libcore, simply set value of the key api::PoolConfiguration::DATABASE_NAME to the database's URL connection and set it in the pool's configuration.

It is also possible to configure the size of the connection pool and read-only connection pool when instantiating the PostgreSQL DatabaseBackend : api::DatabaseBackend::getPostgreSQLBackend(int32_t connectionPoolSize, int32_t readonlyConnectionPoolSize).

Local testing

Make sure to have a running PostgreSQL server or PostgreSQL docker container. As an example, if you are running it on localhost:5432 and test_db as database name, database's name forwarded to the pool (through configuration key api::PoolConfiguration::DATABASE_NAME) should look like : postgres://localhost:5432/test_db . In order to run local tests

cd lib-ledger-core-build

On Linux or macOSX,

ctest

On Windows,

ctest -C Debug -VV

if you want to run only one specific unit test. (e.g. the test case BitcoinLikeWalletSynchronization.MediumXpubSynchronization in the test project ledger-core-integration-tests)

./core/test/integration/build/ledger-core-integration-tests "--gtest_filter=BitcoinLikeWalletSynchronization.MediumXpubSynchronization"

Publish libcore JAR into local repository

First you need to build the libcore with JNI enabled

mkdir build_lib_jni
cd build_lib_jni
cmake .. -DSYS_OPENSSL=ON -DOPENSSL_USE_STATIC_LIBS=TRUE -DTARGET_JNI=ON -DPG_SUPPORT=ON
cmake --build . --parallel

Then you can build & publish the jar with sbt publishLocal. A tool script wraps it:

./tools/publish-jar-local.sh ./lib_build_dir_jni

It will publish a maven artifact (available at ~/.ivy2/local/co.ledger/ledger-lib-core_2.12/local-SNAPSHOT) that can be used by any third party

Build production-like version of the library

To build the production-like version of the library use script tools/prod-like-build.sh. This script requires Docker. It starts from building Docker image with required versions of the dependencies. Next it starts the Docker container with that image and the lib-ledger-core source code from the current directory. The resulting ledger-lib-core.jar will be copied from the container to the artifacts sub-directory of the current directory. By default the Release versions of the lib-ledger-core is created. To specify the required build type add it to the command line: ./tools/prod-like-build.sh Debug.

Documentation

You can generate the Doxygen documentation by running the doc target (for instance, make doc with makefiles).

Use Code Coverage

⚠️ Only available on Linux for now (with gcc).

  1. Make sure to have lcov installed
    sudo apt-get install -y lcov
  2. Set the CODE_COVERAGE cmake option to ON
  3. Compute the coverage, in build directory:
  • Based on unit tests only: cmake --build . --config Debug --target coverage_unit
  • Based on all tests: cmake --build . --config Debug --target coverage_all
  1. Open the report: ./coverage/index.html

Use optional compilation checks

  • clang-tidy checks can be activated by setting CLANG_TIDY cmake option to ON
  • include-what-you-use checks can be activated by setting IWYU cmake option to ON

Use optional compilation optimization

  • ccache compilation optimization can be activated by setting CCACHE cmake option to ON

Binding to node.js

The library can be compiled and integrated as an node module in a pretty straightforward way. You will be interested in either using it, or making a new version of the node module.

Using the node module

The lib-ledger-core-node-bindings repository contains the node.js bindings you will need to interface with lib-ledger-core. You can either clone the git repository or simply install from npm directly:

npm i @ledgerhq/ledger-core

Generating a new node module for your system

Generating bindings is a several steps process:

  1. First, you need to make some changes to lib-ledger-core and generate a fresh version of lib-ledger-core.
  2. Clone lib-ledger-core-node-bindings and edit the package.json file in order to remove or comment the "preinstall" line in "scripts".
  3. In the folder of lib-ledger-core, run the tools/generateBindings.sh script by giving it the path to the bindings (i.e. where you cloned lib-ledger-core-node-bindings) and as second argument the path to the directory where you built the lib-ledger-core — it should be something like $(your-lib-ledger-core-dir)/../lib-ledger-core-build or $(your-lib-ledger-core-dir)/build.
    • This script requires an up-to-date djinni. To ensure it’s correctly up to date, go into lib-ledger-core/djinni and run get fetch origin --prune && git rebase origin/master.
    • You will need sbt and java8 for a complete, working install.
    • The script will generate files in both projects. You’re advised to remove the ones created in lib-ledger-core — if any — with a git checkout . and/or git reset ..
  4. cd into lib-ledger-core-bindings and run yarn to generate the bindings.
  5. You will have the module in build/Release/ledgerapp_nodejs.node in the bindings project.
  6. npm i should install your own version.

Support

Libcore:

Libcore can be built for following OSes:

  • MacOS: minimum supported version is macOS 9.0, with x86_64 architecture,
  • Linux: Debian (stretch), Ubuntu and Arch are supported, with x86_64 architecture,
  • Windows: 64-bit architecture is built with MSVC (starting from Visual Studio 15), 32-bit is built with MinGW,
  • iOS: x86_64, armv7 and arm64 architectures are supported, minimum supported version is iOS 10.0,
  • Android: x86, armeabi-v7a and arm64-v8a architectures are supported, minimum supported version is Android 7 (API 24) (Java 8 is needed).

Bindings:

  • NodeJS bindings:
    • Please use node with version >=8.4.0 and <9.0.0 (other versions are not tested (yet)),
    • Node-gyp is used to build native module and requires python with version 2.7.x.

Developement guidelines

Local tests

The best way to run tests locally is to use Nix:

nix-build --arg runTests true --arg jni false

If you don't want to, you can also provision the postgres test database if necessary, and then run ctest.

Code formating

We use clang-format >= 14, not available by default on ubuntu 20.04

Install

sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
sudo apt update
sudo apt install clang-format-14

CI

Rebasing

Rebasing is done easily. If your PR wants to merge feature/stuff -> develop, you can do something like this — assuming you have cloned the repository with a correctly set origin remote:

git checkout feature/stuff
git rebase -i origin/develop

Change the pick to r or reword at the beginning of each lines without changing the text of the commits — this has no effect. Save the file and quit. You will be prompted to change the commits’ messages one by one, allowing you to remove the [skip ci] tag from all commits.

Release process

To release the libcore, a Github action automates everything:

  • Go to Release libcore action
  • Select "Run workflow"
  • Set the version you want to tag

It will automatically:

  • Push the tag
  • Create the Release note
  • Build libcore release (ubuntu 22 & macos 12)
  • Publish libcore jar
  • Update WD

Q/A and troubleshooting

I have updated an include file and test code doesn’t see the changes!

Currently, interface files (headers, .hpp) are not linked by copied directly into the test directory. That means that every time you make a change in the interface that is tested by any code in core/test/, you need to update the copy.

Just run this command:

cd $your_build_folder
rm -rf CMakeFiles CMakeCache.txt

I have upgraded my macOSX system and now I can’t compile anymore.

Especially if you’ve upgraded to Mojave for which there are some breaking changes, you will need to perform some manual tasks — here, for macOSX Mojave:

xcode-select --install
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

lib-ledger-core's People

Contributors

ajinjude avatar alekece avatar amougel avatar barjonr avatar barrystyle avatar bertrandd avatar dependabot[bot] avatar drizzt avatar dud225 avatar gagbo avatar hadronized avatar hlafet-ledger avatar huiqi avatar hzheng-ledger avatar jcoatelen-ledger avatar jdellinger-ledger avatar khalilbellakrid avatar ktollec-ledger avatar mario128mex avatar meriadec avatar mortalkastor avatar noirbizarre avatar onyb avatar pollastri-pierre avatar rdbr avatar teams2ua avatar twilgenbus-ledger avatar viktorb-ledger avatar ybadiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lib-ledger-core's Issues

Address verification

The addresses are too big for Ledger Nano S screen, and the speed is also too fast.

I saw that for some cryptos it shows only the beginning and the end, omitting the middle part, what makes it much simpler and user friendly. Isn't it possible to do it for all of them? And what are the risks of it?

Another idea would be to navigate through the address using the buttons and confirm it pressing both at the same time, or even some kind of 'checksum' of the address on the device and Ledger Live and simplify it to only 6 digits for example.

`make install` erroring when building with `-DBUILD_TESTS=OFF`

I ran the following command in a debian-testing:slim docker image:

root@6f6b2a4cfeb4:/lib-ledger-core-build# cmake -DBUILD_TESTS=OFF  ../lib-ledger-core && make

After that, I ran make install from the same build directory, which failed with:

root@6f6b2a4cfeb4:/lib-ledger-core-build# make install
[  1%] Built target secp256k1
[  1%] Built target bigd
[  1%] Built target fmt
[ 58%] Built target crypto
[ 58%] Built target blake
[ 58%] Built target ethash
[ 58%] Built target snappy
[ 62%] Built target leveldb
[ 62%] Built target sha512256
[ 63%] Built target sqlcipher
[ 65%] Built target soci_core_static
[ 66%] Built target soci_sqlite3
Consolidate compiler generated dependencies of target ledger-core-obj
[100%] Built target ledger-core-obj
[100%] Built target ledger-core
[100%] Built target ledger-core-static
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/openssl/e_os2.h
-- Installing: /usr/local/share/openssl/c_hash
-- Installing: /usr/local/share/openssl/c_info
-- Installing: /usr/local/share/openssl/c_issuer
-- Installing: /usr/local/share/openssl/c_name
CMake Error at core/lib/openssl/cmake_install.cmake:50 (file):
  file INSTALL cannot find
  "/lib-ledger-core/core/lib/openssl/tools/c_rehash": No such file or
  directory.
Call Stack (most recent call first):
  core/lib/cmake_install.cmake:57 (include)
  core/cmake_install.cmake:47 (include)
  cmake_install.cmake:52 (include)


make: *** [Makefile:130: install] Error 1

It seems the install target is trying to install openssl, which IIUC has explicitly been excluded from the build by the BUILD_TESTS=OFF flag.

nanox check failed

image

i got the following errors:

(ledger) localhost:ledger$ python -m ledgerblue.checkGenuine --targetId 0x33000004
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/shangzuo/work/document/ledger/ledger/lib/python2.7/site-packages/ledgerblue/checkGenuine.py", line 140, in
secret = getDeployedSecretV2(dongle, bytearray.fromhex(args.rootPrivateKey), args.targetId, args.issuerKey)
File "/Users/shangzuo/work/document/ledger/ledger/lib/python2.7/site-packages/ledgerblue/checkGenuine.py", line 58, in getDeployedSecretV2
dongle.exchange(apdu)
File "/Users/shangzuo/work/document/ledger/ledger/lib/python2.7/site-packages/ledgerblue/comm.py", line 141, in exchange
raise CommException("Invalid status %04x (%s)" % (sw, possibleCause), sw, response)
ledgerblue.commException.CommException: Exception : Invalid status 69d5 (Unknown reason)

Shuffle outputs

Add a method on TransactionBuilder to shuffle outputs (currently change address is always the last output).

Review api::Logger’s interface

This interface has functions named like i, d, e, w and c. It’s pretty obvious what those are for but info, debug, error, warning and critical wouldn’t hurt and are more explicit and easier to read.

Coin integration: wishlist

Community wishlist

This issue is used as a tracker for currencies that people from our community would like to be integrated in lib-ledger-core. If you want a coin integrated, please comment on this issue.

Disclaimer: this is only a tracking list. A currency (one you want or even yours) listed here doesn’t mean it’s necessarily going to be integrated. Coin integration is currently a work in progress and implies internal strategy decisions that cannot be automated. This is just a community wishlist, not a roadmap.

Disclaimer²: please be respectful towards each others’ wishes. Especially, please try to avoid heated discussion, especially about hard forks, that tend to divide people more than unite them.

If you want to contribute and if you haven’t read it already, we have a CONTRIBUTING document stating which type of contribution we accept. Thank you.


  • Energi (NRG) #141.
  • NIX (NIX) #94.
  • Unobtanium (UNO) #55.
  • lbry_credits #24.
  • Gamecredits #44

Invalid "FROM" address in Ledger Live

Hi there,

A user reported the following issue: this transaction shows a different "FROM" address in Ledger Live (screenshot attached) compared with the public one. The highlighted address shown is 16RLCxMiT6b9bCQCfQiYViqPT26JLysuVp while the "public" one is actually 3NWraTvebTsDNHi5Swnymx7sVVPpMD6C8s.

Thanks!

screenshot 2018-12-19 at 14 05 01

Missed include, msvc build.

Having troubles while building ledger-core with VC++ 2019 using CMake 3.15.2.

2>C:\Work\lib-ledger-core\core\src\utils\hex.cpp(67,28): error C2039:  'invalid_argument': is not a member of 'std'
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.21.27702\include\vector(19): message :  see declaration of 'std'
2>C:\Work\lib-ledger-core\core\src\utils\hex.cpp(67,44): error C3861:  'invalid_argument': identifier not found
3>LINK : fatal error LNK1104: cannot open file 'C:\Work\lib-ledger-core\build\core\src\ledger-core-obj.dir\RelWithDebInfo\hex.obj'
4>LINK : fatal error LNK1181: cannot open input file 'C:\Work\lib-ledger-core\build\core\src\ledger-core-obj.dir\RelWithDebInfo\hex.obj'

image

Adding an include - fixes the build error.

Provide a tool to update library version

That tool should be able to change the version number in all required places.

When this issue is done, please edit the contributing.md file to add hints about the tool.

Cosmos Mintscan URL Structure Changed

The Mintscan URL structure has changed since the cosmos_synchronization.cpp file was last touched, creating breakage in the apps. The new url structure should be "mintscan.io/cosmos/..." instead of "mintscan.io/..."

File: lib-ledger-core/core/test/integration/synchronization/cosmos_synchronization.cpp

URL Should be updated to:
Line 407: https://www.mintscan.io/cosmos/account/{}
Line 553: https://www.mintscan.io/cosmos/validators/{}
Line 767: https://www.mintscan.io/cosmos/account/{}
Line 786: https://www.mintscan.io/cosmos/account/{}

Goes hand-in-hand with this issue: LedgerHQ/ledgerjs#749

cannot find LedgerAPI blockexplorer implementation

Hi @EricLarch @btchip @KhalilBellakrid @pollastri-pierre

We are using Ledger's lib-ledger-core and C++ / Qt to build a trustless P2P exchange based on HTLCs with an integrated multi-currency wallet.

Our integration was smooth until we discovered that lib-ledger-core's WalletPool used for creating wallets (BTC, ETH, XRP, XMR) seems to query your server infrastructure, such as
eth-mainnet.explorers.dev.aws.ledger.fr.

We can see that WalletPool is using the websocket protocol with Ledger API and references to LedgerApiBitcoinLikeBlockchainObserver & LedgerApiEthereumLikeBlockchainExplorer. Unfortunately, we are unable to find any further references to Ledger API, its source code or live server instances which we can query.

Our goal is to setup a multi-currency wallet utilizing lib-ledger-core. Could you kindly advise us where we could find LedgerApi's block explorer and self-host it? Are there alternatives in case your explorer is closed-sourced?

Btw we also stumbled upon these tasks: https://github.com/LedgerHQ/lib-ledger-core/projects/10#card-13905293, https://github.com/LedgerHQ/lib-ledger-core/projects/10#card-13905295 - do you still plan to work on them, and do you deem them feasible?

In the event that the answer is yes, we can try to work on a PR into lib-ledger-core to communicate with bitcoind/geth nodes directly, eventually getting rid of LedgerAPI's hosted blockexplorer instances, and/or making this approach an alternative to using LedgerAPI servers.

Potential memory leak

File:/src/math/Base58.cpp:75

std::string ledger::core::Base58::encode(const std::vector<uint8_t> &bytes,
                                         const std::shared_ptr<api::DynamicObject> &config) {
    auto base58Dictionary = getNetworkBase58Dictionary(config);
    std::string result;
    const double iFactor = 1.36565823730976103695740418120764243208481439700722980119458355862779176747360903943915516885072037696111192757109;
    int len = bytes.size();
    int zeros = 0, length = 0, pbegin = 0, pend;
    pend = len;
    while (pbegin != pend && !bytes[pbegin]) pbegin = ++zeros;
    const int size = 1 + iFactor * (double)(pend - pbegin);
    unsigned char* b58 = new unsigned char[size];
    for (int i = 0; i < size; i++) b58[i] = 0;
    while (pbegin != pend) {
        unsigned int carry = bytes[pbegin];
        int i = 0;
        for (int it1 = size - 1; (carry || i < length) && (it1 != -1); it1--, i++) {
            carry += 256 * b58[it1];
            b58[it1] = carry % 58;
            carry /= 58;
        }
        if (carry) return result; //b58 - memory leak, result - return of uninitialized value
        length = i;
        pbegin++;
    }
    int it2 = size - length;
    while ((it2 - size) && !b58[it2]) it2++;

    int ri = 0;
    while (ri < zeros) { result += base58Dictionary[0]; ri++; }
    for (; it2 < size; ++it2) result += base58Dictionary[b58[it2]];
    delete[] b58;
    return result;
}

Coin integration: THORChain (RUNE)

Hi, a potential consideration:

THORChain is the largest and only decentralised cross-chain exchange. Top50 token. It is based on Cosmos/Tendermint SDK. Ledger app recently approved.

Various wallets such as Trust Wallet, ASGARDEX-electron and app.thorswap.finance have integrated THORChain send/receive: trustwallet/wallet-core#1368

Resources
SEED
https://seed.thorchain.info/
THORNODE API
https://thornode.thorchain.info/thorchain/doc/
MIDGARD API V2
https://midgard.thorchain.info/v2/doc
THORNODE TENDERMINT RPC
https://rpc.thorchain.info
MAINNET CHAINS CLIENTS
https://bnb.thorchain.info
https://btc.thorchain.info
https://eth.thorchain.info
https://bch.thorchain.info
https://ltc.thorchain.info
m/44'/931'/0'/0/0
https://viewblock.io/thorchain
https://github.com/xchainjs/xchainjs-lib
https://docs.thorchain.org

Future
Similar to Trust Wallet, once integrated coin, LedgerLive use can use decentralised swaps and liquidity ("LP") in the same way ShapeShift are using THORChain, including optional affiliate fees. This is as simple as sending funds with a memo to the current inbound vault (or router).

Add the ability to configure hash algorithm for BitcoinLike currencies

Currently we only use sha256 as the hashing algorithm for blockchain protocols based on Bitcoin. Some currencies are using different hashing algorithm and we need to abstract this.

The most flexible solution will be to abstract hashing for every single case we need to hash:

  • The hash function used to compute transaction hash
  • The hash function used to derive public keys
  • Hash function to compute challenge to sign
  • ...

not installing due to an error

$ cmake -DCMAKE_INSTALL_PREFIX=/path/to/qt5 ../lib-ledger-core && make
-- CMake version: 3.11.2
-- Build type:
CMake Error at core/lib/CMakeLists.txt:18 (add_subdirectory):
The source directory

/home/lib-ledger-core/core/lib/spdlog

does not contain a CMakeLists.txt file.

-- Configuring SOCI:
-- SOCI_VERSION = 3.2.3
-- SOCI_ABI_VERSION = 3.2
-- SOCI_PLATFORM_NAME = x64
-- SOCI_COMPILER_NAME = gcc-8
-- SOCI_SHARED = OFF
-- SOCI_STATIC = ON
-- SOCI_TESTS = ON
-- Looking for SOCI dependencies:
-- Boost:
CMake Warning at /usr/share/cmake/Modules/FindBoost.cmake:587 (message):
Imported targets and dependency information not available for Boost version
(all versions older than 1.33)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindBoost.cmake:950 (_Boost_COMPONENT_DEPENDENCIES)
/usr/share/cmake/Modules/FindBoost.cmake:1618 (_Boost_MISSING_DEPENDENCIES)
core/lib/soci/cmake/dependencies/Boost.cmake:5 (find_package)
core/lib/soci/cmake/SociDependencies.cmake:77 (include)
core/lib/soci/CMakeLists.txt:68 (include)

-- WARNING:
-- Boost not found, some libraries or features will be disabled.
-- See the documentation for Boost or manually set these variables:
-- BOOST_RELEASE_VERSION =
-- BOOST_INCLUDE_DIR =
-- BOOST_LIBRARIES =
-- MySQL:
-- MySQL not found.
-- MySQL Embedded not found.
-- WARNING:
-- MySQL not found, some libraries or features will be disabled.
-- See the documentation for MySQL or manually set these variables:
-- MYSQL_INCLUDE_DIR = MYSQL_INCLUDE_DIR-NOTFOUND
-- MYSQL_LIBRARIES = MYSQL_LIBRARIES-NOTFOUND
-- ODBC:
-- WARNING:
-- ODBC not found, some libraries or features will be disabled.
-- See the documentation for ODBC or manually set these variables:
-- ODBC_INCLUDE_DIR = ODBC_INCLUDE_DIR-NOTFOUND
-- ODBC_LIBRARIES = ODBC_LIBRARY-NOTFOUND
-- Oracle:
-- WARNING:
-- Oracle not found, some libraries or features will be disabled.
-- See the documentation for Oracle or manually set these variables:
-- ORACLE_INCLUDE_DIR =
-- ORACLE_LIBRARIES =
-- PostgreSQL:
-- WARNING:
-- PostgreSQL not found, some libraries or features will be disabled.
-- See the documentation for PostgreSQL or manually set these variables:
-- POSTGRESQL_INCLUDE_DIR = POSTGRESQL_INCLUDE_DIR-NOTFOUND
-- POSTGRESQL_LIBRARIES = POSTGRESQL_LIBRARIES-NOTFOUND
-- POSTGRESQL_VERSION = unknown
-- SQLite3:
-- WARNING:
-- SQLite3 not found, some libraries or features will be disabled.
-- See the documentation for SQLite3 or manually set these variables:
-- SQLITE3_INCLUDE_DIR = /usr/bin
-- SQLITE3_LIBRARIES = SQLITE3_LIBRARY-NOTFOUND
-- Firebird:
-- WARNING:
-- Firebird not found, some libraries or features will be disabled.
-- See the documentation for Firebird or manually set these variables:
-- FIREBIRD_INCLUDE_DIR = FIREBIRD_INCLUDE_DIR-NOTFOUND
-- FIREBIRD_LIBRARIES = FIREBIRD_LIBRARIES-NOTFOUND
-- FIREBIRD_VERSION =
-- DB2:
-- WARNING:
-- DB2 not found, some libraries or features will be disabled.
-- See the documentation for DB2 or manually set these variables:
-- DB2_INCLUDE_DIR = DB2_INCLUDE_DIR-NOTFOUND
-- DB2_LIBRARIES = DB2_LIBRARY-NOTFOUND
-- Configuring SOCI core library:
-- SOCI_CORE_TARGET = soci_core
-- SOCI_CORE_TARGET_OUTPUT_NAME = soci_core
-- SOCI_CORE_DEPENDENCIES = -lpthread /usr/lib64/libdl.so
-- WITH_BOOST = ON
-- COMPILE_DEFINITIONS = SOCI_ABI_VERSION="3.2" HAVE_DL=1 SOCI_LIB_PREFIX="libsoci_" SOCI_LIB_SUFFIX=".so"
-- Configuring SOCI database backends:
-- MySQL not found.
-- MySQL Embedded not found.

-- Configuring incomplete, errors occurred!
See also "/home/fedora/CMakeFiles/CMakeOutput.log".
See also "/home/fedora/CMakeFiles/CMakeError.log".

Hi

I get this error when i cmake. Could you help me, level beginner

Ethereum message signing hex preview incorrect

When signing this message on a Ledger Nano S:

0x21c78f55e3f54ab5d872bfea03ad05d7bfb3d35dc1a537fd3ae731cdbb9bea21

which is the result of running:

0x3bd03be584f9df8a79ed49d8502c63d5fcff148157544242ffdbcc2b64321b1e

through:

keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))

I am shown the following "message hash" on the Ledger Nano S display when prompted to confirm the signing:

1DAO...8EEE

When I'd expect to be shown:

21C7...EA21

If I disregard this discrepancy and sign the message anyway and verify the v, r, s values with the message I sent to the Ledger, I can verify that it is in-fact the message that was signed. The signature is valid for the expected value.

Why is this other "message hash" being presented to the user? Where does it come from? Any clarity on this would be great since we want our users to be able to confirm that they are signing the exact message they think they are signing.

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.