Questions tagged [abi]

The Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain and for contract-to-contract interaction. Data is encoded according to its type, as described in this specification. The encoding is not self describing and thus requires a schema in order to decode.

Filter by
Sorted by
Tagged with
94
votes
8answers
41k views

What is an ABI and why is it needed to interact with contracts?

ABI is referenced in many places including the official Ethereum website. What is an ABI and why is it necessary to use?
42
votes
3answers
35k views

How to call a contract method using the eth_call JSON-RPC API

Ok, so I'm trying to call a contract method using the methods provided by the Ethereum JSON RPC interface. The JSON RPC is running on an Ubuntu machine. Unfortunately, I can't really get a result back ...
38
votes
6answers
36k views

How do you get a json file (ABI) from a known contract address?

I want to watch a Solidity contract using the Mist browser. I know how to do that and it needs the address and the json. I have the address, but I don't have the json. I do have the source code. Can ...
21
votes
2answers
6k views

Do I need a compiled contract just to get the ABI definition?

Why do I need a compiled version of the contract just to get the ABI definition? Seems like the contract address should be enough. Im very confused because I am simply trying to run a contract ...
9
votes
1answer
12k views

What does Solidity's “call” function mean?

address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; nameReg.call("register", "MyName"); //1 nameReg.call(bytes4(sha3("fun(uint256)")), a); //2 if(!nameReg.call.value(10)){throw;} //3 Here ...
15
votes
1answer
4k views

Deploying contract with constructor arguments via Geth RPC

How can I deploy a compiled contract with constructor arguments using geth rpc? I have tested my call deployed the compiled contract bytecode just fine, I just don't understand how I can pass ...
6
votes
1answer
2k views

How is an ABI stored in bytecode?

I'm trying to understand how a simple hex string like 0x25d8dcf2 is enough information to execute a function in a contract. I've read up on the ABI and understand that the hex string is basically just ...
17
votes
6answers
12k views

Encoding/Decoding contract ABI data

How to encode and decode ABI data? Can someone show me an example with web3js library?
21
votes
3answers
4k views

Pass a function as a parameter in Solidity

Can you pass a function as a parameter in Solidity? My guess: There is the concept of address in Solidity, but they represent contracts. Contracts can have fallback functions, but I don't think you ...
10
votes
3answers
4k views

How does the EVM find the entry of a called function?

I read the source code of go-ethereum and confused about how does the EVM find the entry of a called function. As the specification said, the data field in a transaction specifies the function and the ...
10
votes
2answers
6k views

How to list all the contracts currently on the blockchain?

I know one way to interact with contracts is, in the geth interface, to use the command: eth.contract(ABI).at(Address) But for this I will need to know the ABI and address of the contract in advance....
5
votes
1answer
3k views

Interaction with a deployed smart contract from the geth command line

I have a contract which I'd like to be able to sum numbers submitted by any other address: contract UnitCounter { mapping (address => uint256) public UnitsFrom; uint256 public TotalUnits; ...
7
votes
2answers
3k views

Clarification of “256 bit word” semantics

EVM has "256bit words". Some cases treat strings shorter than 32 bytes (256 bits) as left-justified ascii (packed into the most significant bytes of the word). Does this mean that the word value of ...
5
votes
1answer
677 views

Accessing the last function parameter from msg.data

I have a fallback (unnamed) function in my contract and I know that the last parameter (or first, does not matter) passed is always an uint. Is it possible to somehow access it though the msg.data?
4
votes
3answers
4k views

How get Constructor Arguments ABI-encoded?

Im trying to verify an ETH contract, but I complete the etherscan form to and i receive this message: "Error! Unable to verify source code Missing Constructor Arguments for function JL(uint256 ...
4
votes
1answer
240 views

What is a function selector?

I am reading an article, it says: To enable deployment on the Ethereum platform, the contract functions are compiled into EVM bytecode and a piece of code called function selector is added, ...
8
votes
2answers
12k views

Getting ABI data for ERC20 tokens programatically with Web3 [duplicate]

I am just starting to dive into Web3. I am trying to display the various ERC20 token values for a given Ethereum Address. The pieces I need to do this are: Token Contract Address Token Contract ABI ...
6
votes
2answers
3k views

Understanding nameReg.call(“register”, “MyName”) style call between contracts

Here's an example from solidity docs on Address type methods(call method specifically): address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; nameReg.call("register", "MyName"); ...
3
votes
1answer
2k views

How to decode input data with ABI using java?

There is a tool on npm ethereum-input-data-decoder. And yes, i can read input data as hex byte[] bytes = Hex.decodeHex(transactionReceipt.getInput().substring(2).toCharArray()); System.out.println(...
8
votes
2answers
5k views

How to get the contract ABI in new Remix IDE?

Waked up today just to find out the remix browser interface changed to this what happened !!? I cannot find the contract details to get the json interface anymore.
3
votes
1answer
455 views

How to explain string serialization when invoking contract method?

On Ropsten testnet I have deployed a contract like this: // creation of contract object var aContract = web3.eth.contract([{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"...
3
votes
1answer
1k views

How are the arguments of the constructor encoded in the contract creation transaction?

The Ethereum ABI defines how arguments are encoded and passed when a method is called. But how are the arguments to the constructor encoded in the contract creation transaction which creates the smart ...
3
votes
2answers
675 views

Passing Struct as an argument in call

I am trying to pass a struct as an argument while calling the function of another contract: pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; library Test { struct TStruct { int x; ...
3
votes
1answer
1k views

Can you help me parse this input data from a newProposal transaction from The DAO?

Every Ethereum transaction that represents a function call on a smart contract holds an input field with data that corresponds to the data sent through the interface of the function. For example, this ...
3
votes
5answers
3k views

Is there a way to extract ABI from a deployed contract?

I am building a web UI for testing smart contracts and currently I have to supply the ABI for a contract I test. Is there a way to extract the ABI from a deployed contract (preferably programmatically)...
0
votes
0answers
80 views

Are there any libraries/tools for encoding input for data field of web3.eth.call method? [duplicate]

You can call contract functions using web3.eth.call method. Information on which function to call and what arguments to pass to this function is encoded according to the rules that can be found here. ...
8
votes
2answers
3k views

How to estimate the cost to call a Smart Contract method?

After succesfully deployed this Smart Contract on Ethereum testnet https://testnet.etherscan.io/address/0x27c042342C9ba937214117e11A4970A6145034cB is it possible to calculate how much gas is going ...
2
votes
1answer
774 views

Where does ABI decoding take place?

I'm trying to understand the winning contract from the Underhanded Solidity Contest. That contract apparently caused an overflow in the ABI decoder, but I'm having a hard time understanding where in ...
11
votes
3answers
7k views

Convert contract arguments from JSON to ABI-encoded format

I want to verify a contract code on Etherscan, but don't know how to get the arguments in ABI-encoded format. I have the source code and the interface in JSON. Is there some tool I can use, or some ...
6
votes
2answers
557 views

Is sending some datas in the data field safe?

An airdrop ask to send it 0ETH with 150000 GAS and some datas in DATA field. Is it safe? What could be the aim of this transaction? Thanks.
4
votes
2answers
1k views

What is calldata?

What is calldata? I learned that there are three types of memories: Storage Memory Stack In the Ethereum docs, it says that the function parameters are of type memory by default. However, I've also ...
1
vote
1answer
2k views

How to verify a contract having constructor arguments?

This is a contract that requires an argument to be deployed. The Contract Name is "Asset". The compiler used is "Compiler 0.4.16+commit.d7661dd9.Emscripten.clang" and Optimization was Disabled. To ...
7
votes
1answer
2k views

How to watch contracts on Mist without ABI?

I've been trying to watch the Ethereum Alarm Clock contract on the main net (@ 0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b) via Mist. This is the first time I've used Mist to watch contracts and I don'...
5
votes
1answer
549 views

Do you need to publish the contract ABI and address for others to interact with the contract?

Suppose you write a contract that you want others to interact with. My understanding is that if you want others to interact with your contract, you need to provide the contract's ABI and address. Is ...
4
votes
1answer
1k views

How to parse ABI out of contract code?

Using the web3 JS library, there's hooks to grab a transaction by its hash (web3.eth.getTransaction()), which includes an input property that is the data payload of the transaction. The first four ...
2
votes
1answer
536 views

ethereumjs-abi equivalent for Golang?

ethereumjs-abi is great for easily ABI encoding and decoding in javascript. Is there an equivalently simple package for Golang? Geth's accounts/abipackage does this, but there's a lot of setup and it'...
0
votes
1answer
40 views

Calling contract functions using only ABI without source code

I have MyContract.json file of some contract(assume i haven't its source code). In .json file, there is abi and bytecode. If i want to deploy such contract (through web3js), I am facing following ...
0
votes
2answers
370 views

Can you obtain the ABI of a smart contract using the contract address and contract code?

I have an ABI I'm trying to use to execute a withdraw of Ethereum from a smart contract via MyEtherWallet, but I'm receiving an error of "Please enter a valid ABI." I'm concerned the ABI I have is ...