区块链solidity书籍推荐,区块链solidity基础
到目前为止,区块链技术已经成为一个热门话题,而Solidity是一种用于构建智能合约的高级编程语言。本文将介绍一些关于Solidity的书籍,帮助读者更好地了解和学习Solidity。
首先是《Solidity开发指南》,这本书是一本关于Solidity的入门书籍,旨在帮助读者快速掌握Solidity的基本知识,以及如何在实际应用中使用Solidity。本书介绍了Solidity的基本概念,包括智能合约、以太坊虚拟机、Gas、以太币等,并且深入介绍了Solidity的语法和技术,并给出了实际的例子,帮助读者更好地理解和使用Solidity。
接下来是《Solidity编程实践》,这本书介绍了如何使用Solidity编写智能合约,以及如何使用Solidity编写可扩展的智能合约。本书深入讨论了Solidity的基本概念,以及如何使用Solidity编写智能合约,并给出了实际的案例,帮助读者更好地理解和使用Solidity。
最后是《深入浅出Solidity》,这本书是一本关于Solidity的经典书籍,主要介绍了Solidity的基本原理,以及如何使用Solidity来构建智能合约。本书介绍了Solidity的基本概念,包括智能合约、以太坊虚拟机、Gas、以太币等,并且深入介绍了Solidity的语法和技术,以及如何使用Solidity来构建智能合约,帮助读者更好地理解和使用Solidity。
总之,Solidity是一种用于构建智能合约的高级编程语言,本文介绍了三本关于Solidity的书籍,帮助读者更好地了解和学习Solidity。这三本书分别是《Solidity开发指南》、《Solidity编程实践》和《深入浅出Solidity》,它们都是关于Solidity的优秀书籍,可以帮助读者更好地理解和使用Solidity。
请查看相关英文文档
『一』Which one is the leader, AR or FIL
FIL and AR both provide decentralized storage, and storage is the infrastructure of the Web 3.0 era. Compared with FIL and AR, I am personally more optimistic about Arweave. The current market value of AR is only one-third of FIL, the total number of AR is almost 66 million, and AR’s user subscriptions are much better than FIL. AR is a one-time buyout, and FIL is a continuous subscription. If you don't subscribe next time, I'm sorry, all the data will be deleted. Moreover, AR is SOL’s blockchain storage platform, the leading public chain platform, and its price and value are guaranteed.
『二』What is Ethereum? A Beginner’s Guide to Ethereum Development
What is Ethereum? A Beginner’s Guide to Ethereum Development
Many students are already eager to invest in the blockchain If you are a member of the development team, but you feel like you don’t know where to start, this article will be based on the Ethereum platform and introduce the obscure concepts involved in Ethereum development in a popular way, so that you can easily get started.
What is Ethereum
Ethereum is a decentralized application platform built on blockchain technology. It allows anyone to build and use decentralized applications running on blockchain technology within the platform.
For students who don’t understand this sentence, you can temporarily understand that Ethereum is Android in the blockchain. It is a development platform that allows us to write applications based on blockchain technology just like the Android Framework.
Before there was Ethereum, writing blockchain applications was like this: copy a copy of the Bitcoin code, and then change the underlying code such as encryption algorithm, consensus mechanism, network protocol, etc. (This is the case for many altcoins. A new coin will come out if you change it).
The Ethereum platform encapsulates the underlying blockchain technology, allowing blockchain application developers to develop directly based on the Ethereum platform. Developers only need to focus on the development of the application itself, thus greatly reducing the difficulty.
At present, a relatively complete development ecosystem has been formed around Ethereum: with community support, there are many development frameworks and tools to choose from.
Smart Contract
What is a Smart Contract
The program on Ethereum is called a smart contract, which is a collection of code and data (state).
Smart contracts can be understood as contracts (special transactions) written in code that can be automatically executed on the blockchain (driven by events).
In Bitcoin Script, we have mentioned that Bitcoin transactions can be programmed, but Bitcoin Script has many restrictions and the programs that can be written are also limited, while Ethereum is more complete (in computer science terms , calling it "Turing complete"), allows us to write programs (smart contracts) that can do almost anything just like any high-level language.
Smart contracts are ideal for those with high requirements on trust, security and durability.Application scenarios, such as: digital currency, digital assets, voting, insurance, financial applications, prediction markets, property ownership management, Internet of Things, peer-to-peer transactions, etc.
At present, apart from digital currency, there are not many real-life applications (just like the mobile platform has just begun to come out). I believe that within 1 to 3 years, various killers will slowly appear.
Programming language: Solidity
The default programming language for smart contracts is Solidity, and the file extension ends with .sol.
Solidity is a language similar to JavaScript. It is used to develop contracts and compile them into Ethereum Virtual Machine byte code.
There is also a smart contract development language that looks like Python: Serpent, but it is recommended that you still use Solidity.
Browser-Solidity is a Solidity IDE for browsers. You can click in to have a look. We will introduce more articles about the Solidity language in the future.
Operating environment: EVM
EVM (Ethereum Virtual Machine) Ethereum Virtual Machine is the operating environment for smart contracts in Ethereum.
Solidity is to EVM just like it is to JVM, so it will be easy for everyone to understand.
The Ethereum Virtual Machine is an isolated environment, and the code running inside the EVM cannot have any contact with the outside world.
The EVM runs on the Ethereum node. When we deploy the contract to the Ethereum network, the contract can run on the Ethereum network.
Contract Compilation
The Ethereum Virtual Machine runs the bytecode form of the contract, which requires us to compile the contract before deployment. You can choose Browser-Solidity Web IDE or solc compiler.
Contract deployment
When developing applications on Ethereum, the Ethereum client (wallet) is often used. Usually when we are developing, we generally do not come into contact with the concept of client or wallet. What is it?
Ethereum client (wallet)
Ethereum client, in fact, we can understand it as a developer tool, which provides account management, mining, transfer, deployment and execution of smart contracts, etc. Function.
EVM is provided by the Ethereum client.
Geth is a typical client used when developing Ethereum and is developed based on the Go language. Geth provides an interactive command console, which contains various functions (API) of Ethereum through the command console. We will introduce the use of Geth in an article later, but here everyone has a concept.
The Geth console is similar to the console in the Chrome browser developer tools, but it runs in the terminal.
Relative toGeth and Mist are Ethereum clients with graphical operating interfaces.
How to deploy
The deployment of smart contracts refers to publishing the contract bytecode to the blockchain and using a specific address to identify the contract. This address is called a contract account.
There are two types of accounts in Ethereum:
· External accounts
This type of account is controlled by a private key (controlled by a person) and is not associated with any code.
·Contract Account
This type of account is controlled by their contract code and has code associated with it.
Unlike Bitcoin’s UTXO design, Ethereum uses a simpler account concept.
Both types of accounts are the same for EVM.
The difference and relationship between external accounts and contract accounts is this: an external account can send messages to another external account or contract account by creating and signing transactions with its own private key.
Sending a message between two external accounts is the process of transferring value. But messages from the external account to the contract account activate the code of the contract account, allowing it to perform various actions (such as transferring tokens, writing to internal storage, mining a new token, performing some operations, creating a new contract, etc. wait).
Only when the external account issues instructions, the contract account will perform the corresponding operation.
Contract deployment is to deploy the compiled contract bytecode to the Ethereum blockchain in the form of sending transactions through an external account (the actual deployment is successful only after the actual miner produces the block).
Run
After the contract is deployed, when you need to call the method of this smart contract, you only need to send a message (transaction) to this contract account. After the message is triggered, the code of the smart contract will be executed in the EVM. .
Gas
Similar to cloud computing, the resources that occupy the blockchain (whether it is a simple transfer transaction or the deployment and execution of a contract) also require corresponding fees (there is no free lunch in the world, right? ).
Gas mechanism is used for billing on Ethereum. Gas can also be considered as a workload unit. The more complex the smart contract is (the number and type of calculation steps, the memory occupied, etc.), the more it requires to complete the operation. Gas.
The amount of Gas required to run the contract for any particular contract is fixed and is determined by the complexity of the contract.
The Gas price is stipulated by the person running the contract when submitting a request to run the contract to determine the fee he is willing to pay for this transaction: Gas price (denominated in Ethereum) * Gas quantity.
The purpose of Gas is to limit the amount of work required to execute a transaction while paying for execution. When the EVM executes a transaction, Gas will be gradually consumed according to specific rules. No matter where it is executed, once the Gas is exhausted, an exception will be triggered. All state modifications made in the current calling frame will be rolled back. If the execution endsThere is still Gas remaining in the bundle, and these Gas will be returned to the sending account.
Without this restriction, someone would write a contract that cannot be stopped (such as an infinite loop) to block the network.
So actually (to put the previous content together), we need an external account with an Ethereum balance to initiate a transaction (ordinary transaction or deploy and run a contract). When running, the miner charges the corresponding work Quantity fee.
Ethereum Network
Some anxious students may want to ask, how can we develop smart contracts without Ethereum? You can choose the following methods:
Select the Ethereum official website test network Testnet
In the test network, we can easily obtain free Ether coins. The disadvantage is that it takes a long time to initialize the node.
Use a private chain
Create your own Ethereum private test network, often called a private chain, which we can use as a test environment to develop, debug and test smart contracts.
With the Geth mentioned above, it is easy to create your own test network. You can mine as much Ethereum as you want without having to synchronize the entire blockchain data of the official network.
Using the Developer Network (Mode)
Compared with the private chain, under the Developer Network (Mode), a developer account with a large balance will be automatically allocated for us to use.
Use simulation environment
Another way to create a test network is to use testrpc. testrpc is an Ethereum environment simulated locally using memory. It is more convenient and faster for development and debugging. And testrpc can help us create 10 test accounts with funds at startup.
When developing a contract, you can test it in testrpc and then deploy it to the Geth node.
Update: testrpc has now been integrated into the Truffle development framework and is now named Ganache CLI.
Dapp: Decentralized Application
The Ethereum community calls applications based on smart contracts decentralized applications (DecentralizedApp). If we understand the blockchain as a database that cannot be tampered with, and smart contracts as programs that deal with the database, then it is easy to understand Dapp. A Dapp not only has smart contracts, but also needs a friendly user interface and other things.
Truffle
Truffle is a Dapp development framework. It can help us deal with a lot of trivial things, allowing us to quickly start the process of writing code - compiling - deploying - testing - packaging DApp.
Summary
Let’s summarize now. Ethereum is a platform that allows us to easily use blockchain technology to develop decentralized applications. In this application, useSolidity is used to write smart contracts that interact with the blockchain. After the contract is written, we need to use the Ethereum client to deploy and run the contract with an account with balance (using the Truffle framework can better help us do these things ). For the convenience of development, we can use Geth or testrpc to build a test network.
Note: In order to make it easier for everyone to understand, this article makes analogies to some concepts. Some of them are not strictly accurate. However, I also think that for beginners, it is not necessary to master every concept in detail and accurately. Learning is A gradual and in-depth process, many times we will find that after a period of time, we will have different understandings of the same thing.
『三』 Sol coin mining tutorial
First go to the SolFlare developer website and click "Create Wallet" to start creating a new wallet. A brief Solflare product introduction will follow, showing you the main features of the wallet. At the same time, the wallet will also remind you that tokens are stored in a non-custodial manner, which means that you are the only one responsible for the security of your funds: if you lose your private key and mnemonic phrase, neither Solflare nor anyone else can help you restore access. Resulting in asset loss.
If you do not have a hardware wallet, select "Using Keystore File" to start creating the wallet and click "Next". You have created your first Solflare wallet. You can now see the interface, with the main page showing your wallet address, available balance, and completed transactions. Next, you need to recharge SOL tokens to the wallet for subsequent staking.
Select the verification node you want to stake your tokens in the pop-up dialog box. You can enter a node name such as "Everstake". Then click "Next".
To sum up, the above is some introduction to sol currency and some steps of mining. As a popular currency, staking mining is a new way to play. I hope this article can help everyone!
Operating environment:
Brand model: Huawei nova7
System version: harmonyOS.2
App version: v13.4
[Extended information]
SOL has provided a deflationary code Coinomics, only possible after ETH implemented a token burning upgrade in July, made SOL immediately attractive to investors keen to pursue returns on deflationary assets.
Solana Blockchain launches a solution based on the Proof of History consensus algorithm that combines the best of PoW and PoS. As a result, the Solana platform’s blockchain capabilities will continue to expand over time, and users can participate by delegating tokens to validating nodes.
『四』Solana Validation Node Equipment, Network Requirements, and Staking Reward Penalty Mechanism
There is no strict minimum SOL requirement to run a validator on Solana.
However, in order to participate in consensus, a voting account with a rent-free reserve of 0.02685864 SOL is required. Voting also requires sending a voting transaction for each block that validators agree on, which can cost up to 1.1 SOL per day.
Note: By default, your validators will have no stake. This means it will be ineligible to be a leader. (No or very low returns from not staking.)
If you want to use the validator as an RPC node, the above hardware recommendations should be considered the minimum requirements. To provide full functionality and improve reliability, the following adjustments should be made.
While you can run validators on a cloud computing platform, it may not be cost-effective in the long run.
However, it might be convenient to run the non-voting api node on a VM instance for your own internal use. This use case includes exchanges and services built on Solana.
In fact, the mainnet-beta validator operated by the team is currently (March 2021) running on n2-standard-32 GCE (32 vCPU, 128 GB memory) instance with 2048 GB SSD , to facilitate operation.
For other cloud platforms, choose an instance type with similar specifications.
Also note that egress internet traffic usage can be high, especially if running a staking validator.
Running validators for live clusters (including mainnet-beta) within Docker is not recommended and generally not supported. This is due to concerns over general Docker containerization overhead and resulting performance degradation unless specifically configured.
We only use Docker for development purposes. Docker Hub contains images for all versions of solanalabs/solana.
Pre-built binaries are available for Linux x86_64 on AVX2-capable CPUs (Ubuntu 20.04 recommended). MacOS or WSL users can build from source.
Internet service should be at least 300Mbit/s symmetrical, commercial. 1GBit/s preferred
For inbound and outbound, the following ports need to be open to the Internet
Not recommended inRun the authenticator behind the NAT. Operators who choose to do this should be able to easily configure their network equipment and debug any traversal issues themselves.
For security purposes, it is not recommended to open the following ports to the internet on staked mainnet beta validators.
CUDA is required to use the GPU on your system. The provided Solana distribution binaries are built on Ubuntu 20.04 and CUDA Toolkit 10.1 update 1. If your machine uses a different CUDA version, you will need to rebuild from source.
Tip: Solana verifier can group verification clusters.
Validator performance test reference:
Validator software deployed to GCP n1-standard-16 instance with 1TB pd-ssd disk and 2 Nvidia V100 GPUs. These are deployed in the us-west-1 region.
solana-bench-tps is started after the network has converged from the client machine with n1-standard-16 CPU-only instances, with the following parameters: --tx_count=50000 --thread-batch-sleep 1000
TPS and confirmation metrics are captured from dashboard numbers over an average of 5 minutes at the beginning of the bench-tps transfer phase.
Here is an overview of the Proof of Stake (PoS) (i.e., the use of an in-protocol asset, SOL, to provide secure consensus) design. Solana implements a proof-of-stake reward/security scheme for validator nodes in the cluster. The purpose is threefold:
While many details of the specific implementation are currently being considered and are expected to be focused through specific modeling studies and parameter exploration on the Solana testnet, we here outline our current understanding of the main components of the PoS system Thinking. Much of this thinking is based on the current state of Casper FFG and allows optimization and modification of specific properties based on Solana’s Proof of History (PoH) blockchain data structure.
Solana's ledger verification design is based on a rotating, stake-weighted selected leader that broadcasts transactions in a PoH data structure to validating nodes. These nodes, after receiving the leader's broadcast, have the opportunity to vote on the current state and PoH height by signing transactions into the PoH stream.
To become a Solana validator, a certain amount of SOL must be deposited/locked in the contract. This SOL is specified whenInaccessible during the interval. The exact duration of the staking lock-up period has not yet been determined. However, we can consider three phases of this time, for which specific parameters are required:
The trustless sense of time and ordering provided by Solana's PoH data structure, along with its turbine data broadcast and transport design, should provide Sub-second transaction confirmation time, which is proportional to the log of the number of nodes in the cluster. This means that we should not limit the number of validating nodes with a prohibitive “minimum deposit” and expect nodes to be validators with a nominal amount of SOL staked. At the same time, Solana's focus on high throughput should incentivize verification customers to provide high-performance and reliable hardware. Combined with the potential minimum network speed threshold to join as a verification client, we expect a healthy market for verification delegation to emerge.
As discussed in the Economic Design section, the annual validator interest rate will be specified as a function of the total percentage of the circulating supply that is staked. The cluster rewards validators who are online and actively participate in the validation process throughout the validation period. For validators who go offline/fail to validate transactions during this period, their annual rewards will be effectively reduced.
Similarly, we can consider algorithmically reducing the active stake amount of a validator when the validator is offline. That is, if a validator is inactive for a period of time due to zoning or other reasons, the number of shares it considers "active" (eligible for rewards) may be reduced. This designed structure will help long-lived partitions eventually reach finality on their respective chains, as the percentage of total non-voting stake will decrease over time until there are active validators in each partition An absolute majority can be achieved. Likewise, upon re-engagement, the "active" staking volume will come back online at some defined rate. Depending on the size of the partition/active set, different equity reduction rates can be considered.
『五』What is the sol coin?
The full English name of the sol coin is Sola Token. Sola Token (sol currency) is the next generation of decentralized social platform that can incentivize and benefit all relevant parties - users, third-party developers and core teams. Sola's name comes from the acronym for "social layer." Sol coins are issued by the Sola platform and used for the operation of the Sola platform. Sol currency is the only currency for mutual payment between platform users.
At the heart of Solana’s scalable solution is a decentralized clock called Proof of History (PoH), which was built to solve the time problem in distributed networks where there is no single trusted source of time. By using a verifiable delay function, PoH allows each node to generate timestamps locally through SHA256 calculations. This eliminates the need to broadcast timestamps throughout the network, improving overall network efficiency. (Solana)SOL Coin PriceToday's Quote_The latest news on SOL Coin. Is it worth long-term investment?
SOL currency trading platform:
Binance official website: https://accounts.binancezh.top/cn/register?ref=79591276
Binance, the world's leading blockchain Digital Asset International Station provides a wide range of digital currency transactions, blockchain education, blockchain project incubation, blockchain asset issuance platform, blockchain research institute and blockchain charity services to the world. Currently, users cover the world. Available in more than 180 countries and regions, with 1.4 million orders/second core memory matching technology, it is one of the fastest cryptocurrency trading platforms in the world and one of the platforms with the largest cryptocurrency trading volume in the world.
Solana’s mission is to support all high-growth and high-frequency blockchain applications and democratize the world’s financial system. At its core, Solana is: Scalability: Solana is capable of supporting more than 50,000 transactions per second while maintaining a 400 millisecond block time.
Decentralization: Using the Turbine block propagation protocol, the platform can support thousands of nodes while maintaining performance and scalability.
Low Execution Fees: Network transaction costs are estimated at $10 for 1 million transactions.