texts: ropsten: insufficient funds for gas * price + value using web3

texts:
Im using "web3": "^1.0.0-beta.37"

And I want to understand How can I send rawTransaction

My code is:

const pk = 'xxxxxxx';
const rawTransaction = {
    "to": "0xa53709839ab6Da3ad9c1518Ed39a4a0fFCbA3684",
    "value": web3.utils.toWei('1', 'wei'),
    "gas": 2000000,
    "chainId": 3
};
let signedTx = await web3.eth.accounts.signTransaction(rawTransaction, pk).catch(console.dir);
let sendTx = await web3.eth.sendSignedTransaction(signedTx.rawTransaction).catch(console.error);

My account has 4Eth (on ropsten) and my httpProvider is ropsten (using infura)

but I get this error

  Error: Returned error: insufficient funds for gas * price + value

I follow:

https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=signTransaction#signtransaction

and then

https://web3js.readthedocs.io/en/1.0/web3-eth.html#eth-sendsignedtransaction


texts: Testing contract withdrawal pattern with Truffle

texts:
I'm trying to write a test in Truffle to test the following Solidity code:

function withdrawFunds() {
    uint funds = withdrawals[msg.sender];
    withdrawals[msg.sender] = 0;
    msg.sender.transfer(funds);
}

I'm running into trouble working out how to check whether the sender has received the correct amount of Ether stored in their withdrawals map, especially taking into account gas cost.

My current attempt to test withdrawing 1 ether.

let seller = accounts[1];

let initialBalance = web3.eth.getBalance(seller);

let withdrawal = await token.withdrawFunds({ from: seller });

var finalBalance = web3.eth.getBalance(seller);

let gasCost = getTransactionGasCost(withdrawal["tx"]);

finalBalance.minus(initialBalance).minus(gasCost);

assert.equal(
  finalBalance,
  etherToWei(1),
  "Funds were not credited to withdrawer."
);

getTransactionGasCost looks like this:

function getTransactionGasCost(tx) {
  let transaction = web3.eth.getTransactionReceipt(tx);
  let amount = transaction.gasUsed;
  let price = web3.eth.getTransaction(tx).gasPrice;

  return new BigNumber(price * amount);
}

However, at the moment running truffle test gives this error:

 Error: Invalid number of arguments to Solidity function
  at Object.InvalidNumberOfSolidityArgs (/usr/lib/node_modules/truffle/build/cli.bundled.js:43290:16)
  at SolidityFunction.validateArgs (/usr/lib/node_modules/truffle/build/cli.bundled.js:329518:22)
  at SolidityFunction.toPayload (/usr/lib/node_modules/truffle/build/cli.bundled.js:329534:10)
  at SolidityFunction.sendTransaction (/usr/lib/node_modules/truffle/build/cli.bundled.js:329607:24)
  at SolidityFunction.execute (/usr/lib/node_modules/truffle/build/cli.bundled.js:329700:37)
  at /usr/lib/node_modules/truffle/build/cli.bundled.js:318086:16
  at Promise (<anonymous>)
  at /usr/lib/node_modules/truffle/build/cli.bundled.js:318052:18
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

It seems that the call to token.withdrawFunds is causing the error, but I'm not sure why as the function should take no arguments. Am I approaching this test as a whole in the correct way? Any help is very appreciated!


texts:
I am getting this crash:

go.Universe$proxyerror: invalid transaction v, r, s values
    at org.ethereum.geth.EthereumClient.getBlockByNumber(Native Method)

for this call:

ethClient.getBlockByNumber(App.ethereumContext, -1).number

This happens with

compile  group: "org.ethereum", name: "geth", version: "1.5.7-SNAPSHOT"

unfortunately not always and I did not yet find a way to reproduce it - but perhaps somebody else already stumbled upon this and has some pointer on what the problem is here. I am just syncing / reading chaindata there currently - I do not change state there at all ( so no transaction or contract deployment when this happens).

Update: also happens with 1.5.8-SNAPSHOT


texts:
For three days I've been trying to sync a full node. Syncing the last two days has taken about six hours a day. At this rate I won't be able to sync it. It's behind "age=3y8mo5d".

This is the command I used:
geth --datadir /media/internal-2tb/eth --syncmode full

Why is it taking so long? Is there a way I can speed it up so it syncs in a reasonable amount of time?


texts: How do we use block.number (as opposed to block.timestamp) for measuring time?

texts: I've heard block.timestamp can be manipulated by miners, and as I am writing a contract that uses block.timestamp in crucial functions, I am wondering how best to mirror its behavior using block.number


texts:
From the global context:  msg.gas (uint): remaining gas

I want to understand when and how this global context variable gets updated. In Remix I ran a fallback function multiple times in a row but it never seemed to change msg.gas ...

Remaining in what sense? Total available for this user? The amount remaining for this particular transaction?  What remains after the transaction is completed or before?  What if you check it in a function foo() that is just about to call function bar() which also costs gas ? what is its value inside each function? and when exactly does it get changed?  Where exactly are these global context variables stored?


texts: Difference between transfer/transferFrom and approveAndCall in cost

texts: Which of these functions cost less, computationally and in terms of gas usage?


texts: Manually setting transaction fee when transacting using geth

texts:
I am using geth to transfer some ether to another account.
After geth attach to my node, I just do is the following
personal.unlockAccount(eth.accounts[0])

eth.sendTransaction({from:eth.accounts[0], to:'0x....', value: web3.toWei(0.05, "ether")})

In a transaction I did a few days ago I paid 0.00168 Ether ($2.30) transaction fees. The transaction was confirmed in under a minute, so I want to to manually reduce the transaction fee if I am not in a rush to get my transaction confirmed.
In this post I see that you can set the gas price to any value you want by supplying a gasPrice argument in eth.sendTransaction(). I also now check in ethgasstation.info that a "standard" gas price is 114 Gwei. I also see in the documentation that the units of gasPrice is wei.
My question is how would I put my desired gas price in my sending transaction? I don't want to make a big mistake with units and drain my whole account by paying huge fees! Would I put something like
eth.sendTransaction({from:eth.accounts[0], to:'0x....', value: web3.toWei(0.05, "ether"), gasPrice:114e9})

?


texts: truffle: ParserError: Expected identifier but got 'payable' address payable []array; ^-----^ Compilation failed

texts:
While compiling in truffle I got an error because of payable modifier. If I remove payable then there's no error. But I want to use payable. Can anyone please help me?

error:

truffle(develop)> compile
Error parsing /contracts/test.sol: ParsedContract.sol:3:13: ParserError: Expected identifier but got 'payable'
    address payable []array;

contract is:

pragma solidity >=0.4.0 <0.6.0;
contract test{
    address payable []array;
}


texts: Not possible to connect to the Web3 provider

texts:
I have a problem connecting my url to my quorum node.

I already make sure the node has an account, I run it without problem but I have that error

enter image description here

enter image description here


texts:
After playing around with eth-lighwallet library I have a security related question.

How does one securily store a user password in a browser?

Imagine a situation where a user provides a password and it's used by eth-lighwallet to sign transactions.

On the one hand, an application can prompt user for password every time eth-lightwallet needs it. While it's kind of safe, it's a bad user experience.

On the other hand, an application can save a password in a variable/localStorage/sessionStorage and use it on whenever needed basis.

The second scenario seems insecure, because some malicious script can retrieve this password and do whatever it wants, like transfer funds and stuff.

If only there was a  way to store user password in user's browser, so that javascript could set it, but not get it. And the only way to get it was to use a special button that guarantees that the click is coming from a user's mouseclick and not some script.


texts: How should we set a import path in solidity?

texts:
I failed to compile a solidity file with import statement.

  Error: Source not found: File not found.
  import './contract.sol';

How should we set a import path?

I used web3.js for compiling.

  web3.eth.compile.solidity(data);

Layout of a Solidity Source File — Solidity 0.2.0 documentation
http://solidity.readthedocs.org/en/latest/layout-of-source-files.html


texts: Suggest me tutorial for Dapps and solidity programming

texts:
I am new to learning solidity programming and dpps development. Please share the fine tutorial for both.

Hope get the fine answers...


texts:
Is there currently any way to do confidential transactions with Ethereum for a custom token?

If not, is there any work/research being done on how this might be possible?


texts:
What happens when a smart contract gets several similar calls in the same block?

Consider for instance this greeter:

contract greeter {
    string name;

    function setName(string name_) {
        name = name_;
    }

    function getName() constant returns(string) {
        return name;
    }
}

What happens if Bob, Alice and Eve all call the Greeter at the same time and all three calls are in the same block? Does everyone get the proper response with their own name? Does the contract get run three times?


texts: network port udp:30303 could not be mapped: no UPnP or NAT-PMP router discovered

texts: I keep getting this error and cannot start my geth client anymore. Google searched for awhile couldn't bring me to any working solution. Do you know how to resolve this?


texts: account recovery with web3 privateKeyToAccount()

texts:
I'm currently stucked by this strange thing:
I started by exporting my private key(fdba67e41f7c6767100969ae3f045d10a59e35d380acf5b37a3b208bd2969347) from my metamask account, which i can use to login with MEW without problem (and gives me the address 0xa6CDA44CEA3Ac87435d9fDF548B051dDE90D128F):

But when I use the function web3.eth.accounts.privateKeyToAccount() with this private key as input, it's not creating an account with the corresponding public key as address.

var account_1_priv = 'fdba67e41f7c6767100969ae3f045d10a59e35d380acf5b37a3b208bd2969347';

var acc = web3.eth.accounts.privateKeyToAccount(account_1_priv);
console.log(acc)

>>> { address: '0xaF6d10CbEcd036f713cA504d3e952F2A31845EB9',
privateKey:'fdba67e41f7c6767100969ae3f045d10a59e35d380acf5b37a3b208bd2969347',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt] }

The new address showned here became 0xaF6d10CbEcd036f713cA504d3e952F2A31845EB9.

Same thing with the sign function

I need to sign a transaction locally with my private key privKey, and I used it in the following way: (last line with the sign function from web3.eth.accounts)

var account_1_priv = 'fdba67e41f7c6767100969ae3f045d10a59e35d380acf5b37a3b208bd2969347';
var hashdata = "0x2ff5a3650ca0391b59cf6614820cac78fd7564302c5614349990117b21df0eeb";

var result = web3.eth.accounts.sign(hashdata, account_1_priv)
console.log(result)

>> { message: '0x2ff5a3650ca0391b59cf6614820cac78fd7564302c5614349990117b21df0eeb',
messageHash: '0x5c9aac8744ec24ede5fc8e3125cf4e388d14afb8e809575fdd9477ecee44db33',
v: '0x1b',
r: '0x93291c697b8e30350f93e7b13e27b6dd232d6d4d9cb5edb8a32c06554ed2bafd',
s: '0x79f2d63e1225f4f7d4f0caff85f5af39599b8630c81abd9b758ad1915b001b49',
signature: '0x93291c697b8e30350f93e7b13e27b6dd232d6d4d9cb5edb8a32c06554ed2bafd79f2d63e1225f4f7d4f0caff85f5af39599b8630c81abd9b758ad1915b001b491b'
}

but later when I want to verify the public key with hashdata, v, r, s on solidity with ercrecovery like this:

  ecrecover(bytes32 hashdata, uint8 v, bytes32 r, bytes32 s);

I got the output of 0xaF6d10CbEcd036f713cA504d3e952F2A31845EB9, which is the same as the privateKeyToAccount() gave me, but different from my metamask account. Am I using any of these functions wrong? how can I sign the message correctly  with a private key on behavior of my metamask account? I was thinking about maybe the problem is related to the HD wallet structure, but haven't found any related topics yet.


texts:
I try to setup a private network containing three nodes (bootnode, sealer, transaction node with rpc) and PoA. So far so good.
The thing is I don't want to have any ether nor do I want to pay any gas for transactions since I only use the network to create contracts and interact with them (used it as a fancy database), so I don't need an actual currency.
I used geth to setup the three nodes and as long as I have ether in my system (accounts are funded and I pay the gasprice) all works fine. But as soon as I try to set the accepted gasprice for the sealer node via the --miner.gasprice=0 and don't fund my accounts the transactions are not put to the blockchain anymore.
I'd be very happy if there is a solution to this.
Cheers


texts: Combine BytesX and BytesY to create BytesZ?

texts:
I am working on a Solidity Smart Contract (^0.5.10) where I want to return an array of Ratings elements.

struct Ratings {
    address restaurant
    uint8 score
};

Since returning Rating[], string[], and bytes[] from functions is still experimental, I was attempting to compress the struct into a byte22[] and return that in a serialized format. But I don't know how to combine byteX objects into another byteX object.

I have 3 variables like so:

bytes20 address_string = BytesUtils.toBytes(restaurant.experience);
bytes1 separator = bytes1(";");
bytes1 rating = BytesUtils.toBytes(review.rating);

How can I combine them to create a byte22?


texts: Is there a difference between the terms TestRPC and Testnet?

texts:
From what I understand, a testnet is just a local (or private) blockchain for developers to experiment on, and TestRPC is/was a specific implementation of a testnet for the Ethereum blockchain?

(I say 'was' because it appears Truffle absorbed TestRPC)


texts: How to define a function inside a truffle contract test

texts:
Is that possible to define a function inside a truffle contract test?

There is a repetitive yet complicated step in truffle test scenario I am working on and wondering would it be possible to organize the code and put the repetitive steps to boilerplate function.

My knowledge in ecmascript is limited. All I tried ended up with different errors.

    roundStart(); //TypeError: Cannot read property 'roundStart' of undefined
    this.roundStart(); //TypeError: this.roundStart is not a function
    this.game.roundStart(); //TypeError: Cannot read property 'roundStart' of undefined

Here is the code snippet:

// assume the code runs with no error except the call of roundStart()

contract('SpaceDefense', function ([_, owner, newOwner, player1, player2, hero, stranger]) {

  function roundStart() {
    it('start the round', async function () {
      //..
    });
  });

  describe('pot and pot withdrawal functions by owner', function () {
    it('the pot must match with initial transfer', async function () {
      (await this.game.pot()).should.be.bignumber.equal(100);
    });
    //...

    roundStart(); //TypeError: Cannot read property 'roundStart' of undefined
    this.roundStart(); //TypeError: this.roundStart is not a function
    this.game.roundStart(); //TypeError: Cannot read property 'roundStart' of undefined

    //....
    it('pot withdraws must not allowed during the game', async function () {
      await assertRevert(this.game.potWithdrawTo(1, owner, {from: owner}));
    });
  });
});


texts: Why does fabdep keep asking to open port 111 even if it is open?


texts: I sent my presale wallet to the main account of my Mist Eth Wallet using MyEtherWallet.com. It said it sent and my presale wallet is empty but it has not showed up on my Mist wallet yet. Also it says TEST-NET on the top left. Do I have to get out of the TEST-NET before i can see my sent ETH? If so how to I do that? Thank you


texts: How can I prove my friend having changed just one word in the seed and have it lay around is super insecure?

texts: My friend said to me that he has his seed saved in Google Drive and that he is absolutely safe even if someone found it out. He even gave me his seed to try to break it. I know that all I have to do is brute-force each word in the seed from bip-39 list, so I just need 2048 * 24 (it's 24 word seed) iterations. How can I do that? How can I send a request to the mainnet and check if the seed is valid? Thanks.


texts:
I'm playing with "The Graph" example counter project. If all I do is change the contract address in the mapping.ts to the same Counter contract on Rinkeby, then try to deploy, I get this error:

Error deploying the subgraph: Internal error: Could not pick index node

My mapping.ts:

specVersion: 0.0.1
description: A simple counter
repository: https://github.com/graphprotocol/example-subgraph
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum/contract
    name: Counter
    network: rinkeby
    source:
      address: '0xe740d90c98cbe1f23acdc0b65ac34750f6523b9b'
      abi: Counter
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.1
      language: wasm/assemblyscript
      entities:
        - Counter
      abis:
        - name: Counter
          file: ./abis/Counter.abi
      eventHandlers:
        - event: Incremented(uint256,uint256)
          handler: handleIncremented
      file: ./src/mapping.ts


texts: Attaching crypto to a message stored on IPFS

texts:
I want to send a message to another user and attach some eth with this message with the condition that the receiver should only be the person who can claim that crypto.
Step1:Write a message, store it on IPFS and get the content hash.
Step2: Store this hash against the recipient address in the smart contract.
Step3: Send the desired crypto to a smart contract function REDEEM which will only give away the crypto if the signed hash of the content will be made available.
Step4: Recipient checks the smart contract and sees all the messages that have been shared with him and fetches their content hashes.
Step5: If he wants to redeem the crypto attached to a particular message, He will sign the message and send it to the REDEEM function of the smart contract.
Step6: REDEEM function checks two things, if the content hash does belong to the recipient and if yes, If the message signature is valid or not. If yes, Transfer the crypto to the recipient.
My question is: Does the signature even required to check if the content hash belongs to the recipient or not?


texts: What algorithm is used to encrypt a private key?

texts: In my understanding, private keys are encrypted with some symmetric algorithm, so you can't access them without passphrase. What is it called?


texts: Remix IDE: How to manually input an address for test in the correct way?

texts:
I'm using remix to practice and learn Solidity. Sometimes I need to pass an argument of type address type to a function manually using GUI provided by remix. But whatever address I insert, syntax error shows up.
However, if I hard code, I can use something like:

 address a=0x123;

But I cannot insert 0x123 into the box provided by the browser.

Question: What address format should I use to pass it to a function manually in remix?


texts: How do I check whether a storage variable is "empty"?

texts:
How do I check whether a storage variable is "empty", i.e., no value has been assigned to it, or the value has been deleted?

For a string, I'd convert it to bytes and check for length 0. And for uints, I'd check whether it equals 0.

But what about structs (or other types that I haven't mentioned) ?


texts:
I know I've seen a list of peers in the Parity UI before but now I don't remember the URL.  I'm going to kick myself when someone sends this link.

Can anyone tell me what I'm missing?


texts: Can anyone help guide on running two geth clients on the same box and same network?

texts:
I am working on Mac OSX. I have the CL tools installed and I can start one geth client on a private network. Mining works. Wallet features work. I am able to successfully mine eth and deposit it into the primary/default account of Geth1.

Then I run another instance of geth. Same network id, same genesis JSON, different data directory. I removed the runtime rpc flags. I am unable to get the Geth2 client to connect and mine on the same network.

NodeInfo on Geth1 and Geth2 shows the IP address as null. I'm not sure where that is supposed to be populated or if it is the culprit.

Can anyone provide a pointer what I might look at next to make the second client connect to the network started by the first?

Here is the command line for each:

Starting console:

geth --genesis /Users/myuser/ethereum/TestNetOne/TestNetOne-Genesis.json --nodiscover --maxpeers 3 --datadir "/Users/myuser/ethereum/TestNetOne" --identity "TestNetOne" --networkid 21863 --rpc --rpcport "8080" --rpccorsdomain "" --port "30304" --rpcapi "db,eth,net,web3" console

Second console:

geth --genesis /Users/myuser/ethereum/TestNetOne/TestNetOne-Genesis.json --nodiscover --maxpeers 3 --datadir "/Users/myuser/ethereum/TestNetOne/data_dir1" --identity "TestNetOne" --networkid 21863 console

The second console also has a static-nodes.json in its data_dir with the following:

[
"enode://482238402e50522795112b309891111ce933d20ebebee712c687a3ea3479f8b441532019bd99a6451549fa82e4134215664eb550323043040242e67c15684c63@127.0.0.1:30304",
]

That enode is the enode Id of the first geth process.

Thanks in advance!


texts: Mist started re-syncing and ethers are gone

texts:
I downloaded the  blockchain with geth --fast --cache=1024 option and size of my blockchain data after download of 2412706 blocks was around 10.9GB. I imported my accounts to keystore files and accounts appeared there, but ethers were gone. I restarted my wallet, and it started syncing again, still showing 2380606 blocks left, and my chaindata foder has reached around 11GB. Why is Wallet resyncing? And why Ethers are gone?
 I am using latest Ethereum wallet 0.8.6.


texts: How to limit transactions to only approve addresses?

texts:
I am dealing with a private consortium scenario (private Ethereum network) where all participants are known in advance and have assigned an addresses used in genesis. Like to know if its possible to limit the any transaction on the network to these addresses? Another way of saying it is if its possible to whitelist the addresses?

From technical side using geth 1.7.3 and all members in the consortium have permission to mine blocks so have full visibility into all transactions. Its just I don't know at the moment how to ensure reject transactions which are not in the genesis file.


texts: Can someone verify this answer: gasLimit vs. minGasLimit

texts:
I would have thought that these are the upper and lower bounds of how much gas can be used in any one transaction.  But the mainnet file has the same value for each of these.  Can someone explain what these values actually mean?

(Hint: please don't provide the same link to the same thread that fails to explain these.  I mean this one: What does each genesis.json parameter mean?)


texts: For a homework problem, I need to write a contract for a rock-paper-scissors game for two players who would deposit the same amount of money then the winner will get both deposits. I am new to Solidity and don't know where to start.


texts: Measuring elapsed time between user erc20 token transfers with lazy evalutation

texts:
So I'm learning solidity and wanted to make an erc-20 token after reading the solidity by example docs. Let's call the token T.

I would like to measure the elapsed time between two transfers of an arbitrary amount of T from the same erc-20 wallet ,and use this elapsed time later in the transfer function, for example charging a time based fee.

My idea was to store the value TimeOfTransferusing now somewhere (where ? I need a place where it can't be tempered with or frauded) , then substract it from the next nowcall at a future transfer, and thus get the elapsed time.

Also can this is done in a way that can't be gamed/faked while making the user pay for all gas ?

Maybe something like this. Should I add a if statement that controls at every transfer if it's the first or is there a way to store the time of the very first transfer of token T from that wallet ? If I return a 2-tuple (true, TimeofTransfer) in the transfer function, is it still an erc-20?

Sorry if this is overly specific, I couldn't find related answers.

function transfer(address to, uint tokens) public returns (bool success) {
    Elapsed = now - TimeOfTransfer
    TimeOfTransfer = now
    balances[msg.sender] = balances[msg.sender].sub(tokens);
    balances[to] = balances[to].add(tokens);
    emit Transfer(msg.sender, to, tokens);
    return true;
}


texts:
I've just tried the base program and mist for windows. and wanted to know if there is an "official" sort of app for android. i do not like trusting 3rd parties.

I could try the most popular open source. but core is better.

btw. I tried to google this but those are some hard keywords to find. sorry if this is a duplicate. although it might be good for new people like me.

Whats the most trustworthy way to get etc? coinbase ask all of my data... like that is going to work


texts: How to fix gas limit issue when doing official Ethereum Tutorial?

texts:
I'm trying to work on this tutorial for past three hours and I just don't understand why are there so many holes to do it.

  https://ethereum.org/greeter

It took me forever to figure out what it meant by:

var greeterFactory = eth.contract()

At the time of writing, I'm trying to execute the loadScript('greeter.js') but I am unable to because it keeps on throwing  Error: insufficient funds for gas * price + value

This should not be true because in my Genesis block, I've set the gas limit to 2000000000

So I decided to run miner.start() after setting the eth.coinbase to the account in concern [the account which eth.accounts[0]] and it's doing nothing but making my Ubuntu machine lag with I/O usage absolute maximum!

Secondly, I know I'm the test client and not live client because I ran the console as gth --datadir ./myDir --networkid 30304 console 2>>mylog.log

It's very frustrating and I'm not new to programming [relatively]


texts: How to publish in ethereum with "imports" ? or how to do?

texts:
Hello i have this question in my mind now :

  How to publish in ethereum with "imports" ? or how to do ?

why i say this ?

answer : when i wanna "verify and publish Contract Source Code" with a normal code without "import" the verify is successful

the problem : but when i try to do the same with a code has a "import" in the code , the "verify" fails and say me this error

Error! Unable to generate Contract ByteCode and ABI (Compiler Exception)

the abi is fine but i think they cant generate the bytecode for this warnning :

myc:9:1: ParserError: Source "MyToken.sol" not found: File import callback not supported
import './MyToken.sol'
^-------------------------^

i trying to solving but nothing works for me and i don't know what i need to read to solve this problem and publish my contract, if somebody have documentation for solve this problem please help me

i am searching that  errors but i don't see information to how solve them

here is a example of the running code

pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;

import './MyToken.sol';

contract test1 {

    /* Variables */
    MyToken isMyToken;

    /* Constructor to define things */
    constructor(MyToken _myToken) public {

        isMyToken = _myToken;

    }

}

thanks a lot for read


texts: How do you get casted uint division to work like literal division?

texts:
How do I get testDivCast() to return the same result as testDivLiteral()?

pragma solidity ^0.5.1;

  function testDivLiteral() external pure returns (uint16) {
    return (1 / 5) * 100;
  }
  // Expected: 20 | Result: 20

  function testDivCast() external pure returns (uint16) {
    return (uint16(1) / uint16(5)) * uint16(100);
  }
  // Expected: 20 | Result: 0


texts: Deployed bytecode size seems to mismatch contract code size

texts:
I See some very weird solc behaviour with regards to compiled bytecode size.
A much shorter contract compiles to bigger byte code.
short contract: compiles into 439 bytes.
while this longer one compiles into 129 bytes.
note that the longer contract includes the code of the shorter one plus some extra code.
not sure what am I missing.


texts: API call to get a list of all transactions sent TO a specific address (not contract)?

texts:
I have used the Etherscan API call "http://api.etherscan.io/api?module=account&action=txlist&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken" to get the list of all transactions sent by an account.
 However, I couldn't find one to get received transactions for an account.

Also, do these API calls return only the confirmed transcations? Or the pending ones too? If pending ones are also included, which of the following fields could be the status of the transaction:

blockHash
:
"0x6328ddeaef59621cdce67c801fea0e7d28815bf233b589c3c5c67896a47b1fd1"
blockNumber
:
"5842812"
confirmations
:
"111"
contractAddress
:
""
cumulativeGasUsed
:
"1687090"
from
:
"0x6a812b123eae1226d2426c6e8b7c0ffec550436a"
gas
:
"500000"
gasPrice
:
"1000000000"
gasUsed
:
"113191"
hash
:
"0xb17bfae7cb3048f41b0b463f8d5430cdfecc5303df9c619d5057d3b497f4268e"
input
:
"0xbe45fd62000000000000000000000000f4566cbdef5d1cfbce6ce0ab8fe62869a6050960000000000000000000000000000000000000000000000000000000001dcd65000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001094e7c38477db43f195b9016c97c0099000000000000000000000000000000000"
isError
:
"0"
nonce
:
"1323"
timeStamp
:
"1579782177"
to
:
"0x6fafb91cd63b4ec07e1d35a7bfd31df23e4a7aa2"
transactionIndex
:
"26"
txreceipt_status
:
"1"
value
:
"0"


texts: How to listen for contract events in JavaScript tests?

texts:
I'm trying to trigger events in my solidity contract to output some debug information in my javascript tests. However the events seem to get never caught.

That's the relevant contract code:

pragma solidity ^0.4.4;

contract CrowdFunding {

    uint public deadline;
    event DeadlineSet(uint deadline, uint timeNow);

    function withdrawal() returns(bool) {
        DeadlineSet(deadline, now);
        return true;
    }
}

Here's how I try to listen for the events in my JavaScript test file:

 var deadlineSet;
 deadlineSet = contractInstance.DeadlineSet({_from:web3.eth.coinbase});
 deadlineSet.watch(function(err, result) {
    if(err) {
        console.log(err);
        return;
    }
    console.log("Deadline " + result.args.deadline);
    console.log("Time Now " + result.args.timeNow);
    deadlineSet.stopWatching();
});

My tests are working fine and I can send money to the contract and call methods, but I never see any of the console outputs defined above.

Any help is appreciated.


texts:
I am on the lookout for a lean service that can discover and return all transactions for an address. The discovery should be for past blocks aswell as future ones.

With lean I mean something akin to a headless systemd service that serves raw and/or json transaction data per query.

Any pointers on recipes on how to strip down existing frills-rich tools to base service is welcome, too.


texts:
I downloaded the new ethereum wallet yesterday. I deleted everything in the folder: chain data, I resynced the whole blockchain aswell.

But now when I open the wallet, my balance shows zero... when I enter it's address on etherchain it shows the right balance... which is larger than zero.

Any help how to resolve this pls?


texts: What are the differences between Drizzle and the Truffle React box?

texts:
Truffle has many "boxes", two of which are:

truffle unbox react

And:

truffle unbox drizzle

They both seem to be focused on frontend development. Other than Drizzle being based on a Redux store, what are the differences between the two?


texts: Running the Rinkeby network using geth on Windows

texts:
I am following these instructions here to setup Geth on a Windows 10 system for running on the Rinkeby network.

In Step 3, there are two lines of code to run

geth --datadir=$HOME/.rinkeby init rinkeby.json
geth --networkid=4 --datadir=$HOME/.rinkeby --cache=512 --ethstats="yournode:Respect my authoritah!@stats.rinkeby.io" --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303 --rpc --rpcapi="personal,eth,network"

I ran the first line and it seems to be downloading the chain. What does the second line of code do? Do I run both lines at the same time??


texts: Can you use Ethereum to build a blockchain with a different proof mechanism?

texts: This may be a silly question but is it possible to build a system that can use both the euthereum proof of work/stake and a custom built proof using the same ethereum nodes?


texts: Windows 10 private net can't connect to the other peers, geth: 1.8.11

texts:
System information:

Geth version: Geth/1.8.11-unstable
OS & Version: WINDOWS10

I modified the main net Genesis config parameters in DefaultGenesisBlock in genesis.go,
and I replaced the MainnetBootnodes parameters with one line:
    enode://a4574b52d5ebc4414f1a55e656f66ca5647d891d5989e2bc3660141ec2c3fbed2dcd9bd50fc050915e3b8b96527f3fd9a8dfbcbdc9de3255fb948148ccd67603@192.168.2.210:30303

for learning Purpose.

Run geth.exe on 192.168.2.210 and 192.168.2.52.
The geth.exe on 2.52 can not connect to that on 2.210.
They are the same version that I build it. Cmd is "geth.exe console" with no other paras.
I've tried to use admin.addPeer() in geth and also failed.
net

{
  listening: true,
  peerCount: 0,
  version: "1",
  getListening: function(callback),
  getPeerCount: function(callback),
  getVersion: function(callback)
}


texts: Will it eventually become impossible to sync the chain with an SSD?

texts:
It seems that using a HDD to sync the node is no longer possible/recommended, and it seems this is because of the many active adresses. What if the number of active adresses increase? Will it eventually become impossible to sync with an SSD as well? And when might this happen?

Thanks and kind regards Soebgst


texts: Invalid transaction signature on sending transaction

texts:
Hello guys I'm having a "Invalid transaction signature." error. Can't get pass this one. Am I missing something?

client, err := ethclient.Dial("path/to/geth.ipc")
if err != nil {
    return err
}
ks := keystore.NewKeyStore("path/to/keystore", keystore.StandardScryptN, keystore.StandardScryptP)

to := common.HexToAddress("0x999b010976f0fb4d4e43646bc6c8fbd9ea7f5323")
from := common.HexToAddress("0x53a8368b7f6d140cdb5e0bf6dce0cbe9e6934430")
data := []byte("Lorem ipsum")
value := big.NewInt(10000000000000000)

gasPrice, err := client.SuggestGasPrice(context.Background())
if err != nil {
    return err
}

msg := ethereum.CallMsg{
    From:     from,
    To:       &to,
    GasPrice: gasPrice,
    Value:    value,
    Data:     data,
}
gasLimit, err := client.EstimateGas(context.Background(), msg)
if err != nil {
    return err
}

nonce, err := client.PendingNonceAt(context.Background(), from)
if err != nil {
    return err
}

newTx := types.NewTransaction(nonce, to, value, gasLimit, gasPrice, data)
networkID, err := client.NetworkID(context.Background())
if err != nil {
    return err
}

signedTx, err := ks.SignTxWithPassphrase(accounts.Account{Address: from}, "secret", newTx, networkID)
if err != nil {
    return err
}

if err := client.SendTransaction(context.Background(), signedTx); err != nil {
    return err // Error triggered here
}


texts: options to retrieve 24h transfer data between main DeFi protocols

texts:
I am trying to build a daily graph showing the transfers between the main DeFi protocols as well as some of their properties (for example, collateralization).  What are your recommendations for places to find and retrieve such data?
So, for example, if I want to know how much is transferred into Maker-DAO's multi-collateral DAI contracts coming from Uniswap, and the collateralization ratio of those Maker contracts ... is there some API or service that solves this problem?


texts: How to add ether balances to accounts in Solidity online compiler Javascript VM?

texts: Using the Solidity online compiler set to its own JavaScript VM, calling any function with ether in msg.value throws an exception. I don't see a way to add an ether balance to an address.


texts:
I'm having trouble understanding the difference between nested chains (Plasma) and sharding.

As I understand it now, Plasma creates a nested chain, periodically transmitting root hash state of the nested chain to the main chain while the nested chain deals with it's own logic without spamming the mainnet.

Sharding seemingly does a similar thing and the difference between them is not clear to me. Could you compare them, stating differences?


texts: web3 - how receive values from contract methods

texts:
I have a Solidity contract with a method that changes the state of the contract. This method normally returns a value. But web3 gives me txHash, net the return value. Do I have a way to receive that value?

myContract.incrData.sendTransaction(function (err, result) {
    var txhash = result;  // <-- I need return value, not the tx hash
})


texts: Is it possible to pay ICO consultants in the ICO's new currency?

texts:
I am working as a consultant on a new ETH based ICO campaign.

The arrangement is that they will pay me with their new tokens they are issuing through their ICO. The problem is, as far as I know, tokens are automatically paid through a smart contract to investors based on their ETH contribution.

I am wondering if there is anyway I can guarantee receiving the tokens? I have had to turn to stack overflow to get an answer, it is incredibly difficult to find relevant, reliable information online.

Are they able to transfer their tokens prior to their ICO to an ether wallet?

Any help would be appreciated!


texts: Constructor auto generation and property visibility

texts:
Suppose I have the folloing:

contract Owned {
    address owner;

    function owned() {
        owner = msg.sender;
    }

    modifier onlyOwner() {
        if (msg.sender == owner) _
    }
}

contract Example is Owned {
    function doSomething() {
        if (address == <some address here) <statement>;
    }
}

The above seems to work. So, I assume 2 things:

The compiler generates a default constructor for Example.
The address property is default-visible to child contracts.

About 1., what would happen if the parent constructor had arguments and I didn't declare it explicitly?

Would it behave like Java classes, copying the constructor signature to it's child and, therefore, making me pass the arguments when creating the contract?

Or Would it behave like PHP (older) classes, simply not initializing the property?

About 2., I've noticed that there is a public modifier for properties, but I'm not sure of what omitting such modifier defaults to.


texts:
Why are the sent time of these transactions constantly reset and why are they still pending after 14 hours?

Hello,

Yesterday I tried to send some test transactions from Metamask. One with 0.01 Gwei and one with 5 Gwei gas price. When I check on etherscan the sent time is constantly reset. So even today it still looks like they were sent five minutes ago or so. Also, they just keep pending, they never actually arrive in the other account.

https://etherscan.io/address/0x00c101e88d7f1382874d1a0013621479ed148933

What's wrong and how can it be rectified?

Vesa


texts: subscription not happen on geth+websocketProvider in web3

texts:
I have started geth node (connect to ropsten testnet) on my local OSX system.
Command: geth --testnet --fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303" --datadir data--ws --wsport 8546 --wsorigins "*" --rpc --rpcport 8545 --rpccorsdomain "*" --nodiscover --ws --wsport 8546

Geth node is not in block synchronization status

eth.syncing => false

Geth version : 1.8.11-stable

XXX-iMac:~ XXXXX$ geth version

Geth
Version: 1.8.11-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.3
Operating System: darwin
GOPATH=
GOROOT=/usr/local/Cellar/go/1.10.3/libexec

Web3 version:
"^1.0.0-beta.34"

Javascript code Running on Node environment

var web3 = new Web3(
    new Web3.providers.WebsocketProvider('ws://127.0.0.1:8546')
);

const contractAbi =[...];
const contractAddress = 'xxxxx';
const contractInstance = new web3.eth.Contract(contractAbi, contractAddress);
var res = contractInstance.methods.currentTicket.call((err, result) => {
    if (err) {
        console.log("error getting currentTicket", err);
    }
    else {
        console.log("success getting currentTicket", result);
    }
});

Here currentTicket is a variable containing an integer value.
Nothing is called, I looked for several github issues ticket and nothing helped me! Any kind of help will be appreciate!

UPDATE1:

I looked for below web3 issues ticket, but nothing helped me!
https://github.com/ethereum/web3.js/issues/989
https://github.com/ethereum/web3.js/issues/1093

UPDATE2:

Getting on front end works well.

async function callAsync(f, params) {
  if (!params) params = [];
  return new Promise((resolve, reject) => {
    f(...params, function(err, res){
      if (err) reject(err);
      resolve(res);
    });
  });
}
const contract = web3.eth.contract(contractAbi);
const contractInstance = contract.at(contractAddress);
currentTicket = (await callAsync(contractInstance.currentTicket.call)).c[0];


texts: Transfer contract address from truffle to meteor

texts:
I am very new to dApp-Development and therefore frankly i need some basic help.
How can i get the address of my deployed contract by truffle in meteor?
I hope there is a simple solution.


texts: Is it possible to calculate the gas costs of a transaction exactly upfront?

texts: In the Ethereum wallet there are the estimated gas costs. Why is it only an estimate? Is is possible to calculate the gas costs precisely upfront?


texts: why eth fund is deducted when sending tokens

texts:
I am testing on the Ropsten net.

I created the standard ERC20 token with the Token Factory. Then I sent some tokens to another ETH address with myetherwallet. What I found was that my ETH balance was deducted for the transaction fee. And the receiver could NOT send the tokens back because there was no ETH in his wallet.

So here is the question, does it behavior the same on the Main net?
And can the transaction fee come from token, to be specific, the ETH balance stays the same and the token balance is deducted for the transaction fee?
The main concern is that if it always deducts ETH balance, and as not all participants have ETH balance, how would the token circulate？


texts:
I want to create an ethereum wallet that is erc20 compatible on my client side.

It should allow user to enter his own password and generate private key, recovery phrases and utc file.

I try to research online and discover web3js and it seems that it cannot fulfill my requirement. Any reliable library ?

I am expecting something like Ethereum.generateWallet(randomKey, password) and it will do everything. It should be best done in client side using javascript.


texts: Is there any way to do dry run a smart contract on Ethereum Mainnet?

texts:
For testing my codes without side effects (e.g., consuming gas, etc.) on the development environment, I'm finding a way to execute a smart contract that interacts with other contracts deployed on Ethereum Mainnet. Is there any way to do dry run contracts in the same state on mainnet?

Finally, "ganache-cli --fork" did this job. Thank you for an answer and a comment.
$ ganache-cli --fork http://localhost:8545@1599200

  -f, --fork                Fork from another currently running Ethereum client at a given block. Input should be
                            the HTTP location and port of the other client, e.g. 'http://localhost:8545' or
                            optionally provide a block number 'http://localhost:8545@1599200'


texts: After truffle init I don't see MetaCoin.sol and other files expected to be there?

texts:
I have Truffle installed on an Ubuntu 14.04 LTS box.  Here are my Truffle and Solidity version numbers:

Truffle v4.0.6 (core: 4.0.6)
Solidity v0.4.19 (solc-js)

I am following along the Blockgeeks "How To Learn Solidity" tutorial:

https://blockgeeks.com/guides/solidity/

After running Truffle init, that guide and other tutorials I have seen on the Web say I should have the following files in the directories created by the Truffle init command:

contracts\ConvertLib.sol
contracts\MetaCoin.sol
contracts\Migrations.sol
migrations\1_initial_migration.js
migrations\2_initial_migration.js

I only have the files marked in bold.  The other files are missing.  Does anyone know how I get the other files?


texts: When does a SUICIDE opcode becomes effective?

texts:
The documentation (https://github.com/ethereum/wiki/wiki/Subtleties) states that SUICIDE becomes effective at the end of the transaction, but in block 116525, the same contract was able to SUICIDE three times in three distinct transactions:

0x7476afface26678a6c236618a7079db7ce567a213dc75652378f3580e1a10f28
0x51826f28e829cb9425dbd1c77a2c77484d04d8b02ccab05934e5885d313fbe91
0xa6c23583bba9139ca7e168328a2d15978d90dfdd61a6be697abbec1846b59e01

is it a bug that has since been fixed, or is a SUICIDE only effective after a block is complete?


texts: Calling a function on an existing contract

texts:
I'm trying to create a very simple proxy contract that forwards my transaction/call and nothing else.

So User A > transaction to P(roxy)C > Call to Contract (msg.sender = user A)

i've tried two ways to get this too work (low level call and abstract function), but I'm not sure what could be the problem here. This works locally, but not live.

 contract ContractProxy {
    address public _owner;
    address public _targetcontract;
    event CallContract(bool succes);

    function ContractProxy(address target) public {
        _owner = msg.sender;
        _targetcontract = target;
    }

    function callcontract(uint contractgas, address targetu, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) public {
        require(_owner == msg.sender);
        if(_targetcontract.call.gas(contractgas)(bytes4(keccak256("targetfunction(address,uint256,address,uint8,bytes32,bytes32,uint256)")), targetu, nonce, user, v, r, s, amount)){
            CallContract(true);
        } else {
            CallContract(false);
        }
    }

    function changetargetaddress(address newaddress) public {
        require(_owner == msg.sender);
        _targetcontract = newaddress;
    }}

I added the event to find out what's going on, but it appears to be false. The function name parameters and types appear to be correct, so I'm wondering what else could cause an error. So some questions..

Is call executed in the original context of the account calling the proxy contract?
How can I find out what the error for the underlying contract is? I suspect a gas issue, can I find out? Should I throw when the call returns false?
I read you need to be carefull when working with low level calls and return values.. could that be an issue here? The function doesn't actually return a value.
I am now trying to get this to work with an abstract contract. When I deploy this with mist, the code is valid, but I only deploy my proxy contract (with MIST) and feed it the real contract's address. From what I understand, that's how it's supposed to work? Feels a bit weird/like a trick, but I read that abstract contract is the way to go here. Thoughts?


texts: In the truffle console, how to set and get current account?

texts:
I'm using the $ truffle console.
I can see my available accounts using truffle(development)> web3.eth.accounts.

But when I run some smart contract code, which account is running the contract?

And, how can I change the account which is running the contracts in the truffle console?


texts:
I am installing the latest version of parity (1.4.1).  I created a new account and am syncing the chain.  I have two UTC keystore files from a older version of geth that I stopped syncing some time ago.

In the parity web gui I click on 'new account' then 'import accounts from geth keystore' but I am told that 'there are currently no importable keys from the Geth keystore, which are not already available on your Parity instance.

These keystore files are in my .ethereum folder and I have also tried copying them and putting them in the .parity/keys directory

Has anyone else has this problem or know how I can import these accounts into parity?


texts: I think I have a good idea for how to implement a token contract. How do I submit an ERC describing the protocol/API?


texts: how to authorize parity trusted signer in Chrome app

texts:
How can I authorize a trusted signer in Google Chrome Parity app?
I keep getting this message:

  Authorization token is invalid


texts:
I've got a very strang behaviour when running a oraclize call like in the following example:

class Test is Oraclize... {

  uint64[] timestamps;
  uint64[] numbers;

  function pushItem(uint64 number) {
    timestamps.push(uint64(now));
    numbers.push(number);
  }

  function sendRequest() {
    bytes bytesString = new bytes(...)
    // construct a json string for using as param for oraclize call
    // {"str": "<number1>,<timestamp1>,...<number n>,<timestamp n>,"}
    // e.g {"str": "1,1534703529,2,1534703544"}
    oraclize_query(3600, "URL", apiURL, string(bytesString), gasLimit);
  }

  function __callback(...
}

Now the functions are called like this:

await test.pushItem(1);
await test.pushItem(2);
await test.sendRequest();

I ran this code a lot of times without any problems. But one time my backend got a call from oraclize where the parameters are in wrong direction: {"str": "2,1534703600,1,1534703513"} Also the timestamps in the request were not included in my timestamps array.

The only explanation I have is that on one node test.pushItem(2); was mined before test.pushItem(1);.

Since rinkeby works a little bit different than mainnet I would like to know if this can happen and can my assumption be right?


texts: Transaction cancelled due to out of gas. How do i recover my ETH?

texts:
TXID
0x679d887dd23623c5477bffb62f854215b9736734c89b4579a6e9e1a93457a8c3

I sent with apparently not enough gas, it cancelled, but I still have not received the ETH back in my wallet.

How can I recover my funds?


texts:
Consider a getter function with a restriction on who can read it, like

function getData()
    public
    view
    returns (uint x)
{
    require(msg.sender = '0x123..123');
    x = data;
}

This prevents people from getting this data via Remix or from another contract unless its address is 0x123..123; the requester must know not just the address, but possess its private key.

Yet via web3.js, I can pull this by using

EthContract.methods.getData.cacheCall({ 'from': '0x123..123' })

Here I do not need the private key.

I was wondering if there was a way to call web3.js  programs within the blockchain, which would allow one to effectively get around the private key ownership requirement.


texts:
In Ethereum the terms "Contract" or "Smart Contract" are loosly used; "Smart Agent" might have been a better name [citation-needed]. Most smart contracts are certainly not legal contracts.

Now for a contract to be a legal contract there are certain conditions that have to be met, for example it needs to contain 4 elements:

  At common law, the elements of a contract are offer, acceptance, intention to create legal relations, and consideration.
  Source wikipedia

In an attempt to turn a "Smart Contract" into a legal one, how would you design these 4 terms? Bonus points for Solidity code snippets ;)


texts: Whats the best way of translating this struct?

texts:
Let's say I must have this data structure:

├── Operations (struct)
│   ├── date_begining (uint)
│   └── date_end (uint)
│   └── responsible (address)
│   └── type **(?)**
│          ├── Observation (struct)
│          |     └── Production units (string)
│          |     └── Parcel (string)
|          OR
│          ├── ObservationPrague (struct)
│          |     └── Fon state (bool)
│          |     └── Trapped (string)
|          OR
│          ├── ObservationDesiese (struct)
│          |     └── Other var (bool)
│          |     └── Some Other var (uint)
|          OR
│          ├── Logistics (struct)
│          |     └── Other var1 (bool)
│          |     └── Some Other var1 (uint)

So As you can see, I need a struct of operations that always have 4 keys:  date_begining, date_end, responsible and type. That ok until now. But now, my type should have one of the 4 following choices: Observation, ObservationPrague, ObservationDesiese or Logistics, that consequently have their own key/values too. So, what is the best way for me struct my "type". Is there a way I can say, "it's one of those four structs" in solidity lang? I thought of the enums, but concluded it couldn't be because then I wouldn't be able to have key/value pairs under the enum. Appreciate any help.


texts:
The Ethereum token tutorial has a check for a uint256 overflow.

function transfer(address _to, uint256 _value) {
    /* Check if sender has balance and for overflows */
    if (balanceOf[msg.sender] < _value || balanceOf[_to] + _value < balanceOf[_to])
        throw;

    /* Add and subtract new balances */
    balanceOf[msg.sender] -= _value;
    balanceOf[_to] += _value;
}

I haven't found references elsewhere to guarding against uint overflows or security flaws in contracts because of them. It seems like both would be common if this was an issue.


texts: Binance node - number of pending and queued transactions differs in local node and from binance.org

texts:
System information
Geth version: geth version
1.10.1-stable-c2d2f4ed
OS & Version: Windows/Linux/OSX
Linux
Expected behaviour
Get pending transactions from local binance node, match the result I get from https://bsc-dataseed1.binance.org
Get real pending transaction list
Actual behaviour
Number of pending transactions is much less than expected (~2000), number of queued transactions is much more than expected (~13000).
Example: local node does not give back new token listings on pancakeswap but data from https://bsc-dataseed1.binance.org seems valid.
Local node seems to be synchronized.
Steps to reproduce the behaviour
using web3 in python3.8
getting pending transaction filter id with 'eth_newPendingTransactionFilter' method (POST to local node or https://bsc-dataseed1.binance.org)
using 'eth_getFilterChanges' method with the pending filter id (POST to local node or https://bsc-dataseed1.binance.org)


texts: Why can't a contract wake up and run itself?

texts: This question is not about external solutions, but are there technical limitations to why a contract that has funds, can't schedule itself to run at a future block?  Could the Ethereum protocol have been designed to include this functionality and if so, what would it have involved?


texts: How to deploy a smart contract to actual ethereum network instead of Truffle or Ganache?

texts:
I am building a react application using web3 to interface with Ethereum. At a bare minimum, it needs to create a contract, deploy said contract, store a value (i.e. a string: "test"), then later retrieve that value.

All this needs to happen in the React application and on the ethereum network. No test networks, no outside tools to deploy the contract.

I can't seem to find a reference on how to accomplish this, for what is really a simple task. All tutorials I could find focus on Ganache or Truffle and use outside means to deploy the contract...


texts: Syntax Error: Type tuple(bool,bytes memory) is not implicitly convertible to expected type bool

texts:
I am trying to compile the following program:

pragma solidity ^0.5.1;

contract MKotET1_1{

    address payable king; uint public claimPrice = 100;

    function calculateCompensation() public returns(uint) {
    }

    function( ) external payable {
       if (msg.value  < claimPrice) revert();
           uint compensation = calculateCompensation();
           if(!king.call.value(compensation)("")) revert();
          king = msg.sender;
       }
    }

I am getting following syntax errors:

    solc MKotET_stackExchange.sol
    MKotET_stackExchange.sol:12:14: Error: Unary operator ! cannot be applied to >type tuple(bool,bytes memory)
              if(!king.call.value(compensation)("")) revert();
                 ^--------------------------------^ MKotET_stackExchange.sol:12:14: Error: Type tuple(bool,bytes memory)
    is not implicitly convertible to expected type bool.
              if(!king.call.value(compensation)("")) revert();
                 ^--------------------------------^

Somebody please guide me how to remove the above syntax errors.

Zulfi.


texts:
I have unboxed pet-shop. Then inside the contracts folder, I made a file Election.sol which has the code -

pragma solidity ^0.5.8;

contract Election{
    string public candidate;
    constructor() public{
        candidate = "candidate 1"; //state var

    }
}

Then inside migrations folder, I made 2_deploy_contract.js which has the code -

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

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

Truffle-config.js -

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*", // Match any network id
      from:"0xCAEf077F78ce851B21524363753b4A49a4a6D503",
    },
    develop: {
      port: 8545
    }
  }
};

When I do truffle migrate, I get this error. -
truffle migrate

Compiling your contracts...

  Everything is up to date, there is nothing to compile.

Migrations dry-run (simulation)

  Network name:    'development-fork'
  Network id:      1
  Block gas limit: 0x1388

1_initial_migration.js

Deploying 'Migrations'

Error: Error: Error:  * Deployment Failed *

"Migrations" ran out of gas (using Truffle's estimate.)
   * Block limit:  0x50e7c
   * Gas sent:     undefined
   * Try:
      + Setting a higher gas estimate multiplier for this contract
      + Using the solc optimizer settings in 'truffle-config.js'
      + Making your contract smaller
      + Making your contract constructor more efficient
      + Setting a higher network block limit if you are on a
        private network or test client (like ganache).

at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Truffle v5.0.22 (core: 5.0.22)
Node v8.10.0


texts: When trying to connect to a pool it says ethminer.exe is written wrong or wasn't found

texts:
So I started 2 days ago with farming eth and I wanted to join a pool. So I searched up a good pool, for me I chose Nanopool and looked at the tutorials on how to connect.
They say type this into your command console (windows 10 user):

  ethminer.exe -G -F http://eth1.nanopool.org:8888/(your adress)
  So I put my adress in:
  ethminer.exe -G -F http://eth1.nanopool.org:8888/0x664c9F5Ef393a53FcB58F7B26E6CcF1b272D3fD1
  But afterwards my cmd line says:

The command "ethminer.exe" is either misspelled or
could not be found.
But ethminer is running at the same time and geth is updating the chain constantly I don't know why this happened. Thanks for the help.
Andy


texts: How to scan ether transfer from smart contract to my addresses programmatically?

texts:
Correct me if I am wrong, the transaction receipt contains only the log of contract events. So we can only use it to examine the internal transaction that produces a event.

How about ether transfer inside a contract? More specifically when the contract calls the send or transfer of a Members of Addresses(#1).

Let’s say I have a large list of deposit addresses, is there any general way to detect ether transfer made from a contract (it can be any contracts written by others) by scanning a transaction?

1: http://solidity.readthedocs.io/en/develop/types.html#members-of-addresses


texts: Finding a better way to retrieve information about struct

texts:
I've run into a problem about getting information about the structs. The code is written below:

pragma solidity ^0.4.23;
contract Transport {

    address public manager;
    Batch[] public batchArray;
    mapping(uint => bool) batchList;

    struct Batch {
        uint batchId;
        string batchCreationDate;
        address batchOwner;
        string batchOrigin;
        string productName;
    }
    constructor(address owner) public {
        manager = owner;
    }
    function createNewBatch(string batchCreationDate, address batchOwner,
                         string batchOrigin, string productName) public {

        uint batchId = uint(keccak256(block.difficulty, now));

        Batch memory newBatch = Batch ({
            batchId: batchId,
            batchCreationDate: batchCreationDate,
            batchOwner: batchOwner,
            batchOrigin: batchOrigin,
            productName: productName
        });

        batchArray.push(newBatch);
        batchList[batchId] == true;
    }

    function getBatchDetails(uint batchId) public view returns(string, address, string, string) {
       //???
    }
}

After I created a batch and put it into an array, I want to have a function of getting the details about a certain batch by providing batchId. I can't figure out what I need to input in getBatchDetails() function. Would appreciate your help.

By the way, do I overcomplicate this code? If so, any ideas on how I can restructure it?

Thank you


texts:
I was looking over at https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork and I don't understand some of the parameters:

DATA, 32 Bytes - current block header pow-hash
DATA, 32 Bytes - the seed hash used for the DAG.
DATA, 32 Bytes - the boundary condition ("target"), 2^256 / difficulty.

Here are my questions:

Is the first parameter the hash of the whole block or just header?
(is transaction tree included)
Where does the seed hash come from? Is it deterministic? Is every miner receiving the same seed hash?


texts:
I have to create and transfer token using ERC 20.Inside the standard interface of ERC 20, we have function approve(address spender,using token) which inturn approves spender to take some token from (msg.sender).
My question is that can we specify some other account address which we wish to transfer from instead of (msg.sender)..?? (i.e can we pass an extra parameter for the function approve like approve(address owner,address spender,uint token)...??)


texts: Solidity: extracting (slicing) characters from a string

texts:
Perhaps a double, but I couldn't find an answer here, and neither in strings library.

I have a string public string = "ABCDEFG"

I need to put together a function that iterates through the characters of the string and returns the characters that are in between the input numbers.

for example, function getSlice(uint256 begin, uint256 end) would return CDE if passed 2 and 6.

What would be the best way to create such a function?


texts: How do I read an array inside of a struct?

texts:
as part of learning solidity and smart-contract development, I am developing a simple part management/tracking system. I have a struct and a mapping for a list of parts as such:

struct Part {
   uint pNumber;
   string pName;
   string pDesc;
   string pManuf;
   string[] owners;
}
mapping(uint => Part) public part_store;
uint public partsCount;

I'm adding new parts to the mapping using the following method:

function createPart (string _pName, string _pDesc, string _pManuf) public {
        partsCount++;
        part_store[partsCount].pNumber = partsCount;
        part_store[partsCount].pName = _pName;
        part_store[partsCount].pDesc = _pDesc;
        part_store[partsCount].pManuf = _pManuf;
        part_store[partsCount].owners.push(_pManuf);

        /* Trigger event */
        emit partCreatedEvent(partsCount);
    }

Everything is compiling without errors and I'm able to submit this transaction through Truffle. I get a transaction ID when I create new parts.

Now I'm trying to read the data inside of part but I don't see the array where I pushed the data. It seems that the last data in the object is the manufacturer. But it doesn't show that I've pushed the original manufacturer as owner of that part.

> contract.part_store(1)
Result:
[ BigNumber { s: 1, e: 0, c: [1] },
   'part name',
   'part desc',
   'part Manuf' ]
>

Have I not properly defined the array and pushed data to it? How can I read the data inside of that array? I need an array because this is an easy way to store owners for the parts since owners can change (i.e. defining a new owner by pushing new owner to the array for the specific part).

Thanks all.

EDIT: It seems that if I define an array outside of a struct and public, I am able to read the value:

string[] public test1;
string[] test2;
function writeElem() public {
   test1.push("t1");
   test2.push("t2");
}

results:

> contract.writeElem()
...tx: 0x88...
...txHas: 0x88...
> contract.test1(0)
't1'
> contract.test2(0)
TypeError: app.test2 is not a function
> contract.test2
undefined

I don't think I can define variables in struct public or private so maybe that's why I'm unable to read that data? Could it be something with data access for arrays in Solidity?


texts: provably fair heads up p2p poker - feasible integration with eth smart contract?

texts:
There are a lot of different projects looking to implement trustless poker using a mental poker cryptographic scheme and blockchain technology (virtue poker and many others). But most of these projects are not ready for use. They are usually trying to emulate an entire gambling site which is a big undertaking.

I thought perhaps in the meantime we could try to simplify the problem a little and provide a dApp which is solely a heads up (two player) holdem cash game that is provably fair and whose buy ins and payouts are secured by smart contract. With only two parties, many of the subtle complications like player dropout become simplified. The idea is for the two parties to (1) pay their buy ins into a contract; (2) engage in a p2p poker session logging proofs of their game state; (3) present a proof of game state to the contract to receive the payouts.

I am already actively developing a heads up, texas holdem, p2p protocol (secure mental poker with proofs). But could (1) and (3) be feasibly built around such a protocol on ethereum? Could we write a contract in solidity that simply knows how to: take in funds from 2 parties, evaluate game state proofs, and remit funds. If the actual playing of the game can happen off chain, then something like this could already be usable (no lag during game play for blocks to be processed). Glaring difficulties? Misconceptions or false assumptions? Size or complexity limitations on the proof of game state data that must be evaluated by the contract?


texts:
I have the Tahonga R9 380x

I am on Ubuntu 14.04.4 LTS using the Open CL version: 15.201-0ubuntu0.14.04.1 which i got after running the apt-cache policy flgrx command.

The drivers are not headless meaning I have to use a display to do some stuff etc. fan control

According to https://www.cryptocompare.com/mining/sapphire/radeon-r9-380x-ethereum-mining/ , I should be getting around 24 MH/s per card.

The way I see it, this could be due to the following reasons:

Drivers. The drivers are not optimal for mining. This is however countered by this guys answer that claims that 15.x drivers are better than 16.x  's
Thermal throttling. Le card is throttling itself. Maybe I need to fiddle with some settings to increase thermal headroom? This is however countered by the Saphire's giant ass heatsink and the fans don't even kick in till about 40% load.
OS. The OS is the problem. Maybe I need to go a full headless setup by installing Ubuntu Server. Because what I currently use has a desktop environment, even though no display is attached since I SSH into the rig. Maybe the desktop environment is stealing some GPU hashing power?

Inputs from anyone with the same config or related would be highly appreciated.


texts: How to get transaction receipt using transaction hash?

texts:
I deployed a smart contract and done some transactions. Now I want to see the transaction receipt of the transactions. So I wrote this code:

 var Web3 = require('web3');
 var web3 = new Web3(new
 Web3.providers.HttpProvider('https://rinkeby.infura.io/IHyXTwb......Pu'));
 var txR
 =web3.eth.getTransactionReceipt("0x1333fbc20a9ad2bb56264.......d6576c");
 console.log(txR);

I am getting

  promise pending


texts:
I got quite an interesting question.
I have created an array of structs, and in each struct, I have an array of address.
Then I got a method that when its called on given struct [index] its adds sender address to an array of an address of given struct.

Now my question is, is it possible to also add a string to each element of address array?
From what I understand you can’t have 2d array of 2 different types?

 struct Project{
            int id;
            string name;
             int votes;
           address[] voters;

        }
    Project[] public projects;

    function vote(uint index , string comment) public {
           Project storage project = projects[index];
        Project.votes++
           project.voters.push(msg.sender);
    // now to add a string (comment) to each address that is added to address array
        }


texts: Is an ERC721 Token an Instance of a Contract?

texts:
I'm new to smart contracts and I would like to get my head around the concept of "tokens". From what I understand tokens are defined by smart contracts. So one could say, "This token is defined by this contract". However when I look at the functions in each smart contract it looks as if you are able to access info regarding ALL tokens and their owners.
Does this mean that the concept of a "token" is not an instance of the smart contract that defines it but rather an entry within the smart contract? Could the smart contract be sort of "the database" or "log" where all tokens are registered to their owners?


texts:
I'm using Solidity 0.8.0 (so I'm using ABIEncoderV2) and web3.js 1.3.4 and I'm trying to call a contract's method passing a nested struct.
erc1155.methods.safeBatchTransferFrom(
            owner,
            orchestratorAddress,
            [tokenAId, tokenBId],
            [tokenAAmount, tokenBAmount],
            payload
        ).send({ from: owner });

where my payload is
let payload = [
            operationId,
            [
                [
                    ['0x0000000000000000000000000000000000000000', '42', '43', true]
                ],
                receiver
            ]
        ];

Since I take advantage of the ERC1155 callback onERC1155BatchReceived() in my orchestrator contract, currently I don't even load it in the front-end. I know that latest Solidity versions exposes struct informations in the ABIs, so maybe this could be part of the problem.
However, operationId is an uint256 and receiver is an address, in my contract I use two consecutive abi.decode(). [['0x0000000000000000000000000000000000000000', '42', '43', true] is a vector of struct such this:
struct MyStruct {
        address fieldA;
        uint256 fieldB;
        uint256 fieldC;
        bool fieldD;
    }

Indeed one of these fields should be a struct itself, but even with the simplification I used here I get the same error when I try to send the transaction:
Error: invalid arrayify value (argument="value", value=["6",[[["0x0000000000000000000000000000000000000000","42","43",true]],"0x0000000000000000000000000000000000000000"]], code=INVALID_ARGUMENT, version=bytes/5.0.9)
    at t.value (index.ts:205)
    at t.value (index.ts:217)
    at t.value (index.ts:221)
    at c (index.ts:136)
    at r.value (bytes.ts:13)
    at array.ts:62
    at Array.forEach (<anonymous>)
    at m (array.ts:54)
    at r.value (tuple.ts:23)
    at t.value (abi-coder.ts:106)


texts: What were the design factors driving having EVM native words as 256-bit? It feels excessive, especially if one needs to process as large data set as blockchain.


texts:
I am new to mining ethereum and have been trying to set it up for the last few hours. I have created a coinbase wallet and have followed the advice given in this question. The accepted answer has me run the command

ethminer -G -F http://yolo.ethclassic.faith:9999/0x<YOUR_WALLET_ADDRESS> --farm-recheck 200

However I keep getting the error

miner  16:05:28.730|ethminer  Getting work package...
  ✘  16:05:38.732|ethminer  Failed to submit hashrate.
  ✘  16:05:38.732|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32003 : Client connector error: libcurl error: 28 -> Operation timed out

So I thought that perhaps the server is offline. So I tried connecting to a different pool, e.g. ethpool.org. Unfortunately I find it very hard to find out what I should do to start mining. On the website there is a list of stratum servers, the europe one being eu1.ethpool.org:3333. So I tried the command

ethminer -G -F eu1.ethpool.org:3333/0x<YOUR_WALLET_ADDRESS> --farm-recheck 200

and get the error

miner  16:12:09.399|ethminer  Getting work package...
  ✘  16:12:12.696|ethminer  Failed to submit hashrate.
  ✘  16:12:12.696|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32603 : INTERNAL_ERROR: : {"id":999,"jsonrpc": "2.0","result": false,"error": "Invalid JSON request"}

I tried different variations of this command but always get the same error.

I also tried mining without a pool. For this I run

geth --rcp

and in another terminal

ethminer -G

This seems to work but I don't know how to tell ethminer to mine for my coinbase wallet. Where should I put my coinbase address in the above two commands?


texts: Is there any EVM debugger with a flexible UI layout available as of 2021?

texts: Remix debugger seems to be pretty mature. But, its web-based interface makes it impossible to shuffle the block around. For example, I want to move the "Stack" section to the right sidebar so that it can take up a longer/wider space; thus fitting a deeper stack without needing to scroll the page. However, Remix doesn't allow me to rearrange the UI according to my convenience. The other debuggers I found in Reddit seem to be either abandoned or in the infancy. Hence, those are not usable at all. Is there any EVM debugger available at the moment which provides the same feature as Remix, but the UI is a bit more flexible?


texts: How to find all Ethereum nodes and list it?

texts: Hi is that possible to find eth nodes and list it with some details? I want to do some metrics and service like ether nodes. they dont have an API.


texts: I accidentally sent a token to a token contract. Can I get it back? $MWAT

texts:
community!

Instead of transferring my ERC20 token $MWAT (RED PLATFORM) to my wallet, I accidentally sent it to the contract itself

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

On contract address there're also stuck tokens..
https://etherscan.io/address/0x6425c6be902d692ae2db752b3c268afadb099d3b

Would the contract creator be able to send it back to me?
Maybe some chances to send it back?
Or contract could expire in 5/10 years and send back to origin wallet?


texts:
I have been syncing on a I7-2600 with two WD raptor 10k rpm drives in Raid0 @ 100% disk IO for over a week and only on block 2470271. Another rig I have has 4 drives raid 0 and it has been syncing for 3 days and on block 2425081.  I think my drives might fail from the stress.  Incredibly frustrating for people who want to support this cryptocurrency but unable to get on board and participate -- especially how the wallet software encourages people to put some ETH in their wallet during the installation process.  I suspect some people will never be able to access the money they put into their wallets.

The inefficient manner in which nodes sync and process the chain doesn't make sense.  Perhaps someone can explain why this is happening because other cryptocurrency wallet apps I have used (btc/ltc) do not exhibit this behavior syncing. It seems that segment downloaded needs to be processed into the db and this is taxing my HDDs and causes system to be unresponsive.

Since it is possibly to copy the chaindata from one node to another, it would be great to see a P2P download of a large portion of the chaindata db as a seed and then incrementally update.  It would speed up syncing 100x!

For someone wanting support this cryptocurrency this has been an extremely frustrating experience.


texts: Geth/Parity node - When is a new block imported

texts:
Based on my observations and also on block-timestamps-vs-received-timestamp, I suppose that a block "n" is imported into geth or parity node, only after a block "n+1" is mined.
Is that correct?
Could anyone explain the concepts of this behavior?
Thank you.


texts:
I just started learning how to write smart contracts. I have some questions about crowdfunding.I follow the instructions of my textbook.

My operating system is Windows 10. It compiles OK, but when I check the state, it always show "Funding", and it doesn't end.
First,I use Mist Wallet to deploy the contract.Set the duration and goalAmount,I set 1800 sec and 10 ether.Then I press the deploy button.
Second,I use geth to Transaction =>(cf.fund.sendTransation({from:eth.accounts[1],gas:5000000,value:web3.toWei(10,"ether")})
Up to now is no problem.All 10 ether have sent to the account.
Last,I check the state =>(cf.status()  =>   "Funding"/cf.ended()   =>  "false")
It used to be "Campaign Succeeded"/true

Is there any problem in my program?

pragma solidity ^0.4.18;

contract CrowdFunding {

    struct Investor {

        address addr;

        uint amount;

    }

    address public owner;

    uint public numInvestors;

    uint public deadline;

    string public status;

    bool public ended;

    uint public goalAmount;

    uint public totalAmount;

    mapping (uint => Investor) public Investors;

    modifier onlyOwner () {

        require(msg.sender == owner);

        _;

    }

    constructor(uint _duration, uint _goalAmount) public {

        owner = msg.sender;

        deadline = now + _duration;

        goalAmount = _goalAmount;

        status = "Funding";

        ended = false;

        numInvestors = 0;

        totalAmount = 0;

    }

    function fund() public payable {

        require(!ended);

        Investor storage inv = Investors[numInvestors++];

        inv.addr = msg.sender;

        inv.amount = msg.value;

        totalAmount += inv.amount;

    }

function checkGoalReached () public onlyOwner {

        require(!ended);

        require(now >= deadline);

        if(totalAmount >= goalAmount) {

        status = "Campaign Succeeded";

        ended = true;

        require(!owner.send(address(this).balance));

        uint i = 0;

        status = "Campaign Failed";

        ended = true;

        while(i <= numInvestors) {

            require(!Investors[i].addr.send(Investors[i].amount));

            i++;

          }

  }

    }

    function kill() public onlyOwner {

        selfdestruct(owner);

    }

}


texts: Contract Call has been reverted by the EVM with the reason: 'execution aborted (timeout = 5s)'

texts: I defined an array of objects in the Ethereum smart contract. An object is a structure that is inserted into the array every time a function is called.When 80,000 data is inserted, it takes a long time, estimated at 25 hours...When traversing the array filter, directly reported timeout.The geth client used


texts: Solidity Multiple Contracts and Inheritance issue

texts:
My smart-contract has gotten bigger than the 24K size allowed by Ethereum, so I had to break it up into smaller contracts. I then had to facilitate all sorts of inheritance and importing between these contracts to make everything work correctly again, but in the end, I was still unable to deploy successfully - and it seems to be for the same "contract-size-is-too-big" reason. Here’s what Truffle is telling me:
Error:  *** Deployment Failed ***

"DBTCFull" ran out of gas (using a value you set in your network config or deployment parameters.)
   * Block limit:  6721975 (0x6691b7)
   * Gas sent:     6721975 (0x6691b7)

I’m pretty sure I’m getting this error cause the contracts are all still too big.
Being that I'm only like 2/3 through this project and still have more code to write, size is going to be an issue. So what I’m really trying to understand here is what approach I should be taking. Should I use:

Inheritance - where contracts import other contracts? or
Reference - where contracts are deployed separately, then reference one another?

Here's a scenario that roughly illustrates how my contracts are supposed to interact with one another:
Contract # 1
contract MakePizza {
    // 1. This contract defines a “Pizza” Struct and…
    // 2. Has functions to make various Types of Pizza

    Struct Pizza { … }
   // etc.
}

Contract # 2
contract DeliverPizza is MakePizza {
    // This contract only handles the Deliveries of Pizzas. So it:
    // 1. Defines a “Customer” Struct (customer’s name, phone number, etc.)
    // 2. Defines a “CustomerAddress” Struct (street address, city, zip-code, etc.)
    // 3. Has “delivery” type functions
}

Contract # 3
Contract HandleTheMoney is MakePizza, DeliverPizza  {
    // Defines all things having to do with funds:
    // 1. Acceptable Payment methods
    // 2. Defines various Fees
    // 3. Declares the Permissions re who’s allowed to withdraw funds from the contract, etc.
}

// And finally, Contract # 4:
contract JoesPizzaShop is MakePizza, DeliverPizza, HandleTheMoney {
    // The “master” contract, bringing everything together
}

So I’m pretty sure this is the Inheritance approach. (Cause I'm using that is MakePizza syntax here.)
Now here's the thing: this all compiles successfully - but fails to deploy, giving me the error I listed above.
It seems importing all the files into one another isn't doing anything to reduce the overall size.
The other approach would be to deploy each contract separately, then get instances of them all in the “master” contract - the one called JoesPizzaShop - and work that way.
I’m thinking this latter approach would be “cleaner” - and hopefully smaller. But I worry it might also produce its own unique set of nightmares. Might even require major architectural changes.
So basically, I’m not sure how to proceed.
Given that the contract's size seems to be the main issue, which approach should I take?
Am I just executing the inheritance approach the wrong way - or is that just the wrong approach to begin with?


texts: Customized oracle to access and make changes to data on a cloud service

texts:
Although, there is some literature mentioning the possibilities of oracles to supply external data to smart contracts in a blockchain, I am a newb and was wondering whether there is a successful implementation of this.

I am aware of services like Oraclize and Reality Keys which provide data from "outside world."

What is the most developed and documented service for oracles?

In what kind of projects are these oracles being used?

There is a list of Dapps which were developed using Oraclize and Ethereum. But how exactly is an Oracle being used here?

Consider a scenario where a Smart Contract from a private Ethereum blockchain needs to read/write data to a cloud service. Can I design my own oracle to do this? If yes, where can I get more information regarding this?

Blockchain services are used to achieve trust-less peer-to-peer transactions and a secure distributed storage of these transactions. Won't the concept of oracles contradict this, because we're "trusting" a single source for our information? Or is there a way to implement oracles on a consensus-based system?

Please provide any useful sources to better understand Oracles. Thanks in advance.


texts: Ethereum Wallet and Mist stuck on block 1,699,999 even after updating to latest version of geth

texts:
geth version
Geth
Version: 1.7.2-stable
Git Commit: 1db4ecdc0b9e828ff65777fb466fc7c1d04e0de9
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.1
Operating System: darwin
GOPATH=
GOROOT=/usr/local/Cellar/go/1.9.1/libexec

Here - https://github.com/ethereum/go-ethereum/issues/15185 - they suggest updating but I'm already running latest.

Mist is also stuck on 1,699,999.

When synchronising Bitcoin blockchain I also had troubles (Bitcoin Core crashing) and the solution was to delete peers.dat. Hoping here there is also some magic bullet.


texts: Using blockchain to store education certificates that are signed by at least two people. Is this possible to do on Ethereum?

texts:
Objective:

I want to build a public blockchain where people can put their education certificates on the chain. The certificate's issuer and recipient both put their signature on the certificate to verify where it came from and who it is given to.

Concern:

Firstly, I think it's quite unfeasible to treat the EVM as a storage unit simply because the gas cost to manage it would be ridiculous. This leads me to think I'll have to put the storage unit on an off-chain DAPP that is perhaps regularly updated whenever someone submits a new certificate through executing the smart contract in EVM.

Secondly, I'm not sure if Ethereum supports smart contracts that create a certificate which contains the issuer and recipient's "signature" as a variable. Most of the articles I've read are about multi-sig wallets, but not necessarily about putting multiple signatures on an object that the contract generates.

Question:

What would be the best way for me to design this DAPP's structure?
How do I enable users to put multiple signatures onto the certificate using Solidity (it if is possible at all)?
Is what I am proposing beyond the scope of what EVM allows people to do?


texts: What does it mean that Ethereum is "turing complete"

texts: People often say that Ethereum is a "turing complete" blockchain, or  that it comes with a built-in "turing complete" programming language. What does this mean, and why is it an important feature for Ethereum?


texts: Proving the Existence of Logs to the Blockchain

texts:
To preface this: I'm not entirely sure this question makes any sense. Just a thought I had that I wanted to check the feasibility of.

I'm pretty sure it is possible to use a Merkle proof to show that a transaction was included in some block, and I wonder if this is also possible with logs.

Essentially, would it be possible to prove that a log was generated by including a Merkle proof of either 1) the transaction that generated the log or 2) the log (I know logs are stored differently than transactions, so I'm not sure this is possible at all).

Essentially could there be a proof provided to a contract that some log was generated by some transaction in some block?


texts: [Geth v1.9.13]some of our nodes are not synced

texts:
System information

Geth version: v1.9.13
OS & Version: Amazon Linux2

behaviour

I am running node for 7days on mainnet, however, it's still syncing.
Previously, our node could complete sync for 2 days.
I didn't change server specs or any settings.

Also, other node, which started syncing at the sametime, has already synced.

When I checked the status like the image below, currentBlock seems to be not updated even though highestBlock goes up.

Logs

Pictures below are the screen capture of status check results and logs of the node synced normally.

Can anyone reveal the cause of this problem?


texts: Type Error memory is not converted into struct storage

texts:
pragma solidity ^0.4.17;

contract hoteltranscation  {

  struct hotel{
    string HotelName;
    uint256 BookingNumber;
  }

   function HotelBooking(string _HotelName,uint256 _BookingNumber ) public   {
     hotel storage addtrascation =  hotel (_HotelName,_BookingNumber);
   }
}

I have declared a struct as  public varable  and i want to use it as storage  variable inside a function

2) I am getting the following error

':12:6: TypeError: Type struct hoteltranscation.hotel memory is not implicitly convertible to expected type struct hoteltranscation.hotel storage pointer.\n     hotel storage addtrascation =  hotel (_HotelName,_BookingNumber);\

3) I want to make the state varables as storage  varables and store some data


texts:
I have connect to my rpc geth via web3 successfully, but I can't connect web3-eth-miner to my server. Here is my code

I started my rpc server as

geth --datadir ./tolotolo  --rpc --rpcapi="db,eth,net,web3,personal,web3,miner" --rpcport 5200 --rpcaddr 192.168.1.99 --rpccorsdomain "http://192.168.1.53:5050" --allow-insecure-unlock

var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider(config.ethUrl));
const { Miner } = require("web3-eth-miner");
const options = {
    defaultAccount: config.adminAccount,
    defaultBlock: 'latest',
    defaultGas: 1,
    defaultGasPrice: 0,
    transactionBlockTimeout: 50,
    transactionConfirmationBlocks: 24,
    transactionPollingTimeout: 480,
}
web3.eth.net.isListening()
    .then(() => {
        console.log('web3 is connected'); // Here web3 is connected
        const miner = new Miner(new web3.providers.HttpProvider(config.ethUrl), null, options);
        console.log(miner);
        // miner.startMining(1).then(console.log);
    })
    .catch(e => console.log(e));

Miner console shows

givenProvider: null,
  _currentProvider: CustomProvider {
    host: 'CustomProvider',
    connection: HttpProvider {
      withCredentials: false,
      timeout: 0,
      headers: undefined,
      agent: undefined,
      connected: false,
      host: 'http://192.168.1.99:5200',
      httpAgent: [Agent]
    }
  }

Any idea about how to connect web3-eth-miner to my rpc server?


texts:
I'm trying to to make a contract which lets the user choose any number he likes to populate an array of integers used in a mapping.
Then he can choose any index of this array to increase its value by 1.

Below is the function that makes the increment:

    pragma solidity ^0.4.19;

    contract test {

       //the array size is chosen by the user
       mapping (bytes4 => int[]) internal map;

       function _increase(bytes4 _id,uint _index) public {
           map[_id][_index] = map[_id][_index] + 1;
       }

    }

The problem is, unless you give the array in the mapping a fixed number like:

    mapping (bytes4 => int[1000]) internal map;

The function that increases its numbers throw an error (in remix):

Since giving this array any large random number to cover all the possibilities is a waste of unused space, can anyone think in a workarround?

Thanks a lot.


texts: Is there a way to test out the mist browser from a website without downloading it?

texts: I want to test out the mist browser by going to a website without the need to download it and install it. Is there such an implementation? A testnet setup with some test coins would be good.


texts: How to compile the solidity source code for getting the soljson.js file?

texts:
Solidity's reposite: https://github.com/ethereum/solidity;
I want convert the cpp code to javascript using emscripten. But I don't know whether there is a script in above reposite, if yes, how could I run it? I haven't found the doc to describe it. Could you tell me? Thanks very much!


texts: Unhandled Rejection (TypeError): this.web3.eth is undefined

texts:
My getWeb3.js file:
import Web3 from 'web3'

export default async () => {
    var web3Provider = null;
    if (typeof window.ethereum !== "undefined") {
        web3 = new Web3(window.ethereum)
        try {
            // Request account access if needed
            await window.ethereum.enable()
            // Acccounts now exposed
        } catch (error) {
            // User denied account access...
            console.log("MetaMask cannot be enabled!")
        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        web3Provider = new Web3(window.web3.currentProvider);
    }
    // Non-dapp browsers...we use ganache
    else {
        console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
        web3Provider = new Web3.providers.HttpProvider('http://localhost:7545');
        console.log("ganache")
    }
    return web3
}

Here is how I call getWeb3, it always complain on this var accounts = await this.web3.eth.getAccounts(), saying this.web3.eth is undefined
export default class PaypalContract {
  constructor() {
    console.log(instance)
    if (!instance) {

```
  instance = this
  this.web3 = getWeb3()
  console.log("web3 init:",this.web3)
  this.contract = contract(PaypalContractMeta)
  this.contract.setProvider(this.web3)
  this.usdtcontract = contract(usdtContractMeta)
  this.usdtcontract.setProvider(this.web3)
}

return instance
```

  }

  async payToContract(coin_address,recipient,price,order_id) {
    //const { eth: { accounts: [ account ] } } = this.web3

```
var accounts = await this.web3.eth.getAccounts()
var account = accounts[0]
console.log('account:',account)
console.log("coin address:",coin_address)
const coincontractInstance = await this.usdtcontract.at(coin_address)
const contractInstance = await this.contract.deployed()
var priceUnit = this.web3.utils.toBN(price).mul(this.web3.utils.toBN(this.web3.utils.toWei("1")))
await coincontractInstance.approve(contractInstance.address,priceUnit,{from: account})
await contractInstance.deposit(coin_address,recipient,priceUnit,order_id,{ from: account })
await contractInstance.setExpiryDate(order_id,0,{ from: account })
```

  }


texts:
I am running a simple contract in remix. I have an event in my contract which will be emitted just to check values of stateVariables.

contract stateVariable{
uint stateVariable1=10;
uint stateVariable2=20;
uint stateVariable3=30;
event log(uint stateVariable);
function display() public
{
   //emit log(stateVariable1,stateVariable2,stateVariable3);
   emit log(stateVariable1);
   emit log(stateVariable2);
   emit log(stateVariable3);
}

}

My question is about the format of log emitted in Remix. Why below log message contains "0" :"10" ? Is it something which shows the arguments number and it's value ?

    {

    "from": "0x0dcd2f752394c41875e259e00bb44fd505297caf",
         "topic": >>
    "0xf82c50f1848136e6c140b186ea0c768b7deda5efffe42c25e96336a90b26c744",
         "event": "log",
         "args": {
             "0": "10",
             "stateVariable": "10",
             "length": 1
         }
     },

When i tried to display all three stateVariables it shows below :

  "args": {

     **"0": "10",
     "1": "20",
     "2": "30",**
     "stateVariable1": "10",
     "stateVariable2": "20",
     "stateVariable3": "30",
     "length": 3
  }


texts: Getting stock market data from API or other means?

texts:
I'm trying to make a contract that interacts with a market price or a market out come : e.g APPL drops below X or NFLX > Y ...
Is it possible in Solidity to call an external API during this consensus process (e.g Yahoo Finance)  -- I have seen the chain.link protocol and Augur, but I'm not sure how these work -- any pointers on how to do something like this?


texts: How can access to a external file using loadScript?

texts:
I'm using loadScript in ethereum console to load a external js file:

  loadScript('teste.js');

// teste.js

function fx() {
return 12;
}

However when I run it in ethereum console it always returns false:
(teste.js is located in a folder 'src' in the datadir - admin.datadir)

  loadScript('src/teste.js')
  false

Why I do have this behaviour? Should return 12?
I also tried placing the .js in various reasonable locations, but the ouput of loadScript() is always false...

I hope someone could help.

Thanks


texts: metamask and infura - Managing and signing with private keys

texts:
I am using Infura as a node for my DApp so I need to send raw transactions by signing them. These transactions can come from multiple users of an application so each user must sign and send a raw transaction to infura.

One solution would be take the private key as input from user during signup and securely store it somewhere for future transactions. This sounds like an insecure way and a lot of work.
Afaik the easiest and one of the safest ways to do this is get access to the account from metamask on the client instead of managing private keys of multiple users in my application.

If I'm using the second approach, I don't wanna put the logic of signing and doing transactions on the client, I need to transmit the private key to the server so that it will sign the transaction. How can I achieve this? Is there a safe solution to this?

Should I put all the blockchain logic in the client and update my database in the server code when successful? (I don't personally like this)
Most acceptable approach that I can think of is to sign the transaction using web3.personal.sign() on the client and then send the signed transaction to the server where the server calls web3.eth.sendSignedTransaction() to make the transaction.

How are the real DApps doing this with metamask integration?

EDIT:

I wanna rephrase this question since there is no straight forward anaswer here so far. The question would be:

What is the easiest way to sign transactions on user's behalf from the server without hardcoding their private keys? Any solution with or without Metamask would do.