Skip to content

Latest commit

 

History

History
82 lines (54 loc) · 2.51 KB

020_examples_wallet.md

File metadata and controls

82 lines (54 loc) · 2.51 KB

tanglePHP

Discord Twitter
Apache-2.0 license IOTA >PHP 8 WorkflowUnitTest >packagist_stable

Examples (Wallet)

Include

<?php
  // include iota lib
  require_once("autoload.php");

Create new mnemonic

  $mnemonic = new \IOTA\Crypto\Mnemonic(IOTA\Wallet::createMnemonic());

or

Use exist mnemonic

  $mnemonic = new \IOTA\Crypto\Mnemonic('giant dynamic museum toddler six deny defense ostrich bomb access mercy blood explain muscle shoot shallow glad autumn author calm heavy hawk abuse rally');

Open wallet

  $wallet    = new \IOTA\Wallet($mnemonic);

Open address

  $address_0 = $wallet->address();
  $address_1 = $wallet->address(0, 1);

Get informations

  echo "WalletSeed:     " . $wallet->getSeed();
  echo "WalletMnemonic: " . $mnemonic;
  echo "AddressPath:    " . $address_0->getPathString();
  echo "AddressBech32:  " . $address_0->getAddressBech32();
  echo "Balance:        " . $address_0->getBalance();

  echo "AddressPath:    " . $address_1->getPathString() . PHP_EOL;
  echo "AddressBech32:  " . $address_1->getAddressBech32() . PHP_EOL;
  echo "Balance:        " . $address_1->getBalance() . PHP_EOL;

Additional Examples

Please find other examples in the examples folder.


<- Back to Overview