Create Ethereum Client
use BlockSDK;
$blockSDK = new BlockSDK("YOU_TOKEN");
$ethClient = $blockSDK->createEthereum();
or
$ethClient = BlockSDK::createEthereum("YOU_TOKEN");
Object
Tx
GetBlockChain
GET
https://api.blocksdk.com/v1/eth/block
{
"height" : 9098547,
"bestblockhash" => "0x235145654e2034d0852a9e8cd9bc6e3eea8a7179aec0723cd12db7d18e5f06b4",
"prev_hash" => "0xb4cbec945d9dcf8a870d4ae5b156758f6b7824ed6da9a69130431cad7200a92e",
"unconfirmed_count" : 1234,
"low_gwei" : 1,
"medium_gwei" : 2,
"high_gwei" : 3
}
Response
$blockChain = $ethClient->getBlockChain();
GetBlock
GET
https://api.blocksdk.com/v1/eth/block/{block}
Path Parameters
Query Parameters
Request Body
{
"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
$block = $ethClient->getBlock([
"block" => 8913145,
"offset" => 0,
"limit" => 10,
"rawtx" => true
]);
GetMemPool
GET
https://api.blocksdk.com/v1/eth/mempool
Query Parameters
{
"unconfirmed_count" : 10,
"tx" : {...}
}
$pool = $ethClient->getMemPool([
"rawtx" => true,
"offset" => 0,
"limit" => 10
]);
ListAddress
GET
https://api.blocksdk.com/v1/eth/address
Query Parameters
{
"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
$listAddress = $ethClient->listAddress([
"offset" => 0,
"limit" => 10
]);
CraeteAddress
POST
https://api.blocksdk.com/v1/eth/address
Request Body
{
"id" : 1,
"address" : "0x1234567890",
"private_key" : "abcdefg"
}
Response
$address = $ethClient->createAddress([
"name" => "test address"
]);
GetAddressInfo
GET
https://api.blocksdk.com/v1/eth/address/{address}
Path Parameters
Query Parameters
{
"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
$addressInfo = $ethClient->getAddressInfo([
"reverse" => true,
"rawtx" => false,
"offset" => 0,
"limit" => 10
]);
GetAddressBalance
GET
https://api.blocksdk.com/v1/eth/address/{address}/balance
Path Parameters
{
"address" : "0x12345678",
"balance" : 0,
"unconfirmed_balance" : 0
}
Response
$addressBalance = $ethClient->getAddressBalance([
"address" => "0x12345678"
]);
SendToAddress
POST
https://api.blocksdk.com/v1/eth/address/{from}/sendtoaddress
Path Parameters
Request Body
{
"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
$tx = $ethClient->sendToAddress([
"from" => "0x12345678",
"to" => "0x12345678",
"amount" => 0.1,
"private_key" => "abcdefg",
"gwei" => 5
]);
SendTransaction
POST
https://api.blocksdk.com/v1/eth/transaction
Request Body
{
"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
$tx = $ethClient->sendTransaction([
"sign_hex" => "0x1234567890abcdefg"
])
GetTransaction
GET
https://api.blocksdk.com/v1/eth/transaction/{hash}
Path Parameters
{
"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
$tx = $ethClient->getTransaction([
"hash" => "0x123456789"
])
LoadAddress
POST
https://api.blocksdk.com/v1/eth/address/{address}/load
Load your address.
The loaded address does not require private_key when using SendToAddress
Path Parameters
Request Body
$load = $ethClient->loadAddress([
"address" => "0x1b2d1d126af619a0fa5211bd2db79d83a29c4991",
"private_key" => "abcdefg",
"password" => "abcdefg"
]);
UnloadAddress
POST
https://api.blocksdk.com/v1/eth/address/{address}/unload
Path Parameters
$unload = $ethClient->unloadAddress([
"address" => "0x1b2d1d126af619a0fa5211bd2db79d83a29c4991"
]);