基于区块链的毕业设计ETH – 以太

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计ETH – 以太 是一篇很好的国外资料

ETH - 以太 ETH - 以太

ETH

The essential Elixir library for interacting with Ethereum blockchain. You can now create Ethereum wallets, query the blockchain and sign/send transactions, all from Elixir / Erlang Virtual Machine.

Example

  wallet = ETH.Wallet.create   # %{eth_address: "0x31CF67A272A23C7A11128C97FC3B2F4C13AFD87F",   #   mnemonic_phrase: "similar bleak naive absorb picnic avoid sponsor canoe inform misery crisp hotel critic have parent couch wrong survey staff primary wet wear velvet horse",   #   private_key: "C8E2F24A806A422034990C7391B4CEB7133CD3680987FEBB5750555F99F0FC83",   #   public_key: "04C4AA07F234226CA90FB3E8BB1590D5BEB703E449700FE0B2DF539A948289EA75220CC837CA68F429F3FB3D6677B2D63CF66277888B8209D0B3F3229CE339654C"}    specific_private_key = "9756371A51D7FC25EDFC95A49DEF3806ED34DF2EBCA2065E543369E708C47374"   another_wallet = ETH.Wallet.create(specific_private_key)   # %{eth_address: "0x6A26B49D8046DC5B74D41E29F9A5CA7AD78EEC9B",   #   mnemonic_phrase: "nuclear random shoot photo lemon base retire naive pig urge sock assist spy hurdle road nephew alien verify art stable identify giraffe soccer mushroom",   #   private_key: "9756371A51D7FC25EDFC95A49DEF3806ED34DF2EBCA2065E543369E708C47374",   #   public_key: "04D1F70F6048D1E22FBEBBF3AF462E3356747AB2BB81EC269C600BE6A53C3223472AA336DF0060719C6F3AEC45E40AE57ED39735B61B8F5EF989466D46CA1B72C0"}    accounts_in_your_client = ETH.get_accounts   # ["0xfdf5d02f2082753dda0817492d6efff7e76e47aa",   #  "0xb9906b679aa8edd03fdf7fe396af4d9a77af4108",   #  "0xae6463bf32efc106ad4300d902e572e1c43e6e9c",   #  "0xb764c82ae23467be2cf90ab9019ee2464a3946f9",   #  "0xfc5b5a6cd171f4123439f28fad9986c70572b35f",   #  "0x7605c8812cfb51a7d2d16e598f521c9302d0ed7f",   #  "0x7dab29cc88c2ecd69ec216b7d089a82bb95fe1ad",   #  "0xba3a30f3c4fd2b4a44936b42ceea87ec3e53294a",   #  "0xb3f4869ce14d6bbd659dc5d2f9a515b58b2765d2",   #  "0x8c9cec7feacdbbf472ebcc4f61224d83c880896b"]    first_account_in_your_client = List.first(accounts_in_your_client)   first_account_private_key = "f121f608500f7e3379c813aa6df62864e35aa0b6cd11a2ff2c20ac84b5771fb2"    ETH.get_balance("0x31CF67A272A23C7A11128C97FC3B2F4C13AFD87F") # {:ok, 0} # this account holds no ether   ETH.get_balance!(first_account_in_your_client, :wei) # 1.0e20 -> in this example this address holds 100 ether / 1.0e20 wei    ETH.get_transaction_count(first_account_in_your_client) # {:ok, 0}    {:ok, tx_hash} = ETH.send_transaction(%{     from: first_account_in_your_client, to: wallet[:eth_address], value: 22   }, first_account_private_key)   # {:ok, "0x13893d677251ddb9259263490504f3e611a0a7bff23b108641d2cb08b7af21dc"}    ETH.get_transaction!(tx_hash)   # %{block_hash: "0xf9917088fc6750677cc1cfb4f7dcab453b21c7de2cb22ed7e6753df058bec5cf",   #   block_number: 1, from: "0xfdf5d02f2082753dda0817492d6efff7e76e47aa",   #   gas: 21000, gas_price: 20000000000,   #   hash: "0x13893d677251ddb9259263490504f3e611a0a7bff23b108641d2cb08b7af21dc",   #   input: "0", nonce: 0, to: "0x725316bb37d202b0eb203cd83238c31e983a7936",   #   transaction_index: 0, value: 22}    ETH.get_balance!(first_account_in_your_client) # 99.99958 # in ether   ETH.get_balance(wallet[:eth_address], :wei) # {:ok, 22.0} # in wei

Warning: This library uses the Ethereum JSON-RPC under the hood, so you need an ethereum client such as parity/geth or testrpc to use of most of the API.

Credits

  • Izel Nakri – I reverse engineered ethereum JavaScript libraries in Elixir so you don’t have to.

Additionally this library wouldnt exist without the libraries below:

  • ExRLP
  • Ethereumex
  • keccakf1600
  • libsecp256k1

NOTE:

To properly use this package, you will need to run rebar compile eunit for libsecp256k1.

TODO:

Ethereum Smart Contracts, small enhancements

Installation

If available in Hex, the package can be installed by adding eth to your list of dependencies in mix.exs:

def deps do   [     {:eth, "~> 0.3.0"}   ] end

Running the tests

Install a testrpc(now renamed to ganache-cli) to run ethereum locally: npm install -g ganache-cli

Elixir tests automatically spawns and kills the ganache-cli process. All you need to do now is to run the tests in sequence thus –seed 0: mix test --seed 0

The docs can be found at https://hexdocs.pm/eth.

Bump ex_doc from 0.23.0 to 0.25.1 (


ETH - 以太ETH - 以太

示例

以太坊eth区块链blockchain交互的基本长生不老药库。您现在可以从Elixir/Erlang虚拟机创建以太坊eth钱包、查询区块链blockchain和签署/发送交易

学分

  wallet = ETH.Wallet.create   # %{eth_address: "0x31CF67A272A23C7A11128C97FC3B2F4C13AFD87F",   #   mnemonic_phrase: "similar bleak naive absorb picnic avoid sponsor canoe inform misery crisp hotel critic have parent couch wrong survey staff primary wet wear velvet horse",   #   private_key: "C8E2F24A806A422034990C7391B4CEB7133CD3680987FEBB5750555F99F0FC83",   #   public_key: "04C4AA07F234226CA90FB3E8BB1590D5BEB703E449700FE0B2DF539A948289EA75220CC837CA68F429F3FB3D6677B2D63CF66277888B8209D0B3F3229CE339654C"}    specific_private_key = "9756371A51D7FC25EDFC95A49DEF3806ED34DF2EBCA2065E543369E708C47374"   another_wallet = ETH.Wallet.create(specific_private_key)   # %{eth_address: "0x6A26B49D8046DC5B74D41E29F9A5CA7AD78EEC9B",   #   mnemonic_phrase: "nuclear random shoot photo lemon base retire naive pig urge sock assist spy hurdle road nephew alien verify art stable identify giraffe soccer mushroom",   #   private_key: "9756371A51D7FC25EDFC95A49DEF3806ED34DF2EBCA2065E543369E708C47374",   #   public_key: "04D1F70F6048D1E22FBEBBF3AF462E3356747AB2BB81EC269C600BE6A53C3223472AA336DF0060719C6F3AEC45E40AE57ED39735B61B8F5EF989466D46CA1B72C0"}    accounts_in_your_client = ETH.get_accounts   # ["0xfdf5d02f2082753dda0817492d6efff7e76e47aa",   #  "0xb9906b679aa8edd03fdf7fe396af4d9a77af4108",   #  "0xae6463bf32efc106ad4300d902e572e1c43e6e9c",   #  "0xb764c82ae23467be2cf90ab9019ee2464a3946f9",   #  "0xfc5b5a6cd171f4123439f28fad9986c70572b35f",   #  "0x7605c8812cfb51a7d2d16e598f521c9302d0ed7f",   #  "0x7dab29cc88c2ecd69ec216b7d089a82bb95fe1ad",   #  "0xba3a30f3c4fd2b4a44936b42ceea87ec3e53294a",   #  "0xb3f4869ce14d6bbd659dc5d2f9a515b58b2765d2",   #  "0x8c9cec7feacdbbf472ebcc4f61224d83c880896b"]    first_account_in_your_client = List.first(accounts_in_your_client)   first_account_private_key = "f121f608500f7e3379c813aa6df62864e35aa0b6cd11a2ff2c20ac84b5771fb2"    ETH.get_balance("0x31CF67A272A23C7A11128C97FC3B2F4C13AFD87F") # {:ok, 0} # this account holds no ether   ETH.get_balance!(first_account_in_your_client, :wei) # 1.0e20 -> in this example this address holds 100 ether / 1.0e20 wei    ETH.get_transaction_count(first_account_in_your_client) # {:ok, 0}    {:ok, tx_hash} = ETH.send_transaction(%{     from: first_account_in_your_client, to: wallet[:eth_address], value: 22   }, first_account_private_key)   # {:ok, "0x13893d677251ddb9259263490504f3e611a0a7bff23b108641d2cb08b7af21dc"}    ETH.get_transaction!(tx_hash)   # %{block_hash: "0xf9917088fc6750677cc1cfb4f7dcab453b21c7de2cb22ed7e6753df058bec5cf",   #   block_number: 1, from: "0xfdf5d02f2082753dda0817492d6efff7e76e47aa",   #   gas: 21000, gas_price: 20000000000,   #   hash: "0x13893d677251ddb9259263490504f3e611a0a7bff23b108641d2cb08b7af21dc",   #   input: "0", nonce: 0, to: "0x725316bb37d202b0eb203cd83238c31e983a7936",   #   transaction_index: 0, value: 22}    ETH.get_balance!(first_account_in_your_client) # 99.99958 # in ether   ETH.get_balance(wallet[:eth_address], :wei) # {:ok, 22.0} # in wei

警告:此库在后台使用以太坊ethJSON-RPC,因此您需要一个以太坊eth客户端,如parity/geth或testrpc来使用大部分API

注意:

  • Izel Nakri-I在Elixir中反向工程以太坊ethJavaScript库,因此您不必这样做

此外,如果没有以下库,此库将不存在:

待办事项:

要正确使用此软件包,您需要为libsecp256k1运行rebar compile eunit

安装

如果有十六进制版本,可以通过在mix.exs中将eth添加到依赖项列表中来安装该软件包:

运行测试

安装testrpc(现在重命名为ganache cli)以在本地运行以太坊eth:npm Install-g ganache cli

def deps do   [     {:eth, "~> 0.3.0"}   ] end

Running the tests

Elixir测试自动生成并终止ganache cli进程。您现在需要做的就是按顺序运行测试,因此–seed 0:mix test–seed 0

可以在https://hexdocs.pm/eth.

The docs can be found at https://hexdocs.pm/eth.

Bump ex_doc from 0.23.0 to 0.25.1 (

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/23506.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计ETH – 以太

提供最优质的资源集合

立即查看 了解详情