综合What is the difference between a “call” , “message call” and a “message”下的回复,得出此文。

Call 是一个在不同的上下文下含义很混乱的词汇。

Message 是带有数据载荷或价值,在合约到合约之间传递的东西(合约可能有独立账户,也可能没有!)。Message 到达目标账户后,如果目标账户含有代码,则目标账户会产生状态迁移,这时候 Message 就产生了 Message Call。Message 不会因为挖矿延迟,他们本身就是 transaction 执行的一部分。

Transaction 一定是由外部账户签署的,账户到账户之间发送的 Message ,要么它产生了一个合约,要么它是一个 Message Call,而且它可以激发合约之间越来越多的 Message Call。

再引用 Solidity 官方文档原文:

A transaction is a message that is sent from one account to another
account (which might be the same or the special zero-account, see
below). It can include binary data (its payload) and Ether.

In fact, every transaction consists of a top-level message call which in turn can create further message calls.

对于已经被创建好的合约而言,它收到的transaction,都是 Message Call,对于很多其他文献而言,Message Call 也叫 internal transaction,但它不像正式的 transaction 一样带有签名,也就无法被 transaction api 查询出来。

我们经常讲的 call 和 transaction 还有是两种调用合约的方式:

SendTransation 必然会对链上数据进行修改。所以高层 API 通常只是得到一个 transaction hash,以后再得到 reciept。

call 则当场得到结果,但不会引起链上的数据变化。