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 / private_to_wif.php
Last active November 30, 2020 10:24
Wallet Import Format (WIF) in PHP - Private to Wif
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
echo "<pre>";
$base58 = new \FurqanSiddiqui\Base58\Base58();
$base16 = new \Comely\DataTypes\Buffer\Base16();
$privateKey = $base16->set("0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D");
@askaaqib
askaaqib / masterkey.php
Created November 25, 2020 07:41
Create Master Key from Seed - BIP32 PHP
<?php
declare(strict_types=1);
$seed = "000102030405060708090a0b0c0d0e0f";
echo "<pre>";
require "../vendor/autoload.php";
$mskobj = \FurqanSiddiqui\BIP32\BIP32::MasterKey($seed, "512");
$msk1 = $mskobj->raw();
echo "<h3>Master Key </h3>";
@askaaqib
askaaqib / submit_transaction.php
Created November 25, 2020 05:13
Submit Transaction - Stellar PHP API
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use ZuluCrypto\StellarSdk\Keypair;
use ZuluCrypto\StellarSdk\Server;
use ZuluCrypto\StellarSdk\XdrModel\Operation\PaymentOp;
echo "<pre>";
@askaaqib
askaaqib / stream_payments.php
Created November 25, 2020 05:13
Stream Payments - Stellar PHP API
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use ZuluCrypto\StellarSdk\Server;
$server = Server::testNet();
$account = $server->getAccount('GCCZACJX7DHEWGK5WJ2ONRGAJN2RBGGCX3OO4NF66JMJ4MNACKED577A');
@askaaqib
askaaqib / list_payments.php
Created November 25, 2020 05:13
List Payments - Stellar PHP API
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use ZuluCrypto\StellarSdk\Server;
$server = Server::testNet();
//$account = $server->getAccount('GCCZACJX7DHEWGK5WJ2ONRGAJN2RBGGCX3OO4NF66JMJ4MNACKED577A');
@askaaqib
askaaqib / fund_account.php
Created November 25, 2020 05:12
Fund Account - Stellar PHP API
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
// See 01-create-account.php for where this was generated
$publicAccountId = 'GCCZACJX7DHEWGK5WJ2ONRGAJN2RBGGCX3OO4NF66JMJ4MNACKED577A';
// Use the testnet friendbot to add funds:
$response = file_get_contents('https://horizon-testnet.stellar.org/friendbot?addr=' . $publicAccountId);
@askaaqib
askaaqib / create_account.php
Created November 25, 2020 05:12
Create Account - PHP Stellar API
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use ZuluCrypto\StellarSdk\Keypair;
$keyPair = keyPair::newFromRandom();
echo "<h3>Secret Key</h3>";
@askaaqib
askaaqib / account_details.php
Created November 25, 2020 04:35
Accoun Details - Stellar PHP Api
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use ZuluCrypto\StellarSdk\Server;
// See 01-create-account.php for where this was generated
//$publicAccountId = 'GCCZACJX7DHEWGK5WJ2ONRGAJN2RBGGCX3OO4NF66JMJ4MNACKED577A';
$publicAccountId = 'GBN2Q4QX72P5COMA2EJDRL42BCUXZVPM4FDNCMEMQHL7Z3AWJEL3SETT';
@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();
@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");