Questions tagged [bytes]

both the fixed-size array byte, bytes1...bytes32, and the dynamic array bytes types in Solidity

https://solidity.readthedocs.org/en/latest/types.html#fixed-size-byte-arrays

bytes1, bytes2, bytes3, ..., bytes32. byte is an alias for bytes1.

https://solidity.readthedocs.org/en/latest/types.html#dynamically-sized-byte-array

bytes: Dynamically-sized byte array

202 questions
4
votes
1 answer

What does the bytes format “\xFF\xFF\xFF” mean and how it is interpreted?

bytes sig = hex"aca7da" and bytes sig = "\xac\xa7\xda" seem to be the same thing, ASCII interpreted as hex. Does the format "\xFF\xFF\xFF" somehow code that it should be read as hex?
cryptorenaisance
  • 593
  • 1
  • 6
  • 8
2
votes
1 answer

How does solidity find positions within a bytes array?

My understanding of arrays is that the initial storage point of the array is used to find the beginning of the array, and finding specific items in the array from that point forward require even distribution of elements, as the product of the index…
CreatedAMadman
  • 190
  • 1
  • 14
2
votes
0 answers

How to input byte array to a function?

I have a function in my contract and it have bytes1[4] array parameter and returns. function foo(bytes1[4] memory _mdata) public pure returns(bytes1[4]){ bytes1[4] memory result; uint8 i; for(i=0 ; i<4 ; i++){ result[i] =…
Kronos
  • 896
  • 1
  • 10
  • 21
1
vote
1 answer

bytes seem to be limited to length 8

I'm pretty new to Solidity, and I was writing a contract to play around with dynamic arrays. My array length grows, but it seems to stop at length 8. Here's the contract I wrote: pragma solidity 0.4.19; contract BigData { bytes public doubleBag…
Breedly
  • 111
  • 4
1
vote
1 answer

Converting bytes16 to int128

I am working on a little decentralized game with a world made of plots. It has a map which links a location to a Plot struct. A location is saved as a bytes16 but represents two int64 (coordinates can be negative and the center is in 0, 0). How can…
Th0rgal
  • 245
  • 1
  • 2
  • 11
0
votes
2 answers

What is the purpose of the variable "maxlength" in this function?

I am trying to understand the function "appendUintToString" from Solidity concatenate uint into a string? The function is recreated below. For now, I am trying to understand what the integer "maxlength" does. function appendUintToString(string…
CreatedAMadman
  • 190
  • 1
  • 14