abi2signature
Generates the Ethereum ABI 4 byte signatures if you provide the ABI or the function signature.
Installation
$ npm i -g abi2signature
Usage examples
From stdin
$ abi2signature < cryptokitties-abi.json0x06fdde03 -> [ function ] name0x095ea7b3 -> [ function ] approve0x18160ddd -> [ function ] totalSupply0x23b872dd -> [ function ] transferFrom0x313ce567 -> [ function ] decimals0x475a9fa9 -> [ function ] issueTokens0x70a08231 -> [ function ] balanceOf0x95d89b41 -> [ function ] symbol0xa9059cbb -> [ function ] transfer0xdd62ed3e -> [ function ] allowance0xddf252ad -> [ event ] Transfer0x8c5be1e5 -> [ event ] Approval
From function string
$ abi2signature func2sig "receive(address)"receive(address) -> 0x9d01174f
From ABI string
$ abi2signature string2sig '[{...your abi...}]'
Vyper one liner
$ vyper -f abi contracts/uniswap_exchange.vy | abi2sig
Solidity one liner
Solidity outputs a header so I could not find a way to do this
$ solc --abi --pretty-json contracts/ballot.sol | abi2signature======= contracts/ballot.sol:Crowdfunding =======...