texts:
We are trying to create an upgradeable smart contract. Our first decision is to segregate data and rules. This post focus on data.
I read about the ERC930. It proposes a data storage based only in key-value pairs in order to keep the data storage very dinamic to accomodate changes. This ERC is still open.

I understand that we will have no domain-specific schema and it will be the resposibility of the rules to check that the data is really valid. It makes rules more complex and more error-prone. On the other hand, ERC930 makes a contract upgrade easier.

My question is: are you using ERC930 in our project? Are you using other solution to data upgradibility? What are the pros and cons?


texts: Storing transactions result into database

texts:
I need to store the transaction details to my database. And here is my code:

    var rawTx = {
        nonce: nonce,
        gas: estimate_gas,
        to: contract_add,
        value: '0x0',
        data: dataField,
        chainId: 4
    };
    web3.eth.accounts.signTransaction(rawTx, privateKey, function (err, hash) {
        if (err) {
              // Store err to database here
                 ...
        }
        else {
            web3.eth.sendSignedTransaction(hash.rawTransaction)
                .then(res => {
                    console.log("DONE SENDING");
                    // Save res to Database here
                    ...
                })
                .catch(error => {
                    console.log("FAILED SENDING");
                    // Save error to Database here
                    ...
                });
        }
    });
} catch (err) {
      // Save err to Database here
         ...
}

The code is works for me, except when sendSignedTransaction catch an error that transaction was not mined in 750second. I know the transaction is still processing even this timeout error occurs.

But the critical problem here is further transactions will getting stuck in the pending, and get the same timeout error in my code. These transaction need to wait in pending until the previous transactions success.

After the first transaction success, geth will continue process the pending transactions in node, but execute them without go through my code above, so I can't store the transaction result into my database now.

Is there any solution for this? Or there is some callback in geth when a transaction done so I could use this callback to store the transaction result?


texts: Airdropping ERC20 Tokens to multiple addresses in a single transaction

texts:
done , wrong question.
better to use this

contract ERC20 {
  function transfer(address _recipient, uint256 _value) public returns (bool success);
}

contract Airdrop {
  function drop(ERC20 token, address[] recipients, uint256[] values) public {
    for (uint256 i = 0; i < recipients.length; i++) {
      token.transfer(recipients[i], values[i]);
    }
  }
}


texts: Anyone know the current hashrate of this card? Looked but could not find anyone posting ethereum hashrate estimates. Found one for 0.5mhs but that seems awfully low.


texts: Specifying gas amount for contract call from JavaScript

texts:
I'm making this call from JavaScript to the contract function.

contracts['CrowdFunder'].contract.contribute({value: web3.toWei(0.000000000000000005, 'ether')});

The function is called, but the error message says,

An error occurred during contract execution: 'Out of gas'

See  http://testnet.etherscan.io/vmtrace?txhash=0x58c3e7d41db0dd3ba4c2b600b374b2576f9508d84e7351058232027af4cc3abb

How do I specify the amount of gas in JavaScript for the above?


texts: Move my ether from own Mist-wallet to online wallet

texts:
Trying to get my ether out but no transfer works. Sync says 3 month 0% since days.

Is there any possibility to use any online wallet instead? And if yes, how to import my ether other than transfer?

OS: win7
latest version ethereum wallet


texts: Testing using Truffle unbox: Assert.equal error

texts:
I ran the pet shop project. It uses "truffle unbox". The petshop project at:
Petshop project using Assert.equal without any error
is able to execute Assert.equal command but when I am using Assert.equal, I am getting error. I am first deploying the pet-shop project in my project folder using "truffle unbox petshop". It creates the files but then I modified the files as follows.
My files are (got from Michalzalecki):
//Funding.sol

pragma solidity 0.5.16;
contract Funding {
   address public owner;
   constructor() public {
      owner = msg.sender;
   }
}

//2_deploy_contracts.js
var Funding= artifacts.require("Funding");
module.exports = function(deployer){
   deployer.deploy(Funding);
};

//TestFunding.sol
pragma solidity ^0.5.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Funding.sol";

contract  TestFunding{

  function testSettingAnOwnerDuringCreation() public {
    Funding funding = new Funding();
    Assert.equal(funding.owner, address(this), "An owner is different than a deployer");
  }
}

I am getting following error when I am compiling my code using "truffle test":

$ truffle test You can improve web3's peformance when running Node.js
versions older than 10.5.0 by installing the (deprecated) scrypt
package in your project Using network 'development'.
Compiling your contracts...
===========================

Compiling ./test/TestFunding.sol

/test/TestFunding.sol:10:5:
TypeError: Member "equal" not found or not visible after
argument-dependent lookup in type(library Assert).
Assert.equal(funding.owner, address(this), "An owner is different than a deployer");
^----------^
Compilation failed. See above. Truffle v5.1.33 (core: 5.1.33) Node
v8.10.0

Somebody please guide me how can I modify the pet-shop project to create a new project for testing so that it can use Assert.equal(...)command.
I am getting the same error after changing the Assert to 'assert':
$ truffle test

You can improve web3's peformance when running Node.js versions older
than 10.5.0 by installing the (deprecated) scrypt package in your
project Using network 'development'.
Compiling your contracts...
===========================

Compiling ./test/TestFunding.sol

/test/TestFunding.sol:10:5:
TypeError: Member "equal" not found or not visible after
argument-dependent lookup in function (bool) pure.
assert.equal(funding.owner, address(this), "An owner is different than a deployer");
^----------^
Compilation failed. See above. Truffle v5.1.33 (core: 5.1.33) Node
v8.10.0

Zulfi.


texts:
I am writing to understand a smart contract which seems quite "meaningless" to me.

The contract is at (https://etherscan.io/address/0xd4fa166d5ffe8f78230fc05e6850881dc08b2da2#code) but indeed over 1k addresses have exactly the same piece of code deployed.

So from the de-compilation results (https://ethervm.io/decompile?address=0xd4fa166d5ffe8f78230fc05e6850881dc08b2da2&network=), I don't see too much has been done here. It seems that this contract somehow sends out something, and then that's it. No information is kept track of in the storage anyhow.

Could anyone shed some lights on this (such kind of) contracts and let me know what's going on here?  Thanks a lot.


texts: How to pass constructor parameters to solc?

texts:
I'm trying to compile a Smart Contract to bytecode using solc.
I'm on a Ubuntu VM so I have to rely on a simple-to-install cmd line application.

Compilation works fine but it seems like I can't pass any input parameter for the constructor.

Any suggestions?


texts: How to change settings for truffle develop?

texts:
I'm trying to change the settings for my truffle develop node, but the values in truffle.js don't seem to work. Here's what I have there:

  networks: {
    development: {
      host: "127.0.0.10",
      port: 95455,
      network_id: "*", // Match any network id
      gas: 47123880,
      gasPrice: 1000
    }
  }

Note that I tried to change the host and port values, but I still see Truffle Develop started at http://localhost:9545/ when I start truffle develop. So I suppose the gas value doesn't affect anything as well.


texts: What is the best practice to receive ether from external accounts?

texts:
I want to create a smart contract that receive ether from external accounts and pay them some profits monthly. I need to receive ether from them. What is the best practice in this regard? Whether the accounts that publishes the contract to the blockchain network should receive ether or the contract itself?
I was wondering if you assist me in this regard.


texts: I wonder why for Ethereum Web3 API (and for Bitcoind as well) the choice for the remote API has been on RPC style instead of RESTful. In principle REST is driven by data models while RPC is driven by actions, so I assume that the designers found a node much more "someone" to send command, rather than a set of resources to be accessed with CRUD (Create Read Update Delete) patterns. However, I'd like to find some prior discussion on that if any available on the fora.


texts: web3.eth.SendSignedTransaction - gas issue

texts:
I am trying to send a signed transaction using web3.eth.sendSignedTransaction(). Everything seems to be working ok for my other web3 methods, but I am having trouble setting the gas for this. When calling it I get the message:

"Error: Returned error: Transaction cost exceeds current gas limit. Limit: 5000, got: 47100. Try decreasing supplied gas."

So I try setting it to 5000 then get the following error:

"Error: Returned error: Transaction gas is too low. There is not enough gas to cover minimal cost of the transaction (minimal: 53400, got: 5000). Try increasing supplied gas."

What could I doing wrong here?


texts: Can't install Truffle Framework to Mac OS Big Sur

texts:
so I checked to see if I had the latest version of nodejs, and it turns out that I do.
kalebamarante$ node -v
v15.5.0

then I tried installing a version of Truffle and it didn't work
~ kalebamarante$ npm install --g truffle@5.1.39
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/truffle
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/truffle'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kalebamarante/.npm/_logs/2021-01-22T00_28_36_853Z-debug.log

Then I went to the truffle website and copied the new link into my terminal and this happened.
KALEBS-MBP:~ kalebamarante$ npm install -g truffle
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/truffle
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/truffle'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/truffle'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/kalebamarante/.npm/_logs/2021-01-22T00_32_03_163Z-debug.log

I'm trying to work on a bigger project and I can't move forward until I have truffle installed. I appreciate all the help I can get!!
thank you


texts: Refresh page upon MetaMask Confirmation. Web3js & React()

texts:
I would like to reload the React Web3 wallet's page upon MetaMask Confirmation. Meaning when the ERC-20 token send transaction is confirmed, the page should reload or state should update to display the new balance.

In this transfer function, the pseudo-code starts with ".on()":

function refreshPage() {
  window.location.reload(false);
}

transfer(recipient, amount) {
  this.state.waviiiToken.methods.transfer(recipient, amount).send({ from: this.state.account })
  .on('confirmation' refreshPage);
}

Please let me know if this is possible or if you have an example I can reference that updates state or refreshes the page.


texts: Why does truffle always fail with "Error: Don't set config.from directly. Instead, set config.networks and then config.networks[].from"

texts:
I have a problem that suddenly appeared, and now I get it every time that I try to run truffle test or truffle migrate, regardless of which project it is. I've even tried fetching the Petshop from the truffle docs (http://truffleframework.com/tutorials/pet-shop), and I still get the same error:

   mybox@c:~/code/petshop (master)$ truffle test
Using network 'development'.

Error: Don't set config.from directly. Instead, set config.networks and then config.networks[<network name>].from
    at Config.set [as from] (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:3019:15)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:320066:21
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)

It seems like it protests that I'm using the old syntax for setting from, wanting me to do it for each network. However, this is done in the truffle.js file of all of the projects. It almost seems as there is some kind of global config that overrides the local somewhere, but I have no idea where.

I've tried reinstalling and downgrading truffle, to no avail.

Versions:

Node v9.4.0
Truffle 4.0.1


texts: Can blockchain transaction be made real time?

texts:
Let me explain myself a bit ;)

I am new around blockchain biz but not in tech. Somehow I missed the bus so far.

So what I gather is a transaction is sent out and whoever gets there first creates a recorded block for good to seal the transaction and this process can take anywhere from few seconds to 10 mins. Please correct me if I am wrong. I am mostly from web / app world so I am trying to figure out how such a delayed transaction recording mechanism be useful for say user authentication during a login process.

Am I missing something ?

after bit of reading around I did find this https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2 which clarifies quite few things.

But my question is is there a way to make blockchain transactions real time so that a website user can perform it without any delays. What are the best practices / approaches to achieve this ?


texts:
From

0x74e442b7ee73634cb55ce8d96d5ffa2b7a2f73ce

To

0x9BC98204e90F3c5b827D5f097808A765D8EE1121

Amount

0.01

Please help me to find tx hash.


texts:
With the default allowed ["net", "web3", "eth"], I want to expose Geth 1.9.21-stable RPC to another machine.
In config.html I set HTTPVirtualHosts = ["*"].
The cmd to start geth (via systemd) is geth --nousb --config /path/to/config.toml --http --http.addr "0.0.0.0"
Do I need to use --http --http.addr "0.0.0.0" in the start cmd or is there a way to do this in config.toml? (AFAIK --nousb has to be a start cmd parameter)
This has been asked before, but things change and all the answers are a few years old.
PS: the perimeter firewall handles blocking access to RPC from outside the LAN. It would be nice to specify in Geth what is the only LAN IP that can use the RPC, but it is not necessary.


texts:
I'm working on a Dapp for voting in a municipality and national election. There is a lot of code, and I've met the max limit of the contract size many times but have been able to keep it under the limit by cutting down functions, compress requires error text, move internal functions inline, and other small fixes to reduce size. But now, even if I do everything as efficiently as possible, I still go over the limit, and I'm not done with the Dapp yet. I've used this doc to reduce size: "https://ethereum.org/en/developers/tutorials/downsizing-contracts-to-fight-the-contract-size-limit/#remove-functions"
I'm now looking into splitting the contracts into smaller contracts or making a library, but splitting the contracts into smaller ones OR creating a library, still gives the same problem when migrating in truffle.
I've read that when using a library, I should avoid internal functions because they are included in the main contract instead of being used from the outside.
If you want to look at my code, check out our repo here: "https://github.com/voljumet/ChainVote/tree/libbie-1"
(we have commented out some of the functions to be able to migrate)
Edit: The question: how to use a library, and if I'm doing it correctly, is there something with testing it in truffle that causes the contract to exceed the maximum size?


texts:
I have a problem installing Swarm. when i enter
sudo apt-get install ethereum-swarm i get a problem saying :

  dpkg: error processing archive /var/cache/apt/archives/ethereum-swarm_0.3.1+build14601+xenial_amd64.deb (--unpack):
   trying to overwrite '/usr/bin/swarm', which is also in package swarm 2.1.6-1
  dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)

Is there anybody who knows how to fix this issue?
Thanks


texts:
I've tried to run contract function in Mist, which required 10,900,000 of gas, but get 'Exceeds gas limit' error.

How can I call this function? Maybe some ways to increase gas limit inside Mist...

Also, if I provide less gas than required (e.g. 3,000,000), what will happen ?


texts:
The DAO contract was attacked on 17th June 2016 where the attacker drained about USD 50 million worth of ethers using a recursive call vulnerability in The DAO contract code.

The attacker drained the stolen ethers into a few child DAOs and the Robin Hood Group drained the remaining funds into other child DAOs.

A hard fork is scheduled for block #1,920,000 (in around 24 hours time, ~ 23:26 20/07/2016 Australian Eastern Standard Time) to transfer the ethers from The DAO contract and it's child DAOs into a Withdrawal contract.

Once the hard fork has passed, how do I convert my The DAO tokens into ethers?

The DAO Refunds

[THIS] How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?
How do I get a refund for the amount I paid in excess of 1 ether to 100 The DAO tokens
How do I get a refund for my The DAO tokens that was split into a child DAO?
How do I convert my The DAO tokens into ethers on the Ethereum Classic chain?
How to conditionally send ethers to another account post-hard-fork to protect yourself from replay attacks

Update 13:31 Jul 20 2016 UTC

The Withdrawal contract has a balance of 11,597,664.781027947 Ether ($145,318,739.71).

A successful hard fork. Happy Hard Fork Everyone! Good work Devs and other involved.

Update 22:31 Jul 20 2016 UTC

The Withdrawal contract now has a balance of 6,369,298.685677664 Ether ($79,807,312.53). About 45% of DAOs have now been converted into ETHs, over 1,506 transactions.

Update 18:04 Jul 23 2016 UTC

The Withdrawal contract now has a balance of 4,595,418.245476871 Ether ($65,944,251.82). About 60% of DAOs have now been converted into ETHs, over 3,887 transactions.

Here's a chart from https://slacknation.github.io/medium/11/11.html:

Update 23:18 Aug 1 2016 UTC

Update 14:58 Sep 6 2016 UTC

13.55% balance remaining.


texts: Trying to run private blockchain in console stops after successfully writing genesis block

texts: I am trying to run private blockchain geth --networkid 100 --identity node1 --verbosity 3 --nodiscover --nat none --datadir=~/Documents/testmeteor/ init ~/Documents/testmeteor/Genesis.json console. However after successfully writing genesis block console exits and node is not running. I run the command once, deleted everything except the keystore and allocated some ether to my account and then run the command again. Also if i try to run this command (since I need to connect my node to my frontend with web3API) geth --datadir ~/Documents/testmeteor --rpcaddr="localhost" --rpcport="8545" --rpccorsdomain="http://localhost:3000" --nodiscover  init Genesis.json console I get this error even though the Genesis.json exists in the directory Fatal: failed to read genesis file: open Genesis.json: no such file or directory Please help


texts: Can I send data (e.g. text) in a Transaction with Web3J?

texts: I need to send a transaction from an account to another one via Web3J that includes not only the value field but also the data field (in particular, I need to send text). Is it possible?


texts:
I'm trying to import the web3 library in Node.js so that I can handle Ethereum smart contract events, however I can't get the import to work.

I'm running Babel on each file to convert to es5, and the import in Node's index.js file looks like this:

import Web3 from 'web3';

When I add that "import Web3 from 'web3'" statement I get a "scrypt" error:

webpack:///./node_modules/scrypt/index.js?:3
var scryptNative = __webpack_require__(!(function
webpackMissingModule() { var e = new Error("Cannot find module
'./build/Release/scrypt'"); e.code = 'MODULE_NOT_FOUND'; throw e; } .
()))

^

Error: Cannot find module './build/Release/scrypt'
at webpackMissingModule
(webpack:///./node_modules/scrypt/index.js?:3:84)
at eval (webpack:///./node_modules/scrypt/index.js?:3:181)
at Object../node_modules/scrypt/index.js

This is my version of web3: (However, I have tried other versions which also don't work)

"web3": "^1.0.0-beta.26"

I've searched around but I can't find any solution to the above error. Any help is greatly appreciated.


texts: web3.utils.fromWei(web3.eth.getBalance(web3.eth.coinbase), 'ether').toNumber() gives error

texts:
web3.utils.fromWei(web3.eth.getBalance(web3.eth.coinbase), 'ether').toNumber()

gives this error:

> /usr/local/lib/node_modules/truffle/build/cli.bundled.js:369506
>     throw new Error('Provided address "'+ address +'" is invalid, the capitalization checksum test failed, or its an indrect IBAN address
> which can\'t be converted.');
>     ^
>
> Error: Provided address "undefined" is invalid, the capitalization
> checksum test failed, or its an indrect IBAN address which can't be
> converted.
>     at Method.inputAddressFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-helpers/src/formatters.js:409:1)
>     at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:144:1
>     at Array.map (<anonymous>)
>     at Method.formatInput (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:142:1)
>     at Method.toPayload (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:177:1)
>     at Eth.send [as getBalance] (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth/~/web3-core-method/src/index.js:467:1)
>     at evalmachine.<anonymous>:0:29
>     at Script.runInContext (vm.js:134:20)
>     at runScript (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/console.js:199:1)
>     at Console.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/console.js:213:1)
>     at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/repl.js:118:1)
>     at bound (domain.js:395:14)
>     at REPLServer.runBound [as eval] (domain.js:408:12)
>     at REPLServer.onLine (repl.js:639:10)
>     at REPLServer.emit (events.js:188:13)
>     at REPLServer.EventEmitter.emit (domain.js:441:20)
>     at REPLServer.Interface._onLine (readline.js:308:10)
>     at REPLServer.Interface._line (readline.js:654:8)
>     at REPLServer.Interface._ttyWrite (readline.js:933:14)
>     at REPLServer.self._ttyWrite (repl.js:712:7)
>     at ReadStream.onkeypress (readline.js:184:10)
>     at ReadStream.emit (events.js:188:13)

truffle version:

Truffle v5.0.1 (core: 5.0.1)
Solidity v0.5.0 (solc-js)
Node v11.6.0

I'm trying to set up a test environment, ganache-cli (Ganache CLI v6.2.5 (ganache-core: 2.3.3)) is running in another terminal window.


texts: How to use infura with web3 to talk to remote ropsten node?

texts:
I understand we need mnemonic as we did use it in deploying contract with truffle so as to be able to send ether from our ropsten account private keys. I could not find a way use the same in my server.js file to call contract functions. I want to build a webapp which neither uses local node nor metamask and all the transactions are carried by my account.
I am sharing my code which i derived from various sources but don't know why is it not executing:

const express = require('express');
const Web3 = require('web3');
const fs = require('fs');

const app = express();
app.use(express.json());

console.log('server side code running');
app.listen(3000, () => {
    console.log('Listening on port 3000');
});

if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
}
else {
    web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/<api key>"));
}

var contractabi = JSON.parse(fs.readFileSync('abi.json', 'utf8'));
var contractaddress = '0xb51adbdd256930bd6b4c613add6fcca31db49827';
var contract = new web3.eth.Contract(contractabi,contractaddress);

const privateKey = 'my private key';
const account = web3.eth.accounts.privateKeyToAccount('0x' + privateKey);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;
contract.methods.set(7)
    .send({
        from: web3.eth.defaultAccount,
        gas: 2000000,
        gasPrice: 4000000000
    })

Error I'm facing: UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: ""
I think it returns a promise which i'm not able to use. I need help!
and if there are alternate ways to do the same, i'm excited to know


texts: Does a caller contract needs to know the complete interface of a callee?

texts:
As far as I understand if a caller uses just one function from a callee contract it only needs to know the signature of this function, not the whole interface.

Callee.sol (Kovan):

contract Callee{

    uint public anyNumber;

    function theOnlyFunctionCallerNeeds (uint someData) external {
        anyNumber = someData;
    }

    function justSomeRandomFunction(uint someOtherData) public view returns (uint){
        return anyNumber + someOtherData + 42;
    }
}

Caller.sol (Kovan):

interface Callee{
    function theOnlyFunctionCallerNeeds (uint);
}

contract Caller{

    Callee callee;
    uint public anyNumber;

    function Caller(address calleeAddr) public {
        callee = Callee(calleeAddr);
    }

    function usingCallee(uint callerData) external {
        callee.theOnlyFunctionCallerNeeds(callerData);
    }
}

It works on testnet (Kovan) but I cannot find it anywhere in the docs. So my question is can I use this pattern to write upgradable contracts (so I could easily change Callee contract except for one function)? Is there anything to be considered?


texts: Storing ICO tokens in contract address instead of owner address

texts:
In most of the ICOs,initially all tokens are transferred to  owner address instead of being handled at the
contract address.Why?.


texts: (web3.js) The method eth_compileSolidity does not exist/is not available

texts:
I have tried to develop a javascript function with web3.js to compile a solidity contract. In html/javascript code, I have prepared the following.

var contract_code = "pragma solidity ^0.4.....[omit the content here])";
var compiled_contract = web3.eth.compile.solidity(contract_code);

By reference of google chrome broswser developer tools, I found the following error.

  web3.min.js:1 Uncaught Error: The method eth_compileSolidity does not
  exist/is not available
      at Object.InvalidResponse (web3.min.js:1)
      at s.send (web3.min.js:2)
      at Object.e [as solidity] (web3.min.js:2)
      at deployContract ((index):53)
      at HTMLButtonElement.onclick ((index):114)

I checked again the Ubuntu 16.04 server and confirmed the installation of solc.

ubuntu@ip:~/node$ which solc
/usr/bin/solc

I have search on Internet and someone have suggested to add --solc on geth command. My Geth version is v1.6.0.

geth --datadir ethfolder --solc /usr/bin/solc

However, it shows the following error message.

  flag provided but not defined: -solc

I tried the eth.getCompilers() command.

  eth.getCompilers();

  Error: The method eth_getCompilers does not exist/is not available
      at web3.js:3104:20
      at web3.js:6191:15
      at web3.js:5004:36
      at :1:1

I tried admin.setSolc function which is mentioned in the official wiki.

  admin.setSolc('/usr/bin/solc');

  TypeError: 'setSolc' is not a function
      at :1:1

Would anyone can advise hint on how to implement the compiling job on web3.js?


texts: Trouble making an affiliate program with Ethereum

texts:
Is it possible to make an affiliate program with Ethereum without requiring a new user to register before he starts to earn or spend money? (but instead using his Ethereum wallet address as his registration with my site)
To store the affiliate ID, I would need to make an Ethereum transaction and thus show MetaMask to a newly coming user, which he would reject or even leave my site immediately, because he has not asked for this transaction.
Any way to work around of this limitation?


texts: how to access multiple values using getStorageAt?

texts:
I have a small smart contract that has 2 functions, one to set 3 numbers and another function returning these 3 numbers.

return(a,b,c)

samplecont.setnumbers(100,250,250)
samplecont.getnumbers()
                 [100,250,250]
samplecont.setnumbers(101,260,260)
                 [101,260,260]
samplecont.setnumbers(102,270,270)
                 [102,270,270]

I am trying to access the past values of these 3 variables using getStorageAt. Have written following code after reading other responses on this topic:
mycontractaddress consists of the address if mined contract.

uint maxBlocks = 50;
uint startBlock = eth.blockNumber;
for (var i = 0; i < maxBlocks; i++) {
        current = web3.eth.getStorageAt(mycontractaddress, 0, startBlock-i);

        blockDate = new Date(web3.eth.getBlock(startBlock-i).timestamp*1000);

        console.log("Block #" + (startBlock-i) + " Timestamp:" + blockDate.toString()
          +  " Value:" + web3.toDecimal(current));

    }

however, output only shows the first of the 3 numbers:

Block #7547 Timestamp:Wed, 07 Sep 2016 14:06:55 IST Value:102
Block #7546 Timestamp:Wed, 07 Sep 2016 14:06:50 IST Value:102
Block #7545 Timestamp:Wed, 07 Sep 2016 14:06:47 IST Value:102
Block #7544 Timestamp:Wed, 07 Sep 2016 14:06:45 IST Value:102
Block #7543 Timestamp:Wed, 07 Sep 2016 14:06:17 IST Value:102
Block #7542 Timestamp:Wed, 07 Sep 2016 14:06:14 IST Value:102

what am I doing wrong? appreciate any pointers.


texts: How to Install go-ethereum on Redhat Linux?

texts:
I would like to install go-ethereum on Redhat Linux 6.X. I have visited https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum link but it does not show installation steps for Redhat Linux 6.X.

Please guide me details steps to setup go-ethereum on RHEL machine.

Is it it possible to setup without using vargrant / docker / build go src?


texts: Presign transaction to later publish with aave

texts:
Is it possible to have pre-signed tx that I could publish to close a position with aave.
Let's imagine I have 0.1 wbtc deposited with aave and I borrow 1000 usdt. I can close my position from the webapp but is it possible that I presigned a 100usd to repay the usdt that I can publish later on?
Where should I start? Thanks


texts: Is there any way to run multiple nodes on Ethereum?

texts:
Does anyone know that how to run multiple nodes on one PC in private test network?
like running several Ethereum Wallets which could be used for testing contract or transfers.

Thanks.


texts: Is ERC1155 an overkill if all NFTs are going to be unique?

texts:
Within the use-case I'm trying to define an ERC1155 for, I do not foresee to use duplicates for the same token. However, I would like to be able to have this option if such a necessity arises.
Is using an ERC1155 still a viable way, or it's just adds too much complexity for a "nice to have" feature, and I just go back to ERC721?


texts:
I just started learning about Solidity and i want to learn more about smart contracts and all the universe about Solidity programming.
So i downloaded VS Code and i installed the Solidity extension in my VS code.
After then what steps do i have to do to begin writing solidity?
Do i have to download nodejs or truffle?
I ve search on the internet there are not tutorials about setting up Solidity on VS Code. I need to help me about setting up all the details so the Solidity works as it should.
Sorry if it is a stupit question, but i really need help
Thanks everyone!


texts: How to connect ethereum wallet to ganache?

texts:
Can anyone list out the steps  on how to connect the ethereum wallet to ganache?

Thanks in Advance


texts: Is it possible to send ether from contract address to my account address using the CloseChannel() function and what will be the Truffle command?

texts:
pragma solidity ^0.4.0;

contract exchange {
    mapping (address => uint256) public balances;
    event PaymentDone(string s);

    function Channel( uint value) payable {
        balances[msg.sender] -=value;
        balances[this] +=value;
    }

    function CloseChannel( address to,uint value) {
        if (to.send(value)) {
            PaymentDone("Done");
        }
    }
}


texts:
My application and GETH sits on the same server.  I only want GETH to accept WS connection on the same server.  What is the proper way of setting --ws.origins ?  Historically I just used --ws.origins * but I'm sure that is not good practice.
I'm thinking --ws.origins "127.0.0.1" or --ws.origins "ws://127.0.0.1"


texts: CrowdSale basic contract sample showing Gas limit error

texts:
Hello I have copied Basic contract from official website https://ethereum.org/crowdsale

I'm beginner in Solidity and Ethereum development

It was successfully compiled by Remix but when I click "Create" under Run tab its show me an error

  creation of Crowdsale errored: Gas required exceeds limit: 300000.  An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).

I'm not sure why it is showing

Here is my code

pragma solidity ^0.4.16;

interface token {
    function transfer(address receiver, uint amount) public;
}

contract Crowdsale {
    address public beneficiary;
    uint public fundingGoal;
    uint public amountRaised;
    uint public deadline;
    uint public price;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;
    bool fundingGoalReached = false;
    bool crowdsaleClosed = false;

    event GoalReached(address recipient, uint totalAmountRaised);
    event FundTransfer(address backer, uint amount, bool isContribution);

    /**
     * Constrctor function
     *
     * Setup the owner
     */
    function Crowdsale(
        address ifSuccessfulSendTo,
        uint fundingGoalInEthers,
        uint durationInMinutes,
        uint etherCostOfEachToken,
        address addressOfTokenUsedAsReward
    ) public {
        beneficiary = ifSuccessfulSendTo;
        fundingGoal = fundingGoalInEthers * 1 ether;
        deadline = now + durationInMinutes * 1 minutes;
        price = etherCostOfEachToken * 1 ether;
        tokenReward = token(addressOfTokenUsedAsReward);
    }

    /**
     * Fallback function
     *
     * The function without name is the default function that is called whenever anyone sends funds to a contract
     */
    function () payable public{
        require(!crowdsaleClosed);
        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised += amount;
        tokenReward.transfer(msg.sender, amount / price);
        FundTransfer(msg.sender, amount, true);
    }

    modifier afterDeadline() { if (now >= deadline) _; }

    /**
     * Check if goal was reached
     *
     * Checks if the goal or time limit has been reached and ends the campaign
     */
    function checkGoalReached() afterDeadline public {
        if (amountRaised >= fundingGoal){
            fundingGoalReached = true;
            GoalReached(beneficiary, amountRaised);
        }
        crowdsaleClosed = true;
    }

    /**
     * Withdraw the funds
     *
     * Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached,
     * sends the entire amount to the beneficiary. If goal was not reached, each contributor can withdraw
     * the amount they contributed.
     */
    function safeWithdrawal() afterDeadline public {
        if (!fundingGoalReached) {
            uint amount = balanceOf[msg.sender];
            balanceOf[msg.sender] = 0;
            if (amount > 0) {
                if (msg.sender.send(amount)) {
                    FundTransfer(msg.sender, amount, false);
                } else {
                    balanceOf[msg.sender] = amount;
                }
            }
        }

        if (fundingGoalReached && beneficiary == msg.sender) {
            if (beneficiary.send(amountRaised)) {
                FundTransfer(beneficiary, amountRaised, false);
            } else {
                //If we fail to send the funds to beneficiary, unlock funders balance
                fundingGoalReached = false;
            }
        }
    }
}

So please help me out what is exact issue and how can I fix it.


texts: Ger transaction details from the variable declared in smart contract

texts:
I have written smart contract in which I have declared one variable like uint256[] public UserIdList. And I am adding 3 userids while migrating that contract.

Now, I am doing the mapping of user id with machine id and I want to fetch the transaction details by particular user id, so how to do it inside solidity ?


texts: Where do the funds go when we loose the stake in PoS (Casper Update)?

texts: In PoS, we know that if the validator try to mess with the blockchain, they loose their funds...where that fund goes ??? tell me please


texts: Determine network congestion, min required gas/gas price based on current conditions

texts: Say I have an application that is making some low priority transactions.  I'd like to keep them as low priority as possible without having them take 20+ minutes or poof and disappear. What's the best technique to determine the current network conditions? For example, some nights 1 gwei gets a transaction through within a couple minutes. Other nights, 2 gwei takes 25 minutes to go through. What's the best way to determine the gas price and gas for my transactions? Can I only use the "eth_gasPrice" method, or is there something else I should be aware of?


texts:
I am calling method with params:

{
  "jsonrpc":"2.0",
  "method":"eth_estimateGas",
  "params": [
    {
      "to": "0x8f0921f30555624143d427b340b1156914882c10",
      "data":"0xa9059cbb0000000000000000000000001fb330ab08bdba6e218e55fabc357643cf8252e300000000000000000000000000000000000000000000000000005af3107a4000"
    }
  ],
  "id":1
}

But I always get an error:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32000,
    "message": "gas required exceeds allowance or always failing transaction"
  }
}

0x8f0921f30555624143d427b340b1156914882c10 this is address of some ERC-20 Token. When i put instead this Contract address someone other everything works great. What can be a problem?


texts: Blockchain takes abnormally long to synchronise?

texts: I recently formatted my computer, re-installed Ubuntu and consequently have to re-download and re-synchronise the blockchain. I initially started using the most recent (as of this posting) Mist release and left it overnight; progressed around 1.8M blocks. The following day, I moved this data to a backup folder and restarted entirely using geth --fast --cache=1024. 24 hours later this had advanced 2.8M blocks. I have now gone back to Mist and continued from the 2.8M, but it is moving incredibly slow to the point where I am convinced I am missing something..? Any suggestions would be much appreciated! I should add that I am running on a 1GBit connection, so that, if anything, is definitely not the bottleneck.


texts: What do you as parameters to external functions in solidity that take struct as parameters?

texts:
There's a function in solidity Im looking at which takes the custom datatype
DecreaseLiquidityParams as input.
    function decreaseLiquidity(DecreaseLiquidityParams calldata params)
        external
        payable
        returns (uint256 amount0, uint256 amount1);

DecreaseLiquidityParams id defined in another file as:
struct DecreaseLiquidityParams {
    uint256 tokenId;
    uint128 liquidity;
    uint256 amount0Min;
    uint256 amount1Min;
    uint256 deadline;
}

So If I'm calling this function through web3 on python, do I pass the parameters in individually or as a dictionary? like this:
contract.functions.DecreaseLiquidity(12345,100,100,100,100).buildTransaction(..)


texts: Whisper: Error: failed to reach the PoW target, specified pow time (5 seconds) was insufficient

texts:
From web3.py docs/SHH_API:

  ttl: Time-to-live in seconds.
  powTime: Maximal time in seconds to be spent on proof of work.
  powTarget: Minimal PoW target required for this message.

On the following example I give one hour for the ttl. This could be much larger time such as 1 day and so on.

[Q] What is the benefit of using powTarget and powTime? How could I prevent the error I am having that is shown below?

When I increase powTime, the time required to sent the message also increases, so what could be the optimum powTime and powTarget for given seconds for the ttl (for example for one day)?

> web3.shh.post({
  pubKey: '0x04d96278caa49aff29d76399001a43a9a8005da21c6853d20d6af11d61df8a2a25de0fe79a1099bd4b915445d94cbd448b2fe548fb53fed5d887291f35de0f44c9',
  ttl: 3600,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 5,
  payload: web3.fromAscii("Hello there!")
  });

Error: failed to reach the PoW target, specified pow time (5 seconds) was insufficient
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at <anonymous>:1:1


texts:
I'm having trouble building from source and/or finding a prebuilt binary (ideally this would be statically-linked) of ethereum to begin mining.  Is anyone looking at this build failure?

https://launchpad.net/~ethereum/+archive/ubuntu/ethereum/+build/9719707


texts: Whats the difference between .call.value() and .call.value()()

texts:
contract Test {

    function Test(){
        msg.sender.call.value(0);
        msg.sender.call.value(0)();
    }

}

Whats the difference here between the first and second call? My hunch is the 1st one doesn't actually do anything, however this indeed does compile.


texts: During the ICO and private sale, Can we lock the bonuses upto 6 months

texts: I am writing smart contract and stuck some where how can i block bonuses during the private sale and in ico?


texts: I lost 3 ETH transfering from Ether.li to Poloniex

texts:
I need help (please, please, please) for understanding what's happens.

1 - From Ether.li I did a first attempt for transfer 3 eth to poloniex. But susprisly, the operation was made with 0 eth. Still 3 eth in the ether.li wallet.
https://etherscan.io/tx/0x877a797e27cfa4ea7129fba344c7998e97949327aff19f8e062fe3b29d3580ff

2- I tried to transfer again next day, and in this time it was apparently good, because my balance in ether.li was 0 eth.
But now I can see there is 3 internal transactions, being the first of them my wallet in poloniex, and the others wallets of poloniex, like hot wallets or similar.
https://etherscan.io/tx/0xb3b9ccf5c592926eeb8a1822b14d4bcf762f6b0b6fd9defe692f988746e29415

3- Here is my contract 0x7c7e907032d95598f5dbbe11c72612e9f7f7ef18

4- If I go to internal transactions in my contract, I can see  the transfer of the 3 eth the wallet on polloniex.

Things I already did:

6 tickets to Poloniex. They only answered the first, like automatic answer (very fast, 1 second delay) saying they were having problems of delay in this momments with eth, and please wait.

Email to poloniex
3 attemps to chat with a moderator in the chat of poloniex.
Twitter poloniex.

Also...

Email to ether.li
Twitter to creators of ether.li (as they ask for it in the contact page)

Also...

Ask in forums for understand what happens, and where can be my eth.

I know I'm like an "ant" in this world of criptos, lot of newbies here asking for same problems. Please, I really would appreciate if someone can bring me a little bit of light.

Thank you

JAKE: I FACE THIS ISSUE AS WELL AND LOTS OF OTHERS DO TOO. IT WOULD BE LOVELY IF THIS QUESTION WOULD BE ANSWERED.


texts:
I wrote a very simple smart contract like this:

contract Test{
    function test1(address payable addr, uint256 value) payable public {
        addr.transfer(value);
    }
}

And I compiled it using solc 0.5.7 on Remix. Some of the opcodes related to transfer function are like this:

PUSH 8FC            addr.transfer(value)
DUP3            value
SWAP1           addr.transfer(value)
DUP2            addr.transfer(value)
ISZERO          addr.transfer(value)
MUL             addr.transfer(value)

In this part it is very obvious that 8FC, which is the gas stipend (2300) of transfer and send function in solidity, is lost when it is multiplied by zero. As a result, in debug view of Remix, I see this just before executing the CALL opcode in the stack:

According to the Yellow Paper, the first parameter of CALL is gas right? Why here the first parameter of CALL is zero and how solidity ensures that transfer and send only forward 2300 gas?

I found another similar question here, but I still couldn't get the answer from their discussion. Any ideas?


texts:
I'm creating new address with web3.py with this code:

from web3 import Web3
w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
w3.personal.newAccount('the-passphrase')

And have few questions:

Is there a way to get the-passphrase from address returned from
the code below? Need the same behaviour as dumpprivkey from
bitcoin-cli
Why I'm getting different addres every time when I'm
using same passphrase? Does it means that I can use inputs of every
of these addresses with using only this passhprase? Is structure of keys is different than bitcoin's privatekey-publickey-address?
When I use
signTransaction method, should I use 'passphrase' or its hash?

Thanks!


texts: how are negative numbers stored within the EVM stack?

texts:
for example, I have these opcodes:

PUSH60
PUSH40
SUB

for sub operations, I believe that the second stack item is subtracted from the first stack item (60 - 40) which would equal to -20 being the new first stack item. I know this would be stored as hexadecimal, but does the stack store negative numbers? Thanks


texts: I'd like to create an UTXO style coin contract to trace each coin movement. There are many account based coin contracts, but I couldn't find any UTXO coin contract. Are they any samples?


texts: How long will it be till ETH is not worth mining? (Ice Age)

texts:
I believe we recently started a period where difficulty bombs in ETH will have substantial effect, but it is surprisingly hard to find throughout explanation about this online, hence the question.

How long will it be now till there is no point in mining ETH and what can happen if PoS doesn't proof itself i.e. will this bomb be defused or ETH just goes down a lot in value?

Will miners move to ETC mining if they don't want to stake ether, which seems odd to me now as there is not clear future for classic as far as I know.

I will appreciate expanded answer, as this is genuinely interesting to me.


texts: While using myetherwallet to generate offline transaction hash, can developer steal my private key?

texts:
To be very clear, I have used myetherwallet offline to send eth many times in the past. I went through the code for the version I saved and found no Maliciously code. Hypothetical for future development, not accusatory for recent version (at least not for the one I used, v3.21.0) I even started to modify their code to I can automate my own way of signing multiple transactions hash into a file. FYI, you can broadcast the signed transaction hash via etherscan.io api, so there is no need to use step 3 referred by MEW.
First, I perform everything related to ethereum offline in a dedicated PC that never saw internet. The only way to move data is via a USB thumb drive between computers.
I spent very large amount of time to examine the security holes in very step alone the way. Most of them I have control except a few I have doubt:
Since user need to provide the private key to sign the transaction of sending ether, and one transtion parameter/arugement/field is DATA (optional), it can be code for smart contract or a text message like "hello world". Can myetherwallet developer encrypt your private key with their own key and put it as a message string into this field so it would be part of signed hash broadcasted to the internet (only them can decryt that on the blockchain)?
This question applies to all hardware wallet as well because they use similar way to sign transactions.
I know MEW is open source, but I doubt even the most advance security expert read source code every time when they use MEW offline. I supposed you can save a copy of known good MEW offline and using it for as long as you can (This is what I did). But there is no gurauntee the known good copy you saved can be used forever. Are you going to read source code everytime you update? probably not, so how can you trust MEW / any hardware wallet vendor not trying to steal your private key?


texts: Find ETH address with amount range (Query Big Data)

texts:
I'm trying to run a query similar to this:
https://medium.com/google-cloud/how-to-query-balances-for-all-ethereum-addresses-in-bigquery-fb594e4034a7
But I would like to find ETH address:

Ending with ...6f59 and Balance between 1 to 40 ETH
Ending with ...4ecc and Balance between 1 to 5 ETH
Ending with ...1ae5 and Balance between 0 to 1 ETH

Would it be possible to run such query?
Thank you!


texts:
Referring to this link: https://theethereum.wiki/w/index.php/ERC20_Token_Standard

looking at the last contract. (Line 130)

function totalSupply() public constant returns (uint) {
    return _totalSupply  - balances[address(0)];
}

Why do we use balances[address(0)] here? Is that means we will get the sum of all values in the balances?


texts:
I am trying to install web3 using command

  npm install --save web3@1.0.0-beta.26

However, it is failing with error :

verbose node v8.9.1
verbose npm  v4.6.1
 error code 128
 error Command failed: git -c core.longpaths=true rev-list -n1 browserifyCompatible
 error fatal: ambiguous argument 'browserifyCompatible': unknown revision or path not in the working tree.
 error Use '--' to separate paths from revisions, like this:
 error 'git <command> [<revision>...] -- [<file>...]'

EDIT
After following a suggestion in this thread, npm got updated but the npm installed with node was still being used. SO fixed that using this. Now, the error is showing as :

794 verbose stack Error: Command failed: C:\Program Files\Git\cmd\git.EXE clone --depth=1 -q -b browserifyCompatible git://github.com/frozeman/WebSocket-Node.git C:\Users\<USER>\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-3198c7e8 --config core.longpaths=true
794 verbose stack warning: templates not found in C:\Users\<USER>\AppData\Local\Temp\pacote-git-template-tmp\git-clone-f63c9472
794 verbose stack warning: Could not find remote branch browserifyCompatible to clone.
794 verbose stack fatal: Remote branch browserifyCompatible not found in upstream origin

Versions : npm@6.4.1, node@v10.12.0 , git version 2.19.1

Yarn gives similar error. I tried tracing npm logs, the error occurs while looking up for branch named "browserifyCompatible" for websocket dependency which seems a valid branch.

I've tried starting cmd with admin privileges and executing from git bash and reinstaling git, node, npm. Any inputs will be highly appreciated.


texts: TypeError: filterCreationErrorCallback is not a function

texts: trying to deploy contract to Ropsten network-


texts: Web3: call the solidity function with the address can't return the expected outcome! (everyone can help?)

texts:
solidity code:

address public administrator;

constructor() public {
    administrator = msg.sender;
}

function isAdministrator(address _address) public view returns (bool) {
    return _address == administrator;
}

web3 code

The expected outcome is return true but the con.log returns false.

[![enter image description here][2]][2]

In the truffle console call the function by input the admin address will return true, in web3 it returns false whatever input the admin address or other address it still returns false! I think the problem is about the web3 code but I don't which part was wrong! The address part in web3 needs to convert?

I am using the truffle pet-shop box to do my project!
everyone can help me?

Truffle v5.1.22 (core: 5.1.22)
Solidity v0.5.16 (solc-js)
Node v10.15.3
Web3.js v1.2.1


texts:
I hope someone can help me.
I wanted to swap my USDT for ShopX on Uniswap. I had my USDT in my metamask wallet and was connected on Uniswap. I had to approve so that I could swap. Appently I made a mistake, now my USDT is gone. Hopefully someone can help me understand what happened and if I am lucky how to solve it.
Thanks for any help!
https://etherscan.io/tx/0x9fc1450990cf7bcbedbd776c314e60bb9e35274ef322fb83a13e45f90c933190
Greetings,
Sebas


texts: Invoke contract B from A and preserve msg.sender

texts:
is it possible to call a function in deployed contract B from contract A while preserving msg.sender to be original sender that invoked contract A. I know there is delegatecall method but also passes the entire context. I only need to pass the msg.sender.

For example, I want to invoke transfer function in my contract A that sets balance of addr of my contract B to X when I deploy my secondary contract B. Since I created and deployed both contracts I can do this but only if I do 2 tx calls.


texts: Error while compiling Solidity code via py-solc

texts:
I am getting the following error while attempting to compile Solidity code via py-solc. Is it due to a new update of py-solc? how can I fix it?

>>> from . import views
  File "/home/manzik/Desktop/Ethereum Voting/voting/home/views.py", line 5, in <module>
    import commission.views as comm
  File "/home/manzik/Desktop/Ethereum Voting/voting/commission/views.py", line 164, in <module>
    compiled_sol = compile_source(contract_source_code)
  File "/home/manzik/.local/lib/python3.6/site-packages/solc/main.py", line 108, in compile_source
    stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
  File "/home/manzik/.local/lib/python3.6/site-packages/solc/utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/home/manzik/.local/lib/python3.6/site-packages/solc/wrapper.py", line 169, in solc_wrapper
    stderr_data=stderrdata,
solc.exceptions.SolcError: An error occurred during execution
> command: `solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc`
> return code: `1`
> stderr:

> stdout:
Invalid option to --combined-json: clone-bin


texts: Do I need to delete mappings that I don't need anymore?

texts:
I have a struct like this:

    struct Game {

       string gameID;
       string[2] teams;
       string winningTeam;
       string losingTeam;

       mapping(string => uint) totalWeiBet;

       mapping(string => Bet[]) bets;
       mapping(string => Token[]) tokens;
       mapping(string => mapping(address => bool)) wasSuchTokenBet;

       bool isLocked;
       bool isFinalized;
   }

and a state mapping which holds all active Games:

   mapping(string => Game) activeGames;

When I'm done with the game and I no longer need it (because it is finalized) - I am wondering - how much of the struct do I want to delete? Do I simply delete the struct out of active games mapping? Or should I try to clear all the mappings inside of the struct first? Why would I clear them? What if I don't and I simply delete the whole struct? Does delete cost me additional gas in any case, or it's the other way around - it never costs anything so there is no disadventage of deleting?

Thanks for help again! I love the community here!


texts: Call several endpoints in an Oraclize nested query and return an array

texts:
I am trying to get an average of ETH/USD conversion rate through Oraclize. My query works well when calling one single HTTP endpoint but I would like to call several endpoints within the same query and have the results returned in an array so that I can get average and remove outliers.

Currently, the best I managed to get is a response through computing the result of two queries nested in a Wolfram alpha query:
[WolframAlpha] (${[URL] ...} + ${[URL] ...}) / 2

But this is not very satisfying and I would like to have an array of values that I can process in solidity. I suppose nesting/computation would also be possible but seems like a hassle.

I am trying to find the exact syntax for the following "query":

[${[URL]...}, ${[URL]...}, ${[URL]...} ...].

What would be the syntax if this is possible? If not, what solution would you suggest?


texts:
This is my function in solidity

function transferForm(address _from, address _to, uint256 _value) public returns (bool success) {
}

Now i am calling the same function in test file for testing my smart contract

tokenInstance.transferForm(spendingAccount,10,{from : fromAccount})

I have intialized from Account to accounts[3]

Why are we sending the data by using {from : fromAccount}

Why can't we send data such as

tokenInstance.transferForm(from,spendingAccount,10,)

Is there any difference?

How do function knows when we are changing the position of function input parameters we are sending

please help me in understanding the logic


texts: Is there any way to keep track of the fork flags in the live network?

texts:
Or in other words, how is the voting going right now. Ethernodes' crawler tells me there are 1072 nodes online right now running version 1.4.10 (search for "1.4.10"). I cannot see however whether they have set a support/oppose flag.

Is there any way to see the distribution of said flags in the live network?

Also, are both clients still working on the same chain at this moment (pre-block #1920000)?


texts:
I know that gas is used to keep contracts running but what are other usages for ether? Is ether used for buying all kinds of virtual tokens, will you need ether to use dapps or how is ether going to be used in ethereum economy?

Please provide as much information as you can on this issue.


texts:
I have a view function which takes a string as input and split the string into substring and i want to define a string array inside the function depending on the number of substrings that the function parameter contain and perform some logic on it. But I fail to do this. Is there a solution to do this or is it impossible in solidity to define array size during runtime?

code:

function retrieveProducer(string _input) public returns(string)
{
    string memory s1 = _input;
    string memory s2;
    string  memory s3;
    bytes memory s1bytes = bytes(_input);
    uint index = 0;
    uint totallength = BCServiceList.length;
    uint paramNumber = 0;
    while(s1bytes.length != 0)
    {
       (s2,s1) = splitString(s1,";");
        paramNumber = paramNumber.add(1);
       s1bytes = bytes(s1);
    }
    string[] memory localStringArray= new string[](paramNumber);
    //do some logic and return a string
}


texts: How to read data from smart contract using web3.js?

texts:
I want to build something similar to the Read Contract tab feature of etherscan
which reads a contract and return all the public props like:
 - name, totalSupply, decimals, etc.

However I have not found any information on web3 documentation.


texts: Can Ethereum wallets be deleted for fraud?

texts:
Stellar Foundation, who created the Stellar Lumens coin (XLM), are able to shut down XLM addresses that engage in fraud. Stellar scammers often send small payments to other XLM wallets at random with a memo to visit a scam site.
Can Vitalik and Ethereum do the same to ETH wallets: close fraudulent accounts?


texts: what's the super graphic card is a very suitable  for the mining  etheium and what is the exact CPU that suits it wuth RAM.


texts: Undeclared identifier _setTokenURI in ERC721

texts:
I'm using

pragma solidity ^0.8.0;

I heard that _setTokenURI was removed in pragma 0.8.0
I tried these options
https://forum.openzeppelin.com/t/function-settokenuri-in-erc721-is-gone-with-pragma-0-8-0/5978
like using

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";

but that didn't work either, has anyone else figured out a work around for this ?
Strange they still have it in their docs https://docs.openzeppelin.com/contracts/4.x/erc721
Code:
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract myNFT is ERC721{

    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
        mapping(string => uint8) hashes;

    constructor() public ERC721("myNFT", "MNFT") {}

    function awardItem(address recipient, string memory hash, string memory metadata)
        public
        returns (uint256)
    {
        require(hashes[hash] != 1);
        hashes[hash] = 1;
        _tokenIds.increment();
        uint256 newItemId = _tokenIds.current();
        _mint(recipient, newItemId);
        _setTokenURI(newItemId, metadata);

        return newItemId;
    }
}


texts:
I want to retrieve the latest state from the local disk leveldb. I first get the latest block "currentBlock" from the leveldb, which works fine. Then I use the function loadLastState in go-ethereum source code, the corresponding state "currentBlock.Root()" is not found. Then I did into the low level function trie.OpenTrie, it cannot find the corresponding state by the stateRoot.

My question is whether the state is stored on the local disk? Or just the blocks are stored on disk? Thanks!


texts: Implication of hacking into an ethereum node on proof of stake

texts:
It is my understanding that in proof of stake, the validator puts up a stake that gets slashed if they don't respond to requests truthfully. In the scenario that someone hacks into your node, wouldn't it be very easy to slash someones funds and have them lose a ton of money?

The scenario I am trying to capture here is one where you try to run a proof of stake validator on the cloud or an environment that could be more prone to breaches. In PoW, it would be inefficient, but, I could run a miner on my cloud and just give it the public key. It'll continue making me money without the private keys. If I want to run my own wallet to interact with my account I could setup a node in a more locked down environment to accomplish that and on an on-demand basis. For PoS I would assume it would be risker to try this since the validator would need to have access to the private key or some hypothetical staking key that provides lesser access.

Does Ethereum have any protections from this?


texts:
I installed a v.0.8.7 client and tried switching to Ropsten, following these instructions. Namely, I typed in:

dyn906-29:~ sam$ geth -- datadir /Users/sam/Library/Ethereum/testnet/geth/chaindata/ init /Users/sam/Library/Ethereum/testnet/testnet_genesis.json; geth -- datadir /Users/sam/Library/Ethereum/testnet/geth/chaindata/ --networkid 3 console

... synchronization started, with typical (i.e., after I let it run about 10 minutes) console output:

I1124 12:07:01.281067 eth/downloader/downloader.go:298] Synchronisation failed: block download canceled (requested)
I1124 12:07:23.178469 core/blockchain.go:975] imported 3 block(s) (0 queued 0 ignored) including 0 txs in 1.001425657s. #84205 [dc3d3bcd / c0b43021]
I1124 12:07:24.448356 core/blockchain.go:975] imported 3 block(s) (0 queued 0 ignored) including 2 txs in 8.001122ms. #84208 [e716f763 / 9cdfe671]
I1124 12:07:33.003664 core/blockchain.go:975] imported 2048 block(s) (0 queued 0 ignored) including 1897 txs in 4.743529105s. #86256 [2c5e179c / dbc9325e]
I1124 12:07:37.833884 core/blockchain.go:975] imported 2048 block(s) (0 queued 0 ignored) including 676 txs in 4.821595483s. #88304 [f9215a23 / 62150759]

What confuses me in this output it indicates I downloaded as many as 86256 blocks (see end of last line)... but I see here  that there are only about 35000 blocks in the new testnet so far.

So I have the impression that I am synchronising with Morden..

1. Am I currently synchronizing with Morden (instead of with Ropsten)?

2. How can I make sure my Client is synchronizing with Ropsten?

Thanks.

EDIT: The GUI mentions a total of ca. 1,800 K blocks... so I am fairly positive my Client is synchronising with Morden. So how to move to Ropsten?


texts: Making GET request with ChainLink (using dynamic URL Params)

texts:
Im quite new to using ChainLinks Client to make requests to external API's.
I am generating random numbers using their VRFBaseConsumer in my Wallet Contract.
Upon receiving a newly generated number, id like to use it along with the senders wallet to make a GET request to my API in order to store the number and its meta data.
I have been successful in doing so by using hardcoded values for my url params.
However, when i come to plug in the uint256 that the VRF generated (tokenID), into the following code, it doesn't seem to upload :
function uploadMetaDataToServer(uint256 tokenID, address creator) external returns (bytes32 requestId)
{
    Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);

//RIGHT HERE
        string memory finalURL = strConcat('https://baseURL.com/dev/nft/metadata/',addressToString(creator),'/',uint2str(tokenID));

    request.add("get", finalURL );
    request.add("path", "CREATED");

     sendChainlinkRequestTo(oracle, request, fee);
}

function addressToString(address _address) internal pure returns(string memory) {
   bytes32 _bytes = bytes32(uint256(_address));
   bytes memory HEX = "0123456789abcdef";
   bytes memory _string = new bytes(42);
   _string[0] = '0';
   _string[1] = 'x';
   for(uint i = 0; i < 20; i++) {
       _string[2+i*2] = HEX[uint8(_bytes[i + 12] >> 4)];
       _string[3+i*2] = HEX[uint8(_bytes[i + 12] & 0x0f)];
   }
   return string(_string);
}
function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) {
    if (_i == 0) {
        return "0";
    }
    uint256 j = _i;
    uint len;
    while (j != 0) {
        len++;
        j /= 10;
    }
    bytes memory bstr = new bytes(len);
    uint k = len - 1;
    while (_i != 0) {
        bstr[k--] = byte(uint8(48 + _i % 10));
        _i /= 10;
    }
    return string(bstr);
}

function strConcat(string memory _a, string memory _b , string memory _c, string memory _d ) internal pure returns (string memory){

    bytes memory _ba = bytes(_a);
    bytes memory _bb = bytes(_b);
    bytes memory _cc = bytes(_c);
    bytes memory _dd = bytes(_d);

string memory abcde = new string(_ba.length + _bb.length + _cc.length + _dd.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (uint i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (uint i = 0; i < _cc.length; i++) babcde[k++] = _cc[i];
for (uint i = 0; i < _dd.length; i++) babcde[k++] = _dd[i];
return string(babcde);
}

Whenever I replace the tokenID with a hard coded uint (upon calling uint2str()), it works :
function uploadMetaDataToServer(uint256 tokenID, address creator) external returns (bytes32 requestId)
{
    Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);

//RIGHT HERE
        string memory finalURL = strConcat('https://baseURL.com/dev/nft/metadata/',addressToString(creator),'/',uint2str(12345));

    request.add("get", finalURL );
    request.add("path", "CREATED");

     sendChainlinkRequestTo(oracle, request, fee);
}

I cant seem to figure out whats going on here and why the data only uploads if im using a hardcoded uint. any help would be greatly appriciated


texts: How to read all token balances from wallet?

texts:
The following code works for me to read Ether value from wallet:

var web3Instance =  new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

export async function readAccountEtherValue(address: string): Promise<number> {
    var balance = await web3Instance.eth.getBalance(address);
    return web3Instance.utils.fromWei(balance, "ether");
}

How can I read the values of all tokens from the wallet?


texts: "Fork choice rule" : A general term? or a specific algorithm?

texts:
Is "Fork choice rule" a general term including all the algorithms used for choosing a branch among other branches in a fork (including longest chain rule etc) ?
Or is it a specific algorithm designed for Casper Ethereum ?


texts:
I'm trying to allow NFT holders to sell their tokens by listing prices (ETH) and allow others to buy those listed tokens.

I used openzeppelin and succesfully implemented and tested my token creation. Now, if I want that exchange to be happened, how do I further implement? I created another contract btw to begin with.

import "openzeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";

contract MyTokenSale {

 ERC721Token public token;

 constructor(address _tokenAddress) public {
    token = ERC721Token(_tokenAddress);
  }

Any examples or code snippets would be greatly appreciated.


texts: how does exchanges manage user's Ethereum wallets?

texts:
I noticed that Binance exchange created an unique address for every user to deposit ERC20 tokens.  after the deposit, Binance transfer those tokens to a specific address, which is marked as "Binance"(should be the cold wallet) on etherscan. here is the address.

the whole process looks like this:

step1: user's wallet =>  user's address at Binance
step2: user's address at Binance =>  Binance's address.

my understanding is: step2 costs gas too and Binance paid for it.
is that right?   for now the gas cost for every Ethereum transaction is about 0.0011298ether.

so every deposit from user, costs Binance ether?

if there are many small deposit, then there could be a lot of gas cost on the transfer of step2.

what is the benefit of this?

is there a better way to avoid the extra cost?


texts: Is it possible to create an Ethereum Adress in MEW (MyEtherWallet) entirely offline and then send tokens to it or do I have to at least activate it one time online?


texts:
What is the mean number of embedded hashes per Ether?

If my understanding is correct, the Keccak-256 hash function is a fundemental unit of computational work on the Ethereum blockchain. Therefore each new ETH unit must have some number of hashes performed to bring it into existance. I'm interesting in gauging what this value is and how it changes over time:

How has NoHashes/ETH changed over time?

I'm assuming it varies with the Proof of Work target value. I'm am unsure if there was any special mechanism behind the pre-sale which changes the NoHashes/ETH.

How will NoHashes/ETH change when the system changes to Proof of Stake?


texts: differences in terms of api supported by full node vs light node

texts: Are there any differences on the API supported by full node vs light node in Ethereum?


texts:
I have some confusions regarding merkle patricia tree..

Q1. As in a binary merkle tree hash of a node is calculated and we combine the hash of two child node to create parent node and so on. State tree is merkle patricia tree, so how hash is calculated in this (means hash of all node or only root node)?

Q2. As in state patricia tree, node is designed on (key, value) pair where key is account of user. So what is the key in transaction tree and reciept tree?

Q3. In patricia tree, (key, value) pair is stored. so here value represents hash of something or original data of account is stored as a leaf node?


texts: Node on Raspberry Pi and connection via web3.js

texts:
I have installed a geth-node on raspberry pie. Raspberry pie is connected via Ethernet.  Now  I am trying to connect to this node via web3.js

    var ethWeb3 = new Web3(new Web3.providers.HttpProvider('http://192.168.0.220:8042'));

192.168.0.220 ->is the address of device. (I connect so via terminal)

But if I check ethWeb3.isConnected(), it returns false.

My geth script is:

geth --identity "node1" --fast --networkid 42 --datadir /home/pi/ChainSkills/node --nodiscover --rpc --rpcport "8042" --port "30303" --unlock 0 --password "/home/pi/ChainSkills/node/password.sec" --ipcpath /home/pi/.ethereum/geth.ipc --dev

Where can be a mistake?


texts: Decoding Contract Log's "Data" field With eth-abi Throws Error: "Padding bytes were not empty: b'0x0000000000'"

texts:
I used this guide to create the code below. I suspect the error is somewhat related to the encoding processes I do to the strings, as that is the only place where I deviate from the guide. Here is my code for decoding the contract's log's data field:

from sha3 import keccak_256
import json
import urllib.request
import ssl
import eth_abi

def format_raw_data(logs,event_name):
    abi = json.loads(json.loads(open("./abi.json").read())['result'])
    types = []
    names = []
    indexed_types = []
    indexed_names = []
    for elem in abi:
        if 'name' in elem and elem['name'] == event_name:
            for input in elem['inputs']:
                if input['indexed']:
                    indexed_types.append(input["type"])
                    indexed_names.append(input["name"])
                else:
                    types.append(input["type"])
                    names.append(input["name"])
            break

    for log in logs:
        encoded_topics = list(map(lambda x: str.encode(x), log['topics'][1:]))
        indexed_values = [eth_abi.decode_single(t, v) for t, v in zip(indexed_types, encoded_topics)] #error occurs here
        values = eth_abi.decode_abi(types,log['data'].encode())
        print("Data: ", dict(zip(names,values)))

The thrown error is "eth_abi.exceptions.NonEmptyPaddingBytes: Padding bytes were not empty: b'0x0000000000'" Once the abi is downloaded into the same directory, the error should be reproducible.

Many Thanks


texts: Generating and signing a transaction - what am I doing wrong?

texts:
I am writing a program in c++ for generating and signing transactions. The transaction it generates seem to be invalid. Every time I try to broadcast it, I get an error saying insufficient funds on sender address.

RLP rlp;
uint8_t *privatekey = charArrayToByteArray("*******************************************");

TX tx;
tx.nonce="0x06";
tx.gasPrice="0x01a13b8600";
tx.gasLimit="0x5208";
tx.to="0x8f9ad0411a887c3243bcded341ed63f90b3e1417";
tx.value="0x2386f26fc10000";
tx.data="0x";
tx.v="";
tx.r="";
tx.s="";

string enc = rlp.bytesToHex(rlp.encode(tx, true)); //Encode raw transaction

uint8_t *hashval = new uint8_t[HASH_LENGTH];
keccak256((uint8_t*)enc.c_str(), enc.size(), hashval); //Generate hash

uint8_t* signature = new uint8_t[SIGNATURE_LENGTH];
uECC_sign(privatekey,hashval, HASH_LENGTH, signature, uECC_secp256k1()); //Sign the hash

uint8_t *r = new uint8_t[32];
uint8_t *s = new uint8_t[32];
splitArray(signature,r,0,32);
splitArray(signature,s,32,64);

tx.r = string("0x") + byteArrayToCharArray(r, 32);
tx.s = string("0x") + byteArrayToCharArray(s, 32);
tx.v = "0x1c";

string encoded = rlp.bytesToHex(rlp.encode(tx, false)); //Encode transaction with signature

uECC library: https://github.com/kmackay/micro-ecc/blob/master/uECC.h

RLP library: https://github.com/kvhnuke/Ethereum-Arduino/blob/master/Ethereum-Arduino/RLP.cpp

Resulting transaction: http://ehrs.info/images/g7HkznUS3C.png


texts: why web3.eth.getBlockNumber().then(console.log) returns 0

texts:
I have build a Ethereum Full Node in Ubuntu 18.04. geth is running through the following command:

nohup geth --rpcaddr 127.0.0.1 -rpcport 8545 --rpc -rpcapi "wb3,admin,eth,personal,net" --ws --wsaddr 127.0.0.1 --wsport 8546 --wsorigins "*" --datadir "/data/ethereum" --syncmode fast --maxpeers 10000 --cache 8196 >> geth.log 2>&1 &

one line of geth.log content:

INFO [06-06|00:59:22.250] Imported new block headers               count=1    elapsed=6.793ms     number=10206927 hash="92683d…04062d"

truffle is configured as the following:

development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    }

In truffle console, when I use command web3.eth.getBlockNumber().then(console.log), it just returns

0
undefined

Why is it not 10206927(from geth.log) or a close number?

Thanks in advance!


texts: Solidity Exceeds block gas limit during Mocha Tests with Ganache-cli

texts:
How can I increase the gas limit in this case? The error message is "n: Exceeds block gas limit" or "base fee exceeds gas limit".

I think there is some kind of api I need to set the block gas limit here.

Are my contracts too large? Should I test each contract one by one instead?
Please advise. Thank you.


texts: Best way to queue ethereum events for a production app in messaging system like kafka

texts: i'm trying to figure the best way to securely and provably receive events from an ethereum contract and queued to a message queue like apache kafka, without duplicates or events being missed out. I've heard there are issues with using the event subscription of web3 js. could you list out the best alternatives for a production grade enterprise app? eg. blockcypher API, alchemy etc.


texts: How to perform Web3 & MetaMask user sign in

texts: I'm new to blockchain development and would like to build an app with node.js, express.js, next.js, web3, meta mask for user sign in. Are there any good docs that would help me out thank you.


texts: Since a light node makes transactions from a connected full node, does a light node need ethers to make transactions or it uses the ethers from the full node?


texts:
I'm trying to use the following piece of code to build an De-Fi App by following along this tutorial
Following is the piece of code in the App.js file
import React, { Component } from 'react';
import Web3 from 'web3'
import logo from '../logo.png';
import './App.css';

class App extends Component {
  async componentWillMount(){
    await this.loadWeb3()
    console.log(window.web3)
  }
  async loadWeb3(){
    window.addEventListener('load', async () => {
      // Modern dapp browsers...
      if (window.ethereum) {
          window.web3 = new Web3(ethereum);
          try {
              // Request account access if needed
              await ethereum.enable();
              // Acccounts now exposed
              web3.eth.sendTransaction({/* ... */});
          } catch (error) {
              // User denied account access...
          }
      }

However I'm getting the following error when I try to run it in the Chrome browser where Metamask

'ethereum' is not defined  no-undef

I was merely following the tutorial on Blockchain App tutorial and the step is around the 1 hour 38 minute mark.


texts: What if the chosen validator does not create a block. How works consensus mechanism in this scenario over proof of stake


texts: Function returns always with the same input even it is in the loop..TRUFFLE+ANGULAR 7+WEB3

texts:
One of the function in Contract:

 function getPostCounts(uint _postID)public view returns(PostCountsModel memory postCounts){
        return postCountOperations[_postID];
    }

This is the calling function in component.ts (Angular project)

 for (let i = 5; i > 0; i--) {
          app.getPostCounts(i).then(_postCounts => {
            console.log('Iteration-->', i);
            console.log('Total Posts Counts', _postCounts);

          })

The resulting output is::

Iteration--> 5 Total Posts Counts (5) ["0", "0", "0", "0", Array(0), postID: "0", likes: "0", disLikes: "0", shares: "0", comments: Array(0)] Iteration--> 4 Total Posts Counts (5) ["0", "0", "0", "0", Array(0), postID: "0", likes: "0", disLikes: "0", shares: "0", comments: Array(0)] Iteration--> 3 Total Posts Counts (5) ["0", "0", "0", "0", Array(0), postID: "0", likes: "0", disLikes: "0", shares: "0", comments: Array(0)] Iteration--> 2 Total Posts Counts (5) ["0", "0", "0", "0", Array(0), postID: "0", likes: "0", disLikes: "0", shares: "0", comments: Array(0)] Iteration--> 1 Total Posts Counts (5) ["0", "0", "0", "0", Array(0), postID: "0", likes: "0", disLikes: "0", shares: "0", comments: Array(0)]

From the above output we can observe every time it returns the same object. postID is alwys be 0 .I dont know why it is happening.

Please help me!


texts: How to initialized struct with member variable type mapping

texts:
I have a problem with the below code,  specifically samplestruct2

struct samplestruct1 {
    string name;
}
struct samplestruct2{
    string name;
    mapping (int => samplestruct1) s1s;
}

function createSampleStruct2(string name) {
    samplestruct2 s2;
    s2.name = name;
    ...
}

samplestruct2 s2 is giving me a warning : "uninitilized storage pointer"

I also tried samplestruct2 s2 = samplestruct2(name), it gives me also an error


texts:
Last year just after the DAO hack i started to play with ETH and MIST, i created a contract because i wanted to see the transaction info of the wallet i wanted to use for mining..

I have updated mist, but i do not see the contract in my wallet anymore, i can see the address on the blockchain with eth on it, and i can see a Contract Creation on the main address on the mist wallet but i do not have have the contract listed

I have tried to upload the keyfile to myether but there is 0 eth there, and nothing under token...?


texts: How to create raw transactions for erc20tokens using python? Is there any api to send and receive transactions?

texts: I want to create raw transactions for erc20tokens. I want to know how to create addresses for erc20tokens and also to send and receive coins using python. Any help would be appreciated. Thanks


texts: What is the difference between SafeERC20.sol VS ERC20.sol

texts:
Need to understand the safeERC20.sol and ERC20.sol from openzeppelin
I was reading the medium articles and unable to understand why safeERC20.sol has been used
Please help me understand this
Thanks


texts: Contract migration error: The contract code couldn't be stored, please check your gas amount

texts:
I am trying to deploy my simple ERC20 token with locally installed Truffle, but received this error:

truffle migrate --reset
Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  Migrations: 0xc67440ccf402de259e5d6193eec29283bcb5555e
Saving successful migration to network...
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying ERC20...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.

ERC20 class contains:

pragma solidity ^0.4.11;

    contract ERC20 {
        //uint public totalSupply;
        function totalSupply() constant returns (uint totalSupply);

        function balanceOf(address _owner) constant returns (uint balance);
        function transfer(address _to, uint _value) returns (bool success);
        function transferFrom(address _from, address _to, uint _value) returns (bool success);
        function approve(address _spender, uint _value) returns (bool success);
        function allowance(address _owner, address _spender) constant returns (uint remaining);

        event Transfer(address indexed _from, address indexed _to, uint _value);
        event Approval(address indexed _owner, address indexed _spender, uint _value);
    }

Migration JS file:

var ERC20 = artifacts.require("./ERC20.sol");
var SafeMath = artifacts.require("./SafeMath.sol");

var MyToken = artifacts.require("./MyToken.sol");

module.exports = function(deployer) {
  deployer.deploy(ERC20);
  //deployer.deploy(SafeMath);
  //deployer.link(ERC20, MyToken);
  //deployer.link(SafeMath, MyToken);

  //deployer.deploy(MyToken);
};

Environment:

Truffle v3.3.0, bundle version: 3.3.1
Solidity v0.4.11 (solc-js)
EthereumJS TestRPC v3.0.5

So my token is inherited from this ERC20 contract, but I even can't compile parent one contract. What is wrong?


texts: How to track mining progress on Testnet?

texts:
(beginner question)

I have installed Ethereum Wallet 0.7.6 on Windows. It shows 5-6 peers and 1,230,865 (growing every ~1 minute). Two days ago I clicked on "Start Mining" and the wallet has been running continuously for over 48 hours now. I have 0 ether balance, but according to this answer, however, I should have some Testnet ethers within 20 minutes, mining using the CPU only.

Update: I found an external configuration reason for the lack of results and indeed the client wasn't mining, but still my question is valid:

How can I track my mining activities on Testnet (shall I use the same tools as for Main Network)?

What can I do when my balance is stuck at zero? Shall I check some website (explorer)? Look at the logs? Check something in the wallet interface?

Advised to check the Etherscan explorer I would like to stress I am talking about a situation where I have not mined any block for 48 hours and it shows like this:

From the screen above (or subsequent links) I cannot see a way to tell if my Mist is actually mining something or not.

As a contrary, if I ran geth on Main Network in CLI, I could see things being processed even if I didn't get any results (blocks).


texts: Why are there no leading zeroes in ethereum block hash?

texts:
The block hash has to be below certain difficulty, right? In bitcoin this means, that there are many leading zeroes in hash value, eg. for bitcoin block #402329 hash is 000000000000000006efd706f4467e2d7ed6f0fed757ca7d59e2cc8c81a2d9e3.

But for the ethereum blockchain the hash of block #1138224 is 0xa4f80a26aecb5fc975e12a9d3d0f6a7907c60b1d7e6b5205dfb4c984dad7f1ba.

Why are there no leading zeroes?


texts: deploy a smart contract in production with truffle

texts:
I'm ready to deploy a smart contract in production ethereum blockchain,
may I remove 1_initial_migrations.js from my project?
As far as i can see, when i deployed the contract to rinkeby test network also the Migrations.sol has been delpoyed, but i do not understand what is the scope of this additional contract.
tnx for your support.


texts: Issue with Serverless deploy of smart contract-Dependency mismatch -Package.json,Package-lock.json error

texts:
I'm trying to deploy my smart contract serverless(AWS lambda) and I'm using Truffle framework.

The code is getting deployed in an earlier system(earlier it was deployed here). Now I have updated the smart contract version .When I am deploying it. I am not able to in my new system due to dependencies mismatch n version change.I tested my smart contract in local system using ganache. there uts working fine. When deploying serverless I am getting the issue.

Below is the error screenshot

 - Below are the dependencies in package.json.

"aws-sdk": "^2.256.1",
"express": "^4.16.3",
"fs": "0.0.1-security",
"openzeppelin-solidity": "^1.12.0",
"pug": "^2.0.3",
"solc": "^0.4.24",
"web3": "^1.0.0-beta.50"

and all the above have been updated to newer versions..
0

above were the earlier dependencies in which the project was executible.Now I have updated to below dependencies--
"aws-sdk": "^2.489.0", "express": "^4.17.1", "fs": "0.0.2", "openzeppelin-solidity": "^2.3.0", "pug": "^2.0.4", "solc": "^0.5.10", "truffle": "^5.0.26", "truffle-hdwallet-provider": "^1.0.13", "web3": "^1.0.0-beta.52" } even though the package.json file is updated the package-lock.json file is in the older version ...n despite several tries (using ncu -u -->npm install)..still package-lock is not getting updated


texts: Calling truffle migrate from an end-to-end test, how do I retrieve addresses of compiled contracts?

texts:
I'm developing an end-to-end test that triggers truffle migrate and then needs to make contract addresses available to functions in the test.

How can I make truffle migrate return deployed contract addresses? It would not be ideal to parse the stdout from truffle migrate.


texts: How can an address on Etherscan have a balance of 0 ETH when I don't see any outgoing transactions?

texts: I don't know why balance of the address is 0.


texts: How to determine which modifier caused transaction to fail?

texts: When applying modifier like isOwner, or hasFunds to a method the log at least in remix does not indicate in detail the name of the modifier but only that a given function has failed.  Is there anyway to determine which modifier failed on the function without debugging? How exactly should one use debugging to see this? Should events be issued in modifier or not to record pass or failure?


texts: Not able to connect to metamask using ethereum.enable()

texts:
I actually tried building a simple Decentralized application using the truffle pet-box. There's some issue in the App.js part of my project. I'm not able connect it to the MetaMask. I used this to connect:
initWeb3: async function() {
    // Modern dapp browsers...
    if (window.ethereum) {
      App.web3Provider = window.ethereum;
        // Request account access
       try {
    // Will open the MetaMask UI
    // You should disable this button while the request is pending!
    **await ethereum.enable();**
  } catch (error) {
    console.error(error);
  }
}

I got an error in the console as shown below:

Then I changed my code as :
initWeb3: async function() {
        // Modern dapp browsers...
        if (window.ethereum) {
          App.web3Provider = window.ethereum;
            // Request account access
           try {
        // Will open the MetaMask UI
        // You should disable this button while the request is pending!
       **ethereum.request({ method: 'eth_requestAccounts' });**
      } catch (error) {
        console.error(error);
      }
    }

But still there's some issue and I see this:

How can I connect to metamask? I've been trying a lot but nothing worked.


texts:
I have a simple question about solidity memory declaration:
It both return bytes data in following two cases, but one needs to have memory keyword and another does not.
I am a bit confused about the theory behind the scene. It will be appreciated anybody can help to clarify it.
function toBytes(string memory data) pure external returns(bytes memory) {
    return bytes(data);
}
function keccakBytes(string memory data) pure external returns(bytes32) {
    return keccak256(bytes(data));
}


texts: Take a percentage of msg.value on ERC721 transfer

texts:
I want to transfer part of the value paid to an address whenever an NFT is traded. If the value is 0, then nothing is transferred.
My original idea was to override the transfer function in oppenzeppelin/ERC721, but its impossible to override a nonpayable function to payable.
Any way of doing this? The idea is for a DAO to make passive income every card trade.


texts: Passing a public variable to a function in truffle console

texts:
I have a simple function to compare two string:

function stringCmp(string a, string b) public returns (bool){
  bytes memory aa=bytes(a);
  bytes memory bb=bytes(b);
  if(aa.length!=bb.length)
    return false;
  for(uint i=0; i< aa.length; i++)
    if(aa[i]!=bb[i])
      return false;
  return true;
}

This function properly work in truffle console if used as follow:

t=contract_name.at("address_of_c");
t.stringCmp.call("string1","string1") --> true
t.stringCmp.call("string1","string2") --> false

Supposing we have declared in the contract:

string public p="ciao";
string public q="ciao";
string public r="hello";

Which is the properly way to pass those string to the call?
I tried :

t=contract_name.at("address_of_c");
t.stringCmp.call(t.p(),t.q()) --> true (and it seems ok but..)
t.stringCmp.call(t.p(),t.r()) --> true (So what..???)
t.stringCmp.call(t.p,t.r) --> true (???)
t.stringCmp.call(t.p.call(),t.q.call()) --> Invalid number of arguments to Solidity function

Moreover what is exactly going on?
Any Workaround?


texts: What you mean by Off-Chain in Ethereum Blockchain? can i use geth as off-chain in DApp?

texts: I have read several articles of off-chain definition and come to know that they are use for scale the ethereum blockchain. but my question is what is actually mean by off-chain word in ethereum blockchain? can i use geth as a off-chain for DApp? how i start to implement off-chain in DApp project? or off-chain means any local database? i am totally confused and gone through many articles in last three days. please help me to find out this answers and it will really helpful your suggestion to me.


texts:
On a private dev chain with two Ethcore nodes, I created a dapp as per the instructions at https://github.com/ethcore/parity/wiki/Tutorial-Part-I. Everything was OK and I can see the dapp listed in the Parity browser UI under DECENTRALIZED APPLICATIONS on the APPLICATIONS tab. However, when I click on it, I get just a blank page. After waiting about 10 seconds, when I refresh the page, it displays Loading for a few seconds and then the message The dapp cannot be reached

Googling for "the dapp cannot be reached" ethcore only gave me the Git commit page of the commit when this message was added to a Javascript source file.

Any help is very much appreciated.


texts: Installing swarm is giving: unrecognized import path "context" (import path does not begin with hostname)

texts:
I was getting started with Swarm. I am trying to install Swarm and am following the official tutorial for it. Being specific I ran the following commands:

sudo apt install golang git
curl -O https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.7.3.linux-amd64.tar.gz
mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc
echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc
mkdir -p $GOPATH/src/github.com/ethereum
cd $GOPATH/src/github.com/ethereum
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
git checkout master
go get github.com/ethereum/go-ethereum

The last command is giving import error:

  package context: unrecognized import path "context" (import path does
  not begin with hostname)

I am not sure what's causing the issue. Any help?


texts:
I have a very simple migration script, and I believe I did nothing wrong.

var Migrations = artifacts.require("./Migrations.sol");
var HW = artifacts.require("./HelloWorld.sol");

module.exports = function(deployer) {
    deployer.deploy(Migrations);
    deployer.deploy(HW);
};

However, truffle migrate just doesn't want to deploy without the --reset option.

I have even tried to do migrate without compile, and truffle do aware that my HelloWorld.sol had been changed, and compile automatically. But it just doesn't want to deploy.


texts: How to delete an item in an array of uint256

texts: I'm using solodity 0.7 and have an array of uint256 so is there away to delete an item in this array?


texts: Difference between Binary of the Contracts in Hex and contract bytecode?

texts:
I use the command "solcjs --bin mycontract.sol" to get the "Binary of the contracts in hex" and it looks like:

It can be used as a parameter of evm in geth after the command "evm --code".
When I use Remix, I get the bytecode in JSON of my contract:

So, what are differences between binary in hex and bytecode of a contract ? What are they used for ?


texts:
I'm trying to execute these commands on windows 10

./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]"
./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'

When  I try the first one on powershell, I get this error:

  Error: failed to unmarshal json. invalid character '*' looking for beginning of value

so I tried with this one just in case,

./ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"

which gives me another error:

  Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Origin"

What are the proper commands for above IPFS configs on windows 10 using powershell?


texts:
I have a Wordpress website on one server. And on AWS (another server) I have block chain installed.
Now I want to show the Block chain data (Smart Contarct Informationor Transactions) into my wordpress website. I know I can use web3js for the same. But do I need to install something on my wordpress server to run Web3js Commands?

Regards
AKM


texts: who has the right to access to a smart contrat's storage space?

texts:
Contracts have 2 ** 256 32-byte storage slots available to store data in. This can be thought of as each contract having it's own database.
Can all nodes in a blockchain network access to smart contract's storage space ?


texts:
I am currently running a private ethereum chain with 2 nodes. My coinbase address on the main node has plenty of ether so I went to make a transaction but got the error "Gas Limit exceeded". I noticed that the gas limit was set to 5000 which is too low to make a transaction so I went to the customised genesis.json file and increased the limit to "0xC350" or 50000. Despite this the limit only moved to 5003. I have no idea why it does this and I have replaced the figure with other bigger numbers yet it only ever manages to get to 5003 instead of the default 5000. Any help would be much appreciated.

Here is my Genesis.json file:

{
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash":      "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0xC350",
"difficulty": "0x400",
"mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc":
{
"0xcf117e46aa225864ed1d0dd7e99b8b006abe3410":
{ "balance": "10000000000000000000000000" }
}

}

I am using Geth.