• This repository has been archived on 26/Apr/2024
  • Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    TypeScript
  • License
    Other
  • Created over 1 year ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Coinbase Wallet as a Service (WaaS) SDK for React Native. Enables MPC Operations for iOS and Android Devices.

React Native WaaS SDK

This is the repository for the mobile React Native SDK for Wallet-as-a-Service APIs. It exposes a subset of the WaaS APIs to the mobile developer and, in particular, is required for the completion of MPC operations such as Seed generation and Transaction signing.

Prerequisites:

For iOS development:

For Android development:

Installation

React Native

With npm:

npm install --save @coinbase/waas-sdk-react-native

With yarn:

yarn add @coinbase/waas-sdk-react-native

Android

In your Android application's settings.gradle file, make sure to add the following:

include ":android-native", ":android-native:go-internal-sdk", ":android-native:mpc-sdk" 

project(':android-native').projectDir = new File(rootProject.projectDir, '../node_modules/@coinbase/waas-sdk-react-native/android-native')
project(':android-native:mpc-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/@coinbase/waas-sdk-react-native/android-native/mpc-sdk')
project(':android-native:go-internal-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/@coinbase/waas-sdk-react-native/android-native/go-internal-sdk')

Usage

See index.tsx for the list of supported APIs.

Example App

This repository provides an example app that demonstrates how the APIs should be used.

NOTE: An example Cloud API Key json file is at example/src/.coinbase_cloud_api_key.json To run the example app, populate, or replace, this file with the Cloud API Key file provided to you by Coinbase.

Running in Proxy-Mode (recommended)

To run the example app using proxy-mode:

  1. Ensure the proxy server is correctly set up and active at the designated endpoint. The default endpoint is localhost:8091.
  2. If your proxy server endpoint differs from the default, update the proxyUrl in the config.json file accordingly.
  3. On app startup, choose Proxy Mode from the Mode Selection screen.

Running in Direct-Mode (not recommended)

To run the example app using direct-mode:

  1. Populate the .coinbase_cloud_api_key.json file with your personal API credentials.
  2. On app startup, select Direct Mode from the Mode Selection screen.

iOS

Ensure you have XCode open and run the following from the root directory of the repository:

yarn bootstrap # Install packages for the root and /example directories
yarn example start # Start the Metro server
yarn example ios --simulator "iPhone 14" # Build and start the app on iOS simulator

NOTE: To build an app that depends on the WaaS SDK, you'll also need a compatible version of OpenSSL. You can build the OpenSSL framework by running the following on your Mac from the root of this repository:

yarn ssl-ios

You can alternatively depend on an open-compiled version of OpenSSL, like OpenSSL-Universal, by adding the following to your app's Podfile:

pod "OpenSSL-Universal"

Android

Ensure you have the following Android environment variables set correctly:

  • ANDROID_HOME
  • ANDROID_SDK_ROOT="${ANDROID_HOME}"
  • ANDROID_NDK_HOME="${ANDROID_HOME}/ndk/<insert ndk version>"
  • ANDROID_NDK_ROOT="${ANDROID_NDK_HOME}"

And then export the following to your PATH:

export PATH="${ANDROID_HOME}/emulator:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH}"

Run the following from the root directory of the repository:

yarn install # Install packages for the root directory
emulator -avd Pixel_5_API_31 # Use any x86_64 emulator with min SDK version: 30.
yarn example start # Start the Metro server
yarn example android # Build and start the app on Android emulator

By following the above steps, you should be able to run the example app either in proxy-mode or direct-mode based on your preference and setup.

Recommended Architecture

Broadly speaking, there are two possible approaches to using the WaaS SDK:

  1. Use the WaaS backends directly for all calls.
  2. Use the WaaS backends directly only for MPC operations; proxy all other calls through an intermediate server.

Of these two approaches, we recommend approach #2, as outlined in the following diagram:

Recommended Set-up

The motivation for placing a proxy server in between your application and the WaaS backends are as follows:

  1. Your proxy server can log API calls and collect metrics.
  2. Your proxy server can filter results as it sees fit (e.g. policy enforcement).
  3. Your proxy server can perform end user authentication.
  4. Your proxy server can store the Coinbase API Key / Secret, rather than it being exposed to the client.
  5. Your proxy server can throttle traffic.

In short, having a proxy server that you control in between your application and the WaaS backends will afford you significantly more control than using the WaaS backends directly in most cases.

The methods from the WaaS SDK which are required to be used for participation in MPC are:

  1. initMPCSdk
  2. bootstrapDevice
  3. getRegistrationData
  4. computeMPCOperation

Proxy-Mode vs. Direct-Mode

Users can switch between two distinct operating modes: proxy-mode and direct-mode.

Proxy-Mode (recommended)

Proxy-mode allows the application to connect to the Coinbase WaaS API through a proxy server. The primary features of this mode include:

  • Initiate the SDK without needing the Coinbase Cloud API key details in the app itself. Communication will be authenticated during Proxy-Server <> WaaS API.
  • The SDK, by default, points to a proxy server endpoint at localhost:8091. Update this proxyUrl in the config.json file.
  • Cloud credentials are stored in the proxy server, eliminating the need to have them on the application side.

Direct-Mode (not recommended)

Direct-mode enables the app to connect directly to the Coinbase WaaS API, bypassing the need for a proxy server. Key aspects of this mode are:

  • The app communicates directly with the Coinbase WaaS API, with no involvement of a proxy server.
  • Users must provide the API Key and private key for communication, retrieved from the .coinbase_cloud_api_key.json file.

Native Waas SDK

We expose a Java 8+, java.util.concurrent.Future-based SDK for use with Java/Kotlin. An example app is included in android-native-example/ for more information.

Requirements

  • Java 8+
  • Gradle 7.*
    • If using central gradle repositories, you may need to update your settings.gradle to not fail on project repos.
      • i.e (repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS))

Installation

To begin, place the android-native directory relative to your project.

In your settings.gradle, include the following:

include ':android-native', ':android-native:mpc-sdk', ':android-native:go-internal-sdk'
project(':android-native').projectDir = new File(rootProject.projectDir, '../android-native')
project(':android-native:mpc-sdk').projectDir = new File(rootProject.projectDir, '../android-native/mpc-sdk')
project(':android-native:go-internal-sdk').projectDir = new File(rootProject.projectDir, '../android-native/go-internal-sdk')

Remember to specify the correct relative-location of android-native.

In your build.gradle, you should now take dependencies on

implementation project(":android-native")
implementation project(':android-native:mpc-sdk')
implementation project(':android-native:go-internal-sdk')

Demo App

A demo app of the native SDK is included in android-native/. Opening this directory with Android Studio should be sufficient to build and run the app.

Considerations

  • The SDK should import cleanly into Kotlin as-is -- the sample app includes a demonstration of utilizing Waas's Futures with Kotlin task-closures. Please reach out with any questions.

More Repositories

1

terraform-landscape

Improve Terraform's plan output to be easier to read and understand
Ruby
1,570
star
2

coinbase-wallet-sdk

An open protocol that lets users connect their mobile wallets to your DApp
TypeScript
1,423
star
3

coinbase-pro-trading-toolkit

DEPRECATED — The Coinbase Pro trading toolkit
TypeScript
864
star
4

kryptology

Go
846
star
5

coinbase-pro-node

DEPRECATED — The official Node.js library for Coinbase Pro
JavaScript
839
star
6

build-onchain-apps

Accelerate your onchain creativity with the Build Onchain Apps Template. ⛵️
Solidity
701
star
7

odin

Archived: Odin deployer to AWS for 12 Factor applications.
Go
543
star
8

coinbase-python

DEPRECATED — Coinbase Python API
Python
521
star
9

onchainkit

React components and TypeScript utilities to help you build top-tier onchain apps.
TypeScript
481
star
10

solidity-style-guide

471
star
11

assume-role

DEPRECATED — assume-role: a CLI tool making it easy to assume IAM roles through an AWS Bastion account
Shell
423
star
12

geoengineer

DEPRECATED — Infrastructure As Code
Ruby
401
star
13

coinbase-node

DEPRECATED — The official Node.js library for the Coinbase API.
JavaScript
363
star
14

mesh-specifications

Specification files for the Mesh Blockchain Standard
Shell
320
star
15

cbpay-js

Coinbase Pay SDK
TypeScript
317
star
16

coinbase-php

DEPRECATED — PHP wrapper for the Coinbase API
PHP
297
star
17

smart-wallet

Solidity
287
star
18

coinbase-ruby

DEPRECATED — Ruby wrapper for the Coinbase API
Ruby
241
star
19

temporal-ruby

Ruby SDK for Temporal
Ruby
218
star
20

step

step is a framework for building, testing and deploying AWS Step Functions and Lambda
Go
208
star
21

wallet-mobile-sdk

An open protocol for mobile web3 apps to interact with wallets
Kotlin
203
star
22

mesh-sdk-go

Mesh Client Go SDK
Go
192
star
23

coinbase-ios-sdk

Integrate bitcoin into your iOS application with Coinbase
Swift
171
star
24

nft-dapp-starter-kit

Starter kit for developers who want to build an NFT minting site
TypeScript
159
star
25

mesh-cli

CLI for the Mesh API
Go
154
star
26

coinbase-java

Coinbase API v1 library for Java
Java
147
star
27

coinbase-commerce-node

Coinbase Commerce Node
JavaScript
142
star
28

waas-client-library-go

Coinbase Wallet as a Service (WaaS) Client Library in Go.
Go
140
star
29

coinbase-commerce-php

Coinbase Commerce PHP
PHP
136
star
30

traffic_jam

DEPRECATED — Ruby library for time-based rate limiting
Ruby
129
star
31

dexter

Forensics acquisition framework designed to be extensible and secure
Go
122
star
32

coinbase-exchange-ruby

DEPRECATED — Official Ruby library for the GDAX API
Ruby
122
star
33

mongobetween

Go
110
star
34

multisig-tool

DEPRECATED — Multisig Vault recovery tool
JavaScript
110
star
35

mesh-bitcoin

Bitcoin Mesh API Implementation
Go
108
star
36

mesh-ethereum

Ethereum Mesh API Implementation
Go
100
star
37

coinbase-advanced-py

The Advanced API Python SDK is a Python package that makes it easy to interact with the Coinbase Advanced API. The SDK handles authentication, HTTP connections, and provides helpful methods for interacting with the API.
Python
98
star
38

coinbase-android-sdk

DEPRECATED — Android SDK for Coinbase
Java
96
star
39

react-coinbase-commerce

Coinbase Commerce React
JavaScript
92
star
40

fenrir

Archived: AWS SAM deployer to manage serverless projects.
Go
91
star
41

pwnbot

You call PwnBot in Slack on someone else's unlocked computer
JavaScript
90
star
42

commerce-onchain-payment-protocol

Solidity
90
star
43

digital-asset-policy-proposal

Digital Asset Policy Proposal: Safeguarding America’s Financial Leadership
84
star
44

coinbase-commerce-python

Coinbase Commerce Python
Python
79
star
45

magic-spend

Solidity
78
star
46

verifications

📜 "Coinbase Verifications" is a set of Coinbase-verified onchain attestations that enable access to apps and other onchain benefits.
Solidity
75
star
47

CBTabViewExample

TypeScript
72
star
48

chainstorage

The File System For a Multi-Blockchain World
Go
71
star
49

coinbase-bitmonet-sdk

DEPRECATED — Library to accept bitcoin payments in your Android App
Java
63
star
50

self-service-iam

DEPRECATED — Self Service AWS IAM Policies for dev at scale
JavaScript
58
star
51

coinbase-wordpress

DEPRECATED — Coinbase plugin/widget for Wordpress
57
star
52

coinbase-commerce-woocommerce

Accept Bitcoin on your WooCommerce-powered website.
PHP
57
star
53

paymaster-bundler-examples

JavaScript
55
star
54

barbar

DEPRECATED — OSX crypto-currency price ticker
Swift
53
star
55

demeter

DEPRECATED — Security Group Management For AWS
Ruby
52
star
56

coinbase-exchange-node

DEPRECATED — Use gdax-node
JavaScript
47
star
57

cadence-ruby

Ruby SDK for Cadence
Ruby
43
star
58

coinbase-woocommerce

DEPRECATED — Accept Bitcoin on your WooCommerce-powered website.
38
star
59

protoc-gen-rbi

Protobuf compiler plugin that generates Sorbet .rbi "Ruby Interface" files.
Go
38
star
60

mesh-ecosystem

Repository of all open source Mesh implementations and SDKs
33
star
61

master_lock

Inter-process locking library using Redis.
Ruby
32
star
62

coinbase-commerce-ruby

Coinbase Commerce Ruby Gem
Ruby
30
star
63

watchdog

DEPRECATED -- Github Bot for Datadog codification
Go
28
star
64

bittip

DEPRECATED — Reddit tip bot
JavaScript
27
star
65

cash-addr

Utility to convert between base58 and CashAddr BCH addresses.
Ruby
26
star
66

maxfuzz

DEPRECATED — Containerized Cloud Fuzzing
C
26
star
67

rules_ruby

Bazel Ruby Rules
Starlark
24
star
68

mesh-geth-sdk

go-ethereum based sdk for Mesh API
Go
24
star
69

onchain-app-template

TypeScript
24
star
70

redisbetween

Go
23
star
71

gtt-ui

DEPRECATED
JavaScript
22
star
72

btcexport

Export process for Bitcoin blockchain data to CSV
Go
22
star
73

bchd-explorer

Vue
21
star
74

baseca

Go
21
star
75

coinbase-sdk-nodejs

TypeScript
21
star
76

coinbase-commerce-whmcs

Coinbase Commerce module for WHMCS
PHP
18
star
77

coinbase-nft-floor-price

Coinbase NFT floor price estimate model
Python
17
star
78

coinbase-magento

DEPRECATED — Accept Bitcoin on your Magento-powered website.
17
star
79

salus

We would like to request that all contributors please clone a *fresh copy* of this repository since the September 21st maintenance.
HTML
17
star
80

coinbase-android-sdk-example

DEPRECATED — Example android app leveraging the coinbase android sdk
Java
15
star
81

staking-client-library-go

Programmatic access to Coinbase's best-in-class staking infrastructure and services. 🔵
Go
15
star
82

coinbase-spree

DEPRECATED — Accept bitcoin payments on your Spree store with Coinbase.
15
star
83

coinbase-cloud-sdk-js

TypeScript
14
star
84

staking-client-library-ts

Programmatic access to Coinbase's best-in-class staking infrastructure and services. 🔵
TypeScript
14
star
85

service_variables

Service level variables backed by Redis - useful for service wide configuration.
Ruby
12
star
86

solidity-workshop

JavaScript
12
star
87

chainsformer

Go
12
star
88

omniauth-coinbase

DEPRECATED — Coinbase OAuth 2 Strategy for Omniauth
Ruby
12
star
89

coinbase-javascript-sdk

DEPRECATED
JavaScript
11
star
90

coinbase-commerce-prestashop

DEPRECATED — Official Coinbase Commerce Prestashop Payment Module
PHP
11
star
91

mkr-vote-proxy

Cold storage-friendly voting for MKR tokens
Solidity
11
star
92

chainnode

Go
10
star
93

step-asg-deployer

Deprecated, renamed and maintained at https://github.com/coinbase/odin
Go
10
star
94

wrapped-tokens-os

TypeScript
10
star
95

eip-token-upgrade

Solidity
10
star
96

client-analytics

TypeScript
9
star
97

code-of-conduct

Code of conduct for open source projects managed by Coinbase
9
star
98

coinbase-magento2

DEPRECATED: Accept Bitcoin on your Magento2-powered website.
8
star
99

coinbase-commerce-opencart

DEPRECATED — Coinbase Commerce Integration For Opencart
PHP
8
star
100

waas-proxy-server

Go
7
star