Using PHP as blockchain
from the characteristics of the language itself, go is a very efficient language, which highly supports concurrency. Go language itself pays more attention to distributed systems, and concurrency processing is relatively good, such as advertising and search, which are high concurrency servers
go language advantages:
excellent performance, can be directly compiled into machine code, does not rely on other libraries, go is extremely fast. Its performance is similar to Java or C + +
concurrency is supported at the language level, which is the biggest feature of go. It is born to support concurrency, and go is the concurrency supported in gene, which can make full use of multi-core and make it easy to use concurrency
the built-in runtime supports garbage collection, which is one of the features of dynamic language. Although GC is not perfect at present, it is enough to cope with most of the situations we can encounter, especially GC after go1.1
it's easy to learn. The authors of go language all have the gene of C, so go naturally has the gene of C. There are 25 go keywords, but the expressive ability is very strong. It almost supports most of the features you've seen in other languages: inheritance, overloading, object, etc
rich standard libraries, go has built a large number of libraries, especially the network library, which is also my favorite part< As like as two peas, br / > built-in powerful tools, Go language is built with many tools chain, the best should be gofmt tools, automatic formatting code, make team review become so simple, code format is exactly the same, it is very difficult to think differently.
cross platform compilation and fast compilation. Compared with the sluggish compilation speed of Java and C + +, the fast compilation time of go is a major efficiency advantage
disadvantages of go language:
package management: package management of go language is absolutely not perfect. By default, it has no way to make a specific version of the dependency library, nor can it create replicable builds. In contrast, python, node and Ruby all have better package management systems. However, with the right tools, the package management of go language can also perform well
lack of development framework: go language does not have a major framework, such as Ruby's rails framework, Python's Django framework or PHP's laravel. This is a heated discussion in the go language community, because many people think that we should not start with using frameworks. This is true in many cases, but if you just want to build a simple crud API, it's much easier to use Django / djrf, rails laravel, or Phoenix
exception handling: go language can help developers deal with compilation errors by simply returning errors (or call stack) through functions and expected calling codes. Although this method is effective, it is easy to lose the scope of the error, so it is difficult to provide meaningful error information to users. Error package can solve this problem by allowing us to add context and stack trace to return error
another problem is that we may forget to handle errors. Static analysis tools such as errcheck and megacheck can avoid these errors. Although these solutions are very effective, they may not be the right way.
let me analyze it:
1: bitcoin has been broken in China, and its price has dropped sharply, which is unexpected by the global mining pool
2: compared with the current mining cost of bitcoin, it makes money entirely by cheap electricity bills
3: there are only 21 million bitcoins, and most of them have been g up in the early stage, which makes it difficult to dig those bitcoins that have not been g up in the future, and there is too much competition. Many small mines are in a state of loss
and why do many well-known mines turn to TCD
first of all, bitcoin is the optimized and upgraded version of bitcoin, with a constant number of 100 million. The early mining is very good. Unlike bitcoin, which has too high cost and low cost performance ratio, it is appropriate to use bitcoin as a supplement to compare bitcoin. Bitcoin is used for large amount payment and bitcoin is used for small amount payment.
Yes
use PHP code to define blocks:
class block {
public $prevhash
public $hash;
public $timeStamp;
public $data;
}
prevhash: the hash value of the previous block; Hash: hash value of the current block; Timestamp: the time stamp generated by the block; Data: data stored in the block; The fields prevhash, hash and timestamp are called block headers in the blockchain, and the hash value of the block is calculated by SHA-256 algorithm
extended data
the practical use and significance of blockchain:
blockchain is a decentralized distributed ledger. What is decentralization? There is no center, or everyone can be a center. This is different from the traditional way of centralization. Distributed ledger means that the storage of data is not only on each node, but each node will and share the data of the whole ledger
In addition, blockchain has the characteristics of disintermediation and information transparency. For example, for example, when we shop on Taobao, after we place the order, the cost we pay is first hit in Alipay. After we receive the courier and confirm the receipt, the money will be transferred to the seller's account. In the blockchain, buyers and sellers can trade directly without any platform as a third-party certification authoritythe system will broadcast the transaction information of both parties. All hosts will record and back up the transaction data after receiving the information. If the order of one machine is wrong, the backup data of other machines will not be affected
the concept of blockchain is a new application mode of distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and other computer technologies. Since it is a mode, it is not limited to language, only that language is more suitable
blockchain needs a lot of storage, calculation and transmission. PHP is not suitable for these characteristics, especially the efficiency of PHP
if you want to study this, look at the article of blockchain more:
understanding of blockchain,
51 lines of code to realize a simple PHP blockchain
in order to let people visit their own website, domain name is essential. Domain names should be as short and easy to remember as possible, such as. Top domain names. Of course, there are not many easy to remember and characteristic domain names now. You need to consider it yourself, as long as you think there are certain rules or it is convenient for users to remember
Second, space
to build a website, there must be a space, that is, a place to store the website. For indivial users, it is recommended to purchase virtual host. When purchasing a virtual host, you need to see its service, speed, response time, etc. Generally, you can choose a well-known service provider
note: at present, the domestic service providers with better domain name and space, such as alicloud, Western Digital and China data, are very good choices< Third, the website program
of course, the website program is ready-made, because indivials do not need to start from scratch to develop a website program, and they do not have the strength. Now there is a ready-made website management system on the Internet, and there are many such systems, which can be selected on the basis of their own comprehensive trial
when choosing a website program, we must also consider its versatility and secondary development. For the general bad, not concive to the second phase of development, although powerful, but not recommended, because the site has a certain scale, the need for personalized function design will be very troublesome. In addition, ASP (ASP. Net) is the best choice for the program. PHP and JSP are not very popular in China; Asp.net should be chosen as far as possible between ASP and asp.net. After all, its development trend is based on. Net architecture
Fourth, website design
after choosing the website program, you need to design the website according to your own needs. Generally speaking, if there are professional artists and programmers to modify the nature of the best. But indivial stationmaster may not have this kind of condition, can choose the intelligent station of service provider.