Questions tagged [encoding]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 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 ...
1
vote
1answer
20 views

Error: Invalid bytes6 value

I'm trying to create a TicketPurchaser application. Here is the whole code for the smart contract, although I think the problem I'm asking about is a type error, most of the code is not important. ...
0
votes
1answer
27 views

Solidity keccak behavior

I have a weird issue. I'm trying to keccak256 packed encoded arguments in Rust [which should mimic Soldity's behavior to be checked on chain later]. I've failed for now. To figure out the issue I've ...
0
votes
1answer
25 views

ABI encoding with tuples

I don't understand how ABI encoding with tuples work: f(uint8[], uint) with arguments [3], 4 accordingly https://abi.hashex.org produces: ...
3
votes
2answers
34 views

What is a good alternative to `ContractTranslator.encode_abi`

Since the ethereum Python library has been deprecated in May 2019, the ContractTranslator.encode_abi function is probably not the best way to turn Python argument lists into calldata strings. In ...
0
votes
1answer
25 views

What is the data field in eth_call commands for USDT?

I'm trying to use eth_call to send USDT (TetherToken) from one account to another (Although I know that eth_call just simiulate such transaction). Everything is clear in this regard, just the data ...
0
votes
1answer
24 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. ...
0
votes
2answers
79 views

Correct ABI payload packaging to call another Contract's address

Let's suppose I have the two following contracts, Dest and Proxy: pragma solidity ^0.5.0; contract Dest { function foo(string memory name, string memory symbol, uint256 decimals, uint256 ...
0
votes
3answers
255 views

Remix Deploy Error encoding arguments

I'm building a simple fund raising smart contract and having problems deploying this through Remix. I'm wanting to set the "goal" and "minimum contribution" values (in wei) during the contract ...
1
vote
1answer
50 views

How to encode function call in C

I understand web3 can be basically used for every existing task, however, is there anything we can use for C? My C program is communicating with the RPC server using the curl library, by posting JSON ...
1
vote
1answer
113 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 ...
4
votes
1answer
106 views

Is pre 0.5.0 keccak256(a,b) equivalent to post 0.5.0 keccak256(abi.encodePacked(a,b))?

In pre 0.5.0 Solidity if you wanted to hash a some set of data you would do keccak(a, b, c). Post 0.5.0 keccak only takes 1 arg and it is suggested to use keccak(abi.encodePacked(a,b,c)) instead But ...
2
votes
1answer
51 views

Understanding first evm word of reference types in assembly

Given the following function: function getArrayItems(bytes calldata) external returns ( bytes4 _signature, bytes32 _wutIsThis, bytes32 _length, bytes32 _firstItem ) { assembly { ...
1
vote
1answer
31 views

Where is the position of each paramter in a smart contract function when encoded as inputdata in a transaction

When I reviewed the BEC attack, I found the position of each parameters value in real transaction was not corresponding in to definition of function in smart contract. The exploit transaction is at: ...
1
vote
1answer
147 views

Decoding parameters with inline assembly in Solidity

I Would like to know if there is a solidity equivalent to this web3: web3.eth.abi.decodeParameter() I'm currently looking at something like Seriality, but wondering if there was a supported ...
0
votes
1answer
60 views

encoding several variables into a byte

I want to define a byte256 and I want to assign different sections of the byte to different variables, any literature or guidance is appreciated. for further clarity I want to do something like ...
0
votes
1answer
137 views

what type of encoding is used by the abi specification in solidity

the abi specification of solidity which provides functions like abi.encodePacked() using a certain type of encoding (eg: for functions, a 4 byte function signature hash followed by encoding of ...
1
vote
3answers
381 views

web3py encode method call parameters

I want to encode the parameters needed to call a contract method. In web3js I would use web3.eth.abi.encodeParameters(types, values); I need to do the same in python I found a function called ...
4
votes
1answer
109 views

What are function signatures in ABIv2 and how do they enhance Ethereum?

EIP-712 talks about function signatures being bytes4. I understand that the new version of the ABI format will contain a pre-defined set of keccak256 hashes of function names, as per the work done on ...
0
votes
1answer
63 views

Is Data Stored on Ethereum encrypted or only RLP encoded?

Is Data Stored on Ethereum encrypted or only RLP encoded? If data is not encrypted, is there some way to secure and encrypt it using AES encryption algorithm in cipher block chaining (CBC) or XTS mode ...
0
votes
2answers
505 views

abi.encodePacked with lot of zeros

According this documentation types shorter than 32 bytes are neither zero padded nor sign extended and When I use abi.encodePacked(address, uint, uint, address) I am getting a result with lot of ...
2
votes
1answer
593 views

ethereumjs-abi equivalent for Golang?

ethereumjs-abi is great for easily ABI encoding and decoding in javascript. Is there an equivalently simple package for Golang? Geth's accounts/abipackage does this, but there's a lot of setup and it'...
0
votes
1answer
22 views

As of today (Solidity v0.4.22)… Is there a way to return structs from public functions?

https://medium.com/coinmonks/solidity-tutorial-returning-structs-from-public-functions-e78e48efb378 According to this article (link above), on Medium I'd have to use tuples... but this was so in ...
2
votes
1answer
775 views

How to unpack/decode parameters encoded with web3.eth.abi.encodeParameters in Solidity?

My client app (nodejs) packs some arguments to pass to a smart contracts as bytes _data (similar to ERC223 calls with fallback). I pack the arguments in my JS client like this: const packedArgs = ...
0
votes
1answer
67 views

Potential attack

I have two computers, one of them is airgapped. I had also two MEW private key, stored in the airgapped computer, I made a lot of transaction from the first private key to the second one. ...
0
votes
1answer
52 views

Apparent mismatch between Oraclize CBOR and python3 CBOR encodings

I encoded a value using the Oraclize CBOR library like so: Buffer.buffer memory cborArgs; Buffer.init(cborArgs, 64); cborArgs.startArray(); cborArgs.encodeUInt(10); cborArgs....
1
vote
1answer
150 views

No luck recovering public key after EIP 155

I'm trying to understand Ethereum transaction signing, but for some reason I'm unable to verify the signature. I have a test account, 0xb2c899884790aa9e256a2d4b2256ca3319e64e32, its public key is ...
1
vote
0answers
24 views

What's the point of RLP over other encoding formats? [duplicate]

What makes Ethereum need an encoding like RLP? What's so special about this format over others? How does it fit in specifically for Ethereum's needs?
1
vote
1answer
332 views

Using web3.js to do base58 (ipfs) encoding and decoding?

Is it possible to use the web3.js libary to do base58 encoding and decoding? It seems that web3.js includes the bignumber library, but I'm unsure as to whether this can handle the base58 encoding ...
3
votes
2answers
919 views

How to RLP-encode messages in Solidity

I'm trying to figure out how to interact with the current version of the Casper contract from Solidity. The vote-function in the casper contract takes an array of bytes, which represents the RLP-...
2
votes
2answers
549 views

field size and value range of chainId (EIP-155)

EIP-155 defined a list of chain IDs, e.g. main net is 1 Ropsten is 2. I don't seem to be able to find a definition about its supposed value range and data size. Quoting the yellow paper rule (287) ...
2
votes
1answer
218 views

Encode raw transaction data for inner transaction data for transfer using erc223

How do I encode data for inner transaction call of ERC223Receiver contract after transferring erc223 tokens to it? example: Contract ERC223Receiver { function foo(uint256 a) { // some ...
0
votes
1answer
946 views

How to convert decode/encode string to Base58?

How to convert decode/encode string to Base58 on solidity?
5
votes
1answer
2k views

Python and Solidity keccak256 function gives different results

I am working on implementing a smart contract application in which, on and off chain calculations will exist. I will have to calculate the Hash Function of multiple integers with Python and Solidity. ...
2
votes
1answer
900 views

How to encode dynamic types when calling a contract function?

I am trying to figure out how to calculate the offset in bytes to the start of their data area, measured from the start of the value encoding as described here in the Solidity docs for dynamic ...
6
votes
4answers
2k views

How to decode Log.Data in Go

I'm fetching the logs using client.SubscribeFilterLogs. The event parameters are encoded in types.Log.Data. How can I decode it in go?
0
votes
1answer
40 views

Where can I test programming tokens?

When I follow the instructions on ethereum.org I need to download the wallet and sync it again by downloading all the blocks. This takes hours everytime, I feel I'm missing out on something. Is there ...
2
votes
2answers
1k views

How do I do the equivalent of Solidity's bytes32(a_signed_integer) in JavaScript?

I've got an app that takes various kinds of input via an HTML form, but always ends up sending it to a contract as bytes32. The expectation is that another contract that ultimately consumes the data ...
0
votes
1answer
278 views

user api to exchange eth token and wallet address creating using code

Is there any API to help exchange ether or tokens online which will help in coding an exchange. For bitcoin one can generate a wallet address, is it possible to generate a wallet address for Ethereum ...
2
votes
1answer
268 views

Encoding multidimensional arrays in raw transaction data

Say, there is a function in a contract: function foo(uint[2][2][2] numbers) {} How the following array should be encoded in raw transaction data? [ [ [ 1, 2 ], [ 3, 4 ] ], ...
2
votes
2answers
610 views

What is the correct encoding for geth keystore files?

I'm attempting to import a transcribed geth UTC--... format keyfile into geth on ubuntu, using this guidance, and am getting the following error: Fatal: Failed to load the private key: encoding/hex: ...
2
votes
0answers
618 views

What encoding is used for Ethereum addresses? [duplicate]

Is it Base58Check, which is used for Bitcoin addresses? Or something else?
1
vote
0answers
39 views

Case - does it make sense? [duplicate]

Am I right, that 0xc1384BAFDD139a61998e1f612948da22fD878BD2 and 0xc1384bafdd139a61998e1f612948da22fd878bd2 are the same addresses? I'm asking, because, for example, in Bitcoin base64 is used, so ...
1
vote
1answer
412 views

Ethereum Contract ABI - Encoding for functions with no arguments

I am using argument encoding from this page (https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) to build data field for offline signing. I am using eth.sendRawTransaction to call a function ...
2
votes
0answers
357 views

eth_sendTransaction for function with address type parameters

I'm interacting with my local private blockchain created using geth. I'm able to use eth_call, but now I have some problems with eth_sendTransaction. The signature of the function is this: function ...
5
votes
1answer
490 views

Storing hardcoded calldata in a Solidity contract

I've been trying to store a hardcoded call in a contract, but I'm getting confused on the encoding. Let's say I have the following bytes: ...