{
"previousBlockHash": "c0574d7a7b8497373dbead497c2dc7f60fdcfc8c5a9fcb48f7d373acc9bbb099",
"payloadLength": 1189,
"totalAmountNQT": "100000000",
"generationSignature": "c5098d37267bc71134fc8572a87b4af8727a2e5139d60fe8833fab98af22244a",
"generator": "11693867635361772359",
"generatorPublicKey": "fbb72a280228af5c8c74c7c754a290e1539f839553c00bc560cac7bfdb324a7c",
"baseTarget": "1530224444",
"payloadHash": "633992be640a593ba04e31ca4028deed70bbf47cff333e2a0372a4e2a4aba205",
"generatorRS": "bened-walet",
"nextBlock": "5937170741469897491",
"requestProcessingTime": 175,
"numberOfTransactions": 6,
"blockSignature": "ff65a82e385c135cf9bd5be0861e9e5d3d3174fbd993e5b7f57935ec4...",
"transactions": [
"15184285173972564233",
"15200280108574630445",
"15200507403046301754",
"15900338016714606285",
"17881859777840687131",
"18361738217269620028"
],
"version": 3,
"totalFeeNQT": "600000000",
"previousBlock": "4005816059437078464",
"cumulativeDifficulty": "10229109959119715",
"block": "8455642159445842600",
"height": 275730,
"timestamp": 29797208
}
{
"block": "2680262203532249785",
"requestProcessingTime": 1
}
{
"blocks": [
{
"previousBlockHash": "f88c75a36317e1795348330cb9a944f33153b517ebdf05d9f3f9a606e997618d",
"payloadLength": 981,
"totalAmountNQT": "0",
"generationSignature": "02f7462b62270c0028c379d838d3a192cf0b782995f3bb1929a5378d26e7e8a9",
"generator": "2218289317977832095",
"generatorPublicKey": "98ccf5d5173b13e4c9eab2631372f61ce8ba506db559d73b285073a689872e75",
"baseTarget": "151761236",
"payloadHash": "82f8c8ca1f8f2252172ed1e9836d5228432fcb18aecfa7d55a119efcd242321c",
"generatorRS": "bened-walet",
"numberOfTransactions": 5,
"blockSignature": "76a3f7f966256c4985262fb4622190b2b9a19b900f6ce443ab7d581e3176c...",
"transactions": [
"10545999940082849455",
"16751328983055099280",
"1257496316971695605",
"2048859884870801838",
"5105170273384355243"
],
"version": 3,
"totalFeeNQT": "500000000",
"previousBlock": "8782326465060769016",
"block": "7299310714263322546",
"height": 281683,
"timestamp": 30416681
},
{
"previousBlockHash": "edc2d65d24883b9b32c46da4eec3792a69a5ff9a9b1e629c4e7e0224432c87c9",
"payloadLength": 0,
"totalAmountNQT": "0",
"generationSignature": "8c4944c7a9ef5700d1b89660fdf83bcbd3dbbfbe191fef005d0f248a573816fe",
"generator": "15766845356521829337",
"generatorPublicKey": "11636697faf4ade736cedf6c528bec0142353c4d93fce05cdb818c49e0390422",
"baseTarget": "303522472",
"payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"generatorRS": "bened-walet",
"nextBlock": "7299310714263322546",
"numberOfTransactions": 0,
"blockSignature": "90464d183ed01cb0930ef527e746eaa092d1558697c369cc9246add5f6eec...",
"transactions": [],
"version": 3,
"totalFeeNQT": "0",
"previousBlock": "11185683789279314669",
"block": "8782326465060769016",
"height": 281682,
"timestamp": 30416671
}
],
"requestProcessingTime": 2
}
{
"senderPublicKey": "57fb6f3a958e320bb49c4e81b4c2cf28b9f25d086c143b473beec228f79ff93c",
"signature": "5f0378b7390ff5a815eadd1354de533eef682f139362b153576e2207320a6...",
"feeNQT": "100000000",
"transactionIndex": 2,
"requestProcessingTime": 2842,
"type": 0,
"confirmations": 849,
"fullHash": "3a304584f20cf3d2cbbdd9698ff9a166427005ab98fbe9ca4ad6253651ee81f1",
"version": 1,
"ecBlockId": "17321329645912574173",
"signatureHash": "b35eae7d2f01639810d37694138aa0a86fbbf8a9bf58c2be4f2a5b8f0f30b3f7",
"senderRS": "bened-walet",
"subtype": 0,
"amountNQT": "100000000",
"sender": "15323192282528158131",
"recipientRS": "bened-walet",
"recipient": "17013046603665206934",
"ecBlockHeight": 275727,
"block": "8455642159445842600",
"blockTimestamp": 29797208,
"deadline": 60,
"transaction": "15200507403046301754",
"timestamp": 29796934,
"height": 275730
}
{
"signatureHash": "b35eae7d2f01639810d37694138aa0a86fbbf8a9bf58c2be4f2a5b8f0f30b3f7",
"unsignedTransactionBytes": "001046aac6013c0057fb6f3a958e320bb49c4e81b4c2cf28b9f25d086c143...",
"transactionJSON": {
"senderPublicKey": "57fb6f3a958e320bb49c4e81b4c2cf28b9f25d086c143b473beec228f79ff93c",
"signature": "5f0378b7390ff5a815eadd1354de533eef682f139362b153576e2207320a6...",
"feeNQT": "100000000",
"type": 0,
"fullHash": "3a304584f20cf3d2cbbdd9698ff9a166427005ab98fbe9ca4ad6253651ee81f1",
"version": 1,
"ecBlockId": "17321329645912574173",
"signatureHash": "b35eae7d2f01639810d37694138aa0a86fbbf8a9bf58c2be4f2a5b8f0f30b3f7",
"senderRS": "bened-walet",
"subtype": 0,
"amountNQT": "100000000",
"sender": "15323192282528158131",
"recipientRS": "bened-walet",
"recipient": "17013046603665206934",
"ecBlockHeight": 275727,
"deadline": 60,
"transaction": "15200507403046301754",
"timestamp": 29796934,
"height": 2147483647
},
"broadcasted": true,
"requestProcessingTime": 8475,
"transactionBytes": "001046aac6013c0057fb6f3a958e320bb49c4e81b4c2cf28b9f25d086c143...",
"fullHash": "3a304584f20cf3d2cbbdd9698ff9a166427005ab98fbe9ca4ad6253651ee81f1",
"transaction": "15200507403046301754"
}
{
"requestProcessingTime": 4,
"fullHash": "3a304584f20cf3d2cbbdd9698ff9a166427005ab98fbe9ca4ad6253651ee81f1",
"transaction": "15200507403046301754"
}
{
"accountRS": "bened-walet",
"publicKey": "57fb6f3a958e320bb49c4e81b4c2cf28b9f25d086c143b473beec228f79ff93c",
"requestProcessingTime": 2,
"account": "15323192282528158131"
}
{
"unconfirmedBalanceNQT": "12",
"forgedBalanceNQT": "0",
"balanceNQT": "12",
"requestProcessingTime": 1
}
{
"publicKey": "57fb6f3a958e320bb49c4e81b4c2cf28b9f25d...",
"requestProcessingTime": 36
}
{
"apiProxy": false,
"correctInvalidFees": true,
"ledgerTrimKeep": 30000,
"maxAPIRecords": 100,
"blockchainState": "UP_TO_DATE",
"currentMinRollbackHeight": 121200,
"numberOfBlocks": 122560,
"isTestnet": false,
"includeExpiredPrunable": true,
"isLightClient": false,
"services": [
"API",
"API_SSL",
"CORS"
],
"requestProcessingTime": 3,
"version": "0.0.0.1",
"maxRollback": 800,
"lastBlock": "14248468661966364222",
"application": "BND",
"isScanning": false,
"isDownloading": false,
"cumulativeDifficulty": "1117541424500920",
"lastBlockchainFeederHeight": 122559,
"maxPrunableLifetime": 7776000,
"time": 6297968,
"lastBlockchainFeeder": "5.182.17.81"
}
BENED API PHP
<?php
function request($action, $data=array()){
$url = 'http://localhost/xsrv';
$data['requestType'] = $action;
$body_string = http_build_query($data);
if($ch = curl_init()){
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body_string);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
$err = curl_errno($ch);
$result = curl_exec($ch);
curl_close($ch);
$res = @json_decode($result, true);
return $res;
}
return '';
}
// Wallet generation by passphrase, the phrase must be generated complex and unique.
function getAccountId($secretPhrase){
$data = [];
$data['secretPhrase'] = $secretPhrase;
$res = request('getAccountId', $data);
return $res;
}
// Get node status data.
function getBlockchainStatus($data = []){
$res = request('getBlockchainStatus', $data);
return $res;
}
// get block data by height ($height) or block number ($block)
function getBlock($height = 0, $block = 0){
$data = [];
if($height > 0) {
$data['height'] = $height;
}
if($block > 0) {
$data['block'] = $block;
}
$res = request('getBlock', $data);
return $res;
}
// get block ID by block height ($height)
function getBlockId($height = 0){
$data = [];
if($height >= 0) {
$data['height'] = $height;
}
$res = request('getBlockId', $data);
return $res;
}
// get latest blocks with transactions ($includeTransactions = true)
function getBlocks($lastIndex = 0, $includeTransactions = true){
$data = [];
if($lastIndex > 0) {
$data['lastIndex'] = $lastIndex;
}
if($includeTransactions == true) {
$data['includeTransactions'] = 'true';
}
$res = request('getBlocks', $data);
return $res;
}
// get transaction data by number
function getTransaction($transaction){
$data = [];
if($transaction > 0) {
$data['transaction'] = $transaction;
}
$res = request('getTransaction', $data);
return $res;
}
// get account balance by account ID
function getBalance($account){
$data = [];
if($account) {
$data['account'] = $account;
}
$res = request('getBalance', $data);
return $res;
}
// get PublicKey from account wallet
function getAccountPublicKey($account){
$data = [];
if($account) {
$data['account'] = $account;
}
$res = request('getAccountPublicKey', $data);
return $res;
}
// sign a transaction for sending (first we launch SendMoney, then we use the received transactionBytes field)
function broadcastTransaction($transactionBytes){
$data = [];
if($transactionBytes) {
$data['transactionBytes'] = $transactionBytes;
}
$res = request('broadcastTransaction', $data);
return $res;
}
function sendMoney($recipient, $publicKey, $amountNQT, $feeNQT){
$data = [];
$secretPhrase = "***"; // sender wallet password
$data['deadline'] = 60;
$data['secretPhrase'] = $secretPhrase;
$data['publicKey'] = $publicKey; // recipient's publicKey
if($recipient) {
$data['recipient'] = $recipient;
}
if($amountNQT) {
$data['amountNQT'] = $amountNQT;
}
if($feeNQT) {
$data['feeNQT'] = $feeNQT;
}
$data['message'] = 'Test-'.time();
$res = request('sendMoney', $data);
return $res;
}
// Examples of using:
print_r(getBlockchainStatus());
print_r(getBlock(0, "11312160551713577960"));
print_r(getBlock());
print_r(getBlockId());
print_r(getBlocks(1, true));
print_r(getTransaction('11618761853142767113'));
print_r(getBalance('bened3leu28gctm6u4gagl'));
print_r(getAccountPublicKey('bened3leu28gctm6u4gagl'));
print_r(getAccountIdPublicKey('6801230ae024f939a5116241d197152a2931315cba08ee06c79cae97ea1ba616'));