• Stars
    star
    282
  • Rank 145,895 (Top 3 %)
  • Language Vue
  • Created about 2 years ago
  • Updated 21 days ago

Reviews

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

Repository Details

Unified coin/token specification for wallets in ADAMANT apps

Crypto wallets for ADAMANT apps

Coin/token info and specification for usage in ADAMANT apps.

Structure

Root directory includes:

  • \general\ β€” Includes directories for each coin/token, in which info.json stores their general descriptions and specifications.
  • \blockchains\ β€” Contains specific to blockchains information, which can override general specs. Tokens inside are grouped by blockchain as a separate folder.

Blockchain info

Each blockchain in \blockchains\ includes info.json, which links to main coin in \general\:

{
  "blockchain": "Ethereum", // Blockchain readable name
  "type": "ERC20", // How an app should mark token blockchain
  "mainCoin": "ethereum", // A coin containing parameters common to the blockchain
  "fees": "ethereum" // Coin to pay fees in
}

Navigate to \general\${mainCoin} to get explorer links, address regex and other shared for blockchain parameters.

Coin/token info

Coin/token info stored in \general\${token_name} folders. Specific blockchain info in \blockchains\${blockchain_name} overrides it. For example:

{
  "name": "Example Coin", // Readable coin name
  "nameShort": "Example", // Optional. Readable coin short name
  "website": "https://example.com", // Project website URL
  "description": "Non existing coin", // Short description

  "explorer": "https://explorer.example.com", // Optional. Explorer URL
  "explorerTx": "https://explorer.example.com/tx/${ID}", // Optional. URL to get tx info
  "explorerAddress": "https://explorer.example.com/address/${ID}", // Optional. URL to get address info
  "explorerContract": "https://explorer.example.com/contract/${ID}", // Optional. URL to get contract info

  "regexAddress": "^EC([0-9]{8,})$", // Optional. RegEx to validate coin address
  "research": "https://research.binance.com/en/projects/${project}", // Optional. Research URL
  "symbol": "SYM", // Coin ticker
  "type": "coin", // "coin" or "token"

  "decimals": 8, // Decimal places
  "cryptoTransferDecimals": 8, // Max precision for tx

  "minBalance": 0.00001, // Optional. Minimum acceptable amount for an address
  "minTransferAmount": 0.00000546, // Optional. Minimum acceptable amount for tx

  "fixedFee": 0.5, // Optional. Fixed transfer fee

  // Optional. When the transfer fee is variable, but an app has not yet calculated it
  "defaultFee": 0.00003153,

  "qqPrefix": "exmpl", // Optional. QR code prefix for an address
  "status": "active", // "active" or "disabled". Should the coin be processed

  // Should an app itself create the coin or only use the info for the blockchain
  "createCoin": true,

  "defaultVisibility": true, // Optional. To show a coin by default, or hide it
  "defaultOrdinalLevel": 0, // Optional. Default ordinal number in a wallet list. Coins with the same ordinal number are sorted alphabetically. Coins without an order are shown last, alphabetically

  "consensus": "dPoS", // Optional. Blockchain consensus type
  "blockTimeFixed": 5000, // Optional. Fixed block time in ms
  "blockTimeAvg": 600000, // Optional. Average block time in ms

  "minNodeVersion": "0.8.0", // Optional. Minimal supported node API version

  // Optional. Node links for API
  "nodes": [
    { "url": "https://node.example.com" },
    { "url": "http://0.0.0.0:36666" }, // It's possible to use IP:port URI
    {
      "url": "https://second-node.example.com",
      "alt_ip": "0.0.0.1:36666" // Alternative way to connect if the domain of a node is censored
    }
  ],

  // Optional. Services related to a project
  "services": {
    "infoService": [
      { "url": "https://info.example.com" },
      {
        "url": "https://second-service.example.com",
        "alt_ip": "0.0.0.1:80" // Alternative way to connect if the domain of a service is censored
      }
    ],
  },

  // Optional. Additional project links
  "links": [
    {
      "name": "github",
      "url": "https://github.com/--example"
    },
    {
      "name": "whitepaper",
      "url": "https://example.com/whitepaper.pdf"
    }
  ]

  // Optional. Tor configuration if a project uses Tor
  // It follows the same structure as the root properties
  // Currently supported props are described below:
  "tor": {
    "website": "http://abc.onion",
    "explorer": "http://xyz.onion",
    "explorerTx": "http://xyz.onion/tx/${ID}",
    "explorerAddress": "http://xyz.onion/address/${ID}",
    "nodes": [/*...*/],
    "services": {/*...*/},
    "links": [/*...*/]
  }
}

Ethereum & ERC20 tx fee calculation

The total cost of a transaction is the product of the gas limit and gas price:

$$Tx \, fee = gas \, limit \times gas \, price$$

ADAMANT apps estimate gas limit and gas price using web3 library. To make sure the Ethereum blockchain will include the tx, these estimates must be multiplied by reliabilityGasLimitPercent and reliabilityGasPricePercent.

If it’s not possible to get estimates, apps will use defaultGasLimit and defaultGasPriceGwei. When gas price is higher than warningGasPriceGwei, apps will show a note/warning.

These parameters are set inside general\ethereum\info.json and may be overridden by blockchains\ethereum\info.json and specific tokens.

Info for updating in-chat coin transfer tx statuses

Read AIP-12: Non-ADM crypto transfer messages to learn more about Tx statuses.

Statuses workflow: Pending (new or old tx) ⟢ Registered ⟢ Confirmed, Cancelled or Inconsistent.

To help apps with updating statuses, additional fields are introduced:

{
  // ...
  "txFetchInfo": {
    // Interval between fetching Tx in ms when its current status is
    "newPendingInterval": 10000, // "Pending" for new transactions
    "oldPendingInterval": 3000, // "Pending" for old transactions
    "registeredInterval": 40000, // "Registered"

    // Attempts to fetch Tx when its current status is `Pending`
    "newPendingAttempts": 20, // for new transactions
    "oldPendingAttempts": 3 // for old transactions
  },

  /**
   * Time in ms when difference between in-chat transfer and Tx timestamp considered
   * as acceptable. Otherwise, an app should mark Tx as `Inconsistent`.
   */
  "txConsistencyMaxTime": 60000
}

Transaction considered as new or old depending on how much time passed from in-chat transfer.

const isNew = (admTransferTimestamp) =>
  Date.now() - admTransferTimestamp <
  newPendingTxFetchAttempts * newPendingTxFetchInterval;

Icons

Coin icons/images files are stored \general\${token_name}\images folders.

Required:

  • icon.svg β€” Vector image file
  • icon.vue β€” Vector image vue template for PWA
  • ${token_name}_wallet.png β€” @x1 (55px) resolution for iOS app
  • ${token_name}[email protected] β€” same, @x2 resolution
  • ${token_name}[email protected] β€” same, @x3 resolution

Optional:

  • ${token_name}_wallet_dark.png β€” @x1 (55px) resolution for iOS app, dark icon
  • ${token_name}[email protected] β€” same, @x2 resolution
  • ${token_name}[email protected] β€” same, @x3 resolution
  • ${token_name}_notification.png β€” @x1 (55px) resolution for iOS push notifications
  • ${token_name}[email protected] β€” same, @x2 resolution
  • ${token_name}[email protected] β€” same, @x3 resolution
  • ${token_name}_wallet_row.png β€” @x1 (21px) resolution for iOS app for private key screen
  • ${token_name}[email protected] β€” same, @x2 resolution
  • ${token_name}[email protected] β€” same, @x3 resolution

If there will be no optional icons, apps will take regular _wallet icons.

Contribution

Please have a look at the CONTRIBUTING.md.

More Repositories

1

adamant

ADAMANT Blockchain Node
JavaScript
728
star
2

ETH-transactions-storage

Indexer for Ethereum to get transaction list by ETH address
Python
610
star
3

adamant-im

ADAMANT Decentralized Messenger. Progressive Web Application (PWA)
Vue
582
star
4

adamant-tradebot

Free self-hosted market-making software for cryptocurrency projects and exchanges. Makes trade volume, maintains spread and liquidity/depth, set price range, and builds live-like dynamic order book.
JavaScript
541
star
5

adamant-coinoptimus

Free self-hosted cryptocurrency trade bot for non-professional traders
JavaScript
378
star
6

pool

ADAMANT Forging pool with Web interface
JavaScript
352
star
7

adamant-api-jsclient

ADAMANT Javascript API library
TypeScript
350
star
8

adamant-exchangebot

Crypto exchange bot for ADAMANT
JavaScript
347
star
9

adamant-console

Command-line utilities to work with ADAMANT blockchain
JavaScript
342
star
10

adamant-explorer

ADAMANT Blockchain Explorer
JavaScript
338
star
11

adamant-iOS

iOS native client for ADAMANT Decentralized Messenger
Swift
337
star
12

adamant-2fa

ADAMANT's Blockchain 2FA demo
JavaScript
335
star
13

adamant-notificationService

ADAMANT push Notification Service for iOS Messenger app
C#
324
star
14

AIPs

ADAMANT Improvement Proposal repository
HTML
288
star
15

adamant-schema

Swagger schema for ADAMANT node
TypeScript
263
star
16

adamant-currencyinfo-services

Self-hosted crypto and fiat currency rates service provider. MOEX, Currency-Api, ExchangeRate.host, Coinmarketcap, CryptoCompare and Coingecko.
JavaScript
249
star
17

currencyinfo

Self-hosted crypto and fiat currency rates service provider. Combines MOEX, Currency-Api, ExchangeRate.host, Coinmarketcap, CryptoCompare, and Coingecko.
TypeScript
146
star
18

adamant-android

Android native client for ADAMANT Messenger
Java
28
star
19

adamant-fcm-notification-service

FCM push notification service for ADAMANT
Java
3
star
20

adamant-bountybot

Carry out bounty campaigns & crypto airdrops, with automatic task verifications and payouts. Bounty bots work in ADAMANT Messenger chats directly.
JavaScript
3
star
21

adamant-pool

ADAMANT Forging pool with Web interface
JavaScript
2
star
22

adamant-bet

Anonymous and Blockchain-proved betting on crypto rates
JavaScript
2
star
23

adamant-tradebot-dex

Free market-making software on decentralized exchanges (DEX) for cryptocurrency projects. Makes trade volume, manages liquidity, watches a token price. [In development]
1
star
24

adamant-watchbot

Watches ADAMANT blockchain transactions, notifies about specific ones, recoups fees
JavaScript
1
star
25

adamant-docker

ADAMANT node for Docker
Shell
1
star
26

adamant-trader

Advanced open-source cryptocurrency tradebot
1
star
27

ipfs-node

IPFS decentralized file storage and transfers
1
star