Skip to content

Instantly share code, notes, and snippets.

View askaaqib's full-sized avatar
⚒️
Same old, Same old

Aqib. askaaqib

⚒️
Same old, Same old
  • Pakistan
View GitHub Profile
@askaaqib
askaaqib / ethereum-php.php
Last active October 28, 2020 05:14
Ethereum Php Library
<?php
require "../vendor/autoload.php";
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
$eth->networkConfig()->setChainId(3);
echo "<pre>";
//// CREATE PRIVATE KEY
$prv = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares1"));
@askaaqib
askaaqib / ethereum-testing.php
Last active November 2, 2020 07:34
Ethereum Testing
<?php
require "../vendor/autoload.php";
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
echo "<pre>";
//// CREATE PRIVATE KEY
//$prv = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares1"));
//$prv1 = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares2"));
//
@askaaqib
askaaqib / endians.php
Created November 10, 2020 06:21
Endians
<?php
require "../vendor/autoload.php";
$be = \FurqanSiddiqui\Ethereum\Math\Integers::Pack_UInt_BE(0x12135895);
$le = \FurqanSiddiqui\Ethereum\Math\Integers::Pack_UInt_LE(0x12135895);
echo "<h3>Big</h3>";
print_r($be);
echo "<h3>Little</h3>";
print_r($le);
@askaaqib
askaaqib / rlp-new.php
Created November 10, 2020 06:22
RLP from json to table
<?php
require "../vendor/autoload.php";
$rlp = new \FurqanSiddiqui\Ethereum\RLP();
$jsonData = '{
"emptystring": {
"in": "",
"out": "0x80"
},
@askaaqib
askaaqib / account-test.php
Created November 11, 2020 06:06
Account Test - TNC Sdk
<?php
require_once "../vendor/autoload.php";
$ip = "185.244.248.40";
$port = 3030;
$tnc = new \TNC\TncCoin($ip,$port);
$af=new \TNC\Accounts\AccountFactory($tnc);
//Get Account
//$account = $af->getAccounts(["lorenzo"]);
//echo "<pre>";
@askaaqib
askaaqib / block-test.php
Created November 11, 2020 06:07
Block Test - Tnc
<?php
require_once "../vendor/autoload.php";
$ip = "185.244.248.40";
$port = 3030;
$tnc = new \TNC\TncCoin($ip,$port);
$bf= new \TNC\Blocks\BlockFactory($tnc);
//Latest Block
@askaaqib
askaaqib / Tnc.php
Created November 11, 2020 06:14
TncCoin
<?php
require_once "../vendor/autoload.php";
$ip = "185.244.248.40";
$port = 3030;
$tnc = new \TNC\TncCoin($ip,$port);
//$accountFactory = new \TNC\Accounts\AccountFactory($tnc);
//$account = $accountFactory->createAccount("lorenzo","nopass","alex","nopass");
//print_r($account);
@askaaqib
askaaqib / client.php
Created November 12, 2020 06:15
Client Socket
<?php
$host = "127.0.0.1";
$port = 25003;
$message = "Hello Server";
echo "Message To server :".$message;
// create socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
// connect to server
$result = socket_connect($socket, $host, $port) or die("Could not connect to server\n");
@askaaqib
askaaqib / server.php
Created November 12, 2020 06:16
Server Socket
<?php
// set some variables for configation
$host = "127.0.0.1";
$port = 25003;
// naver timeout! then set 0
set_time_limit(0);
// Create socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
// Bind socket to port
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
@askaaqib
askaaqib / bip39.php
Created November 17, 2020 07:23
Bip39, Create Entropy, Mnemonics, Seeds
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
echo "<pre>";
$bip39 = new \FurqanSiddiqui\BIP39\BIP39();
//$entropy = \FurqanSiddiqui\BIP39\BIP39::Generate();
//$genEntropy = $bip39->generateSecureEntropy();