PHP code example of aelf / aelf-sdk

1. Go to this page and download the library: Download aelf/aelf-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aelf / aelf-sdk example snippets


use AElf\AElf;
$url = '127.0.0.1:8000';
$aelfClient = new AElf($url);
$height = $aelfClient->GetBlockHeight();

public function getBlockHeight();

public function getBlockByHash($blockHash,$

public function getChainStatus();

public function getContractFileDescriptorSet($address);

public function getCurrentRoundInformationAsync();

public function getTaskQueueStatusAsync();

public function getChainIdAsync();

 public function addPeer($address);

 public function removePeer($address);

 public function getPeers($withMetrics);

 public function getNetworkInfo();

public function getTransactionPoolStatus();

public function executeTransaction($input);

public function executeRawTransaction($input);

public function createRawTransaction($input);

public function sendRawTransaction($input);

public function sendTransaction($input);

public function sendTransactions($input);

public function getTransactionResult($transactionId);

public function getTransactionResults($blockHash, $offset = 0, $limit = 10);

public function getMerklePathByTransactionId($transactionId);

public function isConnected();

public function getFormattedAddress($privateKey, $address);

public function getAddressFromPubKey($pubKey) ;

public function getGenesisContractAddress();

public function getContractAddressByName($privateKey, $contractNameHash);


   $url = "Http://127.0.0.1:8001";
   

   $this->privateKey = 'be3abe5c1439899ac2efd0001e15715fd989a3ae11f09e1cb95d320cd4993e2a';
   
lang=bash
1. PHP => 7.0
2. gmp
3. curl