Turtle Network Code Snippets

goldenbear7 edited this page Oct 26, 2018 · 8 revisions

Php code snippets to show different types of TN balances online

Regular — that's how much TN you have, including those you leased;
Available — the same as regular only without TN you leased / balance you can lease and spend;
Effective — available plus those TN which is leased to you;
Generating — the minimal effective for last 1000 blocks / balance gives you mining power;

Regular;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["regular"], '.', -8, 0); ?>

Available;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["available"], '.', -8, 0); ?>

Effective;
<?php $url = "https://privatenode.blackturtle.eu/addresses/effectiveBalance/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["balance"], '.', -8, 0); ?>

Generating;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["generating"], '.', -8, 0); ?>

Show All Balances;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo "Address:" ." ". $balans["address"] . "<br />\n"; echo "Regular Balance:" ." ". substr_replace($balans["regular"], '.', -8, 0) . "<br />\n"; echo "Generating Balance:" ." ". substr_replace($balans["generating"], '.', -8, 0) . "<br />\n"; echo "Available Balance:" ." ". substr_replace($balans["available"], '.', -8, 0) . "<br />\n"; echo "Effective Balance:" ." ". substr_replace($balans["effective"], '.', -8, 0) . "<br />\n"; ?>

Cuplikan kode PHP untuk menunjukkan perbedaan jenis saldo online TN

Regular -- ---yaitu berapa banyak TN yg kamu miliki, termasuk yg di sewakan;
Yg tersedia -- sama seperti reguler hanya tanpa yg di sewakan / saldo yg bisa anda sewa atau pakai;
Efektif -- saldo tersedia di tambahe TN yg disewakan ke anda;
Hasil -- minimal efektif untuk 1000 blok terakhir/ saldo yg memberi anda tenaga penambangan;

Reguler;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["regular"], '.', -8, 0); ?>

Tersedia;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["available"], '.', -8, 0); ?>

Efektif;
<?php $url = "https://privatenode.blackturtle.eu/addresses/effectiveBalance/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["balance"], '.', -8, 0); ?>

Menghasilkan;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo substr_replace($balans["generating"], '.', -8, 0); ?>

Semua saldo;
<?php $url = "https://privatenode.blackturtle.eu/addresses/balance/details/ADDTurtleWalletADDRESS"; $response = file_get_contents($url); $balans= json_decode($response, true); echo "Address:" ." ". $balans["address"] . "<br />\n"; echo "Regular Balance:" ." ". substr_replace($balans["regular"], '.', -8, 0) . "<br />\n"; echo "Generating Balance:" ." ". substr_replace($balans["generating"], '.', -8, 0) . "<br />\n"; echo "Available Balance:" ." ". substr_replace($balans["available"], '.', -8, 0) . "<br />\n"; echo "Effective Balance:" ." ". substr_replace($balans["effective"], '.', -8, 0) . "<br />\n"; ?>

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.