Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Sample C++ Application for Wallet-Core

Overview

This repository contains a simple but complete C++ sample application, for demostrating usage of the Wallet Core library (part of Trust Wallet).

DISCLAIMER

This is a sample application with demonstration purpose only, do not use it with real addresses, real transactions, or real funds. Use it at your own risk.

Documentation

See the official Trust Wallet developer documentation here.

See especially Wallet Core Integration Guide, and Build Instructions.

Prerequisites

You need to download and build WalletCore yourself (there is no official binary distribution). The dependencies TrezorCrypto and protobuf are also needed, these are also come with WalletCore. You need to build the library.

Building and Running

Go to the samples/cpp folder within wallet core repo:

git clone https://github.com/trustwallet/wallet-core.git
cd wallet-core/samples/cpp

Configure and build -- path to the top-level Wallet Core library folder is needed:

cmake . -DWALLET_CORE=../../
make

Run it:

./sample

The relavant sample code is in the file cpp/sample.cpp.

What it Does

An overview of the operations done in the sample app is as follows.

  • Import a wallet
    • Create a wallet by importing an existing recovery phrase (mnemonic), using HDWallet.
  • Derive address
    • Address is derived from the HD wallet.
  • Create send transaction
    • put together a send transaction (contains sender and receiver address, amount, etc.)
    • sign this transaction (using the private key)

See the Integration Guide.