Ethereum

Create Ethereum Client

PHP
PHP
use BlockSDK;
$blockSDK = new BlockSDK("YOU_TOKEN");
$ethClient = $blockSDK->createEthereum();
or
$ethClient = BlockSDK::createEthereum("YOU_TOKEN");

Object

Tx

Name

Type

Content

hash

string

hash of the transaction.

from

string

address of the sender.

to

string

address of the receiver.

contract_address

string

If it is a contract, the contract address is displayed.

value

double

value transferred in Wei.

erc20_value

double

In case of erc20 token transaction, the transaction amount is displayed.

gas_used

int

The exact units of gas that was used for the transaction.

gas_limit

int

Maximum amount of gas provided for the transaction.

gas_price

double

gas price provided by the sender in Wei.

fee_total

double

Transaction fee

nonce

int

the number of transactions made by the sender prior to this one.

transaction_index

int

integer of the transaction's index position in the block

input

string

the data send along with the transaction.

block_hash

string

block hash where this transaction was in.

block_height

int

block number where this transaction was in.

confirmations

int

Transaction Confirmation Count

time

int

The time contained in the block

status

string

The status of the transaction.

get
GetBlockChain

https://api.blocksdk.com/v1/eth/block
Request
Response
Request
Response
200: OK
{
"height" : 9098547,
"bestblockhash" => "0x235145654e2034d0852a9e8cd9bc6e3eea8a7179aec0723cd12db7d18e5f06b4",
"prev_hash" => "0xb4cbec945d9dcf8a870d4ae5b156758f6b7824ed6da9a69130431cad7200a92e",
"unconfirmed_count" : 1234,
"low_gwei" : 1,
"medium_gwei" : 2,
"high_gwei" : 3
}

Response

Nmae

Type

Content

height

int

number of most recent block.

bestblockhash

string

hash of most recent block.

prev_hash

string

Previous block hash of the most recent block

unconfirmed_count

int

Unconfirmed Transaction Count

low_gwei

char

Low Priority (7+ blocks)

medium_gwei

char

Medium Priority (3-6 blocks)

high_gwei

char

High Priority (1-2 blocks)

PHP
PHP
$blockChain = $ethClient->getBlockChain();

get
GetBlock

https://api.blocksdk.com/v1/eth/block/{block}
Request
Response
Request
Path Parameters
block
required
string
Block number or hash
Query Parameters
rawtx
optional
boolean
Get transaction details
limit
optional
number
Number of transactions to import
offset
optional
number
Transaction List Offset
Body Parameters
optional
string
Response
200: OK
{
"hash" : "0x46b8c1571d9b8511c85f185c6e3fef04431c4b891a294c1a0dfc5056dc5604eb",
"height" : 900000,
"extra_data" : "0xd783010303844765746887676f312e342e32856c696e7578",
"gas_limit" : 3141592,
"gas_used" : 0,
"miner" : "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5",
"tx" : [],
"tx_count" : 0,
"total_value" : 0,
"fee_total" : 0,
"reward" : 5,
"size" : 541,
"nonce" : "0xe387a98b08a28430",
"confirmations" : 0,
"time" : 0,
"sha3_uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"prev_hash" : "0x9b8df528faae645e0b5b2cf6d6aa65f2e45a74fc61f4768a52c051a3d3436f85",
"next_hash" : "0x93163b2501158b2161fac65799da8e68ce656fcd1f528db4ceaed5ba91866f9a"
}

Response

Name

Type

Content

hash

string

hash of the block

height

int

the block number

extra_data

string

the "extra data" field of this block

gas_limit

int

the maximum gas allowed in this block

gas_used

int

the total used gas by all transactions in this block

miner

string

the address of the beneficiary to whom the mining rewards were given.

tx

array

Transaction contained in the block

tx_count

int

The number of transactions contained in the block

total_value

double

Total transaction amount included in the block

fee_total

double

Total transaction fee

reward

int

Block Mining Reward

size

int

integer the size of this block in bytes.

nonce

int

hash of the generated proof-of-work.

confirmations

int

Block Confirmation Count

time

int

The date and time at which a block is mined.

prev_hash

string

Previous block hash

next_hash

string

Next block hash

PHP
PHP
$block = $ethClient->getBlock([
"block" => 8913145,
"offset" => 0,
"limit" => 10,
"rawtx" => true
]);

get
GetMemPool

https://api.blocksdk.com/v1/eth/mempool
Request
Response
Request
Query Parameters
rawtx
optional
boolean
Get transaction details
offset
optional
number
Transaction List Offset
limit
optional
number
Number of transactions to import
Response
200: OK
{
"unconfirmed_count" : 10,
"tx" : {...}
}
PHP
PHP
$pool = $ethClient->getMemPool([
"rawtx" => true,
"offset" => 0,
"limit" => 10
]);

get
ListAddress

https://api.blocksdk.com/v1/eth/address
Request
Response
Request
Headers
x-api-key
required
string
API authentication key
Query Parameters
limit
optional
string
Number of Address to import
offset
optional
string
Address List offset
Response
200: OK
{
"items" : [
{
"id" : 1,
"name" : "test address1",
"created_at" : "2019-03-01 01:23:11"
},
{
"id" : 2,
"name" : "test address2",
"created_at" : "2019-03-01 01:23:11"
}
]
}

Response

Name

type

Content

array

List of created addresses

PHP
PHP
$listAddress = $ethClient->listAddress([
"offset" => 0,
"limit" => 10
]);

post
CraeteAddress

https://api.blocksdk.com/v1/eth/address
Request
Response
Request
Headers
x-api-key
required
string
API authentication key
Body Parameters
name
optional
string
Address name
Response
200: OK
Private keys are not stored in BlockSDK.
{
"id" : 1,
"address" : "0x1234567890",
"private_key" : "abcdefg"
}

Response

Name

Type

Content

id

int

Generated unique id

address

string

Generated address

private_key

string

Private key of generated address(BlockSDK is not stored on the server)

PHP
PHP
$address = $ethClient->createAddress([
"name" => "test address"
]);

get
GetAddressInfo

https://api.blocksdk.com/v1/eth/address/{address}
Request
Response
Request
Path Parameters
address
required
string
Ethereum Address
Query Parameters
reverse
optional
boolean
Reverse transaction information
rawtx
optional
boolean
Get transaction details
offset
optional
number
Transaction List Offset
limit
optional
number
Number of Transaction to import
Response
200: OK
{
"address" : "0x12345678",
"nonce" : 0,
"tx" : [],
"tx_count" : 0,
"received_count" : 0,
"received_total" : 0,
"received_unconfirmed" : 0,
"spent_count" : 0,
"spent_total" : 0,
"spent_unconfirmed" : 0,
"balance" : 0,
"unconfirmed_balance" : 0,
"unconfirmed_count" : 0,
"first_time" : 0,
"last_time" : 0
}

Response

Name

Type

Content

address

string

Ethereum Address

nonce

int

number of transactions sent from an address.

tx

array

Transaction originated from address

tx_count

int

The number of transactions that occurred at the address

received_count

int

The number of transactions received from the address

received_total

double

Transaction amount received from the address

received_unconfirmed

double

Transaction amount not included in the block received from the address

spent_count

int

The number of transactions spent from the address

spent_total

double

Transaction amount spent from the address

spent_unconfirmed

double

Transaction amount not included in the block spent from the address

balance

double

Remaining balance

unconfirmed_balance

double

Transaction balance not included in block at address

unconfirmed_count

int

Transaction count not included in address block

first_time

int

First Deal Creation Time at Address

last_time

int

Last transaction creation time from address

PHP
PHP
$addressInfo = $ethClient->getAddressInfo([
"reverse" => true,
"rawtx" => false,
"offset" => 0,
"limit" => 10
]);

get
GetAddressBalance

https://api.blocksdk.com/v1/eth/address/{address}/balance
Request
Response
Request
Path Parameters
address
required
string
Ethereum Address
Response
200: OK
{
"address" : "0x12345678",
"balance" : 0,
"unconfirmed_balance" : 0
}

Response

Name

Type

Content

address

string

Ethereum Address

balance

double

Balance of the address

unconfirmed_balance

double

Balance of transactions not included in the block of addresses

PHP
PHP
$addressBalance = $ethClient->getAddressBalance([
"address" => "0x12345678"
]);

post
SendToAddress

https://api.blocksdk.com/v1/eth/address/{from}/sendtoaddress
Request
Response
Request
Path Parameters
from
required
string
Ethereum Address
Headers
x-api-key
required
string
API authentication key
Body Parameters
password
optional
string
If it is a loaded Ethereum address, this value is required and you can enter the password used to load it.
gas_limit
optional
number
Maximum amount of gas provided for the transaction(default 90000)
to
required
string
Ethereum Address
amount
required
string
Amount of Ethereum to send
private_key
optional
string
Ethereum address that has not been loaded requires this value and is issued when generating the Ethereum address.
gwei
optional
string
fee to be used for transactions
Response
200: OK
{
"hash" : "0x123456",
"from" : "0x123456",
"to" : "0x123456",
"value" : 0,
"gas_used" : 0,
"gas_limit" : 0,
"gas_price" : 0,
"fee_total" : 0,
"nonce" : 0,
"transaction_index" : 0,
"input" : "0x",
"block_hash" : "0x123456",
"block_height" : 0,
"confirmations" : 0,
"time" : 0,
"status" : "success"
}

Response

Return Tx on Success

PHP
PHP
$tx = $ethClient->sendToAddress([
"from" => "0x12345678",
"to" => "0x12345678",
"amount" => 0.1,
"private_key" => "abcdefg",
"gwei" => 5
]);

post
SendTransaction

https://api.blocksdk.com/v1/eth/transaction
Request
Response
Request
Headers
x-api-key
required
string
API authentication key
Body Parameters
sign_hex
required
string
signed transaction hex
Response
201: Created
{
"hash" : "0x123456",
"from" : "0x123456",
"to" : "0x123456",
"value" : 0,
"gas_used" : 0,
"gas_limit" : 0,
"gas_price" : 0,
"fee_total" : 0,
"nonce" : 0,
"transaction_index" : 0,
"input" : "0x",
"block_hash" : "0x123456",
"block_height" : 0,
"confirmations" : 0,
"time" : 0,
"status" : "success"
}

Response

Return Tx on Success

PHP
PHP
$tx = $ethClient->sendTransaction([
"sign_hex" => "0x1234567890abcdefg"
])

get
GetTransaction

https://api.blocksdk.com/v1/eth/transaction/{hash}
Request
Response
Request
Path Parameters
hash
required
string
transaction hash
Response
200: OK
{
"hash" : "0x123456",
"from" : "0x123456",
"to" : "0x123456",
"value" : 0,
"gas_used" : 0,
"gas_limit" : 0,
"gas_price" : 0,
"fee_total" : 0,
"nonce" : 0,
"transaction_index" : 0,
"input" : "0x",
"block_hash" : "0x123456",
"block_height" : 0,
"confirmations" : 0,
"time" : 0,
"status" : "success"
}

Response

Return Tx on Success

PHP
PHP
$tx = $ethClient->getTransaction([
"hash" => "0x123456789"
])

post
LoadAddress

https://api.blocksdk.com/v1/eth/address/{address}/load
Load your address. The loaded address does not require private_key when using SendToAddress
Request
Response
Request
Path Parameters
address
required
number
Ethereum Address
Headers
x-api-key
required
string
API authentication key
Body Parameters
password
required
string
Used when trading
private_key
required
string
Address private key
Response
201: Created
[]
PHP
PHP
$load = $ethClient->loadAddress([
"address" => "0x1b2d1d126af619a0fa5211bd2db79d83a29c4991",
"private_key" => "abcdefg",
"password" => "abcdefg"
]);

post
UnloadAddress

https://api.blocksdk.com/v1/eth/address/{address}/unload
Request
Response
Request
Path Parameters
address
required
number
Ethereum Address
Headers
x-api-key
required
string
API authentication key
Response
201: Created
[]
PHP
PHP
$unload = $ethClient->unloadAddress([
"address" => "0x1b2d1d126af619a0fa5211bd2db79d83a29c4991"
]);