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
0
votes
0answers
8 views

Read ABI directly from network api in GOLang

Using go-ethereum package how can we read the JSON file of the deployed contract and then get the ABI out of it and then instantiate? I don't want to compile smart-contracts into GO but want to use ...
0
votes
2answers
19 views

How concatenate encodeWithSignature with another data type to external call?

There are a abi.encodeWithSignature("foo((bytes))", info), but in addition to calling the function in another contract I want to send more data as an address to retrieve with msg.data, for ...
0
votes
0answers
28 views

Can unverified contracts expose a public ABI?

I am trying to understand if there are unverified contracts that come with a public ABI. I was exploring contracts on Etherscan, and I was only able to find unverified contracts without source code ...
0
votes
0answers
22 views

`web3.eth.abi.decodeParameters()` not returning correct values

I call to a method that returns two contract addresses, like this, where method is the method object taken from the ABI (triple-checked that already): web3.eth.call( { from: account, ...
0
votes
1answer
20 views

How to use initialize a bytes array with abi data?

To initialize a bytes array with the bool value True encoded as ABI data, I'm attempting to do it like this: bytes memory arr = '0x0000000000000000000000000000000000000000000000000000000000000001'; ...
0
votes
0answers
19 views

Error calling view function: Returned values aren't valid, did it run Out of Gas?

I compiled my code on 0.6.6 solidity compiler and the code ABI for the function im calling is: { "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], "name": "getAssetIds", "...
1
vote
0answers
33 views

go-ethereum: Return data from contract function

I have a smart contract written in solidity. I deployed the contract to my Ganache network and I can interact with it via go-ethereum using stubs generated by abigen. My function returns a uint256, ...
1
vote
0answers
30 views

What is the maximum size of ABI in real world contracts?

To monitor my contracts during development and test in a private blockchain I’ve written an event explorer that encodes beside other parameter the ABI in an URL parameter. The ABI will be compressed ...
0
votes
2answers
29 views

Decreasing the size of ABI files

I have some Truffle and Solidity produced ABI files that I am bundling with a JavaScript NPM package. 221.7kB esm5/lib/abi/IERC777.json Currently, the ABI files include full details, like ...
0
votes
2answers
38 views

How to generate Data payload for a smart contract transaction programmatically?

Some wallets, like Gnosis Safe multisig, do not have web3.js support or ABI encoder built-in. How one can create a transaction that calls a smart contract function and originates from such wallets?
0
votes
0answers
46 views

Deploy contract with web3 with ABI in JSON file give me “SyntaxError: Unexpected token o in JSON at position 1” [duplicate]

I got problem with my deploy.js script to te deploy my smart contract with web3. When I run it, I always got this error: Attempting to deploy from account XXXXXXXXXXXXXX (node:25929) ...
3
votes
1answer
23 views

abi.decode() and unused variables

I am decoding bytes as the following: // Decode Solidity tightly packed arguments (uint8 _, uint128 stakeId, address behalf) = abi.decode(userData, (uint8, uint128, address)); // solhint-...
0
votes
1answer
74 views

How can I get the ABI from solc.compile? (^0.6.4)

In pragma solidity ^0.6.4; I wrote a contract and can get the byte code as follow: const solc = require("solc"); const path = require("path"); const fs = require("fs"); const inboxPath = path....
0
votes
1answer
21 views

Where does the length parameter end and the actual string start in an abi encoded string?

Assuming I decided to ABI encode a very long string (for the purpose of this question I just picked an arbitrary 5-paragraph lorem ipsum text generate by https://www.lipsum.com/feed/html) and get out ...
1
vote
1answer
28 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 ...
0
votes
0answers
90 views

Interacting with contract in myetherwallet

I have developed some smart contracts and deployed/interacted with them successfully using truffle framework. However, when copying the main smart contract's address and it's ABI into myetherwallet to ...
0
votes
2answers
18 views

Does solidity create unique outputs every time it compiles same exact code?

Is there any difference if I compile everytime I want to deploy another multisig wallet. Or I can just deploy another multisig wallet using the same compiled data?
1
vote
1answer
24 views

AbiEncoderV2 encoding Tuple algorithm

Where can I find AbiEncoderV2 encoding Tuple algorithm? I would like to add Tuples support to a ruby library.
2
votes
2answers
66 views

How to generate calldata for a function

I have got as far as generating the method ID for the function: function transfer(address src, address dst, uint256 amount); The method ID would be: bytes4(keccak256("transfer(address,address,...
0
votes
0answers
10 views

Aragon: How to update files after a contract compiles

I need to update certain files (in app/public/) every time when a contract compiles. Namely I need to extract the ABI from a contract and store in app/public/. Is it possible with the current version ...
0
votes
1answer
50 views

ABI encoding with tuples

I don't understand how ABI encoding with tuples work: f(uint8[], uint) with arguments [3], 4 accordingly https://abi.hashex.org produces: ...
3
votes
2answers
47 views

What is a good alternative to `ContractTranslator.encode_abi`

Since the ethereum Python library has been deprecated in May 2019, the ContractTranslator.encode_abi function is probably not the best way to turn Python argument lists into calldata strings. In ...
7
votes
4answers
164 views

ABI and Bytecode stored inside Contract

I was scrolling around Ethereum StackExchange and I came across with an interesting thought that I have never read or seen anyone talk about. I'm perfectly aware of how contracts work and are ...
7
votes
1answer
184 views

Is the ABI required to call a contract with ethers.js?

From the docs: // The Contract interface let abi = [ ... ]; // Connect to the network let provider = ethers.getDefaultProvider(); // The address from the above deployment example let ...
0
votes
2answers
99 views

Correct ABI payload packaging to call another Contract's address

Let's suppose I have the two following contracts, Dest and Proxy: pragma solidity ^0.5.0; contract Dest { function foo(string memory name, string memory symbol, uint256 decimals, uint256 ...
1
vote
1answer
24 views

arrays and structs for function arguments

A lot of contracts and libraries with functions that use arrays and structs for arguments. Structs can themselves include arrays, structs and mappings. For example: function doSomething(MyStruct ...
-1
votes
1answer
31 views

Transacting with a verified contract (code+ABI); yet, no function displayed in the tx input data

Looking at the transaction overview in etherscan, the "Input Data:" field is only a big Hex value; I was expecting to see the function I was calling...
1
vote
1answer
93 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
29 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
35 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
64 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
50 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
50 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
412 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
29 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
20 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
69 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
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 ...
0
votes
3answers
151 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
42 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
42 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
300 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
281 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
496 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
317 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
2answers
35 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
505 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
103 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
33 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
484 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
2 3 4 5