I have a function in my smart contract called getRandomNumer, and it returns a bytes32. However, in brownie, when I make a transaction it returns the transaction receipt.

How do I get the return value?

requestId = vrf_consumer.getRandomNumber(get_seed, {'from': accounts[0]})

2 Answers 2


You can use tx.return_value in the transaction receipt or make a .call request.

.call which will simulate the transaction going through. Just to note, if you send the transaction again, and then call .call again, it will be different. Here are some examples;

requestId is the transaction receipt:

requestId = vrf_consumer.getRandomNumber(get_seed, {'from': accounts[0]})

requestId is the requestId (returned value):

requestId = vrf_consumer.getRandomNumber.call(get_seed, {'from': accounts[0]})

Use TransactionReceipt.return_value

tx = vrf_consumer.getRandomNumber(get_seed, {'from': accounts[0]})
request_id = tx.return_value

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.