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
1
vote
1answer
13 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 (...
0
votes
0answers
24 views

creating transaction with dynamic arguments (objects/variables)

My scenario is to make transactions (deploy contract, calling its functions, etc.) with arguments (which are dynamically created/extracted from some json abi file). For example; function ...
1
vote
1answer
18 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 (...
0
votes
1answer
39 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
1answer
37 views

How to automatically identify which value is stored in specific location of transaction input , given a smart contract source code and ABI?

For example, a function's name and parameters are given as following: function batchTransfer(address[] _receivers, uint256 _value) public returns (bool); Then I want to get a python dictionary whose ...
1
vote
3answers
43 views

Basic question I guess but is “web3” a client in the sense that I want to use a very simple client to interact with the network?

Long story short I need a way to send programmatically a raw transaction without any bounds checkings or any checks...now I am not trying to abuse or flood the network - my goal is to attempt to send ...
1
vote
1answer
65 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
0answers
14 views

What is the purpose of `internalType` now generated by the Solidity compiler in ABIs?

Newer Solidity 0.5.x compilers generate ABIs whose function and event parameters contain an internalType field as well as the usual type. In the examples I've seen, type and internalType usually have ...
2
votes
0answers
15 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 ...
1
vote
0answers
29 views

Function selector computed differently for libraries?

As documented in various places, the function selector is computed as the first four bytes of the keccak256 hash of the function header, which consists of the function name followed by the list of ...
1
vote
1answer
31 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 ...
0
votes
3answers
51 views

How to call functions from a Smart Contract, without using web3?

I am trying to find out if there is a way to call functions from a smart contract which is already deployed on mainnet/testnet, without using web3. If so, how to do that?
0
votes
1answer
15 views

Unable to interface the contract while running test.js and how to get the abi while compiling using solc?

Solidity Contract: index.sol pragma solidity ^0.5.0; contract Inbox{ string public message; constructor(string memory IntialMessage) public{ message = IntialMessage; } function setMessage(...
2
votes
1answer
20 views

What is the ABI code of a map's getter function?

I'm currently trying to call Etherscan's API eth_call to check data from a smart contract. To do that, I need to pass the function ABI code and data. However, the data I need is stored in a map and I'...
0
votes
3answers
128 views

How to generate the full list of function selectors for a contract?

A contract has many functions and how to automatically generate the full selector list, including inherited functions, for the whole contract? Preferred solution shouldn’t require more than a web ...
1
vote
1answer
83 views

How can I send an Anonymous event (In ABI, anonymous==true) in Solidity?

Here's my contract code, now in the ABI I have an anonymous entry and I'm not sure what is that and how can I emit anonymous event. pragma solidity ^0.4.24; contract TestContract { event Start(...
0
votes
1answer
205 views

TypeError: Wrong argument count for function call: 2 arguments given but expected 1. Use abi.encodePacked

I was playing with this post code example: function random() private view returns (uint8) { return uint8(uint256(keccak256(block.timestamp, block.difficulty))%251); } But I'm always ...
1
vote
0answers
163 views

Cannot read property 'type' of undefined - abi-coder

I'm creating a simple voting contract. It is deployed with truffle and infura. This is the contract code: pragma solidity >=0.4.21 <0.6.0; contract Voter { struct OptionPos { uint ...
0
votes
0answers
25 views

How does remix decode a contract response without the ABI?

Remix seems to be able to decode the output of a contract to a block of JSON without having the ABI (say I just specify the contract address). How is this achieved - I'm interested in doing something ...
0
votes
2answers
31 views

What is the advantage of the function selector?

I can't understand the advantage of function selector. Following link What is a function selctor? uses function selector to invoke a function of another contract but it uses the statements: ...
4
votes
1answer
167 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, ...
0
votes
0answers
70 views

Why am I getting the error "Expected pragma, import directive or contract/interface/library definition?

I have "pragma solidity ^0.5.9" at the start of the file yet I still get this error. Listing.sol:1:1: ParserError: Expected pragma, import directive or contract/interface/library definition. ...
1
vote
0answers
21 views

Where can i get total list of all existent Etehereum contract ABIs?

We all know that exists https://www.4byte.directory/ where we can get mapping (function selector) -> (function signatures). Is there a dataset where I can get mapping (contract address) -> (JSON ...
0
votes
1answer
254 views

myContract.getPastEvents(“allEvents”) returns empty array

I want to get all past events from a contract I deployed on the Ropsten network. Contract is: pragma solidity ^0.5.1; contract SampleContract { uint storageData; event MamboNumberTwo(uint ...
1
vote
0answers
45 views

How to pass array parameter. Drizzle

Is there have a way to pass array parameter from the drizzle to my contract ? I want to pass an array of uint[] i have read a lot about getData() function and encodeABI but how to use it in Drizzle ?
0
votes
1answer
81 views

Get past events of a contract without ABI using Web3?

I'm building a simple explorer and I would like to list events emitted by contracts. Since I can't know the ABI of each contract, is it possible to get past events from a contract using Web3? If I ...
0
votes
1answer
25 views

How can I pass struct as function parameter with ABIEncoderV2 from outside?

have this code: struct UserScore { address user; uint score; uint time; } function getWithStruct(UserScore _user) public view returns (address, uint, uint) { return (_user.user, _user....
0
votes
1answer
226 views

Deploying contract using byteCode

In that example you can see, how to deploy a new contract having just ABI and ByteCode (uses for copy and deploy contracts from mainnet to your testnet for example). /****** Deploying new contract ...
2
votes
1answer
62 views

Reading events of the inner Solidity contract with Web3

Let's say I've got contract A { event E(); function a() public { emit E(); } } contract B { A private a; function b() public { a(); } } Now my Dapp is ...
2
votes
1answer
36 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. ...
1
vote
1answer
192 views

Using AbiEncoderV2 for encoding data in raw transactions

I've come across a use-case to need to pass a struct into a Solidity function. I know this can be done via tuples. However, I need to sign and send this transaction from my node.js back-end using ...
1
vote
1answer
443 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 ...
0
votes
1answer
19 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
405 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
votes
1answer
39 views

Fully Decentralized Dapp [duplicate]

How can I build a fully decentralized dapp where the frontend code (.html,.css,.js) and ABI files (build/contracts/json) are stored in ipfs and contracts on test-network. But I am unable to do so ...
1
vote
0answers
32 views

Smart Contract ABI in Remix (Ethereum)

When I deploy smart contract on the Rinkeby network using Remix the ABI of smart contract does not contain its address, so how do I connect it with my frontend application.
2
votes
1answer
37 views

Understanding first evm word of reference types in assembly

Given the following function: function getArrayItems(bytes calldata) external returns ( bytes4 _signature, bytes32 _wutIsThis, bytes32 _length, bytes32 _firstItem ) { assembly { ...
1
vote
1answer
29 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: ...
0
votes
0answers
50 views

could n't find ABI constructor in my input data

I have developed the solidity code and need to verify the smart contract but I could not find Constructor Arguments ABI-encoded check the screenshots, i have developed in testnet
0
votes
1answer
55 views

Interaction with deployed contract over private blockchain Error: invalid address

I have deployed a smart contract over my private ethereum blockchain using geth. Smart Contract pragma solidity >=0.4.22 <0.6.0; contract GreenPoints { string public name; string ...
1
vote
2answers
97 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/...
4
votes
3answers
519 views

web3.eth.Contract(abi, address) doesn't return contract instance

i'am trying to make a instance of my contract in js using web3, but when I use the function web3.eth.Contract(abi, address) the result is not the expected(I take the ABI from remix). this is the code:...
1
vote
1answer
103 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 ...
2
votes
0answers
42 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; ...
1
vote
1answer
80 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 ...
0
votes
1answer
522 views

abi.decoder in solidity

Im trying to decode a bytes memory _data parameter directly in a smart contract. Im currently running: var data = await abi.encode("120000000000000000000", user2, OCcontract1.address, "...
0
votes
3answers
56 views

ABIs and Solidity programming

This is a practical question. I am developing an application in Solidity with Remix. One thing that takes a lot of time is that when I make changes in the code, I then have to compile it in Remix and ...
0
votes
0answers
114 views

Golang web3.eth.abi.encodeParameters equivalent

I need to encode some data in golang like using the web3.eth.abi.encodeParameters(paramsTypes[], params[]) I tried to use golang's ABI.Pack(functionName string, params) but it's not a good solution ...
1
vote
0answers
151 views

How to decode Tx data? Online tool?

Is there a fast way to decode the data returning from a Smart Contract call? I know there are github projects with JS libraries to decode this kind of data (such as https://github.com/ConsenSys/abi-...
3
votes
2answers
591 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; ...