All Questions

Filter by
Sorted by
Tagged with
1
vote
1answer
6 views

Check emitted event with BN

I'm currently testing events that include numeric values: const level = new BN(1); truffleAssert.eventEmitted(tx, 'EventName', {level}); As you can see, the level variable is a BN, and holds the ...
1
vote
0answers
9 views

UNGAS and why was GAS made available to programming smart contracts?

Hardforks, such as Istanbul, have illustrated the best practice that smart contracts should not make any assumptions about gas. Gas costs have, can, and will change, for example: Is transfer() still ...
0
votes
0answers
8 views

Compiling Old Version Contracts , gives ParserError: Expected pragma, import directive or contract/interface/library definition

Ihave to compile some old contracts (having solidity pragma is <0.5. For this purpose, I have just copy and paste this contract from Etehrscan and save with its name in contracts folder. Install ...
0
votes
1answer
18 views

private key should be a Buffer

I need to check the balance of several addresses for the presence of erc20 tokens, if the balance is not empty, send eth there and forward this balance to the resulting address. But in the end, I get ...
0
votes
0answers
7 views

Gas limit per block - Increasing or Decreasing the value of Gas limit in Go-Ethereum Source Code

My question is that is it possible to modify the value of Gas limit per block in go-ethereum source code. If yes, which part of GasLimit value could be affected on the Gaslimit per block in source ...
0
votes
1answer
10 views

can a smart contract autonomously hold erc20 tokens or ETH?

I want to make a simple smart contract, but I don't know if smart contracts are capable of what I desire. Please tell me if they are: a user can send ETH (or any ERC20 token) to the smart contract ...
0
votes
0answers
8 views

Should I stop the geth node during hard-fork?

As the countdown on https://ethernodes.org/istanbul, should I need to stop my geth node before hard-fork? Or I could continue to syncing during hard-fork. Thanks alot.
0
votes
0answers
11 views

Is function like that prone to reentrancy?

function transfer() payable public returns(bool) { balances[msg.sender] = SafeMath.sub(balances[msg.sender], msg.value); if(msg.sender.call.gas(100000).value(msg.value)()) { ...
0
votes
1answer
14 views

How to handle an ERC20 token which does not return true/false at the end of transfer/transferFrom

The ERC20 Token Standard dictates that functions transfer and transferFrom should return true for success and false for failure. However, various ERC20 tokens deployed on the network have not ...
2
votes
1answer
22 views

Is transfer() still safe after the Istanbul update?

In other words, is using transfer() safe? function transfer(address contractB) public { contractB.transfer(1000); //balances[msg.sender] -= 1000; } How about using call.gas? function ...
0
votes
0answers
8 views

claymore dual ethereum v.15 …and AMD cards

It says automatically sets environment for amd ...but also in v14.7 says both amd and Nvidia card supported except radeon7 cards...I guess what I'm asking is why can't I use my r7 or r6 ? I'm new to ...
0
votes
1answer
16 views

CLI wallet where I can pass in a Private Key and send out ETH and then delete this key?

Is there a CLI command where I can pass in an ethereum private key and send some coins to another address? I'm trying to build out a reoccurring payment system where a user can send 1 eth to another ...
0
votes
1answer
12 views

Function Efficiency

Say I have a function that handles 4 cases via if statements. I could break that into 4 separate functions. The case for breaking it up is that each function call would use less gas. The case against ...
0
votes
0answers
10 views

0x event extra data fields

I'm looking at events on the exchange contract address: https://etherscan.io/address/0x61935cbdd02287b511119ddb11aeb42f1593b7ef#events with a topic_0 equal to ...
0
votes
0answers
13 views

Solc Compiler related Error in Nodejs

I have almost 800 .solc files of version ^0.5.12 (i am using also 0.5.13 compiler version), when i all give them to my input, to compile with following code; var walk = function (dir) { var ...
0
votes
0answers
7 views

Clef signer - standalone docker container

To automate the signing capabilities I'm happy how clef is working. I've a couple of concerns though. answering the commandline prompts on clef init, clef clef attest, and clef. I'm wondering how i ...
0
votes
0answers
13 views

Arbitration and disputes in smart contarct [closed]

I am new in solidity and i want to know about arbitration and dispute functionality in smart contracts any help will be appreciated
0
votes
0answers
7 views

Where can I get list of tokens that allow direct conversion to ether and not just from token to token?

Most tokens simply utilize the ERC20 functions transferfrom/transferto which just use some balances to add from one user to another - but what are the ones who allow you to: buy token cashout to ...
0
votes
0answers
28 views

How it works with modified go-ethereum source code

I modified go-ethereum source code and built it. I am wondering if I want to test and run geth with the modified source code in mainnet or testnet, and how it works in the mainnet or testnet. How to ...
0
votes
0answers
14 views

How to import mySQL data to Solidity?

I have created a mySQL database through phpMyAdmin, storing health data. I would like to use Solidity to develop a smart contract which will implement access control to the data in the database. My ...
0
votes
0answers
9 views

nested calls fail on geth --dev but pass ganache-cli

I have the following solidity contracts defined. I want to test nested calls using the lowlevel api where C->D->E. However, running this code passes on ganache-cli but fails on geth --dev node. Im ...
0
votes
0answers
11 views

How Gas Cost is defined in EVM gas table?

i was checking into EVM gas table (https://docs.google.com/spreadsheets/d/1n6mRqkBz3iWcOlRem_mO09GtSKEKrAsfO7Frgx18pNU/edit#gid=0) (even though it is old sheet) Have few question: On what basis for ...
0
votes
1answer
19 views

Send eth to multiple addresses

I need to send eth to accounts that have erc20 tokens: foreth.forEach(function(item,i){ const balance = contractInstance.methods.balanceOf(item).call(function(err, result) { console.log(...
0
votes
1answer
15 views

TypeError: _getWeb3__WEBPACK_IMPORTED_MODULE_0__.default.eth is undefined

I'm not familiar with webpack, but after reading this error all I know that I import one module that is undefined by webpack. However, I don't know why export default new web3.eth.Contract(abi, ...
-1
votes
0answers
13 views

Building Blockchain Decentralized Apps (DApps) tutorial. When i am writing web3 getting this kind of responseresponse [closed]

Web3Shim { currentProvider: [Getter/Setter], _requestManager: RequestManager { provider: HttpProvider { host: 'http://127.0.0.1:7545', httpAgent: [Agent], withCredentials: ...
1
vote
1answer
21 views

How to guarantee the order of transactions in MetaMask?

I create my transactions with ethers.js and push them into an array like this: const promises = []; promises.push(createTokenApprovalTx()); promises.push(createFooTx()); It's important that the ...
1
vote
1answer
39 views

Vyper fundraising smart contract: 'Attribute' object has no attribute 'func'

[SOLVED]: See below. I am taking a blockchain and security class and we are working with vyper. We have been tasked with rewriting a fundraising smart contract. However, the compilers do not seem to ...
0
votes
0answers
18 views

How to connect to Mist without access to internet?

I need to connect to Mist without access to internet. How I can do it without download any other software?(except geth, of course) With a default connection, I get errors: [ERROR] Sockets / node-ipc -...
0
votes
1answer
14 views

Writing string to separate block in Ethereum

Is it possible to take input of a string from client side and using smart contract write that string data to a new block inside the Ethereum blockchain mainet or any testnet? Basically take in ...
0
votes
1answer
21 views

Decode transaction inputs with go-ethereum

When making a contract transaction using go-ethereum (golang) how can I decode the transaction inputs. Specifically Given a tx.Data []byte , the contract's contractABI abi.ABI and the method that ...
1
vote
1answer
19 views

Garbage in string parameters of events

I have an event defined like this: event Created( address indexed target, string indexed name ); I do emit Created(..., _name); // called function with _name = "comment" which gives ...
0
votes
0answers
21 views

How do I pass a function pointer to a contract method from a unit test?

I'm getting this error: Error: invalid type (arg="type", value="function") when trying to call this method on the contract IntOption: function create( address target, string memory name, ...
0
votes
2answers
11 views

Recovering of typed signature fails because it's too long

I have a typed signature generated by EIP712 V3. It is 132 characters long. I'm trying to recover it using recoverTypedSignature from eth-sig-util. This fails saying: index.js:1 Error: Invalid ...
1
vote
2answers
34 views

Programming Practice - using requires with return types

Can I please get some help with the following? Is it acceptable practice to allow my functions to rely on require statements "passing" to return the correct value? In the example below if the ...
1
vote
1answer
36 views

Get transaction status

There is a code, the essence is this: I need to check the account balance for erc20 tokens, and if the balance is not zero, I need to send eth from another account to this one, after eth reaches the ...
0
votes
1answer
8 views

Get an error: insufficient funds for gas * price + value

I need to send erc20 tokens from one address to another, provided that the token balance is not empty. I check the balance as follows: const balance = contractInstance.methods.balanceOf (...
0
votes
1answer
17 views

Transaction Timing Implications for Reentry Attacks

This is the classic reentry attack: function withdrawBalance() public { uint amountToWithdraw = userBalances[msg.sender]; (bool success, ) = msg.sender.call.value(amountToWithdraw)(""); ...
3
votes
1answer
15 views

Can I add an int32 to an int256?

I'm trying to reduce the storage size of my contracts by reducing the bytes required to store my int data types (among other things). Can I get the best practice for adding int256 and other smaller ...
0
votes
1answer
16 views

Cannot read property 'then' of undefined

I am trying to send ether from one address to another. After executing the code I am receiving an error: Cannot read property 'then' of undefined. How can I fix this? Thanks in advance. const Web3 = ...
0
votes
0answers
7 views

Web3py how to save accounts (private keys) to databases

I am wondering if there is a best practice when using web3py to generate an account, i.e private key, and save to to a database. Which format should I use to save it to a database? does web3py have ...
0
votes
0answers
5 views

How to recover a signature on the server side?

I need to verify the signer of a signature in my node server. const fortmaticApiKey = 'pk_live_...'; const checkPersonalSignature = async (data, signature, signer) => { try { const { get } =...
0
votes
1answer
6 views

What is the ethersjs equivalent of `web3.eth.call` in web3js?

web3.js has the ability to call a transaction and get return data without sending a transaction: web3.eth.call(callObject [, defaultBlock] [, callback]) ethersjs apparently does not have this ...
1
vote
1answer
20 views

A Way Around Restricted Getters

Consider a getter function with a restriction on who can read it, like function getData() public view returns (uint x) { require(msg.sender = '0x123..123'); x = data; } This ...
2
votes
0answers
23 views

In solc 0.4.x assembly, how can I check if a non-constant function returns 'bool' or nothing?

I know how to do it for a constant function, for example: pragma solidity 0.4.25; contract Callee0 {function func() external pure returns (bool) {return false;}} contract Callee1 {function func() ...
1
vote
1answer
19 views

raw transactions to send ERC20 token fails on private network(POA)

I am trying to transfer ERC20 tokens on private ethereum network(POA) Transaction flow: raw tx object creation on backend. { "gasLimit": 37000, "gasPrice": 4000000000, "...
0
votes
0answers
14 views

eth_sendTransaction does not exist / is not available [duplicate]

I try to send eth from one address to another, but I get an error: Returned error: The method eth_sendTransaction does not exist / is not available const Web3 = require('web3') const web3 = new Web3(...
0
votes
0answers
15 views

No response from live networks except ganache when interacting with truffle-contract

I am developing a Web3 app for a private Ethereum network. Throughout the development I used ganache-cli and now I wanted to test in the private live network. I can successfully interact with the ...
1
vote
1answer
28 views

Web3py. Error getting events using Infura: “The method eth_newFilter does not exist/is not available”

I'm trying to get all events from contract, but get error: "ValueError: {'code': -32601, 'message': 'The method eth_newFilter does not exist/is not available'}" I'm using Web3py and Infura. My code: ...
0
votes
1answer
20 views

Is there a case in which selfdestruct is more “powerful” than throw or revert?

Example in this scenario I guess selfdestruct will never get called (also: contract A isn't so important by the way just focus on B onward): in Contract A: address contractb = 0x....; function ...
0
votes
1answer
26 views

I am using already deployed tokens in my contract

My question is if I'm not implementing ERC-20 methods in my contract, but I'm using already deployed ERC-20 contract methods in my contract, so can we say this will be ERC-20 compliant contract? ...

15 30 50 per page