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
1answer
329 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
96 views

Decoding Transaction input data in Nethereum

I'm using Nethereum and see this example of how to decode the Input data of a Transaction object. http://playground.nethereum.com/csharp/id/1063 This looks like it assumes that you have to know which ...
3
votes
2answers
2k views

Why is there 2 methods abi.encode and abi.encodePacked for argument encoding

When we call a function on an external contract, the evm computes a bytes buffer which contains the function signature and arguments. There are 2 ways to serialize arguments: abi.encode and abi....
0
votes
1answer
13 views

How do I encode a uint256 as bytes to feed to a function “sliceuint”, with web3.js and solidity?

I have a function from a library: function sliceUint(bytes bs, uint start) internal pure returns (uint) { require(bs.length >= start + 32, "slicing out of range&...
0
votes
1answer
141 views

Getting error : This type of error is only supported in new experimental ABI Encoder while passing struct inside function

How can I pass struct to Function I tried doing it but all in vain struct testSruct { uint size; } function testFunc( testSruct test) public returns(bool replaced) { return true; } ...
0
votes
0answers
15 views

Can't call method of contract using Web3?

I can call the base methods (totalSupply, name, approve, etc.) but not the custom one's I defined. I get a "[name of method] is not a function error" If I console.log the contract.methods, ...
0
votes
1answer
130 views

How to identify the bytecode of a single function

I am trying to generate the bytecode for a single function. I need to avoid any setup/teardown that may occur in the contract as I am trying to get a precise measurement of the execution time in the ...
0
votes
1answer
15 views

Missing ABI error for web3.eth.Contract() method

I have the following js code const Web3 = require('web3'); const nodeUrl = "my node url"; const web3 = new Web3(new Web3.providers.WebsocketProvider(nodeUrl)); const contractAbi = '[{&...
2
votes
1answer
160 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.
2
votes
1answer
182 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?
1
vote
1answer
203 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++ ...
1
vote
0answers
22 views

Why use ABI encode, encodePacked, encodeWithSelector …etc

1- While learning Solidity, I've been searching for answers on why is encode, encodePacked, encodeWithSelector, and any type of encoding is used in the first place, in Solidity. There are a lot of ...
0
votes
1answer
34 views

Error! Invalid constructor arguments provided. Please verify that they are in ABI-encoded format

Update: so these 2 lines in my code seem to be causing the problem and removing them got everything to work but I still need to include them so if someone can figure out why they are breaking that ...
1
vote
1answer
299 views

Error: Invalid number of arguments to Solidity function when calling safeTransferFrom function

I want to call the safeTransferFrom function to transfer ERC721 tokens. I am using the following code: var contract = this.web3.eth.contract(JSON.parse(contractabierc721)).at(contractAddress); // ...
1
vote
0answers
13 views

Retrieving contracts metadata given swarm hash file

How can I retrieve the contract's metadata referred by Swarm Source at Etherscan page for this contract? https://etherscan.io/address/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code It says the bzzr://...
2
votes
1answer
369 views

How do I get the implementation contract address from the proxy contract address?

I'm using web3.py to interact with multiple unknown contracts, where I don't know beforehand if a contract is a proxy contract or the actual contract. I'm getting the ABIs for the contracts on-the-fly ...
0
votes
1answer
11 views

Is it possible to encode and decode two consequent byte arrays (with unknown sizes) using `abi.encode` and `abi.decode`?

Is it possible to encode and decode two consequent bytes using abi.encode and abi.decode (as following)? bytes memory data = abi.encode(data1, data2); // later on (bytes memory data1_recovered, bytes ...
0
votes
1answer
15 views

Having trouble converting json to abi encoding

I'm trying to convert the following json to abi code using https://abi.hashex.org/ [ { "inputs": [ { "internalType": "string", "...
12
votes
3answers
9k views

web3.js import contract abi from .json file

So I have a deployed contract with address0. I can easily interact with it using my index.html like so: import contract_artifacts from '../../build/contracts/contract.json' var contract0 = contract(...
0
votes
3answers
224 views

where is the abi stored for a contract?

once a contract is compiled and deployed to the blockchain, it stores the 'runtime bytecode' in the blockchain (as I understand). but to invoke the functions of a contract by an EOA, it requires ABI ...
7
votes
4answers
569 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 ...
0
votes
1answer
459 views

How to get token info with contract address in Ethereum

I use web3 library to interact with Ethereum Network and I want to get token info with his contract address such as tokenName, tokenSymbol, tokenDecimal, tokenLogoURL etc. I can get almost any data ...
2
votes
0answers
11 views

Where to download ABI interfaces in JSON with minimum requirements?

Sorry for what I'm sure is a beginner question, but where can I dowwnload the ABIs in JSON format for only minimum required methods? I can't seem to find it anywhere on Google. For example, ERC721. ...
0
votes
0answers
22 views

abi.encodeWithSignature and abi.encode have inconsistent results with dynamic arrays

pragma solidity 0.8.0; function isMemberOfArrayEncodedTest(address member, address [] memory memberArray) public returns (string memory){ bytes4 sig = bytes4(keccak256("isMemberOfArray(...
2
votes
1answer
1k 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....
0
votes
1answer
191 views

Is remix ABI generator still working?

I have recently used the ABI generator fo remix, but when I copy the ABI and paste it in my Geth I get an error: var abi=x; // where x is abi copied from remix ethereum website. However, if I copy ...
1
vote
0answers
57 views

Encoding ABI function signature in Java using web3j?

Is there a generic way to simply take an ABI function, something like: { "name":"foo", "inputs":{ "interalType":"uint256", "...
0
votes
0answers
49 views

Decoding function arguments

I'm using 1inch's API (specifically the /swap endpoint) to generate the tx.data payload, which I then pass to my contract under _data: function swap(address tokenIn, uint amountIn, uint minOut, bytes ...
0
votes
0answers
26 views

Error, returned values aren't valid, did it run out of gas? on a view function

im trying to call a view function from my frontend but cant seem to do so. This is my code: import { AbiItem } from 'web3-utils' import cakeABI from 'config/abi/cake.json' import { getCakeAddress } ...
0
votes
1answer
24 views

What are my constructor arguments ABI-Encoded (noob)

pragma solidity ^0.8.2; contract Token{ mapping(address => uint) public balances; mapping(address => mapping(address => uint)) public allowance; uint public totalSupply = ...
15
votes
2answers
5k 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
142 views

Can an ABI file be made from separate json files by stripping out information?

I am looking at the CryptoKitties KittyCore contract. What I notice is that there are multiple contracts within the file. (https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code)....
0
votes
1answer
1k views

How to find ABI and verify my contract

When I try to verify my contract , it returned: Note: Contract was created during TxHash# 0x8a13fd16a810e886266d49addf46e459847d583528f966561e45abdd34a13e14 Result: Does not match the input creation ...
1
vote
1answer
240 views

How to call solidity function in html 'inspect' console properly?

I can see my contract in my console. The solidity code and abi is in the the index.html. I can't figure out how to call this function and send 0.01 ether with it as well. I would think it is something ...
2
votes
1answer
139 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
1answer
46 views

How to interact with a smart contract without ABI

So I bought a scamcoin (I know). I have the contract and I've managed to decompile the bytecode. How can I interact with the contract to approve the token? https://bscscan.com/address/...
0
votes
1answer
483 views

Can I find constructor arguments from truffle artifact?

I'm in the process of verifying my contract on Etherscan. Etherscan asks for ABI-encoded constructor arguments during the verification process, though I was a bit silly and don't quite know what they ...
1
vote
1answer
31 views

Convert ABI to HTML interface (input)

Is there a way to get code that convert ABI to HTML interface ? I found example in multiples apps but can't find the code, lot of dead github. Apps where I find what I want : https://abi.hashex.org/ ...
1
vote
1answer
67 views

How to distinguish token from a liquidity pool?

Let's take two addresses: Pancake LPs ElonGate The first one is a liquidity pool that implements IPancakePair interface and the second one is a IERC20 token. Short of inspecting the name, how can I ...
0
votes
1answer
1k views

Can not verify contract on etherscan.io “Error! Unable to generate Contract ByteCode and ABI”

I am getting the error "Error! Unable to generate Contract ByteCode and ABI" When I try to verify this code. I have split it into two pieces as I import it but not sure how to include it all in ...
0
votes
1answer
465 views

ABI for Etherscan verification

How I can get ABI in multiple contract code? if the code is here: Token address is: 0x4960a0Db832c3Bb503F3Da59a274D9385e0Ade5A Crowdsale contract: 0x7a76d1A86a8b801865eC9134552904366b327A45 I ...
0
votes
1answer
29 views

A tool that does abi.encodePacked to fill data field in eth_call?

I'm trying to call a contract's deposit method using geth's eth_call. This function takes in value data in bytes: { "from": "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3", "...
1
vote
1answer
458 views

Ethereum Contract ABI - Encoding for functions with no arguments

I am using argument encoding from this page (https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) to build data field for offline signing. I am using eth.sendRawTransaction to call a function ...
1
vote
0answers
22 views

Decoding signature for verification not working

I'm trying to verify a signature, but when I decode it, the function reverts. This is the function I'm using function source(bytes memory signature) public returns (bytes32 r, bytes32 s, uint8 v) { ...
50
votes
7answers
54k 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 ...
1
vote
2answers
928 views

Trouble with web3.eth.Contract, ABI usage with Typescript

I am having a bit of trouble using web3.eth.Contract with Typescript.. import * as ERC721ABI from "../ABIs/ERC721.json"; import Web3 from "web3"; ... const contract = new web3....
15
votes
5answers
13k views

TRUFFLE: What is the best way to to get the JSON ABI code after deploying a contract with truffle to Ganache or Kovan?

Remix makes it so easy to get the json abi code. Does anyone have any recommendation on how best to get he json abi code after successfully deploying a contract using truffle without having to ...
19
votes
4answers
17k views

Web3.js Get Contract Abi Knowing Only Contract Address

is there a way with web3.js to get a contract abi json, knowing only the contract address? I cannot find anymore a link in wich they explain how to do this, in this post the guy replied telling that ...
0
votes
0answers
164 views

./hidapi/hidapi/hidapi.h: No such file or directory

I cloned go-ethereum, and used go mod vender. When make, it's failed! and the error info is: # github.com/karalabe/usb vendor/github.com/karalabe/usb/hid_enabled.go:22:10: fatal error: ./hidapi/hidapi/...
0
votes
0answers
17 views

Get logs for contracts with specific abi

I only want logs on contracts that implement the ERC-20 ABI. That means, no logs can come from ERC-721 or any other type. How can this be done? I am using the eth_logs function but am open to using ...

1
2 3 4 5
7