Skip to Content
Mastering Blockchain Programming with Solidity
book

Mastering Blockchain Programming with Solidity

by Jitendra Chittoda
August 2019
Intermediate to advanced
486 pages
13h 52m
English
Packt Publishing
Content preview from Mastering Blockchain Programming with Solidity

Application Binary Interface encoding functions

Solidity provides many global functions to encode (including packed encoding) the different data types of Solidity. This encoded data is used to create payload data that can be sent to function calls for the external contract calls. These are also used to generate unique hashes of different values.

The following are the different functions available:

  • abi.encode(...) returns (bytes): ABI encodes the given arguments. Arguments can be of any type. It returns the encoded data as bytes.
  • abi.encodePacked(...) returns (bytes): This performs packed encoding of the given arguments. Arguments can be of any type. It returns the packed encoding of the data as bytes.
  • abi.encodeWithSelector(bytes4 selector, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ethereum

Mastering Ethereum

Andreas M. Antonopoulos, Gavin Wood
Complete Cryptocurrency and Blockchain Course | Learn Solidity

Complete Cryptocurrency and Blockchain Course | Learn Solidity

Ravinder Deol, Codestars By Rob Percival, Thomas Wiesner

Publisher Resources

ISBN: 9781839218262Supplemental Content