以太坊交易池分析

简介 以太坊交易池有以下功能: 缓存交易 清理交易 实现交易gasPrice竞价功能 配合出块,提供打包交易 交易查询 配置 配置描述 geth中用数据结构TxPoolConfig描述交易池配置,具体如下: ...

May 15, 2018

以太坊提交交易流程分析

说明 代码基于go-ethereum,版本v1.8.10。 RPC代码入口 SendTransaction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // SendTransaction will create a transaction from the given arguments and // tries to sign it with the key associated with args.To. If the given passwd isn't // able to decrypt the key it fails. func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error) { if args.Nonce == nil { // Hold the addresse's mutex around signing to prevent concurrent assignment of // the same nonce to multiple accounts. s.nonceLock.LockAddr(args.From) defer s.nonceLock.UnlockAddr(args.From) } signed, err := s.signTransaction(ctx, args, passwd) if err != nil { return common.Hash{}, err } return submitTransaction(ctx, s.b, signed) } SendTxArgs的数据结构如下: ...

May 5, 2018