Forum

Default transaction value large negative number with web3

Hey all, anybody here familiar with how default transaction values are set on xDai? I’m attempting to call a function on my smart contract, so I build my transaction using w3 like so:

transaction = contract.functions["FUNCTION_NAME"](*args, **kwargs)
    .buildTransaction({
        "from": wallet_address,
        "nonce": nonce,
        "gas": 1000000,
        "gasPrice": 1000000000,
     })

You can see from these parameters that I do not specify a tx value. I do this because I would like to use the default value (which is 0) specified by w3: http://t.ly/jgz9. However, the transaction I am returned ends up having a value of -900000000000000 wei. Since I don’t specify this value, and since w3 doesn’t either, I am assuming that xDai itself must handle this. Any ideas on why this is occurring are greatly appreciated.

My expectation is that when you do buildTransaction it does not send actual transaction to the network but serialize data that must be signed later. That’s why honestly I do not understand what exactly you meant when you said the transaction I am returned ends up having a value of -900000000000000 wei.

1 Like