Questions tagged [hex]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
12 views

How to tell whether a 0x address is a wallet or a contract?

This as an Ethereum wallet address: 0x983110309620D911731Ac0932219af06091b6744 This is a token contract address (ERC-20, WETH): 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 As you can see they are ...
0
votes
0answers
26 views

How convert hex number to decimal in solidity?

I would like to convert a hex number to decimal.
0
votes
0answers
23 views

Constructing hex data payload for contract interaction

I am trying to construct the data payload as described here and quoted below for interacting with a contract: https://github.com/ethereumbook/ethereumbook/blob/develop/06transactions.asciidoc#...
0
votes
0answers
52 views

Understanding serialized signed raw transaction

I try to understand how the raw transaction hex is generated. This website provides an example script: https://besu.hyperledger.org/en/1.2.0/Using-Pantheon/Transactions/Transactions/ My inputs are: ...
0
votes
1answer
40 views

Is it possible to send message in inputData for ERC20 contracts?

There is a transaction on the Rinkeby testnet that has a message encoded in the input data of the transaction https://ropsten.etherscan.io/tx/...
0
votes
1answer
24 views

String to Bytes Converts to Incorrect Value

I have a string array stored in memory as https://cloudflare-ipfs.com/ipfs/QmSXDsFeNaPa3CJKmn8WKBnA421Zv5r3Ra8n71LZhvEi9s This should convert to ...
0
votes
1answer
14 views

Encoding arguments for UniswapV3 trade function

I am trying to encode arguments to call the UniswapV3ExchangeAdapter through the Set-Protocol TradeModule. The UniswapV3ExchangeAdapter has a function which is called generateDataParam that given hops ...
0
votes
1answer
51 views

Decode hexadecimals gas and gas price values "0xd9c5"

Hello i have following kvp: { gas: "0xd9c5" } But the ABI do not have gas func and the interface is not able to decode it, any idea how to decode the gas to extract the value when is ...
0
votes
0answers
35 views

Solidity: Converting a hex-string into bytes efficiently

I need to convert a string variable (passed to a function), containing a hex-string, into bytes in Solidity. In a way, this is the same as the following, just that the string variable will be passed ...
1
vote
1answer
33 views

Understand txdata in ethereum

I have the following output: initialize(string,string,uint8), txdata: ...
4
votes
1answer
161 views

How do you handle the hex prefix without the value (only "0x")?

First, I'm caling function foo() (from another contract) that returns me a uint in the form of bytes. Then, I'm using BytesLib.toUint(foo(), 0) to retrieve the uint. When the value is supposed to be 1,...
0
votes
1answer
39 views

How many UTF-8 chars can you fit in a 256 bit hex word?

In Ethereum transactions, you can use the Data field to send text. Here's an example testnet transaction. https://ropsten.etherscan.io/tx/...
0
votes
1answer
36 views

Check if calldata contains string

I have a function that is called with some data - "SOMETHING". function checker(address _from, uint _value, bytes calldata _data) external{ //HOW to check if _data contains "...
0
votes
1answer
135 views

Hyperledger Besu: Unable to decode the hex string returned by solidity function containing multiple values

I have set up a Hyperledger Besu network for private transactions using Orion. I am using a javascript client to write to and read data from a smart contract written in Solidity. I am following the ...
2
votes
1answer
511 views

json rpc hex string weird padding/encoding

When sending eth_call to get erc20 token WETH name and symbol I get hex response padded with bunch of zeros and a mysterious digit '2'. for symbol I get response: "...
1
vote
0answers
83 views

Why does ethereum JSON RPC encode bytes as hex?

Why not use base64 since it would be more compact?
1
vote
1answer
2k views

web3 - web3.utils.toHex zeros length

I'm trying to send 12 integer as bytes to a contract function. If I use web3.utils.toHex(12) the variable will become 0xc The problem is that when contract function parses bytes, it reads uint256, ...
2
votes
0answers
70 views

Pass hexadecimal literal to contract using web3js

I have a hex literal that I need to pass into a contract using web3, and I'm not sure how to go about formatting it. In solidity, its formatted like so: hex'...
3
votes
1answer
964 views

Encoded input params

I created a simple test contract with a single method: pragma solidity ^0.4.24; contract SimpleTest { function testFunc(string name, bool isFirst) public { //do stuff } } I'm ...
0
votes
1answer
205 views

Converting Log Topics to int64 correctly in Go

I currently use the code below to extract the ERC721 Token ID from Transfer Event Logs: txHash := newLog.TxHash.Hex() hexString := common.BytesToAddress(newLog.Topics[3].Bytes()).Hex() flowerNum, _ :=...
2
votes
1answer
127 views

Leaf node with encodedPath containing only Hex-Prefix in Merkle Patricia Trie

A leaf node is defined as the tuple [encodedPath, value], and encodedPath uses the Hex-Prefix encoding. Is it possible we have a leaf node with encodedPath having only the prefix and no partial path ...
1
vote
1answer
631 views

Better ways to test bytes32 type using truffle testing framework

small quick question, when I store a bytes32 and retrieve it from truffle console, why is it showing in 64 bits? Ex: 0x74657374737472696e6700000000000000000000000000000000000000000000 because this ...
1
vote
1answer
595 views

web3.toAscii for foreign languages

I have a function that takes bytes32 _name as a parameter and store it in a struct. Let's say _name is either Chinese, Korean, or Japanese and from app.js I would convert the _name to hex to pass it ...
0
votes
1answer
213 views

Python How to make Filter topics: encode integers to its hex string representation

In the documentation: http://web3py.readthedocs.io/en/latest/filters.html Quote "Subsequent topic items are the hex encoded values for indexed event arguments. In the above example, the second item ...