Questions tagged [decoding]
The decoding tag has no usage guidance.
58
questions
1
vote
1
answer
93
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
26
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
62
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
268
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
642
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
55
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
642
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
84
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
359
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
75
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
32
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
129
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
936
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
495
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
323
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 ...
0
votes
2
answers
1k
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 ...
0
votes
2
answers
3k
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
215
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 ...
3
votes
1
answer
3k
views
decodeParameters function python web3?
Is there a function like "decodeParameters" for web3 python?
Regards
1
vote
2
answers
700
views
How to compress transaction's input?
Any idea to compress the input data to erase the much zeros
From: ...
1
vote
1
answer
813
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
118
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
718
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
447
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
3k
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
416
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
1k
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
127
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
199
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
3k
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 ...
1
vote
1
answer
5k
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
225
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
814
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
1
answer
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
755
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
554
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
99
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
216
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
23k
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:
...
4
votes
1
answer
16k
views
how to decode log event of my transaction log?
I receive a transaction event in my log of my Ethereum transaction.
.on('receipt', function(receipt){
console.log("address: " + receipt.logs[0].address);
console.log(&...
0
votes
1
answer
2k
views
abi.decode with pragma experimental ABIEncoderV2 reverts with nested array
I have a function with a parameter of bytes calldata that needs to be decoded to a struct, but the call reverts in assembly. I believe the issue has something to do with the nested array. I have ...
6
votes
3
answers
5k
views
How to decode a raw transaction in Python?
I have a raw_tx in hex format which I'm going to broadcast via eth_sendrawtransaction JSON-RPC method.
I want to check this raw_tx by decoding it on fields: gas, gas_price, nonce, value, etc.
Some ...
1
vote
1
answer
294
views
Where does the length parameter end and the actual string start in an abi encoded string?
Assuming I decided to ABI encode a very long string (for the purpose of this question I just picked an arbitrary 5-paragraph lorem ipsum text generate by https://www.lipsum.com/feed/html) and get out ...
2
votes
2
answers
1k
views
How to decode a transaction to verify its signature in Javascript?
I noticed that it's possible to sign a transaction with a wrong private key. I took the following example found at https://github.com/ethereumjs/ethereumjs-tx
const EthereumTx = require('ethereumjs-...
1
vote
0
answers
106
views
Given just an Etheruem address, is there any way to tell if it's an ERC20 and/or an ERC721
If I have only an Ethereum address and only a locally running node (using a third party such as EtherScan or Alethio is cheating), is there any way to tell if that address is an ERC20 or an ERC721 ...
0
votes
1
answer
231
views
Is Ethereum block header a list?
Decoding a RLP encoded block using Eth specifications do we get header as list? But as per format i.e., [[blockHeader,transactionList,uncleList],totalDifficulty], blockHeader should have been string.
...