Questions tagged [decoding]
The decoding tag has no usage guidance.
65 questions
0
votes
1
answer
22
views
Decoding function input without ABI
It may sound a bit stupid, but how does etherscan, or other similar services decode function input without knowing it's abi? I know, that there are websites like https://www.4byte.directory/ , but ...
0
votes
1
answer
48
views
How to Parse msg.Data
Lets say I have a function and I forward the data to another contract
function Foo(uint256[] myInts, bytes optionalParams) public {
validator.Validate(msg.data);
}
I would like to parse ...
0
votes
1
answer
46
views
Failure to decode JSON
I'm trying to decode the following ZK proof, that lives in a JSON file, into a Solidity struct, using the Foundry book guide for JSON, but I'm getting continuous either errors or the wrong values:
...
0
votes
0
answers
43
views
How do I determine the constructor bytecode for contracts created by another contract
I am looking to decode constructor arguments for EVM contracts. Some contracts are created by externally owned accounts, but many are created via a contract transaction.
In both cases how can I ...
0
votes
1
answer
136
views
How can I decode a Gnosis Safe transaction?
I interacted with a smart contract using Gnosis Safe and sent a transaction to the Sepolia network:
https://sepolia.etherscan.io/tx/0xc0aab967e6f87fed78b6215f7ff02e2b661903f324a115ebc062b9308754002c
I ...
1
vote
1
answer
130
views
Decode Safe transaction data with web3py
The transaction from Safe multisig is executing a contract so it cannot be decoded it directly with the contract ABI. The Safe transaction includes data field with long hex string starting 0x6a761202 ...
2
votes
1
answer
354
views
Need help with abi decode and encode
the solidity data structure and code is as follows :
struct Order {
bytes32 sender;
int128 priceX18;
int128 amount;
uint64 expiration;
uint64 nonce;
}
...
1
vote
1
answer
1k
views
How to decode a bytes value from Ethereum event with ethers.js
I've got the following event declaration in my Solidity contract:
event RemoteOrderCreated(bytes32 indexed id, uint32 indexed nonce, address indexed sender, bytes input);
And I capture the event ...
0
votes
1
answer
117
views
web3.py ContractEvents.myEvent.process_receipt decoding
Here's a link to the docs for reference:
I have the following code:
txhash = "{hash}"
tx_receipt = w3.eth.get_transaction_receipt(txhash)
processed_logs = w3.eth.contract(address="{...
1
vote
2
answers
148
views
How to analyze a tx data?
Given a transaction of type types.Transaction (golang go-ethereum), how can I analyze the data field and check if it has a swap or a sync event?
I know that ...
3
votes
3
answers
455
views
How to decode a nested encodePacked?
The structure of the encoding is
abi.encodePacked(
abi.encodePacked(
address,
uint256,
uint256,
address,
uint256,
address,
...
0
votes
1
answer
1k
views
How to decode the msg.data on a function in plain solidity?
I was wondering how to decode the data payload received on a function
At first, I thought it would be enough with knowing the order of the variables and the exact data type of them at the moment of ...
2
votes
0
answers
69
views
Get addresses of transfers from transactions Web3Py
I am facing issue while trying to retreive data from Goerli (basically, Ethereum). I am trying to fetch transaction from this contract. For every transaction it creates a new airdrop by creating a new ...
2
votes
1
answer
870
views
abi-decoder decode params from data of uniswap transaction
I could decode data for one transaction normally, but I can not for other. I am attaching both examples. I have no clue why the second one doesn't work because it seems I am doing the same yet it won'...
2
votes
1
answer
123
views
call a function in the same contract
i have a contract who containt a function onTokenTransfer(address _sender, uint256 _fee, bytes memory _data), when i transfer some ERC-20 Token using ERC-677 function transferAndCall, the function ...
1
vote
1
answer
629
views
Decoding Storage From trace_call (stateDiff)
I am using Erigon. I am using pendent transactions of swap in goerli, this is an output from trace_call (stateDiff):
{
"output": "0x",
"stateDiff": {
"...
0
votes
2
answers
126
views
What happens if the actual return data type of a contract method is different from ABI
Suppose we want to handle ERC-20 tokens, but some of the token contracts does not comply with the standard completely. In IERC20 interface, transfer has the following signature.
function transfer(...
1
vote
0
answers
46
views
How to decode DSProxy input data
I'm trying to debug a tx made through a DSProxy deployed on Polygonscan, but I'm having a difficult time since the _data part of the DSProxy function input is ABI-encoded. I would have to comb through ...
0
votes
1
answer
196
views
Dynamically decoding response based on user-provided type
In Solidity, I want users to provide the Solidity type of a response upfront, and when the response arrives, I want to decode it based on the type that the user provided - basically dynamic decoding ...
5
votes
1
answer
1k
views
Decoding data from swap event. Uniswap V3
I'm learning how to listen events in blockchain. So I listened an event Swap on Uniswap V3 and got this result:
{
blockNumber: 15560305,
blockHash: '...
0
votes
1
answer
696
views
abi.decode fails to decode Structure
Function reverts when trying to decode this struct:
struct NftProperties {
uint32 dateOfFirstOperation;
uint32 timestampStart;
uint32 timestampEnd;
int64 equivalentCO2;
uint64 ...
3
votes
0
answers
411
views
Detecting internal transactions given a debug_traceTransaction response
Intro
Hello everyone, I am attempting to filter and recreate internal transactions given a debug_traceTransaction response and the {tracer: "callTracer"} tracer. An example transaction can ...
1
vote
2
answers
2k
views
Fastest way to find the function in a contract from it's selector?
Let's say I have a function selector:
0xa9059cbb
And I have a contract as such:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract CallAnything {
function balanceOf(address ...
1
vote
2
answers
5k
views
How do I decode call data in solidity?
I have data in memory that is used for a function call, so I guess that makes it call data rather than a calldata (data location). This call data, say bytes memory data, consists of a selector and the ...
0
votes
0
answers
257
views
Decode number of tokens and token contract address from msg.data (ERC-20)
I have a smart contract with just a fallback function and some logic.
I want users to send their tokens directly to the smart contract to do some smart contract logic on receive.
I've implemented ...
4
votes
1
answer
4k
views
decodeParameters function python web3?
Is there a function like "decodeParameters" for web3 python?
Regards
2
votes
2
answers
899
views
How to compress transaction's input?
Any idea to compress the input data to erase the much zeros
From: ...
1
vote
1
answer
858
views
Why use abi encoding/decoding for method parameters? Why not simply separate the parameters in the method signature?
I have seen source codes where they would encode a bunch of parameters into a single bytes parameter and pass it into a function, what's the real purpose of doing it? For example:
function hello(bytes ...
0
votes
1
answer
291
views
Why can't "input data" get decoded in a normal, readable format in an explorer, in some cases?
Let's say, this transaction https://testnet.snowtrace.io/tx/0x86895afcc3768254e5a1257790e95cdcd7402df6c88ed098c012a809a9be3e1d
The function router.swapExactAVAXForTokens was called here. However, in ...
2
votes
1
answer
810
views
Unable to decode input using Etherscan ABI
I'm looking at the input for a transaction that calls a Smart Contract and I cannot make sense of it. This specific sample is on FTM, but I'm assuming there is no difference in behaviour to ETH?
...
2
votes
0
answers
493
views
How to parse constructor arguments on contract creation transaction using ethers.js?
Ethers.js has a parseTransaction function that can be used in the following way to extract arguments from any transaction on a deployed contract.
const txDescription = contractInfo.interface....
0
votes
1
answer
4k
views
How to send bytes data to contract with web3.py to decode
I'm doing a test and trying to send bytes data to a contract so it can parse, store in variables, and return a value.
Solidity code
pragma solidity 0.6.12;
contract testbyte {
function sendBytes(...
0
votes
1
answer
554
views
How do I parse a bytes32 in solidty?
I have a bytes32 object in memory or storage and I want to parse it into little chunks, for example into one uint8, followed by a bool, followed by uint10, followed by address. How can one do that? I ...
1
vote
0
answers
2k
views
Decoding input data from transaction
I'm struggling with decoding the input data from transaction, have tried already everything that I found in similar topics here but all I can retrieve is:
{
"method": null,
"types&...
0
votes
0
answers
1k
views
How to decode string from bytes 32 in event log that is returned as hex on event log subscribe
I am using the web3.eth.subscribe method to listen for events on a contract.
When an event occurs, I am using the web3.eth.abi.decodeLog to decode the data from the event.
One of the parameters I am ...
2
votes
2
answers
148
views
How can I decode calls to the songbird network?
for example: I am a multisig signer. And I want to decode the call data that is used to call a specific smart contract.
example on smart contract : 0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED (WNat)
I ...
1
vote
1
answer
242
views
bscscan contract argument data decoding
Let's take a look at this tx:
https://bscscan.com/tx/0x9b7cde866e9fe9b9a1c636d0f9686ea5b1920c875d7fcd973baf847bc359c8a9
as you can see it's buying token through pancake swap:
...
2
votes
2
answers
4k
views
Decode input parameter without ABI
I have a transaction with input data that looks like this:
0x2293db5700000000000000000000000030823e060e8be429b34bd9192df9cad4b166a056
I know that the last 40 characters is the token address which ...
2
votes
1
answer
6k
views
Best way to decode transaction input on the client side
I need to decode transaction input on the client side. Libraries like ethereum-input-data-decoder needs NodeJS dependencies like fs.
Now I decode the one type of contract methods as follows:
const ...
0
votes
1
answer
235
views
How to decode input for tx sent to zero address (contract creation tx)
Decoding transaction input data requires providing ABI. How can I decode transaction input from a transaction issued to "zero" address? This special address is used for creating new ...
0
votes
1
answer
853
views
How does Solidity decode a struct returned from a delegate call?
I have a proxy contract that delegate calls to a target contract. The proxy is similar to DSProxy.
In it, there is an execute function:
function execute(address target, bytes memory data) external ...
0
votes
2
answers
4k
views
Decode raw data within Solidity
If I only have the raw input data of a contract call, what would be the best way to decode it into readable form within Solidity?
"[INPUT]":"...
0
votes
1
answer
831
views
How to decode when the input of tracsaction consists of multiple contracts?
I'm testing how to decode the input data of a transaction.
I am currently using Infura and web3py.
In the case of USDT token transfer, USDT ABI and contract address are obtained and decoded through ...
0
votes
1
answer
631
views
Is it possible to encode and decode two consequent byte arrays (with unknown sizes) using `abi.encode` and `abi.decode`?
Is it possible to encode and decode two consequent bytes using abi.encode and abi.decode (as following)?
bytes memory data = abi.encode(data1, data2);
// later on
(bytes memory data1_recovered, bytes ...
1
vote
3
answers
107
views
Would it be possible to integrate crypto with trading bot? [closed]
You can create a trading bot in trading view and see how well your crypto would perform in a given time frame. (I can see how much money would I make if I didn't sell or how much money I would make if ...
1
vote
2
answers
2k
views
Decoding Transaction input data in Nethereum
I'm using Nethereum and see this example of how to decode the Input data of a Transaction object. Nethereum Playground C#
This looks like it assumes that you have to know which function data you're ...
1
vote
0
answers
1k
views
Decoding transaction data using abi-decoder
I'm trying to write a very simple script in typescript that finds uniswap transactions and decodes the transaction data so I can read the function being called and the parameters it is being called ...
0
votes
1
answer
227
views
Method's parameters: a way to know a uint256 is a token amount and its number of decimals?
When decoding transaction actions or logs, I never know how to human-read uint256 values when they are token amounts and, if so, how to know how many decimals they are.
For the decimals, do I always ...
8
votes
2
answers
29k
views
Convert String to Hex using ethers.js
If I use web3.js I can convert a string to hex with:
web3.utils.toHex('4c7b7ffb66b344fbaa64995af81e355a')
How do I use the same utility for ethers.js?
1
vote
1
answer
1k
views
decode ethereum input data in R [closed]
I am using the etherscan API to get the input data of transactions. However I have no real clue how I can decode the input data into something readable.
For example:
...