跳转至主要内容
插图:未来城市,代表以太坊生态系统。

Welcome to Ethereum

The leading platform for innovative apps and blockchain networks

Use cases

A new way to use the internet

Crypto without volatility

Stablecoins are currencies that maintain stable value. Their price matches the U.S. dollar or other steady assets.

Learn more

更加公平的金融系统

无数人无法开立银行账户或无法自由使用自己的钱。而以太坊的金融系统始终保持公开公正。

探索去中心化金融

众网之网

以太坊是区块链创新的中心。最好的项目均构建于以太坊之上。

探索益处

创新应用程序

以太坊应用程序在运行时不会出售你的数据。请保护好你的隐私。

浏览应用程序

资产互联网

艺术品、证书,甚至房地产都可以代币化。任何物品都可以成为可交易代币,所有权完全公开、可以验证。

关于非同质化代币的更多信息
Activity

The strongest ecosystem

Activity from all Ethereum networks

$180.8B
Value locked in DeFi  
$137.2B
Average transaction cost  
$0.0043
Average transaction cost  
14.98M
Average transaction cost  
Learn

Understand Ethereum

Crypto can feel overwhelming. Don't worry, these materials are designed to help you understand Ethereum in just a few minutes.

Values

The internet is changing

Be part of the digital revolution

Legacy

Ethereum

Builders

Blockchain's biggest builder community

Ethereum is home to Web3's largest and most vibrant developer ecosystem. Use JavaScript and Python, or learn a smart contract language like Solidity or Vyper to write your own app.

Code examples

1// SPDX-License-Identifier: MIT
2pragmasolidity^0.8.1;
3
4// This is a smart contract - a program that can be deployed to the Ethereum blockchain.
5contractSimpleWallet{
6// An 'address' is comparable to an email address - it's used to identify an account on Ethereum.
7addresspayableprivate owner;
8
9// Events allow for logging of activity on the blockchain.
10// Software applications can listen for events in order to react to contract state changes.
11eventLogDeposit(uint amount,addressindexed sender);
12eventLogWithdrawal(uint amount,addressindexed recipient);
13
14 // When this contract is deployed, set the deploying address as the owner of the contract.
15constructor(){
16 owner=payable(msg.sender);
17}
18
19// Send ETH from the function caller to the SimpleWallet contract
20functiondeposit()publicpayable{
21require(msg.value>0,"Must send ETH.");
22emitLogDeposit(msg.value, msg.sender);
23}
24
25// Send ETH from the SimpleWallet contract to a chosen recipient
26functionwithdraw(uint amount,addresspayable recipient)public{
27require(msg.sender== owner,"Only the owner of this wallet can withdraw.");
28require(address(this).balance>= amount,"Not enough funds.");
29emitLogWithdrawal(amount, recipient);
30 recipient.transfer(amount);
31}
32}

1// SPDX-License-Identifier: MIT
2pragmasolidity^0.8.1;
3
4// This is a smart contract - a program that can be deployed to the Ethereum blockchain.
5contractSimpleToken{
6// An `address` is comparable to an email address - it's used to identify an account on Ethereum.
7addresspublic owner;
8uint256publicconstant token_supply=1000000000000;
9
10// A `mapping` is essentially a hash table data structure.
11// This `mapping` assigns an unsigned integer (the token balance) to an address (the token holder).
12mapping(address=>uint)public balances;
13
14
15 // When 'SimpleToken' contract is deployed:
16 // 1. set the deploying address as the owner of the contract
17 // 2. set the token balance of the owner to the total token supply
18constructor(){
19 owner= msg.sender;
20 balances[owner]= token_supply;
21}
22
23// Sends an amount of tokens from any caller to any address.
24functiontransfer(address receiver,uint amount)public{
25// The sender must have enough tokens to send
26require(amount<= balances[msg.sender],"Insufficient balance.");
27
28// Adjusts token balances of the two addresses
29 balances[msg.sender]-= amount;
30 balances[receiver]+= amount;
31}
32}

1const ethers=require("ethers")
2
3// Create a wallet instance from a mnemonic...
4const mnemonic=
5"announce room limb pattern dry unit scale effort smooth jazz weasel alcohol"
6const walletMnemonic= ethers.Wallet.fromMnemonic(mnemonic)
7
8// ...or from a private key
9const walletPrivateKey=newethers.Wallet(walletMnemonic.privateKey)
10
11// ...or create a wallet from a random private key
12const randomWallet= ethers.Wallet.createRandom()
13
14walletMnemonic.address
15// '0x71CB05EE1b1F506fF321Da3dac38f25c0c9ce6E1'
16
17// The internal cryptographic components
18walletMnemonic.privateKey
19// '0x1da6847600b0ee25e9ad9a52abbd786dd2502fa4005dd5af9310b7cc7a3b25db'
20walletMnemonic.publicKey
21// '0x04b9e72dfd423bcf95b3801ac93f4392be5ff22143f9980eb78b3a860c...d64'
22
23const tx={
24 to:"0x8ba1f109551bD432803012645Ac136ddd64DBA72",
25 value: ethers.utils.parseEther("1.0"),
26}
27
28// Sign a transaction
29walletMnemonic.signTransaction(tx)
30// { Promise: '0xf865808080948ba1f109551bd432803012645ac136ddd6...dfc' }
31
32// Connect to the Ethereum network using a provider
33const wallet= walletMnemonic.connect(provider)
34
35// Query the network
36wallet.getBalance()
37// { Promise: { BigNumber: "42" } }
38wallet.getTransactionCount()
39// { Promise: 0 }
40
41// Send ether
42wallet.sendTransaction(tx)
43
44// Content adapted from ethers documentation by Richard Moore
45// https://docs.ethers.io/v5/api/signer/#Wallet
46// https://github.com/ethers-io/ethers.js/blob/master/docs/v5/api/signer/README.md#methods
47// Content is licensed under the Creative Commons License:
48// https://choosealicense.com/licenses/cc-by-4.0/

1// SPDX-License-Identifier: MIT
2pragmasolidity^0.8.1;
3
4// This is a smart contract - a program that can be deployed to the Ethereum blockchain.
5contractSimpleDomainRegistry{
6
7addresspublic owner;
8// Hypothetical cost to register a domain name
9uintconstantpublic DOMAIN_NAME_COST=1 ether;
10
11// A `mapping` is essentially a hash table data structure.
12// This `mapping` assigns an address (the domain holder) to a string (the domain name).
13mapping(string=>address)public domainNames;
14
15
16 // When 'SimpleDomainRegistry' contract is deployed,
17 // set the deploying address as the owner of the contract.
18constructor(){
19 owner= msg.sender;
20}
21
22// Registers a domain name (if not already registered)
23functionregister(stringmemory domainName)publicpayable{
24require(msg.value>= DOMAIN_NAME_COST,"Insufficient amount.");
25require(domainNames[domainName]==address(0),"Domain name already registered.");
26 domainNames[domainName]= msg.sender;
27}
28
29// Transfers a domain name to another address
30functiontransfer(address receiver,stringmemory domainName)public{
31require(domainNames[domainName]== msg.sender,"Only the domain name owner can transfer.");
32 domainNames[domainName]= receiver;
33}
34
35// Withdraw funds from contract
36functionwithdraw()public{
37require(msg.sender== owner,"Only the contract owner can withdraw.");
38payable(msg.sender).transfer(address(this).balance);
39}
40}

Built by the community

The ethereum.org website is built and maintained by hundreds of translators, coders, designers, copywriters, and enthusiastic community members each month.

Come ask questions, connect with people around the world and contribute to the website. You will get relevant practical experience and be guided during the process!

Recent posts

The latest blog posts and updates from the community

Events

Ethereum communities host events all around the globe, all year long