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

Qwerty
  • 221
  • 1
  • 9

1 Answers1

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".

Ismael
  • 30,570
  • 21
  • 53
  • 96