Ethereum (ETH)
General Information
Some of Ethereum’s main points:
- There are no UTXOs, only “accounts” (of two varieties)
- Block time is significantly shorter; 15 second target instead of 10 minutes
- Miners get rewards for including references to orphan blocks (so called “uncle blocks”)
- Ethereum’s scripting language is far more expressive than Bitcoin’s; typically advanced transactions/contracts are constructed using a higher level language then converted into EVM bytecode
- Ethereum has no strict cap on monetary supply (ether supply)
- Transactions cost “gas” to run (denominated in ether) depending on how computationally expensive they are to run. Blocks also have total gas limits to prevent runaway computation/keep the network decentralized.
- In a nutshell, Bitcoin is about decentralized, trust-minimizing, sound money. Ethereum is about decentralized, trust-minimizing, sound computation. Much more detail about these differences can be read at the Ethereum Wiki here. You can find more information at the project’s webpage as well.
Get Node Information
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/info \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/info HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/info",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"info"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/info');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/info")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,info", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/info")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/info"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "rinkeby",
"height": 4190581,
"difficulty": "7713546",
"bestBlockHash": "0x42e6e4c11bebf7343720aaf7bcc1f9edeae25f82e57efa2aca14db6ffe95a730",
"txs_count": 31708815,
"synced": true
}
}
Info
General information about a blockchain is available by GET-ing the base resource.
HTTP Request
GET /v1/bc/eth/${NETWORK}/info
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
The returned object contains a litany of information about the blockchain, including its height, the hash of the latest block and more.
Get Block By Hash
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"blocks",
"0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,blocks,0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.mainnet",
"height": 523442,
"hash": "0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383",
"parent_hash": "0x3e3ad7b9a63de7a1f1f564ee5393876caf61eff04d7c330bfe6df9b942c606d6",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"gas_used": "21000",
"size": 658, //in bytes
"timestamp": 1447237199,
"date": "2015-11-11 10:19:59 UTC", //deprecated
"datetime": "2015-11-11 10:19:59 UTC",
"transactions": 1,
"difficulty": "7657563137253",
"total_difficulty": "2874342750898990991",
"gas_limit": "3141592",
"nonce": "0x32dd2d75a55f1463",
"mined_by": "0xf8b483dba2c3b7176a3da549ad41a48bb3121069",
"mined_in_seconds": 7,
"uncles": [],
"extra_data": "0xd983010203844765746887676f312e342e328777696e646f7773",
"confirmations": 7023472,
"total_fees": "1050000000000000"
}
}
Info
Block Hash Endpoint gives you detail information for particular block in the blockchain
HTTP Request
GET /v1/bc/eth/${NETWORK}/blocks/${BLOCK_HASH}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
BLOCK_HASH | - | Hash of the block in blockchain |
BLOCK_HASH is a string
representing the hash of the block you’re interested in querying, for example:
0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383
The returned object contains information about the block in JSON format, including its height, the total amount of wei transacted within it, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block and more.
Get Block by Height
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/blocks/523442 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
const https = require('https');
var options = {
"method": "GET",
"hostname": "https://api.cryptoapis.io",
"path": "/v1/bc/eth/mainnet/blocks/523442",
"headers": {
'Content-Type': 'application/json',
'X-API-Key': 'my-api-key'
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,blocks,523442", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/blocks/523442"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.mainnet",
"height": 523442,
"hash": "0x79230d974f6cea8c11cc2f3a58c2b811313af17a2f7391de6665502910d4d383",
"parent_hash": "0x3e3ad7b9a63de7a1f1f564ee5393876caf61eff04d7c330bfe6df9b942c606d6",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"gas_used": "21000",
"size": 658, //in bytes
"timestamp": 1447237199,
"date": "2015-11-11 10:19:59 UTC", //deprecated
"datetime": "2015-11-11 10:19:59 UTC",
"transactions": 1,
"difficulty": "7657563137253",
"total_difficulty": "2874342750898990991",
"gas_limit": "3141592",
"nonce": "0x32dd2d75a55f1463",
"mined_by": "0xf8b483dba2c3b7176a3da549ad41a48bb3121069",
"mined_in_seconds": 7,
"uncles": [],
"extra_data": "0xd983010203844765746887676f312e342e328777696e646f7773",
"confirmations": 7023472,
"total_fees": "1050000000000000"
}
}
Info
Block Height Endpoint gives you detailed information for particular block in the blockchain
HTTP Request
GET /v1/bc/eth/${NETWORK}/blocks/${BLOCK_HEIGHT}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
BLOCK_HEIGHT | - | Height of the block in blockchain |
BLOCK_HEIGHT is an integer
representing the height of the block you’re interested in querying, for example:
523442
The returned object contains information about the block in JSON format, including its height, the total amount of wei transacted within it, the number of transactions in it and more.
Get Latest Block
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/blocks/latest HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"port": "8021",
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"blocks",
"latest"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,blocks,latest", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/blocks/latest"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.rinkeby",
"height": 4190586,
"hash": "0x0e6dd17fd8796d2dd9b443a877f4f0d5a9ac96f178469a53eacfaf6fdf5e0a34",
"parent_hash": "0x61980a93a927bb57e890d637f96997d0a30855cf19597c6adcea2f2789ee8d1e",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"gas_used": "973938",
"size": 2921, //in bytes
"timestamp": 1554988169,
"date": "2019-04-11 13:09:29 UTC", //deprecated
"datetime": "2019-04-11 13:09:29 UTC",
"transactions": 10,
"difficulty": "2",
"total_difficulty": "7713556",
"gas_limit": "7019104",
"nonce": "0x00",
"mined_by": "0x0000000000000000000000000000000000000000",
"mined_in_seconds": 15,
"uncles": [],
"extra_data": "0xd683010900846765746886676f312e3132856c696e7578000000000000000000b4e94cf8329db3b98d7fd1ed5087edbcfc176bdc3fd9b1f25f19299cb16599f27a047aa82eee5b49cfa53e411194d09c91cb295c0f131082fd9bd2a5e1f63cc601",
"confirmations": 1,
"total_fees": "2999609192498000"
}
}
Info
Latest Block Endpoint gives you detailed information for the latest block in the blockchain
HTTP Request
GET /v1/bc/eth/${NETWORK}/blocks/latest
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
The returned object contains information about the latest block in JSON format, including its height, the total amount of wei transacted within it, the number of transactions in it and more.
Addresses
Whereas the Bitcoin blockchain was purely a list of transactions, Ethereum’s basic unit is the account. The Ethereum blockchain tracks the state of every account, and all state transitions on the Ethereum blockchain are transfers of value and information between accounts. There are two types of accounts:
- Externally Owned Accounts (EOAs), which are controlled by private keys
- Contract Accounts, which are controlled by their contract code and can only be “activated” by an EOA
Crypto APIs Address API allows you to look up information about public Ethereum addresses/accounts and generate your own low-value Ethereum addresses/public-private key pairs.
If you’re new to blockchains, you can think of public addresses as similar to bank account numbers in a traditional ledger. The biggest differences:
- Anyone can generate a public address themselves (through ECDSA in Bitcoin). No single authority is needed to generate new addresses; it’s just public-private key cryptography.
- Public addresses are significantly more lightweight. Consequently, and unlike traditional bank accounts, you can (and should!) generate new addresses for every transaction.
- Addresses can also leverage pay-to-script-hash, which means they can represent exotic things beyond a single private-public key pair; the most prominent example being multi-signature addresses that require n-of-m signatures to spend.
More about Ethereum Account Management can be found in the offical documents.
Generate Address
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/address \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
POST /v1/bc/eth/ropsten/address HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"address"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,address", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address")
.post(null)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"address": "0xb8e51b75a8ab6995b2e11938fed3b05837ec5fa2",
"privateKey": "5d06b11d276e169d2fa2ced94d327902ee954ff47e31bcbf0aa4957a829a0aed",
"publicKey": "303727940fca8f9b1f580908246aa980f9ee2aa9ecc379cbaf6a80f0050c1a2cdd7a467c1e564a2e272fb5b1958320ca11ca79b9cdfaf2bd74e6decd2592daa8"
}
}
Info
The Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address. No information is required with this POST request.
HTTP Request
POST /v1/bc/eth/${NETWORK}/address
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
The returned object contains a private key in hex-encoded, a public key, and a public address.
Generate Account
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/account \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"password":"yourpassword"
}'
POST /v1/bc/eth/ropsten/account HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"password":"yourpassword"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/account",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"password\":\"yourpassword\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"account"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ password: 'yourpassword' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/account');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"password":"yourpassword"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/account")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"password\":\"yourpassword\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"password\":\"yourpassword\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,account", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"password\":\"yourpassword\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/account")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/account"
payload := strings.NewReader("{\n\t\"password\":\"yourpassword\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"success": "keystore saved",
"address": "0x14eefa06e6f617ba9df050d7f9415e5bd0f11d34"
}
}
Info
The Generate Account Endpoint allows you to generate private-public key-pairs along with an associated public address encoded in a keyfile. A password and user id are required with this POST request. Keyfiles are stored in a keystore subdirectory on our servers. The critical component of the keyfile, the account’s private key, is always encrypted, and it is encrypted with the password entered when the account was created.
The user id is needed in order to associate the keyfile with the specific user.
HTTP Request
POST /v1/bc/eth/${NETWORK}/account
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
The returned object contains a public address.
Addresses & Transactions Data
Crypto APIs Addresses & Transactions Data API allows you to look up information about public addresses on the blockchain as well as to look up information about pending transactions, query transactions based on hash, block or index.
Unlike Bitcoin, Ethereum has no concept of UTXOs. Instead, addresses have a running balance, and use an ever-increasing sequence/nonce for every transaction to maintain proper address state. You can read more about this design decision here. Transaction signing and generation are also different in Ethereum, but for basic transactions, the process is very similar to our Bitcoin API.
Get Address Details
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"address",
"0x9e44c54a4ccdade765d23bbbdb99e66003b5e987"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,address,0x9e44c54a4ccdade765d23bbbdb99e66003b5e987", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x9e44c54a4ccdade765d23bbbdb99e66003b5e987"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.ropsten",
"address": "0x9e44c54a4ccdade765d23bbbdb99e66003b5e987",
"balance": "0.116622817690596", //eth
"txs_count": 18,
"from": 17,
"to": 1
}
}
Info
The default Address Endpoint strikes a balance between response time and data on Addresses. It returns information about the balance (in ETH) and transactions of a specific address.
HTTP Request
GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | Address in blockchain |
ADDRESS is a string representing the public address you’re interested in querying, for example:
0x9e44c54a4ccdade765d23bbbdb99e66003b5e987
The returned object contains information about the address, including its balance in ETH and the number of transactions associated with it. The endpoint omits any detailed transaction information, but if that isn’t required by your application, then it’s the fastest and preferred way to get public address information.
Get Basic Transactions By Address
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"address",
"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"basic",
"transactions"
],
"qs": {
"index": 0,
"limit": 15
},
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
querystring = {"index": 0, "limit": 15}
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,address,0x0cb1883c01377f45ee5d7448a32b5ac1709afc11,basic/transactions", headers=headers, params=querystring))
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/basic/transactions?index=0&limit=15"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"hash": "0x364f3fdd15aa212f5c63ae7904207ff49ca3f36e6045ef029b6dd3844735a910",
"amount": "1",
"unit": "eth",
"fee": "0.000000000441",
"datetime": "2020-03-06 09:30:35 UTC",
"timestamp": 1583487035,
"confirmations": 1,
"sent": "0x81b7e08f65bdf5648606c89998a9cc8164397647",
"received": "0x305a6cc29428c67b259308fa0e29a386eb47eca1"
},
{
"hash": "0x9e80d39882b6eb6ff720541d9ee9c91288c5fb8406ea2c4aaa91d71adb31ef3a",
"amount": "1",
"unit": "eth",
"fee": "0.000000000441",
"datetime": "2020-03-06 09:28:29 UTC",
"timestamp": 1583486909,
"confirmations": 8,
"sent": "0x81b7e08f65bdf5648606c89998a9cc8164397647",
"received": "0x890c7a21cc529c46da28cb349789184972f71fde"
}
],
"meta": {
"totalCount": 29973583,
"index": 0,
"limit": 50,
"results": 50
}
}
Info
The Basic Transactions By Address Endpoint returns basic information about all the transactions specified by the query params: index and limit; The maximum value of limit is 50. The value in the returned transactions in WEI.
HTTP Request
GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/basic/transactions?index=${INDEX}&limit=${LIMIT}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | Address in blockchain |
INDEX | 0 | start from |
LIMIT | ------- | limit up to n transactions |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
ADDRESS is a string representing the public address you’re interested in querying, for example:
0x0cb1883c01377f45ee5d7448a32b5ac1709afc11
INDEX is an integer
representing the order of the transaction, for example:
0
LIMIT is an integer
representing limit for transactions, for example:
15
Get Transactions By Address
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"address",
"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"transactions"
],
"qs": {
"index": 0,
"limit": 15
},
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
querystring = {"index": 0, "limit": 15}
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,address,0x0cb1883c01377f45ee5d7448a32b5ac1709afc11,transactions", headers=headers, params=querystring))
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0x0cb1883c01377f45ee5d7448a32b5ac1709afc11/transactions?index=0&limit=15"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"hash": "0xd990474c67fd5f3c41298f6603c611e3bfa19f27c05e0dddf772edbc6c932e9c",
"value": "4884207551764164050",
"date": "2019-07-02 11:57:30 UTC", //deprecated
"datetime": "2019-07-02 11:57:30 UTC",
"timestamp": 1562068650,
"nonce": 83,
"confirmations": 374882,
"block": 5905850,
"gas_price": "15000000000",
"gas_used": "21000"
},
{
"from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"hash": "0x248ca3dc240680bca6670f8a34238f4ed1f6fbdbf3f8925978e7dd38458150b6",
"value": "120000000000000",
"date": "2019-04-16 11:20:15 UTC", //deprecated
"datetime": "2019-04-16 11:20:15 UTC",
"timestamp": 1555413615,
"nonce": 69,
"confirmations": 864432,
"block": 5416300,
"gas_price": "21000000000",
"gas_used": "21000"
},
...
{
"from": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"to": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"hash": "0xf667dbdf4433357766bb3d31c10c71fba6e96ae0ce786f947692639fb1f84ba9",
"value": "12410000000000000",
"date": "2018-12-04 12:56:20 UTC", //deprecated
"datetime": "2018-12-04 12:56:20 UTC",
"timestamp": 1543928180,
"nonce": 166,
"confirmations": 1719929,
"block": 4560803,
"gas_price": "10000000000",
"gas_used": "21000"
}
],
"meta": {
"totalCount": 281,
"index": 0,
"limit": 15,
"results": 15
}
}
Info
The Transactions By Address Endpoint returns all transactions specified by the query params: index and limit; The maximum value of limit is 50. The value in the returned transactions in WEI.
HTTP Request
GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/transactions?index=${INDEX}&limit=${LIMIT}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | Address in blockchain |
INDEX | 0 | start from |
LIMIT | ------- | limit up to n transactions |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
ADDRESS is a string representing the public address you’re interested in querying, for example:
0x0cb1883c01377f45ee5d7448a32b5ac1709afc11
INDEX is an integer
representing the order of the transaction, for example:
0
LIMIT is an integer
representing limit for transactions, for example:
15
Get Transactions For Address By Range
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"address",
"0xc065b539490f81b6c297c37b1925c3be2f190738",
"transactions-by-range",
"1592206432",
"1592908522"
],
"qs": {
"index": 0,
"limit": 15
},
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
querystring = {"index": 0, "limit": 15}
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,address,0xc065b539490f81b6c297c37b1925c3be2f190738,transactions-by-range,1592206432,1592908522", headers=headers, params=querystring))
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transactions-by-range/1592206432/1592908522"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"from": "0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59",
"to": "0xc065b539490f81b6c297c37b1925c3be2f190738",
"fee": "0.000105",
"status": "0x1",
"hash": "0x739460bb62fc2380473cd9f35b77f39ace3c1cc78bd10d858ebfb873db67473f",
"value": "1119895000000000000",
"date": "2020-06-23 10:35:22 UTC",
"timestamp": 1592908522,
"nonce": 66,
"confirmations": 6679,
"block": 8152914,
"gas_price": "5000000000",
"gas_used": "21000"
},
...
{
"from": "0xc065b539490f81b6c297c37b1925c3be2f190738",
"to": "0x20fe562d797a42dcb3399062ae9546cd06f63280",
"fee": "0.00145164",
"status": "0x1",
"hash": "0x69adfd6910ed1c55692a07d36e04387f9277e7403f6cd01a733dd219eec6b33f",
"value": "0",
"date": "2020-06-15 07:33:52 UTC",
"timestamp": 1592206432,
"nonce": 253,
"confirmations": 63469,
"block": 8096124,
"gas_price": "40000000000",
"gas_used": "36291"
}
],
"meta": {
"totalCount": 365,
"index": 0,
"limit": 50,
"results": 14
}
}
Info
The Transactions For Address By Range Endpoint returns all transactions specified by the query params: INDEX, LIMIT, FROM_TIMESTAMP AND TO_TIMESTAMP ; The value in the returned transactions in WEI.
HTTP Request
GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/transactions-by-range/{$FROM_TIMESTAMP}/{$TO_TIMESTAMP}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | Address in blockchain |
FROM_TIMESTAMP | ------- | From timestamp of desired txs |
TO_TIMESTAMP | ------- | To timestamp of desired txs |
INDEX | 0 | start from |
LIMIT | ------- | limit up to n transactions |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
ADDRESS is a string representing the public address you’re interested in querying, for example:
0xc065b539490f81b6c297c37b1925c3be2f190738
INDEX is an integer
representing the order of the transaction, for example:
0
LIMIT is an integer
representing limit for transactions, for example:
15
FROM_TIMESTAMP
and TO_TIMESTAMP
must be provided to get transactions with date range.
Get Address Nonce
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"address",
"0xbB9d3A371b6e1dd468161C0DF12492867CC594dB",
"nonce"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,address,0xbB9d3A371b6e1dd468161C0DF12492867CC594dB,nonce", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/0xbB9d3A371b6e1dd468161C0DF12492867CC594dB/nonce"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"nonce": 108
}
}
Info
The Nonce Endpoint returns the current nonce of the specified address.
HTTP Request
GET /v1/bc/eth/${NETWORK}/address/${ADDRESS}/nonce
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | Address in blockchain |
ADDRESS is a string representing the public address you’re interested in querying, for example:
0xbB9d3A371b6e1dd468161C0DF12492867CC594dB
Multiple Addresses Details
Code samples
curl -X POST 'https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/show-multiple' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'\
-d '{
"addresses" : ["0xdac17f958d2ee523a2206206994597c13d831ec7", "0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5", "0xfa720e85af4c0379191ea94bc0a1f100e7245dd6","0xd551234ae421e3bcba99a0da6d736074f22192ff"]
}'
POST /v1/bc/eth/rinkeby/address/show-multiple HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"addresses" : ["0xdac17f958d2ee523a2206206994597c13d831ec7", "0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5", "0xfa720e85af4c0379191ea94bc0a1f100e7245dd6","0xd551234ae421e3bcba99a0da6d736074f22192ff"]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/show-multiple",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"addresses\": [\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\", \"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\", \"0xd551234ae421e3bcba99a0da6d736074f22192ff\"]}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/eth/rinkeby/address/show-multiple",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ addresses:
["0xdac17f958d2ee523a2206206994597c13d831ec7", "0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5", "0xfa720e85af4c0379191ea94bc0a1f100e7245dd6","0xd551234ae421e3bcba99a0da6d736074f22192ff"]
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/show-multiple');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"addresses" : ["0xdac17f958d2ee523a2206206994597c13d831ec7", "0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5", "0xfa720e85af4c0379191ea94bc0a1f100e7245dd6","0xd551234ae421e3bcba99a0da6d736074f22192ff"]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/show-multiple")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"addresses\": [\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\", \"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\",\"0xd551234ae421e3bcba99a0da6d736074f22192ff\"]}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"addresses\": [\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\", \"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\",\"0xd551234ae421e3bcba99a0da6d736074f22192ff\"]}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/eth/rinkeby/addresses/show-multiple, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"addresses\": [\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\", \"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\",\"0xd551234ae421e3bcba99a0da6d736074f22192ff\"]}"
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/show-multiple")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/address/show-multiple"
payload := strings.NewReader(""{\n\t\"addresses\": [\"0xdac17f958d2ee523a2206206994597c13d831ec7\",\"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\", \"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5\",\"0xd551234ae421e3bcba99a0da6d736074f22192ff\"]}");
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"chain": "ETH.rinkeby",
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"balance": "0",
"txs_count": 0,
"from": 0,
"to": 0
},
{
"chain": "ETH.rinkeby",
"address": "0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5",
"balance": "0",
"txs_count": 0,
"from": 0,
"to": 0
},
{
"chain": "ETH.rinkeby",
"address": "0xfa720e85af4c0379191ea94bc0a1f100e7245dd6",
"balance": "0",
"txs_count": 0,
"from": 0,
"to": 0
},
{
"chain": "ETH.rinkeby",
"address": "0xd551234ae421e3bcba99a0da6d736074f22192ff",
"balance": "0",
"txs_count": 0,
"from": 0,
"to": 0
}
],
"meta": {
"totalCount": 4,
"limit": 4,
"results": 4
}
}
Info
The Multiple Addresses Details Endpoint strikes a general information about the given addresses in the array.
HTTP Request
POST /v1/bc/eth/${NETWORK}/address/show-multiple
Query Parameters
Request Object
{
"addresses": [
"0xdac17f958d2ee523a2206206994597c13d831ec7",
"0xf824da33aabdd5130d2e4e9cca16c1ec1492ceb5",
"0xfa720e85af4c0379191ea94bc0a1f100e7245dd6",
"0xd551234ae421e3bcba99a0da6d736074f22192ff"
]
}
Max length of the array is 10 elements
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. rinkeby,ropsten or mainnet) |
As you can see from the code example, you need to provide several public addresses within the addresses array.
The endpoint returns a string array with information about the addresses, including its balance in ETH and the number of transactions associated with it.
Get Basic Transaction By Hash
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"eth",
"bc",
"ropsten",
"txs",
"basic",
"hash",
"0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,txs,basic,hash,0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/basic/hash/0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"amount": "1",
"unit": "eth",
"fee": "0.000000000000105",
"datetime": "2020-03-06 07:23:57 UTC",
"timestamp": 1583479437,
"confirmations": 84,
"sent": "0x81b7e08f65bdf5648606c89998a9cc8164397647",
"received": "0xafad1d75b685c14d8b48006286e5da00234f96f8"
}
}
Info
The Basic Transaction By Hash Endpoint returns basic information about a given transaction based on its hash.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/basic/hash/${TX_HASH}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
TX_HASH | - | Hash of the transaction in blockchain |
TX_HASH is a string
representing the hash of the block you’re interested in querying, for example:
0x77c302d81b9275fc5d63016fa06f3fad4393e1bebebdc87dfc8af372b24dddb6
The returned object contains detailed information about the transaction, including the value transferred, fee, date received and more.
Get Transaction By Hash
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"eth",
"bc",
"mainnet",
"txs",
"hash",
"0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,txs,hash,0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/hash/0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.mainnet",
"status": "0x1",
"index": 79,
"hash": "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
"value": "0",
"from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"to": "0x946048a75af11c300a274344887ec39452218b3d",
"date": "2018-10-17 08:31:13 +UTC",
"timestamp": 153976507,
"block_hash": "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
"block_number": 6530876,
"gas": "340977",
"gas_price": "6000000000",
"gas_used": "227318",
"nonce": 61,
"confirmations": 1016247,
"token_transfers": [
{
"from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"to": "0x946048a75af11c300a274344887ec39452218b3d",
"tokenName": "EtheremonToken",
"symbol": "EMONT",
"tokenType": "ERC-20",
"tokenID": "30060053",
"value": "11.10948334"
}
],
"input": "0x0396dcb00000000000000000000000000000000000000000000000000000000000000bbe0000000000000000000000000000000000000000000000000000000042e369c00000000000000000000000000000000000000000000000000000000000000000"
}
}
Info
The Transaction Hash Endpoint returns detailed information about a given transaction based on its hash.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/hash/${TX_HASH}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
TX_HASH | - | Hash of the transaction in blockchain |
TX_HASH is a string
representing the hash of the block you’re interested in querying, for example:
0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c
The returned object contains detailed information about the transaction, including the value transfered, fees collected, date received, any scripts associated with an output, and more.
Get Transactions Index By Index, Limit and Block Number
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"block",
"4173655"
],
"qs": {
"index": 0,
"limit": 4
},
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
querystring = {"index": 0, "limit": 4}
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,txs,block,4173655", headers=headers, params=querystring)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/block/4173655?index=0&limit=4"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"meta": {
"totalCount": 14,
"index": 0,
"limit": 4,
"results": 4
},
"payload": [
{
"chain": "ETH.ropsten",
"status": "0x1",
"index": 3,
"hash": "0xf81f9d0091d8e424545f080a6cbd1b5167926371f90828292452ca9df90b551e",
"value": "60000000000000",
"from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
"to": "0x33e5208b30dd58495bd0037ab2ba9a8762c0e757",
"date": "2018-10-05 06:26:26 +UTC",
"timestamp": 1549376226,
"block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
"block_number": 4173655,
"gas": "21000",
"gas_price": "1000000000",
"gas_used": "21000",
"nonce": 752,
"confirmations": 1210755,
"token_transfers": {},
"input": "0x"
},
{
"chain": "ETH.ropsten",
"status": "0x1",
"index": 2,
"hash": "0xd6f1f418515ee7694c31f99d85feea9dddc8081317f0f76c6781de9009787da2",
"value": "60000000000000",
"from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
"to": "0x82de76c863d85c4e3a61a6ea8ae3b7eb452ec0cf",
"date": "2018-10-05 06:26:26 +UTC",
"timestamp": 1549376226,
"block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
"block_number": 4173655,
"gas": "21000",
"gas_price": "1000000000",
"gas_used": "21000",
"nonce": 751,
"confirmations": 1210755,
"token_transfers": {},
"input": "0x"
},
{
"chain": "ETH.ropsten",
"status": "0x1",
"index": 1,
"hash": "0xe53df98e05e68eff01afca62a9ab720cbbe60fee88813148bc33d931d1ead98b",
"value": "60000000000000",
"from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
"to": "0x9d271c0005aafb722d177aa6d0a8145c7be80ed4",
"date": "2018-10-05 06:26:26 +UTC",
"timestamp": 1549376226,
"block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
"block_number": 4173655,
"gas": "21000",
"gas_price": "1000000000",
"gas_used": "21000",
"nonce": 750,
"confirmations": 1210755,
"token_transfers": {},
"input": "0x"
},
{
"chain": "ETH.ropsten",
"status": "0x1",
"index": 0,
"hash": "0x7fc78d0e9a386076cd216ea207f19997d281163aee30204b7ec0a84791c0021f",
"value": "60000000000000",
"from": "0x31d69f8cb2a0c33d43f6a1eac1b5940483d6c40a",
"to": "0x4709ab0acdb83b382240122fe360810668efa728",
"date": "2018-10-05 06:26:26 +UTC",
"timestamp": 1549376226,
"block_hash": "0x0114449f2f83df6947c12e91a9d44cf69cdb34eb1d4b169e373ed2ead785e568",
"block_number": 4173655,
"gas": "21000",
"gas_price": "1000000000",
"gas_used": "21000",
"nonce": 749,
"confirmations": 1210755,
"token_transfers": {},
"input": "0x"
}
]
}
Info
The Transaction Index Endpoint by Index, Limit and Block Number returns detailed information about transactions for the block height defined, starting from the index defined up to the limit defined . In the example above index is 0 and limit is 4, therefore the response will be an array of 4 transactions starting from index 0. The highest number for the limit is 50.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/block/${BLOCK_NUMBER}?index=${TX_INDEX}&limit=${LIMIT}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
TX_INDEX | ------- | Index - start from |
LIMIT | ------- | Limit - up to |
BLOCK_NUMBER | ------- | Block height |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
TX_INDEX is a integer
representing the order of the transaction within the block, for example:
0
LIMIT is a integer
representing limit for transactions, for example:
4
BLOCK_NUMBER is a integer
representing the height of the block, for example:
4173655
Get Transaction By Transaction Index and Block Number
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/txs/block/6530876/79 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"txs",
"6530876",
"79"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,txs,6530876,79", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/6530876/79"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.mainnet",
"status": "0x1",
"index": 79,
"hash": "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
"value": "0",
"from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"to": "0x946048a75af11c300a274344887ec39452218b3d",
"date": "2018-10-17 08:31:13 +UTC",
"timestamp": 1549376226,
"block_hash": "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
"block_number": 6530876,
"gas": "340977",
"gas_price": "6000000000",
"gas_used": "227318",
"nonce": 61,
"confirmations": 1016280,
"token_transfers": [
{
"from": "0x0000000000000000000000000000000000000000",
"to": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"tokenName": "MyCryptoHeroes:Hero",
"symbol": "MCHH",
"tokenType": "ERC-721",
"tokenID": "30060053"
},
{
"from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"to": "0x946048a75af11c300a274344887ec39452218b3d",
"value": "11.10948334",
"tokenName": "EtheremonToken",
"symbol": "EMONT",
"tokenType": "ERC-20"
}
],
"input": "0x0396dcb00000000000000000000000000000000000000000000000000000000000000bbe0000000000000000000000000000000000000000000000000000000042e369c00000000000000000000000000000000000000000000000000000000000000000"
}
}
Info
The Transaction Index Endpoint by Block Number returns detailed information about a given transaction based on its index and block height.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/block/${BLOCK_NUMBER}/${TX_INDEX}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
TX_INDEX | - | Index of the transaction in block |
BLOCK_NUMBER | - | Block height |
TX_INDEX is a integer
representing the order of the transaction within the block, for example:
79
BLOCK_NUMBER is a integer
representing the height of the block, for example:
6530876
The returned object contains detailed information about the transaction, including the value transfered, fees collected, date received, any scripts associated with an output, and more.
Get Transaction by Transaction Index and Block Hash
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"txs",
"block",
"0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
"79"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,txs,block,0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c,79", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/block/0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c/79"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"chain": "ETH.mainnet",
"status": "0x1",
"index": 79,
"hash": "0x5d41df69ee87f712e76ee5f4dd6c0ccbec114b9d871340b7e2b34bf6d8d26c2c",
"value": "0",
"from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"to": "0x946048a75af11c300a274344887ec39452218b3d",
"date": "2018-10-17 08:31:13 +UTC",
"timestamp": 1539765073,
"block_hash": "0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c",
"block_number": 6530876,
"gas": "340977",
"gas_price": "6000000000",
"gas_used": "227318",
"nonce": 61,
"confirmations": 1016285,
"token_transfers": [
{
"from": "0x0000000000000000000000000000000000000000",
"to": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"tokenName": "MyCryptoHeroes:Hero",
"symbol": "MCHH",
"tokenType": "ERC-721",
"tokenID": "30060053"
},
{
"from": "0xc071a1945cff872d30e7f3bdfcd17eca8f46ea19",
"to": "0x946048a75af11c300a274344887ec39452218b3d",
"value": "11.10948334",
"tokenName": "EtheremonToken",
"symbol": "EMONT",
"tokenType": "ERC-20"
}
],
"input": "0x0396dcb00000000000000000000000000000000000000000000000000000000000000bbe0000000000000000000000000000000000000000000000000000000042e369c00000000000000000000000000000000000000000000000000000000000000000"
}
}
Info
The Transaction Index Endpoint by Block Hash returns detailed information about a given transaction based on its index and block hash.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/block/${BLOCK_HASH}/${TX_INDEX}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
TX_INDEX | ------- | Index of the transaction in block |
BLOCK_HASH | ------- | Block hash |
TX_INDEX is a integer
representing the order of the transaction within the block, for example:
79
BLOCK_HASH is a string
representing the hash of the block, for example:
0x0d13e81c01de31060a2830bb53761ef29ac5c4e5c1d43e309ca9a101140e394c
The returned object contains detailed information about the transaction, including the value transfered, fees collected, date received, any scripts associated with an output, and more.
Get Pending Transactions
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/txs/pending HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"txs",
"pending"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,txs,pending", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/pending"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"meta": {
"totalCount": 150,
"limit": 50,
"results": 50
},
"payload": [
{
"hash": "0xf730a960741612568f37fcfdc690cf3a0d64df47608cbd1ccb5b2cd0fd761d7c",
"nonce": 67952,
"blockHash": "0xd7a527f3b9e1955672e25b506985423e9643866a4e9c452f312b97772a620156",
"blockNumber": 7547053,
"transactionIndex": 0,
"from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
"to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
"value": "0",
"gasPrice": "66000000000",
"gas": "77777",
"input": "0xa9059cbb000000000000000000000000b0715ffbdbda3b1abf2fc66339412b6cde636728000000000000000000000000000000000000000000000546f85996e215c40000"
},
{
"hash": "0x22c3f2e2314a715c54b551b935f95886cda901ad02db82aa3ea548e154e0a057",
"nonce": 67953,
"blockHash": "0xd7a527f3b9e1955672e25b506985423e9643866a4e9c452f312b97772a620156",
"blockNumber": 7547053,
"transactionIndex": 1,
"from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
"to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
"value": "0",
"gasPrice": "66000000000",
"gas": "77777",
"input": "0xa9059cbb000000000000000000000000b0715ffbdbda3b1abf2fc66339412b6cde6367280000000000000000000000000000000000000000000005466d9273dd8bdc0000"
},
...
{
"hash": "0xfadc74ab6cb41172541faa6824caf40210ec4a945f7611a3853bf373b3cdaef1",
"nonce": 7565,
"blockHash": "0xd7a527f3b9e1955672e25b506985423e9643866a4e9c452f312b97772a620156",
"blockNumber": 7547053,
"transactionIndex": 49,
"from": "0x726718b171c91e8ec0cd484e49aa943703f5be18",
"to": "0x47ba0689fbd72936749b007d18dfb75d34bf241b",
"value": "0",
"gasPrice": "12000000000",
"gas": "90000",
"input": "0xa9059cbb000000000000000000000000741586d63e7f2b180f425ad322372fd33ee6321f000000000000000000000000000000000000000000000000000012020bf77000"
}
]
}
Info
Pending Transactions Endpoint makes a call to the EVM and returns all pending transactions. The response might be limited if you lack credits.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/pending
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
LIMIT | 50 | limit to 50 transactions |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The returned object contains detailed information about the pending transactions.
Get Queued Transactions
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/txs/queued HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"txs",
"queued"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,txs,queued", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/queued"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"meta": {
"totalCount": 73,
"limit": 3,
"results": 3
},
"payload": [
{
"hash": "0x20872578e2f25a1ef7a234c2f7974c54e9c1a9c8ee70e95674750e394fc71dbb",
"nonce": 67973,
"blockHash": "0xefef5c28ca8360140aec3920de48ad27e98acc250173240fa16bdf63f9245de3",
"blockNumber": 7547071,
"transactionIndex": 0,
"from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
"to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
"value": "0",
"gasPrice": "66000000000",
"gas": "77777",
"input": "0xa9059cbb00000000000000000000000077c9b160a38e023fe90e50498f984ae0ead58db7000000000000000000000000000000000000000000000a94564788f48d6a8000"
},
{
"hash": "0x7c30619b83063efd3c1c57b85630ea47ee4939b5735ea837de1a4222ef98fca8",
"nonce": 67974,
"blockHash": "0xefef5c28ca8360140aec3920de48ad27e98acc250173240fa16bdf63f9245de3",
"blockNumber": 7547071,
"transactionIndex": 1,
"from": "0x99fe5d6383289cdd56e54fc0baf7f67c957a8888",
"to": "0x9064c91e51d7021a85ad96817e1432abf6624470",
"value": "0",
"gasPrice": "66000000000",
"gas": "77777",
"input": "0xa9059cbb0000000000000000000000006fc83d6a36e79838f6ef8116627b21a5ef5c95be00000000000000000000000000000000000000000000054915956c4096000000"
},
{
"hash": "0xea4b4e92ba783fd6fe0e1a15e502d2e807f23a806f68b99609ecf5206d97be20",
"nonce": 15,
"blockHash": "0xefef5c28ca8360140aec3920de48ad27e98acc250173240fa16bdf63f9245de3",
"blockNumber": 7547071,
"transactionIndex": 2,
"from": "0xd6ad306af05fb9fc6d52025d3e7004a3b1390af2",
"to": "0xfbb589251a5dcd955f51fc36e560b18fa8a5e974",
"value": "1013000000000000000",
"gasPrice": "60000000000",
"gas": "1000000",
"input": "0x"
}
]
}
Info
Queued Transactions Endpoint makes a call to the EVM and returns all queued transactions. The response might be limited if you lack credits.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/queued
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
LIMIT | 50 | limit to 50 transactions |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The returned object contains detailed information about the queued transactions.
Transactions
Crypto APIs Transactions API allows you create, cancel and propagate your own transactions and embed data on the blockchain—all based on the coin/chain resource you’ve selected for your endpoints.
Create a Transaction
Info
Using Crypto APIs, you can push transactions to blockchains by using any of the methods below:
1) Use a third-party library to create your transactions and push raw transactions. 2) Use our two-endpoint process outlined below, wherein we generate a TXSkeleton based on your input address, output address, and value to transfer.
New Transaction Endpoint using keystore file stored on our server
In order to use this endpoint you should have an account(keystore file) stored on our servers.
Then, you need to provide the from address, to address, value to transfer (in Ether), gas price and gas limit in wei. A standard ETH transfer requires at least a gas limit of 21,000 units of gas. Even if you set a higher than the required gas limit, only the required limit will be deducted.
If you are not sure whether your gasLimit is enough to make a transaction or what is the average gasPrice, you can take a look at the following endpoints from our docs: Transaction GasLimit Endpoint and Transactions GasPrice Endpoint.
Optional fields are: nonce and data. The nonce
represents the transactions count for the specified from address. If not specified, then the system will automatically calculate the correct nonce.
If needed, a data hexidecimal string can be provided as well (within the json request), as follows:
"data" : "0xbc373585"
Be aware that the gas limit will be higher than the minimum amount of 21,000 wei.
The password associated with the keyfile should also be specified in order to unlock the account.
Nonce
In Ethereum, every transaction has a nonce. The nonce is the number of transactions sent from a given address. Each time you send a transaction, the nonce value increases by 1. There are rules about what transactions are considered valid transactions, and the nonce is used to enforce some of these rules. Specifically:
- Transactions must be in order. You cannot have a transaction with a nonce of 1 mined before one with a nonce of 0.
- No skipping! You cannot have a transaction with a nonce of 2 mined if you have not already sent transactions with a nonce of 1 and 0.
- Transactions with too low nonce will be immediately rejected.
- Transactions with too high nonce will be placed in the transaction pool queue.
- If transactions with nonces that fill the gap between the last valid nonce and the too high nonce are sent and the nonce sequence is
- complete, then all the transactions in the sequence will be processed and mined.
- The transaction pool queue will only hold a maximum of 64 transactions with the same "From" address with nonces out of sequence.
Why is Nonce important?
This value prevents double-spending, as the nonce will always specify the order of transactions. If a double-spend does occur, it’s typically due to the following process:
- A transaction is sent to one address.
- Waiting for transaction registration.
- Something is collected from the first transaction.
- Another transaction is sent with a high gas price.
- The second transaction is mined first, therefore invalidating the first transaction.
This is why exchanges wait for you to have a certain number of confirmations, before allowing you to trade funds.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/new
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress": "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
"toAddress": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"gasPrice": 21000000000,
"gasLimit": 21000,
"value": 1.12,
"password": "123456ABCdef",
"nonce": 0
}'
POST /v1/bc/eth/ropsten/txs/new HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"gasPrice" : 21000000000,
"gasLimit" : 21000,
"value" : 1.12,
"password" : "123456ABCdef",
"nonce": 0
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\",\n\t\"nonce\":0\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"new"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff',
toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
gasPrice: 21000000000,
gasLimit: 21000,
value: 1.12,
password: '123456ABCdef',
nonce: 0 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"gasPrice" : 21000000000,
"gasLimit" : 21000,
"value" : 1.12,
"password" : "123456ABCdef",
"nonce": 0
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\",\n\t\"nonce\":0\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n \"gasPrice\" : 21000000000,\n \"gasLimit\" : 21000,\n \"value\" : 1.12,\n \"password\" : \"123456ABCdef\",\n\t\"nonce\":0\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,new", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\",\n\t\"nonce\":0\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new"
payload := strings.NewReader("{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"password\" : \"123456ABCdef\",\n\t\"nonce\":0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d",
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you’d like to transfer from one address to another, gas price, gas limit and password.
While this particular usage will differ between client libraries, the result is the same: the addresses within your wallet will be used as the inputs, as if all of them had been placed within the addresses array.
As a return object, you’ll receive a transaction hash, for example:
{
"payload": {
"hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d"
}
}
This hash can be traced in the explorer. It will be with a pending status until it is mined.
Send All Amount Endpoint using keystore file stored on our server
This endpoint allows users to send all the available ether on their accounts to a specified address. Users should only specify the following information: - fromAddress; - toAddress; - password;
Gas limit and price are optional. Gas limit will be calculated by the EVM. The Gas price default value is the standard
property from Get Transactions Fee
endpoint.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/new/all
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"password" : "123456ABCdef"
}'
POST /v1/bc/eth/ropsten/txs/new/all HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"password" : "123456ABCdef"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"password\" : \"123456ABCdef\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"new",
"all"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff',
toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
password: '123456ABCdef' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"password" : "123456ABCdef"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"password\" : \"123456ABCdef\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n \"password\" : \"123456ABCdef\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,new,all", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"password\" : \"123456ABCdef\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new/all"
payload := strings.NewReader("{\n\t\"fromAddress\" : \"0xc438d912235ff5facc22c502e5bd6dc1ae14a7ff\",\n\t\"password\" : \"123456ABCdef\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d",
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
As a return object, you’ll receive a transaction hash, for example:
{
"payload": {
"hex": "0xfebf0691cc92f67ace032897a83587c44c5b2ef437341c6cfd5dbf1f8f4c288d"
}
}
This hash can be traced in the explorer. It will be with a pending status until it is mined.
New Transaction Endpoint with a private key
Crypto APIs allows sending transactions for address that are not hold on our servers. In this case the data that should be provided is as follows:
- from address;
- private key;
- to address;
- amount that should be sent;
- gas price;
- gas limit;
- nonce (optional) - integer;
- data (optional) - hexadecimal
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/new-pvtkey
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"gasPrice" : 21000000000,
"gasLimit" : 21000,
"value" : 1.12,
"privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}'
POST /v1/bc/eth/ropsten/txs/new-pvtkey HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"gasPrice" : 21000000000,
"gasLimit" : 21000,
"value" : 1.12,
"privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"new-pvtkey"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be',
toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
gasPrice: 21000000000,
gasLimit: 21000,
value: 1.12,
privateKey: '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"gasPrice" : 21000000000,
"gasLimit" : 21000,
"value" : 1.12,
"privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n \"gasPrice\" : 21000000000,\n \"gasLimit\" : 21000,\n \"value\" : 1.12,\n \"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,new-pvtkey", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey"
payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 21000,\n\t\"value\" : 1.12,\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you’d like to transfer from one address to another, gas price, gas limit and the private key of the address. A standard ETH transfer requires a gas limit of 21,000 units of gas, thefore if gas limit is not priveded the default value will be 60,000 units of gas.
As a return object, you’ll receive a transaction hash, for example:
{
"payload": {
"hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4"
}
}
This hash can be traced in the explorer. It will be with a status pending until it is mined.
Send All Amount Endpoint with a private key
Crypto APIs allows sending transactions (all available eth on a specified address) for address that are not hold on our servers. In this case the data that should be provided is as follows:
- from address;
- private key;
- to address;
- gas price (optional);
- gas limit (optional);
The gas price default value is the standard
property from Get Transactions Fee
endpoint, gas limit (if not set) will be calculated by the EVM.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/new-pvtkey/all
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}'
POST /v1/bc/eth/ropsten/txs/new-pvtkey/all HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\", privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"new-pvtkey",
"all"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be',
toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
privateKey: '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"privateKey" : "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n \"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,new-pvtkey,all", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/new-pvtkey/all"
payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\", \n\t\"privateKey\" : \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
As a return object, you’ll receive a transaction hash, for example:
{
"payload": {
"hex": "0x300feeceb350a5e2e955d05bd31adde7f4e2c6d2390a16d9435c704525e61ea4"
}
}
This hash can be traced in the explorer. It will be with a status pending until it is mined.
Prepare a Transaction
Crypto APIs provides the opportunity to locally sign your transaction. If you want to use third-pary tools for signing your raw transactions you can send to the Prepare a Transaction Endpoint only the following data:
- from address;
- to address;
- value.
For your convenience we need only this information. We will calculate the nonce for your transaction and add default values for gas price and gas value. After sending the request a JSON will be send to you (see response body). With your JSON returned from the Prepare a Transaction Endpoint you now need to use your private key to sign the data provided.
After signing your JSON locally you will be provided with hex-encoded raw string, for example(depends on your third-party tools):
{
raw: "0xf8690e827d00831e8480940cb1883c01377f45ee5d7448a32b5ac1709afc11877265bab9c48000802aa05be8d75183572592949237b32a9aec605631ca3e7471f038d69fff6a4b320777a00f41b170152f34644c1423b1aaf29b2229f05c35eb7534830d30c974c7f9c7c4",
tx: {
gas: "0x1e8480",
gasPrice: "0x7d00",
hash: "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c",
input: "0x",
nonce: "0xe",
r: "0x5be8d75183572592949237b32a9aec605631ca3e7471f038d69fff6a4b320777",
s: "0xf41b170152f34644c1423b1aaf29b2229f05c35eb7534830d30c974c7f9c7c4",
to: "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
v: "0x2a",
value: "0x7265bab9c48000"
}
}
We expect the hex-encoded data from the raw field.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/send
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"value" : 1.212
}'
POST /v1/bc/eth/ropsten/txs/send HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"value" : 1.212
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"send"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be',
toAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
value: 1.212 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"toAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"value" : 1.212
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n \"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n \"value\" : 1.212\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/send"
payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be\",\n\t\"toAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"value\" : 1.212\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"from": "0x1b85a43e2e7f52e766ddfdfa2b901c42cb1201be",
"gas": "2000000",
"gasLimit": "21000",
"gasPrice": "11000000000",
"nonce": 0,
"to": "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"value": "1212000000000000000"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
If request is successful, you’ll receive a JSON with the completed TX and an HTTP Status Code 200.
Broadcast a Signed Transaction
Once you’ve finished signing the raw transaction locally, send that raw transaction to our Broadcast a Signed Transaction Endpoint.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/push
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}'
POST /v1/bc/eth/ropsten/txs/push HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"push"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ hex: '0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,push", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push"
payload := strings.NewReader("{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
$hex is a hex-encoded raw representation of your transaction, for example:
{
"hex" : 0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69
}
If it succeeds, you’ll receive your transacation hash, for example:
{
"payload": {
"hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c"
}
}
Cancel а Transaction
Info
Using Crypto APIs, you can cancel pending transactions.
To cancel the original transaction, you will need to rebroadcast the same transaction with the same nonce
, with 0 ETH
value but also with higher gas price.
To be sure the original transaction will be canceled, we rebroadcast the transaction with 15%
higher gas price!
Cancel Transaction Endpoint using keystore file stored on our server
In order to use this endpoint you should have an account(keystore file) stored on our servers.
Then, you need to provide the transaction hash and the password associated with the keyfile should also be specified in order to unlock the account as follows:
- transaction hash (txHash);
- password (password);
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/cancel
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"txHash" : "0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701",
"password" : "mypassword"
}'
POST /v1/bc/eth/ropsten/txs/cancel HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"txHash" : "0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701",
"password" : "mypassword"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"password\" : \"mypassword\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"cancel"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ txHash: '0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701',
password: 'mypassword'}));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"txHash" : "0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701",
"password" : "mypassword"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"password\" : \"mypassword\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"password\" : \"mypassword\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,new", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"password\" : \"mypassword\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel"
payload := strings.NewReader("{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"password\" : \"mypassword\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f",
"view_in_explorer": "https://blockexplorer.one/eth/ropsten/tx/0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f/?utm_source=cryptoapis.io"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
As you can see from the code example, you only need to provide the hash of the transaction you want to cancel, and the password for the from address of the transaction.
As a return object, you’ll receive a transaction hash, for example:
{
"payload": {
"hex": "0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f",
"view_in_explorer": "https://blockexplorer.one/eth/ropsten/tx/0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f/?utm_source=cryptoapis.io"
}
}
Cancel Transaction Endpoint with a private key
Crypto APIs allows canceling transactions for address that are not hold on our servers. In this case the data that should be provided is as follows:
- transaction hash (txHash);
- private key (privateKey);
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/cancel-pvtkey
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel-pvtkey \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"txHash" : "0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701",
"privateKey" : "b711221b275c67...........f83d7dec908377e4b"
}'
POST /v1/bc/eth/ropsten/txs/cancel-pvtkey HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"txHash" : "0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701",
"privateKey" : "b711221b275c67...........f83d7dec908377e4b"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel-pvtkey",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"privateKey\" : \"b711221b275c67...........f83d7dec908377e4b\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"cancel-pvtkey"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ txHash: '0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701',
privateKey: 'b711221b275c67...........f83d7dec908377e4b' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel-pvtkey');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"txHash" : "0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701",
"privateKey" : "b711221b275c67...........f83d7dec908377e4b"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel-pvtkey")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"privateKey\" : \"b711221b275c67...........f83d7dec908377e4b\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"privateKey\" : \"b711221b275c67...........f83d7dec908377e4b\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,cancel-pvtkey", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"privateKey\" : \"b711221b275c67...........f83d7dec908377e4b\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel-pvtkey")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/cancel-pvtkey"
payload := strings.NewReader("{\n\t\"txHash\" : \"0x9909a4b9c9163efcf79b2a089eae359430b6831ea747966d2e52eabd15b49701\",\n\t\"privateKey\" : \"b711221b275c67...........f83d7dec908377e4b\"\n}"
)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f",
"view_in_explorer": "https://blockexplorer.one/eth/ropsten/tx/0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f/?utm_source=cryptoapis.io"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
As you can see from the code example, you only need to provide the hash of the transaction you want to cancel, and the private key associated with the from address of the transaction.
As a return object, you’ll receive a transaction hash, for example:
{
"payload": {
"hex": "0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f",
"view_in_explorer": "https://blockexplorer.one/eth/ropsten/tx/0x46e5d5638c850a43a653f3d33d65d4a6cac50b4d17200b4162a7dcce9bff530f/?utm_source=cryptoapis.io"
}
}
This hash can be traced in the explorer. It will be with a status pending until it is mined.
Refund a Transaction
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/refund \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"txHash" : "0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918",
"privateKey": "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e" or "password": "SECRET123456",
"gasPrice": 12123340000
}'
POST /v1/bc/eth/ropsten/txs/refund HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"txHash" : "0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918",
"privateKey": "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e" or "password": "SECRET123456",
"gasPrice": 12123340000
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/refund",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"txHash\" : \"0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918\",\n\t\"privateKey\": \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\" or \"password\": \"SECRET123456\",\n\t\"gasPrice\": 12123340000\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"refund"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ txHash: '0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918',
privateKey: '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e' or password: 'SECRET123456',
gasPrice: 12123340000 }));
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/refund');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"txHash" : "0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918",
"privateKey": "0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e" or "password": "SECRET123456",
"gasPrice": 12123340000
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/refund")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"txHash\" : \"0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918\",\n\t\"privateKey\": \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\" or \"password\": \"SECRET123456\",\n\t\"gasPrice\": 12123340000\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"txHash\" : \"0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918\",\n\t\"privateKey\": \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\" or \"password\": \"SECRET123456\",\n\t\"gasPrice\": 12123340000\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,refund", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"txHash\" : \"0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918\",\n\t\"privateKey\": \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\" or \"password\": \"SECRET123456\",\n\t\"gasPrice\": 12123340000\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/refund")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/refund"
payload := strings.NewReader("{\n\t\"txHash\" : \"0xcdc1c26803275b7ea6408d4019debfcf96e42f1c94b2b0a93f3e45d2ee4ab918\",\n\t\"privateKey\": \"0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e\" or \"password\": \"SECRET123456\",\n\t\"gasPrice\": 12123340000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "0x5dbdc5a5f26f59d9d0d18722e443a1bb669939c6ab898f654500ee0475908603"
}
}
The Refund a Transaction Endpoint allows users easily to return the amount in eth they have received from an unknown source.
Only two fields are required: the txHash
of the transcation and the privateKey
or password
(if you are using an account) of the recipient address/account (see examples).
There is an optional field gasPrice
. If gasPrice
field is not set the system will set the recommended gasPrice from the Transaction Fee Endpoint.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/refund
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
Transactions Fees
Get Gas Price
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/txs/fee HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"txs",
"fee"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,txs,fee", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/txs/fee"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"min": "1",
"max": "59894.458",
"average": "42.985",
"recommended": "45", // deprecated
"slow": "33.46200020",
"standard": "43.20000233",
"fast": "56.82152409",
"unit": "Gwei"
}
}
Info
Transactions Fee Endpoint gives information about the gas price for the successful transactions included in the last 1500 blocks.
min
shows the lowest gas price, max
is the highest and average
- the average gas price. recommended
is the gas price that we consider as the one that corresponds to a cheap and fast execution.
However, it is only a suggestion and should be used at users' sole discretion.
slow
, standard
and fast
represent the slowest (25th percentile), standard (50th percentile) and fastest (75th percentile) gas price values.
All gas prices are in Gwei.
slow
, standard
and fast
represent the slowest, standard and fastest values for a transaction fee.
HTTP Request
GET /v1/bc/eth/${NETWORK}/txs/fee
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
Get Gas Limit
Crypto APIs provides an endpoint for estimating the gas needed for a successful transaction. This is very useful when sending ether to contracts or making a transaction with additional data in it.
You have to provide the following data: - from address; - to address; - value of the transaction; - data - this field is optional. However, if data is added it should be a valid hexadecimal number otherwise an error will be returned as a response!
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/gas
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7",
"value" : 0.12,
"data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7"
}'
POST /v1/bc/eth/ropsten/txs/gas HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7",
"value" : 0.12,
"data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n \"value\" : 0.12,\n \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"gas"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0x7857af2143cb06ddc1dab5d7844c9402e89717cb',
toAddress: '0xc595B20EEC3d35E8f993d79262669F3ADb6328f7',
value: 0.12,
data: '24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"toAddress" : "0xc595B20EEC3d35E8f993d79262669F3ADb6328f7",
"value" : 0.12,
"data" : "24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n \"value\" : 0.12,\n \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n \"value\" : 0.12,\n \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,gas", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n \"value\" : 0.12,\n \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/gas"
payload := strings.NewReader("{\n \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n \"value\" : 0.12,\n \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"gasLimit": "25148"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
If it succeeds, you’ll receive a response with the estimated gas, as follows:
{
"gasLimit": "21040"
}
Tokens & Contracts
Crypto APIs Token API allows you to get token balances of addresses, as well as to transfer tokens from one address to another.
Compared to other blockchains, contracts lie at the heart of Ethereum’s unique value proposition. Contracts can be expressively programmed in languages like Solidity; if you’re not familiar with Ethereum’s contract language you should definitely start there.
We offer a number of API endpoints that significantly simplify contract creation and method calling. Via the methods below, you can embed new contracts into the Ethereum blockchain, check their code and ABI, and initiate contract methods and execution. Essentially, we provide a JSON/HTTP binding for your Ethereum contracts.
With great power comes great responsibility; in other words, it’s easier to shoot yourself in the foot with Ethereum. Don’t The DAO it. Follow best security and safety practices when coding your smart contracts.
Get Contract Details
In the request url you should provide the contract you want to observe. After sending the request you will receive a json object with the total supply, decimals, balance, tokenType(In case the contract is not for Token, this is missing), tokenName (In case the contract is not for Token, this is missing), tokenSymbol (In case the contract is not for Token, this is missing) of the contract. Works both for ERC-20 and ERC-721 Tokens.
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"tokens",
"contract",
"0xFe41Cb708CD98C5B20423433309E55b53F79134a",
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a6');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,tokens,contract,0xFe41Cb708CD98C5B20423433309E55b53F79134a", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/contract/0xFe41Cb708CD98C5B20423433309E55b53F79134a"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"decimals": 18.0,
"totalSupply": 109531.470139209559249714,
"balance": 0,
"tokenType": "ERC-20", // In case the contract is not for Token, this is missing.
"tokenName": "Tellor Tributes", // In case the contract is not for Token, this is missing.
"tokenSymbol": "TRB", // In case the contract is not for Token, this is missing.
"contractCreator": "0xe010ac6e0248790e08f42d5f697160dedf97e024"
}
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/tokens/contract/{contract}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
CONTRACT | ------- | contract address (e.g. "0xFe41Cb708CD98C5B20423433309E55b53F79134a") |
Estimate Gas Smart Contract
This endpoint returns the average gas price and gas limit set by the Ethereum Blockchain. At this point for all kinds of deployments the json result will be as follows:
{
"gas_price": 22000000000,
"gas_limit": 4300000
}
The actual amount will be known after the deployment is complete.
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/contracts/gas HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [ "https://api.cryptoapis.io:" ],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"contracts",
"gas"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,contracts,gas", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts/gas"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"gas_price": "22000000000",
"gas_limit": "4300000"
}
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/contracts/gas
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
Deploy а Smart Contract
The Deploy а Smart Contract Endpoint allows you to push your smart contract to the Ethereum Blockchain. You have to provide the bytecode - compiled to binary solidity code. At this point you can validate and compile your smart contract to bytecode at the Ethereum official website - Solidity IDE. When you finish the solidity code go to Compile -> Choose the name of the contract -> Details and from there go to the part BYTECODE and copy the object propery. It should only be a hexadecimal number, for example:
"object":"60806040523480156200001157600080fd5b50336000................"
A private key (associated with a funded Ethereum external account), fromAddress, byteCode, gasPrice and gasLimit, to publish, Crypto APIs will embed the contract into the blockchain and return the transaction hash that created the contract, for example
{
"privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
"fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
"gasPrice" : 21000000000,
"gasLimit" : 2100000,
"byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b5400000000000000000000000000000000000000000000000000000000815250600290805190602001906200009f92919062000128565b506040805190810160405280600d81526020017f6d616166616b6120546f6b656e0000000000000000000000000000000000000081525060039080519060200190620000ed92919062000128565b506012600460006101000a81548160ff021916908360ff16021790555062093a804201600781905550624099804201600881905550620001d7565b828054600181600116
....
ffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
}
The response will be date and hash of the transaction:
{
"payload": {
"hex": "0xf24889df3b88f8bfe2898a41ecab8ec62b60839a22eec606afe3dff9025b86f6"
}
It is very important to provide enough gas in order the transaction to be successful!
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
"fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
"gasPrice" : 21000000000,
"gasLimit" : 2100000,
"byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
}'
POST /v1/bc/eth/rinkeby/contracts HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
"fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
"gasPrice" : 21000000000,
"gasLimit" : 2100000,
"byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [https://api.cryptoapis.io],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"contracts"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ privateKey: '4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1',
fromAddress: '0xe7cc96ba0562dfba61a55c8dd2e162a30942f402',
gasPrice: 21000000000,
gasLimit: 2100000,
byteCode: '0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"privateKey" : "4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1",
"fromAddress" : "0xe7cc96ba0562dfba61a55c8dd2e162a30942f402",
"gasPrice" : 21000000000,
"gasLimit" : 2100000,
"byteCode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,rinkeby,contracts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/contracts"
payload := strings.NewReader("{\n\t\n\t\"privateKey\" : \"4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1\",\n\t\"fromAddress\" : \"0xe7cc96ba0562dfba61a55c8dd2e162a30942f402\",\n\t\"gasPrice\" : 21000000000,\n\t\"gasLimit\" : 2100000,\n\t\"byteCode\": \"0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff...ffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561170957600080fd5b8183039050929150505600a165627a7a72305820d5c331e320cecd2d4312d2652403d5e25028a60929540b4a8ededb52575622a40029\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"hex": "0xf24889df3b88f8bfe2898a41ecab8ec62b60839a22eec606afe3dff9025b86f6"
}
}
HTTP Request
POST /v1/bc/eth/${NETWORK}/contracts
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
Get Token Balance
In the request url you should provide the address you want to observe and the contract address that created the token. After sending the request you will receive a json object with the name of the token, the amount and its symbol.
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"token",
"0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014",
"balance"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,token,0x7857af2143cb06ddc1dab5d7844c9402e89717cb,0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014,balance", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/0x7857af2143cb06ddc1dab5d7844c9402e89717cb/0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014/balance"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"name": "Elly Token",
"token": "0.70429514041990424",
"symbol": "ELT"
}
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/tokens/{address}/{contract}/balance
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | address with tokens (e.g. "0x7857af2143cb06ddc1dab5d7844c9402e89717cb") |
CONTRACT | ------- | contract address (e.g. "0x40f9405587B284f737Ef5c4c2ecEA1Fa8bfAE014") |
Transfer Tokens
In order to transfer tokens from one address to another you should provide the from address, the private key or password (if it is an account stored on our servers), the to address, the contract address that created the tokens and the amount of tokens you would like to transfer. It is also necessary to provide gas price and gas limit. By default these are set to: 21000000000 wei and 100000 wei, accordingly. The amount of token is per unit, for example: if you want to send 120 tokens you should specify:
"token" : 120
;
and for 10.5 tokens:
"token" : 10.5
,
etc...;
There is one optional field: nonce. The nonce
represents the transactions count for the specified from address. If not specified the system will automatically calculate the correct nonce.
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"toAddress" : "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"contract" : "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
"password": "abc123456" or "privateKey" : "0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed",
"gasPrice" : 11500000000,
"gasLimit" : 60000,
"token" : 115,
"nonce": 179
}'
POST /v1/bc/eth/rinkeby/tokens/transfer HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"toAddress" : "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"contract" : "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
"password": "abc123456" or "privateKey" : "0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed",
"gasPrice" : 11500000000,
"gasLimit" : 60000,
"token" : 115
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"token",
"transfer"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ fromAddress: '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11',
toAddress: '0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8',
contract: '0xe7d553c3aab5943ec097d60535fd06f1b75db43e',
password: 'abc123456' or privateKey: '0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed',
gasPrice: 11500000000,
gasLimit: 60000,
token: 115 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"fromAddress" : "0x0cb1883c01377f45ee5d7448a32b5ac1709afc11",
"toAddress" : "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"contract" : "0xe7d553c3aab5943ec097d60535fd06f1b75db43e",
"password" : "abc123456" or "privateKey" : "0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed",
"gasPrice" : 11500000000,
"gasLimit" : 60000,
"token" : 115
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,rinkeby,token,transfer", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/transfer"
payload := strings.NewReader("{\n\t\"fromAddress\" : \"0x0cb1883c01377f45ee5d7448a32b5ac1709afc11\",\n\t\"toAddress\" : \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n\t\"contract\" : \"0xe7d553c3aab5943ec097d60535fd06f1b75db43e\",\n\t \"password\": \"abc123456\" or \n\t\"privateKey\" : \"0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed\",\n\t\"gasPrice\" : 11500000000,\n\t\"gasLimit\" : 60000,\n\t\"token\" : 115\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"hex": "0x47446068a25de467ca9ab07608df0dd81b68955e8734fb4b76b1a4ba5d7c6698",
"view_in_explorer": "https://blockexplorer.one/eth/rinkeby/tx/0x47446068a25de467ca9ab07608df0dd81b68955e8734fb4b76b1a4ba5d7c6698?utm_source=cryptoapis.io"
}
}
HTTP Request
POST /v1/bc/eth/${NETWORK}/tokens/transfer
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
Broadcast a Signed Transaction
Once you’ve finished signing the raw transaction locally, send that raw transaction to our Broadcast a Signed Transaction Endpoint.
HTTP Request
POST /v1/bc/eth/${NETWORK}/txs/push
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}'
POST /v1/bc/eth/ropsten/txs/push HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"txs",
"push"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ hex: '0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex" : "0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,txs,push", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/txs/push"
payload := strings.NewReader("{\n\t\"hex\" : \"0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
$hex is a hex-encoded raw representation of your transaction, for example:
{
"hex" : 0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69
}
If it succeeds, you’ll receive your transacation hash, for example:
{
"payload": {
"hex" : "0x61710049f64c5187611ebc827d7a9f2479cd7c78e8bf6d66232e8dc57328b09c"
}
}
Get Token Transactions By Address
In the request url you should provide the address you want to observe. The response will be a json object with a list of all token transactions for the specified address (in DESC order).
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"token",
"address",
"0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d",
"transfers"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,token,address,0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d,transfers", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/tokens/address/0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d/transfers"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"meta": {
"totalCount": 600,
"limit": 50,
"results": 50
},
"payload": [
{
"txHash": "0xf80c67cc3fb999fe399ba80d35b5da5d4b531d01f9156a02a8a18a98229c23d5",
"date": "2019-08-14 11:05:12 UTC", //deprecated
"datetime": "2019-08-14 11:05:12 UTC",
"timestamp": 1565823902,
"from": "0x59fc0ab4072aae70c38167881be24f9cafc8070d",
"to": "0x74be2a31763c2aa64590c47654cae1a2352d9cb9",
"value": "1000000000000000000",
"name": "The Force Token",
"symbol": "FOR",
"type": "ERC-20"
},
{
"txHash": "0xcd85d17c9144288eae62bf12751925fe14929c4f074d90f5889ae023cc484cd0",
"date": "2019-08-14 11:05:12 UTC", //deprecated
"datetime": "2019-08-14 11:05:12 UTC",
"timestamp": 1565823902,
"from": "0x59fc0ab4072aae70c38167881be24f9cafc8070d",
"to": "0x74cb6771ff18d6db0221b17541630eac8229a35f",
"value": "1000000000000000000",
"name": "The Force Token",
"symbol": "FOR",
"type": "ERC-20"
},
...
{
"txHash": "0xf6aeecd5a4cd4bb23578d9171d2365a64370c28820a5914218086bd30b93195b",
"date": "2019-08-14 10:59:37 UTC", //deprecated
"datetime": "2019-08-14 10:59:37 UTC",
"timestamp": 1565823577,
"from": "0x59fc0ab4072aae70c38167881be24f9cafc8070d",
"to": "0x747f9be4c13fe78af434766ee4521e85be168bd4",
"value": "1000000000000000000",
"name": "The Force Token",
"symbol": "FOR",
"type": "ERC-20"
}
]
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/tokens/address/{address}/transfers
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | address with tokens (e.g. "0x59fc0Ab4072aAe70c38167881BE24f9CAfC8070d") |
LIMIT | ------- | limit to n results |
TYPE | ------- | token types (e.g "ERC-20" or "ERC-721") |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
Get Token Transactions For Address By Range
In the request url you should provide the address you want to observe. The response will be a json object with a list of all token transactions for the specified address (in DESC order).
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"token",
"address",
"0xc065b539490f81b6c297c37b1925c3be2f190738",
"transferstransfers-by-range",
"1590492468",
"1592206193"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,token,address,0xc065b539490f81b6c297c37b1925c3be2f190738,transfers-by-range", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/address/0xc065b539490f81b6c297c37b1925c3be2f190738/transfers-by-range/1590492468/1592206193"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"meta": {
"totalCount": 203,
"index": 0,
"limit": 50,
"results": 6
},
"payload": [
{
"txHash": "0xa518c95b35498cbc59df1ad751c1c8bbc82b837aa19705629dfbdaf68c80c452",
"date": "2020-06-15 07:29:53 UTC",
"datetime": "2020-06-15 07:29:53 UTC",
"timestamp": 1592206193,
"from": "0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59",
"to": "0xc065b539490f81b6c297c37b1925c3be2f190738",
"value": "5",
"name": "StandardToken",
"symbol": "STD",
"type": "ERC-20"
},
...
{
"txHash": "0x51edda47837574891da33b554518a19730616845b5ab8e4f19af5a9cd6946f14",
"date": "2020-05-26 11:27:48 UTC",
"datetime": "2020-05-26 11:27:48 UTC",
"timestamp": 1590492468,
"from": "0xc065b539490f81b6c297c37b1925c3be2f190738",
"to": "0xb8ecc5446c2f35f419e4b97d37e7f5f42dde9dee",
"value": "10",
"name": "StandardToken",
"symbol": "STD",
"type": "ERC-20"
}
]
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/tokens/address/{address}/transfers/{$FROM_ADDRESS}/{$TO_ADDRESS}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | address with tokens (e.g. "0xc065b539490f81b6c297c37b1925c3be2f190738") |
FROM_TIMESTAMP | ------- | From timestamp of desired txs |
TO_TIMESTAMP | ------- | To timestamp of desired txs |
LIMIT | ------- | limit to n results |
TYPE | ------- | token types (e.g "ERC-20" or "ERC-721") |
FROM_TIMESTAMP
and TO_TIMESTAMP
must be provided to get transactions with date range.
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
Get Address Tokens
In the request url you should provide the address you want to observe. After sending the request you will receive a json object with a list of each transfer for the specified address that includes the following information: the contract, the name, symbol, balance and type of the token.
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59 \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"rinkeby",
"token",
"address",
"0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,rinkeby,token,address,0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/tokens/address/0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"meta": {
"totalCount": 3,
"limit": 50,
"results": 3
},
"payload": [
{
"contract": "0x7589fdcc0754a82959800a5250f6dd7f9ba240e1",
"symbol": "STD",
"name": "StandardToken",
"type": "ERC-20",
"balance": "0.000"
},
{
"contract": "0x20fe562d797a42dcb3399062ae9546cd06f63280",
"symbol": "LINK",
"name": "ChainLink Token",
"type": "ERC-20",
"balance": "92.100"
},
{
"contract": "0x092de782a7e1e0a92991ad829a0a33aef3c7545e",
"symbol": "FT",
"name": "FaucetToken",
"type": "ERC-20",
"balance": "45"
}
]
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/tokens/address/{address}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
ADDRESS | ------- | address with tokens (e.g. "0x1316bea88fb7cd4ccc4a57e2f9f4f43d1a86ee59") |
LIMIT | ------- | limit to n results |
TYPE | ------- | token types (e.g "ERC-20" or "ERC-721") |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
Get Contracts GasPrice
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/mainnet/contracts/gas-price \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/mainnet/contracts/gas-price HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/mainnet/contracts/gas-price",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"mainnet",
"contracts",
"gas-price"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/mainnet/contracts/gas-price');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/mainnet/contracts/gas-price")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,mainnet,contracts,gas-price", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/mainnet/contracts/gas-price")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/mainnet/contracts/gas-price"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"slow": "88.9",
"standard": "98",
"fast": "120",
"unit": "Gwei"
}
}
Info
Contract Gas Price Endpoint gives information about the gas price for the latest successful contract transactions. slow
shows the lowest gas price, fast
is the highest and standard
- the median gas price. All gas prices are in Gwei.
HTTP Request
GET /v1/bc/eth/${NETWORK}/mainnet/contracts/gas-price
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
Estimate Token Transaction GasLimit
Crypto APIs provides an endpoint for estimating the gas limit needed for a successful transaction.
You have to provide the following data: - from address (fromAddress) | string; - to address (toAddress) | string; - contract address (contract) | string; - token amount of the transaction (tokenAmount) | number;
HTTP Request
POST /v1/bc/eth/${NETWORK}/tokens/transfer/gas-limit
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/transfer/gas-limit \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"fromAddress" : "0xc065b539490f81b6c297c37b1925c3be2f190738",
"toAddress" : "0x6f2d8d4062dd05da2f4fb6b09a3869401d5a08a6",
"contract" : "0x092de782a7e1e0a92991ad829a0a33aef3c7545e",
"tokenAmount" : 10
}'
POST /v1/bc/eth/ropsten/tokens/transfer/gas-limit HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"fromAddress" : "0xc065b539490f81b6c297c37b1925c3be2f190738",
"toAddress" : "0x6f2d8d4062dd05da2f4fb6b09a3869401d5a08a6",
"contract" : "0x092de782a7e1e0a92991ad829a0a33aef3c7545e",
"tokenAmount" : 10
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/transfer/gas-limit",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"fromAddress\" : \"0xc065b539490f81b6c297c37b1925c3be2f190738\",\n \"toAddress\" : \"0x6f2d8d4062dd05da2f4fb6b09a3869401d5a08a6\",\n \"contract\" : \"0x092de782a7e1e0a92991ad829a0a33aef3c7545e\",\n \"tokenAmount\" : 10 \"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"tokens",
"transfer",
"gas-limit"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify(
{
"fromAddress" : "0x0c739ef237b1f27959c78624b869fafedc6a409a",
"toAddress" : "0xdbe2d997cefb5f4af2a90d5be86c65d494e00ce4",
"contract" : "0x2C5ca0F5F1f0ac5CC7c3c69B8eBa08a4fd5523c7",
"tokenAmount" : 5
}
));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/transfer/gas-limit');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('
{
"fromAddress" : "0x0c739ef237b1f27959c78624b869fafedc6a409a",
"toAddress" : "0xdbe2d997cefb5f4af2a90d5be86c65d494e00ce4",
"contract" : "0x2C5ca0F5F1f0ac5CC7c3c69B8eBa08a4fd5523c7",
"tokenAmount" : 5
}
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/transfer/gas-limit")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"fromAddress\" : \"0x0c739ef237b1f27959c78624b869fafedc6a409a\",\n \"toAddress\" : \"0xdbe2d997cefb5f4af2a90d5be86c65d494e00ce4\",\n \"tokenAmount\" : 5,\n \"contract\" : \"0x2C5ca0F5F1f0ac5CC7c3c69B8eBa08a4fd5523c7\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"fromAddress\" : \"0x0c739ef237b1f27959c78624b869fafedc6a409a\",\n \"toAddress\" : \"0xdbe2d997cefb5f4af2a90d5be86c65d494e00ce4\",\n \"tokenAmount\" : 5,\n \"contract\" : \"0x2C5ca0F5F1f0ac5CC7c3c69B8eBa08a4fd5523c7\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,ropsten,tokens,transfer,gas-limit", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"fromAddress\" : \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"toAddress\" : \"0xc595B20EEC3d35E8f993d79262669F3ADb6328f7\",\n \"value\" : 0.12,\n \"data\" : \"24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/transfer/gas-limit")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/tokens/transfer/gas-limit"
payload := strings.NewReader("{\n \"fromAddress\" : \"0x0c739ef237b1f27959c78624b869fafedc6a409a\",\n \"toAddress\" : \"0xdbe2d997cefb5f4af2a90d5be86c65d494e00ce4\",\n \"tokenAmount\" : 5,\n \"contract\" : \"0x2C5ca0F5F1f0ac5CC7c3c69B8eBa08a4fd5523c7\"\n}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"gasLimit": "43144"
}
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
If it succeeds, you’ll receive a response with the estimated gas limit, as follows:
{
"payload": {
"gasLimit": "43144"
}
}
Payment Forwarding
Payment Forwarding is an automatic way to move any received funds to another wallet, it's mainly used to move funds once received to cold wallets. Moving funds from hot wallets to cold wallets is a common practice in the market, it's used by all exchanges and wallets. You can subscribe for payment forwarding for any wallet/address you own, in the subscription you mention where to move the funds and how to notify you once done. Crypto APIs will monitor the wallet/address you have subscription for and once any funds are received, Crypto APIs will move them to the target wallet/address then notify you by sending a call to the URL you have specified. commerce without necessarily requiring extensive setup barriers, like registering new accounts. In that spirit, our Payment Forwarding API is the easiest way to accept—and consolidate—payments securely without forcing your users to create accounts and jump through unnecessary loops. It’s also a generic way to automatically transfer value from one address to another. While there are many possible use cases, the two we hear most about are: One of the well-known benefits of cryptocurrency is the ability to allow users to partake in online commerce without necessarily requiring extensive setup barriers, like registering new accounts. In that spirit, our Payment Forwarding API is the easiest way to accept—and consolidate—payments securely without forcing your users to create accounts and jump through unnecessary loops. It’s also a generic way to automatically transfer value from one address to another. While there are many possible use cases, the two we hear most about are: A way to generate payment-specific addresses for which funds will automatically transfer to a main merchant address. Great for automatic merchandise (whether physical or virtual) processing. A method to easily fund a multisignature address from any wallet by providing a classic address that will automatically transfer to the multisignature/pay-to-script-hash address. We do not take a fee on payment forwarding, other than the required 21,000 units of wei for gas fee; payments are free. However, as part of your own services, you can include a fee (either fixed or a percentage) that will also be automatically transfered to your own address in the same transaction. Fee-based business models are thus easily achieved, and moreover, easily auditable via the blockchain.
Create Payment Forwarding Automation
Sample Data
curl -X POST https://api.cryptoapis.io/v1/bc/eth/rinkeby/payments \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"callback": "http://example.com/paymet_forwarding_hook",
"from": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"to": "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"privateKey" : "1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e",
"confirmations": 2,
"gasPrice" : 5000000000,
"gasLimit" : 21000
}'
POST /v1/bc/eth/rinkeby/payments HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"callback": "http://example.com/paymet_forwarding_hook",
"from": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"to": "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"privateKey" : "1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e",
"confirmations": 2,
"gasPrice" : 5000000000,
"gasLimit" : 21000
}
var settings = {
"async": true,
"crossDomain": true,
"url": "http://localhost:9146/v1/eth/rinkeby/payments",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"cache-control": "no-cache",
"Postman-Token": "f2553799-4ae0-4a1e-841d-ad6f599ab402"
},
"processData": false,
"data": "{\n \"callback\": \"http://example.com/paymet_forwarding_hook\",\n \"from\": \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"to\": \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n \"privateKey\" : \"1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e\",\n \"confirmations\": 2,\n \"gasPrice\" : 5000000000,\n \"gasLimit\" : 21000\n}\n"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": [
"localhost"
],
"port": "9146",
"path": [
"v1",
"eth",
"rinkeby",
"payments"
],
"headers": {
"Content-Type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ callback: 'http://example.com/paymet_forwarding_hook',
from: '0x7857af2143cb06ddc1dab5d7844c9402e89717cb',
to: '0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8',
privateKey: '1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e',
confirmations: 2,
gasPrice: 5000000000,
gasLimit: 21000 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/rinkeby/payments');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"callback": "http://example.com/paymet_forwarding_hook",
"from": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"to": "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"privateKey" : "1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e",
"confirmations": 2,
"gasPrice" : 5000000000,
"gasLimit" : 21000
}
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/rinkeby/payments")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"callback\": \"http://example.com/paymet_forwarding_hook\",\n \"from\": \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"to\": \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n \"privateKey\" : \"1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e\",\n \"confirmations\": 2,\n \"gasPrice\" : 5000000000,\n \"gasLimit\" : 21000\n}\n"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"callback\": \"http://example.com/paymet_forwarding_hook\",\n \"from\": \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"to\": \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n \"privateKey\" : \"1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e\",\n \"confirmations\": 2,\n \"gasPrice\" : 5000000000,\n \"gasLimit\" : 21000\n}\n"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "v1,bc,eth,rinkeby,payments", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"callback\": \"http://example.com/paymet_forwarding_hook\",\n \"from\": \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"to\": \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n \"privateKey\" : \"1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e\",\n \"confirmations\": 2,\n \"gasPrice\" : 5000000000,\n \"gasLimit\" : 21000\n}\n");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/rinkeby/payments")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/rinkeby/payments"
payload := strings.NewReader("{\n \"callback\": \"http://example.com/paymet_forwarding_hook\",\n \"from\": \"0x7857af2143cb06ddc1dab5d7844c9402e89717cb\",\n \"to\": \"0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8\",\n \"privateKey\" : \"1ddb065abd61315dc8f7632ad4b1a2e136b2fa3b7ab27105e98b7739093a8f2e\",\n \"confirmations\": 2,\n \"gasPrice\" : 5000000000,\n \"gasLimit\" : 21000\n}\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"uuid": "7f0c4666-af1f-44a3-b5f5-1a3c2b904283",
"from": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"to": "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"confirmations": 2,
"callback": "http://example.com/paymet_forwarding_hook",
"gasPrice": "5000000000",
"gasLimit": "21000"
}
}
There are two ways to create an automated payment forwarding:
If you have a keystore file/account create on our servers you need to provide the following information: - from address - to address, - callback, - password, - confirmations - after how many confirmations to execute the payment forwarding - gasPrice (Optional) - gasLimit (Optional)
Otherwise, in order to create an automated payment forwarding for an address that is not stored on our servers you should proved the following information: - from address, - to address, - callback, - private key - confirmations - after how many confirmations to execute the payment forwarding - gasPrice (Optional) - gasLimit (Optional)
If gasPrice or gasLimit is not specified, the total gas fee will automatically be taken from the transaction that triggered the payment forwarding.
When the from address
receives ethers from a transaction the same amount (the gas fee of 21000 units of wei will be substracted) will be forwarded to the to address automatically. If you want to change the to address
you have first to delete this payment forwarding and then add the new one for the same address. For more information how to delete payment forwaring automation view next section: Delete Payment Forwarding.
The callback is the url to which a message will be sent after processing a payment forwarding.
Confirmations can be any number between 1 and 20. Set to 1 means that webhooks will be sent immediately after the block that includes transactions with the specified address is mined. However, since there is the possibility of blockchain block re-write, we suggest that users set the confirmations at least to 6.
HTTP Request
POST /v1/bc/eth/${NETWORK}/payments
Payment Forwarding Response
After executing the forwarding payment a message will be sent to the specified callback(url), similar to the following:
{
"currency": "ETH",
"network": "rinkeby",
"type": "PAYMENT_FORWARDING",
"uuid": "238c883e-f560-4297-949d-b3f45f01dbee",
"txHash": "0xc8019576c5b8140476d28217db711bb9bc642216071b7186d7abd7a97954cfcb",
"url" : "http://example.com/paymet_forwarding_hook",
"status": "DONE",
"message": "Payment forwarding was successful!"
}
There are total of four payment statuses: DONE, FAILED, PENDING and OUT_OF_BALANCE.
For some reasons the payment forwarding may fail.
{
"payload": {
"currency": "ETH",
"network": "rinkeby",
"uuid": "238c883e-f560-4297-949d-b3f45f01dbee",
"type": "PAYMENT_FORWARDING",
"url" : "http://example.com/paymet_forwarding_hook",
"status": "FAILED",
}
}
If status is
FAILED
it means that this forwarding will be executed when the next block is mined.Payments might be pending:
{
"payload": {
"currency": "ETH",
"network": "rinkeby",
"uuid": "238c883e-f560-4297-949d-b3f45f01dbee",
"type": "PAYMENT_FORWARDING",
"url" : "http://example.com/paymet_forwarding_hook",
"status": "PENDING",
}
}
When next block is mined an attempt for executing this payment will be made.
If the value from the transaction that triggers the payment forwarding is spent before the execution of the payment is done, a message will be sent to the specified url:
{
"currency": "ETH",
"network": "rinkeby",
"uuid": "238c883e-f560-4297-949d-b3f45f01dbee",
"type": "PAYMENT_FORWARDING",
"url" : "http://example.com/paymet_forwarding_hook",
"status": "OUT_OF_BALANCE",
"message": "Payment forwarding was not successful! Reason: Balance is not enough!"
}
When status is set to OUT_OF_BALANCE other attempts for executing the payment will not be made.
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
Delete Payment Forwarding Automation
Sample Data
curl -X DELETE https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
DELETE /v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba",
"method": "DELETE",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "DELETE",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"payments",
"d2f41deb-3e13-4e19-b197-c2481f9d9eba"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("DELETE", "v1,bc,eth,ropsten,payments,d2f41deb-3e13-4e19-b197-c2481f9d9eba", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba")
.delete(null)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/d2f41deb-3e13-4e19-b197-c2481f9d9eba"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": {
"message": "Payment forwarding with uuid: d2f41deb-3e13-4e19-b197-c2481f9d9eba was successfully deleted!"
}
}
If you want to delete a payment forwarding just specify the uuid
of the payment in the url request.
HTTP Request
DELETE /v1/bc/eth/${NETWORK}/payments/${UUID}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. ropsten, rinkeby or mainnet) |
UUID | ------- | the uuid of the payment |
Get List Of My Payments Forwardings
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/payments \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/payments HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/payments",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"payments"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/payments');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/payments")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,payments", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/payments")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/payments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": [
{
"from": "0x7857af2143cb06ddc1dab5d7844c9402e89717cb",
"to": "0x4ab47e7b0204d6b3bf0e956db14e63142b9b5ab8",
"uuid": "7f0c4666-af1f-44a3-b5f5-1a3c2b904283",
"callback": "http://example.com/paymet_forwarding_hook",
"confirmations": 2,
"gasPrice": "5000000000",
"gasLimit": "21000"
}
],
"meta": {
"totalCount": 1,
"results": 1
}
}
HTTP Request
GET /v1/bc/eth/${NETWORK}/payments
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | - | Network name (e.g. ropsten, rinkeby or mainnet) |
If the request is successful, you’ll receive a JSON (see the response body) and an HTTP Status Code 200.
Get My Historical Payment Forwarding Automations
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/history \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/eth/ropsten/payments/history HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/history",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"path": [
"v1",
"bc",
"eth",
"ropsten",
"payments",
"history"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/history');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/history")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,eth,ropsten,payments,history", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/history")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/eth/ropsten/payments/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response body
{
"payload": [
{
"uuid": "d597c387-1c1a-46e4-a7e3-a25bff67c1e0",
"payment_uuid": "045f66c9-172b-479f-9e6f-54e5fe83facf",
"status": "DONE",
"block_height": 4137376,
"transaction": "0xfe7f1d262ef8fa1510c220a6d2841a4713b8c2938967eefb503f88f33ab62dc4"
},
{
"uuid": "350c88d3-ed77-406a-aaae-557f9a63418a",
"payment_uuid": "045f66c9-172b-479f-9e6f-54e5fe83facf",
"status": "DONE",
"block_height": 4137496,
"transaction": "0x743b4bf1a42857f98cf5d3ede7820358f7582118116ddf486478a86708b86fb6"
},
{
"uuid": "4970a327-ef9f-402f-9074-a653a53437bd",
"payment_uuid": "045f66c9-172b-479f-9e6f-54e5fe83facf",
"status": "DONE",
"block_height": 4137497,
"transaction": "0x8078c99ff7e793752a8941cbfcbee3b8bc7b6c974bf9a40767d4d9c0906bae81"
}
],
"meta": {
"totalCount": 3,
"results": 3
}
}