All Projects → rust-ethereum → Ethabi

rust-ethereum / Ethabi

Licence: apache-2.0
Encode and decode smart contract invocations

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Ethabi

Burrow
https://wiki.hyperledger.org/display/burrow
Stars: ✭ 851 (+394.77%)
Mutual labels:  ethereum, evm
Chaingear
The consensus computer driven database framework
Stars: ✭ 83 (-51.74%)
Mutual labels:  ethereum, evm
Ette
EVM-based Blockchain Indexer, with historical data query & real-time notification support 😎
Stars: ✭ 37 (-78.49%)
Mutual labels:  ethereum, evm
Ethereumjs Monorepo
Monorepo for the Ethereum VM TypeScript Implementation
Stars: ✭ 813 (+372.67%)
Mutual labels:  ethereum, evm
Chains
provides metadata for networkIDs and chainIDs
Stars: ✭ 117 (-31.98%)
Mutual labels:  ethereum, evm
Ruby To Solidity
(Secure) Ruby to Solidity (Source-to-Source) Cross-Compiler Cheat Sheet / White Paper
Stars: ✭ 7 (-95.93%)
Mutual labels:  ethereum, evm
Py Evm
A Python implementation of the Ethereum Virtual Machine
Stars: ✭ 1,122 (+552.33%)
Mutual labels:  ethereum, evm
Dapptools
Dapp, Seth, Hevm, and more
Stars: ✭ 362 (+110.47%)
Mutual labels:  ethereum, evm
Hevm
(OLD REPO) A debug-oriented Ethereum VM (EVM)
Stars: ✭ 114 (-33.72%)
Mutual labels:  ethereum, evm
Openzeppelin Contracts
OpenZeppelin Contracts is a library for secure smart contract development.
Stars: ✭ 14,308 (+8218.6%)
Mutual labels:  ethereum, evm
Intellij Solidity
Solidity plugin for IntelliJ
Stars: ✭ 646 (+275.58%)
Mutual labels:  ethereum, evm
Evmc
EVMC – Ethereum Client-VM Connector API
Stars: ✭ 137 (-20.35%)
Mutual labels:  ethereum, evm
Echidna
Ethereum smart contract fuzzer
Stars: ✭ 571 (+231.98%)
Mutual labels:  ethereum, evm
Evmone
Fast Ethereum Virtual Machine implementation
Stars: ✭ 162 (-5.81%)
Mutual labels:  ethereum, evm
Aleth
Aleth – Ethereum C++ client, tools and libraries
Stars: ✭ 3,885 (+2158.72%)
Mutual labels:  ethereum, evm
Remix
This has been moved to https://github.com/ethereum/remix-project
Stars: ✭ 1,063 (+518.02%)
Mutual labels:  ethereum, evm
Evm Opcodes
Ethereum opcodes and instruction reference
Stars: ✭ 344 (+100%)
Mutual labels:  ethereum, evm
Awesome Ethereum Security
A curated list of awesome Ethereum security references
Stars: ✭ 345 (+100.58%)
Mutual labels:  ethereum, evm
Evm2wasm
[ORPHANED] Transcompiles EVM code to eWASM
Stars: ✭ 96 (-44.19%)
Mutual labels:  ethereum, evm
Remix Ide
Documentation for Remix IDE
Stars: ✭ 1,768 (+927.91%)
Mutual labels:  ethereum, evm

ethabi

The ABI, Application Binary Interface, is basically how you call functions in a contract and get data back.

An ABI determines such details as how functions are called and in which binary format information should be passed from one program component to the next...

An Ethereum smart contract is bytecode, EVM, on the Ethereum blockchain. Among the EVM, there could be several functions in a contract. An ABI is necessary so that you can specify which function in the contract to invoke, as well as get a guarantee that the function will return data in the format you are expecting. read more

This library encodes function calls and decodes their output.

Documentation

Disclaimer

This library intends to support only valid ABIs generated by recent Solidity versions. Specifically, we don't intend to support ABIs that are invalid due to known Solidity bugs or by external libraries that don't strictly follow the specification. Please make sure to pre-process your ABI in case it's not supported before using it with ethabi.

Installation

cargo install ethabi-cli

Usage

Ethereum ABI coder.
  Copyright 2016-2017 Parity Technologies (UK) Limited

Usage:
    ethabi encode function <abi-path> <function-name-or-signature> [-p <param>]... [-l | --lenient]
    ethabi encode params [-v <type> <param>]... [-l | --lenient]
    ethabi decode function <abi-path> <function-name-or-signature> <data>
    ethabi decode params [-t <type>]... <data>
    ethabi decode log <abi-path> <event-name-or-signature> [-l <topic>]... <data>
    ethabi -h | --help

Options:
    -h, --help         Display this message and exit.
    -l, --lenient      Allow short representation of input params.

Commands:
    encode             Encode ABI call.
    decode             Decode ABI call result.
    function           Load function from json ABI file.
    params             Specify types of input params inline.
    log                Decode event log.

Examples

ethabi encode params -v bool 1

0000000000000000000000000000000000000000000000000000000000000001

--

ethabi encode params -v bool 1 -v string gavofyork -v bool 0

00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096761766f66796f726b0000000000000000000000000000000000000000000000

--

ethabi encode params -v bool[] [1,0,false]

00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

--

ethabi encode params -v '(string,bool,string)' '(test,1,cyborg)'

00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004746573740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066379626f72670000000000000000000000000000000000000000000000000000

--

ethabi encode function examples/test.json foo -p 1
[{
	"type":"function",
	"inputs": [{
		"name":"a",
		"type":"bool"
	}],
	"name":"foo",
	"outputs": []
}]

455575780000000000000000000000000000000000000000000000000000000000000001

--

ethabi encode function examples/test.json foo(bool) -p 1
[{
	"type":"function",
	"inputs": [{
		"name":"a",
		"type":"bool"
	}],
	"name":"foo",
	"outputs": []
}]

455575780000000000000000000000000000000000000000000000000000000000000001

--

ethabi encode function examples/test.json bar(bool) -p 1
[{
	"type":"function",
	"inputs": [{
		"name":"a",
		"type":"bool"
	}],
	"name":"foo",
	"outputs": []
}]

6fae94120000000000000000000000000000000000000000000000000000000000000001

--

ethabi encode function examples/test.json bar(string):(uint256) -p 1
[{
	"type":"function",
	"inputs": [{
		"type":"string"
	}],
	"name":"foo",
	"outputs": [{
		"type": "uint256"
	}]
}]

d473a8ed000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000013100000000000000000000000000000000000000000000000000000000000000

--

ethabi decode params -t bool 0000000000000000000000000000000000000000000000000000000000000001

bool true

--

ethabi decode params -t bool -t string -t bool 00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096761766f66796f726b0000000000000000000000000000000000000000000000

bool true
string gavofyork
bool false

--

ethabi decode params -t bool[] 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

bool[] [true,false,false]

--

ethabi decode params -t '(string,bool,string)' 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000673706972616c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000067175617361720000000000000000000000000000000000000000000000000000```

(string,bool,string) (spiral,true,quasar)

--

ethabi decode function ./examples/foo.json bar 0000000000000000000000000000000000000000000000000000000000000001
[{
	"constant":false,
	"inputs":[{
		"name":"hello",
		"type":"address"
	}],
	"name":"bar",
	"outputs":[{
		"name":"",
		"type":"bool"
	}],
	"type":"function"
}]

bool true

--

ethabi decode log ./examples/event.json Event -l 0000000000000000000000000000000000000000000000000000000000000001 0000000000000000000000004444444444444444444444444444444444444444

a bool true
b address 4444444444444444444444444444444444444444

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].