texts: Cannot see account created when using getAccounts

texts:
i have setup private blockchain on vm using geth and i have created personal account for deployment of contract on private blockchain. Now, when i try to create new account, i am able to do so but i cannot see that account when i try get list of all accounts.

 web3.eth.accounts.create()
{ address: '0xF3E6A7c5A9D92A89054C582bCe92d4defA741459',
  privateKey:
   'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  signTransaction: [Function],
  sign: [Function],
  encrypt: [Function] }
> web3.eth.getAccounts().then(console.log);
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      [Object: null prototype] {
        removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] } }
> [ '0x5907Ed57f77E5d8eb6fC39807b07b8f8803eE608' ]

It is only listing personal account.


texts: How to send ether without manually key in ether amount? (Remix IDE)

texts:
I want to send ether from one account to another account. I do not want to use msg.value and manually key in the ether amount to send ether.
I follow Youtube video and use 3 ways to send ether and all 3 ways have error. I try Google the result, they suggest to put fallback function which I tried and fail to implement. I totally out of idea how to solve this problem.
Hope some experts can help me solve my problem. Thank you very much.
pragma solidity ^0.6.0;

contract TransferEther{
    function sendEther (address payable receiver) public payable {
        //1st way
        receiver.transfer(1 ether);

        //2nd way
        (bool sent, ) = receiver.send(1 ether);
        require (sent, "Failed to send Ether");

        //3rd way
        (bool sent, ) = receiver.call{value:1 ether}(" ");
        require (sent, "Failed to send Ether");
    }
}

1st way error: VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
2nd way and 3rd way error: VM error: revert. revert The transaction has been reverted to the initial state. Reason provided by the contract: "Failed to send Ether". Debug the transaction to get more information.


texts: How to configure truffle network with IPC provider?

texts:
How can I define in truffle the ipc connection to the node? Currently I am using in truffle.js host/port fields, which are used to create a HttpProvider.

module.exports = {
  networks: {
    dev: {
      host: "localhost",
      port: 8545,
      ...
    }
  }
}


texts:
I am exploring for alternate consumer apps besides Metamask to connect to production Ethereum for end users in Ethereum Dapp. Is there better alternatives available for the same?
Thanks


texts: ERC20, correct way of setting totalSupply

texts:
whats the correct way of setting the totalSupply and why?
decimals = 18;
totalSupply = 10000

or
decimals = 18;
totalSupply = 10000 * (10 ** uint256(decimals));

Whats the correct way? What's the difference?
What is (10 ** uint256(decimals)) actually doing?
Seems like the last option is the correct one, because if I dont use the second option, my tokens in Metamask connected to Ganache will show always 0 balance.
Also
10000 === 10000 * (10 ** uint256(decimals)) ?

Also another question, how can I call the methods transfer or transferFrom with a decimal value, sending 2.5 tokens for example? How would that be done, since the type is uint and I cant pass decimals.


texts: Gas estimation failed AmazinBEP20 contract

texts:
Im trying to deploy the contract AmazingBEP20, i use:
http://remix.ethereum.org/#optimize=true&runs=200&evmVersion=null&version=soljson-v0.8.3+commit.8d00100c.js
Contract i want to deploy is this one:
https://testnet.bscscan.com/address/0xe901aa83561bb9acc614b473968fda464d6b14a3#code
Source: https://github.com/vittominacori/bep20-generator/blob/v2.0.0/dist/AmazingBEP20.dist.sol
Getting this error:

It looks due Feereceiver/Payable functions, i set them under comments to disable and deployed correctly without errors here:
https://testnet.bscscan.com/address/0x29f6abf3d35a63eab9e24c953cd48b04fbabd233#code
So, how to fix that gas errors? I had same gas errors trying to deploy a safemoon clone contract on testnet, but on mainet no problems that gas error no appears. In this case no matter testnet/mainet the gas error always there with that functions enabled.
Btw, with that functions disabled, the contract still ok? Or may cause problems?


texts: Maian Tool Repository on Docker: How to store contract retrieved from etherscan.io and what is ‘test.sol’

texts:
I am in the MAIAN tool repository on docker. The link at :
MAIAN Tool GitHub Link
They provided details of how to execute the MAIAN tool from docker. I am in the MAIAN tool repository on docker.
They have first tried to access the contract from docker:
Accessing contract KaratBankCoin using Etherscan.io
The name of the contract is KaratBankCoin. They have not told where to store the contract.
Later on they used the command:

python maian.py -c 2 --soliditycode test.sol KaratBankCoin

I am getting the error :

==================================================================================================== [ ] Compiling Solidity contract from the file test.sol ... [-]
Contract file test.sol does NOT exist [-] Contract KaratBankCoin does
NOT exist

Because I don’t know what is test.sol and I don’t know  how and where to store the KaratBankCoin contract retrieved from mainnet.
They have not provided any details about test.sol and how to store KaratBanCoin because we are in the Maian tool’s repository.
Somebody please guide me.
Zulfi.


texts: Ethereum Internal transactions how to work with it?

texts: I've covered a bunch of forums and I do not understand what Internal Transactions is in etherscan. I have been transferred to the transaction and it is in Internal Transactions. And I do not see her in my balance. How do I bring them to the main wallet, if possible.


texts: How to keep track of a daily and yearly object

texts:
I need some help on what's the best way of implementing solidity code that keeps track of a user's daily data. Once the day passes it's stored in an array for every single day that passes and that daily data is reset for the next day. I would like to get some ideas or sample code related to this?

If I am not explaining it correctly think of it as if someone wants to keep track of their homework everyday. We keep a history of all the days that have passed and are able to show on the UI the current day homework and any of the days in the past.

My current implementation is the following:

mapping(address => Homework) public daily;

mapping(address =>  Homework[]) public overall;

Is this the right approach, I am basically running a scheduler to run every day and once it executes the daily would be reset for each user and push in the daily to the overall.  But I cannot get access to the keys for the mapping making this approach difficult.  Any other suggestions?


texts: Is it possible to check the Thrid party token ( USDT ) within my ERC223 contracts?

texts:
I want to check how many tokens are received in my contracts, so that I am able to allocate MY TOKENS to the TOKEN Sender.

I tried several ways like approveAndCall, but its not working.

I don't know, whether is possible or not.

Thank you.


texts: Showing "We couldn't estimate the gas" error in estimated fee consumption field while executing a contract in ethereum wallet

texts:
I have tried creating contracts in ethereum wallet but sometimes it shows an error while executing those contracts. The error says It seems this transaction will fail. If you submit it, it may consume all the gas you provide. Can anyone help me with this issue?

My smart contract is like:

pragma solidity ^0.4.18;
contract MyToken {
        function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
    }

    contract TransferToken{
        function sendTheToken(address _from, address _to, uint256 _value)public returns(string) {
            address tokenContractAddress = <MyTokenaddress>
            MyToken token = MyToken (tokenContractAddress);
            bool sendSuccess = token.transferFrom(_from, _to, _value);
            if(sendSuccess=true) return 'success';
            else return 'Failure';
        }
    }

In the above contract MyToken is a contract that I have created earlier for crypto-currencies.

pragma solidity ^0.4.18;
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }

contract MyToken {
    string public name;
    string public symbol;
    uint8 public decimals = 2;
    uint256 public totalSupply;
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;
    event Transfer(address indexed from, address indexed to, uint256 value);

    function MyToken(
        uint256 initialSupply,
        string tokenName,
        string tokenSymbol
    ) public {
        totalSupply = initialSupply * 10 ** uint256(decimals);
        balanceOf[msg.sender] = totalSupply;
        name = tokenName;
        symbol = tokenSymbol;
    }

    function _transfer(address _from, address _to, uint _value) internal {
        require(_to != 0x0);
        require(balanceOf[_from] >= _value);
        require(balanceOf[_to] + _value > balanceOf[_to]);
        uint previousBalances = balanceOf[_from] + balanceOf[_to];
        balanceOf[_from] -= _value;
        balanceOf[_to] += _value;
        Transfer(_from, _to, _value);
        assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
    }

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(_value <= allowance[_from][msg.sender]);
        allowance[_from][msg.sender] -= _value;
        _transfer(_from, _to, _value);
        return true;
    }
}


texts: TRUFFLE MIGRATE: Saving migration to chain.Error: Error: Error: Returned error: VM Exception while processing transaction: invalid opcode

texts:
$ truffle migrate

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Starting migrations...
======================
> Network name:    'development'
> Network id:      5777
> Block gas limit: 0x1ff973cafa8000

1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0xb1c862e8e0ef63c49e711d9816606ece17f3b542a63f3ee7231134c0893ecc5c
   > Blocks: 0            Seconds: 0
   > contract address:    0x1504492B6573ef3A9a14dAe6Cc09563Fb4781565
   > block number:        7
   > block timestamp:     1560679987
   > account:             0x8110D6959350570944fa2484E63D5803730e4406
   > balance:             99999.57577006
   > gas used:            261393
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00522786 ETH

   ⠙ Saving migration to chain.Error: Error: Error: Returned error: VM Exception while processing transaction: invalid opcode
    at Object.run (/Users/xxx/.nvm/versions/node/v8.9.4/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
Truffle v5.0.5 (core: 5.0.5)
Node v8.9.4

Can't find the issue to the problem.. Just trying to migrate the very basic Migration contract and it throws this error. Any ideas?


texts: Calling and funding a payable function from existing contract balance

texts: If smart contract A has a balance of 1 ETH, can I call a payable function on Contract B, from a function in Contract A, with a msg.value that would be effectively withdrawn from the balance of smart contract A? As opposed to calling from EOA.


texts:
I am trying to synchronize an archive node. My target was to use Geth to synchronizes on an SSD (example 100GB) and then archive on an HDD (example 5TB). In other words most recent blocks would be stored on the SSD and older blocks would be kept on the HDD.
The closest thing I found to the above is --datadir.ancient which is explained here;
https://blog.ethereum.org/2019/07/10/geth-v1-9-0/
I have set the above as explained with --datadir points to SSD and --datadir.ancient to HDD.
However when I check directory size I get the following;
65G MainnetSSD/geth/chaindata
2.7G MainnetHDD/geth/chaindata/ancient

So at what stage are blocks moved from the SSD to HDD? Is this something I can configure? If not what actually determines when blocks can be freezed?


texts: why transaction receipt's root field is always "0x" in geth 1.7?

texts:
I use geth 1.7 to set up a private network, my genesis config is

this is my contract, the first transaction result is of enen(1,2); the second transaction result is of enen(0,2)

why the transaction receipt's root filed is always "0x" whether the transaction is successful or not?


texts: cannot unmarshal non-string into Go value of type common.Address at Infura

texts:
i'm trying to call this function:

const nonce = web3.eth.getTransactionCount(myAddress)

On the testnet of this node:

'https://ropsten.infura.io/'

But I get this error on this node:

  cannot unmarshal non-string into Go value of type common.Address

at Object.InvalidResponse (.../node_modules/web3/lib/web3/errors.js:35:16)

at RequestManager.send (../node_modules/web3/lib/web3/requestmanager.js:61:22)

at Eth.send [as getTransactionCount]

Any ideas why this is happening?


texts: Failing transaction [not out of gas] but error during execution

texts:
My 2 assumptions of the problem:

out of gas
some failed require statement when calling mint

I don't see these 2 because I made sure to send more than enough gas and that msg.value > priceForTokens on the Ropsten network. Everything works fine with remix's JS VM.

Here's the contract source:

Here's one example of a failed transaction on Ropsten.


texts: Does everyone have to run all the contracts?

texts:
Does everyone have to run all the contracts or can nodes pick and choose what contracts they want to run?

I'm still trying to wrap my head around how many nodes need to run a contract before I can reasonably know it'll go through.


texts: How do I download an entire array using web3?

texts:
I have figured out how to download public data from contracts. This is done by calling contract = web3.eth.contract(abi).at(address) and then calling the function of the data. If I have a string called "hello" I can call contract.hello(function(error, result){console.log(error,result)}).

If I want to download an array, I can only download a part of the array, and not the entire array. Let's say I have uint256[16] arr. I can then download contract.arr(3, function(error, result){console.log("index 4: "+result)}).

How can I download all 16 indexes of the array?


texts:
How can a contract method find the address which invoked it?

Suppose I have a contract A with method B. I used xyz address to call method B then how can method B see xyz address.


texts:
I tried to purchase some tokens on ether delta, but it kept saying tha it would not go through. However, when I came back to my computer, my funds had disappeared. I have located the tokens, but don't know how to retrieve them.

I can see the tokens here, but not when I look at the ether delta interface.
Grateful for any help


texts:
Is there somewhere a list showing the different cost of different calculations?For example:

Perform transaction: 21'000 gas
calculate a hash: 30 gas
addition of two numbers: 3 gas
cycle in a loop: 1 gas
...


texts:
can I add a modifier (for ex: onlyOwner) to a mapping? only I must see the value of mapping's key by myself(onlyowner).

For example:
mapping (address => bool) onlyOwner getAddress;

Thank you.


texts: eth-crypto: How can I use the library in the browser?

texts:
Has anyone manage to use eth-crypto in the browser? I tried to use browserify but I failed. Any hints, what to do?

EDIT:

This is what I did (node:10.15.1/npm:6.4.1)

1) Installed eth-crypto (v1.3.2)):

npm i eth-crypto

2) Created a file main.js:

var ethcrypto = require("eth-crypto");

3) Executed browserify

 browserify main.js -o eth-crypto.js

4) Include eth-crypto.js into my html.file:

<script type='text/javascript' src='eth-crypto.js'></script>

5) After loding the file:

VM29:1 Uncaught ReferenceError: ethcrypto is not defined
    at <anonymous>:1:1

eth-crypto.js has definitely been loaded as I can see it in the network panel of chrome.


texts: I've been working on building and testing a private ethereum network using geth and commodity AWS hardware. I'm curious if it's realistic to expect 14s block times in this case? What I see is very fast block times at the beginning of a new chain, but then it slows to around 21s block times within the first 20,000 blocks.


texts: How to extract signature from web3.eth.sign or web3.personal.sign

texts:
In React Typescript (.tsx file), I'm trying to use web3.eth.sign to validate an account. The signature is being generated properly, but I can't seem to get the signature out of the callback function.
The following code is inside a functional component:
const [signature, setSignature] = useState<string>('')

function Sign() {
   const web3 = window.web3

   web3.personal.sign(
      nonce,
      accountId,
      function(err: any, signed: string) {
         if (!err) {
            console.log(`${signed}`)
            setSignature(signed)
            console.log(`Signature = ${signature}`)
         }
   })
}

Sign()
// some other code that uses signature variable

signed is printing a valid signature, but signature is not being set. This is a big problem. For the rest of my code to work I need to get the signed variable and set it to an external signature variable where I can pass it to other functions.
Any ideas?


texts:
How to determine the uniqueness of an internal transaction

Example is this transaction: https://rinkeby.etherscan.io/tx/0xc756517a69239bddffe3e0cb07eba98d3ad0fae1b44fc936a0119dbaf7008942#internal

they are exact identical of each other (including tx-hash, type, traceId), and I need a way to differentiate those transactions to know if I've already processed the transaction or not.

I'm using etherscan.io to detect internal transactions by iterating block by block. If I were to rebuild the database, I need a way to know if X transaction has already been recorded/processed/seen before or not.


texts: address.send (msg.value) returning false but ethers got transfered

texts:
This is function I am using to transfer ethers from user account to contract account.

function addEathersToContractAccount(address contractAddress)public payable returns(bool){
                changePaymentStatus(2);
                bool success= contractAddress.send(msg.value)
            if(success){
                changePaymentStatus(3);
                return true;
            }else{
                return false;
            }
    }

while testing it in REMIX I have found that this function always returns false but the ethers got transferred from user account to contract account.

Again I have tried it using ethereum testrpc but the result was same.

I have also tried

contractAddress.transfer(msg.value)

This is the output provided by remix

dose any one has any idea why this happens.


texts:
I am currently working with Ethereum Signatures (ECDSA and r, s ,v values) and I'm looking for official information about the recovery id v.

A few posts like this one explain how the calculation is done and I've already achieved to calculate this id. Now I wanted to find some official documentation on this, but unfortunately I couldn't find anything on how to calculate this. I know that it was taken over mostly from bitcoin but they have some more flags (compressed / uncompressed public key) which are not used on Ethereum.

Any help to find some source would be greatly appreciated!


texts: Ethereum Crowdsale Code in Parity not working

texts:
I followed the tutorial on How to do Crowdsales via ethereum.org using Parity. However, there is always an exception when I try to give Ether to the address of the crowdsale contract. any thoughts on this? Here is the code

pragma solidity ^0.4.2;
contract token { function transfer(address receiver, uint amount); }

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;
    event GoalReached(address beneficiary, uint amountRaised);
    event FundTransfer(address backer, uint amount, bool isContribution);
    bool crowdsaleClosed = false;

    /* data structure to hold information about campaign contributors */

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

    /* The function without name is the default function that is called whenever anyone sends funds to a contract */
    function (){
        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) _; }

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

    function safeWithdrawal() afterDeadline {
        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;
            }
        }
    }
}


texts: How can I use token functions of an ERC20 token bought in a crowdsale in Ethereum Wallet?

texts:
I am using Rinkeby in Ethereum Wallet and have created a crowdsale contract which created ERC20 tokens, assigned the crowdsale as the owner and then sold them to addresses which bought them using the buyToken function I coded into the crowdsale.

Now the accounts which purchased the tokens possess them and can transfer them to accounts via the "Transfer Ether and Tokens" button in Ethereum Wallet. But I don't know how to access any of the other functions (the ERC20 functions: totalSupply, balanceOf, allowance, approve, transferFrom).

I was able to do this for tokens where I just deployed the contract of the token by itself directly, but now using a crowdsale contract which creates the token contract and is assigned as the owner of the wallet, I don't know how token holders can access these functions in Ethereum wallet.

I appreciate any help in this. Thank you.


texts:
I want to parse event logs that are generated by the contract shown below, which assigns different sections of calldataload to the 4 Topics, and the Data section, of the event logs.

Topic 0 receives the FUNCTIONHASHES that are shown in Solidity, but I am not clear how the other 3 Topics, and the Data section, are assigned.

For example, the following function uses the note modifier, which emits the event log. Where in the event log will the values of 'what' and 'data' be placed, and what is placed in the Data section of the event log?

function file(bytes32 what, uint256 data) external note {
    require(live == 1, "Pot/not-live");
    require(now == rho, "Pot/rho-not-updated");
    if (what == "dsr") dsr = data;
    else revert("Pot/file-unrecognized-param");
}

This contract emits the event logs:

contract LibNote {
    event LogNote(
        bytes4   indexed  sig,
        address  indexed  usr,
        bytes32  indexed  arg1,
        bytes32  indexed  arg2,
        bytes             data
    ) anonymous;

    modifier note {
    _;
    assembly {
        // log an 'anonymous' event with a constant 6 words of calldata
        // and four indexed topics: selector, caller, arg1 and arg2
        let mark := msize                         // end of memory ensures zero
        mstore(0x40, add(mark, 288))              // update free memory pointer
        mstore(mark, 0x20)                        // bytes type data offset
        mstore(add(mark, 0x20), 224)              // bytes size (padded)
        calldatacopy(add(mark, 0x40), 0, 224)     // bytes payload
        log4(mark, 288,                           // calldata
             shl(224, shr(224, calldataload(0))), // msg.sig
             caller,                              // msg.sender
             calldataload(4),                     // arg1
             calldataload(36)                     // arg2
            )
       }
      }
    }


texts: Ethereum signature verification not matching

texts:
What I want to achieve is sign a message and then verify the signature whether verified by same address or not.

Contract to Invoke ecrecover method to verify the address

contract MyAuth {
    function verify( bytes32 hash, uint8 v, bytes32 r, bytes32 s)
        constant returns(address returnAddress) {
        returnAddress = ecrecover(hash, v, r, s);
    }
}

Java Script Code

var cMyAuthAddress="0x09343c5EBB988315E117E1Cd6EE501AF02412cFB"; // Contract address

var cMyAuthABI="<ABI data>"; // Contract ABI
var cDeployed=web3.eth.contract(JSON.parse(cMyAuthABI)).at(cMyAuthAddress);

var msg = web3.sha3('This my test data');

console.log('Message Hash: '+ msg); // Generated message hash
console.log("Account Used to Sign: "+ web3.eth.accounts[0]);
var state=web3.personal.unlockAccount(web3.eth.accounts[0], '<account password>', 1000); // Unlocking the account to perform the operation
console.log('Account State: '+ state);

var signature = web3.eth.sign(web3.eth.accounts[0], msg); // Signing the messge

console.log('Signature: '+ signature);

var r = signature.slice(0, 66)
var s = '0x' + signature.slice(66, 130)
var v = '0x' + signature.slice(130, 132)
v = web3.toDecimal(v);

console.log("V: "+ v);
console.log("R: "+ r);
console.log("S: "+ s);

if(v<27 || v>28){
    v+=27;
    console.log("Updated V: "+ v);
}

var finalAddress=cDeployed.verify.call(msg,v,r,s)

console.log("Final Address: "+ finalAddress);

Output

  Message Hash:
  0x1c6f4ab842fb95857783a0177eafb0133b3a626c89877a8bf4e2d07987aa1422
  Account Used to Sign: 0x890bd380e472df5b8bab22075c6a5d4f0b84415c
  Account State: true
  Signature:
  0xb8b01f46f147bd5e8f84343719ca7492164f80af5f60370c433e2e096ae52fec76d2bbe0e454b2a07e4100e8463d98286ec6e849cbcf6e24f66f7d579fc8654f1c
  V: 28
  R:
  0xb8b01f46f147bd5e8f84343719ca7492164f80af5f60370c433e2e096ae52fec
  S:
  0x76d2bbe0e454b2a07e4100e8463d98286ec6e849cbcf6e24f66f7d579fc8654f
  Decimal V: 28
  Final Address: 0x0609b9fae476d8b844716e3a0a6a3b5b7a5a2cdf

You can clearly see the final address listed is not matching the one used to sign it the message.

Note: I am trying this on my private blockchain.

  Question: Which step needs to be corrected to achieve the desired result (i.e. Final address should match to the Account address used to
  sign in this case which is
  0x890bd380e472df5b8bab22075c6a5d4f0b84415c)?

Tried using ethereumjs-util with the baove generated signature value but faced same result.

  var ethUtils = require('ethereumjs-util');
  let tSig = ethUtils.fromRpcSig(signature);
  let pubKey = ethUtils.ecrecover(
    ethUtils.sha3("This my test data"),
    tSig.v,
    tSig.r,
    tSig.s);
  let foundAddr = '0x' + ethUtils.pubToAddress(pubKey).toString('hex');
  console.log("Final Address 2: "+ finalAddress);

  Output is Final Address 2: 0x0609b9fae476d8b844716e3a0a6a3b5b7a5a2cdf" (i.e. the same address)


texts: In Solidity, trigger function and send ether at the same time

texts:
function triggerThisFunction(uint256 addValue) public override payable {
        imaGlobalVariable += msg.value;
        imAlsoaGlobal += addValue;
    }

Utilizing strictly solidity, how do I trigger this function and send it ether at the same time from another contract?
So far,
function letsGoTrigger() public {
       implement = constructorOfImplement(targetAddress);
        return implement.triggerThisFunction(1);
    }

But what comes after triggerThisFunction(1)?
Is it... .value()? I'm totally unaware of what to put here.


texts: geth vs parity - quantitative comparison

texts:
How do geth and parity Ethereum nodes compare in terms of:

Speed

How long does it take to sync with the main net, in both fast and full modes (if possible)

Disk space needs

What is the size of the chain data in fast and full modes

Robustness / Reliability

How many critical bugs / crashes were submitted in the last year

Security

How many security bugs were submitted in the last year

Number of users

How many Ethereum nodes are currently running on geth vs parity on the mainnet

Community

Number of maintainers / contributors / stars on Github

Features - what features are supported in geth but not in parity and visa versa, e.g.

Fast sync
Light client
JSON RPC methods (differences if any)
JavaScript API (differences if any)
Fee oracles
Archival mode


texts:
This is a similar question like the Statistics Conferences question at CrossValidated

What are the most significant annual Ethereum conferences?

Rules:

Include a link to the conference
Please include links for the talks (be it youtube, the conference site or some other video streaming site)


texts: Function calling constructor of another contract seems to silently fail

texts:
Ok so I am trying to initialize a new contract. From what I understand, creating this contract will only return a transaction hash. So I'm trying to access the new contract from data structures in the controlling contract. This is working in the solidity online compiler, but it wont seem to work within truffle.

 fundingContract.createProject(amount , deadline, title, description, {from: account}).then(function(projectAddress) {
setStatus("Project created");
console.log(projectAddress.valueOf());
}).then(function() {
fundHub.getProjectAddress.call(0).then(function(_projectAddress) {
  var newProject = Project.at(_projectAddress);
  console.log(newProject);

  newProject.getTitle.call().then(function(projectTitle) {
  console.log(projectTitle.valueOf());
});

Could the function createProject be silently failing?


texts:
I'm always getting this error:
UnimplementedFeatureError: Copying of type struct C.Friends memory[] memory to storage not yet supported.
I don't know what is wrong and how to fix it.
Can someone help me, please?
pragma solidity >=0.4.22 <0.7.0;
pragma experimental ABIEncoderV2;

contract C {

    struct Friends{
        string name;
    }

    struct Person{
        string name;
        Friends[] friends;
    }

    mapping(string => Person) persons;

    function map(string memory name)public{

        Person memory person;
        persons[name] = person;
    }

}


texts: getting error ParserError: Expected type name function

texts:
I am new in solidity and trying some small code however I am getting error which I could not find.

I am trying below code

pragma solidity >=0.4.0 <0.6.0;

contract property {

    uint public value;
    string public location;
    //address public owner
    constructor(uint  _value, string _location) public {
          value = _value;
          location = _location;
    }

    function setval(uint _value) public{
        value = _value;

    }

function getloc1() public pure returns(memory string) {,<--- getting error here
    return location;
  }
}

Error---

ParserError: Expected type name
function getloc1() public pure returns(memory string) {
                                       ^----^


texts:
how I can specify the account which will pay for gas
let say  0x1 is sending tokens to 0x2 but I want 0x3 (I have private key)  to pay for tx gas ?


texts: Unable to receive ether in testnet account

texts: I have set up a test net account using the ethereum wallet on my PC. I have left my miner on in the test environment for several hours and failed to mine test ether. I have also tried getting ether from https://zerogox.com/ethereum/wei_faucet but the it says it is unable to send me ether. The testnet blockchain seems to have synced fine. Can someone help please?


texts: Can transactions with only 1 gwei gas price still succeed (confirmed) in 2021?

texts:
https://ethgasstation.info (now https://archive.is/wip/Zemix) showing

Lowest gas price (gwei)
0
6

Does that mean it is still possible to have transactions with only 1 gwei gas price confirmed?


texts: Is there a Easy Mining Command CLI tool that could use my web host idle CPU to like wineth

texts:
I'm using wineth from https://wineth.net/ it's really easy: download, type your ETH address and it starts mining but it's only for windows with good GPU.
I saw this https://github.com/Genoil/cpp-ethereum but it seems only for GPU...
Is there an equivalent for linux in a command CLI with CPU ?
I ask, because I have 2 web servers with dedicated CPU (not GPU) (web hosting services like digital ocean, liquidweb, etc)
Most of the time, the CPU is at idle (like 0.06 or 0.1 load average)
Is there an easy way to use that extra CPU that does nothing and cost money...


texts: How to find input creation byte code for constructor argument?

texts:
I want to verify and publish my solidity source code on Etherscan.io. My smart contract has an argument in it's constructor for which I need to fill a field in the form that takes Constructor Arguments in ABI-encoded format.

How will I convert my argument into ABI-encoded format?


texts: What's the best way to transform bytes of a signature into v, r, s in solidity?

texts:
Given that solidity does not have any built-in string/bytes manipulation library, I was wondering what the best practice for extracting v, r, s from a signature inside solidity is.

One can encode sig as string v-r-s and use solidity-stringutils to extract them, but isn't there a better way to do this?


texts: How to deploy Library contract separate from the main contract and link it

texts:
For deployment I am using remix. When I deploy Hello.sol the compiler typically merges SafeMath.sol as a part of the main contract (Hello.sol) and deploys. This adds up library and main contract's deployment cost as whole. I want to do this operation separately in order to divide deployment cost in to multiple operations.

[Q] Is there any way to first deploy the library contract separately from the main contract and than link it to the main contract on remix? Should I use Truffle or follow different approach for this?

I have following simple contract, remix deploys Hello.sol as as single contract which also includes SafeMath.sol:

SafeMath.sol

pragma solidity ^0.5.0;

library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "addition overflow");

        return c;
    }
}

Hello.sol

pragma solidity ^0.5.0;

import "./SafeMath.sol";

contract Hello {
    using SafeMath for uint256;
    uint value;

    constructor() public
    {
        value = value.add(100);
    }
}


texts: Web3J: TypeError: MyContract is not a constructor

texts:
I am simply trying to call my contracts on a private blockchain from a nodeJS app after a call from the browser but I keep getting this error in my node:

2017-03-01T21:07:34.782560+00:00 app[web.1]: TypeError: MyContract is not a constructor
2017-03-01T21:07:34.782562+00:00 app[web.1]:     at /app/app.js:77:30
2017-03-01T21:07:34.782563+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-03-01T21:07:34.782563+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:131:13)
2017-03-01T21:07:34.782567+00:00 app[web.1]:     at module.exports (/app/node_modules/express-stormpath/lib/middleware/authentication-required.js:25:12)
2017-03-01T21:07:34.782567+00:00 app[web.1]:     at /app/node_modules/express-stormpath/lib/middleware/get-user.js:154:11
2017-03-01T21:07:34.782568+00:00 app[web.1]:     at /app/node_modules/express-stormpath/lib/helpers/expand-account.js:145:5
2017-03-01T21:07:34.782568+00:00 app[web.1]:     at /app/node_modules/async/dist/async.js:3694:9
2017-03-01T21:07:34.782569+00:00 app[web.1]:     at /app/node_modules/async/dist/async.js:359:16
2017-03-01T21:07:34.782569+00:00 app[web.1]:     at iteratorCallback (/app/node_modules/async/dist/async.js:935:13)
2017-03-01T21:07:34.782570+00:00 app[web.1]:     at /app/node_modules/async/dist/async.js:843:16

Here is how i call my contract, what am I doing wrong ?

app.post('/api/getOrganisationDetails', stormpath.authenticationRequired, function(req, res){
    var rawString = req.user.customData;
    var stringJson = JSON.stringify(rawString);
    var customData = JSON.parse(stringJson);
    var web3 = new Web3();

    web3.setProvider(new web3.providers.HttpProvider(customData.ethereum_provider));
    var coinbase = web3.eth.coinbase;
    var balance = web3.eth.getBalance(coinbase);

    var name = req.body.name;
    var ABI = [{"constant":false,"inputs":[],
            "name":"get",
            "outputs":[{"name":"","type":"int8"}],
            "type":"function"}];

    // creation of contract object
    var MyContract = web3.eth.contract(ABI);
    var myContractInstance = new MyContract('0x90eb73c0bb07b0a5428b3d3ac2a5b7461bdd038b');
    var result = myContractInstance.get(name);
    console.log(result);
    res.status(200);
    res.end("hello world");
});


texts: Is it bad security to use the same private keys and/or keyfiles across production, testnet, and dev?

texts: I'd like to understand the security implications of re-using keys across a privatenet, the public testnet, and the production network. If this is bad, why so? Are there advantages or disadvantages to doing such a thing?


texts:
I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and installed truffle@beta so that it can use v5.

The problem I have is that I am unable to compile my code with truffle. I get this error message:

  UnimplementedFeatureError: Encoding type "struct
  Contract.MyStruct memory" not yet implemented.

What could the problem be as the code does work properly with remix?

Edit: The line of code I typed that gets me to this error after I access my contract folder via the terminal is:

truffle compile

It doesn't give me a line number for where the error is from in my contract but I have functions that return a struct which with Solidity 0.5 need the memory keyword.


texts: Whisper Protocol: How to decode the received message on the receiver node?

texts:
My goal is to send a message from one ethereum node to another one. In order to accomplish it, I have followed this answer that uses Whisper Protocol.

In summary approach I followed from the linked answer above:

  On the receiver node:

> var kId = web3.shh.newKeyPair();
> web3.shh.newMessageFilter(
    {privateKeyID:kId},
    function(err, res) {console.log(JSON.stringify(res))});
> web3.shh.getPublicKey(kId) //returns PUBLIC_KEY_OF_THE_RECEIVER

  On the sender node:

web3.shh.post({
  pubKey: 'PUBLIC_KEY_OF_THE_RECEIVER',
  ttl: 7,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 2,
  payload: web3.fromAscii("Hello there!")
  });

But I obtain following message on my receiver node and I do not see Hello there! string.

{"hash":"0x0585a4c5c9d939fd8fd2861294c06185f6567530d05e3f10207c1317b1f59658",
     "padding":"0x448c2c6829f2b32010bd3d821fa11046d36bb24377c511ba8dfa1672d8b43b458bbbcd437dbb603b9034be01d6b735fee3658dd0d27a2cfcbc8ef10d27829cbd0b76274b2520a9c5036801fb6b30dde0a935fd40bfa293c150405eceb5aa158729452f9f7dca28670752b34bfd6b8fe2a18bf151f0c54273145f4c334294ba0bb56f9c48495d641ee69ae3d5dc8b269de660d60362aacd700d9f11b050ccc392f9b95c3f8c56b8e9efbdfde48092f8e363fe0e486f1dac1beb263d1cb8f913c5ae8339201a9fd0605fd490890817250920d4da82884f2aa44160fb539ea44a8dd6f8af25969a66d414a7c555d4e3703510e1",
     "payload":"0x48656c6c6f20746865726521",
     "pow":96.02344322344322,
     "recipientPublicKey":"0x04f0d4a00e0935e7b79866e2efd184a2552fadf713dc13507720399cb99a842a6fdef02055f01ae5253fc5b2a0eea9e8acad1092d9384ba57755af07949b4007fa",
     "timestamp":1529434469,
     "topic":"0x07678231",
     "ttl":7
    }

I guess payload contains the sent string. "payload":"0x48656c6c6f20746865726521".

[Q] Is there any way to decode this message to obtain the original sent message?


texts: Convert natspec into human readable document

texts:
How do I convert Natspec into something that a human can easily read?

Eg: HTML, Markdown, .PDF


texts: How to get tokens for crowdsale from the main token contract

texts:
Trying to deal with Ethereum contracts using OpenZeppelin examples and Remix.
There is a token contract deployed in the test network:

pragma solidity ^0.5.0;

import "./ERC20.sol";
import "./ERC20Detailed.sol";
import "./Ownable.sol";

contract TestToken is Ownable, ERC20, ERC20Detailed {
  /**
   * @dev Constructor that gives _msgSender() all of existing tokens.
   */
  constructor () public ERC20Detailed("TestToken", "TST", 18) {
    _mint(_msgSender(), 100000 * (10 ** uint256(decimals())));
  }
}

I don’t understand how to make crowdsale contract take TestToken tokens:

pragma solidity ^0.5.0;

import "./Crowdsale.sol";

contract MyCrowdsale is Crowdsale {
  constructor (
    uint256 rate,
    address payable wallet,
    IERC20 token
  )
  public
  Crowdsale(1000000000, wallet, token)
  {
  }
}

if I substitute the address of the contract instead of token, for example Crowdsale (1000000000, wallet, 0x7D01c89107B0d682D06cbC635C320EE531146E6A), I get an error.

I will be grateful for an example.


texts: Does go-ethereum/whisper provides any kind of Public Key Server to obtain other nodes' public key

texts:
For example GnuPG has a Public Key Server, where users able to obtain other users public-keys by using a key ID.
https://security.stackexchange.com/a/110146/179928:

OpenPGP User IDs
User IDs in OpenPGP are used to connect keys to entities like names
and e-mail addresses. These are used to search for keys on key
servers, and matching them to users/e-mail addresses.

node_a> gpg --keyserver hkp://keyserver.ubuntu.com    --send-keys EFA2F330
node_b> gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EFA2F330

=> Does go-ethereum provides this approach for Whisper where key-ids might be the user's Ethereum address in order to obtain other geth nodes' public key for Whisper?
Here:

targetPeer (optional): Peer ID (for peer-to-peer message only).

Than is actual from this comment:

It is indeed be the enode of your target peer. See https://github.com/ethereum/go-ethereum/blob/master/whisper/whisperv6/api.go#L294.

Overall, if I use enode as alternative to public-key, which is much larger string than the public key itself.


texts:
i have created this contract

https://etherscan.io/address/0xfecf0e91a193e8511ac83d8effda34ae4278f491#code

but the problem is when i try to contribute to crowdsale it showing an error, (Error encountered during contract execution [Reverted] )

btw i have put my 2 addresses as whitelist addresses, i can contribute to crowdsale only with these two addresses when i try with other addresses always it failed.

https://etherscan.io/tx/0xc54f702c784785174d7dcba4d643c05f87e43d945adb6cc3290e124cf05f3716

im thinking the issue is in here (function investInternal):

 if(!earlyParticipantWhitelist[receiver].status) {
      throw;
 }

Receiver (the caller of the buy method), is not on the earlyParticipantWhitelist.

please help me if someone knows the what is the error, how to change this and how to change the contact.


texts: It seems like a simple question with a strait forward answer, but I can't seem to find any on Google. Basically, as I understand, Optimism allows for complex smart contracts to be deployed to  L2 optimism layer. So, let's say I wanted to use Chainlink VRF in my smart contract. Will I be able to do that on optimism?


texts: Create Go-Ethereum private chain, which allows to mine on phone

texts:
Hypothetically, creating a private chain on Geth, where I would make sure in the Genesis that mining is easy enough to mine with phone (not thinking as a full time thing, but let's say, you could potentially mine your own transaction within reasonable time).
What kind of implications in terms of security would this have if the network is scaled up to thousands of nodes? (easier 51% attack I assume).
Alternatively, would making the chain PoS better, assuming coin is worth something and enough nodes on network?


texts: Deploying contracts on geth returns Error: connect ECONNREFUSED 127.0.0.1:8545

texts:
I'm using truffle (which uses pudding) to deploy contracts to my testrpc.

No I'm running a geth instance locally with:

  geth --mine -rpccorsdomain "*" --ipcapi "admin,eth,miner" --rpcapi
  "eth,web3" --networkid 1100 --maxpeers 5 --minerthreads 1 --unlock "0xXXXXXXXXetc.." console

Now when I try to deploy my contracts, I get:

Invalid JSON RPC response: "Error: connect ECONNREFUSED 127.0.0.1:8545 at..."

What am I missing here? How does truffle/pudding identify itself to the node, when it deploys? (i.e. truffle deploy) I can't see anything to configure this.


texts: What are Ethereum transaction receipts and what are they used for?

texts: I've seen mention in a few places that blocks store transaction receipts, but I haven't really seen an explanation of what they are and why they exist.


texts: Error : - browser/Mycontract.sol:29:13: Error: Undeclared identifier. assert(value % 10 == 0) ; ^----^

texts:
pragma solidity ^0.4.7 ;

contract MyContract
{
    string sentence = "my first sentence" ;
    address owner ;
    function MyContract()
    {
        owner = msg.sender ;

    }
    function getSentence() public constant returns(string)     {
        return sentence ;
    }
        function setSentence(string newsentence) public returns (string)
        {
            if(owner!= msg.sender)
            {
                return "don't dare to change the contract" ;
            }
            sentence = newsentence ;
            return sentence ;

        }
        uint balance=100 ;
        uint value ;
        function Transact(uint value) public returns(uint)
        {
            assert(value % 10 == 0) ;
            require(value<= balance) ;
            balance = balance - value ;
            return balance ;
        }

}


texts: Contract deployment - Error URI Too Long

texts:
I was trying to deploy a smart contract using the remix IDE. Everything was working fine and suddenly I started getting this error. Spent a couple hours solving it. No luck! Is this an issue with the Metamask or Remix IDE? The code has been working fine on the network for a couple of weeks (no change made).

EDIT: The error has vanished and normal behavior has resumed.


texts: Identify all events occurred in a single transaction

texts:
Is it possible to identify all the events occurred within a single transaction?
I just want to group events by transaction, but looks like it is not possible. e.g. all the events have different transaction_hash, log_index etc.
I'm using the python bindings.


texts: Getting undefined for the length of the dynamic array

texts:
I'm getting undefined for the length of multiSig dynimic array, or votes in testing, no matter how many items are pushed into the array.

FlightSuretyData.sol

   address[] multiSig = new address[](0);
   function getMultiSigLength() public view returns (uint256) {
        return multiSig.length;
    }

FlightSuretyApp.sol

    function testGettingMultiSigLength() public view returns (uint256) {
        return flightSuretyData.getMultiSigLength();
    }

test/flightSurety.js

  it("test getting the length from getMultiSigLength()", async () => {
    // ARRANGE
    let votes;
    // ACT
    try {
      votes = await config.flightSuretyApp.testGettingMultiSigLength();
    } catch (e) {
      console.log("votes error", e);
    }
    console.log(votes);
  });

When I log the e.message I get the following:

  hijackedStack: 'Error: Returned error: VM Exception while processing
  transaction: revert\n'

When I bring the array and the function to be combined within the same

contract FlightSuretyApp.sol

   address[] multiSig = new address[](0);
   function getMultiSigLength() public view returns (uint256) {
        return multiSig.length;
    }
    function testGettingMultiSigLength() public view returns (uint256) {
        return getMultiSigLength();
    }

it works fine which means something about reaching over to another contract that's causing the issue. I've had to import the the contract through import "./FlightSuretyData.sol";

testConfig.js

var FlightSuretyApp = artifacts.require("FlightSuretyApp");
var FlightSuretyData = artifacts.require("FlightSuretyData");
var BigNumber = require("bignumber.js");

var Config = async function (accounts) {
  let owner = accounts[0];
  let firstAirline = accounts[1];

  let flightSuretyData = await FlightSuretyData.new();
  let flightSuretyApp = await FlightSuretyApp.new();

  return {
    owner: owner,
    firstAirline: firstAirline,
    weiMultiple: new BigNumber(10).pow(18),
    testAddresses: testAddresses,
    flightSuretyData: flightSuretyData,
    flightSuretyApp: flightSuretyApp,
  };
};

module.exports = {
  Config: Config,
};

And this is how I authorized FlightSuretyApp to FlightSuretyData

  before("setup contract", async () => {
    config = await Test.Config(accounts);
    await config.flightSuretyData.authorizeCaller(
      config.flightSuretyApp.address
    );
  });


texts: Best way to lock tokens for investors vesting period

texts:
What would be the most convenient way for our team to lock tokens for a vesting period for a relatively large number of wallets? (30+)
We've considered team.finance as well as writing our own contract and UI.
Is there a 3rd option we are missing?
Thanks!


texts: sendRawTransaction not appearing / being submitted to the network

texts:
I'm new to Javascript, so bear with me. I've successfully gotten web3.js working in a HTML file, with getBalances working as it should. (I don't want to use Node.js for now)

However now I'm stuck at sending a raw transaction. The console tells me that a transaction hash is created, but when I search on Etherscan the transaction does not appear. Also no ETH is transferred between the 'from' and the 'to' address.

My code in the HTML file:

      const gasLimitInHex = web3.toHex(30000)

      const valueInWei = web3.toWei('0.05', 'ether')
      const valueWeiInHex = web3.toHex(valueInWei)

      const rawTx = {
        gasLimit: gasLimitInHex,
        to: receiveEthAddress,
        value: valueWeiInHex
      }

      const tx = new EthJS.Tx(rawTx)
      tx.sign(privateKey)

      var serializedTx = tx.serialize()

      console.log(serializedTx.toString('hex'))

      web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
        if (!err) {
          console.log(hash)
        } else {
          console.log(err)
        }
      })

The serialized tx: f866808082753094e1677d96bb82668bb188ec71498db5c0c0c4830e87b1a2bc2ec50000801ba0754d70a1dcbca6a7486fafeed8e63c8738b401af562697c2d97c990c4ac3d543a02a0664aeaa900c4d1d8ad94c3c69b76bcaa5f5c3e8307c4d63c86d60b70f4d7b

The transaction hash that web3.js returns: 0x9b89dad10e235d9bbd4b48f6a9768b557861281645b6d0702115e4a7141b0f41

FYI I'm using the myetherwallet API (https://api.myetherapi.com/eth)


texts: Prevent Transfer of ERC20 token to contract address?

texts:
I want my ERC20 contract to be transferred to EOA addresses only and some specific contract address only.
I don't want to lose my tokens by mistakenly transferring to a contract address that cannot handle ERC20 tokens.
How can I prevent my ERC20 contract to prevent the transfer of tokens to contract addresses?


texts: Retrieving tx.origin and msg.sender from blockchain data

texts:
In Solidity, origin and sender can be easily differentiated through tx.origin and msg.sender, respectively.

Is it also possible to obtain both sender and origin of a specific transaction from the data in blockchain itself? The from field obtained with getTransaction and getTransactionReceipt seems to always be tx.origin.

Specifically, I would like to do so with the JS API. I suspect that somehow processing the information in the transaction logs in the transaction's receipt is probably one way to go, but haven't figured out how yet (although I would expect some simpler way, too).


texts:
I have a hard time creating a uint16[] array in an elegant way.

I try this:

function init() public {
uint16[] memory x = [uint16(1), uint16(1)];
test(x)
}

This raises TypeError: Type uint16[2] memory is not implicitly convertible to expected type uint16[]

I want to use this initialized array in a

function test(uint16[] input){}

function

I can of course create a uint16[] array and the push values in it, but this is not an elegant way of initializing it. How do I correctly initialize these values?


texts: Parity Aura - Error: Transaction has been reverted by the EVM

texts:
I run the following code against two private blockchains, parity-aura and geth-clique. Why does the parity transaction revert and why does it use 6,000,000gas when it should actually only use about 44709gas?

JS Code

contract = new web3.eth.Contract(KVStoreABI);
contract.options.address = contractAddress;
tx = contract.methods.set("hello", "world");
tx.send({ "from": fromAddress })
        .once('transactionHash', function (hash) {
            console.log("TX RECEIVED:", hash)
        })
        .once('receipt', function (receipt) {
            console.log("RECEIPT:\n", receipt)
        })
        .on('error', function (error) {
            console.log("ERROR\n:", error)
        })
        .then(function (receipt) {
            console.log("TX MINED:", receipt.transactionHash)
        });

kvstore.sol

pragma solidity ^0.5.7;

contract KVstore {

  mapping(string=>string) public store;

  function get(string memory key) public view returns(string memory) {
    return store[key];
  }
  function set(string memory key, string memory value) public {
    store[key] = value;
  }
}

Parity-Aura

Contract at: 0xd653D36C16c01dC6c0802B571Bb4B129A2Cb2CD7
Sending  1txs...

TX RECEIVED: 0x0d5e8b19a8706bf2f1e1c46e35081353e140d5a0b608c0b65aae6225cd41a8b3
(node:29273) UnhandledPromiseRejectionWarning: Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0xa1ef20cfdb0790d3fa00420cd892e7cfd59e013c45cd794d0766f8f076e54ff6",
  "blockNumber": 20,
  "contractAddress": null,
  "cumulativeGasUsed": 6000000,
  "from": "0x933e73c3f959759c169effa4019c8faf7d05ce33",
  "gasUsed": 6000000,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "root": null,
  "status": false,
  "to": "0xd653d36c16c01dc6c0802b571bb4b129a2cb2cd7",
  "transactionHash": "0x0d5e8b19a8706bf2f1e1c46e35081353e140d5a0b608c0b65aae6225cd41a8b3",
  "transactionIndex": 0,
  "events": {}
}
at /home/ubuntu/node_modules/web3-core-method/src/index.js:412:37
at processTicksAndRejections (internal/process/task_queues.js:93:5)

Geth-Clique

Contract at: 0x4032E20ea7bb7F1F9dA448D661B3B27EcbCa9DFd
Sending  1txs...

TX RECEIVED: 0x0d7766a5eab1fa3220c9401dc74444360653932fa467941b3e38e033aca132ad
RECEIPT:
 {
  blockHash: '0x177e9d9c12bdfc8cfa895e7bc545e801baca1310e2637637d9dd3afd8a31e063',
  blockNumber: 326,
  contractAddress: null,
  cumulativeGasUsed: 44709,
  from: '0x933e73c3f959759c169effa4019c8faf7d05ce33',
  gasUsed: 44709,
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  status: true,
  to: '0x4032e20ea7bb7f1f9da448d661b3b27ecbca9dfd',
  transactionHash: '0x0d7766a5eab1fa3220c9401dc74444360653932fa467941b3e38e033aca132ad',
  transactionIndex: 0,
  events: {}
}
TX MINED: 0x0d7766a5eab1fa3220c9401dc74444360653932fa467941b3e38e033aca132ad


texts: How to create trueUSD token to my eth address

texts:
I am newbee about smart contract and eth tokens. I have created an eth account by:

let account = web3Client.eth.accounts.create()

I have my account details. I need to add some true usd token to eth address. How to mind token to eth address programatically? Can anyone help?


texts: Solidity: How to add data to a dynamic array

texts:
I am trying to create a list of bytes data on a dynamic array. Here is a very simple contract for an example of what I want to do. I want to be able to call the array to get a list, but it only returns the first bytes32 input I insert using the function.

pragma solidity ^0.4.24;

contract MyContract {

     /* Bytes32 Array */
     bytes32[] public MyBytesArray;

     function addItem(bytes32 _item) public {
          MyBytesArray.push(_item) -1;
     }
}

Also is there a way to remove items from the array in another function?


texts: Locked ERC20 paid out as tx-fees to DAO holders

texts:
I'm creating a contract where people transact by using locked ERC20 tokens.

For example - you'd have 500 of token A locked in the DAO contract.

You decide to send 100 of token A to some other account. The transaction fee was set to 2% of the transaction value. So 98 tokens went to the account you sent them to and 2 tokens need to be paid out to DAO holders in proportion to their holding.

Since I'm not allowed to iterate over accounts because of the gas limit - is there any way I can achieve this?


texts: Does revert() send received ether back to sender?

texts:
When revert() undoes all state changes, does that include sending any received ether back to the sender?
For example, would both sendBackOne() and sendBackTwo() send ether back to the sender?
function sendBackOne() public payable {
    msg.sender.transfer(msg.value);
}

function sendBackTwo() public payable {
    revert();
}


texts: What is the best parity configuration to run a full archive node on raspberry pi?

texts:
I am using a raspberry pi to download the archived version of the blockchain with parity. I've started parity with

parity -d /home/xxx/data/Ethereum --pruning archive --public-node

However, the synchronisation is running at 0-5 blocks per second. At this rate, it won't finish for 1-2 years.

Is there a setting that I can use to speed this up. For example, if I reduced the --max-peers to 10 would it speed up the synchronisation? Or is this an unachievable feat for a Pi?


texts: Can a smart contract be set up so that a function to forward funds sends a set percentage of the Ether received to 2 or more contracts?

texts: For example the the openzeppelin crowdsale contract has a function that sends ether to a wallet address. Could this method include logic to send 60% of the funds received to Alice's wallet and 40% to Bob's wallet?


texts: How to configure the sealer account for a private Clique PoA network in Pantheon

texts:
Pantheon is the new Java-based Ethereum node targeting the enterprise setups.

I am trying to get my geth clique private network running on pantheon, but since pantheon has no account management, I am wondering how to setup the sealer account required for "mining" the blocks in Clique-PoA.


texts:
I am trying to deploy my ico contract to ropsten for testing and its failing as I said in my earlier question. I thought there was something with my code so I tried deploying a contract that I downloaded from github.

I did not modify anything in the contracts except changing the compiler version.

Then tried deploing and as it truffle reached the point where it tried to deploy the crowdsale contract it failed:

Deploying STQCrowdsale...
  ... 0x222d841b9e9628d1b80329491037074ff2105ba27e8f09decfa2a726ece3adb6
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
    at Object.callback (C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\contract.js:147:1)
    at C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\method.js:142:1
    at C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:89:1
    at C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-migrate\index.js:225:1
    at C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
    at IncomingMessage.<anonymous> (C:\Users\Zaid\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1059:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

This is the transaction:

https://ropsten.etherscan.io/tx/0x222d841b9e9628d1b80329491037074ff2105ba27e8f09decfa2a726ece3adb6

Can someone explain whats happening? Why even an pre-deployed and fully tested ICO contract is not getting deployed?


texts: I load Mist, it connects to nodes, then when I "Launch App" it just closes

texts:
If I let it sync instead of launching, it just closes when it's done syncing. I did not see an answer to this problem in the only prior thread I could find.

Thank you


texts:
Let's say I have the following..

contract D {

    function again(uint256[3] memory bla) external  returns(uint) {
        return bla[0];
    }
}

contract A {

    function test(D f, uint256[3] memory haha) external  returns (uint) {
        return f.again(haha);
    }

}

We call test. The very first thing that happens is haha gets copied into memory from calldata. Now, before calling f.again(haha), it gets copied into memory again. Why is this step necessary ? haha was already in memory, so why copy it again ? Also, the again function receives data in calldata and uses completelly new memory.


texts: how to get sealers in Proof of authority network through solidity contract, like inside a contract ?


texts: Newly mined 'blocks are not synchronized' and imported automatically by it's peer [Error: "Discarded bad propagated block"]. How to rectify?

texts:
Step 1:
I'm running "Local Private Ethereum Network". And have two local nodes.
Node2 is attached to Node1.
I started mining in Node1 and it was successful.

INFO [01-11|18:37:01] Successfully sealed new block            number=1 hash=176552…694cb6
INFO [01-11|18:37:01]  mined potential block                  number=1 hash=176552…694cb6

But, node2 gives the error below:

WARN [01-11|18:37:01] Discarded bad propagated block           number=1 hash=176552…694cb6

Since node1 successfully created a NEW BLOCK, I expect node2 'to accept' it.

But, node2 gives error like above.

Step 2:
Restarted node2, and re-attached the node2 to node1.
Now the previously mined-but-discarded-block was 'imported successfully'.

Step 3:
Initiated mining on node2. node2 successfully mined a block. But, this time, the newly mined block was discarded by node1. Restarted node1. Re-attached node2 to node1. Previously mined-but-discarded-block was imported successfully. So, there is a pattern that 'the newly mined blocks are not imported immediately. But, are imported only after the restart of the peer node - which discarded it'.

How to make the peer nodes synchronize automatically and import the newly mined blocks on the fly?


texts: Validating cross-shard transaction using Beacon chain snapshots?

texts:
According to this article: (Link to article), there are two types of validation for cross-shard transactions: Synchronous and Asynchronous.

But the question is that why cannot we use Beacon chain snapshots (as a single common chain between all the shards) to validate such transactions "locally" and without need of communication with other shards for each cross-shard transaction, where Beacon chains include all the snapshots of all the shards.

For example, assuming a transaction is performed between shard#1 and shard#2, such that the credit part is in the shard#1 and the debit part is in the shard#2. Then, if both shards have a Beacon chain (including the snapshot of both shards), this transaction can be validated in each shard locally using the Beacon chain snapshots and without communicating with other shard.

Is there something that I do not consider?


texts: Are constant state variables cached in the EVM?

texts:
From the docs:

  constant for state variables: Disallows assignment (except
  initialisation), does not occupy storage slot.

Does this mean that the EVM caches constants across all contracts using some sort of DHT or sparse Merkle tree?


texts: Error "invalid sender" received randomly when broadcasting a hand signed raw transaction

texts:
I'm working on a mobile wallet app, where I sign a raw transaction and try to broadcast it through https://etherscan.io/pushTx.

The problem is that it sometimes gives me the error "insufficient funds for gas * price + value" as expected(because there are zero ETHs in my account). But sometimes it fails with error "invalid sender".

The following are two transactions signed with identical data(nonce, gas price, value, gas limit, the recipient address, the private key and etc.,) . One is working but the other is failing:

  insufficient funds for gas * price + value:
  f86a80843b9aca0082ea6094380070128936d804f669f588acc54762deb1d8ed872386f26fc100008026a002ea646e10ec345e5412104b5f761b28cfd079a46a8e56aadf70798c1c0d6524a0253968a49677d70948546b68f6ba33ddab85ed37e82a59c86259ee13aa79f207

  invalid sender:
  f86a80843b9aca0082ea6094380070128936d804f669f588acc54762deb1d8ed872386f26fc100008025a00db144bb2b0fb247c0aa31d6a8d7dc73f834c3c3ba32e1cb53180cb900d23ce1a08d2b86e0adb07455e657409a0d676f6ed7cb90b369be3ce5762726cc30c6ea41

I tried decoding the transactions above using ehters-js with the following code and both produced valid from address and chain ID:

function decodeMyTx() {
  var serializedTx = document.getElementById("inputarea").value.trim();
  if (!serializedTx.startsWith('0x')) {
    serializedTx = '0x' + serializedTx;
  }
  try {
    var tx = ethers.utils.parseTransaction(serializedTx);
    var rawTx = {
      nonce: tx.nonce,
      gasPrice: tx.gasPrice.toHexString() + ' -> ' + tx.gasPrice.toString(),
      gasLimit: tx.gasLimit.toHexString() + ' -> ' + tx.gasLimit.toString(),
      from: tx.from,
      to: tx.to,
      value: tx.value.toHexString() + ' -> ' + tx.value.toString(),
      data: tx.data,
      chain: tx.chainId,
      v: tx.v,
      r: tx.r,
      s: tx.s
    };
    document.getElementById("outputarea").value = JSON.stringify(rawTx, null, "  ");
  } catch (error) {
    document.getElementById("outputarea").value = error.message;
  }
}

Could anyone shed some light on this? It's driving me nuts.


texts: When will signers be broadcast on a PoA network?

texts:
I have sort of working PoA but it seems unpredictable.

  clique.getSigners()
  ["0x10799bda8ec85f99e50861571ee8884689ebfbb8", "0x16cfa8b0b01e2bbb0ebfdc49a9438a5c1368dcb6", "0x242f75170b0b38917995724bd5aef1aa07d31fff", "0x5ab4bf732559119d73abbb7dfee295746adf1edc", "0x9440c75f6f7c32ee633a206ace282ce9bd58c822", "0x9a3c01f1ab50e16b3ac083c9f6826429fd1f2c75", "0xc7c776a8b564228ecca00c86d1d80b431aa9f4f3", "0xe578e38bca4f0d1bf4e90be7da9a1bd58277c5b7", "0xf39995b718ae7a0075557f9781425b92fd8b28a6"]
  clique.proposals
  {
    0x5ab4bf732559119d73abbb7dfee295746adf1edc: true
  }

I get the account ending 'edc' as a proposal and also the actual node for it (remote) does not get any voting rights.

Why does the account 0x5ab4bf732559119d73abbb7dfee295746adf1edc appear in the proposal list and also the GetSigners list?


texts: Geth Fast Sync imports blocks that have already been synced

texts:
I keep having this problem where geth fast syncs normally importing headers and receipts (not blocks) up until a certain point at which it starts importing blocks that I had already synced a long time ago.

An example of the output is as follows (the most recent time this happened):

I0524 14:22:07.798880 core/headerchain.go:294] imported 192 header(s) (0 ignored) in 2.469281116s. #660378 [2073f529… / 3a505033…]
I0524 14:22:08.209943 core/blockchain.go:751] imported 6 receipt(s) (0 ignored) in 21.040595ms. #660192 [2073f529… / 454b2b4f…]
I0524 14:22:16.408611 eth/downloader/downloader.go:1130] Rolled back 2048 headers (LH: 660378->658330, FB: 660192->658330, LB: 0->0)
I0524 14:22:17.484047 core/blockchain.go:751] imported 103 receipt(s) (0 ignored) in 512.848247ms. #660295 [07662877… / 02d566a8…]
I0524 14:22:17.922178 core/blockchain.go:751] imported 83 receipt(s) (0 ignored) in 372.939255ms. #660378 [779d2a58… / 3a505033…]
I0524 14:22:34.658717 core/headerchain.go:294] imported 0 header(s) (192 ignored) in 68.916111ms. #192 [88e96d45… / 723899e8…]
I0524 14:23:09.703319 core/blockchain.go:959] imported 2 block(s) (0 queued 0 ignored) including 0 txs in 34.853133777s. #2 [88e96d45 / b495a1d7]
I0524 14:23:09.793493 core/headerchain.go:294] imported 0 header(s) (192 ignored) in 84.786686ms. #384 [967642fd… / d3d5d5c1…]
I0524 14:23:14.549250 core/blockchain.go:959] imported 190 block(s) (0 queued 0 ignored) including 0 txs in 4.74805811s. #192 [3d612266 / 723899e8]
I0524 14:23:14.599539 core/headerchain.go:294] imported 0 header(s) (192 ignored) in 44.800954ms. #576 [bbb506ab… / 41a7466b…]
I0524 14:23:19.567974 core/blockchain.go:959] imported 192 block(s) (0 queued 0 ignored) including 0 txs in 4.949800668s. #384 [967642fd / d3d5d5c1]
I0524 14:23:19.665313 core/headerchain.go:294] imported 0 header(s) (192 ignored) in 78.182567ms. #768 [c4cee3bf… / 5cfe57c2…]

It goes on (somewhat later) to sync only the blocks.

This has been really frustrating in trying to catch up (in this latest instance it went from block #660378 to #192; other times have been comparable to this and sometimes it has happened when I was even further along), and I could really use any help on how to go about fixing this.

Feel free to ask me any questions that might help you diagnose and hopefully fix this issue.


texts: With TRUFFLE: Call public function of contract from within another contract

texts:
Similar to How do you call a function of a deployed contract from another contract? (first answer), but because Truffle has access to the ABI's of compiled contracts thought I could avoid low-level call

Want to call a public function timeProtectTokens on token variable representing ERC20 contract within Escrow contract.
Intuitively I thought to do:

 let token = await ERC20.new()
 let escrow = await Escrow.new(token.address)
 let result = await escrow.token.timeProtectTokens(initialAccount, 5)

..but fails

contract ERC20 is Protected {
}

import "./ERC20.sol";

contract Escrow {
  ERC20 public token;
  constructor(ERC20 _token) public {
    token = _token;
  }
}

contract Protected {
  mapping (address => uint256) public protectedTokens;

  function timeProtectTokens(address _address, uint256 _amount) public **onlyEscrow** {
    protectedTokens[_address] = protectedTokens[_address].add(_amount);
  }
}


texts: geth/parity PoA consensus algorithms - did someone try to measure the performance?

texts:
PoA consensus algorithms are an acceptable choice in public/private permissioned networks.

[Q]: Did someone try to setup a benchmark for measuring the performance of existing PoA implementations in parity and geth?

Possible parameters for the measurements could be:

block gas limits
block times
authority (sealer) node count
transaction sizes
...


texts:
E.g: If I have a uint value of 2000, how do I make it so that I can get the value of 20? (Removing the 00 at the end).

Test cases:

1234 -> 12
1000 -> 10
500  -> 5
7610 -> 76


texts:
Hello Ethereum Guru's,

I am trying to replicate the first example outlined in 'Ethereum in practice part 1' (https://www.ethereum.org/token) using Ethereum Wallet on my Macbook.

I had 1.0 of Ether in the Main account (Etherbase) prior to starting.

Here's what I did:

*Contracts > Deploy New Contract >

*Copied and pasted the code from example.

*Used the Parameters:  MyToken, 10000, MySuperToken, %, 2

*Did not adjust the 'Select Fee' slider at the bottom of the page...just hit the 'Deploy Button'.

*After hitting Deploy it created a contract but gave me the following error:
 'No data is deployed on the contract address!'.

*Some place I read that I needed to send it more gas.  So I sent the 'new contract' some gas from my Main Etherbase account.

Here's what I'm seeing:

*In the blog 'https://blog.ethereum.org/2015/12/03/how-to-build-your-own-cryptocurrency/' it states that after creating the smart contract the following should occur:

"Click the account named “Etherbase” (your main account) and after no more than a minute you should see that your account will show that you have 100% of the shares you just created."

This is not the case for me.  I do not see anything other than:
(1) 'Latest Transactions' shows that the contract was created and that an additional amount of gas was sent from my Etherbase account.
(2) Main Etherbase account has been depleted by the amount of gas used for the above actions.

Where did my 10,000 tokens of "MySuperToken" go to?  What step did I mess up on?  Are there screenshots somewhere of how to create a custom token using this GUI?

Thanks for your help in advance!

~Boss429


texts: Can I dynamically create storage structs?

texts:
I want a function that creates document in my contract. I removed anything unnecessary. Goes like this:

contract MyContract{
  mapping (uint => document) documents;

  struct document{
      address author;
      bytes32 hashedContent;
  }

  function addDocument(bytes32 docHash) public{
      document newDoc = document (msg.sender,docHash); //*
      [...]
  }
}

Documents are structs, and I want to create them from a function and then permanently add the to a mapping. I have an error at the //* line saying:

MyContract.document memory is not implicitly convertible to expected type struct MyContract.document storage pointer.
        document newDoc = document (docHash,msg.sender);
        ^---------------------------------------------^

(from Remix)
The left part is storage but I think the left part is memory.

Is it possible to do what I'm trying to do?

If so, what did I do wrong?
If not, do you know a workaround? (Someone suggested that I do a separate contract for every document but it would complicate everything A LOT considering the rest of my contract and preferably I'm looking for a solution in a single contract.


texts: Conflicting solc versions on Truffle-test

texts:
I'm developing some smart contracts sing solc 0.7.0. I'm able to successfully compile and deploy the contracts, but when I try to run $truffle test I get the following error:
Using network 'development'.

Compiling your contracts...
===========================
> Compiling ./test/TestSupperApp.sol

truffle/Assert.sol:5:1: ParserError: Source file requires different compiler version (current compiler is 0.7.0+commit.9e61f92b.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
pragma solidity >= 0.4.15 < 0.7.0;
^--------------------------------^
,truffle/DeployedAddresses.sol:2:1: ParserError: Source file requires different compiler version (current compiler is 0.7.0+commit.9e61f92b.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
pragma solidity >= 0.7.0 < 0.7.0;
^-------------------------------^

Error: Truffle is currently using solc 0.7.0, but one or more of your contracts specify "pragma solidity >= 0.4.15 < 0.7.0".
Please update your truffle config or pragma statement(s).
(See https://truffleframework.com/docs/truffle/reference/configuration#compiler-configuration for information on
configuring Truffle to use a specific solc compiler version.)

Compilation failed. See above.
Truffle v5.1.41 (core: 5.1.41)
Node v11.14.0

That's the beginning of the testing code:
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/SuperApp.sol";

contract TestSuperApp
{

And the compiler configuration of my truffle-config looks like this:
  // Configure your compilers
  compilers: {
    solc: {
      version: "0.7.0",    // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
      // settings: {          // See the solidity docs for advice about optimization and evmVersion
      //  optimizer: {
      //    enabled: false,
      //    runs: 200
      //  },
      //  evmVersion: "byzantium"
      // }
    },
  },

How is it that DeployedAddresses.sol requires the compiler to use >=0.7.0 AND <0.7.0? And how can I fix it?
(OBS.: Obviously I should change the pragma statement, but since DeployedAddresses.sol is dynamically created at test time, it does not seems possible to directly change it)


texts: How to add a node on different system as a peer in your private blockchain network?

texts:
I have created 2 nodes on different systems. I created accounts and was able to transfer ethers across accounts in the same node. Now i want to connect the 2 nodes on different system. I have used following commands for the nodes:

Node 1:

geth --networkid 100 --identity node1 --verbosity 3 --nodiscover --nat none --datadir "C:\Rahul\blockchain\node1"

Node 2:

geth --networkid 100 --identity node2 --port 30802 --rpcport 8902 --verbosity 3 --nodiscover --nat none --datadir "C:\Rahul\blockchain\node2"

Now i want to add node2 as a peer to node1. So i used "admin.addPeer(enode Address)".

admin.addPeer("enode://675908f0bbdcf8d19110dd84e0bfacbf60acd7c506c126213eedc71f315a95cdeb9a8f5
728832c37c9751ed74803141b9b07674bac015caebcbc73d7aef9798c@172.16.224.167:30802?discport=0")

here 172.16.224.167 is the IP of node2 i.e in another system and 30802 is the port it is listening to.

Now when i enter this command, following is the response i receive:

  Error1:
  (anonymous): Line 1:15 Unexpected token ILLEGAL (and 2 more errors)

Please help me connect these two nodes or instruct me as to where is the mistake.


texts: How to get the address of the code being executed from CALLCODE?

texts:
I want to write a library which can be callcalled by any contract.

As part of this, I want to write a function which returns the contract address of the library to the contract which callcalled it.

address(this) is normally the solution, but in the case of callcode, it can only be used to check if the contract is being callcalled through  if(address(this)==msg.sender) which become always true.

So how to perform this without having to rewrite the code each time because of the requirement to predict the future library’s contract address ?


texts: How to connect project without web3 js npm package

texts:
I'm working with ASP.NET Core project and wanted to connect Blockchain with it. But the problem is, we don't want to use Web3 npm packages. Hence, I have added web3 js as follows

<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>

Now, I'm trying to set Web3 provider (Ganache Server URL) as follows,

const web3 = new Web3("HTTP://127.0.0.1:7545");

But It gives an error of Uncaught ReferenceError: Web3 is not defined

Is there any thing need to add in the above steps?


texts: I usually get ether for Ropsten Tesnet at http://faucet.ropsten.be:3001/, now the site seems to be offline. My question is what happened to the site, but more important, now how can I get ether for ropsten testnet?


texts: ETH Gas fee difference between sending to a wallet or a smart contract

texts:
I want to understand the difference of sending some ETH to a wallet of someone or to a smart contract. It seems costs are not the same. Is this correct?
If so, why does it probably cost more to send ETH to a smart contract than to another wallet?
Maybe someone has an idea or solution to reduce this gas fee for a smart contract receiver.


texts: how to connect nodes on different machines?

texts:
I have two signing nodes on machine #1 and two new nodes on machine #2.

The nodes on #1 are running and I have them in admin under geth. But when I try and connect the nodes on #2 I get various errors. I think this is IP related. I did ifconfig on #1 and used the broadcast address.

I am using Ubuntu 16.04 and geth 1.8. The nodes on #1 seem to work. I use PoA and the network is private.

Has anyone any idea what could be the cause?

From #2 Connection Request -

  geth --datadir node3/ --syncmode 'full' --port 30313 --rpc --rpcaddr
  'localhost' --rpcport 8503 --rpcapi 'p
  ersonal,db,eth,net,web3,txpool,miner ' --bootnodes
  'enode://601ade737b81f16abdd0ce9983b63eb12050c4ef89c46b8fdbf3e3e6c951cc02dffe36f87200033107cf
  8b007355e780fba16b67d1d46603b1321f07 314ea46b@10.132.0.2:30310'
  --networkid 1515 --gasprice '1' -unlock 'afd3cfddc8f5ed78ea9bbbf6c13d3dc40be4541 7' --password
  node3/pwdnode3.txt --mine

Error on #2 -

  ERROR[04-14|12:20:43] Bootstrap URL invalid
  enode="enode://601ade737b81f16abdd0ce9983b63eb12050c4ef89c46b8fdbf3e3e6c951cc02dffe36f87200033107cf8b007355e780fba16b67d1d46603b1321f07\n314ea46b@10.132.0.2:30310"
  err="parse
  enode://601ade737b81f16abdd0ce9983b63eb12050c4ef89c46b8fdbf3e3e6c951cc02dffe36f87200033107cf8b007355e780fba16b67d1d46603b1321f07\n314ea46b@10.132.0.2:30310:
  net/url: invalid userinfo"

From #1

admin.nodeInfo

  {   enode:
  "enode://64793e6e791115d315550d651cda00342b688ba36728b3d8070b04f4513ff65eb15ffb8f66387f1733340d8732e6ca956f0825cd3fc4e67686e04f63c5d0abc4@[::]:30311",
  id:
  "64793e6e791115d315550d651cda00342b688ba36728b3d8070b04f4513ff65eb15ffb8f66387f1733340d8732e6ca956f0825cd3fc4e67686e04f63c5d0abc4",
  ip: "::",   listenAddr: "[::]:30311",   name:
  "Geth/v1.8.2-stable-b8b9f7f4/linux-amd64/go1.9.4",   ports: {
      discovery: 30311,
      listener: 30311   },   protocols: {
      eth: {
        config: {
          byzantiumBlock: 4,
          chainId: 1515,
          clique: {...},
          eip150Block: 2,
          eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000",
          eip155Block: 3,
          eip158Block: 3,
          homesteadBlock: 1
        },
        difficulty: 10593,
        genesis: "0x702d8ca9647d171a6596a775888f71c7c0f3ddb011fbffcb921be685b2ef33b7",
        head: "0x1a8f2a0bf37fbabff2c76977cbfa56c67da056025292fad6bbd5da07d2d0af28",
        network: 1515
      }   } }

This is how I connect on #1 and that works -

  geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr
  'loca lhost' --rpcport 8501 --rpcapi
  'personal,db,eth,net,web3,txpool,miner' --bootnod es
  'enode://601ade737b81f16abdd0ce9983b63eb12050c4ef89c46b8fdbf3e3e6c951cc02dffe
  36f87200033107cf8b007355e780fba16b67d1d46603b1321f07314ea46b@127.0.0.1:30310'
  -- networkid 1515 --gasprice '1' -unlock 'fcad53c780a4f6c66b3daca331fe72fc6559c367'  --password
  node1/pwdnode1.txt --mine


texts: What tools exist for reading non-public storage?

texts:
What tools or methods exist for querying arbitrary contract storage?

The problem at hand is having to inspect smart contract state variables that have been marked as internal. Block explorers, Remix, and other tools only make it easy to query public state.


texts: How to interact with contracts in C++ application?

texts:
Vast majority of resource about contracts deal with using them in web applications with JavaScript web3.

But how you interact with contracts (create, call them, make transactions) in a C++ application?


texts:
To develop Dapp using Kotlin programming language for the front end design, Where should I place this code? and what it should be changed?

<script>

        // Connect a the web3 provider
        if (typeof web3 !== 'undefined') {
            web3 = new Web3(web3.currentProvider);
        } else {
            web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
        }

        // Set a default account
        web3.eth.defaultAccount = web3.eth.accounts[0];

        // Get the contract address
        var RemixContract = web3.eth.contract('...');

        // Get the contract abi
        var myMessage = RemixContract.at('...');

        console.log(myMessage);

        $("#setMessageButton").click(function () {
    message = $("#userInput").val()
    myMessage.setMessage(message, (error, result) => {message = result});
    console.log($("#userInput").val())
});

    </script>


texts: Is it really not possible to write a js function that takes address and returns public key?

texts:
I find it hard to believe that something like this is not possible, as the use of public/private keys is a major bonus of digital identities.

I need to write a Javascript function to take in an ethereum address and return its public key. I know how to get the public key from a signature, but it is harder than I thought to get a transaction signature, web3 cannot return one I believe.

Can I use something in ParityJS to grab a transaction hash from input address account, and get the signature from it?

Someone please tell me this is possible, I am losing hope...


texts: What is the bkp component in a presale JSON file?

texts: Is the "bkp" component of a presale json file a SHA3 hash of the wallet password?


texts:
Is it warranted that web3.utils.toWei(web3.utils.fromWei(x)) is equal in numeric value to x (provided that x is a 256 bit number represented as a string)?
If it is not warranted, how to obtain a value not less (maybe a little greater) that x knowing web3.utils.fromWei(x)?


texts: How do Ethereum mining nodes maintain a time consistent with the network?

texts:
We have established that the timestamp on a parent block has to be before the timestamp of a child block in Can a child block have an earlier timestamp than the parent block?.

How are differences in the clock settings on different miners' computers taken into account?


texts: How to list sub calls of conctract methods transferring money?

texts:
Assuming I have a contract method which conducts several money transfers, e.g.

function payalot(address payable p1, address payable p2, address payable p3) public {
    p1.transfer(42);
    p2.transfer(1337);
    p3.transfer(65535);
}

If I execute this method, I can easily get the executions' transaction hash and transaction receipt.

What I need to know is the list of money transfers conducted by the method. If I have the transaction hash or transaction receipt, is there any (easy) way of getting the details of "sub-calls" (is that the right name?) where money is transferred in Web3py - or in general?

Bonus question: Does that also work when tracking selfdestruct transactions?


texts:
I have some IoT(Internet of things) nodes sharing the received data from sensors with each others. I partitioned them to 2 private(permissioned) networks:

Network 1 includes: X,Y,Z nodes trusting each other.
Network 2 includes: M,N,O nodes trusting each other,for example.

In addition to overall smart contract for each network,

Can I write an individual contract which is special for each node of network( a smart contract for each node) for doing particular act in special time, such as sending data to the another node of another network in special time?

For instance, a particular smart contract for node X of network 1 that in special time is triggered to send data to node M of network 2.

Regards,


texts: How can I connect my HTML user interface to my Ethereum private chain?

texts:
I'm trying to learn smart contract development and test my contracts.

Before, I used truffle, Metamask and testrpc to test my contracts; and it took care of how to interact my HTML page to the local chain.

Now I'm using "geth" and a private blockchain in Ethereum (I'll explain all the steps shortly). I can deploy my contract using geth. I can interact with the deployed contract using geth console. But I don't know how to connect my HTML file to my blockchain.

Question 1: How can I connect my HTML user interface to private blockchain?

Question 2: Do I need to use Metamask when I'm using the private chain? If yes, how can I log into Metamask? as the private chain doesn't provide any 12 words phrase that Metamask needs (testrpc provides it).

My contract is very very simple:

pragma solidity ^0.4.4;

contract T2{

 uint public k2;
 function T2(){
  k2=32;
} }

The steps I take are as follows:

step 1-

 geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain
"*" --datadir Users/xx/TestChain1 --port "30303" --rpcaddr "127.0.0.1"
 --nodiscover --rpcapi "db,eth,net,web3" --networkid 123
 init/Users/xx/CustomGenesis.json

step 2-

 geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain "*"
--datadir Users/aydinabadi/TestChain1 --port "30303" --nodiscover --
rpcapi "db,eth,net,web3" --networkid 123 console

step 3-

unlock my account on the console and deploy my contract: i.e. I put my contract on remix, run it and copy the content of "Web3 deploy". Then paste it on the geth console.

My .js file is:

import "../stylesheets/app.css";
import { default as Web3} from 'web3';
 var web3;
if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
} else {
    // set the provider you want from Web3.providers
    web3 = new Web3(new
Web3.providers.HttpProvider("http://localhost:8545"));
 }

 var abi=[{"constant":true,"inputs":[],"name":"k2","outputs":
 [{"name":"","type":"uint256"}],"payable":false,"type":"function"},
 {"inputs":[],"payable":false,"type":"constructor"}];

 var ins=web3.eth.contract(abi);
 var instance= ins.at("0x863c7b1600b9312f85501dbc933a862b63dad374");
 var accounts;
 var account;
 var account2;
 window.App = {
 start: function() {
 web3.eth.getAccounts(function(err, accs) {
  if (err != null) {
    alert("There was an error fetching your accounts.");
    return;
  }

  if (accs.length == 0) {
    alert("Couldn't get any accounts! Make sure your Ethereum client is
  configured correctly.");
    return;
  }
  accounts = accs;
  account = accounts[0];
  account2 = accounts[1];
  });
   },
  setStatus: function(message) {
  var status = document.getElementById("status");
  status.innerHTML = message;
   },

  k2: function() {
  var spec6 = document.getElementById("spec6");
  var val= instance.k2.call();
  spec6.innerHTML = val.valueOf();

  },
  };

and my HTML file is:

 <!DOCTYPE html>

<button id="send" onclick="App.k2()">Get value</button>


texts: idiots guide to getting presale ether and wallet

texts: I've been looking over the responses for downloading presale ether and wallets. Honestly most of the answers require a strong programming background, which I don't have. I am looking for a safe, easy to understand way to do this as well as an understanding of the wallets and if they work the same as coin base and trezor. If there's a video somewhere even better. Thank you for taking time out to read my post.


texts: Get addresses of the owners of my tokens

texts:
Is it possible to issue a token and then send certain amount of ethereum to coin owners. For example is Alice owns 4 my token and Bob owns 6 of my tokens I want to send in total 10 Ethereums to my token owners, in this example Alice will receive 4 Ethereums and Bob 6 and I want to repeat this action every month. Can someone tell me if it is possible to make this kind of contract?
If it is possible I think there should be some global function, but unfortunately I couldn't find.


texts:
I'm newbie to Ethereum and trying to make things clear.
I've read few articles about PoW(proof of work) vs PoS(proof of stake) and what I understood is,

Proof of Work is nothing but the mining, in which miner get some reward to validate the transaction. After validation of transaction, miner will add that block to the public ledger.

Proof of Stake are(special miners) who do not validate the transaction but they validate the block(or create the block).

For instance if I deploy a smart contract to the Ehethereum Blockchain, it cost me 0.01072934 ether, which is fixed fees of deployment and that will goes to the PoS, and there is no role of PoW in this case.

Is this right? If yes, then how can we differentiate it with proof of authority?

This question based on my previous question:Where the Smart Contract deployment charges goes?


texts:
I want to avoid address reuse.

Suppose i received 1 Eth in address A from Alice and later i want to send this 1 Ether to Bob using another address B.

Is this possible that i can send funds received in one address through another address directly?

or i need to do some intermediary step to transfer money from address A to address B?


texts: When I go to MyEtherWallet.com, I found a list of Ethereum networks like picture below. Could someone explain how many Ethereum networks actually exist and what is the difference between them? Thanks


texts:
I am trying to call a contract function through the 'eth_call' method of rpc. my contract is as follows:

contract Ballot {

   function Ballot(string _title) {

       title = _title;
   }
...

   function getTitle() constant returns (string) { return title; }

...

}

I am calculating the method id for 'getTitle()' which yeilds '0x4e7ea493' which should return the title variable when sent in the 'data' param for the rpc call.

However it only every returns '0x' in the result, what am I doing incorrectly?


texts: Tracking tokenholders of a token with web3

texts:
If I have a token address how can I navigate and find certain things like:

tokenholder addresses
transactions for the token holders including when they made the transaction

I'm new to smart contracts and solidity and the whole ethereum development world so I may be asking a fairy simple question.

I'm wondering if the token address might have member variables such as a mapping for token holders and if so does the token holder have a log of the transactions they made?

Thank you!


texts: Served eth_sendTransaction err="unknown account"

texts:
I'm facing issue with private chain, when I run the node, it shows the logs as below, and transaction went in pending status.

Folder structure

All the wallet file reside into keystore folder.
Node.sh file
GLOBAL_ARGS="--nodiscover --gasprice 0 --targetgaslimit 470000000000 --rpc --rpcaddr 0.0.0.0 --rpcapi admin,db,eth,debug,net,shh,txpool,personal,web3 --mine --minerthreads 1"
echo "Starting node 1.....!"

nohup /usr/bin/geth --port 30304 --datadir=/node1 $GLOBAL_ARGS --rpcport 8545 --rpccorsdomain "*" --allow-insecure-unlock --unlock "address" --password password.txt &

Geth
Version: 1.9.14-stable
Edit-1
Here is the code I'm using to send transactions.
const newAccount =  await provider.web3.personal.newAccount(request.wallet_password);
if (newAccount != null) {

    await provider.web3.eth.sendTransaction({
        from: provider.web3.eth.coinbase,
        to: newAccount,
        value: provider.web3.toWei(1, "ether")
    });
}


texts:
I'm new to mining. I'm searching for a safe way to mine Etherium on my personal PC (Windows 10).
I think the criteria are:

it should be open-source
from reliable, trustworthy developers
no third party software executed

Also, it's very desirable to be easy for a novice.
I did little research and as far as I know, ethminer is good according to these criteria. Am I right? What do you recommend?


texts: Pancakeswap pools and farms not working on bsc tesnet. Undefined allownaces

texts:
We are tryting to make pancakeswap to work on bsc testnet. What we have done is as follows.
We have renamed the cake token to another token e.g BarToken with Symbol BARS
We have added liquidity using Router V2 and Factory V2 and we have added liquidity using pancakeswap swap interface and everything seems to be working fine on this side. We renamed the Lp tokens on factory contract.
Than we fork the pancake-swap frontend and deployed the contracts for.

SyrupBar (provided token address when deploying)
MasterChef (provided srypbar address and token address and change the ownership of syrupbar and caketoken)
Souchef
LP pair contract generated by factory after adding liquidity using pancakeswap-frontend core.

We have added these contracts in config files for contracts, pools, farms and tokens. We also updated wbnb bsc testnet contract.
The problem is that we are not able to approve pool and not able to enable farm which has pair BARS-BNB(we double check the addresses). The wallet address is also the contract owners for all these contract.
After some debugging we find that the allownaces are getting undefined for pools and farms.
Did we miss anything?