基于区块链的毕业设计ethereum-toolkit – 以太坊工具箱
本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计ethereum-toolkit – 以太坊工具箱 是一篇很好的国外资料
ethereum-toolkit
Basic Rust code for parsing Ethereum and Ethereum Classic Block JSON logs. When looking at Eth logs, I like to start with Python or Ruby interactively in a REPL. But then for repeatable, working code, I prefer a well typed language like Rust. Once a number of support functions and definitions are written, I find it faster to work with data. This repo contains much of this basic support, including Newtypes for simple value types and structs for strongly typed JSON deserialization.
I wrote this to create scripts, leveraging Rust’s great type system. The code assumes there’s a JSON file with an array of Blocks and their transactions.
To use it, change the file path at the top to point to a log file you want to inspect:
const FILE_DATA: &str = include_str!("../eth_log.json");
Then add code to the main()
function to examine and query the blockchain:
fn main() { let blockchain_file: Blockchain = serde_json::from_str(FILE_DATA).unwrap(); let cleaned_up_blockchain = blockchain_file.de_dup(); let common_ancestors = duplicated_parents(&cleaned_up_blockchain); let _block_by_hash = make_lookup_by_hash(&cleaned_up_blockchain); println!( "Number of duplicate Parent references (reorgs): {}n", common_ancestors.len() ); }
以太坊eth工具箱
用于解析以太坊eth和以太坊eth经典块JSON日志的基本Rust代码。在查看Eth日志时,我喜欢在REPL中以交互方式从Python或Ruby开始。但是对于可重复的工作代码,我更喜欢像Rust这样的类型良好的语言。一旦编写了许多支持函数和定义,我发现处理数据会更快。这个repo包含很多基本的支持,包括简单值类型的newtype和强类型JSON反序列化的struct。
我写这篇文章是为了创建脚本,利用Rust强大的类型系统。代码假定有一个JSON文件,其中包含一个块数组及其事务。
要使用它,请更改顶部的文件路径以指向要检查的日志文件:
const FILE_DATA: &str = include_str!("../eth_log.json");
然后向main()函数添加代码,以检查和查询区块链blockchain:
fn main() { let blockchain_file: Blockchain = serde_json::from_str(FILE_DATA).unwrap(); let cleaned_up_blockchain = blockchain_file.de_dup(); let common_ancestors = duplicated_parents(&cleaned_up_blockchain); let _block_by_hash = make_lookup_by_hash(&cleaned_up_blockchain); println!( "Number of duplicate Parent references (reorgs): {}n", common_ancestors.len() ); }
部分转自网络,侵权联系删除区块链源码网
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计ethereum-toolkit – 以太坊工具箱