#StackBounty: #go-ethereum #gas #evm #fees Gas costs of the following contract

Bounty: 50

I’m calculating the gas costs of the following contract: 0x6001600190016007026005016002900460049060016021900560150160030260059007600303600960110a60005260086000f3.

Disassembled versions:

contract Contract {
    function main() {
        var var0 = 0x04;
        var var1 = (0x05 + 0x07 * (0x01 + 0x01)) / 0x02;
        var var2 = 0x03 - (0x03 * 0x15) i% 0x05;
        memory[0x00:0x20] = 0x11 ** 0x09;
        return memory[0x00:0x08];
    }
}

label_0000:
    // Inputs[1] { @0032  memory[0x00:0x08] }
    0000    60  PUSH1 0x01
    0002    60  PUSH1 0x01
    0004    90  SWAP1
    0005    01  ADD
    0006    60  PUSH1 0x07
    0008    02  MUL
    0009    60  PUSH1 0x05
    000B    01  ADD
    000C    60  PUSH1 0x02
    000E    90  SWAP1
    000F    04  DIV
    0010    60  PUSH1 0x04
    0012    90  SWAP1
    0013    60  PUSH1 0x01
    0015    60  PUSH1 0x21
    0017    90  SWAP1
    0018    05  SDIV
    0019    60  PUSH1 0x15
    001B    01  ADD
    001C    60  PUSH1 0x03
    001E    02  MUL
    001F    60  PUSH1 0x05
    0021    90  SWAP1
    0022    07  SMOD
    0023    60  PUSH1 0x03
    0025    03  SUB
    0026    60  PUSH1 0x09
    0028    60  PUSH1 0x11
    002A    0A  EXP
    002B    60  PUSH1 0x00
    002D    52  MSTORE
    002E    60  PUSH1 0x08
    0030    60  PUSH1 0x00
    0032    F3  *RETURN

My estimation was (based on the recent fee schedule: https://docs.google.com/spreadsheets/d/1n6mRqkBz3iWcOlRem_mO09GtSKEKrAsfO7Frgx18pNU/edit#gid=0)

3 x ADD + 2 x MUL + SUB + DIV + SDIV + EXP + MSTORE + 18 x PUSH + 5 x SWAP =
3 x 3   + 2 x 5   + 3   + 5   + 5    + 10  + 3      + 18 x 3    + 5 x 3    =
114

Unfortunately, the corresponding VM test in the official go-ethereum repository (https://github.com/ethereum/tests/blob/ad2184adca367c0b68c65b44519dba16e1d0b9e2/VMTests/vmArithmeticTest/arith1.json) estimates this as 129.

Where have I omitted 15 gas in this execution?

(please note transaction and call costs are not applicable for VM tests)


Get this bounty!!!

#StackBounty: #go-ethereum #evm Instrumenting GETH

Bounty: 100

I’m working on instrumenting VM of GETH in order to index interesting data from the blockchain.
I did manage to intercept the call and see internal transactions, but I want to go a little deeper, and
1) understand what method is called on the smart contract
2) Call myself a method on the smart contract
I’m investigating on that line in evm.go

return interpreter.Run(contract, input, readOnly)

first of all I’m noticing that many many time input is just empty, shouldn’t always contain the function to call on the SC?
Is there some facility inside GETH to understand what input is? Ie which method call it represents?
how can I add ( if I can ) add another call to interpreter.Run to call another method on the contract? ( for instance balanceOf on an erc20 contract? )


Get this bounty!!!

#StackBounty: #go-ethereum #whisper #message Whisper: How to send a message from one node to another that is located on different host?

Bounty: 100

  • geth version: 1.8.15-unstable
  • Python: 3.5
  • OS: osx/linux

I have followed this answer.

On the answer’s approach, I observe that each node can only send message to itself and other nodes don’t filter/see those messages. For example, when node-1 sends a message to the network; it won’t show up on the node-2 such that node-2’s web3.shh.info{memory} remains 0, where I assume that it never catches the message.


I have tried using Web3.js and Web3.py where sent message on Node_1 does not show up on Node_2.

=> This is as far as I came by using Web3.js:

The way I start geth, please note that one of the node started with --nodiscover flag, I am not sure that will affect or not:

geth --syncmode fast --cache=1024 --shh --datadir $DATADIR/private  --rpcaddr 127.0.0.1 --rpc --rpcport 8545 --rpccorsdomain="*" --networkid 12345 --rpcapi admin,eth,net,web3,debug,personal,shh

On node-1’s geth-client:

generatedSymKey=shh.generateSymKeyFromPassword("hello");    
symKey=shh.getSymKey(generatedSymKey)    
symKeyID=shh.addSymKey(symKey) //ex: "d5212e736703afbb21246e8acd192e4345ea910398544d765ed6b49f0ec524b5"
filter = web3.shh.newMessageFilter(
        {symKeyID: symKeyID, topic: '0x07678231'}, 
        function(err, res) {console.log(web3.toUtf8(res.payload))});

On node-2’s geth-client:

generatedSymKey=shh.generateSymKeyFromPassword("hello")    
symKey=shh.getSymKey(generatedSymKey)    
symKeyID=shh.addSymKey(symKey) //ex: "c4c4cecf6ad9499c2386b8ce6416f44684e042e491726b38315646c0b4afadc6"
filter = web3.shh.newMessageFilter(
        {symKeyID: symKeyID, topic: '0x07678231'}, 
        function(err, res) {console.log(web3.toUtf8(res.payload))});

Then, node-1 sends message to the network, where only node-1 receives it but node-2 does not.

Following code is run on node-1's geth-client:

node-1’s symKeyID is given:

web3.shh.post({
  symKeyID: 'd5212e736703afbb21246e8acd192e4345ea910398544d765ed6b49f0ec524b5', //symKeyID of the node-1
  ttl: 10,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 2,
  payload: web3.fromAscii("Hello there!")
  });

=> This is as far as I came by using Web3.py:

Node_1 runs shh_filter.get_new_entries()
in order to catch messages but len(received_messages) returns 0, where there is no message is received and web3.shh.info{memory} remains 0.

On node-1:

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))
from web3.shh import Shh
Shh.attach(web3, "shh")

import time, sys;

from hexbytes import (
    HexBytes,
)

receiver = web3.shh.newKeyPair()
receiver_pub = web3.shh.getPublicKey(receiver)
print('receiverPubK: ' + receiver_pub);

topic = '0x07678231'

shh_filter = web3.shh.newMessageFilter({
    'privateKeyID': receiver,
    'topics': [topic]
})

input("Press Enter to continue...");

received_messages = [];
received_messages = shh_filter.get_new_entries()
print(len(received_messages)) # Returns '0'
print(web3.shh.info.memory) # Returns '0'

Output:

receiverPubK: 0x04226d96bf9857ac0ba429c1e8b480a2811ce47cb526dbd3829d7586e5cae740198ba291f3eca0f279f82db8a136be90ea9ec629ed6cd1d45cc7f873159811757d
Press Enter to continue...

After Node_1‘s messages are sent; I have copied printed receiverPublicKey into receiver_pub variable on the following code. I run following code on Node 2. Node 2 sends a message to the network. Later I press enter on the Node_1 and any of those messages does not show up on theNode_1:

On node-2:

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))
from web3.shh import Shh
Shh.attach(web3, "shh")

import time, sys;

from hexbytes import (
    HexBytes,
)

receiver_pub='0x04226d96bf9857ac0ba429c1e8b480a2811ce47cb526dbd3829d7586e5cae740198ba291f3eca0f279f82db8a136be90ea9ec629ed6cd1'; # obtained from node_1 and assigned here.

topic = '0x07678231'
payloads = [web3.toHex(text="test message :)"), web3.toHex(text="2nd test message")]

web3.shh.post({
        'powTarget': 2.5,
        'powTime': 2,
        'ttl': 60,
        'payload': payloads[0],
        'pubKey': receiver_pub
})
time.sleep(1)

web3.shh.post({
        'powTarget': 2.5,
        'powTime': 2,
        'ttl': 60,
        'payload': payloads[1],
        'topic': topic,
        'pubKey': receiver_pub
})

[Q] How could I send a whisper message from one node to another? What do I do wrong on my approaches?


Please note that, I have opened issue on Web3.py and go-ethereum but no one responded.


Get this bounty!!!

#StackBounty: #go-ethereum #whisper #message Whisper: How to send a message from one node to another?

Bounty: 100

  • geth version: 1.8.15-unstable
  • Python: 3.5
  • OS: osx/linux

I have followed this answer.

On the answer’s approach, I observe that each node can only send message to itself and other nodes don’t filter/see those messages. For example, when node-1 sends a message to the network; it won’t show up on the node-2 such that node-2’s web3.shh.info{memory} remains 0, where I assume that it never catches the message.


I have tried using Web3.js and Web3.py where sent message on Node_1 does not show up on Node_2.

=> This is as far as I came by using Web3.js:

On node-1’s geth-client:

generatedSymKey=shh.generateSymKeyFromPassword("hello");    
symKey=shh.getSymKey(generatedSymKey)    
symKeyID=shh.addSymKey(symKey) //ex: "d5212e736703afbb21246e8acd192e4345ea910398544d765ed6b49f0ec524b5"
filter = web3.shh.newMessageFilter(
        {symKeyID: symKeyID, topic: '0x07678231'}, 
        function(err, res) {console.log(web3.toUtf8(res.payload))});

On node-2’s geth-client:

generatedSymKey=shh.generateSymKeyFromPassword("hello")    
symKey=shh.getSymKey(generatedSymKey)    
symKeyID=shh.addSymKey(symKey) //ex: "c4c4cecf6ad9499c2386b8ce6416f44684e042e491726b38315646c0b4afadc6"
filter = web3.shh.newMessageFilter(
        {symKeyID: symKeyID, topic: '0x07678231'}, 
        function(err, res) {console.log(web3.toUtf8(res.payload))});

Then, node-1 sends message to the network, where only node-1 receives it but node-2 does not.

Following code is run on node-1's geth-client:

node-1’s symKeyID is given:

web3.shh.post({
  symKeyID: 'd5212e736703afbb21246e8acd192e4345ea910398544d765ed6b49f0ec524b5', //symKeyID of the node-1
  ttl: 10,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 2,
  payload: web3.fromAscii("Hello there!")
  });

=> This is as far as I came by using Web3.py:

Node_1 runs shh_filter.get_new_entries()
in order to catch messages but len(received_messages) returns 0, where there is no message is received and web3.shh.info{memory} remains 0.

On node-1:

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))
from web3.shh import Shh
Shh.attach(web3, "shh")

import time, sys;

from hexbytes import (
    HexBytes,
)

receiver = web3.shh.newKeyPair()
receiver_pub = web3.shh.getPublicKey(receiver)
print('receiverPubK: ' + receiver_pub);

topic = '0x07678231'

shh_filter = web3.shh.newMessageFilter({
    'privateKeyID': receiver,
    'topics': [topic]
})

input("Press Enter to continue...");

received_messages = [];
received_messages = shh_filter.get_new_entries()
print(len(received_messages)) # Returns '0'
print(web3.shh.info.memory) # Returns '0'

Output:

receiverPubK: 0x04226d96bf9857ac0ba429c1e8b480a2811ce47cb526dbd3829d7586e5cae740198ba291f3eca0f279f82db8a136be90ea9ec629ed6cd1d45cc7f873159811757d
Press Enter to continue...

After Node_1‘s messages are sent; I have copied printed receiverPublicKey into receiver_pub variable on the following code. I run following code on Node 2. Node 2 sends a message to the network. Later I press enter on the Node_1 and any of those messages does not show up on theNode_1:

On node-2:

from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))
from web3.shh import Shh
Shh.attach(web3, "shh")

import time, sys;

from hexbytes import (
    HexBytes,
)

receiver_pub='0x04226d96bf9857ac0ba429c1e8b480a2811ce47cb526dbd3829d7586e5cae740198ba291f3eca0f279f82db8a136be90ea9ec629ed6cd1'; # obtained from node_1 and assigned here.

topic = '0x07678231'
payloads = [web3.toHex(text="test message :)"), web3.toHex(text="2nd test message")]

web3.shh.post({
        'powTarget': 2.5,
        'powTime': 2,
        'ttl': 60,
        'payload': payloads[0],
        'pubKey': receiver_pub
})
time.sleep(1)

web3.shh.post({
        'powTarget': 2.5,
        'powTime': 2,
        'ttl': 60,
        'payload': payloads[1],
        'topic': topic,
        'pubKey': receiver_pub
})

[Q] How could I send a whisper message from one node to another? What do I do wrong on my approaches?


Get this bounty!!!

#StackBounty: #go-ethereum #poa #clique How to immediately include transactions into blocks if there is still space?

Bounty: 50

  • Geth version: 1.8.12-stable
  • OS & Version: Linux/OSX

Expected Behavior

Transactions to distributed to network right at its sent block number and deployed within that.


Actual Behavior

Transactions are delayed one block time to be distributed over network and consequently deployed one block time late.


Explanation

I have a small cluster that is connected to private Ethereum chain that uses POA and block time is fixed 15 seconds. The cluster has four nodes that all nodes are connected to each other. Please note that, there is three signer nodes on my cluster.

When I submit a transaction from a node; the transaction does not reach to all signer nodes on the current block but it is transferred onto the next block. But, I observe that the sent transaction was received by the non-signer node right after it is sent.

For example; when I sent a transaction within the current block, it will not deployed on the current block but on the up coming block. So this forces network to deploy a transaction in 2 block time which is in between 15 seconds to 30 seconds.


Example case:
alper@home is non-signer node and other nodes are signer node.

I sent a transaction within block number 869,334 from node named eBloc@netlab (signer-node) and transaction shows up right after at alper@home named node (non-signer node) on block number 869,334 but it does not show up on the signer nodes even on the node that I sent it from.

enter image description here

On the next block (869,335) I observe that all nodes receive the transactions.

enter image description here

And finally on block number (869,336) the transaction is deployed.

enter image description here

=> If the transaction was distributed to all cluster right after it sent it should be deployed on the block number (869,334) but it used 1 additional block time for this.

[Q1] Why the sent transaction received by the non-signer nodes right after it is sent but not by the signer nodes?

[Q2] Is this normal that the sent transaction won’t transfer to all the network right after it is sent but it takes additional 1 block time even all nodes are connected to each other? Is there any way to force to transfer a transaction to all my signer nodes right after it has been sent?


Get this bounty!!!

#StackBounty: #go-ethereum #poa #clique How to force a transaction to be transferred to the signer nodes right after it is sent to the …

Bounty: 50

I have a small cluster that is connected to private Ethereum chain that uses POA and block time is fixed 15 seconds. The cluster has four nodes that all nodes are connected to each other. Please note that, there is three signer nodes on my cluster.

When I submit a transaction from a node; the transaction does not reach to all signer nodes on the current block but it is transferred onto the next block. But, I observe that the sent transaction was received by the non-signer node right after it is sent.

For example; when I sent a transaction within the current block, it will not deployed on the current block but on the up coming block. So this forces network to deploy a transaction in 2 block time which is in between 15 seconds to 30 seconds.


Example case:
alper@home is non-signer node and other nodes are signer node.

I sent a transaction within block number 869,334 from node named eBloc@netlab (signer-node) and transaction shows up right after at alper@home named node (non-signer node) on block number 869,334 but it does not show up on the signer nodes even on the node that I sent it from.

enter image description here

On the next block (869,335) I observe that all nodes receive the transactions.

enter image description here

And finally on block number (869,336) the transaction is deployed.

enter image description here

=> If the transaction was distributed to all cluster right after it sent it should be deployed on the block number (869,334) but it used 1 additional block time for this.

[Q1] Why the sent transaction received by the non-signer nodes right after it is sent but not by the signer nodes?

[Q2] Is this normal that the sent transaction won’t transfer to all the network right after it is sent but it takes additional 1 block time even all nodes are connected to each other? Is there any way to force to transfer a transaction to all my signer nodes right after it has been sent?


Get this bounty!!!

#StackBounty: #go-ethereum How to force a transaction to be transferred to the signer nodes right after it is sent to the network?

Bounty: 50

I have a small cluster that is connected to private Ethereum chain that uses POA and block time is fixed 15 seconds. The cluster has four nodes that all nodes are connected to each other. Please note that, there is three signer nodes on my cluster.

When I submit a transaction from a node; the transaction does not reach to all signer nodes on the current block but it is transferred onto the next block. But, I observe that the sent transaction was received by the non-signer node right after it is sent.

For example; when I sent a transaction within the current block, it will not deployed on the current block but on the up coming block. So this forces network to deploy a transaction in 2 block time which is in between 15 seconds to 30 seconds.


Example case:
alper@home is non-signer node and other nodes are signer node.

I sent a transaction within block number 869,334 from node named eBloc@netlab (signer-node) and transaction shows up right after at alper@home named node (non-signer node) on block number 869,334 but it does not show up on the signer nodes even on the node that I sent it from.

enter image description here

On the next block (869,335) I observe that all nodes receive the transactions.

enter image description here

And finally on block number (869,336) the transaction is deployed.

enter image description here

=> If the transaction was distributed to all cluster right after it sent it should be deployed on the block number (869,334) but it used 1 additional block time for this.

[Q1] Why the sent transaction received by the non-signer nodes right after it is sent but not by the signer nodes?

[Q2] Is this normal that the sent transaction won’t transfer to all the network right after it is sent but it takes additional 1 block time even all nodes are connected to each other? Is there any way to force to transfer a transaction to all my signer nodes right after it has been sent?


Get this bounty!!!

#StackBounty: #go-ethereum #private-blockchain #testing Ethereum Deployment Problems

Bounty: 50

I deployed a private version of Ethereum on my laptop.

I am using this code to deploy:

geth –-identity "blockdb" –-rpc -–rpcport "9040" --rpccorsdomain "*" –-rpcapi "db,eth,net,web3" –-datadir "c:\blockchain" –-port "30303" –-nodiscover –-networkid 76543 console

and this genesis:

{
"config": {  
    "chainId": 76543, 
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
               },
"difficulty": "0x4000",
"gasLimit": "0x8000000",  
"alloc": {}
 }
 }

The blockchain seems to deploy well, since it gives me the same chain ID, i open Mist (without changing an ysettings) and can see the wallets i create. Miner.start() also works. I see the ethers coming in from the mining. I can see the wallets i create andthe minutes since last block. but the status remains always connecting.

enter image description here

My questions are as follows:

1) When i close the console and restart it, to restart the node, i use the above command again. is that correct? Because:

2) when I restart, I can see the wallets previously created but not the ether. the ether is lost. they all restart from 0. why is that?

3) I am trying to interact ‘externally’ with the blockchain, by using nethereum and ethereum wallet. In both apps I can see the wallets and their balance. but i cannot create new wallets, deploy contracts or transfer ether.


Get this bounty!!!

#StackBounty: #go-ethereum #whisper How to send 1-N signalling or broadcast messages on Whisper?

Bounty: 50

From Whisper wiki:

Low-latency, 1-1 or 1-N signalling messages.

Shh.post(self, message:) and Whisper Usage / shh.post

Creates a whisper message and injects it into the network for
distribution.

Example usage of web3.shh.post, for more details please see this answer:

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

When I remove pubKey from web3.shh.post as arguments; it says: Error: specify either a symmetric or an asymmetric key.

shh.post({ "topic": t, "payload": p }); No signature, no encryption: Anonymous broadcast; a bit like an anonymous subject-filtered twitter feed.

[Q] Since web3.shh.post()requires us to provide single public key of the receiver; is it possible to send 1-N or broadcast message using whisper protocol? If yes, how?


Get this bounty!!!

#StackBounty: #go-ethereum #whisper How to send 1-N signalling messages on Whisper?

Bounty: 50

From Whisper wiki:

Low-latency, 1-1 or 1-N signalling messages.

Shh.post(self, message:)

Creates a whisper message and injects it into the network for
distribution.

Example usage of web3.shh.post, for more details please see this answer:

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

When I remove pubKey from web3.shh.post as arguments; it says: Error: specify either a symmetric or an asymmetric key. Whisper overview is out of date. It gives following example as use case which does not work:

shh.post({ "topic": t, "payload": p }); No signature, no encryption: Anonymous broadcast; a bit like an anonymous subject-filtered twitter feed.

[Q] Since web3.shh.post()requires us to provide single public key of the receiver; is it possible to send 1-N message using whisper protocol? If yes, how?


Get this bounty!!!