存储在区块链中

Storage in the blockchain

我只是想了解更多关于区块链存储的信息。当节点调用智能合约中的函数并传递一个字符串 str 作为参数时,这个字符串将存储在哪里?

字符串是否存储了两次,一次在合约存储中(在智能合约中编程),一次在链的区块中(作为交易)??

还有一点,智能合约的变量是否存储为哈希?我想知道智能合约存储的样子(它是否作为区块中的交易散列)

谢谢

I just would like to know more about the storage in blockchain. When a node call a function in a smart contract and pass a string str as a parameter, where this string would be stored?

该字符串将存储在生成的交易中。但是,这取决于您安装的智能合约。也许,某些智能合约不会保存它。

Does the string stored twice, one in the contract storage ( as programmed in the smart contract ) and one in the chain's block ( as a transaction ) ??

你不在合约存储中存储任何东西,你只执行合约。但是,区块链将信息存储两次:

  • 分类帐:分类帐存储所有交易。分类帐由区块链(“链”)组成,用于将不可变的、有序的记录存储在块中。每个节点都维护一份账本副本。
  • 状态数据库:维护当前状态。它代表链交易日志中曾经包含的所有密钥的最新值。智能合约调用根据当前状态数据执行交易。