texts:
I have a problem with adding new opcode to solidity. I'm using solc (on C++) and geth(ethereum on Go). I want to add new opcode, that takes address payable, uint256, uint256, bytes memory and returns bytes memory. So I have a problem with return value.
Some peaces of code below, I will skip some files, to make question shorter.

Solc

libsolidity/codegen/ExpressionCompiler.cpp

// ExpressionCompiler::visit(FunctionCall const& _functionCall)
case FunctionType::Kind::MyOpcode:
{
    acceptAndConvert(*arguments[0], *function.parameterTypes()[0], true);
    acceptAndConvert(*arguments[1], *function.parameterTypes()[1], true);
    acceptAndConvert(*arguments[2], *function.parameterTypes()[2], true);
    arguments[3]->accept(*this);
    utils().fetchFreeMemoryPointer();
    utils().packedEncode(
        {arguments[3]->annotation().type},
        {TypeProvider::array(DataLocation::Memory, true)}
    );
    utils().toSizeAfterFreeMemoryPointer();

    m_context << Instruction::MYOPCODE;
}

libsolidity/analysis/GlobalContext.cpp

// inline vector<shared_ptr<MagicVariableDeclaration const>> constructMagicVariables()
magicVarDecl("myopcode", TypeProvider::function(strings{"address payable", "uint256", "uint256", "bytes memory"}, strings{"bytes memory"}, FunctionType::Kind::MyOpcode, false, StateMutability::Payable)),

libevmasm/Instruction.cpp

// static std::map<Instruction, InstructionInfo> const c_instructionInfo =
{ Instruction::MYOPCODE,       { "MYOPCODE",          0, 5, 1, true, Tier::Base } }

Geth

core/vm/jump_table.go

// func newFrontierInstructionSet() JumpTable {
CALLACTOR: {
    execute:    opMyOpCode,
    dynamicGas: gasCallActor,
    minStack:   minStack(5, 1),
    maxStack:   maxStack(5, 1),
    memorySize: memoryReturn,
    writes:     true,
    returns:    true,
},

core/vm/instructions.go

func opMyOpcode(pc *uint64, interpreter *EVMInterpreter, callContext *callCtx) ([]byte, error) {
    inoffset, insize := callContext.stack.pop(), callContext.stack.pop()
    params := callContext.memory.GetPtr(int64(inoffset.Uint64()), int64(insize.Uint64()))

    secondValue := callContext.stack.pop()

    firstValue := callContext.stack.pop()

    addr := callContext.stack.pop()

    // ... Do smth with input ...

    outoffset := inoffset.Uint64() + insize.Uint64()

    callContext.memory.Set(outoffset, 1, []byte{0x1})
    tmp := make([]byte, 1)
    tmp[0] = 0x98
    callContext.memory.Set(outoffset + 1, 1, tmp)

    callContext.stack.push(uint256.NewInt().SetUint64(outoffset))

    return tmp, nil
}

Smart contract

pragma solidity >=0.6.0; // SPDX-License-Identifier: GPL-3
contract test {
    event ReturnValue(address payable _from, bytes data);
    function f() public returns(bytes memory){
        address payable addr1 = payable(msg.sender);
        bytes memory params = new bytes(2);
        params[0] = 0x21;
        params[1] = 0x22;
        bytes memory result = myopcode(addr1, 0x11, 0x12, params);
        emit ReturnValue(addr1, result);
        return result;
    }
}

When I run that code I get invalid jump destination. So, what I need to do, to get my code work correctly?


texts: Modifying simple function with inline assembly

texts:
I'm trying to write a super simple contract that's gas efficient utilizing inline assembly in solidity.  All this function needs to do is create a child smart contract with one function, self destruct.  The function also should check msg.sender to make sure it's the contract owner.  This GasToken project does this in a form where they've tokenized the effective stored gas.  They took it to another level where they also used a vanity address to make this even more gas efficient.  I've been trying to generate a vanity address so that I can use their code exactly, but it's taking an extremely long time so I resorted to modifying the code so that I can do it with a normal address and not a vanity address with 10 leading zeros.  So for this question's purpose, let's not do a vanity address.

contract pseudocode:

if (msg.sender != 0x1234....5678) { throw; }
suicide(msg.sender)

How can I write this in inline assembly in solidity?  Here is the source for gasToken.io where they used the vanity address.  I'd like to NOT use the vanity address to simplify my code for the time being since this kind of vanity address is hard to generate without mining hardware.  I've been referencing solidity opcodes but have been unable to successfully get this up and running.

// Creates a child contract that can only be destroyed by this contract.
function makeChild() internal returns (address addr) {
    assembly {
        // EVM assembler of runtime portion of child contract:
        //     ;; Pseudocode: if (msg.sender != 0x0000000000b3f879cb30fe243b4dfee438691c04) { throw; }
        //     ;;             suicide(msg.sender)
        //     PUSH15 0xb3f879cb30fe243b4dfee438691c04 ;; hardcoded address of this contract
        //     CALLER
        //     XOR
        //     PC
        //     JUMPI
        //     CALLER
        //     SELFDESTRUCT
        // Or in binary: 6eb3f879cb30fe243b4dfee438691c043318585733ff
        // Since the binary is so short (22 bytes), we can get away
        // with a very simple initcode:
        //     PUSH22 0x6eb3f879cb30fe243b4dfee438691c043318585733ff
        //     PUSH1 0
        //     MSTORE ;; at this point, memory locations mem[10] through
        //            ;; mem[31] contain the runtime portion of the child
        //            ;; contract. all that's left to do is to RETURN this
        //            ;; chunk of memory.
        //     PUSH1 22 ;; length
        //     PUSH1 10 ;; offset
        //     RETURN
        // Or in binary: 756eb3f879cb30fe243b4dfee438691c043318585733ff6000526016600af3
        // Almost done! All we have to do is put this short (31 bytes) blob into
        // memory and call CREATE with the appropriate offsets.
        let solidity_free_mem_ptr := mload(0x40)
        mstore(solidity_free_mem_ptr, 0x00756eb3f879cb30fe243b4dfee438691c043318585733ff6000526016600af3)
        addr := create(0, add(solidity_free_mem_ptr, 1), 31)
    }
}


texts:
Reading this article, I understand that erasure codes are a potential solution to the data availability issue in sharding. That is, a light node can have higher certainty regarding the contents of a block when erasure codes are used.

However, I couldn't find a straightforward explanation of the concept. Can someone shed some light on it?


texts:
We are evaluating the option to include an Nginx script with authentication in front of a blockchain node.
One option is to use Basic Authentication in the path of the network URL in Metamask. Is anyone doing that?
The obvious disadvantage is to ask the user to configure his/her password in plain text in Metamask. Any other ideas to have a corporative authentication before submitting a transaction?
I know the concept of Metatransaction and actually we intend to use this in the future. But we are trying a simple solution first.


texts: invalid opcode "0x1c" during smart contract method execution

texts:
I have written a smart contract to test event from java project using web3j
I have prepared the web3j wrapper java class using solc compiler version
 "0.5.7+commit.6da8b019.Linux.g++"

I am using a private ethereum network to deploy the smart contract and execute method in smart contract.

The smart contract source is

pragma solidity ^0.5.7;

contract TestEvent {

    // Test Event will be received by java application
    event testEvent(string indexed message);

    function emitTestEvent(
        string  calldata message
    )
    external
    {
     emit testEvent(message);
    }
}

Java code to execute the method is

// Load broken smart contract build by solc version 0.5.7
        TestEvent contract = TestEvent.load("0x673ccae08d3c3f50f111fb9e5870c76bbbf60938",
                web3, credentials,
                GAS_PRICE, GAS_LIMIT);  // contract instance
        if (contract != null){
            TransactionReceipt transactionReceipt = contract.emitTestEvent("Message").send();
            System.out.println(transactionReceipt.toString());
        }

When executing the emitTestEvent method geth log output shows an error

  "err="invalid opcode 0x1c"

What is the problem with my source code?


texts: Interaction between side chain and main ethereum

texts: To reduce gas fee and improve scalability, I want to have a side chain. But I still want to leverage main chain for buying/exchange tokens. Any suggestions? Are there any similar projects which have done this?


texts: Implementing a transaction fee via direct address and QR code

texts:
I was looking through the ethereum javascript api and I was wondering if there is way to implement a custom transaction fee?

For an example, if someone send a certain amount of ethereum to another address, can a percentage or a certain amount of that be send to a third party address?

Even if this is possible for a direct transaction via address, can it be done with a QR code as well?


texts:
Since I am developing a smart contract which requires multiple owners, I modified the Ownable class from OpenZeppelin like this

contract Ownable {
    mapping(address => bool) public owner;
    event AddedOwner(address newOwner);
    event RemovedOwner(address removedOwner);

    /**
    * @dev The Ownable constructor sets the original `owner` of the contract to the sender
    * account.
    */
    function Ownable() public {
        owner[msg.sender] = true;
    }

    /**
    * @dev Throws if called by any account other than the owner.
    */
    modifier onlyOwner() {
        require(owner[msg.sender]);
        _;
    }

    function addOwner(address _newOwner) onlyOwner public {
        require(_newOwner != 0);
        owner[_newOwner] = true;
        AddedOwner(_newOwner);
    }

    function removeOwner(address _toRemove) onlyOwner public {
        require(_toRemove != 0);
        require(_toRemove != msg.sender);
        owner[_toRemove] = false;
        RemovedOwner(_toRemove);
    }
}

This way, owners[address] equals true when the given address is an owner.

I was wondering if this is a reasonable solution or if there are vulnerabilities that I hadn't thought of. I can't think of another solution that allows to add owners dynamically

Edit: I need multiple owners because I have functions that requires to be called by multiple contracts that are deployed after this one. So I can't even add the owners in the constructor and using one variable for each owner can't be done since I don't know how many I'll need

I know how to use OpenZeppelin libraries, but since the Ownable contract does not provide multiple owners functionality, I copied the code and modified it.

Update:

As @medvedev1088 suggested, I created a contract that extends Ownable and adds the mapping for authorized addresses

contract Authorizable is Ownable {

    mapping(address => bool) public authorized;

    modifier onlyAuthorized() {
        require(authorized[msg.sender] || owner == msg.sender);
        _;
    }

    function addAuthorized(address _toAdd) onlyOwner public {
        require(_toAdd != 0);
        authorized[_toAdd] = true;
    }

    function removeAuthorized(address _toRemove) onlyOwner public {
        require(_toRemove != 0);
        require(_toRemove != msg.sender);
        authorized[_toRemove] = false;
    }

}


texts:
First of all I have to say that all this things will work on my windows machine. Today I started to do the same things on a ubuntu machine (with ssh and private key authentication). I've created a genesis.json file and a "blockchain" dir (that will be the location for my private chain data). But when I try to initiate (with my genesis file) the Blockchain, I recive this error:

  Failed to read genesis file: open genesis.json: permission denied

. I've also performed the command chmod 777 genesis.json, but nothing's changed.
The comand, that in windows will work, is: geth --datadir blokchain init genesis.json. I've also tried to put the path of the dir and the file, but nothing.

Any idea? Thanks!

By the ways, this is my genesis.json file:

{
  "coinbase"   : "0x0000000000000000000000000000000000000001",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000000",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0,
        "EIP150Block":0,
        "ByzantiumBlock":0
    }
}


texts: Blockchain - how provenance is achieved?

texts:
I understand that blockchain is immutable and eliminates the need of middleman with smart contracts. But I think there's still chance for everyone to cheat the system like -

Seller sends the asset to buyer, Buyer receives it and claims that
he received the wrong asset. Though I maintain the asset and track
that asset was delivered within BC, buyer can still claim that it is
not what he ordered.
Similarly I'm a property owner and I uploaded pics of property, receipts of my recent property upgrades. I can bribe the contractor
to acknowledge that upgrades were done and make the receipts
available in blockchain.

How can BC enable trust in these type of situations?


texts:
I have created one raw transaction and I don't intend to send it to execute right away. I will send this raw transaction later, maybe 5 minutes or 5 hours or more.

Is this going to work? If not, is there workaround?


texts: Make Truffle deploy a contract and pass it as an argument to another contract's constructor

texts:
I have two contracts, contractA & contractB. I want Truffle to first deploy contractA, then pass it as an argument to contractB's constructor.

This is what I am currently trying, but contractB never actually gets deployed:

let contractA = artifacts.require("./contractA.sol");
let contractB = artifacts.require("./contractB.sol");

module.exports = async function(deployer, network) {
  await deployer.deploy(contractA);  // this gets deployed fine
  deployer.deploy(contractB, contractA.address); // this *never* gets deployed
};

As a matter of fact, contractB does not get deployed even if I change the code to this:

await deployer.deploy(contractA);
deployer.deploy(contractB, "0x123");  // does not deploy even if I enter the address manually

What am I missing here?


texts: Deploying fails with different compile version

texts:
I'm trying to implement a simple card game. Actually, everything is working fine. Until I tried to move from 0.4.0 to 0.4.22. Any idea what is going wrong?
Thanks a lot. And here the code:

pragma solidity ^0.4.22;
import "./InterfaceCardToDefense.sol";
contract CardToDefense is InterfaceCardToDefense{
mapping(int => mapping (int => int)) public AttackPosition2Defense;
mapping(int => string) public CardType2String;
mapping(int => string) public AttackType2String;
mapping(int => string) public Position2String;

function setAttackPositionToDefense(int attack, int position, int defense) public {
    AttackPosition2Defense[attack][position] = defense;
}
function setCardType2String(int _id, string name) public {
    CardType2String[_id] = name;
}
function setAttackType2String(int _id, string name) public {
    AttackType2String[_id]= name;
}
function setPosition2String(int _id, string name) public {
    Position2String[_id]= name;
}
}

PS: Getting this error message through truffle test. Right now even the original version doesn't work. Maybe it is unrelated to the pragma statement. Still a bit confusing

Deploying CardToDefense...
  ... 0x86f3f37d18cff4bcc9b91da5ce63c923eca5567243c52d84018d6f612f94db0d
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.

PPS:
Just found out. If the interface is removed the contract can be deployed. Any Idea what that might be? Here is the interface:

contract InterfaceCardToDefense {
function AttackPosition2Defense(int, int) public returns(int);
}

I suspect that the interface is somehow wrong.


texts: Different kind of coin(token) transaction

texts:
Please help me out.

I want you to fix my problem(Undo or Cancel the transaction) urgently because I'm really desperate at this situation. I'm about to lose all my money.

I mistakenly transfered(withdraw) my Enigma(ENG) tokens(Total Amount : 2805.989) from my Binance exchange(www.binance.com)'s Enigma(ENG) withdrawal address to my Gopax exchange(www.gopax.co.kr)'s Etherium(ETH) deposit address on Jan 19th 21:34.

So, I asked Gopax exchange's technician to fix this problem, but they say they can't help it because the Etherium(ETH) deposit address and Enigma(ENG) deposit address of Gopax exchange is different.

But the weird thing is, apparently, on the Binance exchange, It shows that withdrawal has completed properly.

How could the different kind of coin transaction possibly completed without any warning or notice?

I think the transaction has to be blocked if it was not a same kind of coin address.

And also, as you know, Enigma(ENG) Token adopted ERC20 standards, even If I mistakenly enter my Gopax exchange's Etherium(ETH) deposit address onto the Binance Enigma(ENG) withdrawal address field, It can't be wrong.

Likewise, on the Binance exchange, deposit address of Enigma(ENG) Token and Etherium(ETH) is totally the same.

Then, where is my Enigma(ENG) tokens at?

I'm sending you more detailed transaction information below.

So, please check it out and give an answer.

I look foward to good news from you.

Very thanks.

Txid(TxHash) : 0xd8b77d61269a6987566c3cc92a9abb585efd3f5cd7ffd72c6949f9c2d754f222
Contract Address(Enigma Token) : 0xf0ee6b27b759c9893ce4f094b49ad28fd15a23e4
Transfer From : 0x564286362092d8e7936f0549571a803b203aaced → Binance exchange(www.binance.com)'s Enigma(ENG) withdrawal address
Transfer To(Token Holder) : 0xbbfa6a9597c9faed9a46146e642d27dcc6758199 →Gopax exchange(www.gopax.co.kr)'s Etherium(ETH) deposit address


texts: how to set a require for a string to not be null

texts:
I want to write a require condition for string that string variable could not be null. How to write because string is not taking the != operator
function createOrder(address _seller, string memory orderName) public onlySeller returns(bool){
        require(_seller != address(0), "Invalid Address");
        require(orderName != "null", "Invalid Name");


texts: UniswapV2 removeLiquidity revert ds-math-sub-underflow

texts: I am calling uniswapv2 remove liquidity but i am not able to get what values amountAmin and amountbmin will have . i am calling uniswapv2 router contract function for existing pool but i cant get how much  tokens i have put in that pool through any contract function


texts: How to save and retrieve the investors address in a crowdsale contract

texts:
I am writing a ICO code which should have the following functionalities

To save the address of every investor and
To retrieve all the investors address and the amount invested

Question

What is the best way to do it ? Any code snippet will be a great help.
Lets assume there are 30000 investors.

2.a Is it possible to save those in the state variable ?

2.b Is it possible to get all the 30000 investor address and their amount using any online tool like MEW / Etherscan.io (Read contract) ?


texts: Dapp on Ganache and Truffle but... what about Remix?

texts:
My dapp runs well with Ganache and Truffle but how to deploy with Remix and connect the contract to web GUI without abi?

I mean, i created a Dapp that runs really good on Ganache and i run the web interface and the node with npm run dev.

Now i want to deploy it using Remix, and i want to put all my js files and Index.html to my web server.

How can i do it without destroy all my code? is it possible?


texts: getAccounts combined with infura.io does not return proper list of accounts

texts:
function metaMaskCh() {
  web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io"));
  web3.eth.getAccounts(function(error, result){
    if(error != null)
      console.log(error);
    else
      console.log(result);
  });
}

I've got at least two logged accounts, but using infura, I can not detect any of them:

Output of browser's console:


texts:
I’m new to Ethereum, and I’m working on a side project  I’m curious

How can I discover every NFT on the Ethereum blockchain?

Once I’ve identified the NFT, how do I fetch the metadata?


texts: Transaction history of accounts for a contract

texts:
I want to get the transaction history of the transactions that have been performed by the accounts using my contract (on a private blockchain).

If I perform transactions using the eth.sendTransaction(tx_object) i.e., without using any contract. Then I am able to get the details of the trasaction using eth.getTransactionReceipt(tx_hash).

eth.getTransactionReceipt(tx_hash) returns a transaction object which has a from field and a to field, where each of these has the desired value of the account addresses which were involved in the transaction.

The problem arises when I use a custom contract. I created a contract, which is as follows:

pragma solidity ^0.4.0;

contract MyBank{

    mapping (address => uint) public balance;

    address bankManager;

    event Transfer(address _from, address _to, uint _value);

    function MyBank() {
        bankManager = msg.sender;
        balance[msg.sender] = 10000;
    }

    function transfer(address _to, uint _value) {
        if (balance[msg.sender] >= _value) {
            balance[msg.sender] -= _value;
            balance[_to] += _value;
        }
        Transfer(msg.sender, _to, _value);
    }
}

I execute the transfer() method which gets executed successfully and the transfer happens. Now when I call the eth.getTransactionReceipt(tx_hash)  for this transaction, it returns me a transaction object, which has content of from and to field as follows:

from field contains the address of the account who initiated the transaction,

to field contains the contract address.

So the question is, how can I get or build the transaction history for a particular account if I am triggering transaction from my own custom contract.


texts:
I try using IterableMapping by this example.
I have error when I compiling contract by truffle:

  Expected identifier, got 'LParen'

This is my code:

pragma solidity ^0.4.15;

import "./itMapsLib.sol";

contract User
{
  using itMaps for itMaps.itMapUintAddress;

  itMaps.itMapAddressUint im_myAddressUintMap;

 function addOwner(address _key, uint value) returns (bool){
   im_myAddressUintMap.insert(_key, value);
   return true;
 }

  function allSum() returns (uint sum)
  {
  }
}


texts: EIP20.Sol does not compile. On remix.ethereum.org, I am trying to deploy a test token

texts:
I followed the instructions and got an error:

  Parse Error Expected Token ; got 'LParen' emit Transfer(msg.sender,
  _to_value);

How do I fix this?

Code:

function transfer(address _to, uint256 _value) public returns (bool success) {
    require(balances[msg.sender] >= _value);
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    emit Transfer(msg.sender, _to, _value); //solhint-disable-line indent, no-unused-vars return true;
}


texts: Not able to deploy NFT contract on reinkeby .Seems like truffle is not able to decode private key from the mnemonic

texts:
Here is the truffle config
module.exports = {
  networks: {
    cldev: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*',
    },
    ganache: {
      host: '127.0.0.1',
      port: 7545,
      network_id: '*',
    },
    kovan: {
      provider: () => {
        return new HDWalletProvider(mnemonic, url)
      },
      network_id: '42',
      skipDryRun: true
    },
    rinkeby: {
      provider: () => {
        return new HDWalletProvider(mnemonic, url)
      },
      network_id: '4',
      skipDryRun: true
    }
  },
  compilers: {
    solc: {
      version: '0.6.12',
    },
  },
  api_keys: {
    etherscan: '<ETHERSCAN_API_KEY>'
  },
  plugins: [
    'truffle-plugin-verify'
  ]
}


texts: How to read a private variable from a contract?

texts: Given a contract, how can I find out the current value of one of its variables (as a dev, not from the context of another contract), if it's not public?


texts: Help to replace var type in this Smart Contract

texts:
Which's the type of agent variable? How can I remove the type var (to remove the warning in my code). Please ignore the comments.
    uint nonce;
    struct Agent {
        uint idAgent;
        uint[] O_preferences;
    }
    mapping(address => Agent) public agents;
    address[] public agentsInfo;

    /// @notice Crea un nuevo agente con sus parámetros
    /// @param _address dirección del agente
    /// @param _idAgent id del agente
    /// @param _O_Preferences preferencias del agente
    function setAgent(address _address, uint _idAgent, uint[] _O_Preferences) public {
        var agent = agents[_address];
        agent.idAgent = _idAgent;
        agent.O_preferences = _O_Preferences;
        agentsInfo.push(_address) -1;
    }

Last question: what does that -1 mean (on the last line)?
Thanks in advance!


texts:
I want to implement a database in a private blockchain. It consists of four tables and my idea is to use four smart contracts, one for one table. For each table i'll put the corresponding attributes and its relative CRUD methods in its corrispondent smart contract (i found a nice explanation of CRUD methods here).

Since the CRUD operations behave in a similar way for the four smart contracts, is there a way (or a design pattern) to uncouple the CRUD operations from the definition of the smart contract? So that each smart contract invokes CRUD methods that are defined only one time (and not in each smart contract, in a redundant way) maybe in a separate smart contract.


texts: What would be potential problems with building "private" Ethereum network on AWS?

texts:
Suppose I have two EC2 instances on AWS that are running geth nodes. They have the same genesis block and are in synchronization because peering is setup with open port 30303 (by default is for peering among nodes).

What would be potential issues with this setup? Wouldn't others be able to access from outside the network by hitting the open ports?

Also any issues with scaling?


texts: Solidity Ganache/Mocha test error: base fee exceeds gas limit

texts: I got this when I was running the Mocha test with Ganache package to test the Solidity smart contracts. Then I got base fee exceeds gas limit error. Is that because my contracts are too large? Should I test each contracts one by one instead? Please help. Thank you


texts: Web3 "Transaction ran out of gas" on method that creates a contract

texts:
I have the following Solidity code:

pragma solidity ^0.4.17;

contract Parent {
   function createChild() public {
        new Child();
    }
}

contract Child {

}

Which I'm calling with web3 like this:

const item = await managerABI.methods.createChild().send({
   from: accounts[0],
   gas: '5000000',
})

Although the function is very simple and the gas limit is very high, I'm getting the error Transaction ran out of gas.  Additionally, the full error message shows "gasUsed": 21577, which appears to mean that the actual gas used in the operation was well below the limit.

Any help is appreciated.


texts: How exchanges handle token withdrawals for their users?

texts:
I am working on exchange-like project for ETH and ethereum-based tokens. And I am having a problem with token withdrawals for users.
Every user certainly makes a deposit to his own newly generated address, but the ethereum design does not allow me to use redistributing transactions(from several addresses to several addresses) like in Bitcoin, for instance. So it seems to me that I have to accumulate payments at the single address and make payments from that one. But transferring tokens from all the user accounts might be very costly, and require additional transfer of ether to those accounts to pay fees.
In general terms, what I want to achieve is processing user withdrawals from numerous ethereum addresses just like from a single pool.
So is there a proper efficient way to handle this issue?


texts: Can the contract with the stolen Ether be attacked the same way like the DAO?

texts: Since the Ether of the attacker is in a copy of a theDAO contract - can the ETH be stolen the same way?


texts: Fetch price data: on-chain oracle vs smart contract function

texts:
I want to get the latest and most accurate price data from Uniswap and found out that I can either call the getAmountsOut() function which gives me the amount of tokens I will get in return of a given input amount of tokens. Also it's possible to get the wanted price data via an on-chain price oracle which I could implement by myself thanks to the Uniswap smart contract that stores cumulative price data.
So what's the difference, are their drawbacks with using one method vs the other?


texts: Parity node browser not supported in the ethembedded .iso?

texts:
I recently started a node with the parity implementation.  I could easily load the console and wallet in my browser via http://localhost:8080/home/.

Then I downloaded the parity pre-loaded .iso from ethembeded and tried to start a node on my raspberry pi.  For some reason I cannot get http://localhost:8080/home/ to load in my browser. Has anyone else had this experience?


texts: Who proposes blocks in Ethereum Casper the Friendly Ghost

texts:
I am trying to understand how CTFG is supposed to work. The available online blogs provide a fairly high-level overview. What I have understood so far is that validators will bet on the blocks as they see and think are going to make the canonical chain. However, one thing I am struggling to understand who is going to propose a new block in CTFG? It is very clear in CFFG but not in any discussion on CTFG.

Any clarification or pointers would be appreciated.

Thanks.


texts:
currently, I'm using openzeppelin.

I can't find takeOwnership function in lately ERC721 interface.

takeOwnership function deprecated?
(I cant' find any document)

so, how can I do that like takeOwnership?


texts: How to use web3 when one smart contract is interfacing with another?

texts:
A few months back I posted this question on this form. Since then, I've used the interface method to make my smart contracts interact together. I didn't have any problem while testing and developing in Remix IDE using the JavaScript VM. I'm now building the front end and calling a function that interacts with a function from another smart contract generates an error.
The error is Unhandled Runtime Error
Error: Transaction has been reverted by the EVM and the transaction fails with no revert messages.
I did notice that during compilation, there are two ABI's generated. One for the interface in the smart contract and one for the smart contract itself. I'm currently using the smart contract's generated ABI whilst not knowing how to use the interface ABI or whither I should use it.
To summarize: what should I do with the interface's ABI? Is not using it the reason behind the error.
This is how I made my two smart contracts interact:
The purpose is to get registered entities' details and use them in the modifier to check if they were pre-registered to the system.
pragma solidity ^0.5.0;

contract Register{

    address public govermentEntity;

    struct Seller {
        address sellerAddress;
        string sellerLocation;
        string sellerName;
        address [] sortingMachineAddress; // dynamic array
        bool isExist;
    }

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

    mapping (address => Seller) registeredSellers;

    modifier onlyGovermentEntity{
        require(msg.sender == govermentEntity, "Entity not authorized to register stakeholders.");
        _;
    }

     function getSellerDetails(address addr) external view returns (address, string memory,string memory){

        return(registeredSellers[addr].sellerAddress, registeredSellers[addr].sellerLocation,registeredSellers[addr].sellerName);
    }

pragma solidity ^0.5.0;

 interface RegisterSC{
       function getSellerSortingmMachineDetails(address addr) external view returns ( address [] memory);
    }

contract Tracking{

    string public status;
    address public caller;

modifier sortingMachineOnly (address registerContractAddr, address sellerAddr){

        address[] memory tempArray;

       RegisterSC registerSC = RegisterSC(registerContractAddr); //pass contract address
       tempArray = registerSC.getSellerSortingmMachineDetails(sellerAddr); // pass address of sorting facility-seller

       for(uint256 i=0; i< tempArray.length; i++){ //only registered sorting machines can update the status of the bottle

         if (msg.sender == tempArray[i])
          _;

       }

   }

function updateStatusSorted (address registerContractAddr, address sellerAddr, address plasticBottleAddress) public sortingMachineOnly (registerContractAddr, sellerAddr){

       plasticBaleContributorsAddresses.push(bottleToRecycler[plasticBottleAddress]);
       plasticBale.push(plasticBottleAddress);
       bottlesSortedCounter++;
       status = 'sorted';
        }

This is how I'm calling the updateStatusSorted in the Dapp using web3:
I'm keeping react details out of this segment to keep the question straight forward
import web3 from '../ethereum/web3';
import trackingContract from '../ethereum/tracking';

constructor() {
 this.state = {
            sellerAddress:'0x34....',
            trackingSCAddress:'0xb.....'
        }; }

sortBottle = async () => {

        const accounts = await web3.eth.getAccounts();

        await trackingContract.methods
            .updateStatusSorted(this.state.trackingSCAddress,this.state.sellerAddress,this.state.result)
            .send({ from: accounts[0] });

    };

This is my tracking.js file:
import web3 from './web3';
import Tracking from './build/Tracking.json';

const instance = new web3.eth.Contract(
    Tracking.abi,
     '0xb......'
);

export default instance;


texts: Quorum 7nodes example unable to finish simplestorage migration using privateFor

texts:
I'm following this example: truffle quorum example I created a cluster using docker-compose and all the nodes are up and running but when I run the truffle migrate command the migration doesn't end and finishes like this:

λ truffle.cmd migrate --reset

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

Starting migrations...
======================
> Network name:    'development'
> Network id:      10
> Block gas limit: 1702452429

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

   Replacing 'Migrations'
   ----------------------
   > transaction hash:    0xbb9fc26e04cd017c3e69a37fd2d0062553c749fd752cbc2f67a1727af519c7e1
   > Blocks: 0            Seconds: 0
   > contract address:    0xd0a5685a4ba479D0FF4E86Ca8300738573816c63
   > account:             0xed9d02e382b34818e88B88a309c7fe71E65f419d
   > balance:             1000000000
   > gas used:            284908
   > gas price:           0 gwei
   > value sent:          0 ETH
   > total cost:          0 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:                   0 ETH

2_deploy_simplestorage.js
=========================

   Deploying 'SimpleStorage'
   -------------------------

It doesn't give any error but it doesn't finish migrating.

If I remove {privateFor: ["oNspPPgszVUFw0qmGFfWwh1uxVUXgvBxleXORHj07g8="]} from the migrations\2_deploy_simplestorage.js then the migration is able to finish.

I checked the public key of the seventh node and its correct.

How can I run this example?

I'm using Truffle v5.0.7 (core: 5.0.7), Solidity v0.5.0 (solc-js) and Node v10.15.2

Thanks!


texts: How to calculate gas for contract deployment @_@

texts:
Refer to the following:

rinkeby: {
  host: "localhost",
  port: 8545,
  from: "my address",
  network_id: 4,
  gas: 4800000,
  gaslimit: 2100000000000
}

When I set the gas to 4700000, I received the following error when deploying my contract.

Error: insufficient funds for gas * price + value

When I set the gas to 4800000, I received the following error instead:

Error: exceeds block gas limit

Trust me, any value in between will result with either one of the error above.

May I know what can I do? Is this mean my contract is too complicated for Rinkeby?

------ Additional notes: ------

This is how I start my Rinkeby's node.

geth --datadir rinkeby console --rinkeby --rpc --rpcapi db,eth,net,web3,personal --rpcaddr "0.0.0.0" --rpccorsdomain "*"

May I know if there is any mistakes, because after starting, I use the following command to check the account (with plenty of ETH in Metamask). It always returns 0.

 eth.getBalance("<public key>");


texts: Error Deploying using truffle-contracts: Cannot read property 'apply' of undefined

texts:
I am using truffle-contract package to deploy a contract that was compiled by using truffle compile

deploy.js

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

const contract = require('truffle-contract');
var FooArtifacts = require("./build/contracts/Foo.json");
var Foo = contract(FooArtifacts);
Foo.setProvider(provider);

var myContractAddress = "0x6139e1b82ffbdbeafbb403a77a04e8374d2521b1";
Foo.new(myContractAddress);

Running node deploy.js gives the error

  Cannot read property 'apply' of undefined

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'apply' of undefined
at Provider.sendAsync (C:\Users\y\test\node_modules\truffle-contract\contract.js:24:36)
at RequestManager.sendAsync (C:\Users\y\test\node_modules\truffle-contract\node_modules\web3\lib\web3\requestmanager.js:80:19)
at Object.get [as getNetwork] (C:\Users\y\test\node_modules\truffle-contract\node_modules\web3\lib\web3\property.js:116:33)
at C:\Users\y\test\node_modules\truffle-contract\contract.js:512:27
at new Promise (<anonymous>)
at Function.detectNetwork (C:\Users\y\test\node_modules\truffle-contract\contract.js:503:14)
at Function.deployed (C:\Users\y\test\node_modules\truffle-contract\contract.js:451:19)
at Object.<anonymous> (C:\Users\y\test\deploy.js:10:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

Using truffle-contract 3.0.5, web3 1.0.0-beta.34 according to packages.json.

What went wrong here?

Foo.json artifact

https://gist.github.com/nyxynyx/0c48280e5e881b62409047eedc0d2919

Foo.sol

pragma solidity ^0.4.18;

import './MyContract.sol';

contract Foo {
    uint256 public x;
    MyContract myContract;
    address myContractAddress;

    constructor(address _myContractAddress) public {
        myContractAddress = _myContractAddress;
    }

    function baz() public {
        myContract = MyContract(myContractAddress);
        x = myContract.baz();
    }
}


texts: How to charge a fee in ethereum smart contract transactions

texts: I need help on how to charge a transaction fee in ethereum smart contract using web3? Also which web3 API can be used to check the validation of enough gas on the frontend of smart contract?


texts: How do short confirmation times negatively contribute to blockchain security?

texts:
The Ethereum whitepaper states:

  The motivation behind GHOST is that blockchains with fast confirmation times currently suffer from reduced security due to a high stale rate - because blocks take a certain time to propagate through the network, if miner A mines a block and then miner B happens to mine another block before miner A's block propagates to B, miner B's block will end up wasted and will not contribute to network security.

What is meant by confirmation time? Is that the amount of time it takes for a block to be confirmed by other nodes, or the amount of time it takes to mine a block i.e. difficulty?

Secondly, I'm confused about why faster confirmation times lead to a higher stale rate - wouldn't you encounter the same problem with slower confirmation times as well?


texts: How to change the compiler the mix-ide uses?

texts:
I have build the mix-ide from source, is there a way to change the solidity compiler it uses? I have tried to simply replace the solidity folder in the webumbrella directory with a new version but with no luck.

Is there a compile switch for it, or something similar?


texts: Cant push Owner's address into an array outside function

texts:
I am fairly new to Solidity and I wanted to understand the Push function better.
I am using solidity ver 0.5.12
I wanted to push the Owner address into an array as follows
        address Owner;
        constructor() public
        {
             Owner = msg.sender;
        }
        address[] playersAddressList;
        playersAddressList.push(Owner);

Remix is giving me an error stating
browser/Lottery.sol:53:32: ParserError: Expected identifier but got '(' playersAddressList.push(Owner); ^
However, when I am trying to push the Owner into an array inside the following function there is no error
  function addPlayer(string memory a, uint b) public payable
    {
        playersAddressList.push(Owner);

        address creator = msg.sender;
        playersAddressList.push(creator);

        balance = balance + msg.value;
        require (msg.value >= 1 ether);

        person memory newPerson;

        newPerson.name = a;
        newPerson.age = b;

        players[creator] = newPerson;

    }

I wanted to understand why I can push the Owner's address to an array inside the function but not outside it?
Thanks
Rwiju


texts: Which JSONRPC APIs are required by MetaMask?

texts:
This question is related to What RPC APIs are safe to expose?

I want to run a Parity node not to have a wallet but only to have my own personal JSON RPC node for MetaMask. Parity will not be running on the same host as the browser with MetaMask.

According to https://github.com/paritytech/parity/wiki/JSONRPC, by default the following JSON RPC APIs are enabled:

web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore.

Which ones are absolutely required to use MetaMask and which ones can be disabled?


texts: Loading External data (in Excel/CSV) to blockchain engine

texts:
I am new to solidity blockchain. I have transaction dataset in csv files. I want to load it automatically to blockchain using ethereum solidity.
How can I do it? Is there any UI available? Any guide would be helpful.


texts: Unable to create private testnet using geth. nodeInfo.genesis is of the main network

texts:
I am trying to create my private testnet using geth. However, even when I use a CustomGenesis block from a json file, when I start geth and run admin.nodeInfo, the genesis and head hashes are of the main network.

Here is the CustomGenesis.json:-

{
"nonce": "0x0ae067964324234907200d849",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0x8000000",
"difficulty": "0x4000",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x16d38897146fb767e709386f416bbc88aed53171",
"alloc": {
    "0x16d38897146fb767e709386f416bbc88aed53171": {
            "balance": "10000000000000000000"
    }
}
}

Here is the command I am using to start my private testnet:-

geth --identity "Dev1" --datadir "/home/dev1admin/ethereum/private_test1/chain" --port "30304" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1729 --nat "none" --verbosity 5 console init "/home/dev1/ethereum/private_test1/CustomGenesis.json"

The output of admin.nodeInfo command:-

{
enode:"enode://0e576e1aa07d4ee4ea7fc34fe7a0e46ef16f9b835ce58b76dd7b675eea67d7546c3daf3b3115badabc24235d1056c508b108ba7d0f88bbf3687edae5db9165f7@[::]:30304?discport=0",
id: "0e576e1aa07d4ee4ea7fc34fe7a0e46ef16f9b835ce58b76dd7b675eea67d7546c3daf3b3115badabc24235d1056c508b108ba7d0f88bbf3687edae5db9165f7",
ip: "::",
listenAddr: "[::]:30304",
name: "Geth/Dev1/v1.5.5-stable-ff07d548/linux/go1.7.3",
ports: {
discovery: 0,
listener: 30304
},
protocols: {
eth: {
  difficulty: 17179869184,
  genesis: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
  head: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
  network: 1729
}
}
}

I don't want to use the --dev option with geth because I want to pre-allocate some ether. Also, just using a network id to differentiate between networks seems wrong to me (I also want to be able to set a custom nonce to ensure that no one else connects to my network unless they know my nonce).


texts:
If I send ether from contractB to contractA, then get error "out of gas".

Increase the amount of gas does not help.

In "VM Trace Transaction"
http://testnet.etherscan.io/vmtrace?txhash=0x24269877942122ea5e022833e2dbd80f543458be2195ad2df222387cff7f5382
I see, then call "contractA.send(msg.value);" don't send gas to subcontract.

How to make these contracts work?

contract contractA {
    function() {
        for(uint i = 0;i<10; ++i)
            msg.sender.send(msg.value/10);
    }
}

contract contractB
{
    address contractA = 0x2EA16ad451ca2aA32E06f476691D1529cF11BaC7; // TestNet!!!
    function() {
        if (msg.sender != contractA) {
            contractA.send(msg.value);
        }
    }
}


texts:
I'm making a Hybrid mobile app and planning to use web3.js to access Geth.

What's the best way to expose Geth to the hybrid mobile app?

I will be running Geth on ubuntu 14.04 on Aws


texts: How to automatically pre generate thousands of ETH addresses for my app users

texts:
I'm building an app where every user will have app-generated ETH Wallet to do transactions with internal ERC20 Tokens.

I would like to pre-generate wallets for my users, and assign every wallet upon signup to users.

How can I automatically create let's say 100,000 ETH accounts, and keep the information on my database (address, keys, etc)

Thanks, any advice would be appreciated!


texts: Quorum transaction not mined and no address

texts:
I am running a private Quorum chain consisting of 3 nodes with raft consensus. When I deploy a contract to the chain via web3 I get returned a hash and can then look up the transaction with the local geth console (geth attach qdata/geth.ipc) and check its status with eth.getTransaction(hash), so I get this:

{
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  blockNumber: null,
  from: "0xc58a28d310c76e8298fa086381e6f2da9f046c07",
  gas: 4700000,
  gasPrice: 0,
  hash: "0x75bf6fc10400fa493851b8105973e9b5aab2955dc5d87d217f13ed9562ccafbd",
  input: "0xc2f448268ee5019782beeaee884bc92112187a16af7b23df948fd0f867ecb2f41f34f34e477e2ddd53c74ef20fc48b0ebcda0a003f991f9c6e1a4bedfc65288d",
  nonce: 0,
  r: "0x3cd6c0a90a9b2367d6d47f081ad8509ea374f4db54bbf51eb9ace8360e50bc7a",
  s: "0x6d6cabc76a0d7774ada6ba753d06be0400353a5d3d42d85c92c4db7b8ad2f7bd",
  to: null,
  transactionIndex: 0,
  v: "0x26",
  value: 0
}

But there is no address! So why is the transaction still not mined?

EDIT:
Here is the code I used to deploy the contract:

const Web3 = require('web3-quorum');
const web3 = new Web3(new Web3.providers.HttpProvider('http://..SERVER_ADDRESS..:22000'));

var abiArray = [{...ABI...}];
var simpleContract = web3.eth.contract(abiArray);
var bytecode = "0x6080604052348...";
const account = '0xc58a28d310c76...';

var nonce = web3.eth.getTransactionCount(account);
const contractData = {
    from: account,
    data: bytecode,
    gas: 0x47b760,
    privateFor: ["oUEMYuV2DOlgk88JxKx..."],
    nonce: '0x' + nonce
};

//contract instance
const contractInstance = simpleContract.new(123, contractData, function(e, contract) {
    if (e) {
        console.log("err creating contract", e);
    } else {
        if (!contract.address) {
            console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
        } else {
            console.log("Contract mined! Address: " + contract.address);
            console.log(contract);
        }
    }
});


texts: Storing a lot of data in a contract efficiently

texts:
Do data types like arrays or maps get stored in the patricia tree

(#1)where each element (in the map) has it's own path, and when you add a new element you reference the whole sub tree and add a new path branch, or does it
(#2)just get saved as a single atomic value?

If the 1st is true: Cool.

If the 2nd is true: Is there a special data type that gets implemented that way?


texts: Is it recommended to run Ethereum supernodes?

texts:
In the early days of bitcoin there was a demand for system administrators who were able to run supernodes to support the network with stable nodes and high bandwidth. Litecoin is still recommending that for it's network.

This document is for sysadmins who want to contribute excess upstream bandwidth to
help strengthen the global Litecoin network.  If you do not understand these instructions
you probably don't want to be a supernode.  10mbit+ is recommended.

I have access to such resources and could contribute an Ethereum supernode. Is this desired? And if so, how to run an Ethereum supernode?


texts:
This is my complete contract code :
https://gist.github.com/cmaliwal/31a80d36b8d873a3dca37b2b18188164

When I deployed my contract on ropsten test network using remix and metamask contract deployed successfully.

When I am trying to add token on metmask , I am getting 0 TKN instead of my token (DEV).

transaction address : Tx. on etherscan

contract address :  contract on etherscan


texts: How many exchanges have delisted ETH as a result of the proposed post DAO hack Ethereum hardfork?

texts:
So far I am only aware of the Cryptopia announcement below. Have any other exchanges delisted of threatened to delist ETH yet? If so, which exchanges and how many?

  ETH / BTC market is closing

  Cryptopia believes in immutable blockchain technology, We believe that
  ETH forking their network to save the failures of a 3rd party software
  developer sets a dangerous precedent as this will open the floodgates
  to rollbacks for any other potential fund loss of ETH, Had this been
  the fault of the ETH network core itself this would not be an issue,
  but since DAO has nothing to do with the ETH network this action seems
  to be totally motivated my money and investor pressure, with all this
  in mind Cryptopia have decided to remove ETH from the site to avoid
  the upcoming fork and any inevitable future forks to save ICO
  investors., Please close all open orders and withdraw your ETH BEFORE
  the hardfork is implemented as we WILL NOT be upgrading to the new
  hardfork, Thanks


texts: Trustless contract upgrades using inheritance

texts:
I've been struggling to find a solution to the problem of upgradeability that maximizes trustlessness while also putting minimal burden on users.  I really wanted to use signed messages to validate user authorization of certain transactions that are sent by the contract owner.  However, based on reading the EIP discussions and experimenting with MetaMask and Cipher, because message signing still seems to be evolving and signing methods are not universally supported by existing wallets or guaranteed to be supported in perpetuity, the next best solution would be to make the contract upgradeable.  But patterns like eternal storage or proxy delegate appear to compromise trustlessness and so are not optimal.

I'm fairly new to Ethereum, so if anyone disagrees with the above, I'd be interested to hear why.

In the meantime, I think the (simplified) solution below will work so that a dapp could be upgraded with only minimal cost to users (gas cost for calling transferBalance), while not compromising trustlessness.

The progression would go like this:

First contract (inherits from Transferable) is created and users add balances
Second contract (also inherits from Transferable but differs from the first contract to the extent that upgrades are needed) is created and a reference to it is set on the first contract with setNext, which is only accessible by the owner of the first contract.
Users initiate balance transfers by calling transferBalance, which empties their balance on the old contract and sets it on the new contract.  Sophisticated users could review the new contract on EtherScan before transferring to ensure that the new contract is not malicious.

pragma solidity ^0.5.8;

contract Transferable {

    address owner;
    Transferable next;
    mapping(address => uint) public balances;

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

    function addBalance() public payable {
        balances[msg.sender] += msg.value;
    }

    function transferBalance() public payable {
        require(address(next) != address(0), "next not set");
        uint value = balances[msg.sender];
        balances[msg.sender] -= value;
        next.receiveBalanceTransfer.value(value)(msg.sender);
    }

    function receiveBalanceTransfer(address _beneficiary) public payable {
        balances[_beneficiary] += msg.value;
    }

    function setNext(address _next) public {
        require(msg.sender == owner);
        next = Transferable(_next);
    }

}

I'd be curious if anyone sees any flaws in this approach or the rationale behind it.


texts: Decoding transaction data using abi-decoder

texts:
I'm trying to write a very simple script in typescript that finds uniswap transactions and decodes the transaction data so I can read the function being called and the parameters it is being called with. After some initial research I found that this package seems to be the most up to date project I could find to accomplish this. However I found that I am running into this error when trying to use the package.
 error TS2345: Argument of type '({ inputs: { internalType: string; name: string; type: string; }[]; stateMutability: string; type: string; name?: undefined; outputs?: undefined; } | { inputs: { internalType: string; name: string; type: string; }[]; name: string; outputs: { ...; }[]; stateMutability: string; type: string; } | { ...; })[]' is not assignable to parameter of type 'Item[]'.
  Type '{ inputs: { internalType: string; name: string; type: string; }[]; stateMutability: string; type: string; name?: undefined; outputs?: undefined; } | { inputs: { internalType: string; name: string; type: string; }[]; name: string; outputs: { ...; }[]; stateMutability: string; type: string; } | { ...; }' is not assignable to type 'Item'.
    Type '{ inputs: { internalType: string; name: string; type: string; }[]; stateMutability: string; type: string; name?: undefined; outputs?: undefined; }' is not assignable to type 'Item'.
      Types of property 'type' are incompatible.
        Type 'string' is not assignable to type 'Type'.

994 addABI(uniswapV2ABI);

  ~~~~~~~~~~~~

Obviously it's a type mismatch but I'm not sure what I should be doing differently other than just require the ABI. If I look at the test file for this project or the one its forked from, or other projects that I have seen, they normally do something like this:
const uniswapV2ABI = require('./abis/uniswap_v2.abi')

and then proceed to use the imported ABI. Does anyone have any suggestions for what I should be doing differently? Any help would be greatly appreciated.
Here is the full code I've written:
import { ethers } from "ethers";
import { UNISWAP_ADDRESS } from "./constants"

import { addABI, decodeMethod } from "abi-decoder-ts"

const uniswapV2ABI = require('./abis/uniswap_v2.abi')

addABI(uniswapV2ABI);

const web3 = new ethers.providers.WebSocketProvider(NODE_ADDR);

async function connect(){
    console.log("Connecting to node...")
    await web3.ready;
    console.log("Node connected");
    return;
}

async function nodeStats(){
    const blockNum = await web3.getBlockNumber();
    console.log("Current Block Height:\t" + blockNum)
}

connect();
nodeStats();

let mempool = [ ];
web3.on("pending", async function(tx) {
    // mempool.push(tx);
    let transaction = await web3.getTransaction(tx)
    try{
        if(UNISWAP_ADDRESS === transaction.to.toLowerCase()){
            console.log("Found New Uniswap Transaction:")
            console.log(transaction.data)
            // const decodedData = decodeMethod(transaction.data);
            // console.log(decodedData)
        }else{
            return;
        }
    }catch{
        return;

    }

});


texts: Detecting a Reverted Transaction with Web3

texts:
I am using Web3 to submit transactions and it seems as though whenever a transaction is successfully mined but reverted I don't get that error on my frontend. Is there anyway to detect when the transaction is reverted with Web3 so I can display an appropriate message on the front end?

The code I am using is below.

Thanks!

 web3.contractInstance().methods.create().send({gas: 90000, value: 10, from: address})
                        .on('transactionHash', hash => {
                            console.log('TX Hash', hash)
                        })
                        .then(receipt => {
                            console.log('Mined', receipt)
                        })
                        .catch( err => {
                            console.log('Error', err)
                        })
                        .finally(() => {
                            console.log('Extra Code After Everything')
                        })

I receive the receipt but no error on revert. Thanks!


texts:
I wanted to know what kind of transaction validation miners would do for the code written below. The code below is simple creating a student logs. So when i say the transaction will be validated by miners before making a block then what exactly is the expectation as in this transaction no ether is involved ?

I understand that the EVM is verifying the transaction(may be they check the address it came from is valid , the signature and all that stuff) and expects required gas to process the below code.  My question is in context of bitcoins, in bitcoins the coins are tracked and each minor verify the contains of the transaction not just the signature.  It also verify where the account trying to send bitcoins is actually owning it to transfer and all that kind of stuff.  Now when my smart contract is just creating a student record as in below code, how minor can verify what the code is trying to push in block is valid.  Now when we try to modify the record that time also it will get updated to new value.  I can read all logs to see the vales but when we call is immutable and needs network consensus to modify anything then how it works with Ethereum.  May be I am seriously missing some concepts here but if any one can guide me to some document to refer …. it will be great help.

function createStudents(string fname, string year, string hash, uint256 _ipfsHash) public {
Student memory student = Student(fname, year, hash);
students.push(student);
studentInfo(fname, year, hash);
ipfsHash.push(_ipfsHash);
}


texts: Setting Block Gas Limit in private blockchain?

texts:
In a private blockchain with Parity, what is the correct way to set the Block Gas Limit?  When I go to "Transfer" and then specify an address in the "recipient" field, a red bar pops up that says:

  the transaction execution will exceed the block gas limit

I don't know why the block gas limit is not the default!  I am using my own chain spec file, but I copied these values from https://github.com/paritytech/parity/blob/master/ethcore/res/ethereum/foundation.json:

"gasLimit": "0x1388",

...

"minGasLimit": "0x1388",

The limit that the error is talking about appears to be 5000 (0x1388) because I get the error until I manually lower the gas (from 21000 default in the field) to 4999.  But why is the limit set to 5000?  Those two parameters don't have anything to do with the block gas limit, do they?

(And anyway, when I do lower the gas limit to anything below 5000, I I get this problem: Parity genesis file - How to set "minimal cost of the transaction" a.k.a. "Gtransaction" value?)

Really I just don't understand what I did to alter the Block Gas Limit.  It should default to 21000, right?  How did I manage to alter that?


texts: Unable to transfer ether from one contract to another

texts:
Here is my contract function:

function DoTransfer() payable {
    address objAddress = 0x29662dA5D870FFb39201A8320214421eE9fE9D25;
    objAddress.transfer(.05 ether);
}

Here is the Javascript that calls that function:

var abi = [{"constant":false,"inputs":[],"name":"getCreator","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getLastDepositer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getLastTransferror","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"DoDeposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"DoTransfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
var MyContract = web3.eth.contract(abi);
var myContractInstance = MyContract.at('0x4E4B55f3e97D1296260012a633285972A4A57f35');

myContractInstance.DoTransfer.sendTransaction({from:"0x3d86B4D6f28554428E5AF38490DD1977691A3082"},function(error, result){
    if(!error) {
        console.log("#" + result + "#")
    } else {
        console.error(error);
    }
})

It returns a transaction ID, no error is shown, but the .05 ether is not transferred.


texts:
Sorry for a newbie question.

I'm designing a smart contract wherein I need to send in many( around 50) arguments to a setter method and return a list of same number of arguments in a getter.
So basically what I'm trying to create is a database store where each record will have these many attributes and there will be many such records.
For setter, I found out that there is something called "calldata" or "msg.data" feature which can hide a list of arguments
For getter, I need to return a two dimensional array in this case but it seems a dynamic array as return type is not supported.

I don't know if there are other ways to do this. Please suggest


texts: Token Swap From Ethereum Host Network To Different Blockchain

texts: What is a good way to swap tokens from the Ethereum host network to a different network (i.e. the Tron blockchain)? Would the best way to do this be to have a smart contract where ERC20 token holders would have to send their tokens and also declare a Tron wallet address to create a public mapping and an array of public keys belonging to the token holders who executed the mapping? Perhaps those two elements can be iterated over off-chain to distribute tokens on the new network? I'm concerned because I don't know if this is the most optimal approach or if it is possible to read and return the on-chain data of an array with a lot of variables due to gas costs? Thanks!


texts: Could the Oraclize _callback function be run twice by the same query?

texts:
An example _callback function from Oraclize:

function __callback(bytes32 _queryId, string _result, bytes _proof)
{
    if (msg.sender != oraclize_cbAddress()) throw;

    if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) {
        // the proof verification has failed, do stuff

    } else {
        // the proof verification has passed, do stuff
        uint random = uint(sha3(_result));
        myNumber++;
    }
}

Is it possible that Oraclize could call this function twice for one query ID such that myNumber increases twice? I get it would cost money them to do so, but if they do control the execution of this function I might add a boolean modifier for integrity of those numbers.


texts: For example, the withdraw method on WithdrawDAO has methodID 0x3ccfd60b. Given the methodID, could it be decoded to know what method it calls ?


texts: How many transactions per second can Ethereum currently handle? What changes will allow the network to be able to handle more?

texts:
I've been searching for a more precise answer to this question, but I've seen a lot of conflicting information stating that Ethereum can currently handle anywhere from 12-45 transactions per second. What is the correct current number?

Then, also, according to this article:

  In creator Vitalik Buterin's words, the long-term goal is for the platform to be able to process transactions at "Visa-scale transaction levels" or beyond.

"Visa-scale" is referenced as being 45,000 transactions per second.

So what has to happen at the technical level in order for this goal to be realized?
More miners?
More nodes?
More efficient core code?

Or will a completely new evolution of Ethereum be necessary to reach that level of transaction capacity?


texts: Solidity/Remix Error : The constructor should be payable if you send value. How to solve this?

texts:
pragma solidity ^0.4.16;

contract MyToken {
    // This creates an array with all balances
    mapping (address => uint256) public balanceOf;

// Initializes contract with initial supply tokens to the creator of the contract
function MyToken (
    uint256 initialSupply
) payable {
    balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
}

// Send coins
function transfer(address _to, uint256 _value) payable {
    require(balanceOf[msg.sender] >= _value);           // Check if the sender has enough
    require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
    balanceOf[msg.sender] -= _value;                    // Subtract from the sender
    balanceOf[_to] += _value;                           // Add the same to the recipient
}
}

The following error occurs when I try to run the above code in Remix to transfer a certain amount of coins to another address:

transact to browser/test.sol:MyToken.transfer errored: VM error: invalid opcode.
The constructor should be payable if you send value.
The execution might have thrown.
Debug the transaction to get more information.

Here is the screenshot of the page :

Please help me !!
Thanks


texts:
I have created a transaction some days ago. It has status Pending and gas price 82 gwei.
Today at etherscan I can see a minimal low gas price is 73 gwei.
And a minimal average gas price has the same value.
It is the first day my gas price is more than that gas price.

Why my transaction is still pending?
What's the process of choosing a transaction to include in the block?
Can this transaction be processed in future or not?

UPDATE:
There are blocks of transactions that have minimal low gas price is 70 gwei.

UPDATE:

How we can see chart from the update yesterday (Apr 19) we have the minimum average gas price is 73 gwei. I create my transaction on Apr 18. I understand there was the moment when the average price was downing till 73 gwei.
Maybe I understand wrong, but if the gas price was less my price so the transaction must be included in a block already, otherwise I'm reading this chart and legend wrong. But my transaction is still pending at this moment...


texts:
Is there anyway to monitor new token creation  using Web3.py?
I tried to accompulish with event_filter.get_all_entries() and using Topics: but no luck..
    'topics': [None,'0x0000000000000000000000000000000000000000000000000000000000000000']

Example Tx
https://etherscan.io/tx/0x9260b52784980ef408581d7c92842bfc39e457022f57bf082da5bdb2785963f1#eventlog
https://etherscan.io/tx/0xdb5db0c3aceb860b97a3978a059153abb9ce6310703b423e6431fec4c4b5b04e#eventlog


texts: View/Pure Gas usage - Cost gas if called internally by another function?

texts:
I know similar questions have been asked before however I could not find an good explanation for the following,

In one of the tutorial it says:

  Pure and View functions don't cost any gas to call if they're called
  externally from outside the contract. But they do cost gas if called
  internally by another function.

Why do they need gas if they don't update anything?
How does read cost gas?
Isn't it read from my local blockchain?


texts: Deploying contract with web3. Two different methods fail

texts:
I tried this method to deploy a contract. It is described in the web3.eth.Contract documentation.
var contract = new web3.eth.Contract (JSON.parse (abi_json_string));
contract.deploy ({ data: contract_bytecode }).send ({ from: from_acct, gas: 160000, gasPrice: 8000000 });

However, it gives me the following error:
authentication needed: password or unlock

I can't find a way to sign the transaction using this method. All the examples, show it as a simple call to deploy and then send. What if you want to sign it first?
So I tried deploying a contract using the same method that I use to sign and send regular ether transactions.
var transaction_data =
{
    from: from_account,
    to: "0x0000000000000000000000000000000000000000",
    data: contract_bytecode,
    gas: 160000,
    gasPrice: 8000000,
    nonce: nonce
};

var common = eth_common_lib.forCustomChain ('ropsten', { networkId: 1994, chainId: 1994, name: 'geth' }, 'muirGlacier');
var transaction = new eth_tx_lib.Transaction (transaction_data, { "common": common });

var bytes = [];
for (var b = 0; b < private_key.length; b += 2)
{
    var hex_byte = private_key.substr (b, 2);
    var int_byte = parseInt (hex_byte, 16);
    bytes.push (int_byte);
}

transaction.sign (Buffer.from (bytes));

var serialized_transaction = transaction.serialize ();

web3.eth.sendSignedTransaction ("0x" + serialized_transaction.toString ("hex")).catch ((error) => { console.log (error); });

I get a receipt when I do it this way but it shows the contractAddress as null. I'm guessing that means the deployment failed.
contractAddress: null

Is web3.eth.Contract the only possible way to deploy a contract? If so, is there a way to do it from a locked account?


texts: Estimating gas limit using Go-ethereum BoundContract (abigen)

texts:
I have a smart contract and it's native bindings generated in go-ethereum (version 1.9.11 if that matters) abigen. Im looking for a way to estimate gas limit before calling method on smart contract.
I cannot find anywhere in documentation any way to estimate gas usage of transaction other than providing raw message which seems to defeat purpose of having bindings in the first place.
For now I figured out this:
//error handling removed for brevity
//contracts.MyContractABI is from abigen file.
abi, _ := abi.JSON(strings.NewReader(contracts.MyContractABI))
data, _ := abi.Pack("myFunction", myParam, myParam2)

ethRPCParams := ethereum.CallMsg{
    From:     from,
    To:       contractAddr,
    Value:    big.NewInt(0),
    Data:     data,
}
gas, _ := c.ethClient.EstimateGas(context.Background(), ethRPCParams)

but it seems to be workaround to instantiate abi separately from already existing and instantiated one in BoundContract.
So, my question is what is the proper way to tackle this operation. For example here I don't get data type safety when estimating gas price and I have to re-instantiate something that should be already instantiated, code is less readable etc.


texts: How to use web3-react with truffle Dapp? any sample code / tutorial?

texts:
I am new to react and finding issues with the front-end of the Dapp application.

Especially in web3 version > web3 1.0.0

I just heard about the web3-react and I think it will be a lot easier.

I follow the https://noahzinsmeister.gitbook.io/web3-react/ and https://github.com/katopz/web3-react-example but could not find any working example or code for the application with web3-react, truffle Dapp

Can you provide any tutorial link/video for such application?

Also, open for the suggestions as I am very new to Dapp(ethereum) and React.

Thanks.


texts: How to parse input data in transaction using go programming language?

texts:
I know there are some resolutions about parsing transaction input data, but they don't work with go. I wander if there is any way i can use with abi available.

Specifically,  When i receive a transaction, i can parse the input data in transaction, to know which function it invokes and parameters it transfers.


texts: Transfer ETH from wallet into two different accounts(sites)

texts:
Could I have one wallet that can be used for two different cryptocurrency sites?
For example: If I transfer ETH into my wallet form one site, could I used my ETH in my wallet to deposit the ETH into another trading site?

Regards


texts: What is the easiest way to transfer ether from user a to user b using nethereum?

texts: I'm new in Nethereum and I only want to transfer ether from account a to account b. Find this big example at Github with a lot of projects in it. I don't unterstand it. So please what is it the easiest way to send a transaction using Nethereum?


texts:
So if I want to setup a consortium network between two companies who would do the mining? The companies want to use the consortium network to purchase goods using ether.

I’d like some clarity in the following.

I’ve read that two miners each is a good rule of thumb having 50% of the miners each for validating the chain. Is this correct?

What is to stop someone starting up another miner?

We don’t want miners to get rewards as this should just be to validate the chain and we primarily want the ether sent from one account to another to allow purchases?

What happens if more companies get on board, would they need to setup miners to validate the chain on there side?


texts: How can I use testrpc as the environment in Remix?

texts:
I've installed ethereumjs-testrpc and I'm running it with testrpc in my terminal, which I'm pretty sure is working because it outputs Listening on localhost:8545 after listing all the test accounts' addresses and private keys.

Now I'd like to test some of my contracts on Remix, and I'm setting the "Environment" field (in the "Run" tab) to "Web3 Provider", but when I use the default input of http://localhost:8545 for the provider endpoint, Remix spits out "Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC)."

Am I missing any steps in setting this up correctly, or is Remix not supposed to be used with testrpc? Thanks


texts: Mining in Ether Wallet, Then Tansfer to BTC, Cash, or...?

texts:
Thanks to the community.
I started mining Ether through the wallet,
What do i do with the Coins now?
Is there a place i can sell or transfer from ether wallet to BTC or something...?
Im lost please assist...
Thanks again!


texts:
There is this piece of code that runs good with solc 0.5.0
updateValueAtNow(totalSupplyHistory, curTotalSupply + _amount);
updateValueAtNow(balances[_user], previousBalanceTo + _amount);

/// @dev `updateValueAtNow` used to update the `balances` map and the
      ///  `totalSupplyHistory`
      /// @param checkpoints The history of data being updated
      /// @param _value The new number of reputation
    function updateValueAtNow(Checkpoint[] storage checkpoints, uint256 _value) internal {
        require(uint128(_value) == _value); //check value is in the 128 bits bounderies
        if ((checkpoints.length == 0) || (checkpoints[checkpoints.length - 1].fromBlock < block.number)) {
            Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];
            newCheckPoint.fromBlock = uint128(block.number);
            newCheckPoint.value = uint128(_value);
        } else {
            Checkpoint storage oldCheckPoint = checkpoints[checkpoints.length-1];
            oldCheckPoint.value = uint128(_value);
        }
    }

Wanting to update it to solc 0.7.3, I must get rid of length-- and length++ as per this spec
For the love of me though I can't seem to get it to work. Any help would be appreciated. This line is crucial
    Checkpoint storage newCheckPoint = checkpoints[checkpoints.length++];


texts:
I want to get all user's transactions from ERC20 compatible tokens.
I can get all incoming transactions using this code:

const to = token.Transfer({_to: account}, {fromBlock: 0, toBlock: 'latest'});
transferEvent.get((_, transactions) => { console.log(transactions); });

But how can I get all transactions (incoming and outgoing) using web3 interface?


texts:
I am trying to figure out how big could a contract be? Is it possible to have 10k functions? One million? More?

Is there any restriction on the function's body size?

Does a bigger contract need more gas to be deployed?

Is a bigger contract slower than a smaller one?


texts: What is the Ethereum Virtual Machine (EVM) total computing power?

texts:
I have a hard time finding the Ethereum Virtual Machine (EVM) computing power. I'm not speaking about the Ethereum Network Hash Rate which secure the block, but the EVM.
Smart contracts are executed on the EVM. As every full node processes every transaction, does that mean that the EVM is constrained to the node with the smallest computer power?


texts: Canceling / overwriting a pending transaction using geth JSON RPC

texts:
This is a private network

A transaction was sent to create a contract using the eth_sendTransaction RPC call.

The transaction is "removed" marked "will be removed" because it ran out of gas but remains in the pending state and miners keep trying to process it.

1- Is there a way to cancel a pending transaction ?

According to the sendTransaction documentation resending a transaction with the same nonce allows to "overwrite your own pending transaction".

Using eth_getTransactionByHash it is possible to recover the nonce of a transaction.

However when sending a new transaction with the same nonce (and more gas), the new transaction fails with "TX (d37f7a1b) failed, will be removed: Transaction w/ invalid nonce"

2- How do we "overwrite" a pending transaction ?

Many Thanks

edit1: result of eth.pendingTransactions

The input is the same (same contract), and so is the the nonce.

The first 2 fail with TX (49dcf54d/7e591a92) failed, will be removed: Out of gas, the third one with TX (d37f7a1b) failed, will be removed: Transaction w/ invalid nonce. tx=8  state=9)

[{
    blockHash: null,
    blockNumber: null,
    from: "0x766b8dc3ee1a98dd53444ce3cc5a185305570861",
    gas: 90000,
    gasPrice: 20000000000,
    hash: "0x49dcf54d52ddad2cfb57d9805b1a94bbc6b60ad44eaac9c117399530424d1300",
    input: "0x60606...5056",
    nonce: 8,
    to: null,
    transactionIndex: null,
    value: 0
}, {
    blockHash: null,
    blockNumber: null,
    from: "0x766b8dc3ee1a98dd53444ce3cc5a185305570861",
    gas: 150000,
    gasPrice: 20000000000,
    hash: "0x7e591a92683453ea0ec6a7024d54198140ec2c23936b3662c4f3e0d9978fc828",
    input: "0x60606...5056",
    nonce: 8,
    to: null,
    transactionIndex: null,
    value: 0
}, {
    blockHash: null,
    blockNumber: null,
    from: "0x766b8dc3ee1a98dd53444ce3cc5a185305570861",
    gas: 500000,
    gasPrice: 20000000000,
    hash: "0xd37f7a1bcedef089723f31bbf155b6c4c66f77fd0b5a5f6c3168a0b8ff3af299",
    input: "0x60606...5056",
    nonce: 8,
    to: null,
    transactionIndex: null,
    value: 0
}]

edit2: change after the node that created the transactions started mining

The situation only changed when the node that created the transactions started mining

The first transaction was removed
The second transaction, although it was rejected with an OOG on storage allocation, completed and a contract address generated
The third transaction was removed

Is this the expected behaviour that the node that created the pending transaction must mine so that a transaction running OOG on another miner is actually removed ?

The original question still remains: how do we remove/cancel/overwrite a pending transaction ?


texts: Unit test compilation failed due member not found or not visible

texts:
I have written an unit test but when I launch it I get following error:

Test.sol:25:22: TypeError:
 Member "val1" not found or not visible after argument-dependent lookup in function () view external returns (string s1, string s2, uint256 val1 memory,uint256,uint256,uint256,uint256,address).
        Assert.equal(partProductionContract.production.val1, _val1, "msg.sender: ");
                     ^------------------------------------------^
Compilation failed. See above.
Truffle v5.0.1 (core: 5.0.1)
Node v11.6.0

I don know what could be te problem, so I post some pieces of the smart contract and of the test function:

contract PartProduction {

    struct Production {
        string s1;
        string s2;
        uint256 val1;
    }

    Production public production;

    constructor(
        string s1,
        string s2,
        string val1,
    )public {
        production.s1 = s1;
        production.s2 = s2;
        production.val1 = _val1;
    }
}

This is the unit test function:

contract Test {
    // The address of the adoption contract to be tested
    PartProduction public partProductionContract = PartProduction(DeployedAddresses.PartProduction());

    function testSetParameters() public {
      string memory _val1 = "someString";
        Assert.equal(partProductionContract.production.val1, _val1, "msg.sender: ");
    }

}


texts: Two smart contracts interact can't pass value when I using web3.js

texts:
I have two different smart contracts interaction_1 and interaction_2

I input the data(team) from remix ide.

What I want to accomplish is when user input team in  user_input function at interaction_1, teamAcceptedEvent.watch in interaction_test.js will start working, and then to put interaction_1 contract address into interaction_2 getValue function, and  interaction_2 contract will receive the user input from interaction_1.

It works fine when I tested it in remix, but when I use web3.js to do it, everything goes smoothly, but interaction_2 didn't get the data from interaction_1.

I'm not sure is there any problem with sendTransaction or the gas price?
I'm just trying to test two smart contract interact using web3.js. thanks

interaction_1

pragma solidity ^0.5.1;
contract interaction_1 {

    string public description;
    string public user_prediction;
    uint public amount;
    event teamAccepted(string team_1);

    function user_input (string memory team) public payable {
           user_prediction = team;
           emit teamAccepted(user_prediction);

    }
    function get_user_input()view public returns(string memory) {
        return user_prediction;
    }

}

contract interaction_2 {
    function getValue (address addr)public returns (string memory);
}

interaction_2

pragma solidity ^0.5.1;

contract interaction_2{
    string public get_user_prediction;
    function getValue (address addr)public returns (string memory){
        interaction_1 b = interaction_1(addr);
        return get_user_prediction = b.get_user_input();
    }
}
contract interaction_1 {
    function user_input (string memory team_1)public payable;
    function get_user_input()public returns(string memory);
}

interaction_test.js

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

var abi_1=[...];

var abi_2=[...];

var contractAddress_1 = "0xa4349e4081b28acb426a3332a17a7333bcf3e640";
var contractAddress_2 = "0x0d2c978af4fdeec4070a6147a352235d0c01ca26";
var interaction_1 = web3.eth.contract(abi_1).at(contractAddress_1);
var interaction_2 = web3.eth.contract(abi_2).at(contractAddress_2);

var teamAcceptedEvent = interaction_1.teamAccepted();

teamAcceptedEvent.watch(function(error, result){
            if (!error)
                {
                    if(result.args.team_1 != null && result.args.team_1 != '')
                    {
                        console.log("get user input");
                        interaction_2.getValue.sendTransaction("0xa4349e4081b28acb426a3332a17a7333bcf3e640",{
                            from:web3.eth.accounts[0],
                            gas:2000000},function (error, result){
                            if(!error){
                                console.log(result);
                            } else{
                                console.log(error);
                            }
                        });
                }
                } else {
                    console.log(error);
                }
        });


texts: Using events and logs to get function returned value with a simple example

texts:
My question is related to this one:

Can a contract function both change the state and return a value when it's called externally

Question: How to read event/log content?

I have a contract like:

contract  Aa {

 uint state;
 event CheckVal(bool value);
 function test() returns (bool ){

 bool temp=true;
 CheckVal(temp);
 state= 5;
 return temp;
 }
}

I want to both change the state and get the returned value: "temp". I'm following the guide from here (the 1st usecase).

The problem is that when in my geth console, I put

  exampleEvent.watch(function(err, result) {
 if (err) {
 console.log(err)
 return;
  }
 console.log(result.args.temp)
 })

only three dots will appear(i.e. ...), so I cannot get the value I want and I cannot send a transaction to the private chain and see the returned value:

instance.test.sendTranaction({gass:4200000});

I'm wondering how I can get the return value in geth console.


texts: web3js 1.0 fromWei throwing although passing correct type

texts:
I have encountered a problem with the web3js 1.0 library.

I have a simple function that is getting a balance from a smart contract:

async balance() {
  return await this.Marketplace.balances(this.storeOwner);
}

I have another function inside my angular component where I display the balance to the user:

async getBalance() {
  const balance = await this.smartContract.balance();
  console.log(balance);
  this.balance = this.smartContract.web3.utils.fromWei(balance, 'ether');
}

When calling the web3.utils.fromWei() function I get this error:

Error: Uncaught (in promise): Error: Please pass numbers as strings or BigNumber objects to avoid precision errors.

but the console log shows me, that the balance is a BigNumber object:

BigNumber {s: 1, e: 0, c: Array(1)}

I am using version 1.0.0-beta.36. Why do I get the error?


texts: Account & Block Polling not happening properly for the DApp in Trust Wallet Browser

texts: my DApp works fine in desktop/laptop using metamask which polls the accounts and blocks (1500ms and 3000ms respectively), as set in the drizzle options. But the same DApp when I open in trust wallet browser, the polling doesnt happen. Thus the values are not getting automatically updated and rendered as they change, in the DApp. Any suggestions as to the possible reasons? I'm using drizzle-react with latest context API, in my DApp.


texts: Error in DNS random node sync // lookup les.mainnet.ethdisco.net on ANY-dns-server:53: server misbehaving

texts:
The Err:
TRACE[02-03|13:52:02.589] Updating DNS discovery root              tree=les.mainnet.ethdisco.net err="lookup les.mainnet.ethdisco.net on 192.168.20.1:53: server misbehaving"
DEBUG[02-03|13:52:02.590] Error in DNS random node sync            tree=les.mainnet.ethdisco.net err="lookup les.mainnet.ethdisco.net on 192.168.20.1:53: server misbehaving"

I'm unable to start to syncing:
> eth.blockNumber
11631492
> var sync = web3.eth.syncing;
undefined
> console.log(sync);
false
null

I've found this solution: https://github.com/ethereum/go-ethereum/issues/21454
it is nearest to me one, what google can bring...
However, the ticket's solution here is asserting, that it is bug on dns-server's side, and suggesting use another dns-server.
I've used 4.2.2.2, 8.8.8.8, mentioned in ticket 172.27.112.1, Tor's server 127.0.0.1:53... Nothing helps...
DEBUG[02-04|15:06:07.627] Error in DNS random node sync            tree=les.mainnet.ethdisco.net err="lookup ECRGTNCIZMH6AH7C7DKWBAZNAI.les.mainnet.ethdisco.net on 8.8.8.8:53: server misbehaving"
DEBUG[02-04|15:06:08.105] Error in DNS random node sync            tree=les.mainnet.ethdisco.net err="lookup ECRGTNCIZMH6AH7C7DKWBAZNAI.les.mainnet.ethdisco.net on 8.8.8.8:53: server misbehaving"
DEBUG[02-04|15:06:08.596] Error in DNS random node sync            tree=les.mainnet.ethdisco.net err="lookup 7JK2XIJCQPOQK5W56Y3LDLHBY4.les.mainnet.ethdisco.net on 8.8.8.8:53: server misbehaving"
DEBUG[02-04|15:06:09.069] Error in DNS random node sync            tree=les.mainnet.ethdisco.net err="lookup KFBBOIP4DLBAHN5GPSMY7IBV6E.les.mainnet.ethdisco.net on 8.8.8.8:53: server misbehaving"

config:
OS: Ubuntu 16.04.3 LTS
cmd: /usr/local/bin/geth --nousb --datadir $DATA_DIR --syncmode "light"
geth-version: 1.9.26-unstable-3c46f557-20201217
build from: https://github.com/ethereum/go-ethereum.git


texts:
Is it mandatory to use IPFS for file storage and use its hash in metadata for NFT, What if file is stored on s3 and we save its sha256 or md5 in metadata?
Hash will be same until file content is ditto, in case of file changed, hash will be changed and we can verify by hash saved in metadata.


texts:
Our service handles thousands (currently 10000+) of users and each user has his own Ethereum deposit address. To detect a new deposit we:

Scan each block to get a list of transactions
Get a list of destination addresses for all transactions in the block.
Filter addresses that belong to our users
Get transactions for these addresses and handle each transaction

But this does not work if there is a transaction for a contract with the internal transaction (transfer) to one of our deposit address.

So my question is: What is the best way to handle transfers via contracts to thousands of our addresses?

We use Parity wallet with trace mode enabled


texts: There are javascript bindings for solc.  Is there an equivalent Python binding for solc, such that you could simply install solc via pip?


texts: How to interact with smart contract using web3js?

texts:
I have deployed a contract in rinkeby network. Now I have the address of the contract and ABI of the contract.

    var contract = new web3.eth.Contract(ContractABI, 'ContractAddress')

But now how to call the functions and how to pass the arguments and console.log the return values.


texts:
I have two nodes connected to the main net. On one I run geth 1.8.27, on the other geth 1.9.1.
When I try to get the code of a smart contract, geth 1.9.1 will not return any code.

Example:

Version: 1.8.27-stable:

> eth.getCode("0x7717eFE25b65c8c0fcb97A170B086C17b025A1e1")

"0x60606040526000357c01..."

Version: 1.9.1-stable:

> eth.getCode("0x7717eFE25b65c8c0fcb97A170B086C17b025A1e1")
"0x"

Any ideas why this is happening or what I could try to fix it?

Edit:
maybe worth mentioning that the 1.8.27 node has been running for months while the 1.9.1 has been running for 2 days. Might this be a matter of synchronization? The blocks are fully synced on both.

Version: 1.8.27-stable:

 > eth.syncing
false

Version: 1.9.1-stable:

 > eth.syncing
{
  currentBlock: 8257358,
  highestBlock: 8257442,
  knownStates: 262464985,
  pulledStates: 262458955,
  startingBlock: 0
}


texts: If I participate in a ERC20 ICO with my Metamask eth address, can I add the custom token later on?

texts: If I have not added the ICO's token to my Metamask yet as a custom token, can I do it after the token distribution? Like claiming my tokens after it's been sent, by adding the new custom token to my Metamask.


texts: Can solidity contract arrays receive arrays of addresses as parameters?

texts:
This question is related to this one but using address arrays instead of strings. Does solidity support arrays of addresses to be passed as method arguments?

contract C {
    uint256 hexVal = 0xABCD;

    function func(address[] addrs) {
        // Do somethings with addrs
    }
}

If yes, is it passed as a Javascript string array when called from an external app?


texts:
I am trying to create an Android Node for Ethereum using go implementation. I am following this link - https://github.com/Seedstars/go-ethereaum-android. During installation process I am running below command in ubuntu:

xgo --deps=https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 --remote=https://github.com/karalabe/go-ethereum --branch=andorid-path-fix --targets=android-16/arm --pkg=cmd/geth github.com/ethereum/go-ethereum

This command is showing following error:

  Failed to check docker installation: exec: "docker": executable file not found in $PATH

I have tried some solutions but they are not working.Can someone help me with this error.


texts: When should I use Whisper or PSS over Traditional Message Channel like AWS SQS?

texts:
What are the benefits using Whisper or swarm/PSS over using a centralized service like Amazon SQS?

My use-case is: deliver information (to say to another party that they should do an action in a smart contract) ?


texts: Documentation On Multisig Wallet in Mist?

texts: Is there documentation related to the built-in multisig wallet contract in the Mist Wallet? I see there are many additional functions in this contract like changing / adding / removing owners etc. However, it's not clear how to use these other features though.


texts: Contract not using Upgraded Proxy Contracts

texts:
There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract.

We now have contracts Foo, which imports proxy contract Bar, pointing to delegate contract ZeroDelegate.

Foo.sol

pragma solidity ^0.4.18;

import './Bar.sol';

contract Foo {
    uint storageData;
    Bar bar;
    address barContractAddress;

    constructor(address _barContractAddress) public {
        barContractAddress = _barContractAddress;
    }

    function set(uint x) public {
        storageData = x;
    }

    function get() view public returns (uint) {
        return storageData;
    }

    function baz() public returns (uint) {
        bar = Bar(barContractAddress);
        storageData = bar.baz(storageData);
    }

}

Bar.sol

pragma solidity ^0.4.18;

import './Proxy.sol';

contract Bar is Proxy {
    function baz(uint x) public returns (uint) {
        return  x * x;
    }
}

ZeroDelegate.sol

pragma solidity ^0.4.18;

contract ZeroDelegate {
    function baz(uint x) public returns (uint) {
        return x * 0;
    }
}

Proxy.sol

pragma solidity ^0.4.18;

import "zeppelin-solidity/contracts/ownership/Ownable.sol";

contract Proxy is Ownable {

    event Upgraded(address indexed implementation);

    address internal _implementation;

    function implementation() public view returns (address) {
        return _implementation;
    }

    function upgradeTo(address impl) public onlyOwner {
        require(_implementation != impl);
        _implementation = impl;
        emit Upgraded(impl);
    }

    function () payable public {
        address _impl = implementation();
        require(_impl != address(0));
        bytes memory data = msg.data;

        assembly {
            let result := delegatecall(gas, _impl, add(data, 0x20), mload(data), 0, 0)
            let size := returndatasize
            let ptr := mload(0x40)
            returndatacopy(ptr, 0, size)
            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
        }
    }
}

Now we first deploy the contracts Foo, Bar, ZeroDelegate.

bar = await Bar.new()
foo = await Foo.new(bar.address)
zeroDelegate = await ZeroDelegate.new()

And foo.baz() sqaures the number 2 to 4.

x = await foo.baz()
console.log(x.toNumber())  // 4

Next we upgrade the Bar contract to ZeroDelegate, but foo.baz() still squares the number 4 to 16

await bar.upgradeTo(zeroDelegate.address)
bar = _.extend(bar, ZeroDelegate.at(bar.address))
await foo.baz()
x = await foo.get()
console.log(x.toNumber())  // 16, but expects 0

However if we were to re-deploy Foo contract, it uses the upgraded Bar. Why is this, and how can we let Foo use the upgraded Bar functions without having to re-deploy Foo, which kind of defeats the purpose of using an upgradable contract.

foo = await Foo.new(bar.address)
await foo.baz()
x = await foo.get()
console.log(x.toNumber())  // 0


texts: Why does my smart contract tokens not show up in MyEtherWallet or MetaMask?

texts:
I have deployed a very basic smart contract to the Rinkeby test network. The contract's address is 0xb145b6d8757b40ac80b5fe2a98ab6c8450a54585. I have made transactions to it using MetaMask, and they show up on Etherscan, for instance this: https://rinkeby.etherscan.io/tx/0x63802d405b809434a34050176c7050549e323b75443b0ae8096ab81985f18b9f . The transaction also shows as "confirmed" in MetaMask. I am also able to confirm that my MetaMask account has tokens using truffle console and checking the account address's balance of tokens.

However, even though I add the token in MetaMask with contract address=0xb145b6d8757b40ac80b5fe2a98ab6c8450a54585, symbol=BRR and decimals=18, they don't show up in MetaMask. The same thing happens if I "watch token" in MyEtherWallet. What could I be doing wrong?


texts: question about smart contract code possible vulnerability

texts: I need help with one of my smart contracts. I wrote a smart contract that have functions that only emit events. The parameters of each event are some of the functions parameters. I want to ask if anyone has in mind any possible vulnerability that might occur. Maybe a gas problem or any other attack or vulnerability as I can not think of any. Thanks in advance for your help!


texts:
I am looking at producing a set of NFT's that are a set of 100, the item does not have an image, but is a token to run through an algorithm, I want them to be limited whole NFT's, not ERC-20s.
I am thinking there is two options:

An ERC-1155 collection of 100 unique items with one print each
One item with 100 prints, each print containing a unique ID

I do not mind how this is done, I am just looking for a way that I can simply generate these, sell them on open sea (or via minting) and then identify the order they were sold, i.e. first is #1.
What is the best approach here? Should I just write a mintable smart contract with ERC-1155 and then allow custom properties that store the id of each print?


texts: If I send a raw transaction from A to B, and B runs the transaction, who pays for gas?

texts:
I want to build a mobile app that will have a private key attached to it so that it can generate raw signed transactions.

I want to send these raw transactions to my server, which will then relay these transactions to a smart contract.

I am doing this because I am under the belief that the server will be the one to pay the gas fees for the transaction since it is the one who sends it to the ethereum network. Is this correct?