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
2
votes
1answer
1k views

bytes4(keccak256(“function(uint256)”)) vs. (abi.encodeWithSignature(“buyItem(uint256)”)

What is the (a) technical difference between and (b) practical difference between these, i.e., when do you use one or the other: bool result = address(contract).call.value(10)(bytes4(keccak256("...
2
votes
2answers
2k views

Deploy contract from command line

Is there any command or utility to deploy contract from .sol file to test-net? I've seen there is JSON API, so I can write some code to implement this. But isn't it done already? Thanx.
2
votes
1answer
874 views

Uncaught Error: could not decode, json: cannot unmarshal array into Go value of type string(…)

I'm trying to use my already deployed contract using web3.js from my console but i'm having issues. I get my compiled contract from browser-solidity then do: var web3 = new Web3(new Web3.providers....
2
votes
1answer
110 views

Who uses the ABI typically? Is it the wallet?

I have seen all kinds of explanations of ABI. But I am still wondering who would use it. As per my current understanding it should be wallet apps using it. Or is it the node app? Can someone please ...
2
votes
1answer
51 views

Automatically extracting functions names and parameters from ABI JSON file

I have done some work on captioned subject. For example, I can extract all getter functions (and some constructors as well) of all given smart contracts (in abi json file format). Then i can call (...
2
votes
0answers
21 views

Why is it required to know the function selector in a smart contract to call the function? [duplicate]

I understand what a function selector is and how it is computed: The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order ...
2
votes
2answers
115 views

Hashnot matching generated from solidity contract and web3js

I want to make hash same as generating by solidity contract from web3 or ether's js. In solidity contract hash generation by below : sha256(abi.encodePacked(no of parameters)). Kindly help for it. ...
2
votes
0answers
49 views

Why I can't use two functions with same name, but different parameters

I have a function which returns address but it gives me error if I try to read it. I'll explain by a quick example: Solidity: contract TestOneReturn { mapping(uint => uint) m_Data; ...
2
votes
1answer
572 views

How can I decode the inputs to a transaction written by a smart contract constructor with Nethereum?

I've been able to decode the inputs to a contract function transaction given the ABI as follows: var myFunction = contract.GetFunction("MyFunction"); var myFunctionTxn = await contract.Eth....
2
votes
0answers
233 views

“queue limit” error

I try to deploy a smart contract and every time i receive "queue limit" error. Here is what i do: Web3 = require("web3") web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); ...
2
votes
1answer
158 views

How can I check if a contract contains a specific function signature in the ABI?

I'm using Geth and thinking maybe I'll have to deep dive into the Go code to make this happen, but it should be possible. What would I need to do to check if a function signature exists in a contract?
2
votes
0answers
221 views

How to get ABI for an existing contract [duplicate]

I'm trying to understand Ethereum smart contract interaction at the base level using the JSON-RPC. Say I want to update a contract programmatically. I create the contract, there is a public method ...
2
votes
0answers
360 views

eth_sendTransaction for function with address type parameters

I'm interacting with my local private blockchain created using geth. I'm able to use eth_call, but now I have some problems with eth_sendTransaction. The signature of the function is this: function ...
1
vote
2answers
209 views

Do you know online tool for abi encoding?

Is there easy to use online tool to encode ABI parameters to pass verification on etherscan?
1
vote
2answers
123 views

Can a Contract ABI change?

I am developing an app that is using the etherscan-api package. I use it to get the contract ABI. The problem is that I retrieve it via the API every time the function is called. My question is: ...
1
vote
2answers
246 views

Abi to call value

how to calculate ABI to call some variable in contract? for example contract X { uint data; function Y(uint a) {} } How to calculate signature to call variable "data" ? I know to call ...
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 ...
1
vote
1answer
146 views

how to create Function Selector (Method IDs)

As stated in ABI specs that 0xcdcd77c0: the Method ID. This is derived as the first 4 bytes of the Keccak hash of the ASCII form of the signature baz(uint32,bool). So, I have to create method IDs (...
1
vote
2answers
156 views

verify and publish when using oraclize?

I'm using oraclize in my contract. import "github.com/oraclize/ethereum-api/oraclizeAPI.sol"; When I go to verify and publish on etherscan I get this error myc:4:1: ParserError: Source "github.com/...
1
vote
2answers
354 views

Encode constructor arguments used when deploying a contract

How can I encode the constructor arguments when deploying a contract? Here is my deployment function: async function deploy(abi, bin, args) { let contract = new this.web3.eth.Contract(JSON.parse(...
1
vote
1answer
405 views

Is there a way to reverse engineer and know the ABI of a contract just by knowing its contract address?

Let me be clear on this, here i want reverse functionality. I have the contract address generated and i am able to access it in the mined block. However i want to know what is the data in ABI json ...
1
vote
1answer
325 views

How to access public contract storage with Go?

I have a mapping defined in a contract: mapping(bytes32=>string) public name; How can I access this in Go? abigen provides bindings for functions but not variables. This question shows how to ...
1
vote
1answer
13 views

Running test with multiple contract address on a local Ganache blockchain

I'm developing with Truffle and Ganache I have an standard ERC20 ABI that I import in my test file. it only has 3 optionals functions name, symbol and decimals. const Token = artifacts.require('./...
1
vote
1answer
31 views

Can't find address in abi encoded data of event

I have an event with the signature Event(address, uint256, string) which my smart contract emit from time to time. I am testing said contract on a ganache test net where when the Ganache picks up ...
1
vote
1answer
31 views

AbiEncoderV2 encoding Tuple algorithm

Where can I find AbiEncoderV2 encoding Tuple algorithm? I would like to add Tuples support to a ruby library.
1
vote
1answer
678 views

Web3js & Web3.py ERC20 Name, Symbol, & Decimals call(): Results in Web3.exceptions & OverflowError for Some But Not All Existing Contracts

I'm building simple Javascript & Python 3 scripts using the Web3 module to output ERC20 token names, symbols, and decimals from any given contract address. The standard ERC20_ABI json file was ...
1
vote
1answer
37 views

I have a huge ᴀʙɪ file in the ᴊꜱᴏɴ fomat but third party’s contract’s code is private. How to generate the list of function selectors?

I have an abi file with lot of functions for a large contract. It would really take a lot of time to generate by hand the hash of each functions/methods. Since the source code isn’t public, how to ...
1
vote
1answer
1k views

Abi encode / decode using strings instead of bytes

For some reason beyond my control, I need to store encoded data in a string variable. I know abi.encode and abi.decode usually work on bytes memory but I also believe that string memory can be casted ...
1
vote
1answer
52 views

Is the encoded ABI of a function guaranteed to be unique?

I assume that two functions of different prototypes will yield two different encoded ABIs. Is that correct? With regards to two functions of the same prototype, I tested a pair of functions which ...
1
vote
1answer
705 views

Solidity 0.5.2 - OpenZeppelin - New SafeERC20 callOptionalReturn(token,data)

i've been trying to mix ERC20 functionality with ERC223 function overloading technique and create a bridge for backwards compatibility using SafeERC20. For relevancy sake i renamed SafeERC20 into ...
1
vote
1answer
39 views

Where is the position of each paramter in a smart contract function when encoded as inputdata in a transaction

When I reviewed the BEC attack, I found the position of each parameters value in real transaction was not corresponding in to definition of function in smart contract. The exploit transaction is at: ...
1
vote
1answer
228 views

abi.encodeWithSignature did not work

pragma solidity ^0.5.3; contract SimpleFallback{ event FallbackCalledEvent(bytes data); event AddEvent(uint a, uint b, uint result); event DoubleEvent(uint a, uint b); event ...
1
vote
1answer
134 views

Can abstract contracts in solidity have state variables?

I want to have one deployed contract with my data structure and all data and another separate contract with functions that calls the deployed contract. If i've understood things correctly, one should ...
1
vote
1answer
165 views

Anyone with knowledge in org.web3j.abi.Type Decoder?

I am trying to decode a String with this code that I found but I have not been able to do it. String to = inputdata.substring(10, 74); String value = inputdata.substring(74, 138); Method refMethod = ...
1
vote
1answer
24 views

Dapp SDK - Hardcoded ABIs vs Dynamic ABIs

I am developing a Javascript SDK to allow for integration of external services with our Dapp. The SDK calls the smart contracts' methods and therefore needs to know contracts addresses and ABIs. ...
1
vote
1answer
790 views

Where do I find the “constructor arguments” for a contract deployed with Remix?

When try to verify token, I dont know what to put in for this line: Constructor Arguments ABI-encoded (For contracts that accept constructor parameters) I made token after looking at a YouTube ...
1
vote
1answer
477 views

Truffle: Creating a single ABI file if contracts are in separate .sol files?

I am building a project which is divided into separate .sol files, one per contract or interface. The tutorial shows a single file cryptozombies_abi.js which appears to me to be something like the ...
1
vote
1answer
258 views

web3.py - Python dtype for contract function with int256[x]

Say I have this example contract: pragma solidity ^0.4.0; contract SEexample { int256[3] thing; uint8 internal i=0; function submit(int256[3] bids,int256[3] prefs) public returns (...
1
vote
1answer
112 views

ABI artifacts corrupted, manually edit ABI?

Is it possible to manually add functions to the ABI, specifically the getProduct and addProductToStore functions? Does it make a difference? Have already tried deleting build + recompiling + ...
1
vote
2answers
2k views

How to get a variable from the smart contract with web3 and abi?

I use web3.js and try to take a value of the variable from the smart contract. My code for it is: var contract = web3.eth.contract(abi).at(address); where abi - json array and address - valid ...
1
vote
1answer
73 views

Is there an online database that maps functions with their signature?

I have already seen a site with all the functions of solidity with its signature, but do not remember its url, I'm looking for it.
1
vote
2answers
679 views

How are Solidity structs serialized?

I'm trying to serialize a struct off chain so that I can pass it to a function as bytes32[length] that dynamically casts it to a struct (using assembly). However looking at memory representation of ...
1
vote
1answer
104 views

How to see common ENS names that have been auctioned?

In the ENS documentation, it says that the "DApp" shows you when common ENS names are being auctioned. How do the DApp and the twitter bot know what names people are auctioning? The DApp and ...
1
vote
1answer
764 views

Accessing a 3rd party contract's functions using Truffle

I'm trying to build a basic dashboard that will allow me to track the status of any given ICO (assuming the token is ERC20). Right now, I managed to deploy a simple Crowdsale + Coin contract based ...
1
vote
1answer
628 views

When using delegatecall, data in parameters of type uint[] are left-shifted by 8 bits

progma solidity ^0.4.15; contract Callee { uint public result_; function foo (uint _length, uint[] _nums) public returns (uint) { result_ = 0; for ( uint i = 0; i <...
1
vote
1answer
419 views

how to retrieve function call address from deployed contract for usage with MetaMask send + transaction data?

I've deployed a contract into my testrpc network. $ truffle deploy Using network 'development'. Running migration: 1_initial_migration.js Deploying Migrations... Migrations: ...
1
vote
1answer
497 views

Instantiate a deployed Smart Contract

After deploying a Smart Contract and knowing that: address = 0x20e4ac9385ea45919b9709c2b38d3190efa42ee4 ABI = [{ constant: false, inputs: [], name: "kill", outputs: [],...
1
vote
1answer
30 views

How does the EVM identify a dynamic type in the function calldata?

So as per the ABI encoding specifications mentioned in Solidity Docs, for a dynamic array, the data location (in bytes from start, for the data part) is specified at first, followed by the length of ...
1
vote
1answer
24 views

Events declared in library are missed in contract ABI

DYDX contract SoloMargin is firing events like LogTrade, LogSell but they are not provided in ABI. SoloMargin contract: https://etherscan.io/address/0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e#code ...
1
vote
1answer
120 views

How to get contract object using ABI json and address with web3j?

I worked with web3js(JavaScript) and used web3.eth.Contract with 2 params (json, address) and successfully got contract object. Now I started to work with web3j(Java) and don`t understand how I have ...