4

I am using multisig.liq at Try-Liquidity to generate a KT1 address(which has 3 owners, need 2 agree) and I send 10 xtz to it. When I transfer 2 to another KT1 address, I got ../preapply/operations failed.

I made sure transfer's param "parameters" is right(I paid and transfered 2 xtz to a tz1 address, then I found the block that include pay or manage transaction to get "parameters").

For pay is:

'parameters': {
    'prim': 'Left',
    'args': [{
        'prim': 'Unit'
    }]
}

For manage is:

'parameters': {
    'prim': 'Right',
    'args': [{
        'prim': 'Some',
        'args': [{
            'prim': 'Pair',
            'args': [{
                'string': $destination
            }, {
                'int': $amount

            }]
        }]
    }]
}

So I want to transfer to another KT1 address. First, I forged operation. Here's the code:

header2 = {"Content-Type": "application/json","Cache-Control": "no-cache"}
branch = requests.get("https://alphanet.tezrpc.me/chains/main/blocks/head/hash",headers=header1)
counter = requests.get("https://alphanet.tezrpc.me/chains/main/blocks/head/context/contracts/tz1PvVPHCtyvwrpLKoCFBXbiPh3DwmiFFKnQ/counter",headers=header1)
print(branch.json())
print(counter.json())

body = {'contents': [{
 'kind': 'transaction',
 'amount': '0',
 'source': 'tz1PvVPHCtyvwrpLKoCFBXbiPh3DwmiFFKnQ',
 'destination': 'KT1DKT2QpnwNnRCzVnYYuwuZuuS2AAajHBC4',
 'storage_limit': '60000',
 'gas_limit': '400000',
'fee': '50000',
'counter': str(int(counter.json()) + 1),
            'parameters': {
                'prim': 'Right',
                'args': [{
                    'prim': 'Some',
                    'args': [{
                        'prim': 'Pair',
                        'args': [{
                            'string': 'KT1CY4g5MTxwyfC7zT5eju8FkdgmnGgHF5Qj'
                        }, {
                            'int': '2000000'
                        }]
                    }]
                }]
            }
 }],
 'branch': branch.json()
}
r = requests.post("https://alphanet.tezrpc.me/chains/main/blocks/head/helpers/forge/operations",json = body,headers=header2)
print(r.json())

result is ok,return:    iaee37aa2db362fd021d14d669e7f34df15216e98714d31d4ecccc4c6bcdc11b10800002efd70b3ca5eb8d39531d36aa1b4eea21d52e8a0d08603c76880b518e0d403000133f2e99faa15741f833d623aa99800701aa2036900ff0000003405080509070701000000244b543143593467354d547877796643377a5435656a7538466b64676d6e4767484635516a008092f401

This is when ../preapply/operations failed happens. Here is the result:

'contents': [{
    'kind': 'transaction',
    'source': 'tz1PvVPHCtyvwrpLKoCFBXbiPh3DwmiFFKnQ',
    'fee': '50000',
    'counter': '13383',
    'gas_limit': '400000',
    'storage_limit': '60000',
    'amount': '0',
    'destination': 'KT1DKT2QpnwNnRCzVnYYuwuZuuS2AAajHBC4',
    'parameters': {
        'prim': 'Right',
        'args': [{
            'prim': 'Some',
            'args': [{
                'prim': 'Pair',
                'args': [{
                    'string': 'KT1CY4g5MTxwyfC7zT5eju8FkdgmnGgHF5Qj'
                }, {
                    'int': '2000000'
                }]
            }]
        }]
    },
    'metadata': {
        'balance_updates': [{
            'kind': 'contract',
            'contract': 'tz1PvVPHCtyvwrpLKoCFBXbiPh3DwmiFFKnQ',
            'change': '-50000'
        }, {
            'kind': 'freezer',
            'category': 'fees',
            'delegate': 'tz1Ke2h7sDdakHJQh8WX4Z372du1KChsksyU',
            'level': 104,
            'change': '50000'
        }],
        'operation_result': {
            'status': 'failed',
            'errors': [{
                'kind': 'permanent',
                'id': 'proto.003-PsddFKi3.badContractParameter',
                'contract': 'KT1DKT2QpnwNnRCzVnYYuwuZuuS2AAajHBC4'
            }, {
                'kind': 'permanent',
                'id': 'proto.003-PsddFKi3.invalidConstantTypeError',
                'location': 0,
                'expectedType': {
                    'prim': 'or',
                    'args': [{
                        'prim': 'unit',
                        'annots': ['%_Liq_entry_pay']
                    }, {
                        'prim': 'option',
                        'args': [{
                            'prim': 'pair',
                            'args': [{
                                'prim': 'key_hash',
                                'annots': ['%destination']
                            }, {
                                'prim': 'mutez',
                                'annots': ['%amount']
                            }],
                            'annots': [':proposition']
                        }],
                        'annots': ['%_Liq_entry_manage']
                    }],
                    'annots': [':_entries']
                },
                'wrongExpression': {
                    'prim': 'Right',
                    'args': [{
                        'prim': 'Some',
                        'args': [{
                            'prim': 'Pair',
                            'args': [{
                                'string': 'KT1CY4g5MTxwyfC7zT5eju8FkdgmnGgHF5Qj'
                            }, {
                                'int': '2000000'
                            }]
                        }]
                    }]
                }
            }, {
                'kind': 'permanent',
                'id': 'proto.003-PsddFKi3.invalidConstantTypeError',
                'location': 1,
                'expectedType': {
                    'prim': 'option',
                    'args': [{
                        'prim': 'pair',
                        'args': [{
                            'prim': 'key_hash',
                            'annots': ['%destination']
                        }, {
                            'prim': 'mutez',
                            'annots': ['%amount']
                        }],
                        'annots': [':proposition']
                    }]
                },
                'wrongExpression': {
                    'prim': 'Some',
                    'args': [{
                        'prim': 'Pair',
                        'args': [{
                            'string': 'KT1CY4g5MTxwyfC7zT5eju8FkdgmnGgHF5Qj'
                        }, {
                            'int': '2000000'
                        }]
                    }]
                }
            }, {
                'kind': 'permanent',
                'id': 'proto.003-PsddFKi3.invalidConstantTypeError',
                'location': 2,
                'expectedType': {
                    'prim': 'pair',
                    'args': [{
                        'prim': 'key_hash',
                        'annots': ['%destination']
                    }, {
                        'prim': 'mutez',
                        'annots': ['%amount']
                    }],
                    'annots': [':proposition']
                },
                'wrongExpression': {
                    'prim': 'Pair',
                    'args': [{
                        'string': 'KT1CY4g5MTxwyfC7zT5eju8FkdgmnGgHF5Qj'
                    }, {
                        'int': '2000000'
                    }]
                }
            }, {
                'kind': 'permanent',
                'id': 'proto.003-PsddFKi3.invalidConstantTypeError',
                'location': 3,
                'expectedType': {
                    'prim': 'key_hash'
                },
                'wrongExpression': {
                    'string': 'KT1CY4g5MTxwyfC7zT5eju8FkdgmnGgHF5Qj'
                }
            }]
        }
    }
}],
'signature': 'edsigtu9rtsMXF9GeMTu9QCwWeNMLmsn8BMMkcMVRPuLD9mtNAQSmPuMvNBvuXza4sygyxT9KGjsWyBNsEpVGB8mg8t5mUShekk'
}]

Could someone tell me how to transfer from a KT1 address to another KT1 address? After all, the application only exists for the scenario: transfer XTZ between 2 multisign KT1 address.

hope Ocaml Pro can answer. because the example mulitisig.liq can't send to another KT1 address

1

The liquidity multisig example you used can only send to a key_hash as per the smart contract code. This means that this multisig contract can not send to a KT1 address (which is an originated address).

You can do this using Michelson smart contracts, I have written a basic example in fi: https://github.com/TezTech/tzcontracts/blob/master/multi_sig/basic.fi

This contract can be compiled to Michelson at https://fi-code.com. We will be putting together more documentation regarding this and an example of how you can send and receive from it, but feel free to use the online editor and documentation too.

| improve this answer | |
  • 1
    hi stephen, could you please expand on your response to fully answer the question ? it looks more like a comment according to SE :) – Ezy Mar 4 '19 at 4:23
  • 1: I found a KT1 address KT1XfTzTJWFMsEukKXXVoKbwsBFbZvYS3hkn has no code. what meaning of this address, just for delegate? 2: if a KT1 address has michelson code. send to it must need parameter right? – purplecity Mar 4 '19 at 4:26
-1

In the error, you can see

'kind': 'permanent',
'id': 'proto.003-PsddFKi3.badContractParameter',
'contract': 'KT1DKT2QpnwNnRCzVnYYuwuZuuS2AAajHBC4'

This is because KT1DKT2QpnwNnRCzVnYYuwuZuuS2AAajHBC4 is not a contract with type parameter unit (https://alphanet.tzscan.io/KT1DKT2QpnwNnRCzVnYYuwuZuuS2AAajHBC4?default=code), so the internal TRANSFER_TOKENS with Unit fails.

| improve this answer | |

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.