Tutorials:Read Contract: Difference between revisions
m (Move page script moved page Tutorials:8d4f to Tutorials:Read Contract) |
|||
| (13 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= | A smart contract is not a “user account.” It’s code + on-chain storage living at an address. People (wallets) send transactions to the contract address, and the contract updates its internal storage according to its rules. | ||
=Spring Token Contract Address= | |||
Let's have a look at the Spring Tokens Smart Contract in Ethereum: | Let's have a look at the Spring Tokens Smart Contract in Ethereum: | ||
| Line 9: | Line 11: | ||
[[File:Smart01.jpg|800px]] | [[File:Smart01.jpg|800px]] | ||
By clicking in the "contract" tab | In '''Overview''' we see that the contract does not hold ETH, and idealy should not hold tokens. But at time of this writing it shows 1 token in holdings. This is most likely spam sent to addresses as advertising. And quite often to try to scam people, so be careful with these. | ||
In the '''More Info''' tab we see the "Contract Creator" address, and a link to the '''Token tracker''' page that combines: | |||
* On-chain data (supply, holders, transfers, contract, decimals) | |||
* Off-chain / reference data (token name/symbol, links, sometimes reputation indicators) | |||
in a single token-focused dashboard. | |||
We have many tabs like: Transactions, Internal Transactions, Token Transfers, etc. We will look at the contract tab and get some information from the contract. | |||
=Read Contract= | |||
By clicking in the "contract" tab, and then "read code" we can get some information from the contract itself: | |||
In the field number 4: '''Initial_Reward field.''' | |||
The initial reward was 168 Spring tokens, but the number is written with 18 zeroes because it is given in "Wei" units. | |||
''Wei is the smallest denomination of Ether (ETH) on the Ethereum network, named after cryptographer Wei Dai; one Ether equals one quintillion (10¹⁸) Wei, making Wei essential for precise transaction fees (gas) and microtransactions, similar to how a Satoshi is the smallest unit of Bitcoin. It allows for granular calculations, preventing rounding errors in the complex operations of smart contracts and decentralized finance.'' | |||
[[File:Smart012.jpg|800px]] | [[File:Smart012.jpg|800px]] | ||
==Exercise: | In the field 18: we see the result of calling '''Get Mining Reward''' method, and it gives the current number of tokens per reward. | ||
Other interesting field is number 29: '''Tokens Minted''', showing how many tokens have been minted so far. | |||
=Minting Tokens= | |||
The Transactions tab lists the normal, signed transactions that directly call the contract (usually from a wallet or Externally Owned Account). An external account can call the Mint function of the contract, but this is rarely happening because the tokens are mined trough mining pools. The Mining Pool smart contract talks internally with the token contract, and when a smart contract performs an action it sends a log that appears in the events tab. | |||
The records of token mint appear in the "Events" tab. | |||
=Exercise:= | |||
Click on the | Click on the events tab and find the latest MINT transaction: | ||
[[File: | [[File:MintTransaction.png|800px]] | ||
Only the latest 25 events appear, and you can see some Mint events. Although Seasonal Tokens rewards are issued every 10 minutes on average, in the sense that every 10 minutes a solution to the proof of work is found, the mint function is not called every 10 minutes. The mining pools collect many solutions and submit only one mint call every few hours to save on gas fees. | |||
Latest revision as of 05:15, 13 January 2026
A smart contract is not a “user account.” It’s code + on-chain storage living at an address. People (wallets) send transactions to the contract address, and the contract updates its internal storage according to its rules.
Spring Token Contract Address
Let's have a look at the Spring Tokens Smart Contract in Ethereum:
0xf04aF3f4E4929F7CD25A751E6149A3318373d4FE
In Overview we see that the contract does not hold ETH, and idealy should not hold tokens. But at time of this writing it shows 1 token in holdings. This is most likely spam sent to addresses as advertising. And quite often to try to scam people, so be careful with these.
In the More Info tab we see the "Contract Creator" address, and a link to the Token tracker page that combines:
- On-chain data (supply, holders, transfers, contract, decimals)
- Off-chain / reference data (token name/symbol, links, sometimes reputation indicators)
in a single token-focused dashboard.
We have many tabs like: Transactions, Internal Transactions, Token Transfers, etc. We will look at the contract tab and get some information from the contract.
Read Contract
By clicking in the "contract" tab, and then "read code" we can get some information from the contract itself:
In the field number 4: Initial_Reward field. The initial reward was 168 Spring tokens, but the number is written with 18 zeroes because it is given in "Wei" units.
Wei is the smallest denomination of Ether (ETH) on the Ethereum network, named after cryptographer Wei Dai; one Ether equals one quintillion (10¹⁸) Wei, making Wei essential for precise transaction fees (gas) and microtransactions, similar to how a Satoshi is the smallest unit of Bitcoin. It allows for granular calculations, preventing rounding errors in the complex operations of smart contracts and decentralized finance.
In the field 18: we see the result of calling Get Mining Reward method, and it gives the current number of tokens per reward.
Other interesting field is number 29: Tokens Minted, showing how many tokens have been minted so far.
Minting Tokens
The Transactions tab lists the normal, signed transactions that directly call the contract (usually from a wallet or Externally Owned Account). An external account can call the Mint function of the contract, but this is rarely happening because the tokens are mined trough mining pools. The Mining Pool smart contract talks internally with the token contract, and when a smart contract performs an action it sends a log that appears in the events tab.
The records of token mint appear in the "Events" tab.
Exercise:
Click on the events tab and find the latest MINT transaction:
Only the latest 25 events appear, and you can see some Mint events. Although Seasonal Tokens rewards are issued every 10 minutes on average, in the sense that every 10 minutes a solution to the proof of work is found, the mint function is not called every 10 minutes. The mining pools collect many solutions and submit only one mint call every few hours to save on gas fees.