texts: Understanding eth_estimateGas with regards to gas price, and current mempool

texts:
Does anyone have a detailed understanding of how eth_estimateGas works with regards to gasPrice and the current mempool state?
I have historically seen some really odd behavior when using eth_estimateGas on mainnet.  I've seen both false positives and false negatives.  In other words, I've seen an eth_estimateGas that tells me a tx would fail only to watch the tx succeed.  And I've also seen an eth_estimateGas that tells me a tx would succeed only to watch it fail.  And from these experiences, I take the result of eth_estimateGas with a huge grain of salt.  I always assumed the reason was based on the state of the mempool at that moment when the node received my request.  And since mempool is always changing and you don't know the actual mempool of the miners, you get inconsistency.
M question is:  Is there any 100% reliable way to verify that a transaction will actually succeed or fail (and at what gas cost) totally unrelated to mempool, gas auctions, etc?  I want a reliable way to say "yes my tx will succeed" and I don't want other transactions to be factored in.  I want to assume the state of the blockchain is the recent block, or better yet, a specified block.  One thought is, I could call eth_estimateGas with a gasPrice of like 9999999999999999999 or something really massive so that the node that receives my request would assume it always gets the first spot in the block (even though that's not the actual gas price I'll be using.
I've tried calling eth_estimateGas when setting the gasPrice, but I ran into some odd errors.  I also noticed that calling eth_estimateGas using Infura is more likely to work than just using my geth node.  I'm wondering if Infura is routing the call to Parity as well and maybe Parity handles the call differently than Geth.


texts:
I need to make sure that the value being sent to my contract is at least a certain amount. To do this I need to be able to compare the value with a ufixed:

require(msg.value > previousValue * 1.1)

but I'm getting the following error:

TypeError: Operator > not compatible with types uint256 and ufixed128x18

What's the right way to do this?

Thanks


texts: What Is the prime web application framework for Ethereum Dapp?

texts: Which web app framework is well accepted and better suited for developing Ethereum Dapp? It seems that Javascript based frameworks have certain advantage over others. But there are popular web app frameworks available in Ruby and Python as well.


texts: What's the point of keeping historical transactions?

texts:
I understand there are a few different sync modes. Archival nodes keep everything and they take ~2TB if not more. geth --fast downloads all historical transactions (besides transaction headers), but only verifies recent states, which saves space and is faster to catch up. Fast is the default mode for initial syncs (and only enabled for the initial sync).

My questions are about historical transactions:

What's the point to download transactions in --fast mode? It seems like it could just work without doing so.
More generally, what are the reasons to keep historical transactions around, now that state root is already in consensus?

W.r.t. #2, an argument I've seen is that replaying transactions is the only definitive way to verify a given state, I.e., if one just verifies state roots, an attacker could feed false states (after eclipsing the victim node and assuming the attacker has enough hashing power) that circumvents EVM mechanisms (i.e., no valid transactions can lead to that state.) This is a noted weakness of fast sync compared to classical sync. I agree this is technically a new attack vector. But I'm not sure I appreciate the practical difference. What is the difference between an invalid state and a valid state which is potentially derived from bogus transactions?


texts: How come Go Ether and Ethereum Wallet both say 0 ether but Etherchain says .05?

texts:
When I try web3.fromWei(eth.getBalance("<My Account>"), "ether") I get 0. Also when I install and run the Ethereum Wallet, I see my account but it says 0. But when I open etherchain and input my address I see

Balance:    0.05455706564854493 Ether ($27.74) | Buy more

I tried

eth.sendTransaction({from:eth.accounts[1], to:'<other address>', value: web3.toWei(0.05, "ether"), gas:21000});

and I get Error: insufficient funds for gas * price + value

Where as the Mist application just sits and spins syncing and downloading blocks. If I choose "Launch App" then I see my wallet but the balance is 0,

What am I doing wrong?

READ BEFORE YOU SHRUG THIS OFF IF YOU SEARCHED!

Actually I wasn't doing anything wrong it just doesn't work like that.

I needed to import my UTC into Metamask and it worked perfect, I waited around for 4 days and tried to sync thanks to you guys saying it was a duplicate.

:-(


texts: Sharing members between derived and base contract

texts:
I am trying to reduce code complexity by using inheritance. I was wondering if it is possible to share data store members like arrays or mapping between deployed base and derived contracts.

In other words, I was wondering if it is possible to modify the derived lookup contract using add, but get the same result with the base lookup contract getLookupById. Do I need to store the mapping in a separate contract?

pragma solidity ^0.4.11;

contract BaseLookup {

    address owner;
    function BaseLookup() { owner = msg.sender; }

    struct Lookup {
        uint id;
        string name;
    }

    mapping(uint => Lookup) lookupById;

    function getLookupById(uint _id) public constant returns (uint, string) {
        return (lookupById[_id].id, lookupById[_id].name);
    }
}

contract DerivedLookup is BaseLookup {

    function add(uint _id, string _name) public {
        Lookup memory newLookup;
        newLookup.id = _id;
        newLookup.name = _name;

        lookupById[newLookup.id] = newLookup;
    }
}


texts: Need to know exact public address the user used to make a Metamask payment with?

texts:
I need to know how to do do the following tasks, after I triggered a Metamask payment with Web3 and the user paid:

how to get the exact public address the user used to make that payment?  I need that address because my dApp is a game and if the user wins, I will use that address to pay the user their winnings.
how to listen for confirmation that their payment has been written to the Ethereum ledger (has been confirmed), from the same web page Javascript that initiated the transaction with Metamask?

A good gist or code sample would be incredibly useful if you know of one.


texts:
I am trying to create an Ethereum Contract, through my java application, has anyone done this before? how do you pass the JASONRPC command via java method
I am using TESTRPC


texts: ERC20 Transactions - how to pay for the gas?

texts:
So I have an ERC20 token, which I'm creating a wallet to send it from one address to the other.

I understand that I have to pay for the gas in this transaction using Ether, but my question is: how is this workflow?

Do I need to hold Ether on the same wallet as the ERC20 coin and it'll be automatically sent over or do I have to send out Ether from another address when I sign the transaction? This is a bit confusing at this moment, could someone clarify this process?


texts:
There are a number of questions relating to the invalid JUMP error.

I get this when debugging a solidiy contract on the testrpc with geth command line:

Error: VM Exception while processing transaction: invalid JUMP at 3802e3b6eefb98
150918c4ddfaabf93c18d6c41aaa2682c5cdbc0a9a9a6a2853/cb611bab0cd7c4f21f7cb0b91ad45
f1330995289:13717
    at web3.js:3119:20
    at web3.js:6023:15
    at web3.js:4995:36
    at web3.js:4055:16
    at apply (<native code>)
    at web3.js:4141:16
    at <anonymous>:1:1

Can you explain the invlid JUMP error - what is going wrong at the Virtual Machine opcode level?

What approach should you use when finding the source of such errors?

Is this error unique to go-ethereum?

EDIT:

The question is answered here:

What does a "bad JUMPDEST" error mean?

What is the distinction, if any, between the above invlaid JUMP and that question's bad JUMPDEST?

Other questions:

oraclize 'VM Exception: invalid JUMP'

VM Exception: invalid JUMP when I call a second function

invalid JUMP after upgrading truffle & testrpc

Invalid jump destination error when attempting to transfer The DAO tokens


texts: How do I automatically verify my contracts on etherscan using brownie?

texts: I discovered truffle has truffle-plugin-verify that help you verify your contracts on etherscan. I wonder if similar functionality can be done with brownie ?


texts: web3.eth.getFilterChanges(web3_filter.filter_id) throws 'filter not found'

texts:
I am listening ethereum network through local geth node. I connected to geth through web3.py. I started a job in python code that periodically gets new blocks from filter. Here is the code:

def main():
    web3 = Web3(HTTPProvider(cfg.eth_node_url))
    web3_confirmed_filter = web3.eth.filter('latest')

    scheduler = BlockingScheduler()

    scheduler.add_job(
        func=eth_listener_job.process_blocks(),
        args=[web3, web3_confirmed_filter],
        trigger=IntervalTrigger(seconds=cfg.pending_trx_scan_interval),
        id='block_processor',
        name='Load new blocks',
        replace_existing=True)

    scheduler.start()

Here how job method looks like

def process_blocks(web3, web3_filter):
    print('Scanning for new blocks...')

    ....
    trx_blocks = web3.eth.getFilterChanges(web3_filter.filter_id)
    ....

Sometimes I get error on line

  trx_blocks = web3.eth.getFilterChanges(web3_filter.filter_id)

ValueError: {'code': -32000, 'message': 'filter not found'}

What might be a reason for this error?


texts: error in getData function while calling function of smart contract

texts:
Whenever i try to hit this request i get a error, also used debugger and it says buyTokens function not found.

exports.transferEthShare = (data, next) => {
var data_contract = require('../contractABI/data');
var abiData = require('../contractABI/testabi');
let send_add = data.user_address;
let recv_add = data.contract_address;
let transfer_amount = web3.toWei(data.amount, 'ether');
let nonce = web3.toHex(web3.eth.getTransactionCount(data.user_address));
var private_key = data.user_pri_key.slice(2);
let gas = web3.toHex(data.gas_limit);
let gasPrice = web3.toHex(data.gas_price);
var contract_abi = abiData.abi;
var demo_Contract = web3.eth.contract(contract_abi);

let deploy = demo_Contract.buyTokens.getData(   // to ask --- start
    send_add,
    recv_add,
    {
        data: data_contract.abiData,
    });                                         // to ask --- end
var rawTx = {
    from: send_add,
    nonce: nonce,
    gasLimit: gas,
    gasPrice: gasPrice,
    value: web3.toHex(transfer_amount),
    to: recv_add,
    data: deploy,
};
var transaction = new tx(rawTx);
var txData = new Buffer(private_key, 'hex');
transaction.sign(txData);
var serializedTx = transaction.serialize().toString('hex');
web3.eth.sendRawTransaction('0x' + serializedTx, function (err, txHash) {
    if (txHash) {
        next(null, txHash);
    }
    else if (err && err.message) {
        next(err.message, null);
    }
    else {
        next('Unable to sendRawTransaction', null);
    }
});

}


texts: What was the maximum password length of a pre-sale wallet/accounts?

texts: What was the maximum password length for pre-sale wallets/accounts? While we're here, is there a maximum password length for accounts created now, using standard tools like geth/mist?


texts: Anyone remebers The Dao and can help me?

texts: Around 4-5 years ago I invested(more like wasted) a small amout of money on the dao. TBH I forgot about it untill today. I found my privte key and found out i have 94 the dao tokens on my eth wallet. Can i do something with them? Are they worth anything or can i get eth I spend on them back?


texts: A Lottery Solidity Smart Contract that accept erc20/bep20 token instead of ether to enter the lottery

texts:
function enter() public payable {
    require(msg.value > .01 ether);

    players.push(msg.sender);
  }

Change this function to accept erc20/bep20 token to enter the lottery


texts: How to get the correct line numbers from `solc --ast-json`?

texts:
I have the following in a file:

contract Coin {
    address public minter;
    mapping (address => uint) public balances;
    event Sent(address from, address to, uint amount);
    function Coin() {
        minter = msg.sender;
    }
    function mint(address receiver, uint amount) {
        if (msg.sender != minter) return;
        balances[receiver] += amount;
    }
    function send(address receiver, uint amount) {
        if (balances[msg.sender] < amount) return;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        Sent(msg.sender, receiver, amount);
    }
}

When I apply solc --ast-json, the line numbers are all messed up. Say I want to line number of the minter address. It seems every single space is considered a line number, as well as all characters of contract Coin {, therefore saying its line number is 20:7:0!

Any guidance as to how I can get the correct line numbers is much appreciated.


texts:
Everything was working fine until today that when I try to use readFileSync it gives me [Function] for every kind of file. In my example when I try to compile the contract it gives me

'Error parsing input JSON: * Line 1, Column 1\n  Syntax error: value, object or array expected.\n'

> code = fs.readFileSync('Voting.sol').toString
[Function]

> compiledCode = solc.compile(code)
{ errors: [ 'Error parsing input JSON: * Line 1, Column 1\n  Syntax error: value, object or array expected.\n' ] }

I reinstall nodejs and npm but still I get the same error. Any help?


texts: What is the methodID for SafeMath function when SafeMath library is referenced internally?

texts:
For the contract below

contract Example
{
    using SafeMath for uint256;

    uint256 internal _amount;

    function example(uint256 amount)
    external
    {
        _amount = _amount.add(amount);
    }
}

after compiling to EVM bytecode, the SafeMath.add(uint256,uint256) should appear defined in the code.

anyone knows how to calculate the keccak256() signature for this function?
what should I look for in the contract bytecode?


texts:
Following code shows reading of balance:

function WithdrawBuggy(uint256 amount) public {
   uint256 bal = balance[msg.sender];
   require(amount <= bal);
   balance[msg.sender] -= amount;
   require(msg.sender.call.value(amount)());
   if (balance[msg.sender] != bal) {
      emit BalanceDecreased(msg.sender);
   }
}

Can the attacker exploit reading of balance?

Zulfi.


texts:
I joined an ICO for the first time and transferred an ERC20 Token to an Online- Wallet which doesn't support this. The wallet name is Ether.li. Now I want to transfer Tokens back to Myetherewallet and I don't know how to do it?

Is there a way to transfer my ERC20 Token back to Myetherwallet?

Thanks.


texts: Lost beween useWeb3ReactCore and getWeb3

texts:
I am learning Solidity and DAPPs.
I have tried to create a project with truffle, with this command:
$ truffle unbox react

Here is what i see in generated code:
import getWeb3 from "./getWeb3";
...
const web3 = await getWeb3();

Everything works fine !
I have looked at some popuplar projects like uniswap and here is what i've found in source code:
import { useWeb3React as useWeb3ReactCore } from '@web3-react/core'
...
const { active, error, activate } = useWeb3ReactCore()

I do not understand the difference between this 2 ways for working with Web3...
Thanks a lot


texts: Is it ok to install ethereum and ethereum classic geth together on a server

texts:
I already have geth of ethereum running on my amazon linux server. Can I install ethereum classic geth on the same server.? Will it cause problem like transfering from ETH to ETC address accidentally ?  Or may be some collision since both uses geth and one geth hinder the other from running ? Are these just my fears ? do i need two separate servers ?

If both can be installed on same server, can you provide a link for installing ETC geth on Linux server?

UPDATE:

I want to interact with both ethereum nodes from a php script via json rpc.


texts: How to transfer balance from Geth account to an actual place?

texts:
If I only created an account using Geth, but haven't created wallet anywhere (I'm new to mining), and actually got some Ether, is this Ether really exist and I can somehow use it? Or if I haven't created a wallet before it's lost? (it shows 5 when I type web3.fromWei(eth.getBalance(eth.coinbase), "ether"))

**Edit: I only started doing it for fun, didn't really think I'd actually get some Ether so yes.. I am still learning things about Ethereum, so every help is appreciated, even if for you it seems simple, thanks


texts:
According to crowdsale contract at https://www.ethereum.org/crowdsale tokens are transferred to a user account when "function () payable" is called by using external function tokenReward.transfer(msg.sender, amount / price). Nevertheless when user claim its ethers at safeWithdrawal() because fundingGoal hasn't been reached, there is no call to tokenReward.transfer() external function, so it seems to me that the bought tokens are not withdrawed properly, although ether is sent to the user.

Has anybody used this code to crowsale tokens and perform a withdrawal as a user? Do the token balance at token contract decrease properly when safeWithdrawal is called? How is that possible?

Refs.:

Pre ico and ico crowdsale contracts

Buy ICO tokens?

Buy and sell of my tokens


texts: Data Model - Data Warehouse SQL Based - Deploy in Blockchain Ethereum

texts: I am looking for a little clarification/guidance. I currently have a SaaS-based product that is delivered to institutions. I operate a serverless architecture, with an individual database for each client. I would like to effectively build a DAPP out of the database layer, not only for storage but so that aspects of the data could be shared. The core of my offering is the data-model deployed on the SQL database, can this be deployed as an Ethereum app. Can i build this into a contract.


texts: Is it guaranteed to preserve the transaction order when using callbacks?

texts:
When I watch a contract for transaction events in web3.py or web3.js,

In web3.js

var contract = web3.eth.contract(abi);

var cInstance = contract.at(address);

var transferEvent = cInstance .Transfer({}, {fromBlock: 0, toBlock: 'latest'});

transferEvent.watch((error, event) => {});

In web3.py

contract = w3.eth.contract(abi=contract_interface['abi'], address='0x....')

tfilter = contract.on('Transfer',{'fromBlock':0,'toBlock':'latest'})

def transfer_callback(tnx):
    print(tnx)

tfilter.watch(transfer_callback)

Is it guaranteed the callback will be fired according to the order of the transactions? even for past transactions.
e.g. first transaction will be fired first, and second transaction will be fired second and so on.

Please note I'm filtering 0 block to latest. So above code should get all past transaction events too.


texts: Insufficient funds when transferring ERC-20 token using web3

texts:
I am trying to send an ERC-20 token on Mainnet using web3 v1.x and Infura. I get the error in the title while executing this code.

I have a balance of about 0.14 ETH

var provider = new HDWalletProvider(config.mnemonic, "https://mainnet.infura.io/v3/" + config.infuraKey);

const web3 = new Web3(provider);

const tokenAbi = config.abi;
let tokenContract = new web3.eth.Contract(tokenAbi, contractAddress);

let data = tokenContract.methods.transfer(tAddr, tAmountInWei).encodeABI();
const tx = {
   from: myAddress,
   to: contractAddress,
   gas: web3.utils.toHex(400000),
   gasPrice: web3.utils.toHex(25000000000),
   value: "0x0",
   data: data
};

let eTx = await web3.eth.accounts.signTransaction(tx, tx.from, (err, signedTx) => {
    if (err) {
       console.error(err);
       return err;
    } else {
       console.log('SignedTx: ', signedTx);
       return web3.eth.sendSignedTransaction(signedTx.rawTransaction, (err, res) => {
          if (err) {
             console.error(err);
          } else {
             console.log(res);
             count++;
          }
       });
    }
});

My error below:

Error: insufficient funds for gas * price + value
    at /Users/****/****/node_modules/truffle-hdwallet-provider/dist/index.js:15:632675
    at t.i.onreadystatechange (/Users/****/*****/node_modules/truffle-hdwallet-provider/dist/index.js:15:748948)
    at t.e.dispatchEvent (/Users/*****/*****/node_modules/truffle-hdwallet-provider/dist/index.js:1:142373)
    at t._setReadyState (/Users/*****/*****/node_modules/truffle-hdwallet-provider/dist/index.js:15:753708)
    at t._onHttpResponseEnd (/Users/*****/*****/node_modules/truffle-hdwallet-provider/dist/index.js:15:756793)
    at IncomingMessage.<anonymous> (/Users/*****/*****/node_modules/truffle-hdwallet-provider/dist/index.js:15:756051)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)


texts: why doesn't it take any gas when making public view function but still writing in storage?

texts:
I have four questions. I hope you can help me. Good idea questions, maybe this will help others. Thanks in advance.

Question 1) I know that if you don't write anything to storage, then That function is free of gas. right? i can even make public view function and make thouthands for loop, but since there's no reason to distribute this change to other nodes, it must be free even though for loop is big and even though i am making new variables in memory in that function. Is my idea right?

Question 2) I made the public view function, but in that function I wrote something like writing a number in an array and then after writing it , i returned new added element from that array. I touched the storage, I wrote it there. but because of I named my function "view" , it didn't ask me to put gas in metamask. there was no metamask needed at all, even though i wrote in storage. why? My opinion is that It works for me, but not for others and it wouldn't propagate across the nodes.

Question 3) Everyone says you can't return dynamic arrays from functions. Let's take uint[] array. It's dynamic, but I can still return it. then what do people mean? I know i can't return multidimensional array and structs of array. but I can return uint[].

Question 4) I know that If there's some data in storage for example uint[] x . now If I write in a function something like that : uint[] memory mytest = x; That x data that was in storage gets copied into memory. Am I right? If not? why? if yes, does it work the way around? to copy from memory to storage? But i don't think so, because you can't write anything in storage later unless you specify at run time.


texts: What happens when we use "callback" in a function ? and when do we need to use it?

texts:
What happens when we use "callback" as a keyword in a function ?  And when do we need to use it ? and what happens if we do not use it ? For example in the following JavaScript code:

function signPayment(recipient, amount, nonce, contractAddress, callback) {
  var hash = "0x" + ethereumjs.ABI.soliditySHA3(
    ["address", "uint256", "uint256", "address"],
    [recipient, amount, nonce, contractAddress]
  ).toString("hex");

  web3.personal.sign(hash, web3.eth.defaultAccount, callback);
}


texts:
I'm writing here cos' I would like to post a question.
Is there a way to burn gradually tokens?
I can explain this better.......
I would to launch a cryptocurrency (e.g. 1000000 ether).The feature I want to give to this token is that these 1000000 circulating ether will be automatically and gradually reduced...completely "burnt" (e.g. to 500000 ether).
Something like the "Ripple transaction burn fee".
Is there a function or whatever other way to do that in the ethereum code....for example I was thinking using "gas"....but I know something like "nothing" about that...
I'll thank u everyone wants to give his help or his opinion.


texts: Compilation warning in Ethereum Remix IDE

texts:
Warning: No visibility specified. Defaulting to "public".

function setName(string newName) {
^ (Relevant source part starts here and spans across multiple lines).

Help me to resolve it ASAP. Thanks


texts: Why Merkle-Patricia Trie has three types of nodes?

texts:
I've been reading about Merkel Patricia Trie and I think that I understand how it works, but it looks a bit overcomplicated to me, which suggests that I do not understand it fully.

Here is how Merkle Patricia Trie looks like:

Merkel Patricia Trie is similar to a regular Trie data structure but has three types of nodes

Extension Node - contains a part of the key that is common for multiple nodes and contains a reference to a next node
Branch Node - contains pointers to different nodes that have the same key prefix
Leaf Node - contains a value and the remaining part of the key (called key-end). A key of a leaf node is a concatenation of a prefix from all its parents and the key-end in a leaf node.

Since an Extension Node has only a single pointer to another node, it seems that it will always point to a Branch Node. If it were pointing to a Leaf Node, these nodes could be combined into a single Leaf Node. And if it were pointing to another Extension Node, then these two Extension Nodes could be combined into a single Extension Node.

Why do we need to separate Extension Node and Branch Node? Can all branches from a Branch Node be embedded directly into an Extension Node? In this case, we would have just:

Extension Node - that would contain a common prefix for two or more other nodes and would have pointers to other nodes
Leaf Node - that would contain value and the remaining part of the key

If I understand it correctly this would:

remove one level of indirection
improve performance, since there would be fewer lookups in the LevelDB database

Am I missing something?


texts: Solidity: Store structured info for address

texts:
I'm currently writing a smart contract that is supposed to store some data for an address, more or less in the form of an "attribute" as implemented in EiP-1056. Contrary to EiP-1056 very flexible attribute mapping, I want/need a specific set of attributes to be set. Let's assume it is an attribute "a" of type "string" and an attribute "b" of type uint8.
I don`t want to allow only one to be set or none to be set. And I only want to retrieve them together using ONE function. Question is how to store them. I see the following options:

Create a mapping for each, i.e. mapping (address => string) a; and mapping (address => uint8) b; and have a retrieval function, such as function x(address i) returns(string, uint8) {}. Advantage: types are automatically checked. Disadvantage: Possibly more overhead in the smart contract (?)

Store a plain serialized JSONObject containing both values, e.g. {"a":"xxx","b":5}. Advantage: plain and simple. Disadvantage: No control of the contents of the object.

Put everything in a Struct, e.g. struct data{string a; uint8 b;}. Advantage: Clear structure of data. Disadvantage: Cannot be returned in one piece.

What would be the preferred way to go here?
Any other options that might be useful here?


texts: Is it possible to attack "the DAO" attackers new splitted DAO?

texts: Since the splitted DAO (dark DAO) has the exact same vulnerability in its code, is it possible to execute the same attack to the attackers DAO?


texts: What data makes up an Ethereum "account"? How can I recover an "account"?

texts:
(I don't know if "account" is the right term. I suppose an Ethereum "account" is a certain kind of entry in the Ethereum blockchain.)

Suppose I create an "account" with geth: geth account new.

One day, the key files in ~/.ethereum/keystore dissapear. Certantly, Ethereum accounts live on the Ethereum blockchain, not on my drive, so that doesn't mean my account has "died".

I have the following data:

The public key, aka. address
The ICAP
The "created key" (What is the technical name for this?)
The password I used to create the account with geth

Are these data sufficient to access my account?

If not, what additional data would I need?


texts: Launch more than one node connected to Rinkeby from the same machine (change the port doesnt work)

texts:
I would like to know if it is possible to launch more than one node connected to Rinkeby from the same machine through Geth and Mist.

In a local testnet, it is possible to do it changing the --port and --rpcport, but I am trying the same connecting to Rinkeby and I get the following error:

    Database closed
    Fatal: Error starting protocol stack: Access is denied.

I can launch another geth instance just if I disable the ipc-rpc (--icpdisable), but it is not the right solution since it is not possible to deploy Mist.


texts: How should users interact with a smart contract from my platform?

texts:
When deploying a smart contract how can I let users in my own platform (mobile or web) interact with it?
Let's say I have the following contract:

contract Test {
    event Log(address addr);

    function logMe () public {
        Log(msg.sender);
    }
}

In order to use it I must have access to the private and public keys of the user. Is it possible to allow users to interact with the blockchain through their own accounts without the need to have their credentials?


texts: Does smart contract reside on every node after deploying?

texts:
After deploying the smart contract,
it will be compiled as bytecode and run on EVM,
does the bytecode only belong to the deployer or the bytecode resides on the ledger shared by each node in the network(every node has the bytecode)?


texts: Ropsten: Sending a transaction from geth to metamask and metamask to geth

texts:
Starting I did this:

geth --testnet removedb
geth --testnet --rpc --fast --cache=1024

Using geth attach and looking at eth.syncing, I had currentBlock: 898328.  It stopped syncing there roughly and now eth.syncing is false.

Using Metamask I send a transaction to the same wallet geth is using.  Looking in geth with eth.getBalance(eth.coinbase) shows 0.  On etherscan I see transactions from Metamask, but not from geth.


texts: Maximum number of public keys in the ethereum universe

texts: Is there a formula to determine the maximum number of public keys (wallets) in the Ethereum universe?


texts:
I'm trying to do an external function call in assembly.
So I have to prepare a memory area that store the input args.

But where's the address that I should start with mstore?

I mean, there are some solidity code before my assembly {...} part, is there any pointer that always points to the current end of used memory?


texts: How to create multiple connected addresses?

texts:
I didn't see anything on here so I figured the community would benefit as well, plus I really am curious.

Lots of exchanges (or online wallets) have no fees when transferring BTC or ETH or etc between to accounts, for example sending 1 Ethereum from your Coinbase account to your friend's Coinbase account is free (or at least was I don't know about nowadays cause everything is getting to be expensive)

My question is, do these exchanges or etc actually do a transaction and have to pay fees, and just not charge us for inter-exchange transfers?

or

They don't have to pay because they have a certain type of wallet or etc where 1 huge wallet has sub-wallets and doesn't require a fee to transfer between them?

I just don't know how it would work and am curious of what is going on with that?

If there is a way, how could I create multiple wallets that wouldn't need to pay fees for every transfer between them? I feel like it's the opposite of a Multi-sig wallet. I don't know how this would work even still, because you can do an internal transaction of 0 Eth but still have to pay a mining fee.

Thanks


texts: How many Decentralised Autonomous Organisations (DAOs) are there?

texts:
Wikipedia gives a list of DAO's, although there are more than those 5 (one of the 6 in the list is no longer operating).
Is it possible to count them using code, or by observing various data? If so, how many are there?


texts: Efficient Solidity storage pattern for a directional weighted graph

texts:
I would like my graph's nodes to each have a struct of data and 0 or more pointers to other nodes.

It needs to be efficient for insertions of new nodes in between two existing nodes.

Should I use mappings, arrays, a combination of both?

Thanks in advance!


texts: Is it possible to add more tokens to already deployed contract

texts:
I have created smart contract and deployed it. Now I realized that I would like to extend my ICO but of course use the same tokens.

If I create new smart contract with the same name of token it would be whole new token. How can I add more tokens for old contract?
Is there any way to generate new tokens that will be the same as from original contract so I can sell more of them using new contract but at the end those should all be the same tokens?

Like printing dollars, they are new dollars but can be used as old dollars.


texts: Alternative to deprecated Greeter example code?

texts:
After loads of research, it seems the Ethereum.org Greeter example code no longer works. Here's the GitHub issues thread: https://github.com/ethereum/go-ethereum/issues/3793. There are some suggestions, one I will mention below, though, as a noob, it's still unclear.

This is a likely first place to land when starting to develop Ethereum, so I (and many others out there) are looking for a clear workaround.

Greeter example: https://www.ethereum.org/greeter

Running in geth console, here's the broken code with errors:

eth.getCompilers()

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

var greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) selfdestruct(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }' <-- obviously no error here

var greeterCompiled = web3.eth.compile.solidity(greeterSource)*

Error: The method eth_compileSolidity does not exist/is not available
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at <anonymous>:1:23

I HAVE been able to compile greeterSource with 'solc', and I tried this suggestion on the GitHub thread above, though I'm not sure this will work within geth console:

var fs = require('fs');
var exec = require('child_process').execSync;

exec('solc --bin --abi --optimize -o bin greeterSource.sol');

var abi = fs.readFileSync('bin/Greeter.abi');
var compiled = '0x' + fs.readFileSync('bin/Greeter.bin');

Even after npm install fs, I still get this:

Error: Cannot find module 'fs'
    at s (web3.js:1:160)
    at s (web3.js:1:122)
    at <anonymous>:1:10

This should handle the next step in the Greeter example:

var greeterContract = web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);

Again, new to Ethereum development, Im sure after a bit I will have a better grasp on the fundamentals, though considering this example is coming from Ethereum.org, this should be easier! Thanks!

P.S.> Also open for advice on an overall better dev path. I do like starting with command line to learn, though once I get it, what tools would you recommend?


texts:
I'm looking to integrate ERC-20 Token into my shop. Now I have a lot of products so I need automated system to keep track of payments. I did some reading and it looks like if I write smart contract to handle this I would need to prompt user two times (one for allowance and one for transfer) which is not great. I wonder what is the common practice of handling this issue ? I know that ERC-223 solves that problem but unfortunately most tokens are ERC-20.

Another solution is maybe to generate new address for each purchase, but then I would need to transfer ETH to each address in order to move tokens which could get very expensive.


texts: How do I find the ABI/JSON Interface for an ETH/ERC20 contract?

texts: I sent TUSD to my Bittrex holdings to trade for other coins, but it never went into my account with Bittrex. They claim that I sent it to the wrong address. I am trying to recover these tokens so that I don't become homeless again, but as a novice, am finding this to be extremely difficult. I am presently trying to send these same ETH/ERC20 tokens back to my Nano Ledger X via MyEtherWallet.com, but I need the ABI/JSONInterface and don't know where to find that. I am not including the TXID or the EtherScan.io URL here because, as a novice, I don't know if that is a security risk. Thank you in advance for any help that you may be able to provide.


texts: How can i detect the blockchain fork event?

texts:
How should I handle blockchain forks in my DApp?

In this question, a module named  reflux-tx is introduced, which can help to trace the transaction state and watch for the blockchain fork event.

But my project is written in python. Is there exists something similar to reflux-tx implemented in python?

Cause i'm on my ethereum browser project, so it's necessary to find the blockchain fork event to update my database.

Is there any can help me? Thanks for your advices !


texts: GetAll - UnimplementedFeatureError: Nested dynamic arrays not implemented here

texts:
I am creating the following contract:

pragma solidity ^ 0.4.17;

contract TodoList {

    event NewTodo(uint todoId, string value);
    event DeleteTodo(uint todoId, string value);

    mapping(uint => address) public todoOwner;
    mapping(address => uint) ownerTodoCount;

    TodoItem[] public todoItems;

    struct TodoItem {
        string value;
        //TODO submit ether to a TodoItem
        bool active;
    }

    function createTodo(string _value) internal returns(uint) {
        uint id = todoItems.push(TodoItem(_value, true)) - 1;
        todoOwner[id] = msg.sender;
        ownerTodoCount[msg.sender]++;
        NewTodo(id, _value);
        return id;
    }

    function getAllTodos() constant returns(string[], bool[]) {
        uint length = todoItems.length;

        string[] memory values = new string[](length);
        bool[] memory actives = new bool[](length);

        for (uint i = 0; i < length; i++) {
            values[i] = todoItems[i].value;
            actives[i] = todoItems[i].active;
        }

        return (values, actives);
    }
}

I would like to display all todos by a user. For this I created the getAllTodos function.

However, when doing truffle compile I get the following error:

  UnimplementedFeatureError: Nested dynamic arrays not implemented here.

Any suggestions how to access all todos?


texts:
Here is the documentation for Ethereum RPC. It looks straight forward enough, but I just need a list of servers that implement the RPC.

https://ethereumbuilders.gitbooks.io/guide/content/en/ethereum_json_rpc.html

Can I get some Urls to hit so I can actually this working?

Note: I am not trying to run a node locally. I need to hit an existing stable API server which already exposes the RPC calls to the web.


texts:
I am trying to sync the parity wallet by running

parity --warp

Apparently this is only meant to take a couple of minutes, but this has been going on for a couple of hours.

Does any know how much time/space the warp sync to meant to take? Am I doing anything wrong?


texts: Setting variable using constructor or methods

texts: Would it be optimal to set variables within a smart contract using the constructor or using different set methods? Where would you use each case? I'm assuming setting them in the constructor would save fees since you don't need to keep calling functions within the smart contract.


texts: How do I find out the solidity compiler version I am using?

texts:
Specifically, while using Mist. When I create a contract via the Mist GUI, I want to then be able to verify the source code over at Etherscan.  However, Etherscan requires that you provide the compiler version and whether or not optimizations were enabled.

How can I find the version of the compiler for the version of Mist that I have?
Are optimizations always enabled or always disabled?
Does TEST-NET vs Main net make a difference?

Note: I am looking for an answer to how to find the compiler version, not the current Mist compiler version (which will change making the answer only transient).


texts:
I am getting the error "Unable to parser number" while using ethjsonrpc library to connect to geth local ethereum network. Any help on this will be highly appreciated

tx =rpc_.call_with_transaction(rpc_.eth_coinbase(), contract_address, 'Add_Event(string,string,s
tring)', [df.loc[index_value]['UUID'], event_str, column_str])
  File "build\bdist.win-amd64\egg\ethjsonrpc\client.py", line 120, in call_with_transaction
  File "build\bdist.win-amd64\egg\ethjsonrpc\client.py", line 333, in eth_sendTransaction
  File "build\bdist.win-amd64\egg\ethjsonrpc\client.py", line 55, in _call
ethjsonrpc.exceptions.BadResponseError: {u'jsonrpc': u'2.0', u'id': 0, u'error': {u'message': u'Unable to parse number', u'code': -32602}}


texts:
I'm kinda new to Solidity, sorry for this in advance. I'm building a Dapp and cannot understand how to get a mapping or an array from a Struct. This is the struct that have inside a two mappings and one array.

struct Something {
    uint256 var;
    string[] array;
}

This is the result printed in the console:

{
    var: "17"
}

As you can see, the call returns only level one attributes.

How to get that array from the struct?

Thanks in advance.


texts: Ability to easily manage attributes in Solidity Struct

texts:
Below is a very simple smart contract which has a struct Instructor which has 3 attributes right now i.e. age, fName, and lName. Now if tomorrow I wish to add a new attribute I will need to update all the places where this struct was being used in the respective smart contract, which is a bad point from scalability and code maintenance perspective.

so question, Is there a better way of handling this situation?

pragma solidity ^0.4.18;

contract Courses {

struct Instructor {
    uint age;
    string fName;
    string lName;
}

mapping (address => Instructor) instructors;
address[] public instructorAccts;

function setInstructor(address _address, uint _age, string _fName, string _lName) public {
    instructors[_address].age = _age;
    instructors[_address].fName = _fName;
    instructors[_address].lName = _lName;

    instructorAccts.push(_address) -1;
}

function getInstructors() view public returns(address[]) {
    return instructorAccts;
}

function getInstructor(address _address) view public returns (uint, string, string) {
    return (instructors[_address].age, instructors[_address].fName, instructors[_address].lName);
}

function countInstructors() view public returns (uint) {
    return instructorAccts.length;
}

}


texts: What was the approximate cost of 1 ETH during pre-launch (Aug 2014)

texts:
The ETH pre-launch allowed people to exchange Bitcoins for ETH at a determined value.

What was this exchange rate in USD?

E.g. 1 Bitcoin got you X Eth, which was worth about $Y.


texts: On Etherscan the daily GasUsed chart shows current usage of 10-15 bill.  How do I convert this correctly to ether (ETH)?.


texts: Why does a test that passes in Truffle fail when run against testrpc

texts:
Using Truffle and testing against both Truffle's own blockchain and against testrpc yields different results.

I am trying to test that my deployed contract is setting its owner correctly (owner being set to msg.sender in the constructor)

contract Cocktail {
  address public owner;

  function Cocktail() public {
    owner = msg.sender;
  }
}

My Migration script is like

module.exports = (deployer, network, accounts) => {
  const superuser = accounts[0]
  console.log('Deploying to network', network, 'from', superuser)

  deployer.then(() => Cocktail.new({ from: superuser })).then((cocktail) => {
    console.log('Deployed Cocktail with address', cocktail.address)
  })
}

My test is like

const Cocktail = artifacts.require('./Cocktail.sol')

contract('Cocktail', (accounts) => {
  const superuser = accounts[0]

  it('is owned by superuser', () => Cocktail.deployed()
    .then(instance => instance.owner())
    .then((owner) => {
      assert.equal(owner, superuser, `Expected the owner to be '${superuser}'`)
    }))
})

If I just use Truffle's own blockchain and run truffle develop then compile, migrate, then test it's all good.

Contract: Cocktail
  ✓ is owned by superuser

If I fire up testrpc and run truffle test however it claims to migrate okay but the test fails:

Using network 'development'.

Deploying to network development from 0x9aa5b3cee03060172ec9968a49857c2a68341f67
Deployed Cocktail with address 0x2294c2ef0db6994cf0c5a777e10e5be5e7aab69b

  Contract: Cocktail
    1) is owned by superuser
    > No events were emitted

  0 passing (86ms)
  1 failing

  1) Contract: Cocktail is owned by superuser:
     Error: Cocktail has not been deployed to detected network (network/artifact mismatch)

What is going on?


texts:
Why didn't the transaction go through? What is the reason?Transaction has been reverted by the EVM
0xc3519e53c2502987698055bc9ce33d8e439d27afe16b90bd4ad77c0c1c674ff3


texts: Can I make a transaction that sends funds directly to the address an ENS domain resolves to?

texts:
For example, firefly.eth currently resolves to 0xce31f0ad68d9565004bbe351a8677eb74c86866d

Without my software knowing or looking up the specific address "0xce31f0ad68d9565004bbe351a8677eb74c86866d" before it creates the transaction (the way almost all wallet software supporting ENS does/will do), can I sign a transaction which sends funds from my externally owned secp256k1 account directly to "whatever firefly.eth resolves to" without knowing that information at the time the transaction is created?  I dont want to send it to some type of custom built contract that first resolves firefly.eth and then forwards my funds to "0xce31..." once it obtains it.  I want the funds to go directly from my account to "0xce31..." so that if "0xce31" checked the msg.sender it would consider the funds to have come from my account directly.

Is this possible?


texts: Web3JS + React: Fetching API data to use in a call

texts:
I have the following solidity function:

contract testCall {
    string private globalKey;

    function setKey(string key) public {
        globalKey = key;
    }
}

As this function is called from the React client, I need to construct a promise that would fetch the key from an external API https://KEYAPILINK, which returns only one string, so that:

the user clicks on a button,
the key is being fetched from the API
the fetched key is then inserted into the Web3JS call as the setKey(fetched_key)

Can't put together the code of this promise. What would be the best way?


texts: web3.eth.contract is not a function when making contract

texts:
Whenever I try and make a contract, I get:

  web3.eth.contract is not a function

I'm using this code:

const path = require('path');
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');

const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

// Compile the source code
let input = fs.readFileSync('./contracts/ProofOfExistence3.sol', 'utf8');
let output = solc.compile(input, 1);

let abi = JSON.parse(output.contracts[':ProofOfExistence3'].interface);
let bytecode = output.contracts[':ProofOfExistence3'].bytecode;

let gasEstimate = web3.eth.estimateGas({data: bytecode}).then(console.log);

// Contract object
let MyContract = web3.eth.contract(abi);

And if I only run this code below, I get undefined. The same code works in the browser but not in nodejs with the official web3 package.

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

console.log(web3.eth.contract);

Returns undefined.

Any ideas? I'm running "testrpc" locally.


texts: Why does nonce have to increment by one? Wouldn't it be sufficient to require unique nonces?

texts:
For replay protection, it would be sufficient to require a unique nonce for every transaction from the same address. More precisely, it would be sufficient to consider a new transaction T from an address A with a nonce N inadmissible in the ledger if another transaction T' from A with nonce N already occurs in the ledger.

But Ethereum is more strict. Roughly speaking, it considers a transaction T from A with nonce N inadmissible in the ledger if N is not equal to M+1, where M is the nonce of the last transaction from A in the ledger.

Why is that? Why is Ethereum more strict than it needs to be?

I can think of two reasons:

The stricter approach is more efficient (in space and time) to check.
The stricter approach gives users a way to control the execution order of their transactions.

Are there other reasons?


texts: Geth console - list active RPC connections

texts: Is it possible to list open RPC connections (to instances of MetaMask, for example) on a Geth node console?


texts: How can we trust Substratum tokens if they are not open source?

texts:
Substratum is a token that is going to be used to pay people to run decentralized web servers.

Presumably their tokens will have functions that their as of yet undeveloped webserver code will interact with.

Is it possible for them to add additional code to the token as they develop the rest of their infrastructure?

I don't see how they can know how to build the token without first having the server code.

Also, if their token code is not open source (which it isnt) why do investors trust them enough to invest millions?


texts:
When I open the below HTML code in Mist 0.11.1 the popup shows empty that is window.Web3 is undefined!

How to make window.Web3 to work in Mist?

My code similar to this works in MetaMask but not in Mist.

<title>Test Web3</title>

Test

I experiment on Ubuntu Linux 18.10.

Well, a real code from this site:

async function myweb3_init(init) {
    var web3js;
    // Modern dapp browsers...
    if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
            // Request account access if needed
            await ethereum.enable();
            // Accounts now exposed
            init();
        } catch (error) {
            // User denied account access...
        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider);
        // Accounts always exposed
        init();
    }
    // Non-dapp browsers...
    else {
        alert('Non-Ethereum browser detected. You should consider trying MetaMask!');
    }
    return web3js;
}


texts:
I have my contract and people can buy my tokens via web3 and MetaMask. Now when I try to execute sell() function throw an exception and always Etherscan says Failed.

I set to sell and buy prices on my contract.

Here is my sell function:

/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
    require(address(this).balance >= amount * sellPrice);      // checks if the contract has enough ether to buy
    _transfer(msg.sender, this, amount);              // makes the transfers
    msg.sender.transfer(amount * sellPrice);          // sends ether to the seller. It's important to do this last to avoid recursion attacks
}

I don't know what more I have to do. Does someone have any idea to help me?

UPDATE:
Full code: https://pastebin.com/eBYC77GV.

UPDATE2:
Etherscan Report: https://etherscan.io/tx/0x1213ca9540b8b7c0bd34f09dac906906772416a31e3b01559d0c0a3c05582a19

Thanks.


texts:
While testing ERC-721 implementation from https://github.com/m0t0k1ch1/ERC721-token-sample/blob/master/contracts/MyNonFungibleToken.sol and trying to query the method supportsInterface I got the expected result in this case:

// bytes4(keccak256('supportsInterface(bytes4)')) = 01ffc9a7
supportsInterface(0x01ffc9a7);
    bool: true

But not in this other case:

// Checking for example support for function tokensOfOwner()
supportsInterface(0x8462151c);
    bool: false

Any idea why returns false on second case? If worng, how should I properly query the function? Thx!


texts: How to compile solidity AST to binary code?

texts:
I want to do some automatic transformation of solidity source code. For this reason, I thought to get its AST representation using solc --ast or solc --ast-json and modify it.

My questions are:

What is the best approach to modify the AST? Should I use the text or json representation?
How do I compile the modified AST to binary code? Do I have to convert the AST back to source code, and if yes how can this be done?
Are there any existing tools that provide such desired functionalities?


texts: Can a view function from a funded smart contract execute a send() transaction on an external contract?

texts:
I'm creating an open source voting app with a Node.JS front end.  I'm hoping I can create a smart contract that can use funds allocated to it at creation time, so that participating voters don't have to pay to vote.

Normally transactions with a smart contract that require gas require the transactions to be signed.  In the web app context this typically leads to the use of the Metamask plugin when the client app is a browser.  I would like to create an app context where each participating voter does not have to sign/fund each vote (i.e. - each transaction).

BAD IDEAS

Originally I assumed the only way to do this is to have a trusted server "proxy" the user's vote and make an Ethernet payable transaction on the user's behalf using the private key of the smart contract creator.  But I believe that approach is too awkward to be useful because of the apparent available app implementations:

have the contract creator sign each transaction related to each vote as each vote was cast, an awkward idea at best, dead in the water at worst.
batch all the votes and have the creator sign a single transaction to execute the votes against he smart contract.  This sucks because you wouldn't get to see each vote show up on the blockchain as each vote was cast.
store the creators key on the trusted server and proxy-sign on their behalf. This is also a dead approach because it's a security nightmare and no-one is going to accept it.

IDEA: TWO COOPERATING SMART CONTRACTS?

This is the only reasonable approach I can think of but it depends on one technical detail being possible, that of being able to execute a send() transaction from a view function from one contract against another external contract.

Here is how I see it play out.  Two smart contracts are created.

1) The administrative/funding contract.  This contract is funded at creation time by the vote creator and contains the funds allocated to facilitate the vote.  The funds come from the vote creator when the vote is created.  When the vote is closed, any funds left over are sent back to the creator.

2) The voting contract.  This contract records votes as they come in and has a function to close the vote.

As a vote is made from a web page that is part of the Node.JS app, the web page uses Web3.js to call a view function in the administrative/funding contract that acts as a proxy for the user's vote.  It uses the funds it has on hand to call the vote function in the voting contract.

So my questions are:

1) Is it possible for a view function to execute a send() call on an external contract?

2) Will this technique work?

3) Is there a simpler idea with one smart contract that would work?

4) If the above idea isn't workable, is there any way to accomplish the task of having a voting smart contract(s) where you can eliminate the need for participating voters to fund each vote transaction?

As usual, if you know of any smart contract example/tutorial that does this, please leave a link.


texts:
I'm newbie in Ethereum and actually, I'm trying to implement test application which is using smart contracts. On UI I'm using web3.js

Currently, I'm looking for, how user can sign transaction (password, private key, something else). The transaction makes some data manipulation in Smart Contract.

Could you please suggest me best practice for this?

I know, that one of the most popular approach is Metamask, but for me it doesn't good approach. Because, it works only in one browser and with pre-installed plugin. I want to have something what will work for all.

Thanks in advance.


texts: Can someone suggest me a tutorial or explain how to verify ethereum transactions in a non financial use case of blockchain. For example, I am using blockchain to distribute access tokens for my IoT and the miners should verify if the access token is valid or expired and such. what are the changes to be made in order for blockchain miners to verify for this information in a transaction.


texts: where does function variables get created?

texts:
function element() public  returns (uint) {
  uint test = 20;
  return test;
}

Where would test variable be created ? in memory or stack ?
The funny thing is from testing assembly, I can see that it's not in memory. I am just curious why ?
This is what I found on the internet.


texts: Does returning "false" prevent bool function from further execution in Solidity?

texts:
example:

 function proceed() returns (bool success) {

if (msg.sender != owner) return false;

        return important_function();
    }

So important_function shouldn't be reached if msg.sender isn't owner (condition above returns false). This will give bad jump dest or revert, correct? Thanx!


texts:
I have a on-going small private chain could be seen here. I have only few nodes, hence difficulty is pretty low and average block time is high (around a minute). So it can easily attacked with someone who has high computational power, overall it is not that useful and trustable chain.

I want to change my on going private-chain's consortium as from Proof-of-Work into Proof-of-Stake, if possible instead of creating a new chain, I want keep my chain's information. Please note that I control all nodes in the network.

Theoretically,

[Q] Is it possible to change Proof-of-Work into Proof-of-Stake consensus algorithm of an on-going Ethereum private chain? or in order to accomplish this, do we have to create a new chain initialized with Proof-of-Stake consensus algorithm on the genesis block? If yes, how?

[Q] What is the difference between Parity's [ 1 ] and Nixops [ 2 ] approach? Which one is recommended to use?

Some references I found related to this topic:

Rinkeby Ethereum testnet, which uses Proof-of-Authority,
Proof of Authority Chains [ 1 ] and Rolling your own Proof-of-Authority Ethereum consortium [ 2 ].

Thank you for your valuable time and help.


texts: Is it possible to write a smart contract that can execute custom solidity code send to it as data?

texts: Is it possible to write a smart contract that can execute solidity code send to it as data?


texts:
I'm new to ethereum and tried to create a basic token, I deployed contract according with instruction on ethereum website but for some reason it stuck on "deploying contract" phase.

My wallet is fully synced, and transaction is confirmed about a day ago but I don't see my token on contracts page in the wallet and can't access admin page - it still says "creating contract".

Etherscan sees my token, but my wallet does not: https://etherscan.io/token/0x7c8a25cecf3e1d782028cb0ae7f0e23d2a87410c

Would be grateful for any suggestions of what can be wrong and what can I do to resolve this issue.


texts: What is "1" parameter in solc compile function call?

texts:
In the following code:

var compiled = solc.compile(sourceCode,1);

What is the value "1" symbolising?


texts: Issues with extreme large solidity mapping

texts:
Is there any scalability problem if the number of items of a solidity mapping increase too much? For example, any problem when adding, changing or removing some item in the dataset? Or any other problem?
I know the key is calculated using hashes, which minimizes a lot of these kinds of issues, but I want to check if any issue will always be possible with extreme volumes.


texts: What is the --force-sealing option in the parity for

texts: Can someone please explain what the --force-sealing option is for? From the description I don't understand exactly what it's doing. I want to understand why it must be set if I want to get a pending block using the rpc method eth_getBlockByNumber. If it's not set, the method instead of the pending block will return the last block from the blockchain and I want to figure out why.


texts: How can I use Geth (or any other client) to get a list of my peer nodes on the Ethereum network. I see there's a function to get the number of nodes using the web3 api, but I need a list of node IDs or IPs.


texts:
I have a problem when I call the function selectWinner(), send some ether with it to pay for Oraclize. I am using Rinkeby with Infura and metamask for the test accounts. I get an error in the meta mask that says:

Transaction Error. Exception thrown in contract code.

And then the transaction fails.

pragma solidity ^0.4.23;

contract Lottery is usingOraclize {

  uint lotteryFee = 0.1 ether;
  uint8 counter = 0;
  address[10] participants;
  mapping (address => bool) checkParticipant;
  address public owner;
  bytes32 public oraclizeID;
  uint public winnerNumber;

  modifier onlyOnce() {
      require(checkParticipant[msg.sender] == false);
      _;
  }

  function participate() external payable onlyOnce returns(address) {
    require(msg.value == lotteryFee);
    checkParticipant[msg.sender] = true;
    counter = counter + 1;
    participants[counter] = msg.sender;
    return(participants[counter]);
  }

  function getBalance() public view returns (uint) {
    uint contractBalance = address(this).balance;
    return(contractBalance);
  }

  function selectWinner() payable public {
    oraclizeID = oraclize_query("WolframAlpha", "random number between 1 and 10");
  }

  function __callback(bytes32 _oraclizeID, string _result){
    if(msg.sender != oraclize_cbAddress()) throw;
    testString = _result;
    winnerNumber = parseInt(_result);
    uint maxRange = counter;
    uint randomNumber = uint(sha3(_result)) % maxRange;
  }

  function payTheReward() external returns(address){
    address winnerAddress = participants[winnerNumber];
    uint currentBalance = getBalance();
    winnerAddress.transfer(currentBalance);
    deleteParticipants();
    return (winnerAddress);
  }

  function deleteParticipants() internal {
    uint8 a = counter;
    for(uint8 i = 0; i < a; i++) {
      checkParticipant[participants[i]] = false;
      participants[i] = 0;
    }
    counter = 0;
  }
}

I am using Javascript to call it:

selectTheWinner: function(){
 App.contractInstance.selectWinner(
   { from: App.account,
     value: App.web3.toWei(0.1, "ether")
   }
   ).then(function(addr){ console.log(addr)})
     .catch(function(error){ console.log(error); });

My contract number is: 0xFD05EE7F1660fcaDF5BB618cA5b09e6C564F99cF


texts: Technical Question Ether to BNB transfer

texts:
I attempted to swap funds from Ethereum to BNB via the Binance Bridge feature and pancake swap via my Metamask.
I was trying to send the ETH to myself. I did not have any BNB to do the transaction, however the transaction sent in ETH.
I have the eth address that was created by the BSC Bridge but the transaction can only be found on the ETHERSCAN, not the BSC CHAIN.
The transaction was successful but cannot find the ETH any where; I can see the transaction withdrawal in my Metamask, but no deposit in my BSC.
I'm completely lost as to how to retrieve the funds. I can see where they have gone (supposedly me) but I cannot see the funds in Metamask.
Can anyone assist?


texts: Any C library available to interact with an Ethereum smart contract?

texts: I need a C library that enables to create, sign transactions and interact with the smart contract.


texts:
I am trying to execute a script in my truffle project. The script is located in the scripts folder. But whether I run the command from within the root of the project or inside the scripts folder, it cant seem to find my file NiftRouter01.sol which is located in another project. I am using command truffle exec './deploy_pool.js' --network bscTestnet
C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\commands.bundled.js:455204
        throw new Error("Could not find artifacts for " + import_path + " from any sources");
        ^

Error: Could not find artifacts for ../../niftswap-periphery/build/contracts/NiftRouter01.json from any sources
    at Resolver.require (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\resolver\dist\lib\resolver.js:43:1)
    at D:\Blockchain\pancake\pancakeswap-core\scripts\deploy_pool.js:2:26
    at Script.runInContext (vm.js:131:20)
    at Script.runInNewContext (vm.js:137:17)
    at Object.file (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\require\require.js:94:1)
    at Object.exec (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\require\require.js:121:1)
    at internal/util.js:297:30
    at new Promise (<anonymous>)
    at bound exec (internal/util.js:296:12)
    at C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\exec.js:88:1
Truffle v5.1.49 (core: 5.1.49)
Node v12.18.0


texts: Awarding tokens for a specific data provided ? Help

texts:
Let's say that I want to deploy a decentralized system where I would like for data providers to be automatically awarded with tokens for each data packet provided to the system. How would this work with token creation? Who would theoretically be the one 'mining' or creating the tokens assuming that I would like to exclude Proof of Work protocol?

Every answer would be appreciated


texts:
I am using the keccak256 hashing algo to retrieve a message for a signature however I am getting the return value above.

Here is the code:

function adminAuthorizedSwap(string price, string quantity,
    string sellerAddress, uint8 adminV, bytes32 adminR,
    bytes32 adminS) public payable returns(address, uint, uint, bytes32)
{
    bytes memory prefix = "\x19Ethereum Signed Message:\n54";
    bytes32 agreementHash = keccak256(prefix, price, "|", quantity, "|",  sellerAddress);
    //if the agreement hash matches then the trade can take place
    bool agreementIsValid = ecrecover(agreementHash, adminV, adminR, adminS) == admin;
    return(ecrecover(agreementHash, adminV, adminR, adminS), parseInt(price, 0),
        parseInt(quantity, 0), agreementHash);
}

price, quanitity and sellerAddress are all cast as strings.

The values passed to the function are: "100000000", "1", "0xFE6d4bC2De2D0b0E6FE47f08A28Ed52F9d052A02", 28,"0x023409a3bfeaa29209c72704a9ad3e9b95abf14f329c4582155d5533103e00d5", "0x699a3597749ac2ae016ed9fdc31c7f73b70d0a8860d7ffd68d32564957c4c38b"

please note that the message length is hardcoded for this example as I was testing a fixed message.

Here are the return values:

{
   "string price": "100000000",
   "string quantity": "1",
   "string sellerAddress": "0xFE6d4bC2De2D0b0E6FE47f08A28Ed52F9d052A02",
    "uint8 adminV": "28",
    "bytes32 adminR": "0x023409a3bfeaa29209c72704a9ad3e9b95abf14f329c4582155d5533103e00d5",
    "bytes32 adminS": "0x699a3597749ac2ae016ed9fdc31c7f73b70d0a8860d7ffd68d32564957c4c38b"
}
 decoded output     {
    "0": "address: 0x56953edcc55c834bf26fdfe00aba302b09c00202",
    "1": "uint256: 100000000",
    "2": "uint256: 1",
    "3": "bytes32: 0x0000000000000000000000000000000000000000000000000000000000000000"
}


texts: web3 providers for ethereum apart from metamask, to connect web and mobile dapps?

texts: I want to create a list of ethereum web3 providers available apart from metamask, which could be used to integrate blockchain functionalities in our apps or dapps created in various platforms (web app, mobile web app, iOS, Android, even desktop apps). Could you please specify all that you know. Would be really grateful. Thanks in advance.


texts: Contract factory function running out of gas during Truffle test

texts:
Using openzeppelin library and truffle I am trying to make a Contract Factory that creates ERC20 tokens. I prefer to test it with Truffle using solidity and not javascript.

Here is the code from the Contract

    pragma solidity ^0.4.24;

import "zos-lib/contracts/migrations/Migratable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "openzeppelin-solidity/contracts/ownership/Ownable.sol";

contract TokenFactory is Migratable {

    address[] public deployedTokens;

    function createToken(string name, string symbol) public {
        address newToken = new Token(name,symbol,msg.sender);
        deployedTokens.push(newToken);
    }

    function getDeployedTokens() public view returns (address[]) {
        return deployedTokens;
    }

}

contract Token is StandardToken, Ownable {
    string public name = "";
    string public symbol = "";
    uint public decimals = 2;
    uint public INITIAL_SUPPLY = 10000 * (10 ** decimals);

    constructor(string _name, string _symbol, address creator) {
        owner = creator;
        name = _name;
        symbol = _symbol;
        totalSupply_ = INITIAL_SUPPLY;
    }
}

and the Test

pragma solidity ^0.4.24;

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

contract TestTokenFactory {

    TokenFactory tk = TokenFactory(DeployedAddresses.TokenFactory());

    function testChildContractDeployed() public {

        tk.createToken("xxx","sym");
        address[] memory deployedTokens = tk.getDeployedTokens();
        Assert.equal(deployedTokens.length, 1, "Contact is not deployed");

    }

}

my truffle.js

'use strict';

module.exports = {
  networks: {
    local: {
      host: 'localhost',
      port: 7545,
      gas: 6000000,
      gasPrice:1,
      network_id: '*'
    }
  }
};

and the error after running truffle test --network local

  1) TestTokenFactory
         "before all" hook: prepare suite:
       Error: VM Exception while processing transaction: out of gas


texts: Blockchain Recent Scaling Proposals : (Sharding, blocksize , SegWit, GHOST, Lightning, multichains, sidechains, DAGs)

texts:
What are some of the most recent scaling proposals for Blockchain?

Ie. various blockchain scalability topics including the blocksize debate, SegWit, GHOST, Lightning, multichains, sidechains, blockDAGs.


texts: Ethereum Mist wallet 0.8.0 won't receive any payments anymore

texts: Mist would not receive any payments. I have not updated after 0.8.0. Is the reason because I have not done anything to choose which chain I will use?


texts: How does Solidity's sha3 / keccak256 hash uints?

texts:
This is not a question about the issue with Ethereum using a non-standard sha3. I have found the right JS hashing library, and am able to get matching hashes in JS and Solidity on byte strings. What I am wondering is how to represent a uint when passing it to the JS hash lib so that it results in the same hash as created by Solidity sha3.

JS
'0x' + keccak(
  1
)
// 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

Solidity
sha3(
  1
);
// 0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2


texts: Can someone please tell what the code would be to check ether balance at a particular point in time?

texts: I want to understand how to check ether balance at a particular point in time.


texts:
I hope this question is not bad one, but this has been something I have been having trouble understanding.  How does time in the blockchain work, and how can I utilize variables like block.timestamp and the like? I am creating a faucet where the user can withdraw a set amount of ether, then they have to wait one hour before they can withdraw more.

Edit for duplication:  I have looked at other explanations here on StackExchange, but it did not answer my question.  I would like to know how time is passed on the blockchain, and with this knowledge utilize block.timestamp. I apologize if I was unclear.  I am a beginner with creating Dapps, and want to learn! :)


texts: How to setup NFT on a marketplace for another person

texts:
I have been tasked to set up selling NFT on marketplaces like Opensea etc. The issue is how do I perform all these tasks without getting access to their wallet credentials or private key.
The only option I see is to access their computer screen and upload NFTs on marketplaces.
Thanks


texts: Uniswap V2 Router, Factory on Rinkeby testnet

texts: Is it possible to use Uniswap V2 router on rinkeby? What is the contract address of a router? i found only factory contract address ?


texts: The ERC721.sol provided by OpenZeppelin has a variable _holderTokens which is private. If I am writing my smart contract which inherits from ERC721.sol, is there any way to make that variable public so everyone can access it?


texts: What is insecure about generating a random number with keccak256?

texts: Just read that generating random a random number via keccak256 is insecure. What is insecure about it and what are the implications of insecurity?


texts: Is it best practice to check signature malleability in ecrecover

texts:
I am wondering if it is considered best practice to guard against signature malleability to check against the half curve order like this or if this is totally unnecessary.

uint256 constant HALF_CURVE_ORDER = uint256(0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0);

function verifySig(
    bytes32 hash,
    bytes32 r,
    bytes32 s,
    uint8 v
) public {
    require(
        uint256(s) <= HALF_CURVE_ORDER,
        "found malleable signature, please insert a low-s signature"
    );

    address signer = ecrecover(hash, v, r, s)
    // do stuff
}


texts:
I'm trying to run an external script in truffle.  Basically I deploy the contracts with 'migrate' then want to run this script to set the variables.  I just can't seem to get it to call correctly with:

truffle develop
compile
migrate
exec file.js

and my code:

var Factory = artifacts.require("Factory");

module.exports = async function(callback) {
    var factory = await Factory.deployed();
    console.log(factory.address);
    await factory.setVariables(1000000000000000,1000000000000000,7,1);
}

The console logs the correct address, but then it just hangs on the last part.  Any help is much appreciated!


texts: How to perform delegate call inside of view call (staticall)?

texts: Inside view method it's not possible to do delegatecall due to compilation errors. Is there any way to delegate view calls?


texts: Getting internal transactions of Ethereum transactions over RPC

texts:
I'd like to parse Ethereum transactions, so that I know internal transactions (the contract calling other contracts) and the amount of gas those used. For example the information is available here:

http://testnet.etherscan.io/tx/0x87a147aebe94eb532f951d55a10659ca62955bb1ba29f6aecdf1ddf069b96585#internal

I see I can get the transaction receipt object using web3.eth.getTransactionReceipt RPC method. How one would proceed from here and determine what internal transctions the transaction made?


texts: Help, I created an unencrypted myetherwallet private key

texts:
newbie here.  Have opened a myetherwallet wallet to view tokens only.  Unfortunately, the steps I chose landed my with an unencrypted private key!

Am I in trouble?  How can I get myself hidden and secure again?  How bad is this for my future with this private key??

Thanks, any help much appreciated...

Rick


texts: How to receive a fractional number as parameter to my function?

texts:
In my Solidity smart contract, there is a function that needs to receive an amount as parameter.

This parameter is the value to be used for a transfer function. Considering the user may need to transfer 1.25 Ethers, how can he input this data, as there´s not a data type for it?


texts: Unknown account while trying to send transaction via OptimismProvider

texts:
I'm trying to make use of OptimismProvider to sign the transaction on Mumbai Matic. I'm making use of provider.send("eth_sendTransaction", [hexTxn]) and instantiating provider object by:
const provider = new OptimismProvider("MUMBAI_MATIC_RPC_URL", new ethers.providers.Web3Provider(window.ethereum))
where hexTxn is the hexlified version of the txn format:
tx = { to: 'Contract Address', nonce: 0, gasLimit: 0, gasPrice: 0, data: '0x00', value: 0, chainId: 1 }
I'm making use of the below versions:
etherjs: 5.0.30
@eth-optimism/provider: 0.0.1-alpha.14
And I'm getting the below error:


texts:
I'm playing around with truffle and I have this simple program here that I can't seem to get to work...

contract MyContract {

  struct Test {
    bool testBool;
  }

  mapping (address => Test[]) public tests;

  function issueTest(address _owner) public {

      Test memory test;
      test.testBool = false;
      tests[_owner].push(test);
  }

  function setTestBool(address _owner, uint _index) public
    returns (bool sucess) {

    tests[_owner][_index].testBool = true;

    return tests[_owner][_index].testBool;
  }

  function getTestBool(address _owner, uint _index) public returns (bool testBool) {
    return tests[_owner][_index].testBool;
  }
}

in my test file I have:

let myContract;
  var reciever = web3.eth.accounts[1];

  before(async() => {
    myContract = await MyContract.deployed();
  });
it("Test Bool", async() => {

    await myContract.issueTest.call(reciever);
    var sucess = await myContract.setTestBool.call(reciever, 0);
    assert.equal(sucess, true, "Test Bool was set.");

    var result = await myContract.getTestBool.call(reciever, 0);
    assert.equal(result, true, "Bool is true.");
  });

When I do truffle test I get this error:

 Error: Error: VM Exception while executing eth_call: invalid opcode

I think the problem is with .call(). I dont understand what call does very well.

Any help would be great
Thanks!


texts: Can't Broadcast ethereum transaction, what's wrong with this transaction?

texts:
I used eth_sendTransaction with Parity to send some funds, but it does not seem to be getting mined.

The TX ID: 0x2b9d3c36d2cf2e56b5779f47c821791bdc6a0835b8b79c873bc221ff9e9e6a75

The raw transaction: 0xf86d0b85052804393483030d4094f1c19dbd4a9cf2693f55704911fbcde5f40d15b8881bc16d674ec80000801ba00ed29289d190f617db636b97b1186a3d7b7495fa6529619e22146515acc4c5c0a02dadd44c7242549378750b49ee761e603f297de370703a6578f14a10e3a3aa7f

I also have tried re-broadcasting the raw transaction here: https://etherscan.io/pushTx

Which seemed to work and give the same transaction ID, and then when re-attempting it gives the error: Transaction with the same hash was already imported.

So it seems that the transaction has been broadcast from both my node and from etherscan, but it isn't get confirmed?

I checked the gasprice which is the same as many other transactions being confirmed (0.000000022146201908 Ether) and the gas amount is sufficient.

Is there something wrong with this transaction?


texts: Is it possible to create a tool that reads smart contracts and check if it's safe?

texts: I'm really in need of help with my thesis project. I'm currently finding the gap that my adviser is asking for and I seem to be having a hard time with it. What I could think of is actually creating a tool that reads smart contracts and see the flaws and vulnerabilities of the coded smart contract. Could someone explain to me if this is possible and if there are any references that you might want to share or also some ideas for my thesis project. Currently studying computer science btw! Thank you in advance!


texts:
I just started trying to get into ethereum mining and originally wanted to try ethminer to mine from ethermine. I've tried setting up ethminer with both version 18.0 and 17.1, however, it seems that every time I try to run the startup batch file, the error: The following arguments were not expected: -O -FS -S would show up right after executing:
ethminer.exe --farm-recheck 200 -U -S eu1.ethermine.org:4444 -FS us1.ethermine.org:4444 -O 0x181c1Ee88CA71BEB03a6C2F38690DB3AD4787892.HOMERIG.
I just followed what some sites and youtube video showed to create the most basic startup batch file, so I have no idea what's going wrong in this instance.
For reference, the contents of my batch file is:
setx GPU_MAX_HEAP_SIZE 100
setx GPU_USE_SYNC_OBJECTS 1
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_SINGLE_ALLOC_PERCENT 100
ethminer.exe --farm-recheck 200 -U -S eu1.ethermine.org:4444 -FS us1.ethermine.org:4444 -O 0x181c1Ee88CA71BEB03a6C2F38690DB3AD4787892.HOMERIG
pause

Any help would be appreciated


texts:
I have created a contract on remix.ethereum.org and started the Ganache(http://truffleframework.com/ganache/) as private blockchain.
On the Remix I have configured Remix to work with Ganache through custom web3 provider which is my localhost.

It's a simple voting Dapp:

pragma solidity ^0.4.11;

contract VotingDapp {

  mapping (bytes32 => uint8) public votesReceived;

  bytes32[] public candidateList;

  function VotingDapp(bytes32[] candidateNames) public {
    // constructor
    candidateList = candidateNames;
  }

  function totalVotesFor(bytes32 candidate) public view returns (uint8) {
    if(validCandidate(candidate) == false) revert();
    return votesReceived[candidate];
  }

  function voteForCandidate(bytes32 candidate) public {
    if(validCandidate(candidate) == false) revert();
    votesReceived[candidate] += 1;
  }

  function validCandidate(bytes32 candidate) public view returns (bool) {
    for(uint i = 0; i < candidateList.length; i++){
      if(candidateList[i] == candidate){
        return true;
      }
    }
    return false;
  }

  function totalVotesReceived() external view returns(uint){
      uint sum = 0;
      for(uint i = 0; i < candidateList.length; i++){
          sum += votesReceived[candidateList[i]];
      }
      return sum;
  }

}

When I try to call function voteForCandidate I get this error from Remix :

Gas estimation failed
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
VM Exception while processing transaction: revert

When I try to force sending nothing happens.

Thanks


texts: Storing JSON data in Blockchain is it good idea?

texts:
I want to know, that storing JSON data in Blockchain is good idea or we can get some error? Beacuse if we enter all our data in struct we get "InternalCompilerError: Stack too deep, try removing local variables". Using Solidty compiler 0.4.26. By the way in blockchain have any limitation in string length? and how many bytes blockchain can store?
Thank you very much for your answers!
Cincerly, Mike!


texts: Is it possible to convert input data from etherscan to abi?

texts: the contract isnt verified but etherscan knows whats being called. how can we write what we got from the input data back into abi form


texts: It's tax time in Australia and I'm trying to get specific information from Etherscan of the trades I made on EtherDelta. I can track my deposits to and withdrawals from the EtherDelta contract address, but I'm having difficulty finding specifics of the trades I made. For example, I open up the deposit transaction and it just seems like a deadend... what happened after that? Is there a simple way to read details of the smart contracts via Etherscan? Also, is there any documentation about Etherscan and the information it displays?


texts: Solidity: Can you return dynamic arrays in a function?

texts:
I know I can return dynamic byte arrays in Solidity, such as in the following code:

function createMemoryArray(uint size) returns (bytes) {
    // Dynamic memory arrays are created using `new`:
    uint[2][] memory arrayOfPairs = new uint[2][](size);
    // Create a dynamic byte array:
    bytes memory b = new bytes(200);
    for (uint i = 0; i < b.length; i++)
        b[i] = byte(i);
    return b;
}

But is there a way to return something like a dynamic array of strings? I feel like this is just an implementation detail in Solidity, but it would be great if it just serialized everything nicely for me.


texts: How to pass array in web3js(0.20) as function parameter to solidity?

texts:
I have a function in solidity which take array as argument and processed that array.
    function add_level_income(address[] memory _referredBy, uint256 taxedTokenAmount) public returns(bool) {
     address referral;
     for( uint i = 0 ; i <= 2; i++ ){
        referral = _referredBy[i];
        if(referral == address(0)) {
            break;
        }
        uint256 commission = taxedTokenAmount * percentage[i] / 100;
        levelIncome[referral] = levelIncome[referral].add(commission);
     }

     return true;
}

This code is working fine..Now I want to pass array from web3js to solidity..but I'm not able to figure it out how?
I also cross-checked if the array is indeed array or not
function level_income() {
$.ajax({
    type: 'POST',
    url: 'get_referal.php',
    data: {
        usid: web3.eth.coinbase
    },
    success: function(ref) {
        console.log(ref);
        if (ref != '') {
            contract.add_level_income(ref, 100, {
                from: web3.eth.coinbase,
            }, (err, res) => {
                if (!err) {
                    success("level updated")
                }
            })

        }
      }
   });
 }

the ajax call successfully returns
["0x8a9bbe41228a82596f7ae4cff80377a7c8e0c25f","0xd74082a3385dc3a961c84bca85d238456744a6","0xc5f563e6b0f4690aeeee3e9306aae50b120010b31"]

but in response from solidity what I get is Uncaught TypeError: e.forEach is not a function
Error Trace:
Uncaught TypeError: e.forEach is not a function at o.encode (inpage.js:15) at inpage.js:15 at Array.map (<anonymous>) at d.encodeParams (inpage.js:15) at u.toPayload (inpage.js:15) at u.sendTransaction (inpage.js:15) at u.execute (inpage.js:15) at Object.success (auth2.js:1617) at fire (jquery-3.3.1.js:3268) at Object.fireWith [as resolveWith] (jquery-3.3.1.js:3398)
o.encode    @   inpage.js:15
(anonymous) @   inpage.js:15
d.encodeParams  @   inpage.js:15
u.toPayload @   inpage.js:15
u.sendTransaction   @   inpage.js:15
u.execute   @   inpage.js:15.
success @   auth2.js:1617
fire    @   jquery-3.3.1.js:3268
fireWith    @   jquery-3.3.1.js:3398
done    @   jquery-3.3.1.js:9305
(anonymous) @   jquery-3.3.1.js:9548
load (async)
send    @   jquery-3.3.1.js:9567
ajax    @   jquery-3.3.1.js:9206
level_income    @   auth2.js:1608
onclick @   index:246

PS: I'm using metamask injected web0.20 version...


texts: Unable to synchronize with Ropsten testnet with Geth 1.9.25

texts:
For the past two days I've been trying to synchronize with Ropsten testnet using the following command in Geth 1.9.25:
./geth --ropsten --rpc --rpcaddr="0.0.0.0" --rpcapi="eth, web3, personal" --syncmode=fast --cache=2048 --bootnodes "enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303,enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303"

Unfortunately, the node is approzimately 3000 blocks ahead of Etherscan.
Local: 10032595, Etherscan ropsten: 10029763
When I run eth.getBlockByNumber("10029763"), block and miner hashes do not match with etherscan.
The bootnode config was taken from official ropsten github.


texts: "Standard" Mist/Ethereum Multisig Wallet Safe?

texts:
I made a multisig wallet using Mist or EthereumWallet (don't remember exactly) in July 2016 and put some ETH inside. Now, given the Parity hack a few days ago, I am wondering if my multisig wallet is still safe. I am not a programmer so I couldn't "audit" the code.

I hope there was no bug at the time?!

I think the code used for my multisig wallet is discussed here, but I am not sure:
Where's the Solidity code for Mist's default multi-sig contract wallet?

Thanks!


texts:
I created a script that subscribes to PairCreated event on Uniswap using Web3 and Infura API.
The event works for a few minutes but stops working after a while (timeouts?). How can I make it watch the event indefinitely?
uniswapV2FactoryContract.events.PairCreated({})
  .on('data', async function(event){
    const token0 = new web3.eth.Contract(IERC20.abi, event.returnValues.token0);
    const token1 = new web3.eth.Contract(IERC20.abi, event.returnValues.token1);

    console.log(`New pair on Uniswap V2: ${await token0.methods.symbol().call()} ${event.returnValues.token0} - ${await token1.methods.symbol().call()} ${event.returnValues.token1}!`);
  })
  .on('error', console.error);


texts: How to get deployed library from truffle migration script?

texts:
I have smartcontract that linked to library. I see both address in truffle migrate results but I want to have their address inside migration script.
While I can get contract's address by contract.deployed() it doesn't works for library. Awaiting from deployer.deploy(library) also returns nothing.


texts: Does a string message increase the gas usage of a `require` statement?

texts:
In solc 0.4.22 onward, it is possible to provide a string message containing details about the error that will be passed back to the caller (in require, assert and revert statements).

Does the gas usage of these statements depend on the length of the provided string?

I assume that the answer is no, since it would otherwise imply that this information is saved on the blockchain, and AFAIK, reverted transactions are not saved on the blockchain.

If I am correct, then it means that it's the Ethereum node itself which somehow knows how to return this message back to the caller.

Am I correct, and if yes, how exactly is the Ethereum node able to do that? To my understanding, it would need to get the revert opcode (in the case of require and revert) or the invalid opcode (in case of assert) returned from the transaction, and determine exactly where they occurred within the code.

Also, if this is indeed the case, then it means that the deployed bytecode should contain the message, meaning that the gas cost of the contract-deployment itself depends on the length of this message. Is that correct?

Thank you!


texts: Viewing Tokens on Ganache or an alternative

texts: I'm currently working with the truffle suite and so am using ganache as my test blockchain. Is there something I can do with it or with a similar product to see token balances?


texts: Ok so this is a bit abstract, but imagine you have two ERC-721 contracts: GameCharacter and Weapon. You want each GameCharacter to own a Weapon. Is this possible?


texts:
I'm currently trying to work on sending Augur (REP) through geth. I've got the abi in, I can check my balance, I receive a txid after executing the transfer, but the tx never shows up on etherscan.

augur_abi = [{augur_abi is here}]

contract = web3.eth.contract(augur_abi).at('0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5');

contract.transfer("addressgoeshere",500000000000000000);

This is what I have so far. I should note that I'm running Parity 1.3.3 in Geth mode. The amount attempting to send with this particular test being .5

Any thoughts?


texts: Is the function of transferring a fraction of ERC20 token going to work in smart contract?

texts:
For a ERC20 token with decimal=18, there are plenty of decimal to handle something like 10.234. Here is a function to transfer a percentage of a balance:
uint256 public balance;  //in token
address public payable recipient;

function transferOnePercentage() public payable returns (bool) {
   ERC20token.transfer(recipient, balance * 1 / 100);
   return true;
}

When balance=525 and one percent is 5.25, is this function transferOnePercentage going to work and send 5.25 token to recipient?


texts: Hiding values from calculation (zkSnarks?)

texts:
In reference to a calculation of a  hidden stored value.

For example:
Account A & Account B
Both have  hidden stored values.

Accounts A cannot know B's  hidden stored value, and vice versa.

Is it possible for A to interact with B's value, without knowledge of B's hidden value.

Could a smart contract be written to allow A to interact with B's value without knowing (in this case compare and change the value?)

Im assuming this icovered by zkSnarks?


texts:
Do you know what is the purpose to serialize a transaction?
Here is an example:
const serializedTransaction = tx.serialize()
Thank you
Take care
Pierre


texts:
I accidentally transferred my ERC20 token to the wrong address from which then sent it onto a "contract" address. The contract information itself from is saying it now directly went straight to the contract address itself.

I don't know whether I have any options here for recovery? Can someone please advise me? Much appreciated.

Re: duplicate question, I read the post but I am wondering whether the contract has been written in a manner in which the recipient has the capacity to return the tokens.


texts: Is there any decentralized exchange to convert between eth and different chains?

texts: I found most of the decentralized exchangers can only convert among erc20 tokens but cannot deal the btc or other coins running on different chains. Is there any that can deal with this?


texts: Write current transaction hash in struct

texts:
My contract is

pragma solidity ^0.4.11;

contract UserBasic {
    struct Record {
        bytes32 _id;
        address _addedBy;
        uint _dateAdded;
        bytes32 _transactionHash;
        bytes32 _type;
        bytes32 _hash;
        bytes32 _signature;
    }
    // Type to records array
    mapping(bytes32 => bytes32[]) typeRecords;
    // Record ID to record
    mapping(bytes32 => Record) idRecord;
    // Add a record
    function addRecord(bytes32 _type, bytes32 _id) {
        typeRecords[_type].push(_id);
        var _new = Record(_id, tx.origin, now, "", _type, "", "");
        idRecord[_id] = _new;
    }
}

Whenever someone calls addRecord I'd like that transaction's hash to be the

bytes32 _transactionHash;

of the new record being created. I looked through the solidity docs but couldn't find anything there. Is this possible?


texts: How to use ethereumjs-vm to find the internal transactions for a transaction/block using infura.io

texts:
I am using infura.io as my node and trying to get the internal transactions (i.e. transfers initiated by smart contract) for a specific transaction (or its parent block). I have two attempts (both erroring out). It feels like I am missing something basic here.

Some setup code:

const Web3 = require("web3");
const VM = require('ethereumjs-vm');
const Tx = require('ethereumjs-tx');
const blockFromRpc = require('ethereumjs-block/from-rpc');
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/' + process.env.INFURA_API_KEY));

const vm = new VM();

When I try this:

web3.eth.getTransaction('0x6b871b7db60454cf97fe7b5d0bb1192f23984e35990dfeeb8df5b9295d0eaaf5')
    .then(tx => {
        web3.eth.getBlock(6189875)
            .then(block => {
                try {
                    vm.runTx({
                        tx: new Tx({
                            ...tx,
                            data: tx.input
                        }),
                        block: blockFromRpc(block)
                    }, function(err, results){
                        console.log('returned: ' + results.logs);
                    });
                }
                catch(e) {
                    const i = e;
                }
            });
    });

I get an error:

  The sender does not have enough ether to send this tx

and when I try this:

web3.eth.getBlock(6189875)
    .then(block => {
        try {
            vm.runBlock({
                block: blockFromRpc(block),
                //block
            }, function(err, results){
                console.log('returned: ' + results.logs);
            });
        }
        catch(e) {
            const i = e;
        }
    });

I get an error:

  base free exceeds gas limit

Whats going  on? I just want to replay the transaction or block so that I can see the internal transactions.

Thanks in advance.


texts: Which is the node, to which metamask is going to connect?

texts:
I know that metamask is using Geth client, but which node is it going to connect if I select main network to connect.
Generally we use our node server and connect it with client, but how metamask works?


texts: How to call a function of a deployed smart contract in ethereum from another smart contract?

texts:
I have a smart contract deployed at a particular address(say, 0xABC). This contract is ERC20 token(say, ABC token) smart contract. This contract was deployed on **Nov 2017.**

Now I want to have another smart contract that can act as an Escrow, that can hold ABC token until a specific condition is met. This contract is yet to be deployed.

So, how the Escrow contract can accept the ABC token and and release the ABC token to the valid user after the condition is met?
I want to call .transfer() method of ABC token contract from Escrow contract, To get and release funds from Escrow.

Note: This both smart contract are deployed at different address, since they are deployed at different time.


texts:
When I successfully compiled and deployed contracts using Truffle and ganache-cli, I typed truffle develop to get into the truffle(develop)>, and then typed let instance = await Factory.deployed(), it then showed Uncaught Error: CONNECTION ERROR: Couldn't connect to node http://127.0.0.1:9545/. But actually I have opened the new ganache-cli by the command  ganache-cli -p 9545 (successfully run and showed Listening on 127.0.0.1:9545) before that.
Why this happened and what can I do?


texts: How many times has the Ethereum mining difficulty bomb been pushed back?

texts: Ethereum has a built in mining difficulty bomb to force an upgrade. How many times have the difficulty bomb been pushed out? And by pushing out this mining bomb, doesn't this create more ETH into the ecosystem?