Skip to content

defunctec/Crown-PHP-Tools

Repository files navigation

Crown-PHP-Tools

Different PHP functions for Crown(CRW) including Wordpress

Introduction

We're attempting to compile some useful PHP functions for anyone to use within their website.

How to use

They're simple to use, just replace RPCUSER:RPCPASS with your Crown RPC details.

"sendtoaddress.php" Function

If you're not using wordpress then you will need to create your own method of obtaining a Users Crown(CRW) address.
If you are using wordpress take note of 'get_user_crown_address'.
$getUserMeta = get_user_meta($getID, $key = 'get_user_crown_address', $single = true);
This is a manually setup metatag made using the Ultimate Member plugin.
The plugin allows admins to customise their registration form.
Using edit, make a new form box and call it get_user_crown_address.
The code will now pull the users address when they're logged in.

"getaccountaddress.php" Function

If you're not using wordpress then you will need to create your own method of obtaining usernames.
If you are using wordpress then all is taken care of.
This will allocate an account on the Crown client. The user is shown the account address for them to use in some way.

"getaddressesbyaccount.php" Function

If you're not using wordpress then you will need to create your own method of obtaining usernames.
If you are using wordpress then all is taken care of.
This will get the users account address from the Crown client. The user is shown the account address for them to use in some way.

"sendtoaccount.php" Function

This is a wordpress only function.
It will send from the admin wallet "0" account and sent to the logged in user.

"getnewaddress.php" Function

This function has two uses.
If you would like a user to just get a random address then user the function without wordpress features.
If you would like to generate another account address for the logged in user then use the wordpress function.

"listtransactions.php" Function

For non wordpress use, this function will show the last 50 transactions made from the admin/owerner wallet.
For wordpress use, this function shows the logged in user their last n number of transactions.

"getbalance.php" Function

For non wordpress use, this function will show the total balance of the admin/owerner wallet.
For wordpress use, this function shows the logged in users account balance.

"getblockcount.php" Function

Simple getblockcount command which returns current blockchain height.

"masternodecount.php" Function

Simple masternode(count) command to show the amount of masternodes opperating on the network.

"systemnodecount.php" Function

Simple systemnode(count) command to show the amount of masternodes opperating on the network.

"mnbudgetpassing.php" Function

Shows projected passing proposals.

"mnbudgetnextsblock.php" Function

Shows the next superblock height.

"getdifficulty.php" Function

Shows the network difficulty.

"getnetworkhashps.php" Function

Shows the network hashrate.

"nftokensupply.php" Function

Shows the total amount of tokens on the Crown Platform.

"balanceof.php"

There are 4 versions of this function.
Two with wordpress functionallity and two without. The two without will need a way of pulling Crown addresses while the wordpress functions already pull.

About

Different PHP functions for Crown(CRW) including Wordpress

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages