ETH源码学习(2)GetBalance
从这开始读,因为最简单。还能对重要的东西有所理解。如果是单节点debug,重启链之后余额会归零,所以最少要两个节点,同步区块就没这个问题了,具体原因还未知。 声明:eth版本:Geth/v1.10.7-unstable/darwin-arm64/go1.17.5,我对比了网上的一些文章,这块代码有改动,主要以下改变从BlockChain的snap中读account几乎放弃从trie中获取account,判断极为严苛,我想不到有什么情况能进入,应该是放弃了这层分析入口//命令 eth.getBalance('0x0d7dd6dbabee2ec9b325aa7aa8b42d75068e8597') //入口 func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) { //获取statedb state, _, err := s.b.StateAndHea...
Ether.js+Web3modal基础使用
1.说明现在网站会提供很多种钱包,web3modal可以提供统一的provider,不需要你操心太多东西用ether.js而不是web3.js的原因是简单,爽2.安装npm i web3modal npm i ethers //另外还需要安装对应wallet的包,自行搜索就行 3.连接钱包// MM默认就有,无需显式加入 const providerOptions = { walletconnect: { package: walletconnectProvider, options: { infuraId: "", }, }, }; //构建Web3Modal对象 const web3Modal = new Web3Modal({ //缓存provider cacheProvider: true, providerOptions, }); //连接wallet async function connect() { try { const web3ModalProvider = await web3Modal.connect(); provider = new ethers.pr...
ETH源码学习(1)创建私有链
下载geth,创建genesis.json{ "config": { "chainId": 8888, //自行修改 "homesteadBlock": 0, "daoForkBlock": 0, "daoForkSupport": true, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "ethash": {} }, "nonce": "0x42", "timestamp": "0x0", "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", "gasLimit": "0xffffffff", "difficulty": "0x700000",//难度,越大挖矿越慢 "alloc": { "093f59f1d91017d30d8c2caa78feb5beb0d2cfaf...
ETH源码学习(2)GetBalance
从这开始读,因为最简单。还能对重要的东西有所理解。如果是单节点debug,重启链之后余额会归零,所以最少要两个节点,同步区块就没这个问题了,具体原因还未知。 声明:eth版本:Geth/v1.10.7-unstable/darwin-arm64/go1.17.5,我对比了网上的一些文章,这块代码有改动,主要以下改变从BlockChain的snap中读account几乎放弃从trie中获取account,判断极为严苛,我想不到有什么情况能进入,应该是放弃了这层分析入口//命令 eth.getBalance('0x0d7dd6dbabee2ec9b325aa7aa8b42d75068e8597') //入口 func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) { //获取statedb state, _, err := s.b.StateAndHea...
Ether.js+Web3modal基础使用
1.说明现在网站会提供很多种钱包,web3modal可以提供统一的provider,不需要你操心太多东西用ether.js而不是web3.js的原因是简单,爽2.安装npm i web3modal npm i ethers //另外还需要安装对应wallet的包,自行搜索就行 3.连接钱包// MM默认就有,无需显式加入 const providerOptions = { walletconnect: { package: walletconnectProvider, options: { infuraId: "", }, }, }; //构建Web3Modal对象 const web3Modal = new Web3Modal({ //缓存provider cacheProvider: true, providerOptions, }); //连接wallet async function connect() { try { const web3ModalProvider = await web3Modal.connect(); provider = new ethers.pr...
ETH源码学习(1)创建私有链
下载geth,创建genesis.json{ "config": { "chainId": 8888, //自行修改 "homesteadBlock": 0, "daoForkBlock": 0, "daoForkSupport": true, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "ethash": {} }, "nonce": "0x42", "timestamp": "0x0", "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", "gasLimit": "0xffffffff", "difficulty": "0x700000",//难度,越大挖矿越慢 "alloc": { "093f59f1d91017d30d8c2caa78feb5beb0d2cfaf...
Share Dialog
Share Dialog
Subscribe to point
Subscribe to point
http:/exnew.finding3.io/jdDetail?id=181&color-theme=light&desc=&has-h-padding=true&has-v-padding=true&modules=comment&receiver=0x39Ef50bd29Ae125FE10C6a909E42e1C6a94Dde29&target_uri=baidu.com&height=800&display=iframe
http:/exnew.finding3.io/jdDetail?id=181&color-theme=light&desc=&has-h-padding=true&has-v-padding=true&modules=comment&receiver=0x39Ef50bd29Ae125FE10C6a909E42e1C6a94Dde29&target_uri=baidu.com&height=800&display=iframe
<100 subscribers
<100 subscribers
No activity yet