2017 © Pedro Peláez
 

library gulden-client

image

erikbooij/gulden-client

  • Saturday, October 7, 2017
  • by ErikBooij
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

[PHP] Gulden Client

This Gulden client can be used to communicate with a Gulden node directly from PHP. It requires PHP 7.0 or higher., (*1)

Inspiration for this project came from @paulwillen's EasyGulden-PHP. You can check that out as well, it's a single file you can include and it may suit your needs., (*2)

Contributing

Currently only the most useful methods have been explicitely defined on this client. As explained below, all the other methods that are available on the Gulden-cli, can still be called through this client. The distinction about a method being implicitely or explicitely implemented, is that that the explicit ones give you better code completion in your IDE (may I recommend PhpStorm) and pre-parsed results, instead of raw json data., (*3)

Code Completion, (*4)

If a method you'd really like to use, is missing, you can simply open an issue or better yet, open a pull request., (*5)

Installation

The easiest way of installing the Gulden client into your project, is through Composer:, (*6)

$ composer require erikbooij/gulden-client

Usage

You can simply instantiate a Gulden client by passing it your credentials., (*7)

<?php

$username = 'testUser';
$password = 'password';
$hostname = 'http://127.0.0.1';
$port = 9232;

$guldenClient = new GuldenPHP\GuldenClient($username, $password [, $hostname, $port]);

In the above example, you could leave out the hostname and port because these are the default values., (*8)

Communication to the Gulden node is done over JSON RPC and every single method the Gulden node implements can be called directly on the client. For example, if you want to call gettxout on the Gulden node, you can simply do that as follows:, (*9)

<?php

$guldenClient->gettxout('transactionId', 1, true);

Every method throws a NodeException in case it doesn't receive a successful response from the Gulden server. This is useful for methods that are not explicitely implemented on the client. Most methods however, have been explicitely defined and namespaced:, (*10)

Accounts

Call within $client->accounts() namespace., (*11)

  • changeAccountName(string $account, string $name)
  • createAccount(string $name)
  • deleteAccount(string $account, bool $force = false)
  • getAccount(string $address)
  • getActiveAccount()
  • getAddressesByAccount(string $account)
  • getReadOnlyAccount(string $account)
  • importReadOnlyAccount(string $name, string $encodedKey)
  • listAccounts(string $seed = null)
  • setActiveAccount(string $account)

Example:

<?php

$client->accounts()->getActiveAccount();

Blockchain

Call within $client->blockchain() namespace., (*12)

  • getBestBlockHash()
  • getBlock(string $hash)
  • getBlockChainInfo()
  • getBlockCount()
  • getBlockHash(int $blockNumber)
  • getBlockHeader(string $blockHash)
  • getChainTips()
  • getDifficulty()
  • getMemPoolEntry(string $transactionId)
  • getMemPoolInfo()
  • getRawMemPool()
  • verifyChain(int $numberOfBlocks)

Example:

<?php

$client->blockchain()->getBlockCount();

Control

Call within $client->control() namespace., (*13)

  • getInfo()
  • stop()

Example:

<?php

$client->control()->getInfo();

Wallet

Call within $client->wallet() namespace., (*14)

  • abandonTransaction(string $transactionId)
  • backUpWallet(string $filename)
  • getBalance(string $account = '*', int $minConf = 0, bool $includeWatchOnly = false)
  • getNewAddress(string $account)
  • getRawChangeAddress()
  • getUnconfirmedBalance()
  • getWalletInfo()
  • move(string $fromAccount, string $toAccount, float $amount, int $minimumConfirmations = 1, string $comment = '' )
  • refillKeyPool(int $size)
  • sendToMany(string $fromAccount, array $addressesWithAmounts, int $minimumConfirmations = 1, string $comment = '', array $subtractFeeFromAddresses = [])
  • sendToAddress(string $toAddress, float $amount, string $comment = '', string $commentTo = '', bool $subtractFeeFromAmount = false )
  • sendToAddressFromAccount(string $fromAccount, string $toAddress, float $amount, string $comment = '', string $commentTo = '', bool $subtractFeeFromAmount = false)
  • setTransactionFee(float $transactionFee)
  • signMessage(string $address, string $message)

Example:

<?php

$client->wallet()->getWalletInfo();

The Versions

07/10 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Erik Booij

07/10 2017

1.2.0

1.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Erik Booij

01/10 2017

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Erik Booij

20/09 2017

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Erik Booij

18/09 2017

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Erik Booij