texts: how to connect to geth from two local machines ethereum

texts:
I am new to Ethereum and tried everything to connect testnet from two local machine nodes.i tried with running two consoles in single machine by admin.addPeers(nodeUrl) and could connect. when i tried with the same for different machines using same network id it is showing peer count as zero.
please help to solve this. thanks in advance


texts: Member function "transfer" not found or not visible after argument-dependent lookup in contract?

texts:
I am having a problem with my smart contract making value transfers.  My current environment:

Truffle v5.0.0-beta.2 (core: 5.0.0-beta.2)
Solidity v0.5.0 (solc-js)
Node v8.11.1

I created the following test function to help track down the problem:

pragma solidity ^0.4.24;

import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "../node_modules/openzeppelin-solidity/contracts/lifecycle/Pausable.sol";

contract EtherBandBattlesManager is Pausable {

using SafeMath for uint256;

    function testPayment(address _payeeAddr)
            payable
            public
            onlyOwner
            {
        require(_payeeAddr != address(0), "(testPayment) The payee address is not set.");
        require(msg.value != 0, "(testPayment) The amount of value accompanying the transaction is zero.");

        // Make the payment.
        _payeeAddr.transfer(msg.value);
    }
}

Before I upgraded to Truffle 5 beta the contract compiled successfully.  But when I made a call to testPayment() I did see the balance of the Ganache account I was paying from decrease, but I did not see the balance of the destination account increase.

I then upgraded to Truffle 5.0 beta.

Now I get a fatal compiler error saying:

/ether-band-battles-work/solidity/contracts/EtherBandBattlesManager.sol:1142:9: TypeError: Member "transfer" not found or not visible after argument-dependent lookup in address.
    _payeeAddr.transfer(pendingPaymentDetails.paymentAmountGwei);

My understanding is that the transfer() function was introduced in Solidity 4.1 and I am using 4.24 as  you can see.  Why can't the compiler find the transfer() function?  Also, any comments on why I am not seeing the balance on the destination account go up after making the transfer() call would be appreciated.


texts: Mine to 2 Seperate Wallets on a Single 6 Card Rig

texts: I am attempting to set up 5 Rigs. I would like each rig on linux. I am attempting to, in some way, have the mining power split between 2 wallets on each rig. I'm not sure how, but I would like to use a portion of the processing power or 2 of the 6 cards in each rig to mine to a seperate wallet and use the remaining cards to mine to a primary wallet. Would you know if this is possible.


texts: Full Synchronisation with Geth Repeated Tree Node Error

texts:
I am doing a university project on the functionality of the EVM. I need to use debug.traceTransaction() function which requires a fully synchronized node. I have tried to sync Geth on a university VM with the following:

geth console --cache=2048

The node is quick to synch (good internet speed, 8GB of RAM and an SSD). But each time I test it by running debug.traceTransaction() from the console, it gives me the "missing trie node" error.

I have resynched fully 4 times. There is nothing else running on the machine at the same time, so resouces should not be a problem. I am perhaps getting bad info from a nearby peer? There are a few VM's running ethereum nodes within the campus network.. could this be the problem? Is there a way to specify only nodes of a particular IP address range should be synched with?


texts:
I want to write a function that would withdraw all the Ether from the contract:
function withdraw() {
   adminAddress.transfer(address(this).balance);
}

Should I consider here subtracting the (gas-cost * gas-price) from the address(this).balance, or is it going to get paid from the one's address, who called the function?

If I have to calculate (gas-cost * gas-price), how could I do it using pure Solidity?

Thank you


texts: View all NFTs owned by specific Ethereum wallet

texts:
Python developer here, very interested in the ETH ecosystem. I would say I'm an experienced developer, but unaware of the many languages/tools that are available to interact with Ethereum wallets.
Let's say I've recently purchased ownership for a couple of NFTs (images). Is there any way for me to programmatically connect to this Ethereum wallet and view all the NFTs owned by that wallet (given the appropriate auth/access needed)? By view - I mean at least get access to all the metadata that's available for the NFTs, and possibly render the images. Is solidity able to help with this use case?


texts: registerInterface and parent constructors in Solidity

texts:
The openzeppelin ERC721.sol file contains the following code:
    constructor (string memory name, string memory symbol) public {
    _name = name;
    _symbol = symbol;

    _registerInterface(_INTERFACE_ID_ERC721);
    _registerInterface(_INTERFACE_ID_ERC721_METADATA);
    _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}

I have imported this file and declared a constructor as follows in my Smart Contract:
 import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

 contract MyNFT is ERC721 {
    constructor() ERC721("MyNFT", "MNFT") public {
    }
 }

Will the constructor in my Smart Contract call the constructor found in the ERC721.sol openzeppelin file, and thus register the interfaces found in the openzeppelin file, or do I need to explicitly include the _registerInterface lines of the file in my own Smart Contract?
Thank you. J


texts: How to lock eth into a smart contract for a certain amount of time?

texts: Is there any way to send an amount of eth to a smart contract address setting a delay time before the sender address could redeem?


texts: Is it possible to obscure the owner of a non-fungible token?

texts:
Basically, I'd like to have unique records which can be transferred between parties without anyone knowing who owns a particular record until a transfer occurs, at which time only the recipient can tell who owned the record.

Mostly, I'm curious as to whether something like this is even theoretically possible. I'm especially interested in knowing whether or not someone has accomplished it.


texts: Remix doesn't show the constructor call for contract deployment (bug in remix?)

texts:
I would like to test sending ERC20 tokens with my client, so I need to create some tokens on a Testnet. I'm using Remix and Rinkeby testnet, but remix is not what I'm used to anymore. When I did this before (created a contract), there used to be a text field where one could put the constructor parameters to deploy the contract. But now all I see is a test field of Local contract from Address. Where is the constructor field that used to be there?

This is what I see:

And this is my contract:

/*
Implements EIP20 token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
.*/

pragma solidity ^0.4.21;

import "./EIP20Interface.sol";
import "./SafeMath.sol";

contract MyToken is EIP20Interface {

    uint256 constant private MAX_UINT256 = 2**256 - 1;
    mapping (address => uint256) public balances;
    mapping (address => mapping (address => uint256)) public allowed;
    /*
    NOTE:
    The following variables are OPTIONAL vanities. One does not have to include them.
    They allow one to customise the token contract & in no way influences the core functionality.
    Some wallets/interfaces might not even bother to look at this information.
    */
    string public name;                   //fancy name: eg Simon Bucks
    uint8 public decimals;                //How many decimals to show.
    string public symbol;                 //An identifier: eg SBX

    function Constructor (
        uint256 _initialAmount,
        string _tokenName,
        uint8 _decimalUnits,
        string _tokenSymbol
    ) public {
        balances[msg.sender] = _initialAmount;               // Give the creator all initial tokens
        totalSupply = _initialAmount;                        // Update total supply
        name = _tokenName;                                   // Set the name for display purposes
        decimals = _decimalUnits;                            // Amount of decimals for display purposes
        symbol = _tokenSymbol;                               // Set the symbol for display purposes
    }

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

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        uint256 allowance = allowed[_from][msg.sender];
        require(balances[_from] >= _value && allowance >= _value);
        balances[_to] = SafeMath.add(balances[_to], _value);
        balances[_from] = SafeMath.sub(balances[_from], _value);
        if (allowance < MAX_UINT256) {
            allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
        }
        emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
        return true;
    }

    function balanceOf(address _owner) public view returns (uint256 balance) {
        return balances[_owner];
    }

    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars
        return true;
    }

    function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }
}

EDIT:

I found that if I change the constructor from Constructor to MyToken, it works. Apparently remix recomments using Constructor and calls using the class name as deprecated, but then if you do that, you won't be able to deploy your contract. Sounds like a bug?


texts: Looking for updated and stable standard ERC-20 smart contract template which will pass through Remix compilation (latest version) without errors

texts:
I am looking for an updated and stable standard ERC-20 smart contract template which will pass through Remix compilation (latest version) without errors. The template should preferably be easy to modify as well.

Could any of you guys please post a template or a link to a template somewhere?

Tested: Contacted OpenZeppelin already but have not yet found exactly what I'm looking for. The contract should ideally be clearly commented and easy to modify with some kind of "modify this" section for token amounts, name of token and so on. It would also be great if all of it goes into one file only.

Vesa


texts: what algorithm does ethereum use to generate public and private key pair. If i have both the keys how can i verify the match of the key in solidity, and how much gas does it cost? is it an expensive operation?


texts: Reading the data in a contract using Json-rpc

texts:
With access to the contract abi, how can the data from a contract be read?
You can get the byte code with eth_getCode but I don't understand how that can be converted to a readable form


texts: How can my decentralized web application hosted on a cloud application (like AWS) interact with a contract deployed from my localhost

texts:
I have a decentralized web application that is hosted in the cloud.  I recently deployed a smart contract to two different test networks Ropsten and Goerli - my contract deployed to the Ropsten network is using infura as the host so the provider is https://ropsten.infura.io/v3/{project-id}. my web application is able to access the contract because it's hosted by infura
However when I deployed the same contract to Goerli - I set up a local geth node and connected accounts that I created with clef. I deployed the same contract from localhost:8545 (the default geth port)  I can interact with my contract locally when I run my application from localhost:3099.
However when users access the application via the web, How do I connect my web application to my locally hosted geth node?  When I run my application locally (from a different port) current code below
if (process.env.NETWORK === 'goerli') {
    host = process.env.HOST;
    port = process.env.GOERLIPORT;
    web3address = host + port; // http://localhost:8545
}
var web3 = new Web3(web3address);

Would I have to point my live web application to my public ip instead of localhost:8545?
If I'm running my geth node locally?
Are there any tutorials or information on deploying smart contracts from a local geth node and have a web application that lives in the cloud interact with the contract that is hosted on such local node - As always any information is appreciated


texts: Are there any plans to switch Ethereum's primary hash algorithm from Keccak-256 to SHA3?

texts: The Ethereum project was started before the SHA3 standard was finalised, and currently uses an earlier version of Keccak-256 which does not precisely match the FIPS-202 standard for SHA.  Are there any plans to switch Ethereum's algorithm over to the standard now that it has been published?


texts: Unable to build geth executable from go-ethereum source code

texts:
I have a question regarding building geth executable from source code .

I am able to create the geth executable for windows and linux machines , both 64 bit systems.

How can i create the geth executable for the windows and linux 32 bit systems on my 64 bit machines ?


texts: Can someone please explain how address(uint160(bytes20(b))) works differently than address(uint160(uint256(b)))?

texts:
Please explain how address(uint160(bytes20(b))) works differently than address(uint160(uint256(b))) when converting a type that uses a larger byte size then address, for example bytes32, then the address is truncated.

Link: https://solidity.readthedocs.io/en/develop/types.html#address


texts: What is a ZKRollup? And how does it work in scaling a DAPP?

texts: I have tried looking into existing solutions such as ZKSync. I couldn't understand why you would rewrite your smart contracts in a different language - Zinc (as opposed to Solidity/Vyper).


texts: Do Ethereum nodes send around smart contract processing results?

texts:
How does smart contract processing work exactly in ETH? Specifically I'm wondering about what happens after a node has processed a set of smart contracts.

A node grabs a bunch of contracts & transactions, processes contracts and validates transactions, solve s PoW.
Here's the question: what gets packed into the block for the smart contracts? For example, if I had a smart contract that basically had a counter inside, and a call to the function just increments the counter by 1. When the node processes this call, what is it packing into the block? Is it packing the call? The bytecode of the execution process (state transition)? Is it packing in the actual result (the resultant persistent storage of the contract) - i.e., counter = 2?
If the result is packed into the block, do other nodes actually care about the actual result that someone else has packed into a block? Or do they just say "since I trust no one I'm just gonna process it anyway, who cares what result you got, since I don't trust you"? This is why people say eventually every full node processes every smart contract call?

Hopefully my question is clear, thank you!


texts:
I am trying to run below code, but I receive this error

"Gas requirement of function Team3_SE427_Call.increaseCount is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)
Pos: 11:4:"

Here my code;
pragma solidity ^0.5.17;

contract Team3_SE427_Call{

    address payable constant CONTRACT_ADDRESS = 0x600cA6ef0678a82ac4ccbcd4BBc4b284D413C8a9;

    constructor() public payable {

    }

    function increaseCount() public payable {
        Team_SE427_Contract x = Team_SE427_Contract(CONTRACT_ADDRESS);
        int count = x.getCount.value(0.1 ether)();
        x.IncreaseCount.value(0.5 ether)(count);
    }
}

contract Team_SE427_Contract{
    function IncreaseCount(int predict) public payable;
    function getCount() public payable returns(int);

}

How can I fix the problem?


texts: Ethereum Sidechains can run it own smart contracts

texts: When I use a sidechain to store certain information, are smart contracts made in Ethereum's main blockchain or can I have smart contracts inside my sidechain not using Ethereum main chain?


texts: Unable to launch ethconsole with eth (cpp-ethereum) (Ubuntu 14.04)

texts:
I successfully launched a node. Everything works fine, even GPU mining. Except I'm unable to connect with ethconsole, as I get an error message :

$ethconsole
Connecting to node at /home/user/.ethereum/geth.ipc
Uncaught exception: Error: Cannot find module 'process'

And then I have to hit CTRL+C to stop it as it seems to be stuck (tried to wait up to 15 min..).

I already tried

$sudo apt-get install process

and

$sudo npm install process

but that is not the way to solve the problem obviously!

Thanks in advance.


texts: Thoughts on copying state over multiple contract generations?

texts:
I recently published a toy dapp (http://etherdate.co/) to the mainnet with a webapp and after deployment found some breaking bugs that necessitate deploying an updated version of the contract.

I think it's only fair that people who committed ether have their state persisted to the new contract generation.

Are there any best practices that people use for copying state from one generation to the next? Or best practices around designing states to be copied?


texts: struct address field takes the value of the contract address when initialized

texts:
I don't know if this is a quirk in the remix IDE or something solidity does itself, but I've found something interesting and would like to know why it occurs.

I have a struct x in a contract Y which has two fields:

Struct X {
   address owner;
   address renter;
}

Now, when I initialize the struct by calling the function createX() in the remix IDE:

function createX() public {
   X storage x;
   x.owner = msg.sender;
}

The renter address field gets the value of the contract address Y

Why does this happen? I expected the field to equal the zero address.


texts: Where to specify total number of coins that could be mined in the lifetime of mining. How to specify specific amount of coins to mined each year

texts:
I am trying to create a new cryptocurrency based on ethereum. The challenge which I am facing is, where to specify a total number of tokens that would
be allowed for lifetime mining. And the number of coins that can be mined each year.


texts: Beacon chain validators vs. Shard validators

texts:
In the most of current sharded blockchains, there is a second chain required for the computation needed for the maintenance of the whole of the network and receiving updates of the shards and their snapshots. Such a chain has different names in variant protocols: Beacon chain (Ethereum 2.0), Relay chain (PolkaDot) etc.

So the second chain is used for keeping shards snapshots and maintenance of the network.

According to this answer: https://ethereum.stackexchange.com/a/72045/23024 :

  Beacon chain validators for a particular shard, randomly get chosen to
  add the hash of the tip of the shard, to the beacon chain.

Does it mean that a Beacon chain validator CANNOT be a shard validator at the same time?

If it is NOT permitted, Why?
If it is permitted, How?


texts: If I create an ERC-20 token and accept dollars from people in exchange of my ERC-20 token, would this be an asset-backed token?

texts:
If I create an ERC-20 token and accept dollars from people in exchange of my ERC-20 token (with 1 token per dollar), would this be an asset-backed token or a security token?

The idea is to create an ERC-20 token in exchange of dollars from anyone. Or through token swap, exchange money to eth then to the ERC-20 token. The ERC-20 token can be used by token holders to buy merchandises/services and also be used to exchange back to money. Last but not least, it can be used to pay for a smart contract that will airdropped more ERC-20 tokens according to the performance of a certain stocks portfolio/index. Note that ERC-20 token will be used by the smart contract. The smart contract will either deduct or add tokens for the token holder according to the performance of the stocks portfolio/index. Is this token considered a security token?

To make the role of the "algorithmic trading" smart contract more clear, the smart contract is NOT the one that trades stocks in the market. There will be a separate backend service that trades stocks in the system using the reserved cash that the token issuer now "owns". The separate backend service will also call some transactions in the smart contract at the end of the day to deduct or add tokens to be airdropped (if any) to the participating token holders. Isn't this just another "service" that the token holder can opt for? This shouldn't make the token a security token, right? Thanks.

Please let me know if it is and if so, how would this comply with regulations.


texts: Is a bootnode a clone of a fullnode or a lightnode? Can a bootnode mine with cpu or gpu? Should a bootnode's enode address be known by default by other miners and fullnodes, or can they discover this bootnode somehow?


texts:
I'd like to get the return value of a low level call.

(bool success, ) = address(0x1234...7890).call{value:0}(callData);

This post discusses a solution that sounds like it should work, but it doesn't have a checkmark and I was unable to get the source working because that last copy command in the toBytes function does not exist.  I tried experimenting in solidity assembly with mload and mstore to make that copy command, but I could not.

copy(_addr, btsptr, _len);

Does anyone have a complete solution that actually works for this?  Or can anyone help me finish that posted pseudo code from the above-linked post?


texts:
I send ETH to a smart contract of my own, and it always fail. At etherscan I search the failed transaction and it has this message:

"Value transfer did not complete, most likely as a result of a revert opcode."

It always happens, it's like my code doing all the operations but at the end applying this REVERT OPT CODE. I didn't program any revert opt code at least not concious about that. I'm new to this so I have no idea why this is happening.

Can someone tell me what is a REVERT OPT CODE???


texts: Best way to go about connecting multiple wallets to Dapp

texts:
What I want:

A user to connect a wallet to my dapp (1 of 4 choices, say: Metamask, WalletConnect, Formatic and Portis).
The flexibility to create a custom "wallet connect modal" (I've tried web3modal, which is great, and is ALMOST EXACTLY what I need, but lacks the customisation I need, design wise).

What I'm doing:

I'm building a front-end with React.js and TypeScript to interact with smart contracts on the Ethereum blockchain.

Any tips for libraries to consider or any help about how I should be going about this would be greatly appreciated.


texts: While testing wrap & unwrap of ETH to WETH on Kovan ,however the wrap function is fine but unwrap func fails,is anything wrong in my approach?

texts:
trx fails at
& debug at tenderly

pragma solidity 0.5.12;

contract WETH9_
{
mapping (address => uint)                       public  balanceOf;
mapping (address => mapping (address => uint))  public  allowance;

function() external payable ;
function deposit() external payable ;
function withdraw(uint wad) external ;
function totalSupply() external view returns (uint) ;

function approve(address guy, uint wad) external returns (bool) ;

function transfer(address dst, uint wad) external returns (bool) ;

function transferFrom(address src, address dst, uint wad) external returns (bool);
}

contract WrapUnwrap
{

WETH9_ internal WETH;
constructor (address payable WETHAddr) public {

    require(WETHAddr != address(0), "WETH is the zero address");

    WETH = WETH9_(WETHAddr);

}

    function wrap() payable public
{
    uint256 ETHAmount =msg.value;

    //create WETH from ETH
    if (msg.value != 0) {
        WETH.deposit.value(msg.value)();
    }
    require(WETH.balanceOf(address(this))>=ETHAmount,"Ethereum not deposited");
}

function unwrap(uint256 Amount) public
{
    address payable sender= msg.sender;

    if (Amount != 0) {
        WETH.withdraw(Amount);
        sender.transfer(address(this).balance);
    }
}
}


texts: How does network agree upon next block, when two blocks are generated at the same time?

texts:
Say that there are two normal nodes and two miners in a network. Both normal nodes submit a transaction to the network at the same time.

One miner picks up the transaction of one node, and other miner picks up the transaction of the other node, and both tries to mine the next block.

Say that both miners could mine the blocks at the same time.

Now, how can the network come to an agreement about which miner mined the next block?


texts: How can I compare two consensus protocols?

texts: There are a large number of competing consensus protocols in the blockchain space today.  How can I compare them to each other in an objective way?


texts: encode data input of the raw transaction to update an contract function?

texts:
I need to update a contract by calling one of their function but I cant use web3.js so I need to send a raw transaction.

example of function to be call on the contract:

test(address buyer, uint256 amount)

my code in javascript:

var rawTx = {
   nonce: 'CX350',
   gasPrice: 'C350',
   gasLimit: '0x09184e72a000',
   to: 'myAddress',
   value: 'CX350',
   data:  .....
}

How I can encode this call and parameters:

test('0xc5622be5861b7200cbace14e28b98c4ab77bd9b4', 10000)

??


texts: Could something like the utreexo project be implemented for Ethereum?

texts: Could something like the utreexo project (reducing storage costs of full nodes via accumulator technology) be implemented for Ethereum or Ethereum Classic?


texts:
Is owner > 0x0 a good way to test if an address owner was set in Solidity?
I am not sure if this could break something in the future and if there are better ways to see if the address was set. What is the best solution?


texts: How to create smart contracts and tokens without using any cryptocurency?

texts: I am new to Blockchain and I have read to create tokens smart contracts are required and to create a smart contract,ether is required. I wanted to know is there anyway I can create tokens without using ether.


texts: Adding two peers in ethereum privatenet on same machine

texts:
I am trying to add two peers in ethereum privatenet but not adding its shows peer count is 0. I run the below commands

Node1:

geth --identity "Privatenet1" --datadir=./Privatenet1 --networkid 1995 --nodiscover --maxpeers=2 --mine --syncmode fast --port 30303 --rpc --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --nat "any"

Node2:

geth --identity "Privatenet2" --datadir=./Privatenet2 --networkid 1995 --nodiscover --maxpeers 2 --mine --syncmode fast --port 30305 --rpc --rpcport 8540 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --nat "any"

my genesis.json file for both nodes is given bellow:

{
   "config": {
      "chainId": 1995,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
   },
   "difficulty": "400",
   "gasLimit": "2000000",
   "alloc": {
      "a620c4ffe82b2d2a4f3a9efc9d8c88f960696464": {
          "balance": "100000000000000000000000"
      },
      "db93c17c1b206ad4925e72896888012ea56a6005": {
          "balance": "120000000000000000000000"
      }
   }
}

then I tried to add node2 peer in node1 as below:

admin.addPeer("enode://cb2b35bc613fb9e700a5884c0e1bcb4e69e908e1a4509999ba51646cc443743b21b3d5e5c4b9353351a20a4e27321ad310e0fdcc60f26b4e975f5f133707615c@127.0.0.1:30305?discport=0")

enode is validated and showing true but peer count is still 0 and admin.peers is null. I researched on it and I allowed all ports using sudo ufw allow portnumber and telnet 127.0.0.1 30303 throwing Error like Connection closed by foreign host.  is it firewall blocks my connection? can anyone please tell me the solution to resolve this issue.


texts: Given that ABI resides publicly on blockchain, why can't anyone call transferFrom() and steal tokens?

texts:
I am just trying to understand how it actually works and how the assets stored on blockchain are protected. Since ABI definitions are public, contract address too is available, can anyone interact with a smart contract? If yes, how do you restrict it?

As an example, if there is an ERC20 token which implements transferFrom then can't someone call this function setting _to address to his own?


texts: How to find out the IP address of a MetaMask wallet's owner?

texts:
If an Ethereum wallet address was created using MetaMask, can the IP address of the wallet's owner be logged or uncovered somehow?
If we can't find out the IP address, does the company running MetaMask log that information somehow?
Edit
When using the Metamask Chrome extension for the first time, the following appears, which says Metamask the company never collects our IP address, apparently:


texts: In tutorial of ethereum zokrates, high-level code compile error

texts:
im trying to follow this tutorial
 - https://zokrates.github.io/sha256example.html

I built zokrates docker provided and copied the source code to the docker, and then tried to compile the code.

here is the code:

import "LIBSNARK/sha256packed"
def main(private field a, private field b, private field c, private field d) -> (field[2]):
h = sha256packed([a,b,c,d])
    return h

However, i faced following error messages:

  Compilation failed: Semantic error: Function definition for function sha256packed with signature (field[4]) -> (_) not found.

what is wrong with this work?


texts: Out of gas exception when calling contract function

texts:
I am calling the contract function below however I get an error: "VM Exception while processing transaction: out of gas". To test I have simplified the function so it only saves a user's name however I still get the error so I know it is not due to an actual out of gas reason but more due to an error. Running on Ganache.

function createUser(
    address _address,
    string memory _name,
    string memory _companyName,
    int _numYearsExperience,
    int _pricePerHour,
    string memory _specialisation,
    string memory _summary,
    int _numAdsViewed,
    int _numAdsPurchased
    ) public

{

    address _userAddress = _address;

    // Storage for list of users
    User storage user = users[_userAddress];

    // Check that the user did not already exist
    require(
        !user.set,
        "User already exists!"
        );

    //Store the user
    users[_userAddress] = User({
        name: _name,
        companyName: _companyName,
        numYearsExperience: _numYearsExperience,
        pricePerHour: _pricePerHour,
        specialisation: _specialisation,
        summary: _summary,
        set: true,
        numAdsViewed: _numAdsViewed,
        numAdsPurchased: _numAdsPurchased
    });
}

This is the calling code... (JS)

var info = data[i]
var name = String(info.name)
var companyName = String(info.companyName)
var pricePerHour = parseInt(info.pricePerHour);
var yearsExperience = parseInt(info.yearsExperience);
var specialisation = String(info.specialisation)
var summary = String(info.summary)
var address = info.address;
var maxCPT = parseInt(info.maxCPT);

await sellContract.methods.createUser(address, name, companyName, yearsExperience, pricePerHour, specialisation, summary, 0, 0).send({ from: accounts[0]})

Anyone know what's going wrong??


texts: Does constant smart contract function run slower as the blockchain becomes larger?

texts:
We have an assumption that the constant function doesn't deal with arrays - the number of elements involved is constant.

Thanks


texts:
This query is for informational purposes, with something that has had me in doubt all night.

I am trying to send a self-signed transaction for the creation of a contract

My Tx transaction to send is

  const rawTx = {
    nonce:nonce,
    gas:gas,
    from: config.public_key,
    gasPrice:gasPrice,
    to: 0x0,
    chainId: 3,
    data: handle.encodeABI()
  };

At the beginning I had the shipping address to create a contract

0x0000000000000000000000000000000000000000

Well, in eth this is the address to create contracts

https://ropsten.etherscan.io/address/0x0000000000000000000000000000000000000000

Send my transaction with this address, I got the following error.

the contract is not created, but is sent to the address set, when I try to obtain information from the block, I get the following

"invalid argument 1: json: cannot unmarshal non-string into Go value of type hexutil.Uint"

      const status = await this.web3.eth.sendSignedTransaction(
        signTransaction.rawTransaction
      );
        debugger;
      console.log(status);
      const { data, ...temp } = rawTx;
      const form = {
        transaction: rawTx
      };
      this.config.setConfigContract(form);
      const block= await this.web3.eth.getTransactionFromBlock(status.transactionHash);

status.transactionHash  if it exists
"0x5ae4a37cacbcebd222d3ed48e278266a0e15b06fa83b289d71a8f0122dd12a93"
    https://ropsten.etherscan.io/tx/0x5ae4a37cacbcebd222d3ed48e278266a0e15b06fa83b289d71a8f0122dd12a93

My question is, because using 0x0, or
0x0000000000000000000000000000000000000000, no errors, compared to using "0x0000000000000000000000000000000000000000",
Because when I send ethers with the same function in the to field, I put an address in string format,

I use web@1.0.0-beta.35


texts:
I am currently reading the solidty docs , and i came across this :

Mappings can be seen as hash tables which are virtually initialized such
that every possible key exists and is mapped to a value whose byte-
representation is all zeros: a type’s default value. The similarity ends
here, though: The key data is not actually stored in a mapping, only its
keccak256 hash used to look up the value.

Because of this, mappings do not have a length or a concept of a key or
value being “set”.

I understand what hash tables are , but i have absolutely no clue what the above means. What exactly does virtually initialized mean?

If a mapping was created as (uint=>uint) what would happen in this scenario?  I understand the key refereced as a hash , but i fail to understand the concept.  How is this computationally beneficial to the smart contract in terms of storage?

Thanks


texts: How to test if user is on the mainnet/testnet using web3?

texts:
Hello everyone I need your quick help!

I am using web3 1.0.0-beta.34 with React and Next.js and I want to check if user has it Metamask set on mainnet/rinkeby network.

I have read quite a few solutions but I am having a slight problem implementing them.

Basically, I have a Layout component which serves as a wrapper around all the elements, so it is called on every page.

What I found so far is this:

web3.eth.net.getId().then(netId => {
  switch (netId) {
    case 1:
      console.log('This is mainnet')
      break
    case 2:
      console.log('This is the ropsten test network.')
      break
    case 3:
      console.log('This is the kovantest network.')
      break
    case 4:
      console.log('This is the rinkeby network.')
      break
    default:
      console.log('This is an unknown network.')
  }
})

I don't want to console.log it, I want to put it in some kind of a variable, but I am not able to use React state. To simplify it, all I want from this function is to return me a number/string ID of the network where the user is at the moment. For now, it is only returning me a Promise object, and I don't know how to extract the ID from it.

var net = web3.eth.net.getId();
console.log(net);

this is what it shows

Promise {<pending>}
__proto__:Promise
[[PromiseStatus]]:"resolved"
[[PromiseValue]]:1

What i really need is this [[Promise Value]] extracted to a const/var so that I can manipulate it.


texts: How would a 50/50 netsplit play out on Ethereum 2 (beaconchain)?

texts:
I'd like to know what would happen in terms of penalization of staked validators if there was some sort of major global netsplit that -- for the sake of this question -- resulted in exactly 50% of all beconchain nodes being separated from the other 50%.
As I understand things, if a beconchain node goes offline, it is peanalized by having ETH deducted from it's staked balance until it gets to under 16 ETH and then it is excluded from the network. As a blockchain is decentralized, I understand that decisions relating to this are handled collectively by all of the staked nodes.
I've heard people say that the whole practice of excluding offline nodes is to maintain the integrity of the network and handle things such as a nuclear attack. So even if 90% of nodes were suddenly destroyed, the remaining 10% could quickly exclude them and the network would heal.
But in this case, I'm not asking about 50% of the nodes being destroyed. I'm talking about what would happen if half of the nodes couldn't see the other half of the nodes due to a major netsplit. This could be a technical fault, a war or even a political desicion between major world powers. In this scenario, I presume that nodes on each half of the divide, would consider the nodes on the other half of the divide to be offline. As there would then effectively be two separate beaconchain mainnets, each one would then start the process of peanalizing the nodes they couldn't see, reducing them to less than 16 ETH and then eventually excluding them from the network.
If the netsplit was permanent, then I suppose this wouldn't matter. But, let's say that after a week (or a month, or a year) the internet was joined back together again. At this point, could the beaconchain become one again? Would nodes on each side of the split that had had 16 ETH of their stake eaten by the nodes on the other side (which would effectively be all nodes which existed prior to the split as far as I understand it) get their 16 ETH back? How could the stability of the network be maintained if every node had both 32 ETH and 16 ETH at the same time, depending on which part of the split you were looking at?
I've always understood that on Bitcoin and other PoW blockchains that when the two sides of the split were able to see each other again, the longer chain would 'win' and the shorter chain 'orphaned' but that any spends on the orphan chain that hadn't been double-spent on the winning chain would be integrated. But I don't understand how this would with a PoS blockchain, especially with 50/50 split followed by a reintegration.
If this is answered in any documentation or whitepaper then being pointed to the relevant information would be just as valuable as receiving an answer. With such limited knowledge of Ethereum to begin with, it's difficult to even know which terminology to use to find the correct answer. Even Googling something like 'ethereum netsplit beaconchain' return's the dreaded 'It looks like there aren't many great matches for your search' message.


texts: Problem with wallet.transfer in newer solidity compilers

texts:
I read the documentation of the changes on 0.5.0 but I do not know how to get this done with my code snippet. I tried to make the constructor payable but this does not work. Can someone help me. The line "wallet.transfer(msg.value) always through this error: "transfer" not found or not visible after argument-dependent lookup in address" I know that something changed with the namespaces but I cannot figure out how to workaround

contract WalletFactory {
    mapping(address => address[]) wallets;

    function newWallet(address _owner) payable public returns(address wallet) {
        wallet = (address)(new createWallet(msg.sender));
        wallets[msg.sender].push(wallet);
        wallet.transfer(msg.value);
    }
}

contract createWallet {
    address public owner;

    constructor(address _owner) payable public {
        owner = _owner;
    }
}


texts: I have WETH in my ETH wallet but I can't send it

texts: As you see, I have 1.7 WETH. When I try to withdraw, it shows me this


texts: Geth evm not executing contracts on main net but runs fine on ropsten

texts:
I built geth from a fairly new release 1.8.12, when running on testnet (ropsten) it is executing contracts, however when running on the real net it is not, any idea why this is happening? I am using fastsync and not mining - I did start miner but that does not make any difference.

Edit:August 5th 15:14 PDT
Did more debugging and here's where I am at:

In downloader.processFastSyncContent(), the downloader will keep trying to get blocks, and process those after pivot point, in importBlockResults() those blocks after pivot point will be processed and the contracts inside them will be executing. My geth is never passing the pivot point on main net, the afterP list of blocks is always empty. Not sure why tho, my eth.syncing shows:
    {currentBlock: 6094815,
     highestBlock: 6094940,
     knownStates: 84201854,
     pulledStates: 84159136,
     startingBlock: 6094466
    }

On ropsten testnet my evm almost starts evaluating contracts immediately when it is syncing. Now I'm thinking maybe the testnet has something different from the main net that triggers this behavior?


texts:
I am trying to understand the difference in gas cost between getTokenBalance for the two contracts below.

In Example 1 ERC20 is initialized once during the deployment of SomeContract as a part of the constructor, while in Example 2 ERC20 is initialized every time during getTokenBalance invocation.

Is there a siginificant difference between Example 1 and Example 2 below ?

Example 1:

contract SomeContract {
   ERC20 erc;

  constructor(tokenAddress){
      erc = ERC20(tokenAddress)
  }

   getTokenBalance(address owner) returns (uint){
      return erc.balanceOf(owner);
   }
}

Example 2:

contract SomeContract {

   getTokenBalance(address tokenAddress, address owner) returns (uint){
      ERC20 erc = ERC20(tokenAddress);
      return erc.balanceOf(owner);
   }

}


texts: I set up metamask and added tokens. Now my Metamask shows Not Connected

texts: How do I get it connected? I can see my tokens and all of my information, but it still shows "not connected".


texts: Will there be any new additional changes to the Constantinople Upgrade in Feb 2019 vs the delayed one from Jan?

texts: With the upcoming Constantinople Feb 2019 upgrade, will there be any other new changes that wasn't present in the delayed Jan 2019 upgrade? All I know is they fixed the bug they found that delayed it, but was there anything else?


texts: Find out latest block hash in Ethereum using JSON-RPC

texts:
I am developing an ethereum block explorer in PHP and have established an JSON-RPC communication with my server geth node successfully. Nevertheless, I am kind of stuck when trying to find out the last block in ethereum. I have read the great info at https://ethereum.gitbooks.io/frontier-guide/content/rpc.html but I don't find there any way to ask the ethereum node which one is the last block. Once I had the block hash I see there are endpoints to retrieve full information about the block, but I don't know how to find the latest block hash.

The API endpoint eth_blockNumber is supposed to return the latest block number, but how do I get the hash?

Any help? Thanks in advance!


texts:
So last week I went on live.ether.camp and clicked the "Get Address" button then entered a seed phrase which I saved and still know.

Then it told me my address was ready. I then bought 78 ethers on shapeshift.io and had that sent to my address on ether camp.

Since then I tried withdrawing some of my ether by sending them to another address I created with a chrome extension, but the transaction never goes through; it gets stuck saying "Please wait while we are processing your transaction". I left this running overnight and it stayed at the same screen and didn't send. All the identification the "transfer balance" form asks for is the SEED, which I believe should be the one I entered to create my account? My question is, did I make a mistake somewhere? Should I be able to withdraw from an account created on live.ether.camp and has anyone else been able to?

Perhaps I did this the wrong way and my balance can't be withdrawn but I just want to know if that is the case or not.

Screenshots of how I made my account and attempted to withdraw:

http://imgur.com/a/xHRAa


texts: Can emitting an event after a state change cause a reentrancy attack vulnerability?

texts:
Is the following function vulnerable to a reentrancy attack?

function withdraw() public {
     uint amount = pendingWithdrawals[msg.sender];
     // Remember to zero the pending refund before
     // sending to prevent re-entrancy attacks
     pendingWithdrawals[msg.sender] = 0;
     msg.sender.transfer(amount);
     emit AmountWithdrawn(msg.sender, amount);
 }


texts:
I was wondering if there was a way, in theory, to call from a sc two functions from a secondary sc in which the result from the first function is a parameter of the second function so something like:

Contract 1

function one(uint a, unit b) public returns(uint){
    uint c = a+b
    return c
}

function two(uint c, uint d)public returns(uint){
    uint d = c+d
    return d
}

and

Contract 2

function combine(){
     one(a + b)
     two(c + d)
}

Clarifications:

I cannot combine them.

The second requires the first to be executed.

I cannot extrapolate the result of the first in any way

It has to be executed within the second contract.


texts: Verify ethereum signed message using python

texts:
Is there any way to verify signed message using python?
Google  do not provide any useful info. I don't believe that there are no any lib which can do it. Any suggestions?

Many thanks!!!


texts: Solidity- calling function of a deployed contact from within another function

texts:
I am trying to call a function of an already deployed contract from within another contract.

import "./TutorialToken.sol";
contract Sellers
{
  TutorialToken _tt;

  constructor(address _f) public
  {
      _tt = TutorialToken(_f);
  }

  _tt.f();
}

However when I try and truffle migrate I get an error "Sellers" -- Invalid number of parameters for "undefined". Got 0 expected 1!

I am confused on how I call the function of an already deployed contract from within another contract.

EDIT

initial deployment

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

module.exports = function (deployer) {
  deployer.deploy(Migrations)
}

deploying contracts

const TutorialToken = artifacts.require('./TutorialToken.sol')
const Sellers = artifacts.require('./Sellers.sol')

module.exports = function (deployer) {
  deployer.deploy(TutorialToken),
  deployer.deploy(Sellers)
}

Migrations.sol

pragma solidity ^0.5.0;

contract Migrations {
address public owner;
uint public last_completed_migration;

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

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

function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
}

function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
}

}


texts: How much faster is it to sync the FULL blockchain with --cache=1024?

texts:
Running Geth with --cache=1024 is recommended to be able to sync the blockchain faster (since the default is only --cache=16.

I want to have the full blockchain (all past transaction data) so do not want to use --fast.

How much faster is it to sync the full blockchain from the start using geth --cache=1024 than just geth?  Have any benchmarks been performed on this?


texts: Is it possible to make a Public Address only accept ETH/WEI from only Specified Address(es)?

texts: ... and if so what would this theoretical "rejected" transaction look like? Would the ETH/WEI be "auto-returned" back to the original Address?


texts:
Say one smart contract trigers an event after one transaction.
if this transaction was recorded in one uncle block, then there will be one event, and after confirmed by main block , will there be another event?

let 's say we have a web3 front end watching this contract, how many events will be recorded.


texts: how can i move my NFT from localhost to Rinkeby test network

texts:
i have made some NFT's on a local host using ngrok and ganache and i wish to move them to Rinkeby test network so i can publish them on marketplaces, is it possible or is there another way to do so?
Thanks


texts: Tutorials for creating ethereum wallet in android?

texts:
I saw a similarly named question over here but I sort of felt like it was closed by linking an irrelevant question which just lists existing ethereum wallets.

As I understand, I should have the ability to an create ethereum address and private key with it, suitable way to store it securely.
Ability to import an account in the wallet (i.e) given a private key, it should get the corresponding public key or use the underlying private key when given appropriate word phrases.

Then use the private keys to sign transactions for transfer.

So is there any tutorial that covers these? I understand I should use web3j for transactions but it requires some credentials to a wallet file, I'm not entirely sure how to create it.


texts: Web3j decode function from TransactionReceipt

texts:
I'm connecting to a testnet using a Geth node running version 1.8.8-stable,
and also I'm using the web3j lib version 3.4.0.

I deployed a Smart Contract and also used the web3j wrapper tools to interact with the contract and everything looks like working.

What I want to do is to decode the information from newly mined blocks. i.e. I subscribe and I can retrieve all transaction from the newly mined blocks.

I know that a transaction is about my smart-contracts because the "to" address is the same in smart-contracts. But how can I recognize the functions that were called???

Sorry for my English, I hope that someone can help me.
Here an example of the Transaction Receipt that I retrieve from a transaction hash. Is there any way to understand what function of the smart contract was called???

TransactionReceipt{

transactionHash='0x6583a913786bc0010937806c4a97e8fcac673b1cd9e25c79074df76ae235f4f5',

transactionIndex='0x0',

blockHash='0x624ed9afc8a45c0b79a1c471fe732d00b813cc476f264e9ada0d3a15a7cf6198'

blockNumber='0x5e4cf'

cumulativeGasUsed='0x9495',

gasUsed='0x9495',

contractAddress='null',

root='0x3a175640d6654236151ffc9f9afbd9087a656b2b46ead9df5587725a77d3bd7a',

status='null',

from='0x145107ef476743eaabf8df07cefd47b17d87506c',

to='0x70104c2d70145d745ee9308e0ee428e1d96e6142',

logs=[Log{removed=false, logIndex='0x0', transactionIndex='0x0', transactionHash='0x6583a913786bc0010937806c4a97e8fcac673b1cd9e25c79074df76ae235f4f5', blockHash='0x624ed9afc8a45c0b79a1c471fe732d00b813cc476f264e9ada0d3a15a7cf6198', blockNumber='0x5e4cf', address='0x70104c2d70145d745ee9308e0ee428e1d96e6142', data='0x0000000000000000000000000000000000000000000000000000000000000064', type='null', topics=[0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, 0x000000000000000000000000145107ef476743eaabf8df07cefd47b17d87506c, 0x00000000000000000000000061259ec0cfc824e41b5ca2cc64f6453476b165b4]}],

logsBloom='0x00000000000008000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000040000000000080020000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000100000000000000000000000000000800010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000'
}


texts: I am using Web3j and I want confirmation for deposits in user wallet. Is it possible if yes how can I do this using Web3j


texts: Geth in non-mining mode and Etherem Wallet

texts:
If I start Geth node this way:

/home/porton/bin/geth --datadir ~/private_ethereum_blockchain --networkid 100 --nodiscover --nat none --mine --minerthreads 1 --ipcpath /home/porton/.ethereum/geth.ipc --rpc --rpcport 8545 --rpcapi 'web3,eth,debug,net,shh' --rpccorsdomain '*'

and then start Ethereum Wallet, then Ethereum Wallet connects to the local node and uses it as a peer.

If I however remove --mine --minerthreads 1 from the above command, then when I start Ethereum Wallet it stalls with "Looking for peers..." message and cannot use my local node.

Why? And how to use Ethereum Wallet with a local Geth node without mining? (Mining disturbs my testing because it causes unintended changes of balances.)


texts: MetaMask cannot send transaction on local network

texts:
I'm running Geth in dev mode locally, like this:

geth --ipcpath test-chain-directory/geth.ipc --datadir test-chain-directory --dev --rpc --rpccorsdomain "*" console

I can send a transaction from the console, and it works, but when I connect MetaMask to http://localhost:8545, sending a transaction from one account to another fails.

I've made sure to run miner.start() before sending the transaction, but it fails in MetaMask with the following error:

Error: [ethjs-rpc] rpc error with payload {"id":3105471441522,"jsonrpc":"2.0","params":["0x...."],"method":"eth_sendRawTransaction"} Error: invalid sender

The account I'm sending from was one I created via the console, and funded with Eth, before importing into MetaMask, and MetaMask show's balance correctly.

What am I missing?


texts: The address where smartcontract is deployed

texts:
When I use truffle migrate, My smart contract was deployed to the address 0xdb6e3e0dc6481ba0dfdf7698977ddf7e0b94c9c4. Why is that address? and how to replace it by my address?

Migrations: 0xee53cb433385a5b172b7bf4e4dfd592c354d4f21
Saving successful migration to network...
  ... 0xa86cc1bce30b77c0f5030ffd1970449af3166d4cb452a888b16f90a0293df65c
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying Adoption...
  ... 0x2994c186c57cf8367674460eb1288ea629bb98e3beed23cc12d45c0ae4e1b8bb
  Adoption: 0xdb6e3e0dc6481ba0dfdf7698977ddf7e0b94c9c4
Saving successful migration to network...
  ... 0xb9de60d9057b0f53b1c9b7869d253d0146f3e87e4c4167577213a385bbbc26bc
Saving artifacts...


texts:
I found a lot of tutorials say anyone who creates dapps needs to use Node Package Manager (NPM).
And the reason why it is necessary is because nodejs console is used for interacting with the contract on the blockchain.
But why do we need nodejs for smart contract? Smart contract is not written by JS but solidity.
Could anyone please simply explain why and for what purpose we need to use npm?


texts: calling one contract to another contract method

texts:
I want to call the method getdata() and retrieve the returns value to use in another contract. But the call  only returns bool on success or failure.

  How do I get the return value from getdata() from caller() function in contract extra .
  How do I modify the state:- send transaction to  setdata(uint,bytes32) from contract extra and change the state of data1 and data2.

Above problem are based on following code.

pragma solidity 0.4.21;
contract Base{
    uint public data1;
    bytes32 public data2;

    function setdata(uint a, bytes32 b){
        data1 = a;
        data2 = b;
    }
    function getdata() public view returns(uint){
        return data1 ;
    }

}
contract extra{
   bool public retrive;
   bool public retrive_setter;
   address public baseaddress = 0xca598f876f79a5f8f479bfa1dcc8f4f2dffbd5c2;
   uint a = 5;
   bytes32 b ="Lina";
   function caller(){
        retrive = baseaddress.call.gas(10000)(bytes8(keccak256("getdata()")));
        retrive_setter = baseaddress.call.gas(1000000)(bytes24(keccak256("setdata(uint, bytes32)")),a,b);
   }
}

Either you can Modify the code and give your answer. I saw this problem on many devs who are newby. Every possible answers are acceptable.

simply on testing using Remix .

  retrive  0:bool: true
  retrive_setter  0:bool: false


texts:
Has anyone got Truffle tests to work with async/await?

My sample code for testing

require('babel-polyfill');
var ERCToken = artifacts.require("./ERCToken.sol");
var Proxy = artifacts.require("./Proxy.sol");

contract('ERCToken', function(accounts) {
  it("should allow purchase", async function () {
    var expected = 10;
    var meta = ERCToken.deployed();
    var result = await meta.purchase({from:accounts[0],value:80000});
    var balance = await meta.balanceOf(accounts[0]);
    assert.equal(balance.valueOf(),expected,"should have purchased "+ expected + "tokens");
  });
});

TypeError: meta.purchase is not a function

The solidity program does have a function called purchase. ERCToken.deployed() doesn't seem to resolve without a then call.

Can anyone please tell me where am I going wrong?


texts: "potential rewrite attack" message on Geth

texts:
When I was sending Ether using Mist I got the following message on Geth.

I0528 18:34:57.312997 core/blockchain.go:959] imported 1 block(s) (0 queued 0 ignored) including 3 txs in 19.344963ms. #1602638 [e4523f86 / e4523f86]
I0528 18:35:24.519128 eth/downloader/downloader.go:1091] Peer ############ [headers 0.00/s, blocks 0.00/s, receipts 0.00/s, states 0.00/s, lacking    0]: potential rewrite attack: #0 [########…] <= #1512638 limit

After that, the transaction didn't get sent. And I had to send it again.

What does the message mean? Is it dangerous? Is it Geth and the accounts currently being used on Mist compromised?

I tried Googling but nothing really relevant showed up.


texts: Why Can't I Call This Parent Function in Solidity?

texts:
Parent function in ERC1155:
    function uri(uint256) external virtual view override returns (string memory) {
        return _uri;
    }

Attempted overriding function in my child contract:
    function uri(uint256 _id) external virtual view override(ERC1155) returns (string memory) {
        return Strings.strConcat(
            ERC1155.uri(),
            Address.toAsciiString(address(this)),
            "/",
            Strings.uint2str(_id),
            ".json"
        );
    }

I get:
TypeError: Cannot call function via contract type name.
            ERC1155.uri(),
            ^-----------^

I'm doing approximately the same thing in the same file but it works:
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual override(ERC1155, ERC1155Pausable)
    {
        ERC1155Pausable._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }

That function is internal so it's different, but does that difference matter?
Using Solc 0.6.0.


texts: what's the difference between send ether and send offline on mew

texts:
what are the differences between send ether/token and send offline using mew?
I wasn't able to manually set gas price with send either/token, then I found out send offline lets me do that, I signed the transaction with my trezor and everything worked just like send either/token. I'm wondering why send offline is there, what's the primary use case for it?


texts:
I am trying to create NFTs in various digital/crypto marketplaces like OpenSea, Rarible, etc for the past few weeks. In most of the sites, we need to pay some gas fees for adding an asset and creating an NFT for it. But OpenSea doesn't ask for any gas fees for adding an asset in Ethereum. After adding the asset I could see the contract address and unique Token ID for it. But how it is possible to deploy a contract and create an NFT with zero gas fee? On their official website, they have mentioned that they use "Lazy Minting" which is, the NFT token is really minted on the blockchain while its first purchase or transfer.

The new collection manager allows creators to make NFTs without any upfront gas cost, as the NFT isn’t transferred on-chain until the first purchase or transfer is made. We call this lazy minting. It unbundles the on-chain issuance of your NFTs from the metadata.

But technically I couldn't understand the concept behind this. Do they use any await function and promise to achieve this? Or is there any other alternative way?
For more info, Please find the contract address and Token Id for the asset I have added,

Contract address: 0x495f947276749Ce646f68AC8c248420045cb7b5e

Token ID: 34933046909214840971720565469667075475484107771494388163319263788272235577345


texts: How are mappings found in storage in geth?

texts:
Code -

pragma solidity ^0.4.18;

contract CA4 {

mapping(address=>uint16) public balances;

function getBalance() view returns (uint16) {
uint16 mybalance = balances[msg.sender];
return mybalance;
}

function setBalance(uint16 newbalance) public {
balances[msg.sender]=newbalance;
}

}

Geth -

> eth.getStorageAt(con.address,0)
"0x0000000000000000000000000000000000000000000000000000000000000000"
>  var key = web3.sha3("0x0000000000000000000000000000000000000000000000000000000000000000", {encoding:"hex"});
undefined
>  var bn = web3.toBigNumber(key);
undefined
> eth.getStorageAt(con.address, bn)
"0x0000000000000000000000000000000000000000000000000000000000000000"
> eth.getStorageAt(con.address,1)
"0x0000000000000000000000000000000000000000000000000000000000000000"
> con.getBalance()
1000

The array balances is stored somewhere. I am unsure how to find it. I tried a method which worked when we had an array of structs. But that did not work for the mapping of addresses to uint16.

How can we find the actual storage of balances using for example getStorageAt(con.address, slot)?

More Details -

> eth.defaultAccount
"0x46fb9a22689c4a4bfb494baeafbb8b2993725305"
> key=web3.sha3("0x46fb9a22689c4a4bfb494baeafbb8b2993725305",  {encoding:"hex"});
"0x0679d661b585d1b4f0c3fd18f943f19e7fa9777fe23cb96b94f469c20d6f0bd5"
> var bn = web3.toBigNumber(key);
undefined
> eth.getStorageAt(con.address, bn)
"0x0000000000000000000000000000000000000000000000000000000000000000"
>


texts: How can I import Rinkeby account to metamask after deploying my contract to Rinkeby test network?

texts: I finished deploying(compiled and migrated) my contract to Rinkeby test network. So, now I'm trying to go to MetaMask and clicked on Rinkeby TestNet and don't know what to do after. How do I get my Rinkeby's private key or json file to import to metamask? All I can see is ["account Address", "account Address", "account Address"] when I put "eth.accounts" on my geth console.


texts: Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition. function

texts:
I am using Truffle together with Ganache and I can't get this code to run:
pragma solidity >=0.4.21<0.6.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract UniqueAsset is ERC721{

using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
mapping(string => uint8) hashes;

  constructor() public ERC721("UniqueAsset", "UNA") {}
}

function awardItem(address recipient, string memory hash, string memory metadata)
  public
  returns (uint256)

{
    require(hashes[hash] != 1);

    hashes[hash] = 1;

    _tokenIds.increment();

    uint256 newItemId = _tokenIds.current();

    _mint(recipient, newItemId);

    _setTokenURI(newItemId, metadata);

    return newItemId;

}

it shows me the following error:
:15:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
function awardItem(address recipient, string memory hash, string memory metadata)
^------^

Anybody an idea whats wrong?


texts: Uncaught Error: CONNECTION ERROR: Couldn't connect to node web3.min.js:1 http://localhost:8545

texts:
**Hi, I am doing a sample project on Ethereum where 2 fields ( Emp name, Emp Id) will be taken from the UI and set those values using a smart contract and show the values back to UI. Getting below 2 errors.Please help me out to solve this.

  Failed to load http://localhost:8545/: Response to preflight request
  doesn't pass access control check: The value of the
  'Access-Control-Allow-Origin' header in the response must not be the
  wildcard '*' when the request's credentials mode is 'include'. Origin
  'null' is therefore not allowed access. The credentials mode of
  requests initiated by the XMLHttpRequest is controlled by the
  withCredentials attribute. t.send @ web3.min.js:1

  Uncaught Error: CONNECTION ERROR: Couldn't connect to node
  http://localhost:8545.
      at Object.InvalidConnection (web3.min.js:1)
      at t.send (web3.min.js:1)
      at n.send (web3.min.js:1)
      at l.accounts (web3.min.js:1)
      at index.html:41 InvalidConnection @ web3.min.js:1 t.send @ web3.min.js:1 n.send @ web3.min.js:1 (anonymous) @ web3.min.js:1
  (anonymous) @ index.html:41


texts: How to specify Solidity version in web3j?

texts:
I have a simple java maven project whose pom.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>poc</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <solidity.version>0.7.4</solidity.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.web3j</groupId>
            <artifactId>core</artifactId>
            <version>4.8.4</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.web3j</groupId>
                <artifactId>web3j-maven-plugin</artifactId>
                <version>4.6.5</version>
                <configuration>
                    <soliditySourceFiles/>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

As you can see I am using web3j library to interact with my blockchain and web3j maven plugin to convert my solidity files to java files.
When I run mvn web3j:generate-sources, it successfully runs and converts the solidity files to java files. But when I run the main method of the project from the IDE, it fails with this error:

From the error message above, I tried removing the constructor from my solidity file and the pragma line, and then my project builds and runs fine as expected. So, I am thinking my java project is picking the wrong solidity version somehow.
Any tips/hints as to what may be going on here or how to fix this?


texts: What will the ETH inflation rate be after PoS is released?

texts: Has the Proof of Stake emission schedule been decided yet? What will be the rate of inflation? Is 2017 for the end of PoW still the best estimate?


texts:
I've seen sample code in various places that have public arrays, but when I try to create this contract in Remix:

pragma solidity ^0.4.19;
contract Ballot {
  uint8[] public proposals;
}

It always fails with

undefined errored: VM error: invalid opcode.
invalid opcode  The constructor should be payable if you send value.
    The execution might have thrown.
    Debug the transaction to get more information.

Again, this is during the creation of the contract. I've tried sending value (and adding a payable constructor); the error changes (VM error: revert.), but still does not succeed. I've also tried debugging; it steps through the constructor (if present), and then steps through the state field and fails there.


texts: Subcurrency Example: Why always be the "minter" using browser compiler?

texts:
A note in the docs referring to the contract example SubCurrency states:

  This is not a nice example for browser-solidity. If you use browser-solidity to try this example, you cannot
  change the address where you call functions from. So you will always be the “minter”, you can mint coins and send
  them somewhere, but you cannot impersonate someone else. This might change in the future
  Solidity Docs pg 8

contract Coin {
  // The keyword "public" makes those variables
  // readable from outside.
  address public minter;
  mapping (address => uint) public balances;
  // Events allow light clients to react on
  // changes efficiently.
  event Sent(address from, address to, uint amount);
  // This is the constructor whose code is
  // run only when the contract is created.
  function Coin() {
    minter = msg.sender;
  }
  function mint(address receiver, uint amount) {
    if (msg.sender != minter) return;
    balances[receiver] += amount;
  }
  function send(address receiver, uint amount) {
    if (balances[msg.sender] < amount) return;
    balances[msg.sender] -= amount;
    balances[receiver] += amount;
    Sent(msg.sender, receiver, amount);
  }
}

Apart from the issue of whether this persists in the current version, why can you not change the address from where you can call functions in the browser Solidity compiler?

Context: I'm asking to firm up my grasp of contract origins, deployment and ownership.


texts: create multiple transactions between two accounts using SendTransactionAsync method nethereum

texts:
I am trying to create multiple transactions between two accounts using SendTransactionAsync method. But I am getting "replacement transaction underpriced" message. I found some links which says we need to increase nonce to create new transactions in loop. But I am not able to find Nethereum function where I can mention nonce value while creating transaction. Can anybody guide me with solution to this?

HexBigInteger gas = new HexBigInteger(25000);
HexBigInteger value = new HexBigInteger(100);
for (int i = 0; i < 1000; i++)
{
  gas = new HexBigInteger(gas.Value + (gas.Value * 20) / 100);
  value = new HexBigInteger(value.Value + (value.Value * 20) / 100);
  var privateKey1 = "0x5083ff34a6610ad0d08d5e568fcee84e29a1391a6fffa8cf96484388f57de731";
  var account = new Account(privateKey1);
  var web3 = new Web3(account, "http://127.0.0.1:8001/", null, null);
  var addressTo = "0x12890D2cce102216644c59daE5baed380d84830c";
  string data = "ASDF";
  var transaction = await web3.TransactionManager.SendTransactionAsync(new TransactionInput(data.ToHexUTF8(), addressTo, account.Address,gas, value));
}


texts: Wastage with shorter block time and how it is handled

texts:
Comparing to Bitcoin, Ethereum has much shorter block time. It is stated that Bitcoin has 10 minutes set to make least amount of wastage https://bitcoin.stackexchange.com/questions/1863/why-was-the-target-block-time-chosen-to-be-10-minutes

I read in most places that Ghost protocol is implemented in Ethereum to solve this problem, but couldn't find how much wastage is going on. Then again it is said in some posts like here that  Ghost is not implemented in ethereum
Why did Ethereum abandon the GHOST protocol?
but Inclusive protocol. So my main question is how is it ok for Ethereum to have uncles and wastage and for bitcoin it isn't and how much of it has ethereum got?


texts: How do I access my ether from my unencrypted private keys?

texts:
I previously used Jaxx, where I stored some Ether. I have now uninstalled Jaxx, but would like to access my Ether in any way possible.

I don't have the Jaxx mnemonic as it was never made clear that I needed it, but luckily I do have my private key and public address, both of which Jaxx provides in unencrypted form.

I have tried the 'import paper wallet' tool in a new Jaxx wallet, but it just says 'scanning private key' for an hour and doesn't do anything. I have also tried importing via geth, but for some reason my balance shows up as 0. This might be because geth was linked to a testnet?

Any help with retrieving my ethereum is appreciated.


texts: Remix Solidity compiler is giving error (Expected token Semicolon got 'Returns')

texts:
When I debug a similar contract in Remix:
function ConstructorFunction(uint _inputOne, uint _inputTwo){
    callsAnotherFunction('string') returns (bool success);
}

I am returned this error:

contract.sol:2:36: Error: Expected token Semicolon got 'Returns'
callsAotherRunction('string') returns (bool success);
                          ^

(note regarding formatting: '^' appears beneath the 'r' in 'returns')
This seems to occur everytime I include a returns after a function. What is the appropriate syntax?


texts: Is the contract code part of the blockchain or just the hash of the code?

texts:
Almost certainly noob questions - but here goes:

does the Ethereum blockchain contain the contract code or just the hash of the code?
Does the Ethereum `State' contain contract code or just its hash?

Hope you can help. Thanks in advance :)

John


texts:
Please let me know if there is a PHP ethereum API or SDK, with the following requirements:

The project must be currently maintained. Don't send a link to a project that has not been updated in 2 years.
I don't want to open any additional ports on my Linux server.
I need to add transactions to the Ropsten Testnet.
There can't be any limits to requests (such as 200 requests per hour), and there can't be a monthly fee.
It must be a stable, proven API or SDK that will not be terminated in the near future.


texts:
Spec:

Wallets have sums paid to them for different tokens.

Design

Wallet address maps to totalpaid by token.

Implementation

Two mappings, one for wallet address, one for a token label (designed to be an integer based on a second struct)

Error

Integer constant expected

This line fails -

 uint _TotalPaid = PaymentDetail[_TokenIndex][_Wallet].TotalPaid;

Has anyone any ideas about how to solve this error?

Here is the code -

    struct PaymentDetail {
        uint TotalPaid;
    }

    mapping (bytes32 => mapping (uint => PaymentDetail[]) ) public PaymentDetails;

    function addPaymentDetail (bytes32 _Wallet, uint _TokenIndex, uint _Payment) public {
        uint _TotalPaid = PaymentDetail[_TokenIndex][_Wallet].TotalPaid;
        _TotalPaid=_TotalPaid+_Payment;
        PaymentDetail[_Wallet][_TokenIndex].TotalPaid=_TotalPaid;
    }


texts: I am using geth console to interact with the smart contract. I have followed the following link to deploy the smart contract. https://medium.com/@gus_tavo_guim/deploying-a-smart-contract-the-hard-way-8aae778d4f2a I am able to deploy the contract but "storage.get.call()" is always returning 0. The solidity version used in the link is 0.4.10. But I have used solidity version 0.5.11. And I have made changes in smart contract accordingly. Is the solidity version causing problem? What may be the issue?


texts: Multiple addresses initialization in constructor function

texts:
Usually we have one address initialization in constructor function. And that address becomes owner of the contract. While studying erc721 token and going through several examples online i found ceo and coo addresses being initialized in constructor function. I was wondering what is the point of initializing both of them to same address or is there any way to have different addresses for both of them in constructor through msg.sender.

function xyz() public {
   ceoAddress = msg.sender;
   cooAddress = msg.sender;
}


texts: Can i make all the functions in my smart contract as constant?

texts:
What if i make a smart contract that does modify the state, but the all its functions are constant.(it will still compile) It means that i can use my smart contract for free without paying for the gas. Wouldn't this be a lose to the miners?
How does Ethereum handles this situation?


texts: Why is calling .at() is much slower than .deployed()?

texts:
I'm trying to create a helper function that will allow me to switch between a .deployed() call to my contract, vs one with a fixed address using .at(). The second call (that is commented out in the code below), is so extremely slow. I'm making about 1-2 calls per second (polling for an event) against a local testnet and it keeps Chrome pegged at 100% using the second method. The first method is about 20 times faster. Why is this so, and how do I fix this?

getContractDeploy: function() {
    contract_deploy = App.contracts.CONTRACTX.deployed();
    //contract_deploy = App.contracts.CONTRACTX.at(contract_address);
  return contract_deploy;
},


texts: It's 2020 September. How big is the Ethereum blockchain when download a full node?

texts: If I want to support ethereum with a full node. How much space do I need to host a full node as of today 2020 September?


texts: State Root and Merkle Proving that State Exists

texts:
After reading up for a while, I don't have a great understanding of how exactly the state root is calculated in every Ethereum block. I also want to find a method of proving that a certain variables of certain contracts have certain values via a Merkle proof. Are there any resources one can point me to do learn about the how to do so and learn more about stateRoot?
Thanks in advance.


texts: Error when call contract method on binance smart chain

texts:
when a i call any of contract methods (the contract is the pancakeswap factory), this error return
error: call revert exception (method="allPairsLength()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.13)
Anyone know why?
const hre = require ('hardhat');

async function main() {

  const provider = new hre.ethers.providers.JsonRpcProvider('https://bsc-dataseed1.binance.org:443');
  console.log(await provider.getBalance('0xDf5390a504263d35Db42E1Df19775b6855C548af'));
  factory = await hre.ethers.getContractAt('IUniswapV2Factory','0xBCfCcbde45cE874adCB698cC183deBcF17952812');
  await factory.allPairsLength()

}

main();


texts: How can I turn this into a human readable output?

texts:
I have this buy function but the output gives me a transaction Nr. or whatever this is

async function buy() {
  var a = document.getElementById("amount").value;
  var accounts= await web3.eth.getAccounts();
  console.log(accounts);
  var contract = new web3.eth.Contract(abi,address);

  contract.methods.buy(a, "0x0000000000000000000000000000000000000000").send(
    {from:accounts[0]},
    function(error, approve){
      if(error){
        console.log(error)
      } else if(approve){
        console.log("you bought :" + approve)
      }
  });
};

And this is the output:

You bought  :0x54c06a7af7a1a4d9fbe4c69778ea23f40514029124674d86225bec14ae0494d8

how can i trn this into readable out put like, you bought xxx amount of token, for example?


texts: How to get gasPrice from API and use it in truffle.js mainnet network?

texts:
I'm fairly new to javascript and I'm trying to automate pulling the gas price from an api and using it into the truffle.js used to execute via truffle.

Basically, I can pull the gasprice via the API but the variable is not recognized within the defined networks. I can pull the api and use it by sending and calling transactions via web3, but I need to add this to all my scripts(I will eventually but I need a quick fix for now).

I've tried:

equire('dotenv').config()
var HDWalletProvider = require("truffle-hdwallet-provider");
var NonceTrackerSubprovider = require("web3-provider-engine/subproviders/nonce-tracker");

var mnemonic = process.env.ETH_MNEMONIC;
var accessToken = process.env.INFURA_ACCESS_TOKEN;

/*
***********************Fetch tests*******************************/
const Web3 = require('web3');
const fetch = require('node-fetch-polyfill');
var web3 = new Web3(new HDWalletProvider(mnemonic,"https://rinkeby.infura.io/"+ accessToken));

//test vea Async fx
//https://ethgasstation.info/json/ethgasAPI.json
//https://www.etherchain.org/api/gasPriceOracle
async function fetchGasPrice() {
  const URL = `https://www.etherchain.org/api/gasPriceOracle`;
  try {
    const fetchResult = fetch(URL);
    const response = await fetchResult;
    const jsonData = await response.json();
    const gasPriceNow = await jsonData.standard*1;
    const gasPriceNow2 = await (gasPriceNow + 1)*1000000000;
    console.log(jsonData);
    console.log("gasPriceNow", gasPriceNow);
    console.log("gasPriceNow2", gasPriceNow2);
    return(gasPriceNow2);
  } catch(e){
    throw Error(e);
  }
}

var gasP = fetchGasPrice();
console.log("gasP1", gasP);

//test via fx
function fetchOHLC(){
  const URL = `https://www.etherchain.org/api/gasPriceOracle`;
    return fetch(URL)
    .then(response => response.json())
    .then(function(response) {
        var l = response.safeLow;
        var s = response.standard;
        var f = response.fast;
        var ft = response.fastest;
        var gp = response.standard*1;
        var gasPrice = (gp+1)*1000000000;
        console.log("gasprice",gasPrice);
    return gasPrice;
    })
    .catch(function(error) {
        console.log(error);
    });
}

var fetchData = fetchOHLC();
console.log("fetchData:",fetchData);
var price = fetchData.then(function(result){});
console.log("new Gas Price", price);

//test via web3
var gasPrice2 = web3.eth.gasPrice;
console.log(gasPrice2);
var gasPrice2 = gasPrice.toString(10);
console.log(gasPrice2); // "10000000000000"
/********************************************Fetch test end****************
*/

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*", // Match any network id
      gasPrice: 1, // Specified in Wei
      gas:4700000
    },
    ropsten: {
      provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+ accessToken),
      network_id: 3,
      gas: 4700000,
      gasPrice: 17e9
    },

    mainnet: {
      network_id: "1",
      provider: function () {
        var wallet = new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/' + accessToken)
        var nonceTracker = new NonceTrackerSubprovider()
        wallet.engine._providers.unshift(nonceTracker)
        nonceTracker.setEngine(wallet.engine)
        return wallet
      },
      network_id: 1,
      gas: 4700000,
      gasPrice: gasP /*************right here, gasP or gasPrice2 are not recognized*********/
    },
    rinkeby: {
      network_id: "4",
      provider: function () {
        var wallet = new HDWalletProvider(mnemonic, 'https://rinkeby.infura.io/' + accessToken)
        var nonceTracker = new NonceTrackerSubprovider()
        wallet.engine._providers.unshift(nonceTracker)
        nonceTracker.setEngine(wallet.engine)
        return wallet
      },
      network_id: 4,
      gas: 4700000,
      gasPrice: 4000000000
    }

  }
};


texts: response from ETC comming as 0 for latest block

texts:
sudo docker run -d  --name coregethnode -v /node-etc-geth/data:/root  -p 127.0.0.1:8545:8545  -p 30303:30303 etclabscore/core-geth --classic  --http --http.port 8545 --http.addr "0.0.0.0"
I have started my ETC node using above
node is synching but when i try to query it using below curl -X POST -H 'content-type:application/json' --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' http://localhost:8545
I am getting response as '0'.


texts: Where do I see the current, exact DAG size? Is it being tracked on a website somewhere, or is it something I can check on my miner?


texts:
How do I create an Ethereum contract which itself create multiple transactions as a result of a single invocation.

Can anyone help me out here?


texts: ethereum-bridge: always return a callback error

texts:
I am using Oraclize for generating random number for my smart contract. I write unit test for testing oraclize things so I use ethereum-bridge written by Oraclize. Here is my problem:

First: my smart contract sends random query to oralize
On ethereum-bridge console, I see the query and see successfully message.
after a short time, I always see a failure message such as

  ERROR callback tx error, contract myid:
  0x16174d0d5cc86d8104d2a08294b5e00040659442a9cfc364d45e988279594cd8

Same code, but some weeks ago it works. Now, it doesn't. I don't know why and how to fix this.

Edit

Here is my Oraclize code:

constructor() public {
    OAR = OraclizeAddrResolverI(0xDB200f12d0DE77CEAD6Cec77AB328a1548ca4574);
    oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}

function _randomWolframAlpha() internal returns (bytes32) {
    require(
        oraclize_getPrice("WolframAlpha") <= address(this).balance,
        "Oraclize query was NOT sent, please add some ETH to cover for the query fee"
    );

    return oraclize_query("WolframAlpha", "random number between 100000000 and 999999999");
}

Here is test code:

        // Wait for the callback to be invoked by Oraclize and the event to be emitted
        const logNewPriceWatcher = promisifyLogWatch(this.contract.OraclizeCallbackEvent({fromBlock: 'latest'}));

        log = await logNewPriceWatcher;
        assert.equal(log.event, 'OraclizeCallbackEvent', 'OraclizeCallbackEvent not emitted.');

Here is my version:

solidity: 0.4.21
Truffle: 4.1.14
Ethereum-bridge: using latest on master and https://github.com/oraclize/ethereum-bridge/tree/broken-dep-workaround

Thanks


texts: Is Web3 on Python hosted on a Raspberry Pi possible?

texts:
I've created a Discord bot that allows users to calculate their net worth including altcoins and LP tokens, which I want to use web3 to determine the value of. I did the standard pip install web3 on Python 3.6.1. I'm using a Raspberry Pi 3b.
I'm doing from web3 import Web3 to import, but this immediately raises ValueError: int string too large to convert. I determined it's the import causing this error by slowly commenting out everything else.
Is it just not possible to run Web3 on a Raspberry Pi because of the 32bit OS and Python install or am I doing something wrong?


texts: Best practice for multiple dependent requests in Web3.js

texts:
Looking to get some advice on a pretty common scenario using Web3.js

Let's say you want to calculate the number of tokens for a specific ERC20 token contract that are present at an Ethereum Address.

To do this accurately, you will need to fetch both the balanceOf() and the decimals() values through Web3.js, and then adjust the balance to give a final value.

However, best practice for these Web3 requests is to make sure they are asynchronous, so we may get back the balance at a different time we get back the decimals.

What is the best way to display the adjusted value after both of these values are returned?

From my brief research, you can:

Use JavaScript Promises
Use Web3.js Batch
Nest the Asynchronous Calls

Are there any other options? Is there a best choice from the options above? Or is it scenario driven?


texts: Declaration Error: Identifier already declared

texts:
I'm having a problem declaring the enum Stage.
The previous declaration is here:
enum stage {Init, Reg, Vote, Done}

Changing the Stage name doesn't help:
enum stage {Init, Reg, Vote, Done}
Stage public stage = Stage.Init;


texts: Error: Number can only safely store up to 53 bits

texts:
const result = await myContract.methods.myMethod(1).call();

brings the error from above. There is a simmilar questions here but since I use call gas shouldn't matter. I'm using "web3": "1.0.0-beta.35", (Beta.36 doesn't work for me at all.)


texts: Browser based Ethereum app vs Wallet app

texts:
What are the pros and cons of having an Ethereum DApp running on a browser compared to the one in which each user is given a wallet?

This is question is for a DApp that would transfer files from user to user.


texts: Receive deployed contract address by transaction hash with JSON-RPC request

texts:
I want to receive deployed contract address by transaction hash.
Transcation example - 0x996a683acd59a2ad17461f76ce0f387a89a5ac257ec5d667556219c6acc7f45a.

As you can see this contract was deployed by the other contract (fabric) and when I look at the internal transaction - I see newly created contract address (https://etherscan.io/tx/0x996a683acd59a2ad17461f76ce0f387a89a5ac257ec5d667556219c6acc7f45a#internal)

I know that I can calculate new contract address by creator address and nonce (number of transaction from this address), but I have an array of transactions list and don't know number of transaction on the contract deployment time. So I want to get this address with JSON-RPC request if it's possible.


texts: Remix IDE Waring for "Required Compiler Version"

texts:
I am well versed with solidity and often use Remix IDE. Quite recently, despite adding a compiler version in my code. I am still getting this warning
 Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.6.5;".
The code:
pragma solidity ^0.6.5;'
Contact A{
<Something>
}

Any guidance, why is this happening?
Edit: It works fine in incognito mode.


texts: Can ERC-20 Token be attained/transfered based on actions?

texts:
I had a quick question about an abnormal ways to buy ERC-20 Tokens and hear if this is technically possible.

Let's assume there is a smart contract that generates and holds ERC-20Token called 'ThankYou' token, which has a supply of 1 billion tokens.

1) User A donates 100ETH to a child in need.

2) Smart contract detects that User A has donated 100 ETH and validates that 100ETH indeed has been sent to the child

3) Smart contract is triggered to transfer 30ThankYou tokens to User A for doing good.

I would very much appreciate your thought on this. I only came across cases where ERC-20 Tokens are attained by 'buying' with ETH (based on the price of ERC-20 Tokens). I was wondering if above step I mentioned is possible. And If yes, then can User A sell that 30ThankYou tokens for a exchange with ETH.

Thank you,


texts: How can I check if a specific contract's address inherits from a interface or contract?

texts: I have a special contract with few extra functions. In the transfer wei function I want to send it to the special method or if receiver doesn't have it (because is a wallet or doesn't inherit from my abstract or interface), via normal transfer. How can I check if addressTo inherits from my special interface or abstract contract that contain my payable function?


texts: TypeError: Type literal_string "WALLET_ADDRESS" is not implicitly convertible to expected type address

texts:
Anyone know what this error means in Remix - Solidity IDE?

address public constant WALLET = "A_WALLET_ADDRESS";

TypeError: Type literal_string "A_WALLET_ADDRESS"
is not implicitly convertible to expected type address.


texts:
I have a contract for saving some data with a time stamp. Saving data needs to have later time stamp than the last saved data. User will send the data to blockchain in correct order, lets say like this:

for (var data in dataSet){
 var timestamp = DateTime.Now;
 sendDataToBlockchain(data, timestamp);
}

This makes lots of transaction. Data will be sent from one address. Will the data be proceeded and saved in correct order?


texts:
Where can I find the maximum and minimum values that various types can store? And an epsilon value for floats?

I'm looking for something like C's limits.h, but for Solidity / EVM.


texts: Mining in geth 1.5.9 doens't work ubuntu 14.0

texts:
When I execute miner.start(1) in the geth console I get

I0503 10:43:45.019183 miner/worker.go:517] commit new work on block 29 with 0 txs & 0 uncles. Took 323.985µs and still stopped there without mining.

The difficulty isn't too high of the padding block (132480).
I am using  geth 1.5.9 on ubuntu 14.04. Can anyone help me please


texts:
I want to see the logs of the JSON-RPC calls to geth (with all the details if possible). How can I do that? In this page, I have found a command line option:

  --vmodule value           Per-module verbosity: comma-separated list of = (e.g. eth/*=6,p2p=5)

However I don't know how it should like to achieve what I want.


texts: Is there are a ERC-1155 wrapper of ERC-20?

texts:
I want a ERC-1155 contract that allows anyone to "wrap" any ERC-20 token.
Well, that's impossible, because when a ERC-20 token would be added, need to emit events for all its balances, but accounts with balances cannot be en enumerated. Also we can't emit events when the underlying token transfers.
So, I want an "almost ERC-1155" contract that would be ERC-1155 except that for a newly added ERC-20 token the created "1155" token would not emit or not always emit "Transfer" events.
Does such a contract already exist?


texts: Web3j test accounts and Credentials object

texts:
I launch the ethereum blockchain by running testrpc. That is creating 10 test accounts with sufficient funds.
When I use web3 with node.js to to deploy a new smart contract, I can use:

MyContract.new(['MyProps'],{data: byteCode, from: web3.eth.accounts[0], gas: 4800000})

When I use web3 with Java, I need a Credentials object. The following line seems not to work, because the deployment returns that the account has not sufficient funds.

String account = web3.ethAccounts().send().getAccounts().get(0);
Credentials c = Credentials.create(account);
Contract_sol_Contract contract = Contract_sol_Contract.deploy(web3, c, new BigInteger("240000"),new BigInteger("2400000"), props).send();

-->sender doesn't have enough funds to send tx. The upfront cost is: 576 and the sender's account only has: 0

Obviously, the Credentials object is not correct. As far as I understand, the private key must be passed and I used the public address.

How can I access the private address in Java web3j?
Why is it sufficient in web3 (node.js) to use the public address for the deployment of the contract?

Thanks in advance,
Marco


texts: Get private key of smart contract through remix

texts: When I deploy a contract on to an eth network through remix, is there a way I can export that contract's private key out of remix?


texts: Any vulnerabilities found in the EVM or Ethereum Protocol?

texts:
I've read of several vulnerabilties w.r.t. blockchain technology, e.g., Bitcoin, that allowed hackers to steal currency tokens.

From my understanding all these "hacks" have resulted from either spoofing or websites being compromised.

Have there been found any vulnerabilities deep within the EVM or the Ethereum Protocol that allowed hackers to take over accounts and resulted in hotfixes?


texts: Can't access MetaMask accounts via Dapp UI

texts:
I'm trying to initiate a transaction onClick of a button on my UI, however on load web3.eth.accounts is returning emtpy, is this because Im running locally? does MetaMask not work locally?

Yet when I run 'web3.eth.accounts' in the console, it returns addresses relevant to MetaMask


texts: How to Save solidity remix.ethereum file in local disk with sol extension|How to upload/direct load on github after save on local disk?

texts:
Below is my solidity code on remix.ethereum and also created token in ethereum blockchain and now i wants to save my file in my local disk and after save wants to upload on github with verified comment. please help how i can do this ?
http://remix.ethereum.org/#optimize=true&version=soljson-v0.4.25+commit.59dbf8f1.js


texts: How do redistribution rewards work on deflationary coins?

texts:
Regarding "redistribution rewards", I'm referring to the token reward mechanics of deflationary coins such as Safemoon. This mechanism seems to have originated from an ERC-20 token called RFI (reflect.finance), so I will be referencing this token from now.
On reflect.finance's site, they claim:

RFI works by applying a 1% fee to each transaction and instantly splitting that fee among all holders of the token.

My first thought was, do they make a send to every address per transaction made? Obviously not, that'd be way too expensive of an operation to perform on a scale like that.
After further research, I found an interesting snippet on one of their blog posts:
https://reflectnetwork.org/posts/what-is-reflect-finance-rfi-duplicate-1

...Due to the token reward mechanics and the transactionless nature...

They described this mechanism as "transactionless", so that caused me to be even more intrigued. Despite having minimal knowledge on how smart contracts work, I decided to take a look at their smart contract code on github, which is located here:
https://github.com/reflectfinance/reflect-contracts/blob/main/contracts/REFLECT.sol
Due to my lack of knowledge in this domain, I managed to read through that file a dozen times and still have no idea how that feature actually works. I noticed some function names that mention "Reflection" and I assume that is how they refer to the redistribution mechanics, but that's about as far as I can get in understanding this.
Can anyone explain to me in layman's terms how this feature works?


texts: How to transfer ERC20 tokens from a multisig wallet?

texts:
How can I transfer ERC20 tokens from a multisig wallet?

According to this question, it is possible to send a token from a multisig by setting the to parameter as the token contract's address and setting the data parameter to make it execute a transfer function to the final address.

However, writing the data field by hand seems too cumbersome and error prone. Is there an easier way to accomplish this? For example, with MyEtherWallet or other online services.


texts: is smart contract excution in every node give the same result?

texts:
In Ethereum as I know that every full node executes the transaction of the contract, hence if there is a code as follows:

f() {
   string x;
   if(time()<12)
       x=AM
   else
      x=PM
}

So if a transaction arrived to a node before 12 and to another node after 12 does that mean that the valuse of x is diffrent depending on the node.


texts: What do you need to enter in  of geth attach

texts:
What do you need to enter in <IPC_LOCATION> of geth attach
thank you


texts: Is it possible to find out dynamic array size looking at a smart contract?

texts:
This question already answers that in order to get the size of an array programmaticaly, a getter should be defined.

However, assuming that there isn't a getter, is there a way to find out size of a dynamic array in any other way? For example looking at the bytecode.


texts: Can I recover ETH sent to a know address?

texts: On my Metamask Wallet I sent inadvertely my ETH to another address. Can I get it back?