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 is the signature generated when the function does not have parameters?

When the function has parameters, Solidity generates its signature by adding the parameter types after the function name, in between brackets, and taking a keccak256 hash of the resulting string. As ...
2
votes
1answer
12 views

How can I do abi.encodePacked in Python or PHP?

Just concatenating strings doesn't work. Keccak::hash(10 . $address, 256) is what I'm doing atm.
1
vote
0answers
21 views

Cannot read property 'methods' of null

My teammate has deployed ERC 20 token to rinkeby test network using the truffle openzeppelin code. Now I wanted to interact with that token by using ABI and the contract address of that token using ...
0
votes
0answers
16 views

Generating a React UI given a contract ABI

Is there a way to automatically generate a React input form as per a contract address and ABI input by a user? The user inputs a contract address and an ABI. Now, an input form is generated for him as ...
1
vote
1answer
33 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 ...
0
votes
0answers
15 views

What's the difference between the two ways that contract B interacts with contract A?

The deployed contract A: A.sol: contract A { function testA() public returns(uint) {return 1;}; } Here is the first way that contract B interacts with contract A: B.sol: import "./A.sol"...
1
vote
1answer
15 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('./...
2
votes
1answer
160 views

What does the function “abi.encodeWithSelector(bytes4 selector, …) returns (bytes memory)” do exactly?

I tried to edit this function according to my smart contract but I couldn't understand this function. I read the docs already. can someone explain this to me with more details and examples? Thank you.
0
votes
0answers
22 views

No ABI produced with online remix compiler if any libraries defined above main contract

I am using remix online http://remix.ethereum.org/ to compile smart contracts, but the ABI is not being produced if the contract has any libraries or other definitions above the contract code itself. ...
0
votes
0answers
36 views

Is there a c++ library to encode abi

I am writing a c++ wallet and I need to be able to encode smart contract function calls in ABI format. I found that the web3 library has the ability, but it is written in JS. Is there a c++ ...
0
votes
1answer
22 views

How do I receive a revert message using go-ethereum

How do I receive a revert message using go-ethereum? receipt, err := bind.WaitMined(context.Background(), client, tx) if err != nil { fmt.Errorf(err) } fmt.Println(receipt.Status) Now I can only ...
0
votes
1answer
38 views

Cannot figure out how to set constructors and ABI for a contract

So I've been breaking my head over this for the last 2 days. I cannot seem to figure out how to get the constructors and ABI set up properly. I'm testing smart contracts by copying Sushi contract from ...
1
vote
1answer
27 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 ...
0
votes
1answer
61 views

abi.decode with pragma experimental ABIEncoderV2 reverts with nested array

I have a function with a parameter of bytes calldata that needs to be decoded to a struct, but the call reverts in assembly. I believe the issue has something to do with the nested array. I have ...
1
vote
1answer
173 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 ...
1
vote
0answers
54 views

How to call the super contract function where msg.sender should be same in solidity?

I am trying to call contract A.fun_A() via Contract C contract A{ function fun_A(address tenant, uint itemId){ //Here the msg.sender should be msg.sender in C require(msg.sender == ...
0
votes
1answer
34 views

Can we not allow to read/write contract from ethereum explorer?

Is there any way to not allow reading and writing contract from ethereum blockchain explorer? One can view contract code, ABI, and every other information once the owner verifies contracts. Is this ...
0
votes
1answer
25 views

Why do we write ABI before some functions

Why do we write "abi" before abi.encode()? I understand that ABI is a like a JSON file used to help interaction of different applications because the solidity code is stored as bytecode, but ...
0
votes
1answer
31 views

Uncaught TypeError: TheContract.at is not a function

just trying my first steps in ethereum and web3. So i found this tutorial: https://www.youtube.com/watch?v=hcTPjpPvas8 But it raise an error: index.html:85 Uncaught TypeError: TheContract.at is not a ...
0
votes
0answers
21 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
33 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
57 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
62 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
26 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
42 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
45 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
33 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
46 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
109 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
84 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
38 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
103 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
23 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
34 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
196 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
36 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
92 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
77 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
78 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
245 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
309 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
111 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
38 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
180 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
32 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 ...
2
votes
1answer
55 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
103 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 ...

1
2 3 4 5 6