Welcome to Quark Community

Quark is an open source software used mainly as a digital currency that employs multiple cryptographic algorithms, which unlike fiat/national currencies provides the platform for a decentralised monetary system.

Quark was launched in 2013 with the belief that the control of money should not be in the hands of the few, but in the hands of the many. This forum tries to build on that ideology by distributing Quarks in the hands of those that are active in the community. By posting quality articles and contributing to general discussions you will earn Quarks.

Sign up Learn more about Quark

Quark JSON-RPC api commands using PHP 1

php rpc quark

  1. Mako
    If you want to start a web project in Quark you can use the attached script and below instructions t0 access Quark RPC commands using PHP.

    To use this PHP script you need to make sure that you have Quark running and the Quark configuration file includes the RPC details. See chapter 2.2 of this guide for more details: http://quarktalk.org/resources/quark-wallet-configuration-file-information.28/

    To connect to your Quark daemon use:
    // Optionally, you can specify a host and port
    $quark = new Quark('yourRPCuser','yourRPCpassword','host','port');

    If you wish to make an SSL connection you can set an optional CA certificate or leave blank
    // This will set the protocol to HTTPS and some CURL flags

    Make calls to quarkcoind as methods for your object. Responses are returned either as text or array depending on the method called.
    $quark->getinfo(); // array
    $quark->getbalance("*", 1); // float
    $quark->getunconfirmedbalance(); // float
    $quark->validateaddress('QUARK957iywYSpgkYi9gbW3pFtLszeU7wQ'); // array

    When a call fails for any reason, it will return FALSE and put the error message in $this->error
    if (!empty($quark->error)) die($quark->error);

    If you want to make transactions but your wallet is encrypted you need to use walletpassphrase first
    $quark->walletpassphrase('yourwalletpassword', 1);
    $txid = $quark->sendtoaddress('QUARK957iywYSpgkYi9gbW3pFtLszeU7wQ', 100); // address, amount
    echo  $txid;

    To get the list of all API calls available:
    echo "<pre>";
    echo "</pre>";

    I hope you found this short tutorial useful for your Quark web applications.
    Dodorama likes this.

Recent Reviews

  1. drgncabe
    Version: 1
    Perfect, exactly what I needed.