Understanding simple coin transfers between accounts

I just performed my first coin transfer between two Address accounts:

And I noticed that this is a transaction of type “Script”, which has the following bytecode:


Why does this bytecode generate transfers? I couldn’t find any explanation in the docs. And I couldn’t reverse engineer it either.

You can run this through the Fuel Disassembler to decode the script to the following:

00000000      ret     $zero

Basically, the bytecode is just “return zero”

(Note: the disassembler can only read files, so I ran echo "0x24000000" | xxd -r -p > output.bin to save it, then forc dis output.bin)

So basically, the script does nothing, because a script isn’t needed for a basic transfer!

Just transferring from one account to another can be done by just specifying inputs & outputs of a transaction, the node will validate the accounting when validating the transaction.


Thanks! I didn’t know about the Disassembler.

might be a silly question (sorry for the spam!) but why is a script that returns zero needed if “a script isn’t needed for a basic transfer”?

No idea actually!

I’m not sure if a TX with an empty script (length 0) would be valid or not, maybe someone else can answer that.

1 Like

@Voxelot mentioned in our Slack that this minimal script comes from the SDK, but can probably be omitted.

1 Like

Yes, it should indeed be possible to emit that dummy script. As per the FuelVM specs on Script Execution:

If tx.scriptLength == 0, there is no script and the transaction defines a simple balance transfer, so no further checks are required.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.