Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# The PHPCoin (PHP) cryptocurrency node.

For detailed information on installation, usage, and development, please see the [PHPCoin Documentation](./docs/).

--

Name: PHPCoin

Symbol: PHP
Expand Down Expand Up @@ -75,14 +79,6 @@ https://m1.phpcoin.net/

https://m2.phpcoin.net/





## Install

Check [instructions](https://github.com/phpcoinn/node/wiki/Node-installation)




Please see the [Install Guide](./docs/getting-started/) for detailed instructions.
25 changes: 25 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Welcome to the official documentation for PHPCoin. This documentation provides a comprehensive guide to installing, using, and developing with PHPCoin.

* **[Introduction](./introduction/)** - A high-level overview of PHPCoin, its features, and its purpose.
* **[What is PHPCoin?](./introduction/what-is-phpcoin.md)** - A detailed explanation of the PHPCoin project.
* **[Features](./introduction/features.md)** - A list of the key features of PHPCoin.
* **[White Paper](./white-paper/README.md)** - The official PHPCoin whitepaper.
* **[Getting Started](./getting-started/)** - Step-by-step guides for installing and running a PHPCoin node.
* **[Installation](./getting-started/installation.md)** - A guide on how to install a PHPCoin node.
* **[Running a Node](./getting-started/running-a-node.md)** - Instructions on how to run a PHPCoin node.
* **[Wallet](./wallet/)** - Instructions on how to use the command-line and web-based wallets.
* **[Using the Wallet](./wallet/using-the-wallet.md)** - A detailed guide on how to use the PHPCoin wallet.
* **[Mining](./mining/)** - Information on how to mine PHPCoin using different methods.
* **[How to Mine](./mining/how-to-mine.md)** - A guide on how to get started with mining.
* **[Miner Workflow](./mining/miner-workflow.md)** - A detailed, technical step-by-step breakdown of the different mining processes.
* **[ePoW (Elapsed Proof of Work)](./epow/)** - A detailed explanation of PHPCoin's unique consensus algorithm.
* **[Staking](./staking/)** - A guide to staking your PHPCoin holdings to earn rewards.
* **[How to Stake](./staking/how-to-stake.md)** - A guide on how to get started with staking.
* **[Masternodes](./masternodes/)** - Instructions for setting up and running a masternode.
* **[Setting up a Masternode](./masternodes/setting-up-a-masternode.md)** - A guide on how to set up a masternode.
* **[Smart Contracts](./smart-contracts/)** - A comprehensive guide to developing smart contracts on the PHPCoin platform.
* **[Smart Contract Builder's Guide](./smart-contracts/builders-guide.md)** - A detailed guide on how to build smart contracts.
* **[dApps](./dapps/)** - Information on how to build decentralized applications (Dapps) on PHPCoin.
* **[Developing dApps](./dapps/developing-dapps.md)** - A guide on how to develop dApps.
* **[API](./api/)** - The complete API reference for a PHPCoin node.
* **[API Reference](./api/api-reference.md)** - A detailed reference for the PHPCoin API.
10 changes: 10 additions & 0 deletions docs/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[PHPCoin Docs](../) > API


---

# API Documentation

This section contains the API reference for PHPCoin.

* [API Reference](./api-reference.md)
297 changes: 297 additions & 0 deletions docs/api/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
[PHPCoin Docs](../) > [API](./) > API Reference


---

# API Reference

The PHPcoin API provides a set of endpoints for interacting with the blockchain. The API is accessible via HTTP and returns data in JSON format.

## Accounts

### getAddress

Converts a public key to a PHPcoin address.

* **URL:** `/api.php?q=getAddress`
* **Method:** `GET`
* **Parameters:**
* `public_key` (string, required): The public key to convert.
* **Example:**
```
/api.php?q=getAddress&public_key=...
```

### getBalance

Returns the balance of a specific address.

* **URL:** `/api.php?q=getBalance`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address to check.
* **Example:**
```
/api.php?q=getBalance&address=...
```

### getPendingBalance

Returns the pending balance of a specific address, which includes unconfirmed transactions.

* **URL:** `/api.php?q=getPendingBalance`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address to check.
* **Example:**
```
/api.php?q=getPendingBalance&address=...
```

### getPublicKey

Returns the public key of a specific address.

* **URL:** `/api.php?q=getPublicKey`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address to check.
* **Example:**
```
/api.php?q=getPublicKey&address=...
```

### generateAccount

Generates a new PHPcoin account.

* **URL:** `/api.php?q=generateAccount`
* **Method:** `GET`
* **Example:**
```
/api.php?q=generateAccount
```

## Transactions

### getTransactions

Returns the latest transactions for a specific address.

* **URL:** `/api.php?q=getTransactions`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address to check.
* `limit` (integer, optional): The maximum number of transactions to return.
* `offset` (integer, optional): The offset to start from.
* **Example:**
```
/api.php?q=getTransactions&address=...&limit=10
```

### getTransaction

Returns a specific transaction by its ID.

* **URL:** `/api.php?q=getTransaction`
* **Method:** `GET`
* **Parameters:**
* `transaction` (string, required): The ID of the transaction.
* **Example:**
```
/api.php?q=getTransaction&transaction=...
```

### send

Sends a transaction to the network.

* **URL:** `/api.php?q=send`
* **Method:** `POST`
* **Parameters:**
* `val` (float, required): The amount to send.
* `dst` (string, required): The destination address.
* `public_key` (string, required): The sender's public key.
* `signature` (string, required): The transaction signature.
* `date` (integer, required): The transaction date (Unix timestamp).
* `message` (string, optional): A message to include with the transaction.
* **Example:**
```json
{
"val": 10.0,
"dst": "...",
"public_key": "...",
"signature": "...",
"date": 1678886400,
"message": "Hello, world!"
}
```

## Blocks

### currentBlock

Returns the current block.

* **URL:** `/api.php?q=currentBlock`
* **Method:** `GET`
* **Example:**
```
/api.php?q=currentBlock
```

### getBlock

Returns a specific block by its height.

* **URL:** `/api.php?q=getBlock`
* **Method:** `GET`
* **Parameters:**
* `height` (integer, required): The height of the block.
* **Example:**
```
/api.php?q=getBlock&height=12345
```

### getBlockTransactions

Returns the transactions of a specific block.

* **URL:** `/api.php?q=getBlockTransactions`
* **Method:** `GET`
* **Parameters:**
* `height` (integer, required): The height of the block.
* **Example:**
```
/api.php?q=getBlockTransactions&height=12345
```

## Node

### version

Returns the version of the node.

* **URL:** `/api.php?q=version`
* **Method:** `GET`
* **Example:**
```
/api.php?q=version
```

### mempoolSize

Returns the number of transactions in the mempool.

* **URL:** `/api.php?q=mempoolSize`
* **Method:** `GET`
* **Example:**
```
/api.php?q=mempoolSize
```

### nodeInfo

Returns information about the node.

* **URL:** `/api.php?q=nodeInfo`
* **Method:** `GET`
* **Example:**
```
/api.php?q=nodeInfo
```

### getPeers

Returns a list of the node's peers.

* **URL:** `/api.php?q=getPeers`
* **Method:** `GET`
* **Example:**
```
/api.php?q=getPeers
```

## Masternodes

### getMasternodes

Returns a list of all masternodes.

* **URL:** `/api.php?q=getMasternodes`
* **Method:** `GET`
* **Example:**
```
/api.php?q=getMasternodes
```

### getMasternode

Returns a specific masternode by its address.

* **URL:** `/api.php?q=getMasternode`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address of the masternode.
* **Example:**
```
/api.php?q=getMasternode&address=...
```

## Smart Contracts

### getSmartContract

Returns a specific smart contract by its address.

* **URL:** `/api.php?q=getSmartContract`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address of the smart contract.
* **Example:**
```
/api.php?q=getSmartContract&address=...
```

### getSmartContractProperty

Reads a property of a smart contract.

* **URL:** `/api.php?q=getSmartContractProperty`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address of the smart contract.
* `property` (string, required): The name of the property to read.
* `key` (string, optional): The key of the property, if it's a map.
* **Example:**
```
/api.php?q=getSmartContractProperty&address=...&property=myProperty&key=myKey
```

### getSmartContractInterface

Returns the interface of a smart contract.

* **URL:** `/api.php?q=getSmartContractInterface`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address of the smart contract.
* **Example:**
```
/api.php?q=getSmartContractInterface&address=...
```

### getSmartContractView

Executes a view method of a smart contract.

* **URL:** `/api.php?q=getSmartContractView`
* **Method:** `GET`
* **Parameters:**
* `address` (string, required): The address of the smart contract.
* `method` (string, required): The name of the view method to execute.
* `params` (string, optional): The parameters for the method, as a base64-encoded JSON string.
* **Example:**
```
/api.php?q=getSmartContractView&address=...&method=myMethod&params=...
```
10 changes: 10 additions & 0 deletions docs/dapps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[PHPCoin Docs](../) > dApps


---

# Dapps Documentation

This section explains how to develop decentralized applications (Dapps) on the PHPCoin platform.

* [Developing Dapps](./developing-dapps.md)
26 changes: 26 additions & 0 deletions docs/dapps/developing-dapps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[PHPCoin Docs](../) > [dApps](./) > Developing Dapps


---

# Developing Dapps

A Decentralized Application (Dapp) on PHPcoin is a web application that interacts with the PHPcoin blockchain. Dapps can be built using standard web technologies like PHP, HTML, and JavaScript.

## Dapp Structure

A Dapp is typically structured as a web page that is served by a web server. The Dapp's frontend is built with HTML and JavaScript, and it interacts with a PHPcoin node's API to get information from the blockchain and to send transactions.

The backend of a Dapp can be written in any language, but PHP is a natural choice for PHPcoin Dapps. The backend can be used to perform more complex operations, such as interacting with a database or calling external APIs.

## Interacting with the Blockchain

Dapps interact with the PHPcoin blockchain by making calls to a node's API. The API provides a set of endpoints for getting information about the blockchain, sending transactions, and interacting with smart contracts.

You can use any HTTP client to make calls to the API. In PHP, you can use the `file_get_contents()` function or the cURL library. In JavaScript, you can use the `fetch()` API or a library like Axios.

## Example Dapp

The `dapps/demo` directory contains a simple example Dapp that visualizes the PHPcoin network topology. This Dapp is a good starting point for learning how to develop Dapps on PHPcoin.

The Dapp's frontend is built with HTML and JavaScript, and it uses the `vivagraph.js` and `go.js` libraries to visualize the network graph. The Dapp's backend is written in PHP, and it uses the `file_get_contents()` function to call the node's API and get information about the network.
Loading