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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / skycoin.php
Last active August 18, 2022 03:48
SkyCoin SDK PHP
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
$sky = new \SkyCoin\SkyCoin("192.168.100.27", 6420);
$walletFactory = new \SkyCoin\Wallets\WalletsFactory($sky);
echo "<pre>";
////GET BLOCK BY HEIGHT
@askaaqib
askaaqib / sign_verify_signature.php
Created October 16, 2020 06:34
ECDSA, Sign and Verify Signature
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use FurqanSiddiqui\ECDSA\ECDSA;
use FurqanSiddiqui\ECDSA\Curves\Secp256k1;
use Comely\DataTypes\Buffer\Base16;
use \kornrunner\Keccak;