You pay gas spent * gas price amount of ether, where
당신은 다음과 같은 경우에 사용된 가스 * 이더(ETH) 의 가스 가격 금액을 지불합니다.
Transactions with higher gas price have higher priority to be included in a block.
(가스 가격이 높은 거래는 블록에 포함되는 것이 우선순위가 높다.)
Unspent gas will be refunded.
(사용하지 않은 가스는 환불됩니다.)
There are 2 upper bounds to the amount of gas you can spend
당신이 쓸 수 있는 가스의 양에는 두 가지 상한이 있다.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Gas {
uint public i = 0;
// Using up all of the gas that you send causes your transaction to fail.
// State changes are undone.
// Gas spent are not refunded.
function forever() public {
// Here we run a loop until all of the gas are spent
// and the transaction fails
while (true) {
i += 1;
}
}
}
Solidity - For and While Loop (0) | 2022.12.23 |
---|---|
Solidity - If / Else (0) | 2022.12.23 |
Solidity - Ether and Wei (0) | 2022.12.22 |
Solidity - Reading and Writing to a State Variable (0) | 2022.12.21 |
Solidity - Immutable (0) | 2022.12.21 |