Say I have this example contract:

pragma solidity ^0.4.0;
contract SEexample {

    int256[3] thing;
    uint8 internal i=0;

    function submit(int256[3] bids,int256[3] prefs) public returns (int256[3]){
            for (i=0;i<3;i++){
                thing[i] = bids[i] + prefs[i];
        return thing;

Giving this abi:

        "constant": false,
        "inputs": [
                "name": "bids",
                "type": "int256[3]"
                "name": "prefs",
                "type": "int256[3]"
        "name": "submit",
        "outputs": [
                "name": "",
                "type": "int256[3]"
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"

And I deploy using web3.py:

from web3 import Web3, HTTPProvider, IPCProvider
w3 = Web3(HTTPProvider('http://localhost:8545'))   //(testrpc)
tx_hash = contract.deploy(transaction={'from': w3nce.eth.accounts[0], 'gas': 10000000})
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
contract_address = tx_receipt['contractAddress']
contract_instance = w3.eth.contract(address=contract_address, abi=abi, ContractFactoryClass=ConciseContract)

How do I instruct python to meet the int256[13] that the function requires?

I've tried variations on:

import numpy as np
x=contract_instance.submit(a,b, transact={'from': w3.eth.accounts[1]})

also with a.tobytes(), b.tobytes()

Results in :

raise ValueError("No matching functions found")

ValueError: No matching functions found


This seems to work:

x=contract_instance.submit(a.tolist(),b.tolist(), transact={'from': w3.eth.accounts[1]})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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