py-substrate-interface: Contract instantiate produces OutputBufferTooSmall error

Hi Arjan, it’s probably a substrate question, not the interface, but I would like to know what causes this OutputBufferTooSmall error when I try to run

call = substrate.compose_call(
    call_module='Contracts',
    call_function='instantiate',
    call_params={
        'endowment': 1000000,
        'gas_limit': 1000000000,
        'code_hash': code_hash,
        'data': '0x{}'.format(code_bytes.hex())
    }
)

is it something about the data? What goes into data, I didn’t find in the docs. Not the contract code I assume, as it already was passed with the contracts.put_code …?

Screenshot 2020-11-24 at 13 06 21

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

@wzli is it possible for you to share your metadata.json file? Then I have some more example data to run my tests with

Sure, I’m testing an auction contract for off chain assets:

metadata.json.txt

I just released an initial version of ink! contract interfacing classes, still heavily under construction, but you can check out an example here:

https://github.com/polkascan/py-substrate-interface#ink-contract-interfacing-work-in-progress

Hi, I wanted to chime in for additional interest in being able to interact with ink contracts via python. From this discussion, as far as I can tell ATM things should work as long as the data field in the call param of the call extrinsic is correctly formatted? And the spec is (correct me if I’m wrong): selector + param + param + … + param + salt, encoded in SCALE. I’d be great to have a nice interface generated by parsing the contract’s metadata json but building the block manually isn’t too bad.

I’ve also tested deploying multiple of the same contracts, and it seem to work for me when I change the input param during deploy without a salt. Maybe the contract id is just blake2b of account + code_hash + data.

Oh I see, so I’d need this snippet from the metadata file, right?

 "docs": [
          " Creates a new ERC-20 contract with the specified initial supply."
        ],
        "name": [
          "new"
        ],
        "selector": "0xd183512b"