Blockchain code Metaverse VR

SmartContract×VR×Crypto(626)

スポンサーリンク

//tips

//smart contract

1日1回テストネットワークmumbaiのmaticを取得する。

https://faucet.polygon.technology/

https://mumbaifaucet.com/

現在のeth本番環境での適切なgaspriceとgaslimitの組み合わせを探した。

gaspriceはgas stationのgas priceを確認し、これはgweiなのでweiに直してtruffle-config.jsに記載。

https://ethgasstation.info/

Gaslimitはtruffleではgasで設定することになる。deployの場合、送金時とは異なるので21000一律というわけにはいかなさそうなので、テストネットでの検証で使用量gas used: 2812519を参照してガスリミットを設定する。

gas: Gas limit used for deploys. Default is 6721975.

https://trufflesuite.com/docs/truffle/reference/configuration/

Mnemonicがアカウントを生成する流れをMnemonic Code Converterから確認。BIP39 Mnemonic部分にキーワードを入れれば良い。そうすればderived addressでMnemonicから生成可能なアドレス群が表示される。

https://iancoleman.io/bip39/

Metamaskがアカウントごとのバランスを表示する仕組みを確認。

https://metamask.zendesk.com/hc/en-us/articles/360057536611-How-to-check-my-wallet-activity-on-the-blockchain-explorer#:~:text=After%20you%20enter%20your%20MetaMask,date%20transactions%20in%20your%20wallet.

https://blog.etereo.io/how-to-read-the-balance-of-your-metamask-wallet-with-web3-js-6d4c4c364225

Etherscanのrinkebyのアカウントを検索し、残高が同じであることを確認してから最初のトランザクションを検索。

そうすると、このrinkebyのアカウントはcreateされたものではなく最初から存在している、または、etherscanでは最初のトランザクションをキャッチできないことがわかった。

Account:
A public and private keypair that "holds" your funds.
Your funds are actually stored on the blockchain, not in the wallet or account.

https://docs.metamask.io/guide/common-terms.html#words-are-hard

メタマスクで生成されるアカウント、公開鍵と秘密鍵のペアはブロックチェーン上の資金を管理しており、その資金の情報をメタマスク上で表示していることがわかった。

やっとEOAについて理解できてきたかもしれない。ブロックチェーンへの記述のされ方がそもそも違ったのだ。

Ethereum has two account types:

・Externally-owned – controlled by anyone with the private keys

・Contract – a smart contract deployed to the network, controlled by code. Learn about smart contracts

Both account types have the ability to:
Receive, hold and send ETH and tokens
Interact with deployed smart contracts

https://ethereum.org/en/developers/docs/accounts/

下記にあるようにEOAの生成は無料でできるため、最初のトランザクションは発生しなかったのだ。

Externally-owned

・Creating an account costs nothing
・Can initiate transactions
・Transactions between externally-owned accounts can only be ETH/token transfers

さらにこの作成されたアカウントにはnonce,balance,codehash,storagerootがあるので、このbalanceの部分をいじることになる。このbalanceの足し引き(transaction)を蓄積していく形になるか。filterやsumなどがあるのかもしれない。

Ethereum accounts have four fields:

nonce – A counter that indicates the number of transactions sent from the account. This ensures transactions are only processed once. In a contract account, this number represents the number of contracts created by the account.

balance – The number of wei owned by this address. Wei is a denomination of ETH and there are 1e+18 wei per ETH.

codeHash – This hash refers to the code of an account on the Ethereum virtual machine (EVM). Contract accounts have code fragments programmed in that can perform different operations. This EVM code gets executed if the account gets a message call. It cannot be changed, unlike the other account fields. All such code fragments are contained in the state database under their corresponding hashes for later retrieval. This hash value is known as a codeHash. For externally owned accounts, the codeHash field is the hash of an empty string.

storageRoot – Sometimes known as a storage hash. A 256-bit hash of the root node of a Merkle Patricia trie that encodes the storage contents of the account (a mapping between 256-bit integer values), encoded into the trie as a mapping from the Keccak 256-bit hash of the 256-bit integer keys to the RLP-encoded 256-bit integer values. This trie encodes the hash of the storage contents of this account, and is empty by default.

また、その足し引きなどはEVMに蓄積され、codehashにて処理がされているよう。

Where ETH is stored. Users can initialize accounts, deposit ETH into the accounts, and transfer ETH from their accounts to other users. Accounts and account balances are stored in a big table in the EVM; they are a part of the overall EVM state.

このEOAを作成するためにメタマスクからはAPIを送る。

https://docs.metamask.io/guide/rpc-api.html#permissions

EVMのstateについてもう少し理解を深めた方が良さそう。ブロックに刻まれるとimmutableなはずなのでbalanceは0から始まり足したりしなくちゃいけないかと思っていたが、それらのブロックとは別の形でstateのデータベースというものが存在してブロック生成ごとに集計しているのだろうか。

結論としては、Stateごとに更新されるので、最新の値をEOAのbalanceから引き出すことができるよう。bitcoinの仕組みと混同しないようにする。

https://ethereum.org/en/developers/docs/evm/

トランザクションレベルで理解する。イーサリアムの具体的な仕組みを解説

人気の記事

1

皆さん、ついに、エアラインでも、サブスクリプションが始まったのはご存じですか? まだ実験段階ですが、ANAが、定額全国住み放題サービスを提供する「ADDress」と組んで、国内線を4回まで定額利用可能 ...

2

無料でネットショップを開けるアプリとして多くの人に驚きを与えたBASE株式会社が、2019年10月25日東証マザーズに上場しました。2020年2月時点で90万店を超えるショップを抱えるまでに成長してい ...

3

2011年にサービスを開始してから圧倒的な成長率を誇るインテリア通販サイト 【FLYMEe/フライミー】を皆さんご存じでしょうか。 「自分のイメージするインテリア、本当に欲しいインテリアがどこにあるの ...

4

ついに、noteの月間アクティブユーザー数が4400万人(2020年3月時点)に到達しました。 そもそも、「note」とは、クリエイターが、文章やマンガ、写真、音声を投稿することができ、ユーザーはその ...

5

ボードゲームカフェが1日2回転で儲かるという記事をみつけたので興味を持ち、調べてみました。 まずは、需要がどれくらいあるのか、市場のようすからみていきましょう。 世界最大のボードゲーム市場はドイツで、 ...

-Blockchain, code, Metaverse, VR
-, ,

Copyright© BUSINESS HUNTER , 2023 All Rights Reserved Powered by AFFINGER5.