交易
一笔交易是由具有Conflux账户的外部参与者创建的单一指令,该指令使用发送者账户的私钥进行了数字签名。 A transaction can involve a simple transfer of CFX (the native currency of Conflux), a transfer of tokens (such as ERC20 or ERC721), a deployment of a new smart contract, or an execution of a function on an existing smart contract. 交易是在区块链上存储或更新数据的唯一方式。
前提条件
To help you better understand this page, we recommend you first read Accounts.
What's a Transaction?
An transaction refers to an action initiated by an externally-owned account, in other words an account managed by a human, not a contract. For example, if Bob sends Alice 1 CFX, Bob's account must be debited and Alice's must be credited. This state-changing action takes place within a transaction.
Transactions, which change the state of the EVM, need to be broadcast to the whole network. Any node can broadcast a request for a transaction to be executed on the EVM; after this happens, a validator will execute the transaction and propagate the resulting state change to the rest of the network.
A submitted transaction includes the following information:
- from – the address of the sender, that will be signing the transaction. This will be an externally-owned account as contract accounts cannot send transactions.
- recipient – the receiving address (if an externally-owned account, the transaction will transfer value. If a contract account, the transaction will execute the contract code)
- signature – the identifier of the sender. This is generated when the sender's private key signs the transaction and confirms the sender has authorized this transaction
- nonce - a sequentially incrementing counter which indicates the transaction number from the account
- value – amount of CFX to transfer from sender to recipient (denominated in Drip, where 1CFX equals 1e+18Drip)
- input data – optional field to include arbitrary data
- gasLimit – the maximum amount of gas units that can be consumed by the transaction. The EVM specifies the units of gas required by each computational step
- gasPrice - the price of the consumed gas to be included as a tip to the validator
- chainId - the id of the blockchain, which is used to prevent replay attacks
The Core Space transaction includes the following additional information:
- storageLimit - the maximum amount of storage space that can be consumed by the transaction.
- epochHeight - the epoch number of the blockchain, which is used to sets an expiration time for the transaction