NEVERDIE API

Last updated: Oct 5th, 2018

Introduction

The NEVERDIE API is designed to allow developers to create their own DApps that utilize NDC,TPT and other NEVERDIE ERC-20 tokens through simple & elegant function calls.

If you would like provide feedback on current and future implementations or need any further assitance we encourage you to visit our DISCORD

Getting Started

In order to make use of this API you have to create a partner account and obtain a partner API key. You can sign up for a developer account at https://dev.neverdie.io

IMPORTANT! Please make sure you have an Ether Address already setup that supports ERC-20 Tokens prior to registering. We will be sending you test tokens. We reccomend using one of the following to create your wallet address. My Ether Wallet, MetaMask, Parity.

Create Partner Account

API Keys

Once you create your developer account you will have the ability to create an App. This will generate Ropsten and Kovan API Keys automatically.

You will have to fill out some basic info about your App. Once completed your new app will show up on the dashboard with Ropsten and Kovan API Keys.

Deploying

When you're ready to go live simply click on the drop down of your app and select Submit For Approval. This will put your app into a submission state. The NEVERDIE team will review it and once approved you will be granted a Main Network API Key to go live.

=

Token Addresses

In most cases you will need to define the token addresses for your app to create functionality. We highly reccomend storing these values in an easily editable object since the test addresses differ from the live addresses.

Token Faucet

Inside the developer portal you have the ability to request test tokens for your development.

You can request 1 of each token per day. If you require more tokens please contact us directly through the developer portal.

IMPORTANT! The wallet address you request tokens to be sent to can read and send ERC-20 Tokens

Endpoints

Testnet

We've setup 2 endpoints that will enable you to test your calls through the Ropsten or Kovan networks

  • Ropsten https://ropsten.neverdie.com/v1
  • Kovan https://kovan.neverdie.com/v1

Main Network

This endpoint will be used when you app has been approved and deployed.

  • https://api.neverdie.com/v1

JWT Token Expiration

Once you have validated the user credentials successfully, you will receive a JWT token that will allow you to make authenticated calls as the user to the API. It is important to keep in mind that these tokens have an expiration as shown in the table below.
Network Expiration Leeway*
Ropsten 5 minutes 30 seconds
Kovan 5 minutes 30 seconds
Mainnet 30 minutes 60 seconds

* seconds before a token is considered valid

If a token has expired and you make a request to the API, a 401 header will be returned in the response.

You can also retreive the expiration configuration by making a GET request.

Method: GET


Curl example

                                        curl  -H "Content-Type: application/json" https://ropsten.neverdie.com/v1/jwt-expiration
                                    

Response

You will receive a payload with the following data

expiration: Integer value in minutes that the token has been configured to expire.

leeway: Integer value in minutes that the token has before is considered invalid.


Response payload example

                                        {"expiration": 300, "leeway": 30,"status": "success"}
                                        
                                    

Signing Key

As a registered developer you can add apps that will generate network keys and a secret. With this information you can generate a signing key and include it in the request headers. This will allow you to make authenticated calls without the need to provide user credentials.
Here are some examples on how to generate a valid signature.
Node

                                            const request = require('request-promise')
                                            const crypto = require('crypto')
                                            const SHA256 = require("crypto-js/sha256")
                                            const CryptoJS = require("crypto-js")
                                            let secret = '2RzPJD8l0ZLKq'
                                            let devKey = 'gJ05Xm57Ynwvj'
                                            let contentType = "application/json"
                                            const currentDate = new Date().toISOString().replace(/\..+/, '')
                                            const path = '/token-valid'
                                            const message = 'POST '+ contentType +' '+ path +' '+ currentDate
                                            let hash = CryptoJS.HmacSHA256(message,secret)
                                            let wordArray = CryptoJS.enc.Utf8.parse(hash)
                                            let signature = CryptoJS.enc.Base64.stringify(wordArray)
                                            const token  ='DEV '+ devKey +'.'+ signature
                                            const url = 'https://ropsten.neverdie.com/v1'+ path
                                            var options = {
                                                headers: {
                                                'Content-Type': contentType,
                                                'X-Timestamp': currentDate,
                                                'Authorization': token},
                                                method: 'POST',
                                                url: url,
                                            }
                                            let response = request.post(options)
                                            console.log(response)
                                        
Python 3

                                            import requests
                                            from base64 import b64encode,urlsafe_b64encode
                                            from Crypto.Hash import SHA, HMAC,SHA256
                                            from datetime import datetime
                                            import json

                                            secret = "2RzPJD8l0ZLKqDYkAG6L39op"
                                            dev_key  = "gJ05Xm57YnwvjMqPwo1x00"
                                            timestamp = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S")
                                            path = "/token"
                                            content_type = 'application/json'
                                            message = "POST {2} {1} {0}".format(timestamp,path,content_type)

                                            def create_signature(message, key):
                                                key = bytes(key, 'UTF-8')
                                                message = bytes(message, 'UTF-8')
                                                digester = HMAC.new(key, message, SHA256)
                                                signature1 = bytes(digester.hexdigest(),'UTF-8')
                                                signature2 = urlsafe_b64encode(signature1)
                                                return str(signature2, 'UTF-8')

                                            def create_token(secret,dev_key):
                                                string_to_sign = message
                                                signature = create_signature(string_to_sign,secret)
                                                signature = "DEV %s.%s" % (dev_key,signature)
                                                return signature

                                            token = create_token(secret,dev_key)
                                            payload={
                                                "method": "list","category":"funds"
                                            }
                                            headers = {
                                                "X-Timestamp": timestamp,
                                                "Authorization": token,
                                                "Content-Type": content_type
                                                }
                                            url = "http://ropsten.neverdie.com/v1%s" % path
                                            r = requests.post(url,data=json.dumps(payload),headers=headers)
                                            print(r.json())


                                        

API Methods That Are Compatible With Signing Key

  • create-account
  • auth
  • token
  • eth
    • eth_getBalance
    • eth_getTokenBalance
    • eth_getTokensBalance
    • eth_estimateGas
    • eth_getTransactionReceipt
    • eth_getBlockNumber
    • eth_call
    • eth_eventLogs

API Methods


Create User Account


In order to create an account you need to perform a request by including a signing key in the request headers and the following JSON encoded values.

Method: POST

JSON Object: {name: String,nickname: String,email: String,password: String}


Curl example

                                            curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"name":"Jon Doe","email":"[email protected]","nickname":"j","password":"mysuperpass"}' https://kovan.neverdie.com/v1/create-account
                                        

Response

You will receive a payload with the following data

token: String A JWT that you will have to include in the headers of your requests to authenticate future API calls.

created: Timestamp A timestamp indicating when the account was created


Response payload example

                                            {"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MDc5Mzc2NDMsImlkIjo0LCJuYW1lIjoiSm9uIERvZSIsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwic3ViIjo0fQ.Z8j1DA16WcxzNdUyokUXYA2ARYcRoaiIrYD5oZIuU0xNel30yUjyS81YI8ITcBze2V3AxwdzAfn-j5UogGsS9w", "created": "2017-10-13 19:34:03","status": "success"}
                                            
                                        

Important Note! All actions are stored in db per network for example if you create an account in Ropsten that account wont be available on Kovan

Authorization


You can authorize your user accounts by including a signing key in the request headers and performing a request with the following JSON encoded values.

Method: POST

JSON Object:username: String,password: String

secure_login: String If set to true a fingerprint check will be executed on the device accessing the account

Note: The username parameter can contain either the email or the nickname of the user


Curl example

                                        curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"username":"j","password":"mysuperpass"}' https://kovan.neverdie.com/v1/auth
                                    

Response

You will receive a payload with the following data

token: String A JWT that you will have to include in the headers of your requests to authenticate future API calls.

created: Timestamp A timestamp indicating when the account was created

When an account has Two Factor Authentication enabled the token key will not be present. This means you will need to present a 2fa screen for the user to verify his 2fa code.


Response payload example

                                        {"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MDgwMDY3ODgsImlkIjo0LCJuYW1lIjoiSm9uIERvZSIsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwic3ViIjo0fQ.4BW9xTT13KUTC593DKTnDn8AUXqXa5bBXlQTFO-oxw0i-8_RvOkCAslezdsoQ0a6O3TQ9ZnaKd_vyS24XqoYGA", "created": "2017-10-14 14:46:28"}
                                    

Social Authorization


You can authorize your user accounts by enabling social login. Since the social provider wil take care of authenticating users the data you provide to this method will create a new user account the first time you provide this data.

You will need to perform a request with the following url encoded parameters.

Method: POST

username: String, fullname: String, partner_key: String and fid: String

secure_login: String If set to true a fingerprint check will be executed on the device accessing the account


Note: Currently only Facebook is supported.


Curl example

                                        curl --data "username=j&fullname=Chappy+Johnson&fid=1334929446543977&partner_key=mwYkXoWGr" https://kovan.neverdie.com/v1/social-auth
                                    

Response

You will receive a payload with the following data

token: String A JWT that you will have to include in the headers of your requests to authenticate future API calls.

created: Timestamp A timestamp indicating when the account was created


Response payload example

                                        {"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MDgwMDY3ODgsImlkIjo0LCJuYW1lIjoiSm9uIERvZSIsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwic3ViIjo0fQ.4BW9xTT13KUTC593DKTnDn8AUXqXa5bBXlQTFO-oxw0i-8_RvOkCAslezdsoQ0a6O3TQ9ZnaKd_vyS24XqoYGA", "created": "2017-10-14 14:46:28"}
                                    

Two-factor Authentication Request Code


This method enables two-factor authentication for your users account, you can perform a request with the following url encoded parameters.

Method: POST

token: String, email: String and partner_key: String

Note: Currently Google Authenticator and Authy are supported.


Curl example

                                        curl --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjQsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwiaWF0IjoxNTA4MDE3MTMzLCJpZCI6NCwibmFtZSI6IkpvbiBEb2UifQ.6o37_sKszqS9mQRwCU7duXFNgcNRYxajKj3JHdFuFY_Lg9CAEmurA9XqW55Epd2BoNblWx77YM64ey5TIWqwkw' --data "" https://kovan.neverdie.com/v1/request-code
                                    

Response

You will receive a payload with the following data

code: String A string that can be rendered as a QR code that can be scanned with the Google Authenticator app.


Response payload example

                                        {"qrcode": "otpauth://totp/Neverdie%20Wallet:jon%40mail.com?issuer=Neverdie%20Wallet&secret=6F3HRCEUOCVOHZ5C", code: "VPPVISNNEDWTLELO". "status": "success"}
                                    

Two-factor Authentication Validation


Using this method you can validate if the provided code is valid or not. You will have to perform a POST request with the following url encoded parameters and include a signing key in the request headers.

Method: POST

data: JSON Object

data["code"]: String

data["nickname"]: String


Curl example

                                        curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg=='  --data '{"code": "123" ,"nickname":"bob"}' https://kovan.neverdie.com/v1/twofactor-auth
                                    

Response

You will receive a payload with the following data

token: String A JWT that you will have to include in the headers of your requests to authenticate future API calls.

created: Timestamp A timestamp indicating when the account was created


Response payload example

                                        {"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MDgwMDY3ODgsImlkIjo0LCJuYW1lIjoiSm9uIERvZSIsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwic3ViIjo0fQ.4BW9xTT13KUTC593DKTnDn8AUXqXa5bBXlQTFO-oxw0i-8_RvOkCAslezdsoQ0a6O3TQ9ZnaKd_vyS24XqoYGA", "created": "2017-10-14 14:46:28"}
                                    

JWT Token Refresh


Using this method you can generate a new valid JWT token for an existing logged in user.

Method: POST


Curl example

                                        curl  -H "Content-Type: application/json" --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmVuIiwicGFydG5lcl9rZXkiOiJ3cE5NeXhBV3ciLCJzdWIiOjM1LCJpZCI6MzUsInVzZXJuYW1lIjoidGFjb0B0YWNvdG9rZW4uY29tIiwiaWF0IjoxNTEyNjY1MDQzfQ.nO_92q67KO4t7IfhSquL2IhJIBJV8prlWEdNbi3aIzpU3vofCFbEW4jt8qiJhoL_MZ6piZ0egp45Ia-DRUg45Q' --data "{}" https://ropsten.neverdie.com/v1/refresh-session
                                    

Response

You will receive a payload with the following data

token: String A JWT that you will have to include in the headers of your requests to authenticate future API calls.


Response payload example

                                        {"status":"success",token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE1MDgwMDY3ODgsImlkIjo0LCJuYW1lIjoiSm9uIERvZSIsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwic3ViIjo0fQ.4BW9xTT13KUTC593DKTnDn8AUXqXa5bBXlQTFO-oxw0i-8_RvOkCAslezdsoQ0a6O3TQ9ZnaKd_vyS24XqoYGA"}
                                    

Create Wallet


Create a new wallet associated to your account by performing a POST request with the following parameters.

Method: POST

token: JWT, private_key (optional): bytes32 , passphrase (optional): bytes


Curl example

                                        curl -H "Content-Type: application/json" --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmVuIiwicGFydG5lcl9rZXkiOiJ3cE5NeXhBV3ciLCJzdWIiOjM1LCJpZCI6MzUsInVzZXJuYW1lIjoidGFjb0B0YWNvdG9rZW4uY29tIiwiaWF0IjoxNTEyNjY1MDQzfQ.nO_92q67KO4t7IfhSquL2IhJIBJV8prlWEdNbi3aIzpU3vofCFbEW4jt8qiJhoL_MZ6piZ0egp45Ia-DRUg45Q' --data "{}" https://ropsten.neverdie.com/v1/create-wallet
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the saving the wallet was a success or an error occurred.

message: String A string that containts more information.

address: String A string with the new wallet address

Response payload example

                                        {"message": "wallet created successfully", "status": "success", "address": "0xb68ec534dc420f66e1158919f0bce253c2c5a01a"}
                                    

Token


This API method can be called by including a signing key in the request headers witout the need to provide user credentials.

Get Price

Retreive token market data like USD and ETH price.

Method: POST

data: JSON Object

data['method']: String

data['token_symbol']: String Comma separated token symbols. i.e. ndc,tpt


Curl example

                                       curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"get-price","token_symbol":"ndc,tpt,eos"}' https://ropsten.neverdie.com/v1/token
                                   

Response

You will receive a payload with the following data

status: String A sting indicating if the response was successful or an error occurred.

data: Array An array with market data.


Response payload example

                                        {"data": [{"last_updated": "2018-01-20 09:29:42", "token_symbol": "EOS", "usd_price": 14.6702, "eth_price": 0.0128169}, {"last_updated": "2018-01-20 09:29:42", "token_symbol": "NDC", "usd_price": 0.142262, "eth_price": 0.000124290}, {"last_updated": "2018-01-20 09:29:42", "token_symbol": "TPT", "usd_price": 0.15, "eth_price": 0.000131050}], "status": "success"}
                                    

List

Retreive a list of all swappable tokens.

Method: POST

method: String

category: String


Curl example

                                         curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"list","category":"funds"}' https://ropsten.neverdie.com/v1/token
                                     

Response

You will receive a payload with the following data

status: String A sting indicating if the response was successful or an error occurred.

tokens: Array An array with fund tokens data.


Response payload example

                                          {"status": "success", "tokens": [{"name": "Antler", "logo": "https://ropsten.neverdie.com/static/tokens/an.png", "usd_price": 1.0, "symbol": "AN", "address": "0xbFeC3239f0520E09b42E659b50427f5A8d05c8a4"}, {"name": "Antidote", "logo": "https://ropsten.neverdie.com/static/tokens/at.png", "usd_price": 0.1, "symbol": "AT", "address": "0x8D0fFD44837591A946EFD56335Ded9c39F03aF4a"}, {"name": "Cats Eyes", "logo": "https://ropsten.neverdie.com/static/tokens/ce.png", "usd_price": 0.1, "symbol": "CE", "address": "0x97599b7c036Ca58032539046C83c4C5161b19bB4"}]}
                                      

Token Swap


Swap NDC for fund tokens

Method: POST

ndc_amount: Int

swap_token_symbol: String


Curl example

                                       curl -H "Content-Type: application/json" --header 'Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJuYW1lIjoidGVzdGVyNCIsInN1YiI6NTUsImlkIjo1NSwiaWF0IjoxNTIyNDIyNzY1LCJwYXJ0bmVyX2tleSI6IndwTk15eEFXdyIsInVzZXJuYW1lIjoid2VianVua2llMDFAeWFob28uY29tIn0.EN95T9cx2W59A25_-3U4tZiphh1OtzBAlNbsYb6sSF6_fVFOW9yQkerid7fXLNqV8P3IVEudsKozhX3kxx94Nw' --data '{"ndc_amount":"100","swap_token_symbol":"CO"}' https://ropsten.neverdie.com/v1/token-swap
                                   

Response

You will receive a payload with the following data

status: String A sting indicating if the response was successful or an error occurred.

tx: Transaction hash


Response payload example

                                        {"status": "success", "tx": "0xc2ef6dd51accaeb7489794465a8502cfd5d46b290524793113a2582f28b240f6"}
                                    

Save Wallet


To save a user wallet you will need to perform a request with the following url encoded paramaters.

Method: POST

token: String, address: String, passphrase: String, key: String and partner_key: String


Curl example

                                        curl --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjQsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwiaWF0IjoxNTA4MDE3MTMzLCJpZCI6NCwibmFtZSI6IkpvbiBEb2UifQ.6o37_sKszqS9mQRwCU7duXFNgcNRYxajKj3JHdFuFY_Lg9CAEmurA9XqW55Epd2BoNblWx77YM64ey5TIWqwkw' --data "address=0x00000000000000000000000000000000000000000&key=9Wjyt23GhASKlEY&passphrase=secretpassphrase&partner_key=mwYkXoWGr" https://kovan.neverdie.com/v1/save-wallet
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the saving the wallet was a success or an error occurred.

message: String A string that containts more information.

address: String A string with the wallet address.


Response payload example

                                        {"status": "success", "address": "0x00000000000000000000000000000000000000000", "message": "wallet saved"}
                                    

Load Wallets


You can load user wallets performing a request with the following parameters.

Method: POST

token: String


Curl example

                                       curl --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjQsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwiaWF0IjoxNTA4MDE3MTMzLCJpZCI6NCwibmFtZSI6IkpvbiBEb2UifQ.6o37_sKszqS9mQRwCU7duXFNgcNRYxajKj3JHdFuFY_Lg9CAEmurA9XqW55Epd2BoNblWx77YM64ey5TIWqwkw' --data "" https://kovan.neverdie.com/v1/load-wallets
                                   

Response

You will receive a payload with the following data

status: String A sting indicating if the response was successful or an error occurred.

wallets: Array An array containing the wallets addresses.


Response payload example

                                        {"status": "success", "wallets": [{"address": "0x00000000000000000000000000000000000000000"}, {"address": "0x0167d0dE0d08F4c2058E8e17F244DCa64439904a"}]}
                                    

User Settings


You can retreive user settings by performing a POST request with the following parameters.

Method: POST

token: String


Curl example

                                       curl -H "Content-Type: application/json" --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmVuIiwicGFydG5lcl9rZXkiOiJ3cE5NeXhBV3ciLCJzdWIiOjM1LCJpZCI6MzUsInVzZXJuYW1lIjoidGFjb0B0YWNvdG9rZW4uY29tIiwiaWF0IjoxNTEyNjY1MDQzfQ.nO_92q67KO4t7IfhSquL2IhJIBJV8prlWEdNbi3aIzpU3vofCFbEW4jt8qiJhoL_MZ6piZ0egp45Ia-DRUg45Q' --data '' https://ropsten.neverdie.com/v1/load-settings
                                   

Response

You will receive a payload with the following data

status: String A string indicating if the transaction was successful or an error ocurred.

settings: JSON Objetc A JSON object with all the user settings


Response payload example

                                        {"settings": {"display_zero_balance": true, "account_age": " 6 months 25 days", "nickname": "const", "email": "[email protected]", "name": "Jen"}, "message": "OK", "status": "success"}
                                    

ETH Methods


Get Balance


Check the ETH balance of a wallet address by including a signing key in the request headers and performing a request with the following parameters.

Method: POST

params: JSON object

  • address: String
  • block_identifier:String


Curl example

                                        curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"partner_key": "mwYkXoWGr", "method": "eth_getBalance", "params": ["0x0167d0dE0d08F4c2058E8e17F244DCa64439904a", "pending"]}' https://kovan.neverdie.com/v1/eth
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the transaction was successful or an error ocurred.

result: Bignumber The balance of the wallet address


Response payload example

                                        {"status": "success", "result": 0, "message": "OK"}
                                        
                                    

Get Token Balance


Check any given token balance by including a signing key in the request headers and peforming a request with the following parameters

Method: POST

params: JSON object

  • wallet_address: String
  • address: String Token address.


Curl example

                                        curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"partner_key": "mwYkXoWGr", "method": "eth_getTokenBalance", "params": [{"address": "0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC", "wallet_address": "0xccC78eB3c711222549379F68267DE28cB670987C"}, "pending"]}' https://ropsten.neverdie.com/v1/eth
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the transaction was successful or an error ocurred.

result: Bignumber The balance of the wallet address


Response payload example

                                        {"status": "success", "result": 0, "message": "OK"}
                                        
                                    

Get Tokens Balance


Check tokens balances by including a signing key in the request headers and peforming a POST request with the following parameters

method: String

params: JSON

  • wallet_address: String
  • partner_key: String
  • tokens: [address: String, decimals (optional): Int, symbol(optional): String]
  • Note: If you provide decimals along with the token address the token balance will be formatted.


Curl example

                                        curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_getTokensBalance","params":[{"partner_key":"123","wallet_address":"0xccC78eB3c711222549379F68267DE28cB670987C","tokens":[{"address":"0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC","decimals":18},{"address":"0xfA4d3C48d99F85A45b3e2E6a52000bcE92DEed6d","decimals":2}]}] }' https://ropsten.neverdie.com/v1/eth
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the transaction was successful or an error ocurred.

tokens: Array Array with token address and balance


Response payload example

                                        {"tokens": [{"formatted_balance": 346.000000000000000000, "address": "0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC", "balance": 346000000000000000000}, {"formatted_balance": 50.12, "address": "0xfA4d3C48d99F85A45b3e2E6a52000bcE92DEed6d", "balance": 5012}], "status": "success"}
                                        
                                    

Add Token


With this method you can enable the abilty for users to add and track custom tokens for their wallets. You will need to perform a request with the following parameters.

Method: POST

token: String, params: JSON object

Curl example

                                        curl -H "Content-Type: application/json" --header 'Authorization: JWT eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjQsInVzZXJuYW1lIjoiam9uQG1haWwuY29tIiwiaWF0IjoxNTA4MDE3MTMzLCJpZCI6NCwibmFtZSI6IkpvbiBEb2UifQ.6o37_sKszqS9mQRwCU7duXFNgcNRYxajKj3JHdFuFY_Lg9CAEmurA9XqW55Epd2BoNblWx77YM64ey5TIWqwkw' --data '{"partner_key": "mwYkXoWGr", "method": "eth_addToken", "params": [{"tokenaddress": "0x8bBcc7fD9B8A1742CD6Ac9B67E08F771325BE117", "tokensymbol": "RT", "tokendecimals": "2"},"0x0167d0dE0d08F4c2058E8e17F244DCa64439904a", "pending"]}' https://kovan.neverdie.com/v1/eth
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the transaction is successful or an error ocurred.

message: String A string with a message indicating if the transaction was successful or an error ocurred.

Response payload example

                                        {"status": "success", "message": "Token added successfully"}
                                        
                                    

Estimate Gas Price


Estimate the gas price of a transaction by performing a POST request with the following parameters.

Method: POST

to: String, from: String, value: hex encoded string


Curl example with JWT Authentication

                                        curl --header 'Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOjI0LCJwYXJ0bmVyX2tleSI6IndwTk15eEFXdyIsImlhdCI6MTUxMTU0MzQ4NCwiaWQiOjI0LCJuYW1lIjoiam9sbHkgcmFuY2hlciIsInVzZXJuYW1lIjoiam9sbHlAd3VpbGx5LmNvIn0.jvLV4DwcQqeUgEYMzI0tkorRrbxM8iPQysNPubuTCfqcVIWzwj_FJ2ZLbLa2MhpZv2Y5TU2oGF0rz_GONW4cdg' --data '{"method":"eth_estimateGas","params":[{"to":"0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC", "from":"0x76412FC9Cc45cb77bd1326b9aaEb23dEA01517a9", "value": "0x302e303130", "data": ""}]}' https://ropsten.neverdie.com/v1/eth
                                    

Curl example including signing key in the request headers

                                        curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_estimateGas","params":[{"to":"0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC", "from":"0x76412FC9Cc45cb77bd1326b9aaEb23dEA01517a9", "value": "0x302e303130", "data": ""}]}' https://ropsten.neverdie.com/v1/eth
                                    

Response

You will receive a payload with the following data

status: String A string indicating if the transaction is successful or an error ocurred.

result: Bignumber The estimated gas price for the current transaction.

Response payload example

                                        {result: 21000, status: "success"}
                                        
                                    

Send Transaction


Send a raw transaction ready to be signed.

Method: POST

to: String

from: String

value: hex encoded string

data: abi encoded string

unit: string

chainId: integer

gasLimit: hex encoded string

gasPrice: hex encoded string

Curl example send ETH

                                         curl --header 'Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOjI0LCJwYXJ0bmVyX2tleSI6IndwTk15eEFXdyIsImlhdCI6MTUxMTU0MzQ4NCwiaWQiOjI0LCJuYW1lIjoiam9sbHkgcmFuY2hlciIsInVzZXJuYW1lIjoiam9sbHlAd3VpbGx5LmNvIn0.jvLV4DwcQqeUgEYMzI0tkorRrbxM8iPQysNPubuTCfqcVIWzwj_FJ2ZLbLa2MhpZv2Y5TU2oGF0rz_GONW4cdg' --data '{"method":"eth_sendRawTransaction","params":[{"gasLimit": "0x5208","gasPrice": "0x77359400", "to":"0x00E889217E2a6E11eD2342f4A736978012eE3225", "from":"0x426888C6b9F8BE1B50528dAd9A76F4D718881EEa", "value": "0x6a94d74f430000", "data": "", "chainId": 3, "unit": 'ether'}]}' https://ropsten.neverdie.com/v1/eth
                                     
Curl example send NDC

                                         curl --header 'Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOjI0LCJwYXJ0bmVyX2tleSI6IndwTk15eEFXdyIsImlhdCI6MTUxMTU0MzQ4NCwiaWQiOjI0LCJuYW1lIjoiam9sbHkgcmFuY2hlciIsInVzZXJuYW1lIjoiam9sbHlAd3VpbGx5LmNvIn0.jvLV4DwcQqeUgEYMzI0tkorRrbxM8iPQysNPubuTCfqcVIWzwj_FJ2ZLbLa2MhpZv2Y5TU2oGF0rz_GONW4cdg' --data '{"method":"eth_sendRawTransaction","params":[{"gasLimit": "0x5208","gasPrice": "0x77359400", "to":"0x00E889217E2a6E11eD2342f4A736978012eE3225", "from":"0x426888C6b9F8BE1B50528dAd9A76F4D718881EEa", "value": "0x00", "data": "0xa9059cbb00000000000000000000000000e889217e2a6e11ed2342f4a736978012ee3225000000000000000000000000000000000000000000000001314fb37062980000", "chainId": 3, "unit": 'NDC'}]}' https://ropsten.neverdie.com/v1/eth
                                     

Response

You will receive a payload with the following data

status: String A string indicating if the transaction is successful or an error ocurred.

eth_balance_usd: Numeric ETH balance in USD unformatted

eth_balance_usd_formatted: String Formatted ETH balance in USD

eth_balance: Bignumber The eth balance minust gas costs, fee and amount.

tx: String Transaction receipt

Response payload example

                                         {eth_balance:400500883000000000,eth_balance_usd:133.51497936571,eth_balance_usd_formatted:"133.51"message:"transaction sent successfully",status:"success",tx:"0xf65498fa7c688089bb1e80c2ee3b1c52912c8c5a66d93a3a1dc5279ffaf9253c"}
                                         
                                     

Get Transaction Receipt


Get information about a transaction by including a signing key in the request headers and performing a POST request with the following parameters.

Method: POST

tx_hash: String

Curl example

                                          curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_getTransactionReceipt","params":[{"tx_hash":"0xe27d282dc222305e9e1969f6a47e1b4451236b58e9baaba21a9c36fdc604af2c"}]}' https://ropsten.neverdie.com/v1/eth
                                      

Response

You will receive a payload with the following data

Response payload example

                                          {"status": "success", "result": {"data": "", "logs_bloom": "0x00000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000008000080000800000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000200010000000000000000080400000000000000000000000000000000000000000000080000000000000000000000000000000000000000000", "gas_used": 36505, "contract_address": null, "to": "0xc96acc9572f9b79ea3d555aed6e2a1a77e8c95dc", "from": "0x4b010e7c499225b2dcc1347c32bce79958f8b4f2", "transaction_index": 4, "block_hash": "0xe6aec29d47564e887dad464be94cb6de8fb63ea5e4f07d372587a3a9811e155d", "status": "0x1", "transaction_hash": "0xe27d282dc222305e9e1969f6a47e1b4451236b58e9baaba21a9c36fdc604af2c", "logs": [{"removed": false}, {"blockHash": "0xe6aec29d47564e887dad464be94cb6de8fb63ea5e4f07d372587a3a9811e155d"}, {"data": "0x0000000000000000000000000000000000000000000000008ac7230489e80000"}, {"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000004b010e7c499225b2dcc1347c32bce79958f8b4f2", "0x0000000000000000000000006936b470351b91854aeb7d58f37345994c865be7"]}, {"transactionHash": "0xe27d282dc222305e9e1969f6a47e1b4451236b58e9baaba21a9c36fdc604af2c"}, {"address": "0xc96acc9572f9b79ea3d555aed6e2a1a77e8c95dc"}, {"transactionIndex": 4}, {"logIndex": 7}, {"blockNumber": 2222265}], "cumulative_gas_used": 1520777, "block_number": 2222265}}
                                          
                                      

Block Number


Get information about a specific block number by including a signing key in the request headers and performing a POST request with the following parameters.

Method: POST

block_identifier: String (optional) defaults to "latest"

Curl example to retreive the latest block number

                                            curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_getBlockNumber","params":[{}] }' https://ropsten.neverdie.com/v1/eth
                                        

Response

You will receive a payload with the following data

Response payload example

                                            {"status": "success", "block_number": 3555930}
                                        

Curl example to retreive a block with identifier

                                            curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_getBlockNumber","params":[{"block_identifier":"3555930"}] }' https://ropsten.neverdie.com/v1/eth
                                        

Response

You will receive a payload with the following data

Response payload example

                                            {"status": "success", "data": {"nonce": "0x96212e1a7e6a4392", "gasLimit": 9119131, "miner": "0x120c78af68dF5957E776554d138A6B75f2c34B6c", "receiptsRoot": "0x2522a88df914fed74e5bdccc8c311af4a8b197b1e98b74fda1efcf44e84202a3", "size": 18326, "stateRoot": "0xb39c1870dedc1b51fc69744505025dfd76395d7925116e4b6a5b511f67a04aed", "uncles": [], "logsBloom": ....}
                                        

ETH Call


Executes a new message call immediately without creating a transaction on the block chain by including a signing key in the request headers and performing a POST request with the following parameters.

Method: POST

to: String

from: String

data: Hex String

block_identifier: String (optional) defaults to "latest"

Curl example

                                            curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_call","params":[{"to":"0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC","from":"0x6936B470351B91854aeB7D58f37345994c865bE7","data": "0x70a082310000000000000000000000006936B470351B91854aeB7D58f37345994c865bE7"}]}' https://ropsten.neverdie.com/v1/eth
                                        

Response

You will receive a payload with the following data

Response payload example

                                            {"status": "success", "result": "0x000000000000000000000000000000000000000001dfab87c3b4a905e32e8cbc"}
                                        

Event Logs


Retreive logs for a particular contract address by including a signing key in the request headers and performing a POST request with the following parameters.

Method: POST

new_entries:String

to: String

address: String

from_block: (optional) defaults to "earliest"

to_block: (optional) defaults to "latest"

topics: Array

Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:

  • [] "anything"
  • [A] "A in first position (and anything after)"
  • [null, B] "anything in first position AND B in second position (and anything after)"
  • [A, B] "A in first position AND B in second position (and anything after)"
  • [[A, B], [A, B]] "(A OR B) in first position AND (A OR B) in second position (and anything after)"

Curl example Topics OR

                                            curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_eventLogs","new_entries":"false","params":[{"address":"0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC","from_block":"379224","to_block":"400000","topics":[
                                            ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
                                            ["0x0000000000000000000000006936b470351b91854aeb7d58f37345994c865be7"]
                                            ]}] }' https://ropsten.neverdie.com/v1/eth
                                        

Curl example Topics AND

                                            curl -H "X-Timestamp: 2018-07-28T03:13:57" -H "Content-Type: application/json" --header 'Authorization: DEV gJ05Xm57YnwvjMqPwo1x2AwPN6yjEz9rNg1X1X1j.MjgxNThkMWMwNDkwNjVlZWY1NzFhMDgyODJmZDRjNTQ0MjJjZTQ3Yjc4MmQzNTYxOTA3YjZjNzY0NjJkNTBiMg==' --data '{"method":"eth_eventLogs","new_entries":"false","params":[{"address":"0xc96aCC9572f9B79Ea3d555Aed6E2A1A77e8C95dC",
                                            "topics":[
                                            ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                                            "0x0000000000000000000000006936b470351b91854aeb7d58f37345994c865be7"]
                                            ]}] }' https://ropsten.neverdie.com/v1/eth
                                        

Response

You will receive a payload with the following data

Response payload example

                                            {"status":"success",result": [{"transactionHash": "0x15611c0bda2021a52d6326372b0a9e981d6b512d6aecde319a7d25137bb6cb37", "logIndex": 1, "data": "0x000000000000000000000000000000000000000000000002b5e3af16b1880000", "transactionIndex": 1, "blockHash": "0x74b689b30762dc70bd32b2159109ba8eea915691282d6476fa054baf44cbddc4", "removed": false, "blockNumber": 1807147, "address": "0xc96acc9572f9b79ea3d555aed6e2a1a77e8c95dc", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000006936b470351b91854aeb7d58f37345994c865be7", "0x00000000000000000000000094e61ffd5d81f011ccc31016dee6b8a65e4431cc"]}, {"transactionHash": "0x460282b41cc0e3966690cf3c8662bded3c4f9072cecd882ecb520f6d2ebbcacc", "logIndex": 2, "data": "0x0000000000000000000000000000000000000000000000008ac7230489e80000", "transactionIndex": 12, "blockHash": "0x5db170cfcb170114010177f6da6c732b190ba271ceaac4a79af7984888dec0c6", "removed": false, "blockNumber": 1812199, "address": "0xc96acc9572f9b79ea3d555aed6e2a1a77e8c95dc", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x0000000000000000000000006936b470351b91854aeb7d58f37345994c865be7", "0x00000000000000000000000094e61ffd5d81f011ccc31016dee6b8a65e4....}
                                        

Event Logs


Create Dev Signature

                                            let crypto = require('crypto');
                                            let SHA256 = require("crypto-js/sha256");
                                            let CryptoJS = require("crypto-js");
                                            window.createSignature = function(){
                                                secret = "1D4jpxYyEpBLVVg2nJl3AWDPNzv525m71VX1RMYj"
                                                let n = new Date().toISOString().replace(/\..+/, '')
                                                let path = "eth"
                                                let message = 'GET /'+path+' '+n;
                                                let hash = CryptoJS.HmacSHA256(message , secret)
                                                let wordArray = CryptoJS.enc.Utf8.parse(hash)
                                                let signature = CryptoJS.enc.Base64.stringify(wordArray)
                                                return signature
                                            }

                                        

                                            let dev_key = "GjqlQYlNMX1qp1g1o2059q47wZVqg0PG33OZgVGJ"
                                            let signature = createSignature()
                                            let token = "DEV "+dev_key+'.'+signature
                                            let timestamp = new Date().toISOString().replace(/\..+/, '')
                                        

Connect To WS Endpoint

                                            connection = new WebSocket('wss://ws-ropsten.neverdie.com/eth/'+btoa(token)+'/'+timestamp);
                                        

OnMessage Event

You will receive a response telling you if you connected successfuly or not.


                                            {"status": "success", "message": "Authorization successful"}
                                        

Subscribe To Events

If the connection has been successful then you can try to subscribe to the logs method like this:


                                            connection.send(JSON.stringify({"params": ["logs", {"address": "0xe6D4F76c07aC437BA6081F2a07A2BFc8E224F3f2", "topics": ["0x088ba7785fd329abbf01eaa732bad30e14b205b9fc8ab9378f9f529573113555"]}] }))
                                        

Once you have subscribed successfully you will receive an id and a result meaning you have connected sucessfully


                                            {"jsonrpc":"2.0","id":0,"result":"0xf93b4252777e92848f626c41c9923db8"}
                                        

You can find more about which subscriptions are supported on the official geth wiki


OnMessage Event

You will receive a data object


Browser Based Example


                                            <html>
                                            <body>
                                            <div id="log"></div>
                                            </body>
                                            <script src="http://code.jquery.com/jquery.min.js"></script>
                                            <script type="text/javascript" src="sigbundle-ropsten.js"></script>
                                            <script type="text/javascript">

                                            var connection
                                            $(function () {
                                            log = document.getElementById('log');
                                            // if user is running mozilla then use it's built-in WebSocket
                                            window.WebSocket = window.WebSocket || window.MozWebSocket;
                                            let dev_key = "GjqlQYlNMX1qp1g1o2059q47wZVqg0PG33OZgVGJ"
                                            let signature = createSignature()
                                            let token = "DEV "+dev_key+'.'+signature
                                            let timestamp = new Date().toISOString().replace(/\..+/, '')
                                            connection = new WebSocket('wss://ws-ropsten.neverdie.com/eth/'+btoa(token)+'/'+timestamp)
                                            connection.onerror = function (error) {
                                            log.innerHTML = '
  • an error occurred when sending-receiving data
  • ' + log.innerHTML; }; connection.onmessage = function (message) { // try to decode json (I assume that each message from server is json) try { log.innerHTML = '
  • '+message.data+'
  • ' + log.innerHTML; } catch (e) { console.log('This doesn\'t look like a valid JSON: ', message.data); return; } }; }); </script> </html>