• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

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

Repository Details

A library that offers a unified API to prepare, sign and broadcast multiple cryptocurrencies.

AirGap Coin Library

npm documentation build codecov

The airgap-coin-lib is a protocol-agnostic library that allows easy handling of the most important tasks relating cryptocurrencies and blockchains.

It implements operations such as preparing, signing and broadcasting transactions for a range of protocols.

The library consists of a shared interface for all implemented protocols. This is especially useful in the context of AirGap because methods are designed to support offline key management and signing. The following core operations are specified:

  • prepareTransaction - This is done on AirGap Wallet (online) side. Either a public key or extended public key is used and will fetch the required information from the network.
  • signTransaction - This is done in AirGap Vault (offline) side. The output of "prepareTransaction" is the input for this method (hence the output of "prepareTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)).
  • broadcastTransaction - This is done in AirGap Wallet (online) side. The output of "signTransaction" is the input for this method (hence the output of "signTransaction" is transferred via URL scheme (same-device) or QR code (2-device-setup)).

Supported Protocols

The modular design used in this library allows you to simply add new protocols with special logic. Adding a new Bitcoin-like protocol basically means:

  1. select the correct network parameters (see src/networks.ts)
  2. set the Insight API URL to communicate with the blockchain

Adding a new Ethereum-like protocol means:

  1. set the correct chain id
  2. set the JSON RPC URL

Currently supported are:

  • Bitcoin
  • Ethereum
    • Generic ERC20 Tokens
  • Aeternity
  • Tezos
    • FA1.2 tokens
      • tzBTC
      • USDtz
    • FA2 tokens
  • Groestlcoin
  • Cosmos
  • Polkadot
  • Kusama

Features

Protocols

The way the interface was designed is to allow stateless calls. This means the class stores very little state itself. All required input comes from the method params (public key, extended public key, etc...)

Currently we support for Bitcoin-like (UTXO) protocols:

  • Single Address Wallets (deprecated)
  • HD Wallets

Currently we support for Ethereum-like (Account-based) protocols:

  • Single Address Wallets

Delegation

There is a different interface that can be implemented if the protocol supports delegation. The delegation flow usually requires some changes in the user interface of the AirGap Wallet as well.

Inter App Communication

A serializer is included that encodes JSON structures with RLP and base58check. Those strings can then be sent to the other app, either through QR codes or a URL. The serializer can only serialize messages in predefined formats, so new message types have to be added when new protocols are added.

Tezos FA1.2 and FA2 tokens

It is possible to interact (fetch balances, create transfers, etc.) with an FA1.2 and FA2 smart contracts using the TezosFA12Protocol and TezosFA2Protocol classes. An example on how to use them can be found in examples/custom/protocols/tezos/fa2-smart-contract.ts.

Synchronising information between wallet and vault

Such that the system works we need to be able to synchronise wallets. A wallet can be:

  • Single Address Wallet
  • HD Wallet

For the single address wallet we only need to share the public key. For HD Wallet we need to share the extended public key.

Getting started

Requirements

npm >= 6
NodeJS >= 12

Build dependencies get installed using npm install.

Clone and Run

$ git clone https://github.com/airgap-it/airgap-coin-lib.git
$ cd airgap-coin-lib
$ npm install

To run the tests, you will have to install the test dependencies

$ npm run install-test-dependencies
$ npm test

To remove the test dependencies and clean up the package.json and package-lock.json, execute this command

$ npm run install-build-dependencies

Contributing

We welcome contributions from the community. Simple readme updates or bugfixes can be addressed with a PR directly.

For larger changes like new protocols, new features or larger refactorings, please contact us first by opening an issue. This project is under constant development and until version 1.x.x has been reached, there will be frequent breaking changes. So make sure to take a look at the develop branch.

Regarding new protocols / currencies, we cannot guarantee that they will be merged, but we're more than happy to discuss the details of a specific integration in a github issue.

More Repositories

1

airgap-wallet

The AirGap Wallet is installed on an everyday smartphone. This app has only access to public information.
TypeScript
449
star
2

airgap-vault

The AirGap Vault is installed on a spare smartphone that has no connection to any network, thus it is air gapped. This app handles the private key.
TypeScript
393
star
3

beacon-sdk

The beacon sdk allows developers of dApps and wallets on Tezos to implement the wallet interaction standard tzip-10.
TypeScript
100
star
4

tezblock

tezblock is a block explorer for Tezos.
TypeScript
29
star
5

airgap-distro

Bootable live usb/cd linux distribution containing AirGap Vault.
Shell
25
star
6

tezos-rust-sdk

Rust
20
star
7

beacon-node

Reference setup and docker image of the Beacon Node for the Tezos wallet interaction standard
Python
12
star
8

airgap-raspberry-apk-signer

Modified Raspberry Pi Image to sign your APK in the most secure way (airgapped).
Shell
11
star
9

beacon-android-sdk

The beacon sdk allows Android developers of dApps and wallets on Tezos to implement the wallet interaction standard tzip-10.
Kotlin
10
star
10

spire

Spire is a browser extension for Tezos that supports multiple singing methods like Ledger and Beacon-enabled wallets.
TypeScript
9
star
11

beacon-ios-sdk

The beacon sdk allows iOS developers of dApps and wallets on Tezos to implement the wallet interaction standard tzip-10.
Swift
8
star
12

airgap-web-signer

Standalone (offline) transaction signer to host on an air gapped machine
JavaScript
7
star
13

airgap-cli-signer

Standalone (offline) transaction signer to sing a transaction in the console on an air gapped machine Edit Add topics
JavaScript
6
star
14

airgap-sapling

Rust
5
star
15

tezos-metamask-snap

TypeScript
5
star
16

beacon-vue-example

An small vue app showcasing the integration of the beacon-sdk.
Vue
5
star
17

tezos-snaps-wallet

A wallet for the Tezos MetaMask Snap
TypeScript
4
star
18

CMTAT-FA2

Python
4
star
19

beacon-docs

MDX
4
star
20

beacon-example-dapp

An example dApp on tezos using the beacon sdk to communicate with your wallet and the landing page for beacon.
HTML
4
star
21

beacon-debug-wallet

Beacon Debug Wallet is a watch-only wallet for developers to debug Beacon enabled dApps.
TypeScript
4
star
22

airgap-angular-components

A library of angular components and services that are used in both AirGap Wallet and AirGap Vault
TypeScript
3
star
23

tzwrapped-generic-multisig

Python
2
star
24

tezos-standards

tentative repository for the tezos wallet interaction standard
2
star
25

tezos-kotlin-sdk

Kotlin
2
star
26

cordova-plugin-airgap-secure-storage

Cordova Secure Storage Plugin for Android & iOS.
Kotlin
2
star
27

beacon-notification-backend

TypeScript
2
star
28

airgap-docs

Help Center and Documentation of AirGap Vault and AirGap Wallet
MDX
1
star
29

ibcf

TypeScript
1
star
30

ur-registry-xtz

Offline signing standard for Tezos
TypeScript
1
star
31

tezos-swift-sdk

Swift
1
star
32

airgap-community

Tools and libraries built for AirGap by 3rd party developers
JavaScript
1
star