texts: How do you create a new contract instance with an address *and* arguments?

texts:
There is the standard way of creating contract instances with the new keyword where you pass arguments like:

MyContract mine = new MyContract(arg1, arg2);

Then there is another way, like in this example where create a contract instance at a given address, without the new keyword, but without arguments, like this:

MyContract mine = MyContract(address);

How do I create a contract instance at a given address (like the second example), and with the arguments I want (like the first example)?

I'm new to this, sorry if I'm misunderstanding something here.
`


texts:
I need to allow the function caller to only execute the function once for each request ID. So I have IDs and for each ID , the caller can only execute the function once. I need help in a way that is cost efficient to implement this in Ethereum. I am writing a smart contract using Solidity. Any ideas?
mapping(address=>bool) RegisteredOracles;
mapping(uint=>uint)ID_Timesatmp;//to store every request ID and its timestamp

 function ReturnContactTracingList(uint ID, uint timestamp) public{
    require(RegisteredOracles[msg.sender]);  //To be executed by registered oracles only

    require (ID_Timesatmp[ID] == timestamp);//using the ID sent by the oracle to verify the timestamp sent also by the oracle

}


texts: How to use static-nodes.json / trusted-nodes.json to prevent connection loss on private network?

texts:
I have 2 nodes running on private network under the same network id connecting through

sudo geth --identity "testpython manage.py runserver  0.0.0.0:8001" --networkid 1100 --mine --nodiscover --rpc --rpcport 8544 --rpccorsdomain "*" --rpcapi "eth,web3" --port 30304 --ipcpath ~/.ethereum/geth.ipc --genesis /home/user/genesis.json --datadir /home/user/genesis console privatenet 2>/home/user/genesis/log_output5

In one node and in other with different ports. It has same genesis.json and connected to the same network.
When i connect via,

  admin.addPeer(nodeUrl)

It will show the connection in admin.peers and in few seconds it will go off in both the nodes. it keep connecting and disconnecting between the nodes. and in admin.peers remoteAddress port is coming as 59823 though I have given 30305 port.

localAddress: "192.168.15.69:30304",
remoteAddress: "192.168.15.71:59823"

I felt this is causing me not to do node to node ether transaction. once node to node transaction has happened. after that i couldnot.

I read in other links that static-nodes.json / trusted-nodes.json may help in having stable connection. please help me

How to have stable connection
If we use static-nodes.json / trusted-nodes.json , how to use and which one to use. syntax please
How to do transactions in one node and mining from another node?

Losing connection between nodes on private network


texts: Getting name/decemals of unstandardized token on Ethereum blockchain with web3.js

texts:
I understand how to call methods of name/symbol or decemals on ERC-20 tokens but what about tokens that do not have such.. for example this token here https://etherscan.io/token/0xE0B7927c4aF23765Cb51314A0E0521A9645F0E2A#readContract
All I see is totalSupply,balanceOf, owner,locked etc, but no symbol or any informative data..
Is it possible at all ? Thanks


texts: Ethereum Error: Provider does not support subscriptions: HDWalletProvider

texts:
I am making a flash loan request using web3 , truffle and keep getting the error in an event listener:
The current provider doesn't support subscriptions: HDWalletProvider.
I am connecting to the ropsten test network.
I am using the code below to connect to get emitted events in a smart contract:
const web3 = new Web3();
const eventProvider = new Web3.providers.WebsocketProvider(wss);

eventProvider.on('error', e => {
    console.error('WS Infura Error', e);
});

eventProvider.on('connect', function () {
        console.log('WSS Connected');
            setupListeners();
    });

eventProvider.on('end', e => {
    console.log('WS closed');
    console.log('Attempting to reconnect...');

       eventProvider = new Web3.providers.WebsocketProvider(wss);

eventProvider.on('connect', function () {
        console.log('WSS Reconnected');
            setupListeners();
    });
    web3.setProvider(eventProvider);
});
 web3.setProvider(eventProvider);

The request is:
 contract1.methods.flashloan( args_of_my_use_case ).send({
              from: addr, //designated Metamask wallet address
              gas: gasCost,
              value: 0,
              nonce: accountNonce,
            },
            function (error, data) {
               if(error){
                 invariant.currentlyTrading = false;
                 obj.nowTrading = false;
               }
               console.log('arb data => ', data, '   arb error => ' ,error, appendText);
            });

The connection works and events get fired but one of the responses from a flash loan request is:
Error: The current provider doesn't support subscriptions: HDWalletProvider
My truffle config is:
const dotenv = require('dotenv');
const fs = require('fs');

const envConfig = dotenv.config({silent: true});

 const HDWalletProvider = require('@truffle/hdwallet-provider');
 const infuraKey = process.env.INFURA_API_KEY;

const ethPubAddr = process.env.ETH_PUBLIC_ADDRESS;
 const mnemonic = process.env.METAMASK_PVT_KEY;

 console.log("mnemonic -->" , mnemonic);

module.exports = {

  networks: {
    // Useful for testing. The `development` name is special - truffle uses it by default
    // if it's defined here and no other network is specified at the command line.
    // You should run a client (like ganache-cli, geth or parity) in a separate terminal
    // tab if you use this network and you must also set the `host`, `port` and `network_id`
    // options below to some value.
    //
    mainnet: {
      provider: function() {
        return new HDWalletProvider(mnemonic, "https://mainnet.infura.io/v3/"+infuraKey);
      },
      network_id: 1,
      from: ethPubAddr

    },
    ropsten: {
      provider: function() {
         return new HDWalletProvider(mnemonic, "wss://ropsten.infura.io/ws/v3/"+infuraKey);
      },
      network_id: 3,
      from: ethPubAddr,
      gas: 6800000, // Current Ropsten gas limit. See https://ropsten.etherscan.io/block/3141628
      gasPrice: 20000000000 // 1.1 GWei - based on the lower end of current txs getting into blocks currently on Ropsten.
   //   gasLimit: 8000000

    },

    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
    },

  },

  // Set default mocha options here, use special reporters etc.
  mocha: {
    // timeout: 100000
  },

  // Configure your compilers
  compilers: {
    solc: {
       version: '0.6.10',    // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
     settings: {          // See the solidity docs for advice about optimization and evmVersion
       /* optimizer: {
          enabled: true,
          runs: 2
        }*/
      //  evmVersion: "byzantium"
       }
    }

  }
}


texts: Any examples of ERC tokens that pay out recurring dividends?

texts: This post discusses the legal side of issuing digital shares of one's company, but once we get past that mental hurdle and assume the real world is now crypto-friendly, can someone provide a working example of a company or organization that actually issues their own ERC token that merely functions as a smart contract for paying out a regular periodic dividend (recurring transaction) to holders of the said organization's token from that organization's ethereum "treasury wallet"?


texts:
pragma solidity ^0.5.2;

contract Bill {

    string filehash;
    string locker;
    address userwallet;
    uint256 amount;

    event isDeposit(
       string filehash,
       string locker,
       address userwallet,
       uint256 amount
    );

    function Deposit(string memory _filehash, string memory _locker) public payable{
        filehash = _filehash;
        locker = _locker;
        amount = msg.value;
        userwallet = msg.sender;
        emit isDeposit(filehash, locker, userwallet, amount);
   }

}

Why I see warning?

Gas requirement of function Bill.Deposit(string,string) high: infinite.


texts: string and Error: new BigNumber() not a number

texts:
I am trying to generate a hash of a file and send it to a contract. But I am getting an error

  Error: new BigNumber() not a number: a8fac6cf98e6f5e9a76ae1f8064e505b(…)

Here's my contract code:

function sendHash(address student_id, string hash_value) returns(bool sufficient)
{
    student_hashes[student_id] = hash_value;
    return true;
}

Here's my javascript code

function sendHash() {
  getAddresses();
  var meta = MetaCoin.deployed();

  var address = document.getElementById("studentId").value;
  var hash = (document.getElementById("hash").value);
  setStatus("Initiating transaction... (please wait)");

  meta.sendHash(account, hash).then(function() {
    setStatus("Transaction complete!");
  }).catch(function(e) {
    console.log(e);
    setStatus("Error sending contract; see log.");
  });

I am using datatype 'string' in the contract, but the error says not a number. Have tried different ways, but unable to fix this. Any help would be highly appreciated!


texts: Send Transaction failed : invalid address

texts:
Trying to execute a transaction on Remix IDE which is connected to the Ethereum blockchain via Metamask.io Google Chrome extension.

Send transaction failed: invalid address . if you use an injected provider, please check it is properly unlocked.


texts: How to create account by web3 0.20 version?

texts: I try to create new account by using web3, i found that I can only do this in 1.0 of web3 but not in 0.20 version? it does not support personal.newAccount


texts: How does actual gas unit use differ for the similar transaction?

texts:
I transferred ETH 3 times to a smart contract which needs 48734 actual gas units to execute.

It took 68932 units for 1st tx and 48734 for remaining 2. Why it took more gas for the first tx than latter 2?

Link to 2nd and 3rd tx.


texts: Solidity: reserved words as variables, labels, or function names

texts:
In JavaScript you cannot use the reserved words as variables, labels, or function names. Does Solidity have the same restrictions?

I'm wondering about the following example from the Solidity documentation:

pragma solidity ^0.4.0;

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);
    }
}

But from is a reserved word, used in ImportDirective:

ImportDirective = 'import' StringLiteral ('as' Identifier)? ';'
        | 'import' ('*' | Identifier) ('as' Identifier)? 'from' StringLiteral ';'
        | 'import' '{' Identifier ('as' Identifier)? ( ',' Identifier ('as' Identifier)? )* '}' 'from' StringLiteral ';'


texts:
I found this in GUSD Smart Contract.

The ERC20ImplUpgradeable means that the contract can always be changed. And our coin can be stolen whenever they wish without any trace.

If this is allowed by the community, then I will be implementing all my contracts following this same method.

It totally defeat the purposes of having a Smart Contract.


texts:
2 TCs are failing on Big endian system, seems the issue is with the byte ordering only.

1) ethereum/go-ethereum/core/bloombits

2) ethereum/go-ethereum/swarm/storage/feed

Can some one please comment about the significance of these TCs, any critical functionality would be affected if these are neglected?


texts:
I have created a contract based on a standard one to mint and I have code as follows -

  modifier canMint() {
    require(!mintingFinished);
    _;
  }

  /**
   * Function to mint tokens
   * @param _to The address that will recieve the minted tokens.
   * @param _amount The amount of tokens to mint.
   * @return A boolean that indicates if the operation was successful.
   */
  function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
    totalSupply = totalSupply.add(_amount);
    balances[_to] = balances[_to].add(_amount);
    Mint(_to, _amount);
    return true;
  }

  /**
   * Function to stop minting new tokens.
   * @return True if the operation was successful.
   */
  function finishMinting() onlyOwner returns (bool) {
    mintingFinished = true;
    MintFinished();
    return true;
  }

I understand intuitively what onlyOwner means but how is this actually enforced in practice to prevent anyone just minting coins?

I intend to deploy via myetherwallet. So I would have whatever credentials and available via that system.

Once I deployed via myetherwallet, then I need to somehow run the contract. Usually in test I use geth but for the full ethereum system I cannot do that.

So how would I actually run the finishMinting etc? Is there a command line option for production Ethereum, or do I need a Web3 interface in React or something like that, and then how would I confirm I am the onlyowner?


texts: Error: VM Exception while processing transaction: revert at PromiEvent When calling variable function from the deployed contract variable

texts:
I am new to blockchain and development and learning from the dapp university tutorial.
I have created a contract Todolist.sol

  pragma solidity ^0.5.0;

    contract TodoList{
        uint public taskCount = 0;
    }

and have deployed it using

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

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

Then in truffle compiler, i ran the codes as follows which were working

todoList = await Todolist.deployed()
todoList.address

but, This gave me an error

todoList.taskcount()

as  Error: Returned error: VM Exception while processing transaction: revert    at PromiEvent


texts: How to check the bootnodes configured in my node

texts: Sorry if it's a very basic question, but I can't find it. I'm configuring a regular node in a private quorum network using geth. The node is not synchronizing and I'd like to check the bootnodes configured in the node. How can I get them?


texts:
I want to call another contract from my vyper contract.
I have read several tutorials and documentations and there is 2 ways to do that:
First method:
interface MyExternalContract:
   def public_function1_of_my_external_contract(arg1: int128, arg2: int128)
   def public_function2_of_my_external_contract(arg1: int128, arg2: int128)
   ...

@external
def fonction_of_my_contract():
  MyExternalContract(address). public_function1_of_my_external_contract(1,2)

Second method:
contract MyExternalContract:
   def public_function1_of_my_external_contract(arg1: int128, arg2: int128)
   def public_function2_of_my_external_contract(arg1: int128, arg2: int128)
   ...

@external
def fonction_of_my_contract():
  MyExternalContract(address). public_function1_of_my_external_contract(1,2)

As you can see, the "interface" has been replaced by "contract".
What is the difference between those 2 methods ?
Thanks


texts: Ethereum private-net - creating contract can't mine

texts: I'm trying to get started on ethereum private-net. I'm using MIST and trying to do a basic "Hello World" contract on windows. I setup geth and got off setting a private-net and checked it's mining okay. When I add a contract through MIST, it shows processing and nothing happens.


texts:
I think web3 is not completely decentralized or safe to use.

Consider the following example:

I have made a voting Dapp on Ethereum.

Now my smart contract will be on the Ethereum blockchain and my variable and functional calculation will be evaluated on EVM.
But still I need to host my website (HTML/JavaScript code) using a web hosting service like Heroku (which will then communicate with the Ethereum blockchain to provide information).
It is true that a hacker won't be able to edit data (because it is on Ethereum), but he/she can still hack web hosting service (Heroku), right?

And if it is hacked my Dapp won't be available to people.
Then why is Ethereum considered as safe to use?

Please someone correct me if I am wrong, or suggest an alternative solution that even website service cannot be hacked.


texts: Peers attempting to connect to ports on my machine other than those used by geth

texts:
I have a geth node running on a linux machine, and have set up a firewall (UFW) to allow all outgoing connections, but inbound connections to 30303/udp and 30303/tcp only.
I'm noticing in my system logs that the firewall is blocking a lot of attempts to connect to other ports on my machine. For example:
Jul  8 17:48:23 ethnode-e703e05c4 kernel: [20420.869862] [UFW BLOCK] IN=eth0 OUT= MAC=dc:a6:32:8f:2e:85:2c:79:d7:05:f9:98:08:00 SRC=172.112.48.155 DST=192.168.2.47 LEN=40 TOS=0x00 PREC=0x00 TTL=47 ID=0 DF PROTO=TCP SPT=30303 DPT=47962 WINDOW=0 RES=0x00 RST URGP=0

If I'm understanding correctly, this connection attempt originates from port 30303 on the peer (a port used by geth), but is targeting port 47962 on my machine, a port which to my knowledge is not used by geth.
What's happening here? Is this a malicious actor looking for open ports? Or maybe a sign that there are other ports that I need to open on my firewall?
Any insight much appreciated.
Edit: This may be an answer to my own question: The fact that I am allowing outbound connections on any port means that geth will use any port it likes to attempt to establish a connection with other nodes. Then when the other nodes attempt to reply on that port, the firewall blocks it due to my inbound rule. Perhaps someone with a better understanding can confirm or refute that.


texts: web3.js import contract abi from .json file

texts:
So I have a deployed contract with address0. I can easily interact with it using my index.html like so:

import contract_artifacts from '../../build/contracts/contract.json'
var contract0 = contract(contract_artifacts);

Then I can call it's functions like so:

contract0.deployed().then(function(something){});

But I also have another previously deployed contract with address1. The contract is the same as the contract with the address0.
I see only one way to work with the contract1:

var abiarray = [ here goes pretty big abi ];
contract1 = web3.eth.contract(abiarray).at(address1);

Is there another way to do it without including the whole abi of the contract? Because I already have it in contract_artifacts, I just don't know how to get it from there. Thank you.


texts: Calling a uint or address as a function in solidity

texts:
I am pretty new at both ehtereum and Solidity, so my question might be trivial. But I was not able to find an answer Googling for it. I am looking at the contract code for Bittrex deposit. I found this function

function tokenFallback(address _from, uint _value, bytes _data) {
    (_from);
    (_value);
    (_data);
 }

It looks like it just calls the parameters as functions. Can anyone tell me what is going on?

Also, is there a list somewhere with all the standard stuff you have when coding Solidity. I can find the data types and such, but I didn't know the fallback function was a thing. Are there other standard functions like the fallback function?

Thanks


texts: How would one begin to create an Ethereum mining pool?


texts: jsonrpc eth_accounts returns no accounts

texts:
I have a running geth node and by using geth account new command I created a new account:

$ geth account list

  Account #0: {47978a69f410d0f...} ...

Nevertheless, when using json rpc call to list my ether accounts a null result is obtained:

$ curl -X POST --data

  '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'
  http://127.0.0.1:8545

  {"jsonrpc":"2.0","id":1,"result":[]}

Why is that? Any hint? Thanks in advance!

I launched geth with the following command:

$geth --rpc --rpcapi "db,eth,net,web3" --rpcport "8545" --testnet
--etherbase "0x47978a6...."

Is it possible that geth working on testnet gets confused on json rpc calls? Do I need to specify somehow in these calls to use testnet and not mainnet?


texts: RangeError: Maximum call stack size exceeded or Contract code size over limit, yet this is just a copy of a contract already deployed

texts:
I am trying to create a DeFi app that works with PAXG gold token. But in order to do this, I need to first be able to deploy a copy of PAXG on my local testnet (Ganache).
I have forked the github and downloaded the code to my desktop. However, PAXGImplementation is causing a "RangeError: Maximum call stack size exceeded" message when Truffle tries to compile it and  "Contract code size over limit" message when Remix tries to deploy it.
From what I understand, these errors are telling me that there is an infinite loop somewhere in the code. But this same code is deployed to Ethereum and running on the mainnet right now.
I've also checked the code to make sure its verified, and the verified version can be found here. It's identical to the github version in contracts/flattened/PAXGImplementation.sol. Also, I am using the flattened version of the contracts when I try to deploy. I've removed the "zeppelin" folder and moved the contracts from the "flattened" subfolder into the "contracts" folder, then deleted the "flattened" folder. This was to make sure that the error wasn't caused by a bug in Truffle that causes deployment to fail when contracts import each other.
So basically, Remix and Truffle are both telling me that there is an infinite loop in the PAXGImplementation code - and yet, this code has been deployed to Ethereum. It's obviously not possible for both of these things to be true. So I must be misunderstanding something.
Does anyone know what might be going on here and how I can fix it?


texts: What is the difference between ICAP and HEX addresses?

texts:
I've read what Kraken have mentioned in the difference guide but I haven't understood it well.

I plan to mine ethereum. What fits better for me?


texts:
I am trying to create an application using ethereum ,where node.js has used to call methods of smart contract and angular as frontend . I want to use the metamask wallet so my apication can automatically detect it and wallet holder can use the functionality of the platform by using multiple methods of smart contract.

But, I suppose it needs the injected web3 provided by metamask . How i can sent that injected web3 to the node layer, so it can use web3 functionality.

Any support is admirable .


texts: Infura: "project ID request rate exceeded" despite minimal requests

texts: Looks like I'm being rate limited by Infura, despite making nowhere near the 100,000 request/day limit under Infura's Core plan. truffle migrate and truffle test both produce VM Exception while processing transaction: Error: Returned error: Returned error: project ID request rate exceeded. I even created a new Infura project and used that new project ID, but received the very same message. So, is it my fault? All I'm doing is ganache-cli --fork https://kovan.infura.io/v3/[api_key]@latest -u [address] followed by truffle test. What's the remedy?


texts: Missing seed for metamask -- how can I transfer tokens?

texts: I have lost my seed for metamask wallet. I'm very new to crypto. I have ERC tokens in my wallet, address and password are saved, and the hash generated during transfer is saved. Can I transfer my ERC token from Wallet? It is not open. The problem started during my laptop formatting  andI lost my seed .pl file. Please help me transfer the tokens.


texts: SendSignedTransaction web3 v1.0 method call stack underflow

texts:
When calling sendSignedTransaction I got:

VM Exception while processing transaction: stack underflow

Used code is below, using TESTRPC:

const serializeTx = async (contractInstance, publicKey, privateKey, funcData) => {
    let privateKeyBuff = new Buffer(privateKey, 'hex');

    const gasLimit = 500000;

    const nonceNumber = await web3.eth.getTransactionCount(publicKey);
    const nonce = web3.utils.toHex(nonceNumber);
    const gasPrice = web3.utils.toHex(web3.eth.gasPrice);
    const gasLimitHex = web3.utils.toHex(gasLimit);
    const rawTx = {
        'nonce': nonce,
        'gasPrice': gasPrice,
        'gasLimit': gasLimitHex,
        'from': publicKey,
        'to': contractInstance.address,
        'data': funcData
    };

    let tx = new EthereumTx(rawTx);
    tx.sign(privateKeyBuff);

    return '0x' + tx.serialize().toString('hex');
};

    let funcData = MyContract.methods.reserve(param).encodeABI();

        const serializedTx = await serializeTx(
            MyContract,
            body.callerPublicKey,
            body.callerPrivateKey,
            funcData,
        );

        let result = await web3.eth.sendSignedTransaction(serializedTx);

Same contract function is working nice in Remix, also working nice when called using truffle-contract. Now when I try to sign the transaction data it throws
Error: Returned error: VM Exception while processing transaction: stack underflow

EDIT:
The problem was using contractInstance.address it should be contractInstance._address


texts:
I am new to all this.  So far I got the dev tools, kicked off my own test network on the laptop, mined a bunch of ethers, written a contract and deployed it to my network -- all works, awesome.
What I cant get a clear picture of is the transfer of physical assets via this trustless network.  I understand when ethers are being deposited into my contract -- its an electronic thing, it works. What I dont understand is how the delivery of physical goods gets back to the buyer.  For the sake of argument, I want to sell my car, or bonds in my portfolio. If I describe this stuff in the contract in great detail and ask ethers for it, what I am putting up is a promise to sell that stuff --- the actual physical car is still in my garage.  So how is this supposed to work?  Please point me in the right direction.  Thank you


texts: Replacing a requirement for TRC10 token with TRC20 on a TRX contract

texts:
I have a contract that allows users to buy a token and pay with a TRC10 token deployed on Tron. Is it possible to replace the token ID with a TRC20 address instead? And if so, how do I implement it? Thanks.

 function buy(address _referredBy) public payable returns (uint256) {
    require(msg.tokenid==1234567);//this is the tokenid I want to replace.
    purchaseTokens(msg.tokenvalue, _referredBy);
}


texts:
Hello I would like to create an ERC777 token which cannot be divided.

I understand that, because decimals() have to remain 18, I have to override the granularity() to 10^18.

What I don't understand is, that the ERC777 implementation does never check if I send multiples of the granularity().

  granularity():

  Returns the smallest part of the token that is not divisible. This
  means all token operations (creation, movement and destruction) must
  have amounts that are a multiple of this number.

To my understanding I have to mint 10^18 token to get one and to send 1 token I have to send 10^18.
But the ERC777 contract does not check if I send less than the granularity.

I think I'm getting something wrong here.


texts: iexec: is tokens on ropsten network cost some real money

texts:
I am studying iexec for writing smart contract. I follow tutorial at this link. In this tutorial, at the last part, they say:

  Be nice and give back your RLC and ETH to the faucet by sweeping your
  wallet:

  iexec wallet sweep

This makes me feel confusing. Because as I know, iexec uses ropsten network and ropsten network only a testing network. So tokens are generated free for testing. So why in this turorial, they say:

  Be nice and give back your RLC and ETH

Thanks


texts: Payment channel with specific gas Tx payee

texts:
Scenario of a payment channel between two Ethereum accounts:

Is it possible to have one of the two accounts and alway the same, specifically pay for Gas Transaction fee?
if it is, please elaborate on the solution, thanks for reading along!


texts:
I've a contract under test and the method I'm checking is supposed to transfer an amount, and in order to check I need to have the cost of the transaction.
I'm using this code:

var tx = await instance.withdraw(web3.toWei(25,"finney"));
  console.log(tx);
  let ownerBalanceAfter = await web3.eth.getBalance(accounts[0]);
assert.equal(ownerBalanceAfter-ownerBalance,web3.toWei(25,"finney")-web3.eth.gasPrice.mul(tx.receipt.gasUsed)); //withdraw done

The test fails with some unexpected small difference, even if I apparently try to compute the gas cost.
Internally the method call transfer(address), that I know it consumes other gas, but shouldn't this be counted in the tx.receipt.gasUsed?
So what is wrong in my balance computation?


texts: I need a smart wallet contract (for testing)

texts:
The testing specification for my current task requires Create 50 smart wallets that can hold M+ tokens.
Thus I need a smart wallet contract. Please give me source of a simple smart wallet contract. It needs to support at least ERC-20 tokens receiving and sending (preferably also ERC-1155 tokens).


texts: Using metamask, I have seed phrase but unable to recover my old account

texts: I have been using metamask and for some reason there is a problem and my app stopped working so it gave me the only option to reinstall it, so i did it. I have my seed phrase but i didnot have my private key for the wallets. As I installed the application again and restored it with seed phrase my account address is completely change and i am unable to recover it. I just lost access to my funds and coins. Kindly suggest me how to deal with this problem? I am sure that i put the exact seed phrase but i didnot have private key. Is there any other way?


texts: I understood that solidity can only generate pseudo-random numbers. Although, is there any way of generating a, let's say 10 character, random string?


texts: Transaction reverts because of this line. Why?

texts:
Inside my contract Lipsum, I have a function doStuff(uint foo_) which has the following line:
result = (a * (foo_ / 100) / b);

result, a and b are all uint.
If I call the function, it errors out in the mentioned line and returns the following:
transact to Lipsum.doStuff errored: VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.

This function does not deal with payments, it should not be payable, I'm not sending ETH values to it. I don't understand the reasoning behind this error. What am I doing wrong?
I'm using solidity 0.8.1 and Remix.


texts: Veramo example including Issuer and Verifier

texts:
I need an example of Veramo that includes "issuer" and "verifier" code.
(Veramo is the new version of uPort: a self-sovereign identity and user-centric data platform on Ethereum).
Thank you.


texts: Embark + IPFS storage error: Cannot find module 'fs'

texts:
I am using the Embark framework demo code and trying to include IPFS storage (not deployment) functionalities to the project. I get an error message when I try to execute the following code in the browser

ipfs.catText("QmZYZyvJeW3eXEiRPS61hvyWSwuHWuSdQRjxmvsD2XqBom",
       function(err, res) {
           if(err || !res) return console.error(err)
           console.log(res);
    })

I have included ipfs-js from a local folder with <script src="js/ipfs.js"></script>

The error is shown in browser console Error: Cannot find module 'fs'


texts: Remix Solidity Compiler does not work after the update on my browser

texts:
http://remix.ethereum.org Remix Solidity Compiler does not work, solidity compiler does not show up.  I guess there is heavy load on the web-page of remix so browser could not handle it and freezes.

It was working yesterday but it does not today. Does anyone face with the similar issue?

=> What is the recommended browser and its version to open remix?

Thank you for your valuable time and help.


texts:
I have a contract that uses Oraclize to query some bits of data. Basically, I have the following three functions:

getData() - calls Oraclize contract to query data,
__callback() - called automatically by Oraclize, when data received.
setData() - function to get the queried value and do smth.

contract functionChain is usingOraclize {

string public globalKey;

function getData() public payable {
    string memory query = 'json(http://QUERY_LINK)'; //returns string
    oraclize_query(0, "URL", query, 250000);
}

function setData(string text) internal {
    text = globalKey;
}

function __callback(bytes32 myId, string result) {
    if (msg.sender != oraclize_cbAddress()) revert();

    setData(result);
}
}

The logic I have now is the following:
1. getData() is called
2. __callback() { setData() } - setData() is called by the __callback() function.

The problem is, that even though I can successfully query the data via Oraclize, setData() function is never being called. I am getting the logs of success only for the getData() function.

Is this even a legit way to use Oraclize query result in a third function? If not, what would be the best way of linking those functions together, so that SetData() is called after the __callback()?


texts: What information can be publicly read from a signature?

texts: Without knowing anything else than the signature itself, what information if any can be publicly read from the signature?


texts: What are the valuable benefits of having a node?

texts:
Supposedly I'd like to help Ethereum to expand (in terms of the World Computer), so I'd like to setup a Linux machine which can run smart contracts.

What kind of benefits I can get from doing that?
Do I earn anything particular?
If so, what I can get and would it increase over time?


texts: Proper way to give parameters with a contract call?

texts:
I am trying to do a contract call with some parameters. I do this with a NodeJS Express API.

The code looks as following:

var array = JSON.parse(req.body.arguments);
                getContractFromABIAndAddress(req.body.abi, req.body.contractAddress, function(contract) {
                    contract.methods[req.body.method](array).send({from: config.publickey}).on('receipt', function(receipt) {
                        res.json({
                            txHash: receipt.transactionHash,
                            contractAddress: receipt.contractAddress,
                            txURL: config.etherscantransaction + receipt.transactionHash,
                            contractURL: config.etherscanaddress + receipt.contractAddress
                        })
                    });
                })

The req.body.arguments contains the needed parameters and the req.body.method contains the right method to call on the contract.

I can test the code with postman, the body would look like the following picture.

Now as you can see here: Web3 Contract docs,
I am using the second option. myContract.methods['myMethod(uint256)'](123)

The problem is that I can't send multiple parameters, the contract needs the parameters like this: myContract.methods['myMethod(uint256,uint256)'](2,2) but I am giving them like this myContract.methods['myMethod(uint256,uint256)']([2,2]).

This results in the following:

Which means that the contract call is only getting one parameter according to the error logs and to the web3-eth-contract library. This can be solved by doing the following:

Which turns my parameters back to the right format:

If the Web3 library would get an update now, my NodeJS API wouldn't work anymore because I have been messing with the library. I can't find any other way to give the parameters with the contract call, or with contract send, since the problem also exists over there.

Could someone help me out?


texts:
I had a question re sending transactions. In ICOs now you have to be really quick off the mark sending your contribution and they can be rejected if you send before they start.

If we take for example one that starts at 1300. If I hit generate transaction at 1259 and then send transaction at 1301 will that be accepted or rejected? ie will they take 1259 as my time and thus reject it or will it be considered as 1301.

I'm just asking so I can get my payment organised asap and ready to send,

Thanks,

Chris


texts: How would you generate this transaction hash?

texts:
let contract = await instance.mint(
          accounts,
          usersInput.url,
          usersInput.metadata[0],
          usersInput.metadata[1],
          usersInput.metadata[2],

          { from: accounts, gas: 350000 }
        );
        return contract;

If the user has low gas price, then the transaction will error with a message "TxHASH has timed out after 280 seconds"

Using truffle with has the latest web3 I assume.

How would I generate the transaction hash, or return the transaction hash and also send the transaction, so I can store the txHash and then scan for that receipt info when it takes longer than 280 seconds to confirm?

How do I return a tx hash in the code above, without waiting for actually being picked up. I'm confused on the syntax for the input to my function


texts: Can't compile old solidity contracts(version 0.4.17)

texts:
I'm new with blockchain development.
I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2;
These versions were in the package.json file of the project.

When I installed truffle and solidity globally, it installed the latest version for them. And the project was also using these latest versions(check with "truffle version" command). But when I changed old pragma versions to the latest, the project had a lot of errors and warnings(too many to handle manually). So I decided to downgrade truffle and solc to be able to compile the project.

The project finally compiled and some of the tests passed successfully. But when I tried running "npm run coverage" it couldn't find these files from one of the contract:

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

Then I found Assert.sol file in truffle repo on github and referenced it from node_modules. but new error is this:

Error: Could not find truffle/AssertString.sol from any sources; imported from truffle/Assert.sol
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:59552:23
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155895:16
    at next (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:167654:18)
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:59540:7
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:190397:5
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:167559:16
    at replenish (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155865:25)
    at iterateeCallback (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155855:17)
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155895:16
    at ReadFileContext.callback (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:190393:14)
Cleaning up...

This is the package.json:

"scripts": {
    "compile": "truffle compile",
    "build": "truffle build",
    "deploy": "truffle deploy",
    "postinstall": "truffle install",
    "console": "truffle console",
    "testrpc": "testrpc --gasLimit 60000000",
    "testrpc:coverage": "node_modules/.bin/testrpc-sc --port 8555",
    "truffle-test": "truffle test",
    "test": "run-p --aggregate-output --race testrpc truffle-test",
    "solidity-coverage": "node_modules/.bin/solidity-coverage",
    "coverage": "run-p --aggregate-output --race testrpc:coverage solidity-coverage",
    "lint": "node_modules/.bin/solium --dir ./contracts"
  },
  "devDependencies": {
    "concurrently": "^3.5.0",
    "ethereumjs-testrpc": "^6.0.3",
    "npm-run-all": "^4.1.1",
    "solidity-coverage": "^0.2.7",
    "solium": "^0.5.5",
    "truffle": "v4.0.0-beta.2",
    "ethereumjs-util": "^5.1.2"
  },
  "dependencies": {
    "chai": "^4.1.2"
  }

I have three questions:

How can I solve this last error about assert.sol and DeployedAddresses.sol?
Does it worth to downgrade solidity and truffle versions?
because it seems that these last errors won't be the last one I have to deal with, It seems that a lot has changed since 0.4.17 version.
If I will use a new version of truffle and solidity is there any way to avoid basically rewriting all of the contracts?

Any help will be appreciated.


texts:
Is it possible to listen to contract creations on web3?
For example someone deploys a smart contract on the ethereum chain. Is there a method in web3 where I can listen to such an event?


texts:
Does the web3.eth.contract.new error object has a transactionHash?

https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract

I couldn't find anything about how the error object is structured.

Cheers,
Mario


texts:
I am making couple of forwarding transactions (i.e. to contract address that just receives funds and proxifying it to main contract) locally on Ganache CLI running (old testrpc does the same result) and found that some transactions from different senders has the same transaction hash like below:

  // THIS ONE
  Transaction: 0xe0dcb204328627a50b71a05e9c0d258f241ab33ba6cc9d6929b6a4c89c1b70ba
  Gas usage: 207209
  Block Number: 29
  Block Time: Mon May 21 2018 19:16:58 GMT+0700 (+07)

  Transaction: 0x12e8188b4bbd678266e7b92e4c67115bea7452f48f03d30c533caadb3412e2f8
  Gas usage: 177259
  Block Number: 30
  Block Time: Mon May 21 2018 19:17:05 GMT+0700 (+07)

  Transaction: 0x982d265e8199f646493a72c5f08918accc8e90f2e10f4aa1a9b08a67ad0ad5ad
  Gas usage: 162259
  Block Number: 31
  Block Time: Mon May 21 2018 19:17:16 GMT+0700 (+07)

  // AND THIS ONE
  Transaction: 0xe0dcb204328627a50b71a05e9c0d258f241ab33ba6cc9d6929b6a4c89c1b70ba
  Gas usage: 162259
  Block Number: 32
  Block Time: Mon May 21 2018 19:17:26 GMT+0700 (+07)

How it could be?

Transactions are created using ethereumjs-tx and web3.eth.sendSignedTransaction with raw data.


texts: I was working with ethereum wallet which is connected to my private blockchain. I performed a transaction which included transfer of ether from one account to another. Using the hash of this transaction, I called the eth.getTransactionReceipt(<tx hash>) method. It returns a transaction object which has its contractAddress: null. I know there is a single wallet contract Wallet.sol which does not have a transfer method. So how is this transfer done by the wallet application? Ain't there any contract for this purpose?


texts: I have created an ERC20 Token with MEW. However, when I send it to people who have different ERC20 wallets, the logo of my token is always Ethereum like How do I put my own logo on the token so that people see that and not the ethereum logo? I have seen quite a few people who have created ERC20 tokens for fun, having their own logo show on the token and I do not know how they do that!


texts: Is there a readable (less formal) version of Ethereum Yellow Paper?

texts:
The "Yellow Paper" is Ethereum's formal specification.

https://github.com/ethereum/yellowpaper

The problem is that it's difficult to read for people not familiar with formal specifications.

[Q]: is there a readable (less formal) version of it?


texts:
I am trying to find out how to certify data through blockchain technology especially ethereum. I have seen some examples like blockCert which uses bitcoin blockchain but they never say how do they actually do it, they just give the implementation without docs of any kind.

So, I am asking for any knowledge about certifying data with blockchain or at least links or docs to start with.


texts: How to create initial value for my token?

texts: I just deployed my token on the testnet, but when I calculate the value of the token, it returns 'null', how do I ensure that my token has value? Thanks all!


texts:
I am trying to understand how gas refunds work. I made this toy contract that fills in an array and separately does some work (loop a ton of times) and then deletes from the array to save on gas. See at the bottom for this contract. Anyway, if I fill a uint8 array by calling input_array() it costs 353965 gas, whereas with a uint256 array it costs 1057665 gas.

But now if I try to get a gas refund with the uint8 array, it does not appear to work as expected. If I run do_work(false, 1000, 0) (no array deletion) it costs 98135 gas. Once the array is filled, if I run do_work(true, 1000, 5) (delete 5 elements from the array), in the uint8 case, it appears I do not get a gas refund and it costs 132211 gas, where as in the uint256 case it costs significantly less at 65336 gas.

Now I supposed it does make sense you should not get as much of a refund by deleting elements from a uint8 array as a uint256 array, but typically when people talk about gas refunds they say you get 10000 gas net refund from deleting an array element.

pragma solidity ^0.4.0;

contract work_and_array {
    uint8[1000] my_array;

    uint last_index = 0;

    function do_work(bool _delete_array, uint32 num_work, uint32 num_delete) public {
        uint256 x = 0;

        for(uint i=0; i<num_work; i++){
            x = x+1;
        }
        if(_delete_array){
            if(last_index >= num_delete) {
                for(uint j = last_index-num_delete; j<last_index;j++){
                    delete my_array[j];
                }
            }
            last_index = last_index-num_delete;
        }
    }

    function delete_array(uint32 num_delete) external {

    }

    function get_length() external returns(uint256){
        return last_index;
    }

    function input_array() external{

        for(uint i=last_index; i<last_index+50; i++) {
            my_array[i]=1;
        }
        last_index = last_index + 50;
    }

}


texts: unit test with truffle, solidity or mocha?

texts:
Truffle allows either one or the other. Now I wonder which I shall use to test my code. I'm not a big fan of mocha. When I see code like

contract('MetaCoin', function(accounts) {   it("should put 10000 MetaCoin in the first account", function() {
    return MetaCoin.deployed().then(function(instance) {
      return instance.getBalance.call(accounts[0]);
    }).then(function(balance) {
      assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account");
    });

I think that something went really wrong in terms of readability. On the other hand the idea to write a contract to test another contract makes me pretty unconfortable. Which are the caveats of unit testing with these two different approaches?


texts: How the contract storage data saved in blockchain?

texts:
contract {
  mapping (bytes32 => uint256) private balances;

  function setValue(uint256 a) {
    uint index = sha3(msg.sender);
    balances[index] = a;
  }
}

I put a "private" before balances , Can I see the storage data by anylize the blockchain data ?
If i call "setValue()" twice with different param, ex. first time, contractInstance.setValue(param1), the second time, contractInstance.setValue(param2), can i read the "param1" data from blockchain data now ?

https://live.ether.camp/account/Af30D2a7E90d7DC361c8C4585e9BB7D2F6f15bc7
this website can see some contract datas, some ? or everything ?  Thank you!


texts: Ethereum verify transaction using ecrecover returns incorrect address

texts:
** STILL NOT SOLVED **

I'm trying to verify a message, however the ecrecover function is returning the incorrect address: 0x828c50fDeE9160C76EE160C9d8e9D4bc4Cc3D591

function verify(bytes32 message, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
    bytes memory prefix = "\x19Ethereum Signed Message:\n32";
    bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, message));
    address signer = ecrecover(prefixedHash, v, r, s);
    return signer;
}

Message = "test"

Message hash = 0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658

v = 28

r =  0x1e97a4e505996ba54c0003a79281e5c714afe5b93aa867d87a50e6d0c1bb5c81

s = 0x68cf3bbc7afb18e412d68d50c444ba046eea8adc28fa72cda5c12a4199e1b843

Address/Expected result = 0x70b224FF8089D40e4d91331f8284Bb8Ab9877E4B

I am using Ganache-cli.
I have tested in Remix and it works however when I run using ganache and metamask I do not get correct answer.
Not sure what is going wrong???
Many Thanks in advance.

EDIT (front-end)

var payload = "test"
// hash of message
var testData = web3.utils.sha3("test")

// ethereum address
var address = accounts[0]

var signature = web3.eth.sign(testData,address)

signature = signature.slice(2)
console.log(signature)
var r = `0x${signature.slice(0, 64)}`
var s = `0x${signature.slice(64, 128)}`
var v = web3.utils.toDecimal(signature.slice(128, 130))

const response = await contract.methods.verify(testData, v, r, s).call()


texts:
I want to create a contract, which has a deposit function.
But I also want, in the constructor, to start a "thread" that polls an external data source (via oraclize/chainlink or similar) at certain frequency.
Or instead of setting up a loop, should I just call each new block ?
contract SimpleOraclizeContract is usingOraclize {

    function SimpleOraclizeContract() {
      // something like this in java
       new thread().run(new Runnable(){
         while(true){
            sleep(10);
            if(oraclize_getPrice() > 100) {
               doSomething();
            }
         }
     })
    }

    function updatePrice() payable {
        if (oraclize_getPrice("URL") > this.balance) {
            LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
        } else {
            LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
            oraclize_query("URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHXBT).result.XETHXXBT.c.0");
        }
    }

Given the above code how could I call oraclize_getPrice("URL") (which I assume is inherited) every for 10 seconds, or every new block ? Completely outside of a payable function.


texts: How does the EVM ensure perfect determinism and what does that mean?

texts:
I've read What was the reason to invent the EVM? but I feel like it didn't fully answer the question.

So I have a couple of followup questions regarding the EVM:

Why does the EVM ensure perfect determinism (for consensus)? And why is that important? The example made was infinite loop resistance but that is that the only reason for "perfect determinism" (whatever that means).

Why not use a toned down version of an already existing VM like JVM?
(and afaik there are open source alternatives so that you don't need to get a license from Sun)

I don't really understand why the developers had to build a EVM from scratch, that sounds overly complicated.


texts: Can I change state of mapping variable in deployed contract from another contract?

texts:
I am calling addCoin and subCoin function of my AirToken contract and Hotel contract.

This is function defination of addCoin and subCoin in AirToken contract and Hotel contract

function addCoin(address addr, uint256 amount) public
    {
        balances[addr] += amount;
    }

    function subCoin(address addr, uint256 amount) public
    {
        balances[addr] -= amount;
    }

Below lines are my loyalty Contract exchange function where I am calling addCoin and subCoin

(bool success1,bytes memory returnData1)= fromContractAddress.call(abi.encodePacked(bytes20(keccak256("subCoin(address,uint256)")),tokenOwner,exchangeAmount));
        require(success1);
(bool success2,bytes memory returnData2)= toContractAddress.call(abi.encodePacked(bytes20(keccak256("addCoin(address,uint256)")),tokenOwner,exchangeAmount));
        require(success2);

These lines are not giving any error but balances are not updated that should happen if addCoin and subCoin have executed succesfully.


texts: Maintain and even restore privacy when using cryptocurrencies

texts:
All things about cryptocurrency are very new to me; however, the more I learn the more exciting it is and the more possibilities I see as an application developer.  I'm particularly happy to have made progress understanding smart contracts.   Not so happy with learning how to move tokens from one account to another or exchange for different types of tokens.  Apparently, one can do this in not so efficient ways and lose or perhaps spend a lot on the transactions.   Anyhow, I think I've got a better understanding of that now as well and have been reading about micro-transactions and future plans.   While doing so, a new issue became clear.  Privacy.

Before I can see family, friends, and businesses widely accepting cryptocurrencies for exchanges, ones I know will want very low transaction costs and very, very good privacy.   For example, I don't want my friends knowing that I'm paying a particular doctor, much less having every convenient store gaining access to the same.  I don't want strangers knowing how much money I have.   Within a day or so of experience, I haven't learned how to maintain privacy and have learned how to see everyone's transactions.   How can a person maintain privacy?  How can a person regain privacy after entering the ecosystem?


texts: Is the ethereum.org/dao contract vulnerable to recursive call attacks?

texts:
Does putting p.executed = true after p.recipient.call() make this vulnerable to recursive calls?

function executeProposal(uint proposalNumber, bytes transactionBytecode) returns (int result) {
    Proposal p = proposals[proposalNumber];
    if (p.executed) throw;

    p.recipient.call.value(p.amount)(transactionBytecode);

    p.executed = true;

From ethereum.org/dao


texts: Truffle test including mainnet contract - Error: Cannot create instance of Whitelist; no code at address

texts:
Problem with the error Error: Cannot create instance of Whitelist; no code at address 0x6198149b79AFE8114dc07b46A01d94a6af304ED9

How do I have to setup truffle so that I can run a test which includes data from a mainnet contract while the test itself runs on the development chain?

TESTWhitelistAdvanced.js

contract("WhitelistAdvanced Tests", async accounts => {
  var whitelist;

  before(async () => {
    whitelist = await Whitelist.at("0x6198149b79AFE8114dc07b46A01d94a6af304ED9");
  });

truffle-config.js

networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
    },
    mainnet: {
      provider: () => new HDWalletProvider(mnemonic, "https://mainnet.infura.io/v3/" + infuraKey, 0),
      network_id: 1,       // Mainnet's id
      gas: 9975000,        // Block gas
     }
}

2_deploy_contracts.js

const Whitelist = artifacts.require("Whitelist");
const WhitelistAdvanced = artifacts.require("WhitelistAdvanced");

module.exports = function (deployer, network) {
  if (network === 'mainnet') {
    // DO NOT DEPLOY ANYTHING HERE!
  } else {
    deployer.deploy(Whitelist);
    deployer.deploy(WhitelistAdvanced);
  }
};


texts: Threat detected in geth/chaindata: Mirror-4130

texts:
Virus detection just picked up a threat, called Mirror-4130 in ~/Library/Ethereum/geth/chaindata/6902332.ldb

Has anyone else seen this, and/or can explain a bit how the chaindata directory works? Particularly why I may be getting a virus warning

Possibly related, Mist has been having an impossible time catching up on blocks. Is it possible chaindata was corrupted somehow?


texts:
I need to implement withdrawal pattern for my smart contract. I wanted to make it possible to interact with contract for the people, who use smartphones and tables, just by sending some amounts of ether in a fallback function. Is it possible and secure to implement something like that?

function () payable public {
    if (isWinner(msg.sender)) {
        require(!winners[msg.sender].prizeTaken)
        winners[msg.sender].prizeTaken = true;
        msg.sender.transfer(winners[msg.sender].prize);
    } else {
        makeSomeBet();
    }
}


texts: When I create contract using another contract how could I access his methods in web3js?

texts:
Hey I have file 'contractFactory.sol' inside this file I have

contract contractFactory{

    event contractCreated(string name, address institution, address parent);

    function createContract(
        string _name,
        address head,
        address creator,
        address[] _Members)
    public returns(address){

        Contracts  ContractAddress = new Contracts(_name , head , creator , _Members);
        emit contractCreated(_name,address(ContractAddress), creator);
        return address(ContractAddress);
    }
}

contract Contracts{

    function  dosomthing(){}
}

Now in front-end web3js, I had create 'Contracts' contract using 'contractsFactory'.Does any one know how I could access dosomting() methods in web3js?


texts:
in this code  what is part 1 part 2 part 3 part 4

   contract MyContract {
  // part 1
  uint count;
  uint[] totalPoints;

  function localVars(){
     // part 2
     uint[] localArr;
     // part 3
     uint[] memory memoryArr;
     // part 4
     uint[] pointer = totalPoints;
  }
}

can i do this

function doSomething(uint[] storage args) internal returns(uint[] storage data) {…}


texts: Metamask stuck at Unknown network ID when trying to interact with local Ganache network

texts: I'm getting unknown network ID error on transferring a token in meta mask as in the image below. I'm using local network with ganache. I can transfer from metamask account to another after transferring to metamask account from console. but i can't transfer to metamask account from deployed account


texts: Does pending transactions use the current variable on the blockchain?

texts:
Say I have a public variable called:

uint256 testInt;

When I call a function that reads from testInt and then modifies testInt, it will be pending.
Now I submit a new transaction with a higher gas price. It calls the same function. This transaction will process before the pending function.

My question is that will the testInt that is read in 1. be the one modified by 2?


texts: Why doesn't CryproKitties contract use Enumerable.sol?

texts: I am going through the Cryptokitties code, which does not include the optional Enumerable contract, but the KittyBase contract basically declares equivalent indexation and functions. Why did Cryptokitties roll out their own mechanics?


texts: What the sha3 function do with 2 parameters?

texts:
Who can explain what the second line exactly do ?
this function verify ecdsa signature. the msg is already hashaed and it seems like with sha3(prefix,msgHash) will be hashed twice.

function isSigned(address _addr, bytes32 msgHash, uint8 v, bytes32 r,  bytes32 s) public constant returns (bool) {

         bytes memory prefix = "\x19Ethereum Signed Message:\n32";
         bytes32 prefixedHash = sha3(prefix, msgHash);
         return ecrecover(prefixedHash, v, r, s) == _addr;
    }


texts: Truffle- how to deploy ERC20 on local, but not public network, without the error "X is an abstract contract or an interface and cannot be deployed"?

texts:
So, I have a contract, let's call it contract A, that needs to make call to the Dai contract (referred to as Cash). This contract already exists on Kovan, so in 2deploy_contracts.js I simply set its address and pass it to my contract as a constructor variable:

var contractA = artifacts.require("./contractA.sol");
var cashAddress = 0x..;

module.exports = function(deployer, network) {
 if(network === "kovan") {
 deployer.deploy(contractA, cashAddress);
 }
}

contractA.sol, in addition to the contractA contract, has a Cash interface which describes all the functions of this already existing contract:

interface Cash
{
    function approve(address _spender, uint256 _amount) external returns (bool);
    function balanceOf(address _ownesr) external view returns (uint256);
    function faucet(uint256 _amount) external;
    function transfer(address _to, uint256 _amount) external returns (bool);
    function transferFrom(address _from, address _to, uint256 _amount) external returns (bool);
}

And within the contractA constructor we have:

Cash cash = Cash(cashAddress);

The cash variable is then interacted with at various times, for example:

cash.transfer(_to,_amount);)

All well and good. The problem is that for local ganache testing, there is not an already deployed Cash contract, so I need to deploy it myself. I have created Cash.sol: (Im aware its shitty and not ERC20, Im only using it for local testing):

pragma solidity ^0.5.0;

contract Cash
{

mapping (address => uint256) balances;
mapping (address => mapping (address => uint256 ) ) allowances;

function approve(address _spender, uint256 _amount) external returns (bool)
{
    allowances[_spender][msg.sender] = _amount;
    return true;
}

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

function faucet(uint256 _amount) external
{
    balances[msg.sender] = _amount;
}

function transfer(address _to, uint256 _amount) external returns (bool)
{
    require (balances[msg.sender] >= _amount, "Insufficient balance");
    balances[msg.sender] = balances[msg.sender] - _amount;
    balances[_to] = balances[_to] + _amount;
    return true;
}

function transferFrom(address _from, address _to, uint256 _amount) external returns (bool)
{
    require (allowances[msg.sender][_from] >= _amount, "Insufficient approval");
    require (balances[_from] >= _amount, "Insufficient balance");
    balances[_from] = balances[_from] - _amount;
    balances[_to] = balances[_to] + _amount;
    return true;
}

}

And in my 2deploy_contracts.js I need to pass the address of the newly created contract to contractA as follows:

var Cash = artifacts.require("./Cash.sol");
var contractA = artifacts.require("./contractA.sol");
var cashAddress = 0x..;

module.exports = function(deployer, network) {
 if(network === "development") {
 deployer.deploy(Cash).then((deployedCash) => {
      return deployer.deploy(ContractA, deployedCash.address)
 }
}

But when I try and do development deploy, I get the "Cash is an abstract contract or an interface and cannot be deployed" error.

I'm aware that Cash is an abstract contract (because its just an interface) within contractA.sol. But in 2deploy_contracts.js the object 'Cash' points to Cash.sol, NOT to the interface within contractA.sol. So why is truffle making a fuss?

I thought maybe the problem was that there are two different contracts with the same name- Cash. So for the 'local' version I changed the contract name to localCash (both the file name, and the name of the contract). Then it deploys fine, but since contractA has an interface for Cash and not localCash it can't find the contract at the given address. So it would seem that the name of the interface MUST match the name of the full deployed contract.

Wat do?


texts: errors when trying to connect html to geth

texts:
new user here

I'm trying to connect my geth client to a HTML page using web3 such that the webpage can interact with my local testnet.

I have tried several approaches but I always end up with errors:

When I use web3 v1.0 I use the following code:

<html>
<head>
<script language="javascript" type="text/javascript" src="web3.js-1.0.0-beta.36/dist/web3.min.js"></script>
<script type="text/javascript">
var Web3 = require('web3');
var web3 = new Web3('http://localhost:8082');

I get the following error:
ReferenceError: require is not defined

When I use web3 v 0.20 I use:

<html>
<head>
<script language="javascript" type="text/javascript" src="web3.js-develop/lib/web3.js"></script>
<script type="text/javascript">
var Web3 = require('web3');
var web3 = new Web3('http://localhost:8082');
var version = web3.version.api;
console.log(version);
if(!web3.isConnected()) {
    console.log("not connected");
} else {
  console.log("connected");
}

I get:
this.currentProvider.isConnected is not a function

I also tried to use the IRC instead of http:

<html>
<head>
<script language="javascript" type="text/javascript" src="web3.js-develop/lib/web3.js"></script>
<script type="text/javascript">
var Web3 = require('web3');
var net = require('net');
var web3 = new Web3('path_to_geth/geth.ipc', net);

I get:
Error: Cannot find module 'net'

Sorry if this is an obvious mistake on my side but I can't seem to figure it out. Your help is very much appreciated!


texts: ETH deposit to mist wallet, but balance not showing

texts:
I made an ETH deposit to my Mist wallet, but the wallet does not show any balance after 100 confirmations. The wallet is new and blockchain is still syncing.

Any idea how I can solve this issue?


texts:
Metamask is showing an asterisk near the account balance, and the message "Balance may be outdated". Indeed the balance is outdated.

This is true an all networks (Main, Ropsten, etc.) and different accounts. I'm using Chrome.

On etherscan I can correctly see the updated balance. How can I fix this in Metamask?


texts:
It seems like every time I try to execute a contract function through the browser compiler that requires more than around 50k gas (give or take) to execute, the browser tab's memory gets to around 1GB and the compiler crashes.

I'm using chrome and I tried executing a wide range of functions.
When I run the function directly on a parity node I get the response correctly so it seems to me like it's a compiler issue.

Anyone else experienced it and know a workaround?

Note that it seems like it's reproduced more easily when using loops/arrays, maybe because of the array assignments?

Here's the example contract -

pragma solidity ^0.4.8;

contract TestContract {
    function TestContract() {
    }

    function test(uint256 iterations) constant {
        int256[] memory a = new int256[](1000);

        for (uint32 i = 0; i < iterations; ++i) {
            a[i] = i;
        }
    }
}

I pass more than 500 as an argument to the function and the compiler dies.


texts: Claymore Eth Dual Miner: Acceptable rate of incorrect Ethereum shares

texts:
When I use Claymore in dual mining mode (no matter what combination - Ethereum + Decred, Ethereum + Pascal, Ethereum + Lbry), I'm unable to achieve zero incorrect shares for Ethereum (Incorrect ETH shares: none).

Even on cards with factory settings (not overclocked) and low -dcri 10 - there are still incorrect shares about 0.5%.

Statistics (S key pressed in Claymore's window) after about 800 shares on 3 GPUs look like this:

Is that normal? And does it matter? (I mean, can it cause any sanctions from pool?) What are your stats?


texts:
Hell, I'm struggling to get a PoA network to run with nodes on several servers. I've reduced the problem to try to get a 2 sealers network since with more than 2 nodes it doesn't even start. With 2 nodes, it started, then I killed one node and it stuck.

I removed one node's geth directory, and try syncing from scratch, but I keep getting this:

DEBUG[09-26|09:31:37.939] Ethereum message handling failed id=077ea0d162f14b7a conn=dyndial err=EOF
DEBUG[09-26|09:31:37.939] Removing Ethereum peer                   peer=077ea0d162f14b7a
DEBUG[09-26|09:31:37.939] Removing p2p peer                        id=077ea0d162f14b7a conn=dyndial duration=39.835s peers=0 req=false err="read tcp 103.230.15.133:37982->13.124.90.14:30382: i/o timeout"
DEBUG[09-26|09:31:37.940] Block body download terminated           err="block body download canceled (requested)"
DEBUG[09-26|09:31:37.940] Transaction receipt download terminated  err="receipt download canceled (requested)"
DEBUG[09-26|09:31:37.940] Skeleton fill terminated                 err="block header download canceled (requested)"
DEBUG[09-26|09:31:37.940] Skeleton chain invalid                   peer=077ea0d162f14b7a err="block header download canceled (requested)"
DEBUG[09-26|09:31:37.940] Header download terminated               peer=077ea0d162f14b7a
DEBUG[09-26|09:31:37.940] Synchronisation terminated               elapsed=30.241010243s
WARN [09-26|09:31:37.940] Synchronisation failed, retrying         err="block body download canceled (requested)"
DEBUG[09-26|09:31:38.101] Adding p2p peer                          name=Geth/v1.8.15-stable-...                         addr=13.124.90.14:30382   peers=1
DEBUG[09-26|09:31:38.101] Ethereum peer connected                  id=077ea0d162f14b7a conn=dyndial name=Geth/v1.8.15-stable-89451f7c/linux-amd64/go1.10
DEBUG[09-26|09:31:41.702] Found seed node in database              id=485df49d29823cfb addr=103.230.15.133:30380 age=427201h31m41.702795396s

Basically,
err="read tcp 103.230.15.133:37982->13.124.90.14:30382: i/o timeout"
every time, before or after removing the geth DB.

Since it started when I killed the network to restart it in a screen instance, it's obivously not a real connection problem between the machines (I can ssh from one to the other without any problem).

It seems like geth just bugs and does not deliver the blocks it has. Any help please?


texts: How to get token from new smart contract to my erc20 wallet

texts: I created a token using tokenfactory.surge.sh & metamask, but I don't know how to send it to my wallet. Token factory (tokenfactory.surge.sh) doesn't appear to be allowing me to send it right now through their system, so is it possible to send the token directly from metamask?


texts: Can I READ from ethereum as a before hook on my HTTP request?

texts:
I want to add user authentication using ethereum. Let's say I have a User contract that maps a users phones UDID to an account ID

Let's say I have one existing record for "user1" -> "device1".

On my node server is there a way to authenticate that the user matches with the account id before every request? Would READing from the ethereum blockchain be super slow and therefore make this a bad idea? How long does it generally take to READ from the blockchain?


texts: What is chaincode (Open Blockchain) and is it compatible with the EVM?

texts:
What is chaincode and is it compatible with the EVM?

Chaincode FAQ says it supports smart contracts and can these contracts be deployed and function on the Ethereum blockchain?


texts: How to access ethereum smart contract functions from server side api calls using ExpressJS?

texts:
I have the abi and bytecode of contract functions.

Is there a way to access them using api calls only(using web3 module or any other) since i want to integrate them in an android native app and thus can't use web3 plugin for front end javascript.


texts: Is it possible to deploy a new contract on ethereum without running a geth node and without using metamask

texts:
I need to create several contracts on the click of a button. I cannot run a geth node. I am successfully able to do it via metamask but that results on too many transaction pop ups.
Is there a way to create contract without running geth and without using metamask.


texts:
I have just started using ethereum and trying to create a greeter contract.

I followed the instructions on the below link:-
https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial

I have used online solidity compiler and using windows version of go-ethereum created a 2 node private setup.

I am able to create the contract and its mined as well.But when I try to kill the contract using the below command:-
greeter.kill.sendTransaction({from:eth.accounts[0]})

It doesn't work out whether I try the above command from node1 or node2.

I am expecting an error from Node2(as I created the contract from node1) and success from node1 but nothing happens on both.

Can someone please explain this behaviour?


texts: General question: Every user get disconnected from ethereum and now new user adds how will he get the entire data to his node?

texts:
what if every user get disconnected from ethereum and new user adds how will he get the entire data

For example there are 10 persons in entire ethereum blockchain each having node and entire data is stored in there system while using go ethereum.. Now just imagine everyone got disconnected from the ethereum blockchain. Now 11th user try to connect for the first time then how will he get the data for entire ethereum blockchain? as there is no current active nodes?


texts: Invalid Address error after setting defaultAccount

texts:
I am trying to run contracts on a fresh Geth installation of a private blockchain network. It is working fine in the sense that I can transfer ether between accounts. But if I try to execute a contract, the JS Web3 file gets loaded, I set the defaultAccount as web3.eth.defaultAccount = eth.accounts[0] , unlock the account and then after getting the mined address, call the class. But when I call a function, it simply returns

  Error: invalid address

  at web3.js:3879:15

  at web3.js:3683:22

  at web3.js:4948:28

  at map (native code)

  at web3.js:4947:12

  at web3.js:4973:18

  at web3.js:4998:23

  at web3.js:4026:22

  at apply (native code)

  at web3.js:4151:12

For example, even if I execute a contract as simple as the greeter contract, greeter.greet() returns the above.

I assume that there must be a problem with my private network, but can't figure out what it is.

Any help with this would be appreciated.

I want this to run only on the private network, please refrain from suggesting trying it on public test network.


texts:
My Mist/Eth wallet is syncing very slow, it stays 200k blocks behind.

I have 12-13 peers
using the most recent version of mist.
Internet connection is not an issue
RAM 4GB and rest of hardware shouldn't be a problem too

I've read something about increasing cache to speed up significantly but is that possible within Mist client and if yes,  can someone guide me in this?

Thx!


texts: How was the state-bloat attack that led to the EIP 150 hardfork performed?

texts: I understand that SELFDESTRUCT and mispricing of opcodes allowed many empty accounts to be created cheaply as explained in Why were empty accounts allowed to be on the blockchain?  The answer to that question also includes a transaction that created many empty accounts.  How did that transaction/attack work?  When a contract invokes SELFDESTRUCT, it can't SELFDESTRUCT again... or could it?


texts: function overloads when the function is payable

texts:
I'm calling a function from another contract using an interface. The called function is payable and also overloaded.

Example:

contract OverloadedContract {
    function foo(uint x) external payable returns(uint) {
        //do something with the value
        return x;
    }

    function foo(int x) external payable returns(int) {
        //do something with the value
        return x;
    }
}

interface IOverloadedContract {
    function foo(uint x) external payable returns(uint);
    function foo(int x) external payable returns(int);
}

contract CallingContract {
    IOverloadedContract Ioc;
    constructor(address payable _addr) public {
        Ioc = IOverloadedContract(_addr);
    }

    function callIoc(uint x) external payable {
        uint result = Ioc.foo{value:1000}(x);
    }
}

The line uint result = Ioc.foo{value:1000}(x); will throw the following TypeError:

  TypeError: Member "foo" not unique after argument-dependent lookup in contract IOverloadedContract.uint result = Ioc.foo{value:1000}(x);

This makes sense since,according to the documentation(https://solidity.readthedocs.io/en/v0.6.4/types.html#function-types), the {value:1000} creates a function object before the arguments are specified, meaning the compiler doesn't know which function to choose.

A possible solution would be to use a low-level call i.e.

(bool sent, bytes result)=_addr.call.value(1000)(abi.encodeWithSelector(bytes4(keccak256("foo(uint)")),x))

this would however in my opinion defeat the purpose of function overloading.

I wonder now if there is a workaround/alternative such that one can use overloads while specifying the value? Or should one not use overloads in this case?


texts: gasless contract deployment with ganache-cli

texts:
I have runned ganache-cli with this command:
$ ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic test

I have create a truffle project with this command:
$ truffle unbox react

A sample smartcontract is generated in contracts/SimpleStorage.sol
I have tried to deploy this contract on ganache with this command:
$ truffle migrate

I did not made any configuration of HDWallet in truffle-config.js
It is strange but the deployment worked ! I want to understand how this can be possible. gas fees for contract deployment were payed by the first ganache-cli account. I am wondering how his can be possible because truffle didn't know the mnemonic and the accounts private keys.
I just want to understand
Thanks for your help.


texts: Are there non-fungible tokens that can generate a pay-per-view revenue for the owner?

texts:
A non-fungible token (NFT) by definition represents (ownership of) a unique asset, which we will assume is a digital multimedia file in .avi format. The video's length in minutes, file size, content and other properties are one-of-a-kind, therefore making it non-fungible. With that said, the movie can be viewed as a collectible to outsiders if they were given permission to possess it somehow as well.
What is the correct terminology for a specialized NFT that not only represents singular ownership of the digital file, but also the ability to share it with subscribers on a pay-per-view basis? Should the act of subscription instead be off-loaded to a separate smart contract rather than being built into the master NFT?
Cryptokitties and digital paintings from Rarible definitely do not fall under this category since they can only belong to one person and only one person at a time. Could someone link any examples of subscribeable NFTs, where the sole owner of the digital file can generate revenue by sharing it to paying viewers? Or does such a thing not exist
If pay-per-view NFT is not possible, how about duplicates of an NFT, where duplicates are cheaper than the master copy, but owned by those subscribers as well, which in this case are now buyers of the movie?


texts: My blockchain is in sync and I'm mining using the Mist wallet on the testnet, but I have been mining for three days and have not yet mined any Ether. Am I doing something wrong?


texts: Converting between Fiat (USD) to ether in solidity

texts:
I have a situation where I send 1$ worth of ether to my smart contract..

Now, how do I validate the same on solidity? How do I make sure that the user is sending 1$ worth of ether at any given time.

I mean to say, how can I make sure msg.value in solidity is actually equal to 1$ worth of fiat from solidity.

Edit:
I do know, an oracle can be used as a data source. But is there an oracle that provides an api like poloinex.

Step 1: I call the https://poloniex.com/support/api/ and obtain ether - fiat value

Step 2: I send a transaction to a contract using the previously obtained value:
contract.method.aPayableMethod().sendTransaction({ value: toWei('value from poloinex') })

Step 3: In my payable function inside solidity, how do I make sure, that that the msg.value is always equal to 1$.


texts:
I have coded a token that has about 5000 addresses. With token balances in them
Each of these addresses will release tokens at a controlled rate.

I would like these tokens to represent shares and voting weight in a decentralized autonomous organization and the hardcoded 5000 addresses to be part of a blockchain congress. I do not necessarily want to have a crowdsale or a ICO per say. Can I deploy the DAO contracts on top of my token contract at a later date in time in this order.

1) deploy token contract
2) several weeks/months later deploy shareholder organization contract on top of token contract.
3) deploy blockchain congress contract

Do I have to make sure my token contract is Admined and make sure that only the eth address I deployed the token contract is able to deploy new code on top of it,making the tokens i created the official shares in the DAO.

Please excuse me if I seem like a noob. I just want to deploy the token first because it takes so much time to audit a DAO and testing to make it secure. I would feel better if I could deploy the 2 contracts on top of the token at a later date.

I did some tests where I was able to deploy the DAO on top of a crowdsale contract but I might want to opt out of a crowdsale and just distribute the token by other means then deploy the DAO contract on top of my token.

Is this possible and safe practice?

Can I deploy my token now and then deploy the DAO contracts on top of it at a much later date when I feel the code is secure and safely audited?

What is the best practice for doing something like this?

thank you in advance lots of smart people here.


texts:
In PoW, every full-nodes executes contracts of a block to confirm that the miner was doing honest work.

What about in PoA (proof-of-Authority)?

a. Only authorities will execute the contracts to confirm the block

b. Any full-nodes (with or without authority access) will execute the contracts to confirm the block

Thank you in advance!


texts: What is a chainID in Ethereum, how is it different than NetworkID, and how is it used?

texts:
Here it's described in Ethereum's go implementation.

type ChainConfig struct {
    ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection

A few questions:

How is it different than networkID?
Is chainID and networkID needed in every block or just the genesis block?
Can you give a specific example of what it means when it says chainID is used "for replay protection"?

EDIT: Still unanswered:

What would happen in the situation that you set networkID to one of the mainnet networkIDs, but change the other config variables to whatever you want? Why does it matter what you set for networkID if you're running a local chain?


texts: When will Ethereum switch to Proof of Stake so miners can plan to prepare themselves?

texts: There are talks that the switch to PoS could happen this summer but is it too early, or the date is real so should miners already acknowledge that soon enough they will not be contributing as much?


texts: WETH solidity smart contract for use as address in other contract

texts:
In the constructor of the Solidity contract given in the link below
https://github.com/pancakeswap/pancake-swap-periphery/blob/master/contracts/PancakeRouter.sol
receives a second arg which is address of WETH contract but In the repository there is no contract named WETH.sol which I can deploy and pass its address as the argument. Where is this WETH contract . In the Interfaces folder of the repo there is IWETH.sol which has three functions in it which I think need to be implemented.Do I need to Implement WETH on my own which provides the functionality for those functions declared in IWETH.sol?


texts: If there is a fork, will the difficulty go down?

texts:
Say there's a fork with 51% of the hashrate going to the new version. I assume then that the hashrate of the new chain would be almost half of what it previously was for as long as other miners join the forked now official chain.

During this time will the difficulty be reduced in a way that it would provide huge rewards to the new chain miners ?


texts: Opening GETH Websocket to Specific IP (remote connection)

texts:
I'm trying to connect to a GETH node of mine from a different location.  Currently I'm using the following settings:
geth --syncmode "fast" --maxpeers 100 --cache 32000  --txpool.pricebump 1 --ws --ws.api="eth,net" --ws.origins "*"

I'm using the origins "*" for testing purposes as I will replace it with specific IP addresses if I can get this to work.
I'm running UFW firewall in Ubuntu.  I've opened ports 8546:
sudo ufw allow 8546

However, running any web3 call from a different location to the IP address of the node (including the 8546 port) gives error: Error: connection not open on send().  This tells me the node is not connecting.
Any idea what I'm doing wrong?
UPDATE
I've noticed adding --ws.addr "0.0.0.0" enables me to connect remotely.  However, when adding a specific IP to wsorigins, I am still able to connect from any other IP.


texts:
i am making a swap system. I do it on binance smart chain network. What are test nets? I examined it on the binance official page, but I could not reach a clear conclusion.

What I got in the comment line is for the mainnet network. I've entered these for testnet, but the network of errors occurs. What are the addresses?


texts: Is it bad idea to store my passwords on blockchain with a smart contract?

texts:
I want to save my passwords and some other personal data on a ethereum like blockchain. it seems more persistant to me. I may lose my e-mail , my pc may crush and I may lose my usb stick. But nothing will happen to a blockchain.
I will encryp it and put require(msg.sender,myaddress);  to even read functions.
But still is there a way someone else can retrieve these information as it would be very  bad because they could just easily login to my wallets with that info and steal funds.


texts:
I know this question has been asked so many times. But I have not been able to solve my problem.

I am trying to connect to a remote node located on a server.

My server is running geth on rinkeby and RPC should be enabled thanks to this command:

admin.startRPC("0.0.0.0", 8545, "*", "web3,db,net,eth")

In my code (NodeJS), I have the following:

function getNode(callback) {
    var web3;
    console.log(web3);
    web3 = new Web3(new Web3.providers.HttpProvider("https://X.X.X.X:8545"));
    console.log(web3);
    if (web3 != null) {
        console.log("GOT WEB3");
        callback(null, web3);
    } else {
        console.log("did not get web3");
        callback("ERROR", web3);
    }
}

The web3 variable is undefined at the first log, and is returning an object after I get the HTTP provider.

However, I have this error in my console:

  Error: Invalid JSON RPC response: ""
      at Object.InvalidResponse (D:\node_modules\web3\lib\web3\errors.js:38:16)
      at XMLHttpRequest.request.onreadystatechange (D:\node_modules\web3\lib\web3\httpprovider.js:119:24)

What I have done wrong?

Edit: TCP and UDP are all openned on port 8545.

UPDATE 1

Current command to launch geth:

geth --rinkeby console -rpc -rpcaddr "0.0.0.0" --rpccorsdomain "*"

Current NodeJS code:

function getNode(callback) {
    var web3 = new Web3();
    web3.setProvider(new web3.providers.HttpProvider("https://server_external_ip:8545/"), function(error, result) {
        if (error) {
            console.log(error);
            callback("ERROR", web3);
        } else {
            console.log(web3.isConnected());
            callback(null, web3);
        }
    });
}

This is what netstat gives me:

tcp6       0      0 :::8545                 :::*                    LISTEN      3565/geth

Result: serverless gives me a timeout. If no timeout indicated, it runs infinitely without getting anything.


texts: Error: Invalid number of parameters for "Method". Got 3 expected 2!

texts:
I have React app that executes a Smart Contract payable function at some point. The call is below:

try {
  await contract.methods
    .post(
      this.state.param1,
      `${this.state.param2}`,
      {
        from: account,
        value: Number(web3.utils.toWei(`${value}`)),
        gas: 400000,
        gasPrice: web3.utils.toWei("3", "gwei")
      }
    )
    .call();
} catch (error) {
  // Catch any errors for any of the above operations.
  alert(
    `Failed to load web3, accounts, or contract. Check console for details.`
  );
  console.error(error);
}

When executed, it returns an error Error: Invalid number of parameters for "post". Got 3 expected 2!

I have no idea what I'm doing wrong here. Tried recompiling and migrating the contract, nothing works so far. What am I missing here?


texts: Docker mythril can't connect to Ganache or local .sol contracts

texts:
Has anyone here used the docker version of Mythril (https://github.com/ConsenSys/mythril) and can give me a hint on how to make it work? I only get:

$ docker run mythril/myth -xa 0xc0ed3c3c725c6f3202c13fb49fb7fddb1385e62d29279a0a9a170b5251fb10a6 --rpc ganache
Could not connect to RPC server. Make sure that your node is running and that RPC parameters are set correctly.

$ docker run mythril/myth -x MyContract.sol
Input file not found: MyContract.sol

My Ganache is running my Truffle unit tests fine and MyContract.sol is in the current working directory!


texts: Created first ETH token on test-net how does a monetary value get decided?

texts:
So I created my first token on the Ethereum network and I'm curious how does it get a fiat value.

For example they are being used as a test service on a website but how does coincap or coinmarketcap put a value to them? Is it only when it gets on a big exchange like poloniex or bittrex that a fiat value gets pinged with the ETH Token?

I'm curious because were going to do a $0.01 / token value until the total supply sells out. But how would coinmarketcap or coincap know what they're worth.


texts: How can I check if a transaction will broadcast and get added to the blockchain?

texts: Like we have a function called estimateGas in 'web3' and it creates a dummy transaction which is not added to the blockchain, is there some way to test if my signed transaction will broadcast properly and check if the gas would be enough without actually broadcasting the transaction?


texts:
I want to create a simple smart contract for registration of users to a competition where when users can pay to contract and 2 ethers will deduct from his account.
But when I'm trying to do so on my local ganache blockchain,only gas price is being deducted.

But I'm confused on how to accept payments from ethereum network accounts to the contract.

Help me..

Here's the code

pragma solidity >=0.4.22;

contract dCoders {
    // variables
    // storing contract_amount collected for the event
    address public owner;
    uint public regFee;

    mapping (address => uint) public balance;

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

    event reg(address indexed _from);

    // register a user in the event
    function register() payable public {
        // emit reg(_sender, owner, regFee);

        balance[msg.sender] -= regFee;
        balance[address(this)] += regFee;

        emit reg(msg.sender);
    }

    // distribute the amount collected to winners

    // register a sponser in the event
}


texts: Stuck ERC20 tokens appearing in a different contract

texts:
I have 1000s of token called ERC20 still stuck.
I found them when trying to find missing SPANK on MEWconnect which only shows 1% of the SPANK I thought I had.
If i select the spank contract on MEWconnect it shows the etherscan of that contract when selected.
I can see the rest of the spank I bought, but more interestingly I have a lot of "ERC20" there saying spam next to them. I do remember buying 1000s of this token before from etherdelta a few years back not entirely sure I bought as much as it is saying there but possible as was worth nothing at the time.
Forkdelta doesn't show anything if I use the etherdelta public/ private key I use in MEW connect.
Does anyone know what is going on ? Ive heard that some contracts allow for tokens to be sent back.
Id be more than happy if allowed to, to donate 10% to the first viable understandable solution if it turns out not to be spam and I get this back.


texts: Is the Gas Fee refunded if the transaction fails?

texts:
I'm confusing the rule of paying gas fee when caller makes a transaction.

The gas fee is needed when the transaction is made and I know that the require() is the guard function that returns all the gas fee to the caller.

Is the gas fee paid after all operations in the function in the smart contract?

Then, if the require() function is placed at the start of the function and the codes aren't operated at all, does that mean no gas fee is needed?

And what if the value in that require() statement is false condition and the transaction therefore fails?

Is the gas fee 100% refunded to the caller or does the caller have to pay a remaining gas fee after some operations in the function worked?

Can the caller be refunded all gas?

function burn(uint256 _value) public returns (bool success) {
    require(balances[msg.sender] >= _value);
    balances[msg.sender] = balances[msg.sender].sub(_value);
    totalSupply = totalSupply.sub(_value);
    Burn(msg.sender, _value);
    return true;
}

If the gas fee has to be paid after the code has been executed, what happens if caller(msg.sender) can not pay the gas fee because caller's account has no balance after the require () conditional pass?

I doubt that I know right.


texts: Is there a maximum/optimum amount of ERC-721 that can be issued per contract?

texts: Take a role playing game as example in which players are allowed to create any number of characters (each one defined by an ERC-721 token). What would be the consequences of having more than 10 billions of characters created? It's just a matter of the amount of gas players would require to create new characters?


texts:
I've seen several responses from actives saying once a keystore is lost, all is lost.

This is absolutely unacceptable.
Having to find

C\USERS\\APPDATA\ROAMING\ETHEREUM\KEYSTORE

or wherever it is, by having to Google a post explaining the process,
is totally unacceptable.
The engineers behind this left mistake for a reason, knowing full well a Windows crash or drive failure, or that the average, non-expert with Ethereum, would eventually make this mistake and lost all their Ether in the process.

It's out there somewhere, locked up, but my guess is, someone on the inside of ethereum.org knows how to retrieve it.

A back door key to the vault, so to speak.

I want to know, specifically, who came up with this idea and why it has not been corrected. And secondly, where the lost Ether is.

Or who's since stolen it.


texts: I found the exchange on sushi swap or uni swap always changing, if I change 1000 usdt to USDC, the rate is better than changing 10000 usdt, usually if you change more, the rate should be better? Why this different?


texts: Multiple timelocks on wallets in contract

texts:
I am developing an ERC20 token which needs to have a timelock on a certain wallet that unlocks a certain amount of tokens every month.

I am currently using the openzeppelin function:

function TokenTimelock(ERC20Basic _token, address _beneficiary, uint256 _releaseTime) public

However, this would release all tokens at once. I want to implement something that would unlock a percentage of tokens every month, until everything is unlocked. I also need to restrict the transfer of these unlocked tokens to whitelisted addresses only, is this doable?


texts: web3j-android error: static interface method calls are not supported at language level 1.7

texts:
I get this error

  static interface method calls are not supported at language level 1.7

when having

Web3j web3j = Web3j.build(new HttpService(url));

documentation here says for Android you should use this instead of Web3j.build():

Web3jFactory.build(new HttpService());

But Web3jFactory isn't there. I have no such file for the import that should be (what I found if correct)

import org.web3j.protocol.Web3jFactory;

Here my build.gradle (reduced to relevant information)

apply plugin: 'java'

repositories {
    google()
    jcenter()
}

dependencies {
    implementation 'org.web3j:core:3.3.1-android'
    implementation group: 'org.web3j', name: 'infura', version: '3.3.1'
}


texts: how to implement connect button alongwith drizzle library for ethereum dapp?

texts: I'm trying to create an ethereum dapp which uses drizzle library. I need to implement a connect button logic in which clicking on connect button will provide options like Metamask, WalletConnect, FortMatic etc. is it possible to implement such logic for connect button alongwith using DrizzleProvider or drizzleReactHooks.DrizzleProvider ?  been trying various options but no luck.


texts: Can't get Metamask account in javascript

texts:
The command:

web3.eth.accounts

Returns an empty array despite Metamask having one account, how should I be retrieving the accounts in a way that will work with Mist and Metamask?


texts: Using an ERC20 crowdsale for a non-Ethereum based coin

texts:
I am confused as to how a crowdsale works.  If in a crowdsale, people give their Ethereum to a new coin to be entered in a smart contract.  Doesn't that mean that the receiving end of the contract (once the new coin goes live or whatever) needs to also be an ERC-20 public address?

What if the new target coin you are trying to sell, uses say a whole different protocol running on completely different computers, using the SHA3-512 hashing algorithm to sign keys in a completely different elliptic curve?

What power or validity would the ERC-20 tokens entered in smart contracts have over this new network the tokens are to be exchanged for?

So why then can a coin like Nimiq have a token sale of "NET" (ERC-20) and then later be activated to the final target coin Nimiq, and the NET tokens be left useless on the eth blockchain?