当前位置:网站首页>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 !
边栏推荐
- 我想知道如何通过线上股票开户?在线开户安全么?
- [applet practice series] Introduction to the registration life cycle of the applet framework page
- AUTO sharding policy will apply DATA sharding policy as it failed to apply FILE sharding policy
- 【ceph】cephfs的锁 笔记
- 【文件】VFS四大struct:file、dentry、inode、super_block 是什么?区别?关系?--编辑中
- 在校生学习生涯总结(2022)
- 查词翻译类应用使用数据接口api总结
- Super double efficiency! Pycharm ten tips
- PCIe Capabilities List
- 【ceph】CephFS 内部实现(四):MDS是如何启动的?--未消化
猜你喜欢
随机推荐
[CEPH] Lock Notes of cephfs
Learning memory barrier
在校生学习生涯总结(2022)
IDEA本地代理后,无法下载插件
1. accounting basis -- several major elements of accounting (general accounting theory, accounting subjects and accounts)
Don't remove custom line breaks on reformat
How do I open an account on my mobile phone? Is online account opening safe?
JS之手写 bind、apply、call
/etc/profile、/etc/bashrc、~/.bashrc的区别
[CEPH] cephfs internal implementation (I): Concept -- undigested
在重新格式化时不要删除自定义换行符(Don‘t remove custom line breaks on reformat)
JS events
JS handwritten bind, apply, call
在哪个平台买股票开户安全?求指导
On which platform is it safe to buy shares and open an account? Ask for guidance
评价——TOPSIS
如何配置使用新的单线激光雷达
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction
[problem solving] the loading / downloading time of the new version of webots texture and other resource files is too long
TweenMax+SVG切换颜色动画场景








