Does calling an 'external view' function in solidity broadcast a 'transaction' to the network?

时间:2018-03-23 00:32:42

标签: ethereum solidity

"In Ethereum, when you call a function on a contract, you broadcast it to a node or nodes on the network as a transaction." - CryptoZombies (Solidity Tutorial)

Are there circumstances where function calls do not broadcast a transaction to the network?

How might one broadcast a transaction to a specific node?

Thank you.

1 个答案:

答案 0 :(得分:3)

  

是否存在函数调用不向网络广播事务的情况?

是。 constant函数用于从区块链中检索通常在本地EVM中运行的数据(也可以在事务中调用它们)。这些电话不属于交易范围,您不需要为执行电话所用的气体付费。

  

如何将交易广播到特定节点?

您可以通过连接到特定节点来启动事务。此节点可以是本地节点,也可以连接到Infura等远程提供程序。但是,一旦提交了事务,它就会成为网络中所有节点的待处理事务,并且区块链上的任何矿工都可以接收并处理它。您可以使用私有区块链更好地控制处理事务的方式。