I want to create a contract with a hardcoded bytes variable.

contract Test(){
   function Test(){
      bytes x = 0x..... //greater than 32 bytes 

The above returns a Type int_const not implicitly convertible to expected type bytes storage pointer error.

1 Answer 1

contract C1 {
    function f1() returns(bytes) {
        bytes memory bb = "\x00\x01\x02";  // you can extend this

Tested using online Solidity Browser, output is:

Result: "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030001020000000000000000000000000000000000000000000000000000000000"
Cost: 25630 gas. 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.