Ethereum is a blockchain that attracts much attention. It builds a decentralized platform based on cryptography and P2P communication technology, where all transactions are stored synchronously in each node. By cascading blocks in one direction, Ethereum effectively ensures that transactions cannot be tampered with:

Smart Contract Platform

Ethereum is the first blockchain to implement virtual machines, thus providing a good supporting environment for the operation of Smart contracts. It is also for this reason that Ethereum is called Blockchain 2.0, to distinguish it from blockchain 1.0, which is a digital cryptocurrency represented by Bitcoin.

Smart contract can be understood as a contract agreement between machines, which will automatically execute the agreed logic when certain conditions are met. For example, in the process of insurance claim settlement, the compensation will be automatically released to the insurer if the conditions are met. This process can be realized by using smart contract.

Ethereum smart contracts can be developed in a variety of languages, but the most commonly used language currently is the JavaScript like Solidity language. Smart contract development will be explained using Solidity in this course.

JSON-RPC

If we want to build a decentralized application (DApp), in addition to the development of smart contract, we usually need to use other development languages to provide users with the user interface to operate smart contract, such as developing a web page, a mobile App or a desktop application. All of this code needs to interact with Ethereum.

Ethereum specifies the JSON RPC API application development interface that each node needs to implement. This interface is transport-independent, and applications can use this interface protocol to operate ethereum nodes through various communication mechanisms such as HTTP, Websocket, or IPC:

You can theoretically develop decentralized applications on Ethereum using JSON RPC interfaces in any language, but for efficiency, it is better to use language-specific JSON RPC wrapper libraries that encapsulate the protocol details of JSON RPC and help developers focus on the implementation of business logic.

However, in the PHP community, there is still a lack of unified and relatively mature Ethereum development package, and in the development process of DApp, it is often necessary to make comprehensive use of various code resources to solve the problem.

Courses address: xc.hubwiz.com/course/5b36…

Course content

The purpose of this course is to help PHP engineers quickly acquire the skills to develop ethereum applications, while also explaining some basic concepts of Ethereum, such as accounts, transactions, and smart contract development.

Chapter 2 Hi, Ethereum this chapter will explain the simplest process of developing ethereum applications using PHP through a simple PHP application development. After this section, you will be able to introduce basic Ethereum support into your PHP application.

Chapter 3 Account Management This chapter will introduce the account management interface of Ethereum in detail. If you’re interested in developing a centralized wallet app, or if you need to dynamically create accounts on your site (for example, if you want to add support for Ethereum payments to your site), this section will be a great help.

Chapter 4 Understanding States and Transactions This chapter focuses on the transaction operation interface of Ethereum, and also introduces some important concepts such as states, naked transactions, and gas. This section will help you sort out most of the issues with PHP applications interacting with Ethereum.

This chapter will explain the method of using PHP to operate Solitiy contract through a complete process of ERC20 token contract development, compilation, code generation, deployment and interaction. This section is a must if you want to add token support to your site.

Chapter 6 Filters and Events this chapter focuses on Ethereum’s notification mechanism and how you can use filters in PHP to monitor the generation of blocks and transactions and the firing of contract events.

The course provides presets for each point, which you can view in the ~/repo directory of the lab environment.

A small example of PHP in class

Get node version information using PHP.

We just send the HTTP request package in our PHP code. You can use any HTTP library you like like curl, Guzzle, etc., or even use sockets directly to call Ethereum’s JSON RPC API.

For example, the following code uses the Guzzle library:

<? php$client = new GuzzleHttp\Client();
$opts = [
  'json'= > ['jsonrpc'= >'2.0'.'method'= >'web3_clientVersion'.'params'= > [].'id' => time()
  ]
];
$rsp = $client->post('http://localhost:8545'.$opts);
echo $rsp->getBody() . PHP_EOL; ? >Copy the code

Save the above content as raw-test.php and execute:

~$ php rpc-guzzle.php
Copy the code

You should be able to see the results.

Here you can access PHP Ethernet, this tutorial in detail how to use the PHP language support for a website increases the etheric fang block chain, course content involves the key concepts in the etheric fang, such as account management, status and contract, intelligent development and interaction, filter and events, etc., as well as detailed instructions on how to use PHP to interact with the etheric fang, It is the perfect choice for Php engineers to learn ethereum application development.

Also recommended several tutorials:

  • Web3j tutorial, mainly for Java and Android programmers for blockchain Ethereum development web3J development details.
  • Ethereum tutorial, mainly introduces smart contract and DAPP application development, suitable for getting started.
  • Ethereum development, mainly introduces the use of Node.js, mongodb, blockchain, IPFS to achieve decentralized e-commerce DApp combat, suitable for advanced.