texts:
Is there anyway to read the return value from revert('Errored out') from Solidity contract via web3.

For example from below code I need to read the value from revert

pragma solidity ^0.4.22;
contract sample {
function buy(uint amount) payable {
  if (amount > 12)
     revert('Not enough value');
  }
}


texts: unsigned transactions not supported - web3, infura, @ethereumjs/tx

texts:
I am working on sending signed transactions using web3, @ethereumjs/tx, and infura. However, I am getting an error "unsigned transactions not supported".
Here my code, credit:
const Web3 = require('web3')
const Tx = require('@ethereumjs/tx').Transaction

const web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io/v3/PROJECT_ID'))

const addressFrom = '0x210490505e07cB9762017288e4729d0f15xxxxxx';
const Key = 'PRIVATE_KEY';
privateKey = Buffer.from(Key, 'hex');
const addressTo = '0x8035f72510907Fe3EE05b4dF439E5D0d977xxxxx';

const txData = {
  gasLimit: web3.utils.toHex(2500000000),
  gasPrice: web3.utils.toHex(10e9), // 10 Gwei
  from: addressFrom,
  to: addressTo,
  //chainId: 4,
  value: web3.utils.toHex(web3.utils.toWei('123', 'wei'))
}

const sendRawTransaction = txData =>
  web3.eth.getTransactionCount(addressFrom).then(txCount => {
    const newNonce = web3.utils.toHex(txCount)
    const transaction = new Tx({ ...txData, nonce: newNonce }, { chain: 'rinkeby' })
    transaction.sign(privateKey)
    const serializedTx = transaction.serialize().toString('hex')
    return web3.eth.sendSignedTransaction('0x' + serializedTx, function(err, hash) {
      if (!err) {
        console.log('Tx Hash:' + hash);
      }else {
        console.log(err);
      }
    });
  })

sendRawTransaction(txData)

Error:
Error: Returned error: transaction could not be decoded: unsigned transactions not supported
at Object.ErrorResponse (/PATH/node_modules/web3-core-helpers/lib/errors.js:28:19)
at /PATH/node_modules/web3-core-requestmanager/lib/index.js:303:36
at XMLHttpRequest.request.onreadystatechange (/PATH/node_modules/web3-providers-http/lib/index.js:98:13)
at XMLHttpRequestEventTarget.dispatchEvent (/PATH/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (/PATH/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (/PATH/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
at IncomingMessage.<anonymous> (/PATH/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
at IncomingMessage.emit (node:events:381:22)
at endReadableNT (node:internal/streams/readable:1307:12)
at processTicksAndRejections (node:internal/process/task_queues:81:21) {
  data: null
}

Things that I tried:

Making data not null
Adding 'chainId: 4' in transaction
Double checked if my private key is correct.

Thanks.


texts: Recovered address not matching signer address (using ethers)

texts:
Below is a simple signature verification flow I wrote, along with a test case with Buidler (all mainly to learn how to verify signatures in a Solidity smart contract). The problem is that the address I recover from the signature and the associated hash is different from the address of the signer that signed the hash. Moreover, (weirdly) the recovered address changes if the hash being signed is changed. I'm sure that shouldn't happen. I'd really appreciate if you could point out what I'm doing wrong!
The contract:
//SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/cryptography/ECDSA.sol";
import "@nomiclabs/buidler/console.sol";

contract Verification {

    bytes32 public hash;
    bytes public signature;

    constructor(string memory toHash) public {
        bytes32 temp = keccak256(abi.encode(toHash));
        hash = ECDSA.toEthSignedMessageHash(temp);
    }

    function setSignature(bytes calldata _signature) external {
        signature = _signature;
    }

    function verify(address signer) external view returns(bool) {

        address recoveredAddr = ECDSA.recover(hash, signature);
        //console.log(recoveredAddr);
        return recoveredAddr == signer;
    }

}

The test script. The first test passes, the second one fails:
const { expect } = require("chai");
const { ethers } = require("@nomiclabs/buidler");

describe("Verification", function() {

    let verify;
    let signer;

    before(async () => {
        const Verification = await ethers.getContractFactory("Verification");
        verify = await Verification.deploy("Hash this message");
        await verify.deployed();

        const addresses = await ethers.getSigners();
        signer = addresses[1];
    })

    // Test objective: To check that signature generated here in the script is stored, as is, in the contract.
    it("Should verify that signature in the contract and the ethers script are identical", async function() {

        const _hash = await verify.hash();
        const _signature = await signer.signMessage(_hash);

        await verify.setSignature(_signature);

        expect(await verify.signature()).to.equal(_signature);
    });

    it("Should verify that the signer signed the hash the contract was deployed with.", async function() {

        const _hash = await verify.hash();
        const _signature = await signer.signMessage(_hash);

        await verify.setSignature(_signature);

        signerAddr = await signer.getAddress();
        //console.log(`Signer address: ${signerAddr}`);

        expect(await verify.verify(signerAddr)).to.equal(true);
    })
})

Appreciate the help. Thanks!


texts: eth syncing of ethereum classic node in background

texts:
I run ethereum classic node on an amazon ec2 instance. It seems to be running

  ./geth --fast
  ./geth --exec "eth.syncing"  attach

{
  currentBlock: 735772,
  highestBlock: 5565504,
  knownStates: 0,
  pulledStates: 0,
  startingBlock: 735504
}

Should I always start my node with --fast to enable sync ?
how can i leave the ethereum classic node to sync fully from a terminal. It seems to stop when I close terminal. I want it to run in the background. Is that possible ?


texts:
If you look at the Parity chain spec for mainnet (https://github.com/paritytech/parity/blob/master/ethcore/res/ethereum/foundation.json), you will see this line:

"gasLimit": "0x1388",

But that should mean that the gas limit is 5000?  And that's really strange!

Someone is going to say "That is only for the genesis block" and then I will ask them to please answer this question:

Setting Block Gas Limit in private blockchain?

Someone else may say "you can change it to any value you want" but that is not the point.

This is also related:

Parity genesis file - How to set "minimal cost of the transaction" a.k.a. "Gtransaction" value?

Thank you.


texts: Is there a downloadable Ethereum bootstrap?

texts:
I am trying to synchronize a full node, and this is going very slowly, the progress alternates between bursts of high CPU usage (which is fine, it is heavy but importing), and long times with nothing happening (0% CPU usage).

Restarting eth gets it to immediately start importing again, but since it gets stuck every few thousand blocks, this means letting it synchronize on its own will take a very long time.

So before I go for a cron that will stop/restart the node every 10 minutes, I would like to know if there is a better solution.

There is an "import" command for instance, but I could not find any downloadable bootstrap?

Addendum: this would be for eth, not geth, and the aim is to explore the blockchain, so I need all the data (as far as I understand "geth --fast" f.i. would not get all the data)


texts: What exactly is the difference between HDWalletProvider and HttpProvider, and what is the proper scenario for using each?


texts:
Can anyone explain  what is exactly the point of this claim

https://medium.com/@rtaylor30/how-i-snatched-your-153-037-eth-after-a-bad-tinder-date-d1d84422a50b


texts: How to set gas price for an OPCODE in a private PoA chain?

texts:
I have set up a private PoA network on my machine. I can set the gas price and gas limit for all transactions.

Is it possible to set gas price required to sign a transaction for each OPCODE? Like I want to have a different gas price for SSTORE or CREATE rather than the default one.


texts: Using an ethereum address for centralized service authentication

texts:
I am building an app that interacts with a centralized backend. Let's say your typical java spring boot application.
However, as this centralized app is sort of in the blockchain space I was wondering about using a user's ethereum account as a login. (When I mean ethereum account, I mean logging in using metamask to the frontend UI).
So from my understanding, metamask/wallet would sign all requests sent to a smart contract. But in this case, without sending requests to a smart contract, we will need to sign and send requests to a centralized service.
And the centralized service will need to have the public key to verify if the signed owner is the actual sender. Also from what I have read the public key is only available from the ethereum network if a user has done at least one transaction.
With all being said, the question is

How would one go around accomplishing this (If at all if this is practical), keeping in mind security (for example I shouldn't be able to just type another user's address and impersonate that user).
Are there examples of this done in the wild/in production that I could take a look at.


texts:
I have an array that I wish to display on a website, unit public x[31]. Via web3.js, I can create 32 different calls to x[0] through x[31]. Alternatively, I could add a getter view function to my solidity contract that just presents the array
function showX()
        public
        view
        returns (uint[32] memory Xout)
    {
        Xout= x;
    }

With this function built-in to my solidity contract I would just need to call this once in my javascript file, and then have the array. Thus, I can either push more work onto javascript, or solidity.  Is either method more efficient/elegant?


texts: I'm trying to figure out the check of existence  and the immutability of the transaction in the Ethereum block, but I do not know how to get mercle branch. With the help of web3j I can get the block number by the hash of the transaction, and then get the full list of transactions by the block number. But there must be a way to get only those transactions that are needed for verification - merkle proof. How can I get only needed hashes? I will be glad to any help!


texts: How would a miner include my tokens merged mining function in blocks they mine?

texts:
So I have a merged mining token. How would a miner include my function in the blocks they mine?
pragma version:

v0.4.26+commit.4563c3fc.js

Merged mining code:

function mineTokenReward() {
  balances[block.coinbase] += 1; //Miners get rewarded when they mine.
}


texts: What's the difference between contract creation and contract deployment?

texts:
According to the solidity documentation:

One way to create contracts programmatically on Ethereum is via the JavaScript API web3.js. It has a function called web3.eth.Contract to facilitate contract creation. When a contract is created, its constructor is executed once.

Now, How is this different from deploying a contract ? When we deploy a contract, the constructor is executed once. So what's the difference between contract creation and contract deployment ? Or, do they mean the same thing ?


texts:
Can parameter overflow be prevented in the contract, or does it have to be dealt with on the frontend?

Solidity:

contract parameterOverflows {

    uint8 selectedCharacter;

    modifier onlyCharacter(uint8 _character) {
        require(_character < 256);
           _;
    }

    function selectCharacter(uint8 _character) public onlyCharacter(_character) {
        selectedCharacter = _character;
    }

}

If selectCharacter(257) is called, selectedCharacter becomes 1 because (I think) the 257 overflows to 1.

This could be prevented by just not calling the function with anything outside the intended range, but is it possible to prevent this from the contract? Where exactly is the overflow happening?


texts:
I'm looking for a way to store data in a decentralized way such that I can access any record from within the smart contract, probably through oracles I guess?

I've been looking into gundb but not sure how it can be used with solidity.


texts: web3.fromWei(eth.getBalance(eth.accounts[0]), "ether") shows 55 in red

texts:
so maybe i'm not understanding, i've left my miner up and running for quiet sometime, and i run a
web3.fromWei(eth.getBalance(eth.accounts[0]), "ether") on my only single account and it shows up a red 55..

I check that account on etherscanner.io and it shows 0.

so since i was running geth in console mode, i tried sending a transaction, and it indicated exceeded gas limit.

Does this mean i have 55 coins or is this just a bug or something?
Closed Geth to restart miner, and now
web3.fromWei(eth.getBalance(eth.accounts[0]), "ether") shows 0??


texts:
I kept on getting this error. 9/10 of my deployment will fail. But out of the sudden it will be success without any reason.

I have checked the transaction receipt and indeed it had reaches the gas limit. The weird thing is, no matter how high I set, the limit will always be hit (until it reaches the block gas limit)

Saving successful migration to network...
  ... 0x4767ac8dbe6496fad283fd0185557f1fa56bd8772f9e6e727a385a31938d7179
  ... 0xeab261e0b015da89e96607cc20de26678a1d75c88fc1d5307ac526aad539d15d
Saving artifacts...
(node:7376) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The contract code couldn't be stored, please check your gas amount.
(node:7376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

truffle Configuration

development: {
  host: "localhost",
  port: 8545,
  from: "0xc8caa71c16299b40b8579742a27ee53162886040",
  gas: "900000000",
  gasPrice: "3000000000",
  network_id: "*" // Match any network id
},

The ciritcal part of the migration script:

deployer.deploy(V);
deployer.deploy(L).then(async () => {
  deployer.deploy(X, L.address);
});

The X is failing. It's constructor is depending on the address of L. If your earlier guess is correct, then most likely this is the part that gives error.


texts: Contract Created successfully but I don't receive tokens ? Bscscan testnet

texts:
I'm really sorry for the basic question. I've made some basic contracts from youtube videos, now I've tried to take contracts from BSCscan and put them through Remix on Testnet to try them, but I never receive the tokens on testnet?
For example if I take the Safenebula code, change the name and symbol, i create the code but don't receive the tokens in my wallet. As any help?
Contract created - https://testnet.bscscan.com/address/0x791bfc97862231fa64790138717d6cd6cc416c78
Contract used to copy - https://bscscan.com/address/0xa1FD60c51C0BDAC1Ff5BB6067A24d61441E39569#contracts


texts:
Understand that Ethereum or any other DLT for that matter is about provenance. I have a scenario where I need to insert a record/transaction row/item in the ledger.

Instead of appending this record to the ledger (which is like an update), is there some way to create? Because most of these new entries are not related to the last record/entry. i.e., they are new.

State variables in smart contract just updates (the U in the CRUD dimension) instead of create.

Is there a "Create" (Database CRUD) new entry/row item in Ethereum? How does one use Smart Contract to create a new item/transaction row?


texts:
I'm not able to connect metamask with nodejs.

var Web3        = require('web3');
var web3        = new Web3();

if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
 web3 = new Web3(web3.currentProvider);
 } else {
console.log('No web3? You should consider trying MetaMask!');
  }

It is showing the error :

  Error: Provider not set or invalid


texts: Running 'parity account new' - is the generated account suitable for all networks (mainnet, ropsten, kovan, etc)?

texts:
From a command line, I run parity account new.

I am then asked to enter a password (twice), and an account-address is printed.

In addition to that, a JSON file is created.

Finally, I use this NodeJS code in order to generate the private key for my account-address:

let fs         = require("fs");
let keythereum = require("keythereum");
let keyObject  = JSON.parse(fs.readFileSync(KEY_FILE_NAME, "utf8"));
let privateKey = keythereum.recover(MY_PASSWORD, keyObject).toString("hex");
console.log(privateKey);

Is this pair of [public address, private key] suitable for every Ethereum network?

Can I safely use it on any testnet as well as on mainnet?

Or do I need to "register" it in a network before it is considered a valid account on it?

Thank you!

UPDATE:

To elaborate a little bit, I would like to share my understanding of how things work.

Suppose that someone sends 1 ether to 0x1234567812345678123456781234567812345678, and that no one has ever generated an account with this address.

When we check the balance of this account (on etherscan.io, for example), we will see that it stores 1 ether even though no one has ever generated it.

Now, if someone extremely lucky generates an account with this address, then they will be able to use the private key in order to withdraw the funds.

If I am correct in this description, then the immediate conclusion is that no such thing as "account registration" is required.

Am I right?


texts: How to get the actual time of occurrence for ethereum transaction in block

texts:
I used the API of Ethereum to download some transactions info. The timestamp is included, however I found the timestamp not mean the transaction time but the block which this transaction is located founded time. I visited
 https://etherscan.io for this transaction info. The same is true, the page shows me the time of the block which this transaction is located founded time. How can I get the transaction time rather not block founded time?


texts:
In my transaction: gasPrice: 210000

blockHash: "0x69bd71736f2a5d2c83919a0de81a7de0b6b690bb6bdda3acff254d5c68f634bc",
blockNumber: 3178,
from: "0xc8caa71c16299b40b8579742a27ee53162886040",
gas: 2100000000,
gasPrice: 210000,

And the receipt: gasUsed: 72769

blockHash: "0x69bd71736f2a5d2c83919a0de81a7de0b6b690bb6bdda3acff254d5c68f634bc",
blockNumber: 3178,
contractAddress: null,
cumulativeGasUsed: 72769,
from: "0xc8caa71c16299b40b8579742a27ee53162886040",
gasUsed: 72769,

Is that means my total gas consumed = 72769 x 210000 = 15281490000 or 15GWei?

Can I safely assume gasUsed will remains the same if the execution condition (i.e. input parameters) remain the same? Even when I move my code from test node to the main ETH?


texts:
Is there any benefit to buying powerful hardware for Dapp development?
If hardware is not very important what would give the greatest (performance) benefit in improving development speed?


texts: How to query the amount of mining reward from a certain block?

texts:
I want to write a script to analyze mining rewards.
What is the best way to query for the amount of mining rewards of a certain block?
It seems possible to query the address of the lucky miner:

web3.eth.getBlock(200).miner
"0xbb7b8287f3f0a933474a79eae42cbca977791171"

Then I can somehow delve into the account and pick the transaction at certain block. Is this the best way? Or do you know shortcuts? And how to do it?


texts:
I am completely new to the mining world and i wanted to try it once. I have a Sapphire R9 290X.

I followed all the steps to start mining.
Aftert typing in :"geth --rpc --fast --cache=1024" my computer is syncing the last 5 days. My computer crashed 2 times since then, so i reopenend it and it continue loading. Right now my chaindata folder is 56,3GB and the sync is still going on.

my terminal has lines like:

I0213 19:30:51.409306 core/blockchain.go:1001] imported 3 block(s) (0 queued 0 ignored) including 49 txs in 16.8458156s. #2431234 [c2eddc7d / 9c8044f2]

I0213 19:31:06.445217 core/blockchain.go:1001] imported 4 block(s) (0 queued 0 ignored) including 58 txs in 15.0359109s. #2431238 [9c8044f2 / 0dc91408]

I0213 19:31:20.546331 core/blockchain.go:1001] imported 12 block(s) (0 queued 0 ignored) including 60 txs in 14.1011141s. #2431250 [0dc91408 / 80bd5e52]

Where is the end?


texts: Checking TokenBalance of other token contract

texts:
I try to simply check a users DAI token balance on Kovan testnet (ContractAddress: 0xC4375B7De8af5a38a93548eb8453a498222C4fF2) with the following code:

pragma solidity ^0.4.16;

contract ERC20 {
  function balanceOf(address who) constant returns (uint256);
}

contract myTest {

  ERC20 myToken;

  function setToken(address tokenAddress) {
    myToken = ERC20(tokenAddress);
  }

  function getTokenBalanceOf(address h0dler) constant returns (uint balance) {
    return myToken.balanceOf(h0dler);
  }
}

When exucting the getTokenBalanceOf function Remix throughs an error:

"call to myTest.getTokenBalanceOf errored: 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.  "


texts: What is the best way to get the list of all transactions which have happened for my smart-contract in a private setup?


texts: Managing keys/accounts external to Geth?

texts:
I know that Geth requires that you have your wallet files located in the ./keystore directory and that you are required to unlock an account before using it. However, one of our potential use cases is having a web application that allows users to log in and use their wallet with us managing/retrieving credentials with our data model. With Geth's current requirement, we would have to have upwards of thousands of wallet files sitting in the keystore. Is there a way to create and use an account without having this file in the keystore?

I'm afraid the answer is no, but wanted to make sure I haven't missed anything.


texts: Parity Windows slow sync despite --warp/latest vers etc

texts:
I run Parity (latest version) on Windows and the sync is super slow.
I tried several flags proposed here aswell as the warp mode, although as i understand from teh FAQ this is default now any way?!

I tried even adjusting teh snapshot peers, however this now led to stopping my sync and showing "3,797,811 best block".

My start path now looks like this under windows

  "C:\Program Files\Ethcore\Parity\ptray.exe" ui --warp --db-compaction hdd --cache-size 1024 --tracing off --pruning fast --snapshot-peers 16

Thanks for any help


texts: Are transactions in a BatchRequest guaranteed to be in the same block?

texts:
I'm sending 0.1 ETH to 10 different addresses from the same address with manually incremented nonces in a BatchRequest. So far on Kovan, all transactions in the same BatchRequest have entered the same block, which is precisely the behavior I need.

Are these BatchRequest transactions always guaranteed to be in the same block, whether on Kovan or Mainnet?

Edit: The answer is no. I tried with ~700 addresses and only so many (~81) can fit in a single block.


texts: Recommended way to watch events with MetaMask?

texts:
I always get in trouble with things like var filter = web3.eth.filter({fromBlock: '5139365', toBlock: 'latest'}); filter.watch(function(_err, _resp){ ... when using MetaMask as provider.

What is the recommended way to watch for new blocks when using the MetaMask provider?


texts: Hidden gameplay information for game contract

texts:
I developed a maze game in Solidity with a treasure at a location in the game. Players send transactions to move. The first to find the treasure wins some ether.

Is there no solution to the problem that the treasure position will be visible to anybody who looks into the transactions input data?
I know how to hide information submitted by players, like in a rock-paper-scissors game, by hashing the answers and providing the key when the game is finished. But I think that doesn't work here, as the information to hide is needed by the contract to check if a player is at the treasure's position and trigger the reward.
Is there any way (even complex) to workaround this somehow, or is this game just not meant to be on the blockchain?

In case that helps, here is the code: https://github.com/jquentin/EtherMaze/blob/master/EtherMaze%20-%20Payable.sol


texts: How to properly call a function in deployed contract?

texts:
Hi I'm having a web3 code, web3 version is 0.20.0

MyContract.addPerson.call("0x6b1c97bf430704e118cb3aaeb2bccce1a29d85e3",function (error, result){
            if (error) {
                console.log('Error:'+JSON.stringify(error));
                res.send({'status':0,'message':error});
            }else{
                console.log('Result:'+JSON.stringify(result));
                res.send({'status':1,'message':result});
            }
        });

My contract code is

function addPerson(address pesonAddress) public returns(address message){
        if(msg.sender != owner) {message = 0; revert();}
        if(auctioneers[pesonAddress] == true){
            message = 0;
        }else{
            auctioneers[pesonAddress] = true;
            auctionersList.push(pesonAddress);
            message = pesonAddress;
        }

    }

Compiler version is 0.4.20.

Also I tried with

MyContract.addPerson("0x25c8b176c11e21fe5ffdc943acdf6d070d197e02",{value:0,gas: 30000},function (error, result){
            if (error) {
                console.log('Error:'+JSON.stringify(error));
                res.send({'status':0,'message':error});
            }else{
                console.log('Result:'+JSON.stringify(result));
                res.send({'status':1,'message':result});
            }
        });

It shows addPerson() is not a function.

It works well when I test it in remix IDE. But when I call addPerson() with address as an parameter it doesn't add that address to the map and array.Also I checked the address by returning the address, it matches. Also I add an address in remix IDE and then I returned that array in web3js, it contains array of addresses that I added in remix IDE. What I'm doing wrong here? Thank you.


texts: Bootstrapping Geth on Ropsten Testnet with Known Nodes

texts:
I tried syncing with the Ropsten testnet using Geth with the following command.

 geth --testnet --mine --minerthreads=1

When it looks from Geth like I'm synced, the block height is way behind what it shows on https://ropsten.etherscan.io/ and I have either no peers or very few.  Is there a way to give Geth a few known peers to bootstrap it onto the "right" Ropsten testnet?


texts: constant versus public in solidity functions

texts:
Using Mix, if I create a contract in the scenario with address A as a parameter, clicking on getConstant in the html below returns A as I would expected it, and I see a JS flagged transaction.

If now I click on getPublic which is pretty much the same function bare the constant / public keyword I got a pending transaction in the scenario and an address that is not the one I expect.

So I might NOT understand something fundamental about what public means or implies but I fail at seeing what it is.

I have set this basic contract / html for this question :

contract constantOrPublic {
    address creator;
    address otheraddress;

    function constantOrPublic(address _otheraddress)
    {
        creator = msg.sender;
        otheraddress = _otheraddress;
    }

    function getConstant() constant returns(address) {
        return otheraddress;
    }
    function getPublic() public returns(address) {
        return otheraddress;
    }

}

and this html page:

<!doctype>

getConstant:

none

    <button onclick='getConstant()'>getConstant</button>

getPublic:

none

    <button onclick='getPublic()'>getPublic</button>


texts: Workaround for TypeError: Struct containing a (nested) mapping cannot be constructed

texts:
Following example code piece works on solidity v0.6.*:
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.1;

contract Campaign {
    struct Status {
        uint32 cost;
        mapping(uint256 => address) jobs; // I will set this afterwards
    }

    struct Provider {
            mapping(string => Status[]) jobStatus;
    }

    mapping(address => Provider) providers;

    function submit(string memory key) public {
         Provider storage provider = providers[msg.sender];
         provider.jobStatus[key].push(Status({cost:100}));
    }
}

When I update solidity version to 0.7.1 I am getting following error: TypeError: Struct containing a (nested) mapping cannot be constructed..
When I uncomment following line mapping(uint256 => address) jobs; error is gone but is there any way to handle this error without uncommenting  mapping(uint256 => address) jobs; section?


texts: How can I call a function in deployed contract on Ropsten Testnet when I don't have ABI and source code?

texts:
For some testing I deployed several contracts on Ropsten Testnet using web3.py but now if I want to execute them or call any function from them, how can I do this? I don't have ABI as I did several contracts and its practically impossible for me to verify every single contract. I have only Transaction hash and the contract address.

Please help


texts: Calculating gas cost of a transaction on-chain

texts:
We can read the gas limit and the gas price of a current TX in solidity. However, reading those values already uses some of the gas.

What is a reliable way to calculate the actual gas cost of a transaction? An example would be that a whitelisted address has to pay an user, but the gas costs have to be subtracted from this payment.


texts: Imported Mist account into newer version of ethereum wallet. I cannot see my custom tokens in the new wallet

texts: I just imported my old mist account wich holds two contracts into my new ethereum wallet with the wallet file. My problem is that I cannot seem my tokens after importing, that I've created in the older wallet. How can I get them in my new wallet?


texts: How to use sendSignedTransaction without waiting for confirmation?

texts:
I am sending ether to multiple accounts and I want to send them without delay or waiting for confirmation of previous transaction.

const fs   = require("fs");
const os   = require("os");
const Web3 = require("web3");
const net  = require('net');

const NODE_ADDRESS = "IPC";
const SEND_ACCOUNT = "ACC";
const PRIVATE_KEY  = "PRI";
const INPUT_FILE   = "CSV";

async function run() {
    const web3      = new Web3(NODE_ADDRESS, net);
    let nonce_count = await web3.eth.getTransactionCount(SEND_ACCOUNT);

    const lines     = fs.readFileSync(INPUT_FILE, {encoding: "utf8"}).split(os.EOL);
    for (const line of lines) {
        const [id, address, balance] = line.split(",");
        const options = {
            to       : address,
            value    : balance,
            gasPrice : 1000000000,
            gas      : 21000,
            nonce    : nonce_count
        };
        const signed  = await web3.eth.accounts.signTransaction(options, PRIVATE_KEY);
        const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);
        console.log("Address:",address,"Balance:",balance,"Nonce:",nonce_count);
        nonce_count++
    }
}

run();

Thanks in advance.


texts: Why is this distribution not randomized?

texts:
In order to get a random number between 0 and 51, I use this following equation:

index.push((uint(sha256(block.coinbase, block.number, block.timestamp)))%52);

but why the result turns out that it is not that randomized otherwise the distribution is restricted in a narrow region?


texts: Is it possible to give a contract the same address from morden

texts:
I think I just lost a fraction of Ether. I accidentally sent it to the main network, but my contract only existed on Morden. I'm wondering:

Can I deploy the contract retroactively? Is the address created deterministically? If so what pieces must be identical to get an identical address?

It looks like the data will be lost... For me this is ok. I have a suicide function that should return the funds if I can call that.


texts: Geth Node doesn't revert a transaction not satisfying a require

texts:
i'm testing my smart contract on remix with local ganache cli, when i try to test case that doesn't satisfy a require on the SC i correctly receive message "transact to Contract.function errored: VM Exception while processing transaction: revert {errorMessage}" and the transaction is not executed.

But when i try to do the same test by running a geth node localy i don't have the same behavior, the transaction is submitted and mined, with status 0x0.

This is tricky because the transaction is made, i spend gas and i can't catch immediately the error, as the require method should be able to do.

Thanks in advance


texts:
I am creating android dapp for votings
I am trying to check if user's credentials are right,so i use object of PersonalUnlockAccount class and function accountUnlocked().So the problem is that when i call accountUnlocked() it gets me to the first activity and returns nothing
Here is the code

PersonalUnlockAccount personalUnlockAccount = null;
                personalUnlockAccount = web3.personalUnlockAccount(editTextAdress.
                        getText().toString(), editTextPassword.getText().toString()).sendAsync().get();
            Toast.makeText(getApplicationContext(),true.,Toast.LENGTH_LONG).show();
            if (personalUnlockAccount.accountUnlocked()) {
                Log.i(TAG,"Rabotaet");
                ECKeyPair ecKeyPair = null;
                    ecKeyPair = Keys.createEcKeyPair();
                WalletUtils.generateWalletFile(editTextPassword.getText().toString(),ecKeyPair, new File(getCacheDir(),"wallet"), false);
                Toast.makeText(getApplicationContext(),"UNLOCKED",Toast.LENGTH_LONG).show();
                startActivity(intent);
            }else{
                Log.i(TAG,"ne Rabotaet");                   Toast.makeText(getApplicationContext(),"PROBLEM",Toast.LENGTH_LONG).show();
           }

What could be done with this?


texts: Were the nowadays blockchain applications infeasible a few years ago?

texts:
Is it a proper argument to bring Moore's Law into equation when it comes to thinking why the current blockchain applications weren't feasible back in the day (2015-2016)?
I am completely aware of the recent developments in Ethereum as a Blockchain, Solidity, Web3 1.0 (and not only) and many other useful utilities. But in terms of the cost of mining, were these new applications just not feasible back in the day?
On one hand, I would say Moore's Law has nothing to do with it, since if it would actually be easier to mine blocks, then it would be just as easy to tamper with the blockchain. On the other hand, Moore's Law makes it easier to mine blocks, but I don't know the exact current techniques of encrypting blocks (I know of nonce and hashes + the peer to peer network part), so it might actually play a role in the feasability of nowadays' blockchain dapps.
What do you think? Does it somehow play a role? If so, in what manner?
CONCRETE EXAMPLE: Crowdfunding dapp. Was it just too costly to contribute because of the cost of mining if such an application was deployed in 2016?


texts: Performant way to simulate pending transactions in real-time?

texts:
I have this, in ethers.js, where provider is a WebSocketProvider connected to a full node, which is working fine for getting the tx's (quite a lot of them per second):
provider.on('pending', async (txhash) => {
    console.log(`pending tx ${txhash}`);
    const tx = await provider.getTransaction(txhash);
    console.log(tx);
    const resp = await provider.call(tx);
    console.log(resp);
});

call works for return values, but I want to be able to get events from pending transactions in the mempool, as if they are ran at the top of the block.
I also have hardhat, but I'm having a hard time with this use case because I want to keep up with incoming blocks and also simulate each transaction independently (not affecting each other).


texts: Can I know an address on another blockchain that was generated with the same key as an ETH address?

texts:
Let's assume another blockchain (blockchain ATH) uses the same protocol to derive addresses from private keys as the one used by Ethereum.

If I see an ETH address then I know for sure that the person who controls it can generate an identical ATH address (unless the private key is held in a hardware wallet or something).

Now, suppose another blockchain (BTH) use a different protocol to derive addresses; as long as I know the one-way function used, is there a way for me to know which BTH address can be derived from the same key as a specific ETH address?


texts: Are transactions with too high nonce propagated to other nodes from local pool by parity?

texts: I want to understand what happens with tx when I create tx with too high nonce. It's saved in a local queue, but do other nodes get the information about this tx? I don't know, can I remove tx from the queue before it's mined and be sure that it won't be mined later by some node that received that tx before I removed it.


texts: Truffle Metacoin Could not find artifacts for ConvertLib.sol from any sources

texts:
I've just unboxed the Metacoin example from Truffle http://truffleframework.com/boxes/metacoin

When I run truffle test on it in VS Code I get the following error:

1) TestMetacoin "before all" hook: prepare suite:
 Error: Could not find artifacts for /D/TruffleTest/contracts/ConvertLib.sol from any sources
at Resolver.require (C:\Users\MyPuter\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-resolver\index.js:37:1)
  at TestResolver.require (C:\Users\MyPuter\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-core\lib\testing\testresolver.js:17:1)
  at TestResolver.require (C:\Users\MyPuter\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-core\lib\testing\testresolver.js:17:1)
  at C:\Users\MyPuter\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-core\lib\testing\soliditytest.js:141:1
  at Array.forEach (<anonymous>)
  at C:\Users\MyPuter\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-core\lib\testing\soliditytest.js:140:1
  at C:\Users\MyPuter\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-deployer\src\deferredchain.js:20:1
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

I've done nothing to the downloaded example and just followed the step by step from https://medium.com/@wslyvh/get-started-with-ethereum-solidity-on-windows-1672e9953a1

Any ideas why it's failing the before all part in the test? truffle Compile works fine.

I've also just extracted the example folder directly from the download link and ran the truffle test from powershell on that folder and getting exactly the same issue. Im a bit lost.


texts: Is there a tool that creates a basic HTML interface from an ABI?

texts:
I am looking for a tool that builds a basic interface for a contract so that I can use this generated HTML as a starting point to build the front end.

I am aware that Mist, https://chriseth.github.io/browser-solidity/ and http://tgerring.github.io/abi2html-js/# all do this but I haven't found a way to extract the HTML/Java script.


texts: What's identification mark for a internal transaction?

texts:
I used Parity tracer, it return a lot of message with many opCode: CREATE, CALL, CALLCODE, DELEGATECALL, and SUICIDE. It may be 60,70 traces.

But when you see in ropsten or etherscan, it show only 1,2 or 3 internal transactions.

Example:

I have a transaction hash: 0xe3c884a2bc63e033ab3110a8bb50156f81e50c72bc329b1471a1aadedeff3850

See internal transactions of this transaction:
https://etherscan.io/tx/0xe3c884a2bc63e033ab3110a8bb50156f81e50c72bc329b1471a1aadedeff3850#internal
See all traces of this transaction:
https://etherscan.io/vmtrace?txhash=0xe3c884a2bc63e033ab3110a8bb50156f81e50c72bc329b1471a1aadedeff3850&type=parity#raw

It has only 1 internal transactions but has 16 traces. So how I can filter traces to find internal transactions exactly? Can you give me a sample code? Thank you!


texts:
It took 2 days to get to 200gb on geth fast synch mode. But now im moving with approx 5gb a day with a decent internet speed around 100mb/s in Lan.

I disconnected and now running on 25mb/s with wifi. But again the intial 200gb that was synched was with the 25mbs wifi

I should also mention I have a 11Gb msi geo force and 64 gb rams.

Altough, the system is sdd, i also have hdd to keep things neat.
I created a mklink from sdd C: to hdd E: where the node is being stored.
Since the intial 200gb was very fast I do not believe this slow pace is being caused by the mklink to hdd (read-write) folder.
But I need to be sure that is not the case. And this is where my question is? Did the synch slow down after 200gb download due to hdd??

Cuz with this rate it ll probably take me 170 days to fully synch. I am also new at the community. Thanks in advance.


texts: How to calculate arcus sinus in solidity?

texts: I have a function to calculate sinus from this library. How can I calculate arcus sinus and arcus cosine?


texts:
I have a question regarding etherscan and transferring erc20 tokens. First, how does etherscan get all the wallets with a specific token and how accurate is that list? For example XRP...

Second, if I wanted to create a transfer agent myself (list of wallets), for my own token, how would I do this. Actually, I know how to do it, my question is how are ERC20 tokens transfered outside of my own token contract? Can user X send my created token (ABC) to user Y, without using my deployed ABC token contract?


texts: problem I have 200 gb hard disk this will be a problem when downloading the blockchain geth ethereum

texts: How much space does a PC need to download the complete portfolio of geth-ethereum on my pc? I have 200 gb of hard drive.


texts: How can I verify a signature with the web3 javascript API?

texts:
Using the javascript web3 API I can create a signature like this:

> web3.eth.sign(eth.coinbase, "0xdeadbeef")
"0xd3fe64b6f0920593cc4afb1321d592ae91e25fe1a0216e9002a4a6580fb2698c5ec62491c62557b8cc8f64533a5097b3ffb68208952b30cb27ed0a56ae21682201"

Now I'd like to verify that the signature is correct; doing so in a contract is already documented elsewhere, but I am looking for a way to do this using web3. (How) can this be done?


texts: Geth full node stuck on "Migrating ancient blocks". Normal?

texts:
I'm resurrecting my geth node after being offline since late 2018. I copied the old data dir to my server and compiled the latest stable geth. Everything was fine at first, but now sync seems to have stalled.
cli: geth console --datadir /mnt/san-data/blockchains/eth/blockchain/ --syncmode full --cache 16384 --http --ws --nat extip:[redacted]
exert from output:
INFO [04-26|16:56:33.882] Migrating ancient blocks                 count=101661 elapsed=15h58m42.135s
> eth.blockNumber
0
> eth.syncing
{
  currentBlock: 4000261,
  highestBlock: 12312841,
  knownStates: 251868014,
  pulledStates: 251786330,
  startingBlock: 4000261
}
> INFO [04-26|16:57:34.617] Writing clean trie cache to disk         path=/mnt/san-data/blockchains/eth/blockchain/geth/triecache threads=1
INFO [04-26|16:57:34.618] Regenerated local transaction journal    transactions=0 accounts=0
INFO [04-26|16:57:34.655] Persisted the clean trie cache           path=/mnt/san-data/blockchains/eth/blockchain/geth/triecache elapsed=38.401ms
INFO [04-26|16:57:48.442] Migrating ancient blocks                 count=101662 elapsed=15h59m56.695s
INFO [04-26|16:59:03.649] Migrating ancient blocks                 count=101663 elapsed=16h1m11.901s
INFO [04-26|17:00:17.920] Migrating ancient blocks                 count=101664 elapsed=16h2m26.173s
... ======= 5+ hour cut =============
INFO [04-26|22:25:29.949] Migrating ancient blocks                 count=102084 elapsed=21h27m38.202s
INFO [04-26|22:26:53.417] Migrating ancient blocks                 count=102085 elapsed=21h29m1.670s
INFO [04-26|22:28:17.714] Migrating ancient blocks                 count=102086 elapsed=21h30m25.967s
INFO [04-26|22:29:41.789] Migrating ancient blocks                 count=102087 elapsed=21h31m50.042s

> eth.syncing
{
  currentBlock: 4000261,
  highestBlock: 12312841,
  knownStates: 251868014,
  pulledStates: 251786330,
  startingBlock: 4000261
}
> eth.blockNumber
0

$ geth version
Geth
Version: 1.10.2-stable
Git Commit: 97d11b0187b4695ccf44e3b71b54155fe405a36f
Git Commit Date: 20210408
Architecture: amd64
Go Version: go1.16.3
Operating System: linux

disk space:
$ df -h /mnt/san-data/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/san-data   60T  3.9T   53T   7% /mnt/san-data

iotop in accumulative mode notes that geth wrote 8.4G and read 56K of disk in that 5+ hour time window, and hardly any current activity (<100k/s). All open files (via procfs /proc/{pid}/fd) are under the data dir as expected and no other disks are running out of room. netstat shows 50 active connections to geth, 34 of them inbound. nload show spurts of activity (probably from other things running on the server) but plenty of available bandwidth. top shows geth has a single core monopolized. Did it actually stop syncing to do something to every block, 1/3rd of the way through syncing? If so, is there any way to parallelize whatever it's doing?
e: Server is a dl580 chassis with 4 sockets each with a Intel(R) Xeon(R) CPU E7- 4870  @ 2.40GHz for 80 logical cpus; 640gb ram; san is a PowerVault MD1200 with 60TB effective storage. Please spare me the lecture about using 10+ yo hardware for a hobby project. Running Ubuntu 20.04.2 LTS server on 5.4.0-72-generic kernel
ee update: Per Ismael's suggestion in the comments, I looked into creating an issue report in git. Per git issue posting guidelines, I attempted to restart the node before filing an issue. This resulted in failure to restart due to apparent db corruption. So now I'm syncing from scratch. I'll update once it catches up to where it was, to say whether it has the same issue again.


texts:
Long story short, I got into ether mining back in '16, even went as far to buy some ethers and sent it to... wherever? I stopped in Dec '16 and forgot all about it, packed up and stored the PC while I traveled. I finally got a new place and booted up the PC, showing my ether info in etherscan.io - I can login and definitely know the password, however I cannot send what I have because etherscan.io is not a wallet... cannot remember where it is, but I DO have my address. cpp-ethereum is still set up on this win 10 machine, and I opened geth up and inquired to my balance - it said 0! even though etherscan.io shows my actual balance! how do I access my funds and transfer it to coinbase?

Thanks!
- J


texts: What is the difference between JSON-RPC, Javascript API and web3.js?

texts:
As I am getting into blockchain-development (Ethereum), I'm often left confused with what the exact difference between web3.js [link here] and specification of JSON-RPC for ethereum on this page. And what is this documentation about?

Are they same? If not, then how are they related?

Is the geth conosole same as JSON-RPC?

I tried looking up for different answers, and it seems a lot of answers tend to mix up between JSON-RPC and web3.js.


texts: Truffle Test: Simply comparing BigNumber to String works, but WHY?

texts:
Reading from this post, one should not use toNumber() when working with uint256, so when writting the below test, I was expecting it to crash, but it does not, instead it runs to success! why ?
  it("lottery amount should reflect previous two entries", async () => {
    const result = await contract.totalAmount();
    assert.equal(result, web3.utils.toWei("0.2")); // why we can compare BigNumber to string?
  });

web3.utils.toWei("0.2") is string, where result is BigNumber. So how can we simply compare them in an assert?


texts: How can I connect to the local Rocksdb instance used by my parity node?

texts:
I want to see everyones balances, and eventually try to create a realtime visualisation of the state. If I have a node with 10 GB of disk space used by the db, I understand this is Rocksdb taking up the space yeah? About 9,500 MB presently.

Possible to do?
Default root password for the database then is.... ? What is a good client to connect with? Thanks in advance internets!

1864    ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/overlayrecent/db
1872    ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/overlayrecent
1206348 ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/snapshot/restoration/temp
4598188 ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/snapshot/restoration/db
5804540 ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/snapshot/restoration
3694172 ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/snapshot/current
9498716 ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d/snapshot
9500592 ./.local/share/io.parity.ethereum/chains/ethereum/db/906a34e69aec8c0d
9500596 ./.local/share/io.parity.ethereum/chains/ethereum/db


texts: How does the oracle judge whether the request has been attacked by a man in the middle

texts:
The oracle machine can initiate a request to the data source whose URL is the HTTP link address. How does the oracle machine determine whether the HTTP request has been attacked by a man-in-the-middle, such as whether the returned result has been tampered with by a man-in-the-middle?
Hope you can help me! Thanks!


texts:
In the geth console attached to localhost:

  debug.traceTransaction("Transaction hash"); ReferenceError: 'debug' is
  not defined     at :1:1


texts: Quorum PrivateFor Not Working in Web3 - From Account Address to Smart Contract Address

texts:
I am using Web3 to send a transaction to a smart contract address. The public transactions are working OK. However, when I use the PrivateFor parameter in the web3 call, the transaction is still sent to the nodes but not working correctly.

Is this a configuration issue or web3 does not support for PrivateFor transaction as yet?

Thank you.


texts: Can an Ethereum payment be split 90% & 10% between two wallets

texts: I'm setting up a site where my client wants all ETH donations to be split between him and his designer. Is it possible with the user only making the payment to one Wallet? And the payment being filtered upon arrival?


texts:
kindly let me know is that necessary to make use of metamask,my etherwallet or mist with truffle while making coin for ICO launching

Thanks
waiting for your valuable reply


texts:
I know that handing out your private key is like handing over your wallet and say "help yourself", but...

if I had register my public ETH address on some unknown smart contract (like sending a "transaction data" with MetaMask using 0 ETH), is it possible for the smart contract to withdraw/transfer ETH or any tokens from my wallet like a bank's debit order?


texts: Where can I find the source code for Quorum, the permissioned implementation of Ethereum supporting data privacy?

texts: Where can I find the source code for Quorum, the permissioned Go implementation of Ethereum supporting data privacy?


texts: What are the commands for windows power shell to make a testnet. I require steps to set up testnet in private network in Windows OS.


texts: why is need of mapping if same work done by using array in struct?

texts:
I muddle up with mapping use with struct.
this smart contract I used  array instead of mapping

pragma solidity ^0.6.*;
contract MyContract{
    //here we can not assume the length off array so need counter on couter we can fatch data from index (counter)
  Person[] public people;
  uint256 public peopleCount;
    struct Person{
        string _firstname;
        string _lastname;
    }

    function addPerson(string memory _firstname,string memory _lastname) public{
        people.push(Person(_firstname,_lastname));
        peopleCount +=1;
    }
}

And In this program I used mapping and both give me the same result. Can anyone tell me what is the difference.


texts: I think I have to edit the gaslimit on geth genesis file, how do I do it?

texts:
I am getting an error for exceeding gas limit.

I checked current block gas limit by running - eth.getBlock("latest"). It is set to 5000.

I want to increase this, but I have no idea how to.  I have checked this old thread: Can't send transaction -- "Exceeds block gas limit" or "Intrinsic gas too low"

It says I should edit the genesis file, but how?


texts: ERC20 How to transfer the balance to a new address

texts:
I want to call the ERC20 contract with other contracts and transfer the corresponding balance to the contract caller.
What should I do?


texts:
I want to store some data in smart contract and then decrypt it on chain. Pseudocode:

contract EncryptedData {
   bytes data;
   string public decryptedData;

   constructor(bytes data_) public {
      data = data_;
   }

   function decrypt(bytes key) public {
      decryptedData = decryptDataSomehow(data, key);
   }
}

I know that when contract gets called the entire network gets the key and I'm fine with it.

The question is only "how can I decrypt data on chain"? I googled a lot but I didn't find any cryptographic primitives available. Only some EIPs like EIP-213 and so on, but nothing specific.

I'm not cryptographic PhD to implement cryptography myself (and it probably would burn bazillions of gas) so I need some builtins tools or at least already tested contracts.

What are my options here? I can't do it offchain because the entire idea of the whole thing is trust that only smart contract could have. I can't call oracles or something, the entire thing should be completely on-chain.

Edit: I actually have a little bit different situation. My contract is more like

contract EncryptedData {
   bytes[] data;
   string public decryptedData[];

   function addData(bytes data_) {
       data.push(data_);
   }

   function decrypt(bytes key) public {
       for (uint i = 0; i < data.length; i++) {
           decryptedData.push(decryptDataSomehow(data[i], key));
       }
   }
}


texts:
I'm using nethermind client.

The client is running on VM with using VMM of Synology NAS(model:ds918+).
The NAS is installed 14GB HDD, 1TB read/write SSD caches, 4core cpu(Intel Celeron J3455).
OS on VM is ubuntu server 20.04.

However, it seems to be too slow syncing.
See the following screen shots.

I'm not familiar with nethermind console messages, but are the number 0kB/s - 13kB/s on console normal?
I didn't any change configs.

When I was using Geth on the same machine(OS on VM is ubuntu desktop 18.04), it was syncing normally.
So I think the machine spec meets requirement.

Please let me know if anyone knows the cause. It's also a good idea.


texts: Can smart contract send tokens/eth if it doesn't have a send function?

texts:
Let's assume you just created 1,000 tokens at address 0x012345.
You, the owner of 0x012345 sent by mistake all tokens and 1ETH to a smart contract with address 0x987654.
This smart contract doesn't have a 'pay tokens' or 'send ethereum' function and it's pretty basic like that:

pragma solidity ^0.5.1;

contract simpleSmartContract{

 address public inventor;
 string public message;

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

 function changeMessage(string memory message_) public returns(string memory)
 {
     message = message_;
     return message;
 }

}

Can this contract use your tokens or Ethereum sent to it and maybe forward it to the owner? (assuming the smart contract has been already deployed and can't be modified)


texts:
Let's say you have a Smart Contract which allows users to enter in a list by paying 0.05 ETH

How would you implement the front-end / what framework would you choose?

For example, I saw someone who said that ideally would be to use React, a javascript library to build interfaces.

Any other options that are available? Could the Smart Contract be integrated by writing native javascript? I am really confused to be honest, mainly because I still have to understand what my next step is


texts: how to easily transfer ERC20 token from 1000+ accounts which has no ETH in it initially?

texts:
I have a requirement to have 1000+ ethereum addresses, which in fact used to store small amounts of various ERC20 tokens. I want to move all these crypto assets in all these 1000+ wallets into a single address.

If I could create a pool account with a single private key, it was the best method, but based on my current understanding on ethereum, I believe that its not possible with ethereum. Every address is associated with another private key.

Now, note that all these 1000+ account has no ethereum in it. So in order to transfer ERC20 token to a common account, I need to transfer ETH In first to these 1000+ accounts for Gas Price for the ERC20 token transfer for each of these accounts.

Which means I need to trasnfer IN ETH to account for Gas, then trasnfer out ERC20 token to the pool account with the small amount of ETH transferred in.

Though it might work, it seems to be very complicated and a lot of ETH unnecessarily being wasted for Gas while I am still in control of all these 1000+ accounts.

Is there any better or easier way for me? Like exchanges do? How can I internally transfer without a Gas price? Or is there a way (even a complicated way) that I can have a pool account having single private key with multiple addresses?

Can anyone help?

Thanks,


texts:
Can I use strings as identifiers in a Solidity mapping?

I want something like this:

contract C {
    mapping(string => mapping(address => uint)) public balances;
    string[] public tokennames;
    mapping(string => uint) public tokennameIndex;
}

Each string will represent a different token balance. The list of tokens will be maintained (add, edit, remove, reorganize) by an admin account. One alternative for this is to use different contracts for each token, but a 2-D mapping somehow seems easier, given that storage will not be too big. Also it removes the need for a list of contract addresses. Does such an indexing make sense? Thanks!


texts: Is it possible to create a DApp that uses Bitcoin, Lumen, etc over the Ethereum BlockChain?

texts:
I'm a total newcomer to Ethereum, so please forgive me if my Question has been answered before.

I'm trying to build a DApp that allows users to "import" their current Bitcoin for example, and spend it using my DApp. Is this generally possible?

If you could also point me in the right direction of where to start, links, articles, etc. I'd deeply appreciate it!

Kind Regards,


texts: Create new Ethereum accounts and store them in the node using JSON-RPC

texts:
I want to develop a website where each registered user can generate new Ethereum address, send their coins and later exchange them into other coins. I want to implement the following functionalities:

Generate new Ethereum address when the user wants and store the keys into my Ethereum node giving the user better user experience and allowing them to withdraw their funds at any time.
Generate the new account over JSON-RPC if it is possible and secure. I asked this in this link and read a lot of posts telling that it is an insecure way but I don't really understand the reason why. I am newbie to Ethereum environment but I want to start the development of my project and I haven't any other problem in start with another way different from JSON-RPC if it is secure and I can store accounts into my node

I think that maybe I am not understanding something about Ethereum environment because I don't see a secure and easy way to do it. And if I am not wrong, Coinbase works in that way: they generate, save the ethereum wallets and the user just need to send or withdraw their money; so there must be a way to do it. If someone could guide me on how to get started, how to use geth for that purpose or a library would be grateful.


texts:
I am trying to run test cases in sol-unit for Solidity, but when I compile my code with solc compiler I get an error. I don't think the error is critical, but there is very little material on net about it:

  demotest.sol:13:9: Error: Member "assertNotEqual" not found or not visible after argument-dependent lookup in uint256 demo.getX().assertNotEqual(TEST_VAL, "Values are not equal");

contract Demo {

    uint _x = 0;

    function setX(uint x){
        _x = x;
    }

    function getX() constant returns (uint x){
        return _x;
    }
}

import "./Demo.sol";

contract DemoTest is Demo {

    uint constant TEST_VAL = 55;

    // Test method starts with 'test' and will thus be recognized (2).
    function testSetX(){
        Demo demo = new Demo();
        demo.setX(TEST_VAL);

        // Assert methods bound to type. Assertions will automatically fire off a test event (3).
        demo.getX().assertNotEqual(TEST_VAL, "Values are not equal");
    }
}


texts: library, not found or visible after argument-dependent lookup in type

texts:
I am trying to understand libraries and I keep running in to
"not found or visible after argument-dependent lookup in type".

pragma solidity ^0.4.17;

library L{
    struct S{
        uint UI;
    }

    function GetLF(S storage R)external returns(uint LOutP) {
        return R.UI;
    }

    function SetLF(S storage R,uint LInP)external {
        R.UI=LInP;
    }
}

contract C{
    using L for L.S;
    L.S LS;

    function setCF(uint CInP)external {
        L.SetLF(LS,CInP); //<-------error
    }

    function GetCF() external returns(uint COutP){
        return L.GetLF(LS); //<-------error
    }
}

it always happens when trying to use a library function in a contract.

I am thinking it might be a problem with remix because I encountered it with
this code.
http://solidity.readthedocs.io/en/develop/contracts.html#libraries

pragma solidity ^0.4.11;

library Set {
  struct Data { mapping(uint => bool) flags; }

  function insert (Data storage self, uint value)external
      returns (bool)
  {
      if (self.flags[value])
          return false;
      self.flags[value] = true;
      return true;
  }

  function remove(Data storage self, uint value)external
      returns (bool)
  {
      if (!self.flags[value])
          return false;
      self.flags[value] = false;
      return true;
  }

  function contains(Data storage self, uint value)external
      returns (bool)
  {
      return self.flags[value];
  }
}

contract C {
    Set.Data knownValues;

    function register(uint value)external {
        require(Set.insert(knownValues, value));//<-----error
    }
}

so I am looking to understand cause of this error and understand library keyword better.

I suspect because they lower the one time deployment cost but add to the many time gas operating cost. that they are mostly just for factory pattern type stuff where deployment becomes a many time cost.


texts: Combined Token + Crowdsale vs Seperate Token and Crowdsale contracts

texts:
I have just discovered that you can do both a combined smart contract that includes both the token and the crowdsale OR have the token in a separate contract from the crowdsale contract.

Can anyone tell me what the advantages are to either of these methods please?

Many Thanks,

Phil.


texts: what is difference in ethereum transaction after constatanople upgrade?

texts: I have heard that Constantinople update transverse the consensus protocol of ethereum from proof of work to proof of stake. So they claimed that this update could speed up the TPS(transaction per second).if the above update is working.how can I achieve this?


texts: What ports do I need to open when setting up a mining pool

texts:
I am setting up a pool as a VM on my home computer using the instructions provided by https://github.com/sammy007/open-ethereum-pool/
I have followed the instructions and managed to get a test miner connect to it in the local environment but I am having issues connecting an external test miner. Also externally I am getting the Stats API not available message. Locally the page loads fine.

I have mapped the following ports
84 maps to 80 (My isp won’t allow 80)
8888
8008
8084 (I have to change the api port as 8080 was being used)
8545 (I understand opening this is a security risk but I am not sure)
6379
Are there any other ports that I need to open allow the pool to work?


texts: How to make sure no one can withdraw Ether from your smart contract?

texts:
I'm playing around with Solidity and now I'm coding my own "ICO".
Followed this tutorial:

  How to build your own Ethereum based ERC20 Token and launch an ICO
  in next 20 minutes

and things worked fine. But I've seen a lot of articles online how a smart contract is drained from a hacker or how funds are forever locked.

How to make sure only you can access the funds from your ICO?


texts: Could I clone an SSD to another rig and start mining out-of-the-box on Rig B?

texts:
Hypothetically, could I just migrate the contents one SSD to another and mine on Rig B immediately? I found some information at https://radu.cotescu.com/migrating-your-ubuntu-machine-to-a-ssd-drive/

Will this work, assuming the size of the second SSD is same size or larger?


texts:
I have a snapshot of an ETH daemon that is running fine. I tried created another instance of this daemon from this snapshot. Its been running for about 8 hours now and still not synced.
This is the result from the eth_syncing method
{"currentBlock":"10863131","highestBlock":"10863227","knownStates":"100391","pulledStates":"58998","startingBlock":"10780620"}
Can anyone give me any insight into why it's taking this long?
Also calling eth_blockNumber gives me 0.
I'm running Geth 1.9.21-stable
Any help will be appreciated.
Thanks


texts: Why does truebit/dogethereum need to play the "verification game"?

texts: Why do we need to find out exactly where in the scrypt hashing the verification failed? Why not say "the proof of work is incorrect, do not send a dogetoken" and that be the end of it?


texts:
I deployed ethereum pool, i can connect and send valid share to  pool but always the page show Stats API Temporarily Down

my config.json

{
        "threads": 2,
        "coin": "eth",
        "name": "main",

        "proxy": {
                "enabled": true,
                "listen": "0.0.0.0:8888",
                "limitHeadersSize": 1024,
                "limitBodySize": 256,
                "behindReverseProxy": false,
                "blockRefreshInterval": "120ms",
                "stateUpdateInterval": "3s",
                "difficulty": 2000000000,
                "hashrateExpiration": "3h",

                "healthCheck": true,
                "maxFails": 100,

                "stratum": {
                        "enabled": true,
                "listen": "0.0.0.0:8008",
                        "timeout": "120s",
                        "maxConn": 8192
                },

                "policy": {
                        "workers": 8,
                        "resetInterval": "60m",
                        "refreshInterval": "1m",

                        "banning": {
                                "enabled": false,
                                "ipset": "blacklist",
                                "timeout": 1800,
                                "invalidPercent": 30,
                                "checkThreshold": 30,
                                "malformedLimit": 5
                        },
                        "limits": {
                                "enabled": false,
                                "limit": 30,
                                "grace": "5m",
                                "limitJump": 10
                        }
                }
        },

        "api": {
                "enabled": true,
                "purgeOnly": false,
                "purgeInterval": "10m",
                "listen": "127.0.0.1:8080",
                "statsCollectInterval": "5s",
                "hashrateWindow": "30m",
                "hashrateLargeWindow": "3h",
                "luckWindow": [64, 128, 256],
                "payments": 1,
                "blocks": 50
        },

        "upstreamCheckInterval": "5s",
        "upstream": [
                {
                        "name": "main",
                        "url": "http://127.0.0.1:8545",
                        "timeout": "10s"
                },
                {
                        "name": "backup",
                        "url": "http://127.0.0.2:8545",
                        "timeout": "10s"
                }
        ],

        "redis": {
                "endpoint": "127.0.0.1:6379",
                "poolSize": 10,
                "database": 0,
                "password": ""
        },

        "unlocker": {
                "enabled": false,
                "poolFee": 1.0,
                "poolFeeAddress": "",
                "donate": true,
                "depth": 120,
                "immatureDepth": 20,
                "keepTxFees": false,
                "interval": "10m",
                "daemon": "http://127.0.0.1:8545",
                "timeout": "10s"
        },

        "payouts": {
                "enabled": false,
                "requirePeers": 25,
                "interval": "120m",
                "daemon": "http://127.0.0.1:8545",
                "timeout": "10s",
                "address": "0x0",
                "gas": "21000",
                "gasPrice": "50000000000",
                "autoGas": true,
                "threshold": 50000000000,
                "bgsave": false
        },

        "newrelicEnabled": false,
        "newrelicName": "MyEtherProxy",
        "newrelicKey": "SECRET_KEY",
        "newrelicVerbose": false
}

what i can do? thanks


texts: using web3.eth.filter against geth - will I get only confirmed transactions?

texts: When using web3.eth.filter, will I be getting only confirmed transactions back?


texts: Solidity: Is there a way to get the timestamp of a transaction that executed?

texts:
Is there a way for a contract to be able to get the exact time someone called a function in it?

For example, if someone sends funds to the contract address, is there a timestamp recorded by the blockchain that would give the received time of this transaction?

And if so, how would I get this value in Solidity and would the timestamp of this transaction be modifiable by the user in any kind of way once it is sent?


texts: Is it possible for a function to wait for another users approval?

texts:
I have a simple function in contract x that subtracts a value from contract y, is it possible to have contract x send a message to the user of contract y and set a condition that untill user confirms the activity the contract does not execute?

Thank You


texts: Our vendor created the IPFS and Ethereum platform to store the PDF documents. How do i use the same code in Desktop Application

texts:
I am a quiet layman in IPFS and Ethereum. Our vendor created the web application which stores the documents IN IPFS (Ethereum). Now, we do need to do the same in the desktop application also. Unfortunately, our vendor is no longer supporting on this.

Kindly help, what we should refer in the web application and how to build the same logic in the desktop application in order to follow the solution as written in the web application for IPFS / Ethereum decentralized documents management.


texts: Why contract are used for bot purpose instead of use their eth address directly?

texts: Each time i see bot frontrun it's a contract address. Why it's a contract address ? People who use bot are not able to use their ethereum address directly ? or there is a benefit to use contract address maybe ?


texts:
I've completed my truffle Dapp, the contracts are deployed to the Ropsten test network and my web code talks nicely to them, it works great from http://localhost:8080/ when I do an npm run dev.

I now want to put it onto a live webserver, still connected to Ropsten, no code changes, just the built code that is running on localhost in my browser.

How do I do a build for deployment to a webserver?


texts:
I would like to understand how the Ethgasstation algorithm works. I did not find its explanation of reasoning.
I found the explanation of another algorithm that looks like Ethgasstation but not exactly that of Ethgasstation.
Thank you.


texts: value does not get registered in solidity contract

texts:
I have deployed a contract RegisterContract

pragma solidity ^0.4.0;

contract RegisterContract{

struct RegStruct{
    uint regno;
    string name;
    string dob;
    uint contact;
}

RegStruct[] private regStruct;
uint Index;

function set(uint _regno,string _name,string _dob, uint _contact) public
returns(uint Index){
    Index=regStruct.length;
    regStruct.push(regStruct(_regno,_name,_dob,_contact));
}

function getCount() public constant returns(uint count) {
    return regStruct.length;
}
function get(uint Index) public constant returns(string name,uint regno,string dob){
    return(
        regStruct[Index].name,
        regStruct[Index].regno,
        regStruct[Index].dob
    );
}
}

when i register details by calling set() it works fine(i think so because when set() is called transaction take place in metamask ). But when i call getCount(), which shows number of entries in the contract, return 0.
is it because the set() doesn't work properly?
can someone help me

JS code:

<script type="text/javascript" src="/web3.js/dist/web3.js"></script>
<script type="text/javascript">
var Web3 = require('web3');
    if (typeof web3 !== 'undefined') {
        web3 = new Web3(web3.currentProvider);
    }
    else {
        web3 = new Web3(new Web3.providers.HttpProvider("http://192.168.1.103:8545"));
    }

var MyContract = web3.eth.contract([ { "constant": false, "inputs": [ {"name": "_regno", "type": "uint256" },{ "name": "_name", "type": "string" }, { "name": "_dob", "type": "string" }, { "name": "_contact", "type": "uint256" } ], "name": "set", "outputs": [{ "name": "Index", "type": "uint256", "value": "0" }], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "getCount", "outputs": [ { "name": "count", "type": "uint256", "value": "0" } ], "payable": false, "type": "function" }, { "constant": true, "inputs": [ { "name": "Index", "type": "uint256" } ], "name": "get", "outputs": [ { "name": "name", "type": "string", "value": "" }, { "name": "regno", "type": "uint256", "value": "" }, { "name": "dob", "type": "string", "value": "" } ], "payable": false, "type": "function" } ]);
var MyContractInstance=MyContract.at('0xB5eCAd99ba935C0F30Df08AAaFDAED3c7a0E641c');
function insert()
{
    MyContractInstance.set(document.getElementById('regno').value,document.getElementById('name').value,document.getElementById('dob').value,document.getElementById('cntct').value,{ from: web3.eth.coinbase},
    function (err, result) {console.log("result1 : "+result);});
  alert("Registered ok");
  parent.location='home.html';
}

MyContractInstance.getCount(function (err, cnt_result){
    console.log("result1 : "+cnt_result);
    len=cnt_result;

    console.log("length:"+len);
    for(var i=0;i<len;i++){
        MyContractInstance.get(i,function (err, reg_result){
            console.log("result2 : "+reg_result);
            var table = document.getElementById("myTable");
            var row = table.insertRow(myTable.rows.length);
            var cell1 = row.insertCell(0);
            var cell2 = row.insertCell(1);
            var cell3 = row.insertCell(2);
            cell1.innerHTML = reg_result[0];            //name
            cell2.innerHTML = reg_result[1];        //regno
            cell2.innerHTML = reg_result[2];
        });
    }
});

</script>


texts:
hey i was wondering is it random time to get shares while mining eth depending on my pc power and pool im on because im mining on asia1.ethermine.org and i dont know if im meant to get shares quickly or it just takes a bit of time
Another question is what is the best server to mine on when your from Australia


texts:
I think that I can verify a hash of a message using my signature within a Solidity contract, something like this:

contract ecrecover {
    function testRecovery(bytes32 hash, bytes signature) returns (address) {
    bytes32 r;
    bytes32 s;
    uint8 v;
    assembly {
      r := mload(add(signature, 32))
      s := mload(add(signature, 64))
      v := and(mload(add(signature, 65)), 255)
    }
    if (v < 27) v += 27;
    address addr = ecrecover(hash, v, r, s);
    return addr;
    }

I am unclear how to generate the hash or signature given my message and private key. For example, say my message is the string: I am Eric

My account data are:

address: 0x9858EfFD232B4033E47d90003D41EC34EcaEda94

Private Key: 0x1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727

How would I generate the hash and signature of my message?


texts: Failed to unlock account *account number* (no key for given address or file)

texts:
I've been at this for hours, I can't figure out what to do. So some years ago I created an ethereum address using geth. Between then and now, my PC was swiped due to some software problems, and now I'm trying to access my address. I've reinstalled geth, chocolatey, etc.. as per the instructions on their website. I am not 100% sure that I used these programs the first time around, however commandlines etc sound very familiar, so I'm almost sure that these were the programs I used to create my address.
I'm currently trying to do this:
geth account update (address)
Which prompts me to insert password. No matter what I type at this stage (I could just hit enter, or random letters etc..), I get the phrase in the title,
Failed to unlock account account number (no key for given address or file).
Does anyone know what I'm doing wrong?? Getting very frustrated at this, I can't understand what to do, and obviously it means that I'm currently without access to my account..
Thanks so much for any help, appreciate it.


texts: What exactly got stored in a ethereum block?

texts: In Bitcoin blockchain, a set of transactions got stored in the block.In the ethereum blockchain, what is stored in the block? Where is the smart contract stored?or Whether the ethereum block contains both set of transactions and smart contract? Need Clarifications...I am a beginner


texts:
Im following this documentation to implement an application that I pick a file with an input tag

<input id="upload" type="file" />

and im tyring to upload using web3 js :

 document.querySelector('input#upload').click();
    let inputElement = document.getElementById("upload");
    inputElement.addEventListener("change", handleFiles, false);
    function handleFiles() {
       let fileList = this.files; /* now you can work with the file list */
       definedFile = fileList[0];
       web3.bzz.upload({data: definedFile}) // could also be "directory" or "data"
                .then(console.log);
    }

The problem is , my return value is being false.

I've already tested my web3.bzz uploading a local file like :

web3.bzz.upload({
        path: "/path/to/my/file",      // path to data / file / directory
        kind: "directory",           // could also be "file" or "data"
        defaultFile: "/test.png"}) // optional, and only for kind === "directory"
        .then(function(hash){
            console.log("Uploaded :" , hash);
        })
        .catch(console.log);

and it worked beautifully.

It swarm able to upload buffered files?


texts: Geth synchronization shows no smart contracts

texts:
I synchronized my ethereum node using the command

geth --syncmode "fast"

Now I wanted to access a smart contract, e.g. the one of OmiseGO. Unfortunately this is not found. I tried web3 and also a WebGUI etherparty/explorer. Both didn't find anything. No contract address at all. However it found the corresponding transaction, that created the smart contract.

For web3 I used the following code:

var code = web3.eth.getCode('0xd26114cd6EE289AccF82350c8d8487fedB8A0C07');

The code was always 0x which represents that the contract is not present.

Is it because of the syncmode fast that these kind of things are not stored?


texts: How do I find out how big the chain structure is for a particular block?

texts:
I'm downloading the blockchain from scratch, and it's been stuck at 2442432 for a couple of hours now.

The chain structure keeps on downloading though. Is there a way to find out how much of that is left before the blocks continue?


texts: Estimating gas cost of a transaction function with web3

texts:
I am trying to use the estimateGas function in Web3 to estimate how much gas it would cost to run a function in my contract. As an example of how this would normally be used, in geth I can run a command like the following and get something back (21001):

web3.eth.estimateGas({from: eth.accounts[0], to: "0xEDA8A2E1dfA5B93692D2a9dDF833B6D7DF6D5f93", amount: web3.toWei(1, "ether")})

However, running the same command on a webpage with web3 (eg. trying the following):

console.log(web3.eth.estimateGas({from: eth.accounts[0], to: "0xEDA8A2E1dfA5B93692D2a9dDF833B6D7DF6D5f93", amount: web3.toWei(1, "ether")}))

Will result in this error:

  eth is not defined

I am having trouble getting this to work in any case. For example, say in my contract I have the following function:

function SetMessage (bytes32 _message) returns (bool success) {
    message = _message;
    return true;
    }

Which may be executed in Web3 as follows:

MyContract.deployed().then(function (contractInstance) {
      return contractInstance.SetMessage(_message, { gas: 200000, from: web3.eth.accounts[0] })
    })

What would be the exact syntax to estimate the gas of sending a transaction to this function?


texts:
Here is what I did.

Created a Ubuntu 16.04 VM on Windows using Hyper-V
ubuntu-16.04.3-server-amd64.iso
Did apply the Virtual switch for internet access for the Ubuntu VM
Ubuntu got installed with no issues
Did installed apt-get, ssh etc dependencies
Using putty was able to connect from windows host
After connecting did install Docker CE, Docker Machine, Virtualbox

Docker version

 Client:
    Version: 17.09.0-ce
    API version: 1.32
    Go version: go1.8.3
    Git commit: afdb6d4
    Built: Tue Sep 26 22:42:18 2017
    OS/Arch: linux/amd64

Server

Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: f4ffd25
Built: Tue Oct 17 19:05:23 2017
OS/Arch: linux/amd64
Experimental: false

docker-machine version

 docker-machine version 0.13.0, build 9ba6da9

Created the Monax virtual box and installed Monax
Created a chain with this command
monax chains start firstchain
The chain seems to get started perfectly
monax ls

SERVICE ON VERSION
keys  0.17.0
CHAIN ON VERSION
firstchain  0.17.0
On invoking below command faced error as listed below

monax pkgs do --chain firstchain --address $addr

Error:
Error connecting to node (tcp://172.17.0.3:46657) to get chain id: Post http://172.17.0.3:46657: dial tcp 172.17.0.3:46657: getsockopt: no route to host

Can you please highlight what is wrong.


texts:
thx for the post.
I had a few questions.
When running this command:

geth account new

Does this create a wallet?

What if I have a hardware wallet and do not want to use a software wallet, is it possible?

Also after running C:\> geth --rpc
How long do I have to wait?  It seems I have been waiting over 10 hours and its still processing something.  Is this normal?

Thx


texts:
I'm trying to create an account through Node.js. This is my code:

export async function createNewAccount() {
    var web3Instance =  new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
    return web3Instance.eth.accounts.create();
}

But I'm getting the following error (from 'create' function):

  Invalid JSON RPC response: undefined

I have installed web3.js in my project.

What other step have I missed?

BTW opening the browser on address "http://localhost:8545" returns 404. Is there anything I need to install in order to make it work? Is that the testrpc?

Notice that I want to work against the real blockchain, not a test one.

Edit:

As suggested by Karthikeyan, I downloaded and started geth. I don't know if it's actually working, it looks like this:

But I keep getting the same error when I try to create an account.


texts: Constructor set the account to the first trasaction address

texts:
I,m trying to block the call to the getOrigin function to accounts that are not equal to the account that is set in setOrigin function.

Now the first account that call to setOrigin is the unique that can call and see all the information of all the new values.

How can I change the constructor account value in each call that I do to the contract??

pragma solidity ^0.4.24;

import "browser/DateTime.sol";

contract Travel {

address private owner;

modifier isOwner
{
    require (owner == msg.sender);
    _;
}

struct TravelStruct
{
    //Origin
    address clientAddress;
    string originAirportName;
    uint32 originTime; //In timestamp
    uint16 originBagWeight;
    //Tape
    uint32 tapeArrivedTime; //In timestamp
    //Plane
    string flyCode;
    uint32 takeOffTime; //In timestamp
    //Destiny
    string destinationAirportName;
    uint32 destinyTime; //In timestamp
    uint16 destinyBagWeight;
}

mapping(uint => TravelStruct) travels;
uint public travelsRegistryCount;

constructor()
{
    owner = msg.sender;
    travelsRegistryCount = 1;
}

//  ORIGIN PART
function setOrigin (string _originAirportName, uint32 _originTime, uint16 _originBagWeight) public
{
    travels[travelsRegistryCount].clientAddress = owner;
    travels[travelsRegistryCount].originAirportName = _originAirportName;
    travels[travelsRegistryCount].originTime = _originTime;
    travels[travelsRegistryCount].originBagWeight = _originBagWeight;
    travelsRegistryCount++;
}

function getOrigin (uint _id) isOwner public constant returns (address, string, uint32, uint16)
{
    return (travels[_id].clientAddress, travels[_id].originAirportName ,travels[_id].originTime ,travels[_id].originBagWeight);
}
}

The problem that I have is that the constructor parameters are setted in the fist time that I call to a function. But my idea is to renew the constructor parametes each time that the call is made from another account.

Is that possible??


texts: Is there a way for contracts to share balances?

texts:
I am looking for a way for people to be able to send ethers to two contracts (two different address). But I need the balance between these two contracts to be shared. So that one contract can use the other's fund and vice-versa. Is that possible to implement?

Alternatively, would it be possible for the same contract to have two different address that users can send money to that will perform different tasks?


texts: How to use the Ledger Nano S hardware wallet without installing Chrome?

texts:
How can I use the Ledger Nano S hardware wallet with FOSS only and hence without having to install Google Chrome on my Debian machine?

I'd like to use for it ethereum and altcoins.


texts: how can the smart contract auto update contract status for every 1st of each month?

texts:
I am new to etherum blockchain.

I am working on designing the contract for payment money.

The customer must pay money for rent space for every 1 month, or the contract will be invalid.

How can my smart contract check that payment is not paid for every moth? and then update status of that contract automatically?


texts:
I am just a new learner and was trying to replicate the steps from a video (https://www.youtube.com/watch?v=tonsx0O_InA) introducing solidity as follows:

pragma solidity ^0.4.0;

contract DumbCoin1{

    address deployer;
    mapping(address=>uint) balances;

    function DumbCoin1(){

        deployer = msg.sender;

    }

    function giveCoins(uint amount, address receiver){

        if(msg.sender == deployer){
            // give coins to receiver
            balances[receiver] += amount;
        }
        else{
            throw;
        }

    }

    function viewBalance() returns (uint){

        return balances[msg.sender];

    }

}

However, after I clicked the button 'publish on swarm', and tested the giveCoins and viewBalances functions. seems that error occurs as belows:

creation of DumbCoin1 pending...
[vm] from:0xca3...a733c, to:DumbCoin1.(constructor), value:0 wei, data:0x606...e0029, 0 logs, hash:0x02a...50bae
Details
Debug
transact to DumbCoin1.viewBalance pending ...
[vm] from:0xca3...a733c, to:DumbCoin1.viewBalance() 0x692...77b3a, value:0 wei, data:0x3ff...1e05b, 0 logs, hash:0x923...1aaaf
Details
Debug
transact to DumbCoin1.giveCoins errored: Error encoding arguments: SyntaxError: Unexpected token x in JSON at position 7

What is the reason for the failure and how should I fix it?

Thanks so much!!


texts:
Today I downloaded Parity for Windows.
Start it with parity --author 0x9999999999999  --rpc --rpcaddr 192.x.x.1 --rpcport 8545.

Then I have started ethminer  ethminer -G -F 192.x.x.1:8545

When I go to parity's interface I see the best block sync with etherstats, but no commit on next block. Why?

Thanks a lot.


texts:
The specifications are changing much faster than i had thought in this space. I have implemented MVP for my project, and by the time I had completed - the community was discussing Plasma Cash. I feel this is pretty late to ask this question, but still...

What are the real advantages of Plasma Cash? I see here that Karl mentions the main benefits. However i feel the costs seem to be more than just
Large token denominations.

Doesn't it cost us the following?

Micropayments. One time small payments become hard or impossible. Especially where probablistic payments aren't relevant.
Requires a change exchange. A large entity who has a lot of coins of lot of different denominations. This entity could charge aribtrarily to return change. It feels like a cost to need a third party to make a payment - especially for offline payments.
Moving a lot of computation & storage to clients. This might sound like a BCH argument, but wouldn't most of the nodes performing the validations be sufficiently large computation devices (laptops, servers)? For low end devices (think India, Southeast Asia, Africa), a few MB of storage is pretty uphill, especially if you are receiving a lot of low value transactions that have changed hands hundreds or thousands of times. Even if the monitoring is delegated to a third party, the exits seem to be costlier than MVP

In contrast, the MVP especially because of the UTXO model didn't seem to have this complication. It had a confirm message requirement which added some complexity, but can be overcome by requiring a maximum block number for inclusion.

I'm still trying to understand what is leading to the movement to Plasma Cash, especially since Joseph Poon 'declared' on a Plasma Implementers call that Plasma cash is now the new Plasma.

Meta questions :

Is Plasma Cash a true replacement to Plasma?
What are the usecases that either are more suitable for?

Is there something fundemental i'm missing?
I felt it was too late to ask this question on ethresear.ch, apologies! :(


texts: It seems extremely expensive when storing struct type.

texts:
In my contract, there is a struct type:

struct Claim{
 address healthcareProvider;
 uint amount;
 bool patientSig;
 bool paid;
 uint item;
}

And the initialize function is:

 function MakeClaim(uint _amount, uint _item, uint num) {
   Claim memory c;
   c.healthcareProvider = tx.origin;
   c.patientSig = false;
   c.paid = false;
   c.amount=_amount;
   c.item=_item;
}

When I call this function to create a new Claim type, I find the price is 2.687 ETH (not gas). This is much more than the cost for deploying the entire contract! I am testing it on the Morden test net. Where is my problem?


texts:
The yul documentation states:

No “else” block can be defined.

It seems really weird. Yul has much more complex control flow schemes like loops and switches. Also other EVM languages like Solidity support the else blocks and they compile to EVM's jump opcodes just fine.
What's the reason behind this design decision?


texts:
pragma solidity ^0.4.24;

contract User {
    mapping(uint=>address) addresses;
    uint addressRegistryCount;

    function set(address userAddress) public {
        addresses[addressRegistryCount] = userAddress;
        addressRegistryCount++;
    }

    function get(address userAddress) public view returns (uint) {
        for (uint i = 0; i <= addressRegistryCount; i++) {
            if(addresses[i] == userAddress)
                return i;
        }
    }

    /*function getAll() {

    }*/
}

In this contract I have a function called getAll. Inside that function I´m trying to return the full mapping of users. How can I make that?


texts: As of 2020, what are the community-trusted desktop cold storage wallets?

texts:
I'm looking to transfer some ETH from markets to a wallet. I see MyEtherWallet.com has a way to be run in a cold storage environment. However, the fact that they're Twitter account got hacked makes me wonder about their security. I also read some of the team left and made another product, which is fine, but sort of makes me feel uneasy about the fate of both products involved.
I also saw Atomic Wallet recommended in some places, but I discovered that it is not fully open source.
geth seems to be trickier to setup. It also requires one to have the full ledger locally, if I'm not mistaken.
So what's a good software to secure funds WITHOUT spending on hardware wallets? (I don't trust them because the hardware may break and then you're done)


texts: How to get 'defaultAccount' by Nethereum?

texts:
I'm using Chrome with Metamask extension. When I change the account, eth.coinbase value is always set to current one, so I can do the assign in JS code:

web3.eth.defaultAccount = web3.eth.coinbase;

But when I create a Web3 object in C# code and connect to the same node, coinbase value is always the same. Selected account address does exist in eth.accounts array, always with index greater than 0. Is there any way to get selected account address using Nethereum?


texts: ConsenSys/MultiSigWallet how do I call addOwner()

texts:
I'm using the ConsenSys/MultiSigWallet but I'm struggling to add an additional owner to the wallet.

I've read in the source code that an addOwner() call has to be sent by wallet, but I'm unsure how to sign a transaction sent by the wallet as the wallet has no private key.

What should I enter for the Key Password in the screen shot below?


texts: How to deploy a simple hello world smart contract on mist platform with 0 ethers

texts:
pragma solidity ^0.4.11;

contract raman {
    address owner;
    /* Constructor */
    function raman() { owner = msg.sender; }
    function kill() { if (msg.sender == owner) selfdestruct(owner);}
}

contract greeter is raman {
    /* Define variable greeting of the type string */
    string greeting;

    /* This runs when the contract is executed */
    function greeter(string _greeting) public { greeting = _greeting; }

    /* Main function */
    function greet() constant returns (string) { return greeting; }
}

// The above code is working fine, but what to do next and how to deploy it in the blockchain.

I want to just implement a simple smart contract right now in the blockchain I will kill it afterwards.

I have created a wallet with 0 ethers, in mist itself, is it possible to deploy this smart contract with 0 ethers??


texts: How do I set up a private ethereum network?

texts: I'd like to set up a local (private) blockchain that isn't connected to the wider internet so that I can deploy some test contracts. How do I go about doing that?


texts: Get the input data of a transaction with web3j

texts:
How can I retrieve transaction details (including the input data) from a txHash using Web3j?

I tried the following method:

public void buscarHhash(Web3j web3, String txHash) throws IOException {
    String inputdata;

    EthSendTransaction ethSendTransaction = null;
    Request<?, EthTransaction> transactionReceipt = web3.ethGetTransactionByHash(txHash);
    transactionReceipt.send().getTransaction()
            .ifPresent(tx -> {
                inputdata = tx.getInput();
            });
}

This method does not seem to work, and I don't know if I'm doing it right.

Does anyone know how to do it? Not necessarily with the method that I used.


texts:
Is there a tool to generate a solidity code from the ABI interface?

const Ballot = [{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"delegate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"winningProposal","outputs":[{"name":"winningProposal","type":"uint8"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"voter","type":"address"}],"name":"giveRightToVote","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"proposal","type":"uint8"}],"name":"vote","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_numProposals","type":"uint8"}],"payable":false,"type":"constructor"}]

Should result into something like:

contract Ballot {
  function Ballot(uint8 _numProposals) {}
  function giveRightToVote(address voter) {}
  function delegate(address to) {}
  function vote(uint8 proposal) {}
  function winningProposal() constant returns (uint8 winningProposal) {}
}


texts: In the case the Zerofunctionselector bug, how to know which function NAME has a 0 selector?

texts:
Normally, If a smart contract is not affected by the Zerofunctionselector bug, then at the end of the code which makes jump to the target function lies a 0xfe opcode (which result in the smart contract execution to throw).

But if the opcode is not present, then, the first function in the opcode is executed even if it wasn’t declared payable.

How to get actual contract opcode from a deployed address ? How to map those opcodes to source code lines of the contract ?
And can the Zerofunctionselector bug results in private or constructor function to be executed ?