同步以太坊,配置rpc地址
mkdir /opt/blockchain
nohup geth --syncmode "fast" --cache=1024 --maxpeers 30 --datadir /opt/blockchain --rpc --rpcapi db,eth,net,web3,personal,admin,miner --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" &
https://www.51chain.net/portal/book/EthereumFrontierGuide/JSONRPCAPI-121.html
https://luren5.gitbooks.io/dapp-develop/content/43-调用json-rpc-api.html
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 1}' http://127.0.0.1:8545
# 返回 {"jsonrpc":"2.0","id":1,"result":"Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9.2"}
JSON-RPC methods
web3_clientVersion
web3_sha3
net_version
net_peerCount
net_listening
eth_protocolVersion
eth_syncing
eth_coinbase
eth_mining
eth_hashrate
eth_gasPrice
eth_accounts
eth_blockNumber
eth_getBalance
eth_getStorageAt
eth_getTransactionCount
eth_getBlockTransactionCountByHash
eth_getBlockTransactionCountByNumber
eth_getUncleCountByBlockHash
eth_getUncleCountByBlockNumber
eth_getCode
eth_sign
eth_sendTransaction
eth_sendRawTransaction
eth_call
eth_estimateGas
eth_getBlockByHash
eth_getBlockByNumber
eth_getTransactionByHash
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getTransactionReceipt
eth_getUncleByBlockHashAndIndex
eth_getUncleByBlockNumberAndIndex
eth_getCompilers
eth_compileLLL
eth_compileSolidity
eth_compileSerpent
eth_newFilter
eth_newBlockFilter
eth_newPendingTransactionFilter
eth_uninstallFilter
eth_getFilterChanges
eth_getFilterLogs
eth_getLogs
eth_getWork
eth_submitWork
eth_submitHashrate
db_putString
db_getString
db_putHex
db_getHex
shh_post
shh_version
shh_newIdentity
shh_hasIdentity
shh_newGroup
shh_addToGroup
shh_newFilter
shh_uninstallFilter
shh_getFilterChanges
shh_getMessages
# too many file open
prlimit -n150000 -p $(pidof geth)
# 关于 fast full light三种同步模式
Depending on your internet connection, and how fast your computer is, it can take a few hours, a few days, possibly even a few weeks. Yes, you can stop and resume at any time. It is a peer to peer technology that is designed to work with unstable networks, and with peers that go online and offline regularly. After you turn it back on it will pick up where it left off and start synchronizing again.
Geth has the `—fast` option which can be used the first time you start downloading the blockchain. This reduces the amount of data that has to be downloaded by cutting out the parts that don’t absolutely need to be there when you get the chain for the first time. This option only works if you are syncing the blockchain from the beginning though. If you stop it part way through you cannot resume in fast mode. After fast mode is complete, it automatically switches you to full mode going forward.
Geth also has the new experimental `—light` mode. Rather than downloading the complete chain, it downloads only the headers, then relies on the network for any other data it needs.
Using fast mode, the blockchain size will be about 30GB or less, but then will switch to full mode, and continue to grow at a faster pace. Using full mode, the blockchain size will probably be near or over 100GB. Using light mode, the blockchain size will be under 1GB.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?