当前位置:网站首页>Transaction input data of Ethereum
Transaction input data of Ethereum
2022-06-26 15:45:00 【NFT practitioner】
Here I share with you the principle behind the hexadecimal data call contract , I hope that's helpful .
Transaction The main field
You know that every time you interact with the Ethereum network , Whether it is a direct transfer or a call contract, it actually initiates a transaction to the Ethereum network Transaction, This Transaction adopt Metamask After signing and sending to the Ethereum node , Ethereum miners will carry out this transaction.
Transaction There are several important fields in :
- from: On behalf of who initiated this Transaction, It's usually your wallet address
- to: To whom . If it's a transfer ,to Is the address of the wallet you want to transfer money to ; If this transaction is a call contract ,to Is the contract address to be called
- value: How much ETH
- Input Data: input data . If it's a transfer ,Input Data Namely 0x It's empty , Don't pass in , because “from”、“to” and “value” The field has been able to determine that the transaction was made by “ who ”, turn “ How many? ETH”, To “ who ” Went to the ; But if the deal is a call contract ,Input Data You need to include all the information you need to invoke the contract , For example, the contract method 、 Parameters ( The hexadecimal data in the above screenshot , What you enter is actually Input Data)
With this WomenUniteNFT Of Mint transaction For example ,tx=0x64c55a520934460ef87a1bd5f0e86c837babae86897ddf285ae4dc2feafa166d, You can see from yes mint This guy's wallet ,to yes WomenUniteNFT Contract address ,value yes 0, It means no money ( But there are gas),data Is the hexadecimal data he passed in .

Input Data analysis
Or the above transaction Input Data “0xa0712d6800000000000000000000000000000000000000000000000000000000000000fa” For example .
Method identification
First of all, there are loopholes in the contract “def mint(uint256 _wad) payable:”, use keccak256 Work out ”mint(uint256)” Hexadecimal of the hash value of , Take the top eight at the same time to get Input Data Method name ID of “a0712d68” 了 .( Note that the computed hash only needs to be the function name + Parameter type )

Method parameter
After the method id is confirmed , You need to pass in mint Number , If you need one mint 250 individual , The introduction 250 The hexadecimal of “fa”.

Above mint The parameter in the method is uint256 Type of , You need to use the corresponding number of digits when spelling in parameters ,uint256 If the parameter of type is changed to 16 In hexadecimal, you need 64 position , So will “fa” repair 0 To 64 Bit is “00000000000000000000000000000000000000000000000000000000000000fa”.
Pieced together Input Data
At this time, it is identified with the previously calculated method name “a0712d68” Piece together , You can get “a0712d6800000000000000000000000000000000000000000000000000000000000000fa” Of Input Data Data. , With the above Mint Of this transaction Of Input Data identical .( If you have more than one parameter , It is OK to continue to spell according to the length of the parameter type )
Put this Input Data The data is in Metamask Enter... When transferring to the contract address , The Ethereum miner node knows which method to execute the contract and what parameters to pass in .
Last
If you still don't understand , It's just Etherscan Compare the contract and transaction Of InputData, In fact, they can work it out by themselves .
The above contents do not make any investment suggestions , Investment is risky !
边栏推荐
- How do I open an account on my mobile phone? Is online account opening safe?
- 【微信小程序】事件绑定,你搞懂了吗?
- 在哪个平台买股票开户安全?求指导
- 【leetcode】48.旋转图像
- Ansible自动化的运用
- 「干货」NFT 上中下游产业链全景分析
- Summary of students' learning career (2022)
- Is it safe to open a stock account through the account opening link of the broker manager? Or is it safe to open an account in a securities company?
- 【ceph】mkdir|mksnap流程源码分析|锁状态切换实例
- Golang 1.18 go work usage
猜你喜欢

Don't remove custom line breaks on reformat
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction](/img/05/8ec56393cac534cb5a00c10a1a9f32.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction

1. accounting basis -- several major elements of accounting (general accounting theory, accounting subjects and accounts)

Notes on brushing questions (19) -- binary tree: modification and construction of binary search tree

SQLite loads CSV files and performs data analysis

Comparative analysis of restcloud ETL and kettle

【SNMP】snmp trap 介绍、安装、命令|Trap的发送与接收代码实现

查词翻译类应用使用数据接口api总结

JVM笔记

AbortController的使用
随机推荐
Evaluation - TOPSIS
svg canvas画布拖拽
JVM笔记
CNN optimized trick
NFT 平台安全指南(2)
【leetcode】701. Insert operation in binary search tree
[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction
Audio and video learning (II) -- frame rate, code stream and resolution
【ceph】CephFS 内部实现(三):快照
[CEPH] cephfs internal implementation (II): example -- undigested
手机上怎么开户?在线开户安全么?
Solana扩容机制分析(2):牺牲可用性换取高效率的极端尝试 | CatcherVC Research
JS simple deepcopy (Introduction recursion)
How to configure and use the new single line lidar
音视频学习(二)——帧率、码流和分辨率
【ceph】CephFS 内部实现(四):MDS是如何启动的?--未消化
Database - sequence
[CEPH] Lock Notes of cephfs
Ansible自动化的运用
效率超级加倍!pycharm十个小技巧就是这么神