干货|以太坊同步模式源码解析

Redis Lua引擎UAF漏洞CVE-2025-49844深度剖析与复现实践 内存安全是软件系统稳定性的基石,其核心原理在于确保程序对内存的访问始终处于合法、受控的状态。在C/C++等手动管理内存的语言中,Use-After-Free(释放后使用)是一种典型的高危内存安全漏洞,它源于已释放的内存区域仍被程序指针引用,导致数据混乱或程序崩溃。这类漏洞的技术价值在于其往往能突破高级语言的安全边界,直接威胁进程本身,危害等级极高,常见于数据库、浏览器等核心基础设施。在Redis这样的高性能内存数据库中,其内置的Lua脚本引擎为复杂操作提供了强大支持,但同时也引入了沙箱环境下的复杂内存对象生 阅读详情

image

以太坊节点同步的时候支持三种模式:fast,light,full。而官方文档中已经明确–fast和–light参数选项已经被废弃。那么本篇博客就带大家看一下关于此参数的源代码,深入了解同步模式的底层转变。

1

方法定义源代码解析

首选从源代码中找到eth/downloader/modes.go。从文件的名字就可得知此文件是用来定义模式的,所谓modes就是指的同步模式。下面我们看一下此文件内的所有源代码,然后再逐一分析。

package downloader

import “fmt”

// SyncMode represents the synchronisation mode of the downloader.

type SyncMode int

const (

   FullSync  SyncMode = iota // Synchronise the entire blockchain history from full blocks

   FastSync                  // Quickly download the headers, full sync only at the chain head

   LightSync                 // Download only the headers and terminate afterwards

)

func (mode SyncMode) IsValid() bool {

   return mode >= FullSync && mode <= LightSync

}

// String implements the stringer interface.

func (mode SyncMode) String() string {

   switch mode {

   case FullSync:

       return “full”

   case FastSync:

       return “fast”

   case LightSync:

       return “light”

   default:

       return “unknown”

   }

}

func (mode SyncMode) MarshalText() ([]byte, error) {

   switch mode {

   case FullSync:

       return []byte(“full”), nil

   case FastSync:

       return []byte(“fast”), nil

   case LightSync:

       return []byte(“light”), nil

   default:

       return nil, fmt.Errorf(“unknown sync mode %d”, mode)

   }

}

func (mode *SyncMode) UnmarshalText(text []byte) error {

   switch string(text) {

   case “full”:

       *mode = FullSync

   case “fast”:

       *mode = FastSync

   case “light”:

       *mode = LightSync

   default:

       return fmt.Errorf(unknown sync mode %q, want "full", "fast" or "light", text)

   }

   return nil

}

SyncMode类型定义

type SyncMode int

同步的类型是SyncMode,而SyncMode的真实类型是int。

SyncMode常量定义

const (

   FullSync  SyncMode = iota // 同步完整的区块信息

   FastSync                  // 快速同步header,然后再跟进header同步全部内容

   LightSync                 // 只下载header并在之后终止

)

const常量的定义给不同模式分别赋值:

  • full:0

  • fast: 1

  • light: 2

String接口实现

此段代码实现了stringer的接口,当被调用时会返回对应的字符串描述:full,fast,light,unknown。此方法类似与Java中的toString方法。

// String implements the stringer interface.

func (mode SyncMode) String() string {

   switch mode {

   case FullSync:

       return “full”

   case FastSync:

       return “fast”

   case LightSync:

       return “light”

   default:

       return “unknown”

   }

}

IsValid方法

func (mode SyncMode) IsValid() bool {

   return mode >= FullSync && mode <= LightSync

}

此方法比较简单,当传入的mode大于等于0并且小于等于2时返回true。可以简单理解为是一个合法性的校验。

TextMarshaler方法实现

func (mode SyncMode) MarshalText() ([]byte, error) {

   switch mode {

   case FullSync:

       return []byte(“full”), nil

   case FastSync:

       return []byte(“fast”), nil

   case LightSync:

       return []byte(“light”), nil

   default:

       return nil, fmt.Errorf(“unknown sync mode %d”, mode)

   }

}

此方法实现了encoding包下的TextMarshaler接口的MarshalText方法,根据传入的同步类型值返回字符串编码(UTF-8-encoded)之后的文本内容。可以简单理解为SyncMode(int)和文本内容的转换。

UnmarshalText方法实现

func (mode *SyncMode) UnmarshalText(text []byte) error {

   switch string(text) {

   case “full”:

       *mode = FullSync

   case “fast”:

       *mode = FastSync

   case “light”:

       *mode = LightSync

   default:

       return fmt.Errorf(unknown sync mode %q, want "full", "fast" or "light", text)

   }

   return nil

}

此方法实现了encoding包下的TextUnmarshaler接口的UnmarshalText方法,根据传入的文本内容返回SyncMode类型对应的值。可以简单理解为文本内容和SyncMode(int)的转换。

2

方法使用源代码解析

上面我们了解了同步模式的类型和方法定义,现在我们就看一下同步的过程中是怎么使用的。

默认同步模式的定义

在cmd/utils/flags.go文件内定义了项目启动时的基本配置参数,我们可以找到此段代码:

defaultSyncMode = eth.DefaultConfig.SyncMode

   SyncModeFlag    = TextMarshalerFlag{

       Name:  “syncmode”,

       Usage: Blockchain sync mode ("fast", "full", or "light"),

       Value: &defaultSyncMode,

   }

这里定义了默认的同步模式,也就是说如果不传递参数时,同步模式就是按照这里的定义来执行。进一步看一下eth.DefaultConfig.SyncMode的值为多少:

var DefaultConfig = Config{

   SyncMode: downloader.FastSync,

   Ethash: ethash.Config{

       CacheDir:       “ethash”,

       CachesInMem:    2,

       CachesOnDisk:   3,

       DatasetsInMem:  1,

       DatasetsOnDisk: 2,

   },

   NetworkId:     1,

   LightPeers:    100,

   DatabaseCache: 768,

   TrieCache:     256,

   TrieTimeout:   5 * time.Minute,

   GasPrice:      big.NewInt(18 * params.Shannon),

   TxPool: core.DefaultTxPoolConfig,

   GPO: gasprice.Config{

       Blocks:     20,

       Percentile: 60,

   },

}

大家已经看到了,默认的值为downloader.FastSync,至此已经得知如果不传递同步类型参数,geth采用fast模式进行同步。

同步模式中途的变更

经过上面的代码分析我们是否就确定,如果不传递参数geth一直就是通过fast模式进行同步的么?那么,再看看下面的代码分析吧。

在eth/handler.go中方法NewProtocolManager中有这样一段代码:

// Figure out whether to allow fast sync or not

   if mode == downloader.FastSync && blockchain.CurrentBlock().NumberU64() > 0 {

       log.Warn(“Blockchain not empty, fast sync disabled”)

       mode = downloader.FullSync

   }

   if mode == downloader.FastSync {

       manager.fastSync = uint32(1)

   }

这段代码是在创建ProtocolManager时进行同步模式的参数设置。blockchain.CurrentBlock()获得当前的区块信息,而NumberU64()的实现如下:

func (b *Block) NumberU64() uint64        { return b.header.Number.Uint64() }

也就是说NumberU64()返回的是最新区块的头部的number。

现在整理一下这段代码的整体逻辑就是,当同步模式为fast并最新区块的高度大于0(已经同步过一部分数据)时,程序自动将同步模式转变为full,并打印警告信息。到这里,整个区块的同步模式已经豁然开朗了。

3

归纳总结

通过上面代付的分析,我们得到以下结论:

  • geth支持三种同步模式:fast,full,light。

  • 启动geth节点时,如果不传递同步模式参数,默认使用fast模式进行同步。

  • 如果不传递同步模式参数或传递fast,第一次启动默认使用fast并且当前区块为0,因此采用fast进行同步。

  • 如果不传递同步模式或传递fast,第二次启动默认使用fast,但当前区块的header编号不为0,程序自动将fast模式转变为full模式。

  • 因此,同步区块数据量的多少与使用full时的时机有一定关系。

内容来源:程序新视界

作者:二师兄

以下是我们的社区介绍,欢迎各种合作、交流、学习:)

image

第5课 SQL入门之高级数据过滤 如何用AND和OR操作符组合成WHERE子句;如何明确地管理求值顺序,如何使用IN和NOT操作符 阅读详情

相关推荐

【软件测试】在Windows环境安装Docker(详细步骤)

下载和安装,直接下载2、先检查是否开启电脑的虚拟化依次控制面板->程序->启用或关闭Windows功能,把Hyper-v勾上。勾选后重启电脑3、开启后双击下载的 "Docker Desktop Installer.exe"进行安装,直接一直选择下一步即可。4、安装好后在cmd输入 docker -v检查是否安装成功看到上图显示了docker的版本号,说明已安装成功。dcoker的使用1、启动dcoker安装完成后双击桌面的图标,即可启动。启动前可设置镜像加速地址,也可不设。

m0_60054525的博客 4584

以太坊同步模式源码解析

以太坊节点同步的时候支持三种模式:fast,light,full。而官方文档中已经明确–fast和–light参数选项已经被废弃。那么本篇博客就带大家看一下关于此参数的源代码,深入了解同步模式的底层转变。 方法定义源代码解析 首选从源代码中找到eth/downloader/modes.go。从文件的名字就可得知此文件是用来定义模式的,所谓modes就是指的同步模式。下面我们看一下此...

程序新视界 6428

WSL2里CUDA装错了别慌!手把手教你用cuda-uninstaller彻底卸载(附环境变量清理)

本文详细介绍了在WSL2环境中彻底卸载CUDA的完整指南,包括使用官方工具cuda-uninstaller、手动清理残留文件和环境变量重置。针对WSL2的特殊架构,提供了专业开发者的卸载技巧和预防措施,确保零残留卸载,避免影响Windows主机的NVIDIA驱动。

weixin_28732953的博客 146

geth -h 最新版的geth参数

geth -hNAME:USAGE:VERSION:COMMANDS:ACCOUNTpaths.no cap)

做工作不具体化,想问题就会简单化 915

知识图谱本体建模之RDF、RDFS、OWL详解

(一)知识图谱本体建模之RDF、RDFS、OWL详解 1.语义网体系 知识图谱于2012年由Google提出,并不是新概念,而是由语义网络(Semantic Network)衍生而来。语义网络由相互连接的节点和边组成,节点表示概念或者对象,边表示他们之间的关系。RDF,RDFS与OWL都是基于语义网的知识表示框架,在节点和边的取值上做了约束,制定了统一标准,为多源数据的融合提供了便利。RDF,RDFS/OWL 属于语义网技术栈,它们的提出,使得语义网克服了语义网络的缺点。其语义网技术栈如下所示。 2.RD

周周的专栏 1万+

零基础搭建本地AI绘画环境:Stable Diffusion 3.5保姆级安装教程(含中文优化方案)

本文提供零基础搭建本地AI绘画环境的详细教程,重点介绍Stable Diffusion 3.5的安装与中文优化方案。从硬件配置检查到软件依赖安装,再到核心组件配置与中文语义增强,教程涵盖全流程操作指南,帮助用户快速掌握AI文生图模型的本地部署技巧,提升创作效率。

weixin_30752699的博客 324

【我的区块链之路】- 以太坊源码剖析之Geth节点启动全量过程详解

【转载请标明出处】https://blog.csdn.net/qq_25870633/article/details/82992805 最近在整理前端时间学习的源码,由于源码的学习是片段的,那么我们在这篇文章中把它关联起来,这篇文章我们讲P2P部分,我们会从Geth的入口一直到后面的节点发现,节点间广播及同步TX和Block的讲解。首先,我这里先不说fetcher 及downloader的具体工...

qq_25870633的博客 3338

Keil MDK打开别人工程总报错?手把手教你修复‘找不到main.o’和‘未定义’的路径问题

本文详细解析Keil MDK工程移植时常见的'找不到main.o'和'未定义'编译错误,提供从路径修复到宏定义配置的完整解决方案。通过系统化的检查清单和预防措施,帮助开发者快速解决MDK工程迁移问题,提升嵌入式开发效率。

weixin_28724661的博客 404

以太坊Geth几种同步模式

同步模式分类–fast Enable fast syncing through state downloads–light Enable light client mode–syncmode full在Geth1.6版本,–fast参数已经改为–syncmode=fast,当然–fast依旧有效。full模式也一样如此。Full同步步骤:获取区块的header获取区块的body从创始块开始校验没一个

程序新视界 2万+

STM32F103C8T6飞控入门:从零开始,用HAL库和MPU6050搭建你的第一架四轴无人机

本文详细介绍了如何使用STM32F103C8T6和MPU6050模块从零开始搭建四轴无人机飞控系统。通过硬件选型、电路设计、HAL库配置、姿态解算算法实现以及PID控制等步骤,帮助创客和嵌入式爱好者快速入门飞控开发。文章还提供了实用的调试技巧和常见问题解决方案,适合想要掌握四旋翼无人机核心技术的开发者。

weixin_42524750的博客 273

基于STM32的心率血氧手环设计(代码+原理图+PCB)

摘要: 本文设计并实现了一款基于STM32F103C8T6微控制器的多功能心率血氧手环系统,集成了MAX30102传感器(心率/血氧)、ADXL345加速度计(计步)、DS18B20温度传感器(体温)等模块,通过OLED屏本地显示数据,并支持蓝牙(BT04-A模块)与手机APP通信。系统具备自动报警(蜂鸣器触发异常阈值)、手动控制(步数清零/LED照明)及双模式切换功能。测试表明,心率误差≤±2次/分,血氧误差≤±2%,计步准确率>98%,体温误差≤±0.3℃,蓝牙通信稳定。该系统成本低、体积小,为日常健康

3254968421的博客 90

Ethereum geth 同步区块的三种模式

Ethereum(以太坊)当前交易多,截止当前(2018-02-04)已经有5029238个区块,区块大小在150G左右。 如果全部同步,并且严格逐个验证,需要太多的时间和计算。作者曾经用一台实体机,8核,16GB内存,2TB机械硬盘的dell立式服务器,在办公网络下同步区块,结果半个月没有同步完,同步的速度还没有新出区块的速度快。。。。 查找了一下,以太坊有三种同步的模式,full, fa

Archmage的专栏 1万+

ZeroClaw安装、使用方法详细全解

ZeroClaw 是一个用 Rust 编写的轻量级、高性能、完全自主的 AI 助手运行时框架

洛星核的博客 629

从命令行开始解析同步区块的代码

从命令行开始解析同步区块的代码 一.同步简介 我们都知道geth支持三种同步模式 fast模式:从开始到结束,获取区块的header,获取区块的body,从创始块开始校验每一个元素,需要下载所有区块数据信息。速度最慢,但是能获取到所有的历史数据。 full模式:获取区块的header,获取区块的body,在同步到当前块之前不处理任何事务。然后获得一个快照,此后,像full节点一样进行后...

Hacker的博客 802

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

节点同步light、fast、full的区别

0x01 同步模式简介 安装好 geth 之后,运行 geth --help, 你就可以看到下面的命令行说明 ... ETHEREUM OPTIONS: ... --syncmode "fast" Blockchain sync mode ("fast", "full", or "light") ... DEPRECATED OPTIONS: --fast Enable...

wordCIoT的博客 1890

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

以太坊加速区块同步方法

以太坊加速区块同步方法无论是使用图形界面或geth客户端进行节点数据同步时都会是一个漫长的过程。中间还会因为链接其他节点失败导致迟迟无法同步数据,一直打印错误日志。 主要原因是国内节点数过少,外加国内网络的特殊限制。EthFans发起的星火节点计划,组织国内对以太坊项目感兴趣的组织和个人自愿运行超级节点,星火节点的信息将被打包到node(节点)文件中,让社区成员自由下载,连接到更多超级节点,加快同

程序新视界 1万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

以太坊源码深入分析(5)-- Ethereum服务和以太坊P2P协议发送广播源码分析

在“以太坊源码深入分析(2)”一文中,我们提到Ethereum作为一个service,被Node 注册进去。Node start的时候会启动其注册的所有服务,Ethereum service也是一样。一,ethereum service的初始化和启动初始化方法func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) ...

cj2094的博客 2358

以太坊节点启动及同步方式

Go-ethereum同步轻节点 0.前置知识 节点:客户端的软件。全节点、轻节点 客户端:一种以太坊的实现,提供RPC API端点方便用户控制客户端,标准的JSON RPC每个客户端都可以使用。geth、OpenEthereum(停止维护) 轻量同步:下载所有区块头、区块数据并对其进行随机验证 通过客户端与以太坊网络进行交互: -使用合适的协议(eg.curl)手动调用 -附加一个控制台(geth attach) -应用程序中执行 1.安装所需基础工具 yum update -y && y

BradMoon的博客 6480

ETH-服务节点部署(全网最新)

ETH-服务节点部署(全网最新)

HYXRX的博客 7793

geth 命令说明

geth 命令说明

fghvjh的博客 765

以太坊客户端Geth命令用法-参数详解

最新内容会更新在主站深入浅出区块链社区 原文链接:以太坊客户端Geth命令用法-参数详解 Geth在以太坊智能合约开发中最常用的工具(必备开发工具),一个多用途的命令行工具。 熟悉Geth可以让我们有更好的效率,大家可收藏起来作为Geth命令用法手册。 本文主要是对geth help的翻译,基于最新的geth 1.7.3-stable版本。 如果你还不知道geth是什么,请先阅读入门篇:以太坊是什...

weixin_30298497的博客 1201

以太坊源码情景分析之区块(block)数据同步之主动同步

主动同步   同步入口     主动同步有好几个主要场景 geth刚启动 新peer加入 定时sync     后面两个场景入口都在ProtocolManager.syncer func (pm *ProtocolManager) syncer() {     // Start and ensure cleanup of sync mechanisms     pm.fetche...

chunqizhi 1517

区块链Geth的fast模式

想了解更多区块链技术,请百度【链客区块链技术问答社区】进入。 大家在通过geth的fast模式做区块同步时,都会经历长时间的等待,即区块一直停留在70个左右同步不完的情况,并且持续的打印Imported new state entries信息,这个的原因已经在 同步始终不完成,且一直打印Imported new state entries这篇文章里有详细描述,如果在日志里不再看到无休止的Imp...

weixin_44172023的博客 1541

以太坊数据同步常见问题集锦

以太坊数据同步是新手入门的必经阶段,在技术讨论群中(659809063)经常重复的被提问到。这篇博文就给大家整理一下常见的问题列表,以便大家学习。 常见问题列表 区块差几十块始终同步不完,怎么办? 这是大家同步数据遇到的第一个难题。当大家兴致匆匆的启动程序,看着区块离最新的区块越来越近,难免兴奋起来。但当差十几块或几十块的时候,却是漫长的等待,于是忍不住要问,出什么问题了吗?...

程序新视界 1万+

同比 数据模型 环比_同比和环比计算公式?

展开全部一、同比增长计算公式:1、同比增长率=(本期数-同期数)÷同期数×100%例子:比如说去年3月的产32313133353236313431303231363533e4b893e5b19e31333365666237值100万,本年3月的产值300万,同比增长率是多少?本题中,同比增长率=(300-100)÷100=200%2、当同期数为负值的情况,公式应当完善如下:同比增长率=(本期数-同...

weixin_30070961的博客 2369
上一篇: 安装Solidity编译器-Solidity官方文档(2)
下一篇: 干货|破解遗传算法——CryptoPups旺财,基于以太坊的区块链游戏(分享实录)
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址