0

What does the abi.encodePacked("abcdef", "123") function do and how can I simulate the output?

This function is missing in these projects web3-eth-abi, ethereumjs-abi and when I try to call it in ethfiddle I get an error ParserError: Expected pragma, import directive or contract/interface/library definition. abi.encodePacked, so I guess I am not doing something right.

related: web3 equivalent of abi.encodePacked, How to quickly test a Solidity function?
resource: https://docs.soliditylang.org/en/latest/abi-spec.html#abi-packed-mode

1 Answer 1

2

The abi.encodePacked("abcdef", "123") is from solidity. It packs the parameters "tightly", see the definition here: https://docs.soliditylang.org/en/v0.8.10/abi-spec.html#non-standard-packed-mode

In this particular case it will return "abcdef123".

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.