以太坊知识教程------账户
生活随笔
收集整理的這篇文章主要介紹了
以太坊知识教程------账户
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
以太坊有兩種不同類型的賬戶:
- 外部擁有的賬戶,公私鑰。
- 合約賬戶
一個以太坊的賬戶包含四個部分
| 該地址交易的次數( nonce ) | a counter that indicates the number of transactions sent from the account.代表從此賬戶地址發送的交易序號它是用于保障每筆交易能且只能被處理一次的計數器,有效避免重放( replay )攻擊 | the number of contracts created by the account此賬戶創建的合約序號 |
| 賬戶目前的以太幣余額 | the number of Wei owned by this address. Wei is a denomination of ETH and there are 1e+18 Wei per ETH. | |
| codeHash 賬戶的合約二進制代碼 | empty string | 存儲的是 codeHash(這個賬戶的以太坊虛擬機代碼的哈希值)。這個字段在生成后是不可修改的,這意味著智能合約代碼是不可修改的 |
| 賬戶的存儲 | 默認為空 | A 256-bit hash of the root node of a Merkle Patricia tree 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 tree encodes the hash of the storage contents of this account, and is empty by default. |
Key differences
Externally-owned
- Creating an account costs nothing Can initiate transactions
- Transactions between externally-owned accounts can only be ETH
- transfers
Contract
- Creating an account has a cost because you’re using network storage
- Can only send transactions in response to receiving a transaction
- Transactions from an external account to a contract account can trigger code which can execute any different actions, such as transfering tokens or even creating a new contract
總結
以上是生活随笔為你收集整理的以太坊知识教程------账户的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MIMIC 以太坊医疗项目开发(7) 医
- 下一篇: 以太坊知识教程------智能合约的5种