texts: FTM network transaction takes way too long to confirm only when sent from Web3.py

texts:
I'm having a pretty odd issue with Web3.py and the FTM network at the moment. Transactions I send from the UIs of swap protocols confirm in no time (~1-2 seconds). However, if I send the exact same transaction from Web3.py, no matter the gas fee, it takes over 30 minutes to confirm. I'm honestly stumped as to what could be causing this.
For example, this was a txn I sent from Web3.py while the network's average fee was 6 Gwei. I sent it with 50 Gwei, but it still took around 20 minutes to confirm. It was also included to a block where mostly low-fee transactions were crammed.
And I sent this from the UI when the average gas was also 6 Gwei, it pretty much confirmed instantly. It also got included to a block with only 3 transactions.
Here's the code snippet I use for sending transactions:
            func = routerv2.functions.swapExactETHForTokens(1, [WBNB, Web3.toChecksumAddress(address.lower())], to, 2000000000)

            params = {
                "from": to,
                "value": Web3.toWei(qty, "ether"),
                "gasPrice": Web3.toWei(gasprice, "gwei"),
                "gas": gaslimit,
                "nonce": nonce
            }
            built_tx = func.buildTransaction(params)
            signed = w3.eth.account.sign_transaction(built_tx, key)
            txn = backup_w3.eth.sendRawTransaction(signed.rawTransaction)

'routerv2' is SushiSwap's router address and ABI. 'To' is my address, 'value' is the quantity(I used 0.001), 'gasprice' is the, well, gas price, I sent it as 50. Gas limit is 800K, and finally the nonce is the result of w3.eth.getTransactionCount(address).
EDIT: As an update, the issue seems to have.. fixed itself? Still don't know why it repeatedly happened, but all is good right now.


texts: Proper way to stop the Geth console to turn off computer for maintenance?

texts:
After the synchronization of block chain is complete, what happens if you close the geth console while it continues to run the current block chain data?

In the future, I would like to turn off synchronization and close the command prompt geth console so that I can do maintenance on the system.

Is there some duration of time where you can have your system turned off and still start synchronizing again at the last block chain found on your system?

I guess I am asking because it seems that after I had finished synchronization and it was processing through a block, I closed the geth command prompt window.

I then tried to restart geth console and it seems to find the most recent local full block (which on my system seems to be 4058127)

It then goes through this process:

INFO [07-22|11:58:30] IPC endpoint opened: \\.\pipe\geth.ipc
INFO [07-22|11:58:30] HTTP endpoint opened: http://127.0.0.1:8545
INFO [07-22|11:58:30] Mapped network port                      proto=tcp extport=30303 intport=30303 interface=NAT-PMP(192.168.2.1)
INFO [07-22|12:01:00] Block synchronisation started
INFO [07-22|12:01:03] Imported new chain segment               blocks=2 txs=148 mgas=12.617 elapsed=303.788ms mgasps=41.532 number=4058129 hash=ac2f90…89e00a
WARN [07-22|12:01:08] Synchronisation failed, dropping peer    peer=1cd4c9e09b903579 err="retrieved hash chain is invalid"
WARN [07-22|12:05:13] Synchronisation failed, dropping peer    peer=416475e24fa54674 err="retrieved hash chain is invalid"
WARN [07-22|12:10:49] Synchronisation failed, retrying         err="block download canceled (requested)"

It doesn't seem to be able to sync now and it keeps dropping peers.

Does this 'handshake' process just take a long time or did I kind of mess up by stopping the geth console and then trying to restart it.

If it is just a question of patience vs. restarting from scratch, what general time frame should I expect before the handshake completes and I can catch up again to the end of the block chain.

Cheers,
John


texts: Generate contract data hex for 'confirm' function on eth multisig wallet

texts:
I have an account on a hardware wallet that is an owner of a standard multsig wallet contract.  I want to be able to approve a transaction that is originated from a different wallet.  If I have access to all the information about the transaction that I am trying to confirm, is there a way to generate the contract data hex so that I could execute the 'confirm' function directly from the device?  Many thanks!

Here is the code from the contract:

 // confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order
    // to determine the body of the transaction from the hash provided.
    function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
        if (m_txs[_h].to != 0) {
            m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data);
            MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data);
            delete m_txs[_h];
            return true;
        }
    }


texts: Definition of "registrar" and "author" accounts?

texts: What do these accounts refer to in ethereum?  Particularly when setting up a private blockchain?


texts: Geth stuck on blockNumber 0 while syncing is false on Ropsten

texts:
I start geth with:

geth --testnet

It keeps constantly logging a variation of the following line:

INFO [11-21|15:48:42] Imported new state entries               count=770  elapsed=1.795ms   processed=129338 pending=13126 retry=2   duplicate=0 unexpected=927

My console attaches using:

geth attach ipc:/home/faure/.ethereum/testnet/geth.ipc

The following statements evaluate to true

> eth.blockNumber == 0
> eth.syncing == false
> net.peerCount > 0

I'd like eth.blockNumber to be up to date with the latest height so that my account has ETH. Since syncing is false, I'm not sure if I'm having trouble syncing or if I have finished syncing and for some reason the console can't find the blockchain data.


texts:
Some football clubs issued own fantokens
And I'm wondering if there is an infrastructure for mass creation of crypto fantokens, for example by blogers

What service can offer a user-friendly interface to generate own tokens? (preferably Ethereum-based)
Does the service which also can provide manually set up a quarterly token dividends for holders exist?


texts: If I import Ownable and MyClass inherits from it, do I need to migrate the Ownable at all?

texts:
I'm a bit confused about migrations. I've just been told to use 1_migration.js file per contract, except maybe in the case of imports. I am going to change these migrations back to one per migration, but what about the first 2 contracts-- Do I need that first line and corresponding first call to .deploy(Ownable). Thank you for helping.

2_deploy_contracts.js

var Ownable = artifacts.require("./Ownable.sol");
var OmniCAT = artifacts.require("./OmniCAT.sol");
var IronLevels = artifacts.require("./IronLevels.sol");
var Dass42 = artifacts.require("./Dass42.sol");

// Make sure Ownable migrates first since OmniCat inherits
module.exports = function(deployer) {
  deployer.deploy(Ownable);
  deployer.deploy(OmniCAT);
  deployer.deploy(IronLevels);
  deployer.deploy(Dass42);
};

contract OmniCAT is Ownable // imports Ownable
contract IronLevels is OmniCAT
contract Dass42 is OmniCAT


texts: Trying and failing to switch my dapp from local node to infura, please help?

texts:
I have a nodejs 'server' running that listens for events on the blockchain. Currently I have this line in my code:

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

But I'm fed up paying $40 every month for my node. I want to switch to infura. I signed up, added my project, got project ID. Then changed this line of code to:

var provider = new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/PROJECTID");

And I get a whole load of errors as per https://i.imgur.com/CW7InGp.png. What's going on? What am I doing wrong?

  Error: The method eth_newFilter does not exist/is not
  available


texts:
I'd like to convert bytes into any other type. I.e. "0x57D80C61128d608857d5310BB514223Bb6011CAB" into the address 0x57D80C61128d608857d5310BB514223Bb6011CAB, "5" into the uint256 5 and so on. I have followed all the snippets I could find but I can't get any of them working post 0.5.0. I believe the culprit is the change outlined here:

  Conversions between bytesX and uintY of different size are now disallowed due to bytesX padding on the right and uintY padding on the left which may cause unexpected conversion results. The size must now be adjusted within the type before the conversion. For example, you can convert a bytes4 (4 bytes) to a uint64 (8 bytes) by first converting the bytes4 variable to bytes8 and then to uint64. You get the opposite padding when converting through uint32.

Taking the uint example, here is some code that would have worked prior to this version of the compiler:

function bytesToUInt(string memory _b) public returns (uint256){
  bytes memory b = bytes(_b);
  uint256 number;
  for(uint i=0;i<b.length;i++){
    number = number + uint(b[i])*(2**(8*(b.length-(i+1))));
  }
  return number;
}

But this now results in a TypeError: Explicit type conversion not allowed, I've tried moving things around and adding extra conversions but nothing has worked.

For bytes to address, I've tried this:

function bytesToAddress(string memory _b) public returns (address) {
    bytes20 b = bytes20(bytes(_b));
    return address(uint160(b));
}

But you can't explicitly convert from bytes memory to bytes20 and I couldn't get that working either.

Can someone show me how this is done properly? Thanks.


texts: Need help understanding how to add value to the token I made. I want to make it exchangeable for other tokens? I deployed token and added to wallet how do I set its value vs other tokens?


texts:
Etherscan displays all accounts in ethereum being used in the following section https://etherscan.io/accounts

Question: How can I get a list of all active ethereum accounts using geth?

Possible answer: Use Parity. It enables this feature by the RPC call to parity_listaccounts.

Why Not an answer: The account information is available at https://rinkeby.etherscan.io/accounts and rinkeby runs only geth. So geth must be able to provide this information.

Update

A similar question: There exists a similar question How to list ALL Ethereum addresses with a positive balance, but that requires traversing each block which is very time costly process.


texts:
in the browser (I use nodejs with web3 and testrpc), I have:

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

I have the following error:

TypeError: web3.eth.Contract is not a constructor

if I use a non capitalized "c"

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

I have:

contract: {
  "eth": {},
  "abi": [
    {
      "constant": true,
      "inputs": [],
      "name": "displayMessage",
      "outputs": [
        {
          "name": "",
          "type": "string"
        }
      ],
      "payable": false,
      "type": "function"
    },
    {
      "inputs": [],
      "payable": true,
      "type": "constructor"
    }
  ]
}

but later in my script:

var deployed = contract.new({
      from: account1,
      value: web3.toWei(3, 'ether'),
      data: bytecode,
      gas: gasEstimate,
      gasPrice: web3.eth.gasPrice
    }, (error, result) => { });

I have another error:

TypeError: this.eth.sendTransaction is not a function

Any idea of what is my problem ?


texts: Are there any other "smart contract standards" like ERC20?

texts:
QUESTION:

I know that ERC20 is a token standard which means there are a set of functions that a contract has to include to be ERC20 compatible. I find this a clever approach and was wondering if there are any other standards like that (not specifically for tokens). The whole philosophy of ethereum suggests that there should be plenty of such protocols just as we have a bunch of application layer protocols over TCP/IP.

UPDATE:

In addition to CNuts' excellent answer for anyone interested:

ERC is short for Ethereum Request for Comments which is Ethereum's version of Request for Comments

  A Request for Comments (RFC) is a type of publication from the Internet Engineering Task Force (IETF) and the Internet Society (ISOC), the principal technical development and standards-setting bodies for the Internet.

The number represents the Github issue number where the ERC was originally proposed (e.g. for ERC20)
The whole idea of the ERC system was proposed in this Github issue
An ERC is a type of EIP (Ethereum Improvement Proposals) which:

  describe standards for the Ethereum platform, including core protocol specifications, client APIs, and contract standards

General information about EIPs and all the current ones can be found in this repo


texts: What is the way to make Ethereum available to users for free?

texts:
As the web is mostly free today (I mean the old web, the one < 3), most people won't agree in beeing asked for fuel to run sites, apps, even if the gain in terms of safety and trust are so much more that what they could pay as fee to use Ethereum.

So what are the possible economic models to make Ethereum contracts free for use to user ?

I can imagine refunding but user would have to give fuel first even if they are refunded after they use it. I doubt that ads would be welcome on this sort of network, at least on its begining. I didn't see any way for the developper to preload contracts with fuel to make it free for the user (but I'm not sure it's not possible).

So I wonder how to achieve this goal. Perhaps I'm thinking the wrong way, so if anyone have tips to understand this part of the Ethereum.

EDIT: I know how to interact with contracts, I know about fuel fees, but my question is more about the economic model. I read about some model proposal on a blog post (I forgot where, sorry) that proposed refund and ads models. I also read about other crypto-currencies that implement fuel preload, but Ethereum don"t look to be this kind.

The only thing I know is that user (regular users, not geeks) will never accept to pay for something new even if better.

So what's possible to make Ethereum accepted by everyone as the web 3.0 ?

Thanks.


texts: Unable to transfer tokens from another contract

texts:
I am learning soildity.

I created a fixed supply token. My token supply is 1000000 with 0 decimal places. Now, I want to transfer tokens from using new contract, so I created a new contract named Crowdsale. Whenever I am transfring the token from crowdsale contract it gives an error.

"transact to Crowdsale.(fallback) errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value.  Debug the transaction to get more information. "

Note: I am passing the token owner address to the Crowdsale contract at the time of deploying.

you can find my contract using below link:

https://github.com/maksa14/Contracts/blob/master/Test/TokenCrowdsale.sol


texts:
Please help. I don't get what the following error means:

"browser/DGC1.sol:102:1: ParserError: Expected pragma, import directive or contract/interface/library/struct/enum definition. {contract Doge Coin is ERC20Interface, Owned, SafeMath { ^ "


texts: Is there a way to communicate with big files stored in a database from ethereum blockchain?

texts: For example, if my smart contract holds very basic detail of a patient and I want to access his / her medical report stored in a database (mongoDB) .


texts: Save temporarily-shareable private data using Quorum

texts:
Can we use Quorum (or any other Ethererum variation) to save private data that can be shared with other parties for a temp period?

The use case is that: A patient can share his medical data that is related only to a specific category (radiology, dental, etc..). This is can last for a configurable time (ex. the doctor can see the data for the next 10 days only). And the doctor can see the history for a chosen period (ex. 1 year back only).

(Note: The question is about saving and sharing the full data, not only the hash of the record.)


texts: Unable to npm install web3 on Windows 10

texts:
I followed every thing on this page :

https://medium.com/@PrateeshNanada/steps-to-install-testrpc-in-windows-10-96989a6cd594

Except step number 5 where my Node.js version is 8.10.0 instead of 8.10.2 which i dont think is a big difference.

I have installed VS 2017 Community Edition , Windows 10 SDK, OpenSSL , npm-gyp.
I have ran the command npm install --global --production windows-build-tools to install all the latest build tools and still get this error. Help is needed.

EDIT

I have uninstalled Visual Studio 2017 and just install Build Tools through the npm install --global --production windows-build-tools command. A new error appears. How?

pm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated tar.gz@1.0.7: ⚠  WARNING ⚠ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t git://github.com/frozeman/WebSocket-Node.git
npm ERR!
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.253.112]: errno=No such file or directory
npm ERR! github.com[1: 192.30.253.113]: errno=No such file or directory
npm ERR!
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Syed\AppData\Roaming\npm-cache\_logs\2018-03-12T04_26_35_361Z-debug.log


texts: Not receiving ethers after selling the tokens

texts:
I have successfully sold my tokens to the Smart Contract today. However, I did not receive the ethers from the sale.

Here's the txn number: 0x9ae532d08430a9aa5108c9feffbc62b6f31e5078e93ed6016cf232688e46c8aa

Not sure what's wrong, but this is the first time it happened. Appreciate anyone's help on this.


texts: Syntax for calling contract state changing methods

texts:
I've been struggling a bit with calling methods that change the state of the contract. Take, for example, the following contract:

contract C {

     uint[] numbers;

     function initNumbers() {
         numbers.push(1);
         numbers.push(2);
     }

     function stateChanger(uint a) {
         numbers.push(a);
     }
}

After deploying, the initNumbers() method has to be called/sent as a transaction:

c.initNumbers({from:eth.accounts[0],gas:400000});

due to the fact that it changes the state (executes write operations) on the block chain.

How is it possible to call the second method that has an argument but also changes the state (stores it in the contract)?

I've tried the following but got a BigNumber exception:

c.stateChanger({from:web3.eth.accounts[0],gas:400000}).call(3);

The stack trace was:

/usr/lib/node_modules/web3/node_modules/bignumber.js/bignumber.js:1209
            throw error;
            ^

BigNumber Error: new BigNumber() not a number: [object Object]
    at raise (/usr/lib/node_modules/web3/node_modules/bignumber.js/bignumber.js:1177:25)
    at /usr/lib/node_modules/web3/node_modules/bignumber.js/bignumber.js:1165:33
    at new BigNumber (/usr/lib/node_modules/web3/node_modules/bignumber.js/bignumber.js:193:67)
    at new BigNumber (/usr/lib/node_modules/web3/node_modules/bignumber.js/bignumber.js:203:25)
    at toBigNumber (/usr/lib/node_modules/web3/lib/utils/utils.js:367:12)
    at Object.toTwosComplement (/usr/lib/node_modules/web3/lib/utils/utils.js:378:21)
    at formatInputInt [as _inputFormatter] (/usr/lib/node_modules/web3/lib/solidity/formatters.js:40:38)
    at SolidityType.encode (/usr/lib/node_modules/web3/lib/solidity/type.js:179:17)
    at /usr/lib/node_modules/web3/lib/solidity/coder.js:86:29
    at Array.map (native)


texts: Solidity, Web3 - Invalid number of arguments to Solidity function when I have correct number

texts:
I created smart contract and I deployed it on Ropsten network using Truffle. I tested it from Remix and it works. I have there 2 view with a same name checkInputData but different number of parameters.

When I call the first checkInputData from my front-end app (using Metamask and Web3) it works, but when I call the second one, it writes

  Error: Invalid number of arguments to Solidity function

This is my first (correctly working) view:

function checkInputData(string memory _deviceId, int32 _latitude, int32 _longitude, uint _time, uint _speedType) public view returns(bool)

this is the view with the error:

function checkInputData(uint _speedType, int32 _latitude1, int32 _longitude1, uint _time1, int32 _latitude2, int32 _longitude2, uint _time2) public view returns(bool)

and this is how I call it:

contract.checkInputData.call(2,0,0,0,0,10000,0, (error, result)=>{
            if (error) {
                console.log(error);
            } else{
                console.log(result);
            }
        });

I tried to call it in Remix with the same parameters and it works there.

Any ideas what can be wrong and how to solve it?

UPDATE:
I fixed the problem by changing view name. But it still did not give me an answer what was the problem.


texts: How can callable contracts have an empty account state?

texts:
On page 4 of the yellow-paper, the definition of an "empty" account is provided.

An account is empty when it has no code, zero nonce
and zero balance.

A formal definition is then provided, where "no code" is taken to mean that the account's codeHash is equal to the KEC hash of the empty string.
The paper then goes on to say:

Even callable precompiled contracts can have an empty
account state. This is because their account states do not
usually contain the code describing its behaviour.

This confuses me. If the account has code, wouldn't its codeHash != KEC(""), and thus not be empty?


texts:
I want to call a method in the smart contract (UpdateWeather) that goes through several steps before returning the result (an integer). I use sendSingendTransaction but I have doubts.

Is the transaction only mined after UpdateWeather has obtained Conditions and Temperature?

what does the receipt contain? receipt contains Conditions and Temperature? If so, how do you extract the result?
const transaction = myContract.methods.UpdateWeather(place);

try {
              const options = {
              to      : transaction._parent._address,
              data    : transaction.encodeABI(),
              gas     : await transaction.estimateGas({from: account.address}),
              gasPrice: await getGasPrice(web3),
          };
      const signed  = await web3.eth.accounts.signTransaction(options, account.privateKey);
      const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);
      return receipt;
  }
  catch (error) {
      console.log(error.message);
      const receipt = await getTransactionReceipt(web3);
      if (receipt)
          return receipt;
  }

contract Booking
  {

      Weather  WeatherAddr ;

     constructor() public
     {
     }

     function UpdateWeather(bytes32  place_) public view returns(int256 Conditions ,int256 Temperature )
     {
        int256  Conditions ;
        int256  Temperature ;

      (Conditions, Temperature)=WeatherAddr.GetWeather(place_) ;

     }

  }

contract Weather
  {
      function GetWeather(bytes32 place_) public view returns (int256, int256  retVal)
     {
        return(Places[place_].Conditions, Places[place_].Temperature) ;
     }
  }


texts: Remix doesn't compile Selfdestruct with address variable

texts:
Why does Remix compile the below with msg.sender but not with contractOwner address variable?
Thank you


texts: How to sign a contract call (not transaction)?

texts:
My contract uses onlyOwner to restrict access to several functions.  Everything was working but I've had to port everything to use Infura and no longer have local accounts.

I'm able to sign transactions offline / use sendRawTransaction but I'm not sure how to go about doing this with pure functions (not creating transactions) that are still onlyOwner.

I'm using web3.py but I can figure it out from web3.js etc.


texts:
I read in many places that view functions do not cost gas however that's not true because they cost gas for blockchain operations even if those do not change the state. Correct me if I am wrong
For example:

pragma solidity ^0.4.17;

contract myContract {
    uint[] public anArray;   /// assume it has 1,000,000 (1Million) elements

/* function which returns how many times a specific element is in the n array*/

    function elementIndex(uint element) public view returns(uint){
        uint counter;
        for(uint i; i<anArray.length; i++){
            if(anArray[i] == element){
                counter++;
            }
        }
        return counter;
    }
function returnAllElements() public view returns(uint[]){
return anArray;
}}

The real problem comes on the front end when the array has 1 million elements. Running elementIndex() will never work because the iteration will take too long. returnAllElements will not work either (I assume).

What can be done in such circumstances?


texts: Can i know by any method whether the particular address is contract address or simple ethereum address?

texts:
Here is the problem I am facing.

I am calling some function of already deployed contract using its contract address.

Below are the lines of code :-

function registerYourBrand(string memory brand, address contract_address)public onlyOwner returns(bool){
        require(! exists[contract_address][brand], "You have already register your brand");
        (bool success, bytes memory brand_Owner)=address(contract_address).call(abi.encodeWithSignature("getOwner()"));
        require(success);
        address brandOwner = address(bytesToAddress(brand_Owner));
        brandOwners[brand] = brandOwner;
        contractAddresses[brand] = contract_address;
        tokenValue[brand] = 1;
        exists[contract_address][brand] = true;
        emit Register(brand,contract_address);
        return true;
    }

contract_address should be the address of the already deployed contract.

But when I am passing any other address here even if it is not contract address then also these lines are executed. But I am wonder, how is that possible.

I am testing it in remix. I have one deployed contract named 'AirToken' . In that contract getOwner() is one function. When I am calling this function from other contract using its contact_address, this is working fine and I am getting the AirToken owner's address successfully. But when i pass some other address that is not Contract Address, this line is executed succesfully but the returned value is some dummy value like 0x0000000000000000000000000000000000000001 this.

How getOwner() function is found if contract_address is not any contract address ?


texts: How will centralized portions of the Ethereum space (Infura, EtherScan) respond to huge increases in throughput?

texts:
Two forthcoming improvements to Ethereum are Casper and Sharding. While FFG Casper won't decrease the 14-second block time (because it's hybrid POS/POW), full-fledged Casper promises to. Sharding holds the promise of increasing transactions per second (and block production per second) many times over that.

Given the recent overloading of the Ethereum ecosystem in the light of  Cryptokitties, etc., (part of which was due to the overloading of centralized systems such as Infura, EtherScan, and MyEtherWallet) how are these 'centralizing' influences planning on handling the impending massive increase in activity when the changes come into effect?

Shouldn't we all be pretty concerned about this given the heavy reliance on these heavily centralized systems? Would encouraging a much more decentralized stance (i.e. everyone running their own nodes) help?


texts: Is `require` in solidity identical to `assert`?

texts:
If so, why was the name require chosen instead of just assert like most modern programming languages?

Where does the name require originate from?


texts: How to unlock account using web3js with infura?

texts:
I need to unlock accounts using web3js with infura.io, but it seems that infura does not support web3.personal modules.

In this case, I think options are 1.using geth or parity for client node not infura or 2.signing accounts locally before being sent to infura.

If the option 2 is possible, how to do that?

And also, I have user account addresses, public keys, and private keys for use.


texts: Invalid JSON RPC response when creating contract

texts:
I am getting this error while trying to deploy contract on Mainnet via remix.ethereum.org

creation of XXXTokenCrowdsale errored:
Invalid JSON RPC response: {"id":22,"jsonrpc":"2.0","error":{"code":-32603}}

The same copy and pasted contract deploys without a problem on Ropsten or Rinkeby testnets using the same interface on remix.ethereum.org injected Web3.


texts: Automatically deploy a contract with generated Web3js code

texts:
I want a command line tool which having only contract source would automatically not only compile it but also automatically create the JS code which can deploy the contract through Web3.js (using user provided variables for symbol and token name).

Does such a tool exist? If not, is there an easy way to create it?


texts: I tried installing the solidity package onto sublime text. To make a long story short, its in the packages but my solidity is not responding the way my js code is. Meaning the functions are not colored the way it is with the other programming languages I have. I restarted the app twice now and nothing has changed, what do you suggest?


texts: discover if a binary data contains Ethereum address in it?

texts:
Is there a way to guess, with some level of probability , that a 20 byte array is an Ethereum address, besides doing a query against the current StateDB and its history ?

I want to discover hidden addresses in the input for contracts, so , I guess, I would need to (somehow) apply elliptic curve algorithm to this 20 byte array and determine if it looks like part of Ethereum's public key.

Is what I am proposing doable? If so, how would one implement this task ?


texts:
I’m trying to use the renounceOwnership() function from the Ownable.sol contract and it doesn’t seem to be working.
I’ve got a simple 2-contract set-up, as follows:

The first contract is a basic ERC721 Contract - which imports and uses Ownable.sol:
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";

contract myERC721Contract is Context, Ownable, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {

  …code…

}

The second contract imports the first one (“myERC721Contract”) and has a function called cutCord() which calls the renounceOwnership() function that it inherits from Ownable.sol:
import "./myERC721Contract.sol";

contract MyERCMarketplace is myERC721Contract {

   … code…

   function cutCord() external {
      renounceOwnership();
   }

}

As a reminder, this **renounceOwnership()** method - which is from the **Ownable** contract - emits an event called `OwnershipTransferred`, declared as follows:
  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

And here’s how the renounceOwnership() is declared in Ownable:
 function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

Finally, I set up my front-end JS app to listen for the OwnershipTransferred event:
let contractOwnerChanged =  myContractInstance.events.OwnershipTransferred({ fromBlock: "latest", toBlock: "pending" })
.on("data", async function(event) {
    console.log("\n==================\n--->OwnershipTransferred 'data' event = " + event);
    let eventKeys = Object.keys(event);
    let eventValues = Object.values(event);
    console.log("'OwnershipTransferred' eventKeys = " + eventKeys);
    console.log("'OwnershipTransferred' eventValues = " + eventValues);

    let returnValues = event["returnValues"];
    let returnValuesKEYS = Object.keys(returnValues);
    let returnValuesVALUES = Object.values(returnValues);

  })
  .on('changed', async function(event) {
     console.log("OwnershipTransferred 'changed' event = " + event);
  })
  .on('error', async function(event) {
     console.log("--'OwnershipTransferred' - ERROR!" + error);
  });

I trigger my cutCord() function via a simple button-press, as follows:
function cutCord() {
    console.log("\n\n=================\n==> in 'cutCord()'!");

    var cordCutter = myContractInstance.methods.cutCord().call({ from: activeAccount },
      function(error, result) {
        if (!error) {
          console.log("\n\n==>Back in 'cutCord()'!!!  No ERRORS!!!");
          console.log(">'result' is:");
          console.log(result);
        }
        else {
          console.log("ERROR!!! from 'cutCord()' -->\n" + error);
        }
      });

    console.log("\n\n=================\n==>EXITING 'cutCord()'!");
  }

The end result is that nothing is happening: on the one hand I don’t get any errors, but on the other hand, the result that comes back simply returns this in the console:

So what am I doing wrong?


texts: Smallest number of nodes for an Ethereum private blockchain

texts:
In a public instance, one would expect the more miners the merrier, as this improves the overall mining diversity and therefore we get better security.

Private blockchains, as in the Eris case, tend not to rely on proof of work mining, and use some form of proof of stake instead.

My question is: could I run a private blockchain (say using Eris), say, with just two participating nodes? Or is there any inherent lower bound below which security can become compromised?


texts:
Storage operations are very expensive and everything pales in comparison as soon as you start using them.

So I was wondering, what clever way one could use to reduce the following storage write operations (20000/5000 gas each).

function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
  uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
  tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
  tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], amount);
  tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], feeTakeXfer);
  tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
  tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}

They are stored like this: mapping (address => mapping (address => uint)) public tokens;


texts: Web3 not being detected - google chrome extension

texts:
I am working on a google chrome extension that operates when a user opens up a new tab. Upon opening a new tab, my dapp should connect to the user's web3 provider. However, no web3 is being detected.

Everything works fine if deployed as a simple webpage.

I am just running into said issue when I try to operate my dapp as a chrome extension, with it beginning to run when opening a new tab.

Here is truffle-react's setup which I did not edit for retrieving web3:

let getWeb3 = new Promise(function(resolve, reject) {
// Wait for loading completion to avoid race conditions with web3
injection timing.
window.addEventListener('load', function() {
var results
var web3 = window.web3

// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
  // Use Mist/MetaMask's provider.
  web3 = new Web3(web3.currentProvider)

  results = {
    web3: web3
  }

  console.log('Injected web3 detected.');

  resolve(results)
} else {
  // Fallback to localhost if no web3 injection. We've configured this to
  // use the development console's port by default.
  var provider = new Web3.providers.HttpProvider('http://127.0.0.1:9545')

  web3 = new Web3(provider)

  results = {
    web3: web3
  }

  console.log('No web3 instance injected, using Local web3.');

  resolve(results)
}
})
})


texts: What are the mechanics of token reflection?

texts:
I'm trying to understand the mechanics behind token reflection.  This bit here seems to be what most of the ERC20 Tokens having the reflection mechanic are using:
https://github.com/reflectfinance/reflect-contracts/blob/main/contracts/REFLECT.sol
I'm having trouble following what's happening in the code.  Since we don't want to iterate over wallet balances to adjust the holdings anytime a transaction happens which triggers "reflection", it looks like it's doing some kind of math voodoo to determine what someone's actual balance is based on a reflection counter of some kind, maybe?
Also, it looks like this particular token is keeping two sets of balances _rOwned and tOwned.  I'm not sure what those are doing either.
Can anyone provide any insight on what's happening there?


texts:
I'm new to ENS and would like to explore the field. Is there a way to get a list of all active .eth domain that are mapped to IP address?

Thanks


texts: How do I set the nonce for raw transactions?

texts:
A few questions about rawTransactions:

Are they documented anywhere?
How exactly should I set the nonce of a rawTransaction? If I start geth, and submit nothing but rawTransactions to it, then the nonces are simply numbered 1, 2, 3, ..., correct? How about if I mix in some non-raw (sendTransaction) transactions, from a different address? For example, suppose I submit eth_sendTransaction, eth_sendTransaction, eth_sendRawTransaction. Should the nonce of the first raw transaction be 1 or 3?
Has anything changed in the way rawTransaction nonces are handled, between develop and master?
Does the answer to (2) change if the sendTransaction(s) and raw transactions are from different addresses?

Edited (4/2/2016): the specific error I'm getting when I attempt to send raw transactions to geth: -32000: Nonce too low.  (This is why I'm so focused on the nonce value...)

Here is an example of the client-side transaction, prior to being wrapped and packaged by ethereumjs-tx:

{
  "to": "0x895d32f2db7d01ebb50053f9e48aacf26584fe40",
  "from": "0x6bcf3d525c425965a40fb77b1fe6461eeced67d7",
  "gasLimit": "0x2fd618",
  "nonce": 1,
  "value": "0x0",
  "data": "0x5f92896e00000000000000000000000000000000000000000000000000000000000f69b5",
  "gasPrice": "0x4a817c800"
}

Anything obviously wrong there...?


texts:
What is the correct way to get the number of decimals using web3? For example, how would I get the number 6 as a result when trying to obtain USDT decimals from the contract address?
I was using contract.methods.decimals().call() but it returns this
RETURN VALUE I GET  { [Function: bound _executeMethod] request: [Function: bound _executeMethod] }
async getTokenInfo(tx) {
try {
  const contract = new web3.eth.Contract(abi, tx.to);
  const symbol = await contract.methods.symbol().call();
  const decimals = await contract.methods.decimals().call;

  return { symbol: symbol, decimals: decimals };
} catch (error) {
  console.log("getTokenInfo", error);
}


texts: Padding parameter values in contract low-level call

texts:
In the following example:

contract_address.call(bytes4(sha3("function_name(types)")),parameters_values)

should we pad the parameters values to 32 bytes? Because I have seen code like

if (!addressOfA.call(bytes4(keccak256("f1(bool,uint256)")), true, 3)) {
    throw;
}

but according to the ABI specification, "true" and "3" should be padded, where clearly in the example are not.


texts: Are arguments from Provable callback's function mandatory?

texts:
Since I am only using Provable (formerly Oraclize) in order to make a cron job, and calling only a function from inside my smart contract (like here), I was wondering if the parameters myid and result were mandatory.

So my question is, if I have no need for external API call results, can I just write this?

function __callback() public {
    ...
}


texts: How are organization level ethereum wallets and accounts handled

texts:
We are planning to have some of the smart contract functionality available to external users, but only if they go via our website. (Eventually, they will be accessible via usual contract calls directly on the blockchain).
So workflow is like this -> User-logs into our website - provides some information that we can validate against external sources - once validated, we invoke the corresponding smart contract functionality from the backend.

While I can use web3.js to call out from my website to the blockchain, how exactly would my account/wallet be secured by the website itself? As in, if our website is hosted on aws, should we have the secret key stored in our db and use it to sign our calls to the block chain? Or, is the only option to use mist/metamask from a locally secured computer to call the restricted external functions on the contract?

If anyone has done something similar, it would be great if you could share the list of tools you have used to secure and the list of tools you used to access the block chain.

Any thoughts on how multi-people organizations can effectively and securely handle access to smart contracts is also appreciated.


texts: How to get address of contract interface

texts:
In the contract below, how to look up address of tokenContract ?

  Operator != not compatible with types address and contract Token
              if(msg.sender != tokenContract) throw;

contract Token { }

contract A{

    Token public tokenContract

    function A(address addressOfTokenContract) {
    tokenContract = Token(addressOfTokenContract);
    }

    function B() {
    if(msg.sender != tokenContract) throw;
    }

}


texts: Uniquely identifying and lexicographically sorting transactions

texts:
Is event.blockNumber + '-' + event.logIndex unique for an Ethereum transaction (that is no two different transactions having it the same)?
If not, is event.blockNumber + '-' + event.logIndex + event.blockHash unique?
Please also help (with JavaScript) to convert these values into such strings that the order of the transactions in time (approximate) would match the resulting lexicographical order of the values.
I think, somethings like: toHex(event.blockNumber) + '-' + toHex(event.logIndex). How to define toHex()?


texts:
I'm trying to use a mapping inside a struct:
struct PoolStruct {
    uint currentUserID;
    uint activeUserID;
    uint price;
    uint minimalReferrals;
    mapping(uint => address) poolUserList;
  }

the code compiles, so i guess it's somehow permitted.
The problem starts when i try to assign to that property:
PoolStruct memory pool;

pool = PoolStruct({
  currentUserID: 1,
  activeUserID: 1,
  price: POOL_PRICES[i],
  minimalReferrals: POOL_MINIMAL_REFERRALS[i]
});

pool.poolUserList[1] = msg.sender;

get an error on the last line...
TypeError: Member "poolUserList" is not available in struct Definitions.PoolStruct memory outside of storage.
       pool.poolUserList[currUserID] = msg.sender;
       ^---------------^

Is there any way to make this work?


texts: How send transaction with msg.data in Remix?

texts: The fallback function may receive additional data (exposed in msg.data). How can I send a transaction with additional data in Remix?


texts: What will be the transaction fee when Ethereum shifts to PoS?

texts: Ethereum plans to shift from PoW to PoS and there'll be no mining involved anymore. The incentive for peers to participate in the network and confirm the transactions will be the transaction fee. How much will it be?


texts: It took more than 18 hours of transfer ETH with exchange Binance on Stocks.Exchange. Although Etherscan confirms the success of the coins in your wallet. Support StocksExchenge not responding. Here's the transaction number: 0xeea6ab9b6dda5e6329136c8cc52b81851e1d004ff38e162d197e91fc50cd23d2 What to do? Thank you!


texts: Send back to back signed raw transaction

texts:
I have to send multiple signed transactions and from a specific account with nonce via web3.eth.getTransactionCount.
Because the call may come parallel, I either get

  replacement transaction underpriced

or

  Transaction was not mined within 50 blocks, please make sure your
  transaction was properly send.

What is the best way to calculate nonce and make every transaction unique?

I am using web3


texts: CompileError: UnimplementedFeatureError: Encoding type "struct A.Params memory" not yet implemented

texts:
I am hitting a deadend and I hope I can get some enlightenment.
In one of the contract, Pool.sol I have a storage state variable defined as:
struct PoolParam {
        string xyz;
        string yzy;
        address[] tokens;
        uint[] balances;
        uint[] tokenWeights;
  }

PoolParam public PoolInfo;

Then, PoolInfo is updated as information is gathered throughout the life cycle of the contract:
PoolInfo.tokens.push(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));
PoolInfo.balances.push(300);
PoolInfo.tokenWeights.push(2);

After update is completed, this variable is passed into a function which is owned by another contract Factory.sol:
Factory.Create(PoolInfo);

The signature of Create in Factory.sol is:
function Create(
        Pool.PoolParam calldata poolParams
    )
        external
        returns (newPool)
    {

I then I got a compilation error:
CompileError: UnimplementedFeatureError: Encoding type "struct Pool.PoolParam  memory" not yet implemented.
What am I doing wrong?


texts:
0xdb651909881589110a34e4ec28691a367d6b0edd62f73268dbf6b569150b50d3

The above transaction has been pending for 5 days, low gas I guess,
I sent to ether delta to make sure address was correct,before further deposit.
This is obviously blocking further transactions,
What can I Do? Sent via metamask but transaction history not showing it, only on etherscan, IF I had history I could probably pay extra gas,
MEW has a offline tx generator, can I open a mew wallet via mew and over write this transaction with higher gas same nonce,,Thanks


texts:
I created the server based on golang.
This server can load smart contract that is deployed using its address.
It works on my local machine, but it does not work on EC2 instance.
So I decided to develop it based on nodejs.
But I can't find how it can load same smart contract in nodejs.
Please help me.
Thanks.


texts: web3 - get contract from transaction object

texts:
I am fetching the latest blocks transactions using web3 and then I use the getTransaction(txhash) function to get the transaction object. I was wondering, how could I get the information about which token has been transferred with this transaction? The object itself does not contain a property like contract address, only from, to, value and so on.
Is this even possible? If not, how can I determine which token had been sent with a transaction without explicitly subscribing to a contract address and only fetch these transactions? I want to fetch all token transactions using web 3 and monitor the transfers.
Regards


texts: What is the point of having stateRoot rather executing every transaction?

texts:
EVM is a deterministic meaning that if any two(or more) nodes receive identical transactions in the same order(which is what blockchain is for), they will arrive at the same state independently. And there wouldn't be any need for each node to execute all the code. Which would simplify everything to an order of magnitude and would allow each node to decide what transactions they actually want to execute.

As I understand the fact that we have hashes for each state allows us to make requests for the state with that hash to other nodes rather than computing it ourselves. So another question is how much computing does it saves? Is that approach faster? And would it be actually viable to try the approach I offered?


texts: Cannot connect to rinkeby using web3 from 8545 node js?

texts:
I am trying to connect to a rinkeby full node in ubuntu terminal and i have a node js app deployed trying to connect using web3 when  consoling the nodejs app getting connection error

  if (typeof web3 !== 'undefined') {
        web3 = new Web3(web3.currentProvider);
    } else {
        // set the provider you want from Web3.providers
        web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
    }

Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545.
    at Object.InvalidConnection (/var/www/ethernode/node_modules/web3/lib/web3/errors.js:31:16)
    at HttpProvider.send (/var/www/ethernode/node_modules/web3/lib/web3/httpprovider.js:93:18)
    at RequestManager.send (/var/www/ethernode/node_modules/web3/lib/web3/requestmanager.js:58:32)
    at Eth.get [as coinbase] (/var/www/ethernode/node_modules/web3/lib/web3/property.js:107:62)
    at app.get (/var/www/ethernode/app.js:37:29)
    at Layer.handle [as handle_request] (/var/www/ethernode/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/www/ethernode/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/var/www/ethernode/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/var/www/ethernode/node_modules/express/lib/router/layer.js:95:5)
    at /var/www/ethernode/node_modules/express/lib/router/index.js:281:22

some one in stack overflow told to change the localhost to public Ip address , and that also didn't work , some one tell me what is happening here ?


texts: Social networking websites build in ethereum blockchain have instant block time while in the main ethereum network it ranges from 10-20 seconds why?

texts:
I'm new to blockchain actually and I have an idea of a social app and want to build it in blockchain because of complete transparency and privacy-friendly and so.

But I feel that it might piss off the users if it takes much time to update or post content.


texts: How to create a multiple contract with multiple instance

texts:
I would like to know how to create (via another contract or something else) several instances of the same contract with different parameters.

For example create several different ERC20 on demand with different parameters, values, ...

Also would it be possible to create other types of contract like ERC721, with the same principle?


texts:
How does Ethereum handle the integration of an uncle Block? Because, as far as I understand, there could be the possibility that an uncle contains a transaction, which compets with a transaction from a valid block.Thus the mempool of every Miner differs from another, right?

Thanks for the answers.


texts: How to import web3 utils in front end Javascript

texts:
I need to use a web3.utils.soliditySha3 function in my javascript but web3.utils gives:

Cannot read property 'soliditySha3' of undefined

My script can't use .require as well. I tried:

<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js"></script>

to no avail. Please help.


texts: How to showcase stats of live crowdfun in a website?

texts:
I am not completely sure where to find the answer to this. I went over the etherscan.io documentation and I was still confused. I am not sure if I simply create an API related to my account and then copy the address of the contract that I wish to show stats for and insert it into the https code.

The part that says "apikey=YourApiKeyToken" in the documentation confuses me as I don't know if thats the API from an specific contract or simply the API I created?

Any information is greatly appreciated!


texts: How does an Import Wallet work in Ethereum?

texts:
How to provide import wallet option in Ethereum bloackchain?
How does is imports/ how import wallet works?


texts: contract.address is undefined when deploying a contract with cpp-ethereum and ethconsole

texts:
I want to create new contract using cpp-ethereum (built from source) and
ethconsole. I followed this guide: https://www.ethereum.org/greeter.

I modified the contract to contain only one class without functions to minimize the gas cost:

contract greeter{
}

I'm doing this on test network and I have 5 ether on my account.

Here's the js code that I got after using online Solidity compiler:

 web3.eth.getAccounts(function(err, accounts){
    var account = accounts[3];
    console.log("Using account: " + account);
    var greeterContract = web3.eth.contract([]);
    var greeter = greeterContract.new(
    {
        from: account,
        data: '6060604052600a8060106000396000f360606040526008565b00',
        gas: 3000000
    }, function(e, contract){
        console.log(e);
        console.log(contract.address);
        if (typeof contract.address != 'undefined') {
            console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
        }
    })
  })

This is the output that I get:

null
undefined

For some reason, contract is not deployed, function returns no error and contract.address is undefined.

Am I missing something?


texts: How to know if transaction is failed due to insufficient balance?

texts:
I want to know if it is possible to know from "error" object returned by geth  that the error it was due to insufficient balance (something to compare with)

I have a js code like that:

mycontract.storeData("some-data")
     .then(res => {
          // transaction confirmed
            })
     .catch(error => {
     // I want to know the cause if the error (programmatically) like error.statusCode ... ?
  })


texts: Can the Android Metamask Extension be used with DApps?

texts:
I've successfully downloaded the Metamask Firefox Add-on, and imported my wallet into it.

However I'm failing to see how I can use this add-on from within my DApp like I do on Chrome, using the Metamask Chrome Extension.

What are the full capabilities of the Firefox add-on ?


texts: Contract with default function that uses more than 2,300 gas

texts:
I'd like to make a smart contract that I can interact with that I can do two things with:

Be able to send Ether from it to a presale smart contract
Has a default function that uses more than 2,300 gas

I'm trying to make this as an attacker contract to test some vulnerabilities with https://github.com/MysteriumNetwork/Contracts/blob/master/Presale.sol, as I'd like to use it in the future for a presale as well.

This contract throws after a failed send on multiple occasions, with two of the occasions being open to draining of the smart contracts if the msg.sender has a default function using more than 2,300 gas.

I'd like to see if it's possible to make an attacker contract that can drain the presale contract and then test it out.

I know I can use:

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

as the attackers contract default function to have it use more than 2,300 gas, but I don't know how I can send Ether from the attacker contract to the presale contract, since you have to have a balance with the presale, and then be able to call the refund() function (where the main vulnerability lies) from the attacker contract.


texts: Is it possible to change the block target time?

texts: We're curious to know what factors go into block times in a private network with a limited number of validators. Is this fixed or can it be parameterized in any way? How is it related to block times in the public net?


texts: sendRawTransaction insufficient funds while there is enough balance

texts:
Sorry I probably create a topic that was answered multiple times but unfortunately I couldn't find a solution. I'm trying to use RPC server of Geth to send a raw transaction. I've an address with a balance enough and a private key for that address, so I'm trying to call sendRawTransaction and it throws an error "insufficient funds for .. blabla". I have encoded the raw transaction correctly (I believe) since rlpdump shows a correct output. Please help me to find a reason what is happening

What do I have:

The latest version of Geth is running in the fast mode
99.99% synchronization
An address with 0.5 Ether and a private key of that address
An address of a recipient
C++ client application that uses the RPC server of Geth

I encoded the following fields of the raw transaction according to RLP:

Nonce (since there weren't any transactions from the address I've set it to 0x0)
Gas price (Getting it from RPC server by appropriate method, 0x3b9aca00 Wei)
Gas limit (Getting it from the latest block, now it is 5000)
Address of the recipient
Amount in Wei (I'm trying to send 0.05 Ether so it's 0xb1a2bc2ec50000 Wei)
Empty string

Then I calculate Keccak-256 hash from that RLP encoded byte array and sign the hash by the private key by using ECDSA from OpenSSL. Afterwards I append V value to the RLP encoded byte array (V = chaindID * 2 + 35 = 37) and both R and S from calculated signature.

Then I convert the total byte array to hex string, prepend it with 0x prefix and send it to the RPC Server by JSON RPC request eth_sendRawTransaction. And finally I get the error insufficient funds. Please any ideas how to solve it, thanks in advance

P.S.: Please don't show me examples of EthereumJS usage and same libraries for other languages, I don't need any libraries, I'm just trying to understand how should it work in details

UPD: The problem was in wrong signature calculation


texts: Public Nodes that Work with web3 Filters

texts:
I am attempting to connect to the Ethereum blockchain and monitor transactions as they are broadcasted. I don't have the capability to run a full node on my computer, so I am relying on "third party" nodes to connect to the blockchain. The two that I have been trying are "https://mainnet.infura.io/ [MY PRIVATE KEY]" and "https://api.myetherapi.com/eth". To retrieve newest transactions I am using the web3 python module filters. However, when I execute this code, as inspired by here and here:

from web3 import Web3, HTTPProvider
import time

node = #DEPENDS
connection = Web3(HTTPProvider(node))

block_filter = connection.eth.filter('latest')

time.sleep(60) #OR LONGER
print(block_filter.get_all_entries())

If my node is the infuria one, I get the error "requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://mainnet.infura.io/ [MY PRIVATE KEY]". If I use the myetherapi one, the result is simply an empty list.

Are there any other HTTP nodes that I could use to connect to the blockchain? Or is the problem with my code?


texts: Accessing non-active account on metamask

texts:
I want to transfer ownership of an already notarized file with a particular address.  I am using smart contract and representing ownership by "msg.sender" i.e. selected account in metamask is the owner.

Problem is that I am trying to call smart contract function using a address from the metamask account list that is not currently active but I  am only able to fetch the currently selected one in metamask.

Is there any way to access the account not currently selected in metamask and making transaction using it?


texts: What is the Oracle Problem definition exactly and briefly? Does it mean "trusting on a centralized Oracle" ? Or "How to reach a consensus between a group of Oracles" ? Is the matter "centralization" or "being trust-based" ? (that is in contrary to decentralization feature of blockchain.)


texts: How to import artifacts, describe, it from Truffle

texts:
Instead of using truffle deploy, I want to create my own deploy.js script and run it using node deploy.js.

How can I import the classes/functions artifacts, describe and it, so we can do like so:

var Foo = artifacts.require('./Foo');

describe('Deploying', async () => {
    it('Deploying Foo', async () => {
        let foo = await Foo.new()
    })
})


texts:
I'm following along with this short tutorial and ran into a few problems. I'm running testrpc in my console. However, every time I run my index.html I get an error. My index.html file is the following:

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

Coursetro Instructor

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

and Uncaught Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545.

both occur only when I try to execute web3.eth.accounts[0].

The weirdest part about all of this is the fact that this was running fine last night. However, after closing chrome, I opened this up again and I had this error. Anybody know what to do?

Thank you so much in advance


texts: New to Ethereum. Just bought ethers from eBay. How do I transfer them to my own wallet?

texts:
I purchased ethers from an eBay seller and the seller sent me a public and private key for etherchain.org. I have a Jaxx wallet and was looking to transfer my purchased ethers to it, but I have absolutely no clue how to do that.

The seller said that they don't send to wallets and that everything is available on the public ledger. I can see it on the public ledger but I'd rather have it in my private wallet. I just don't like that we both have the private key.

Any guidance would be much appreciated

FNG


texts: Known states for testnet on fast sync mode Nov - 2018

texts:
Whats the current knownStates for testnet on fast sync mode Nov - 2018

Is there an online service which provides the current states of the ethereum testnet.

It been several days and --testnet fast sync haven't completed yet:

> eth.syncing
{
  currentBlock: 4488662,
  highestBlock: 4488733,
  knownStates: 60311013,
  pulledStates: 60309733,
  startingBlock: 4474887
}


texts:
contract MyContract {
    uint public len;
    mapping(uint=>byte) public names;
    function initContracts(byte[] contractNames_){
        for(uint i=0;i<contractNames_.length;i++){
            names[i]=contractNames_[i];
        }
        len=contractNames_.length;
    }
}

When I use Mist, and pass [0x01,0x02,0x03], it seems that
byte[] contractNames_ can not be assigned to storage mapping names, and variable len remains 0.


texts:
Trying to learn blockchain.
I executed the following command to mine:
geth -datadir="/media/Osiris/privatechain" -mine

But the execution does not proceed beyond looking for peers as shon below :
INFO [09-10|11:25:22.306] Commit new mining work                   number=1 sealhash="b08025…681105" uncles=0 txs=0 gas=0 fees=0 elapsed=18.718ms
INFO [09-10|11:25:24.976] New local node record                    seq=2 id=0ed19f8d8511b2b8 ip=155.4.151.40 udp=30303 tcp=30303
INFO [09-10|11:25:32.953] Looking for peers                        peercount=0 tried=13 static=0
INFO [09-10|11:25:46.926] Looking for peers                        peercount=0 tried=9  static=0
INFO [09-10|11:25:56.927] Looking for peers                        peercount=0 tried=5  static=0
INFO [09-10|11:26:06.928] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:26:16.929] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:26:26.930] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:26:36.931] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:26:46.932] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:26:56.933] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:27:06.934] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:27:16.935] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:27:26.936] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:27:36.937] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:27:46.938] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:27:56.939] Looking for peers                        peercount=0 tried=3  static=0
INFO [09-10|11:28:06.940] Looking for peers                        peercount=0 tried=5  static=0
INFO [09-10|11:28:16.941] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:28:26.942] Looking for peers                        peercount=0 tried=3  static=0
INFO [09-10|11:28:36.943] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:28:46.944] Looking for peers                        peercount=0 tried=2  static=0
INFO [09-10|11:28:56.944] Looking for peers                        peercount=0 tried=3  static=0
INFO [09-10|11:29:06.945] Looking for peers                        peercount=0 tried=3  static=0
INFO [09-10|11:29:16.946] Looking for peers                        peercount=0 tried=5  static=0
INFO [09-10|11:29:26.946] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:29:36.947] Looking for peers                        peercount=0 tried=3  static=0
INFO [09-10|11:29:46.948] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:29:56.949] Looking for peers                        peercount=0 tried=7  static=0
INFO [09-10|11:30:09.458] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:30:19.459] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:30:29.459] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:30:39.460] Looking for peers                        peercount=0 tried=4  static=0
INFO [09-10|11:30:49.462] Looking for peers                        peercount=0 tried=2  static=0
INFO [09-10|11:30:59.463] Looking for peers                        peercount=0 tried=5  static=0
INFO [09-10|11:31:09.464] Looking for peers                        peercount=0 tried=4  static=0

I guess, to mine means adding a block to the genesis block. Am i right ?
What does looking for peer means ? Is it a separate node where miners contest to create a block ?If it is so then how can i add another peer?


texts: The average number of pending transactions within the pending pool

texts:
Is it possible to know the average number of pending transactions for a larger period of time? For this chart (https://etherscan.io/chart/pendingtx), I can only figure the most recent 5 days. I would like to make an estimation about the average pending transactions, so it would be great if I can get the data within a larger period of time.

While it is feasible to use web3 API to get the real-time pending transactions, I am wondering whether it is also feasible to collect the historical data.


texts: web3.js Error: the method personal_listAccounts does not exist/is not available

texts:
Code:

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

var sender = web3.eth.accounts[0];
console.log('Sender: ' + sender);

web3.personal.listAccounts;

Output:

Sender: 0xA0A0A01

home/ubuntuuser/node_modules/web3/lib/web3/requestmanager.js:61
    throw errors.InvalidResponse(result);
    ^
Error: The method personal_listAccounts does not exist/is not available
at Object.module.exports.InvalidResponse (/home/ubuntuuser/node_modules/web3/lib/web3/errors.js:38:16)
at RequestManager.send (/home/ubuntuuser/node_modules/web3/lib/web3/requestmanager.js:61:22)
at Personal.get [as listAccounts] (/home/ubuntuuser/node_modules/web3/lib/web3/property.js:107:62)
at Object.<anonymous> (/home/ubuntuuser/Desktop/Ethereum/ethy.js:63:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)

Question:

From the above, commands like web3.eth.accounts[0] works fine, however web3.personal.listAccounts; doesn't. Why might that be the case?


texts: Does Swarm incorporate the Git protocol like IPFS does?

texts: Does Swarm use Git for updating documents, like IPFS does, or does it use something else? I couldn't figure this out from reading any of the documentation?


texts: I want to withdraw amount from Receiver Contract's tokenFallback() function in ERC223 how to implement this scenario?

texts:
I am using ERC223 standard token transfer contract and receiver contract which includes tokenFallback(). I've transferred tokens from my ERC223 contract to receiver's contract address, now I want to get them back using withdraw functionality to msg.sender's address. How to do that inside tokenFallback()?

Here is my Receiver contract's code snippet,

contract ContractReceiver {

      address public owner;
      address public sender;
      uint public value;
      bytes public data;

      constructor() public payable{
         owner = msg.sender;
         balanceOfMyAccount = msg.value;
      }
      modifier onlyOwner(){
         require(msg.sender == owner);
         _;
      }

     function tokenFallback(address _to, uint _value, bytes memory _data) public {
        sender = _to;
        value = _value;
        data = _data;
     }
}


texts: How does number of miners impact in processing the business logic(smart contract) in Blockchains

texts:
Does a number of validating devices/miners have an impact on processing business logic?

If I understand correctly, as the number of validating devices increases, the time it takes to reach the consensus also increases in case of stateful logic. In case of processing the stateless logic, it should be even more.


texts: Code Example from “Mastering Ethereum: Building Smart Contracts and DApps” doesn't work

texts:
I'm reading the Ethereum book of Gavin Wood right know and the following code example gives an error message when I try to compile it with truffle:

pragma solidity ^0.4.22;

contract calledContract {
    event callEvent(address sender, address origin, address from);
    function calledFunction() public {
        emit callEvent(msg.sender, tx.origin, this);
    }
}

library calledLibrary {
    event callEvent(address sender, address origin,  address from);
    function calledFunction() public {
        emit callEvent(msg.sender, tx.origin, this);
    }
}

contract caller {
    function make_calls(calledContract _calledContract) public {
        // Calling calledContract and calledLibrary directly
        _calledContract.calledFunction();
        calledLibrary.calledFunction();

        // Low-level calls using the address object for calledContract
        require(address(_calledContract).
                call(bytes4(keccak256("calledFunction()"))));
        require(address(_calledContract).
                delegatecall(bytes4(keccak256("calledFunction()"))));
    }
}

https://github.com/ethereumbook/ethereumbook/tree/develop/code/truffle/CallExamples

It gives the following error message:

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined

Any ideas?


texts: How does an Ethereum node understand that 51% confirmations have been obtained?

texts:
In a private Ethereum setup:

How does a node that computed the nonce understand that 51% of the nodes have confirmed the mining?
Is there some kind of a counter maintained which shows number of confirmations?
Are the nodes which confirmed the mining rewarded with some amount of Ethers?
Does a node confirmation mean that along with confirming the nonce, all the transactions in the block are also confirmed?


texts: Ethereum testnet balance not getting updated

texts:
I have sent 1ETH to my newly created address in testnet.
The node chaindata is updated and syncing is done (eth.syncing gives false). Also if I do eth.getBlock(2670189), I can see my TxHash in the JSON. But eth.getBalance on the account gives 0.

System config: Google Cloud VM with 4 vCPUs, 12 GB memory, Ubuntu 16.04.3 LTS

TxHash: 0x6f1262ec20c80835113d474b0c9d15c980ed61bb06440ee6960ea1d9531a3097


texts: ABI changes when element is added to contract array

texts:
I notice that when I call a function to add an item to an array in one of my contracts, the ABI of the contract changes. The array is declared as

Proposal[] public proposals;

and the method that adds looks like this:

function newProposal(
        address beneficiary,
        uint etherAmount,
        string JobDescription,
        bytes transactionBytecode
    )
        onlyShareholders
        returns (uint proposalID)
    {
        for(uint i = 0; i < proposals.length; i++)
          if (sha3(proposals[i].description) == sha3(JobDescription))
            throw;

        proposalID = proposals.length++;
        Proposal p = proposals[proposalID];
        p.recipient = beneficiary;
        p.amount = etherAmount;
        p.description = JobDescription;
        p.proposalHash = sha3(beneficiary, etherAmount, transactionBytecode);
        p.votingDeadline = now + debatingPeriodInMinutes * 1 minutes;
        p.executed = false;
        p.proposalPassed = false;
        p.numberOfVotes = 0;
        ProposalAdded(proposalID, beneficiary, etherAmount, JobDescription);
        numProposals = proposalID+1;

        return proposalID;
    }

Interface:

  ..., { "name": "description", "type": "string", "value": "Let's change
  the world!" },...

My question is why and when does the ABI change, and weather it has any effect on the geth client instances to which I have already added the ABI by specifying the contract's deployment ABI and address.


texts:
Is there any benefit or detriment to keeping the same endodeId by maintaining the keystore when performing a fresh sync on an otherwise already in sync node?

By maintaining the endodeId does it confuse peers who have seen your node before in a sync'd state? Or does it lower your reputation by suddenly asking for data you should already have? Peers who discovered your enodeId previously don't need to re-learn a new endodeId, could that result in getting peers faster?

I have static-nodes configured and changing enodeId means I have to modify the static-nodes. So which path is more beneficial? Leave the endodeId and start the re-sync, or start fresh with a new enodeId and modify my static-nodes files?


texts: How Do You Best Calculate Whole Years Gone By In Solidity?

texts:
According to the Solidity docs, you cannot precisely calculate years based on the block.timestamp. I have an interest function compounding on an annual basis, so I only care when a whole year has gone by. If there are 2.99 years gone by since the contract was deployed, the interest calculation will consider that 2 years.

What is the best way to do this?

Here is what I have:

    uint public InitialBlockTime; /*Which is set in the contract constructor.*/

    function CalculateYearsGoneBy() public {
        YearsGoneBy = ((block.timestamp - InitialBlockTime)/31556926);
    }

31556926 is the average amount of seconds per year. Block timestamps are based on the Unix Epoch.


texts: Questions with Building a dapp using Quorum

texts:
I am working on a project to build a dapp for a trust system using Quorum, which needs a permissioned blockchain for data privacy. Only the admin, beneficiary, caregivers, case manager and authorized person can access the trust system. I am a beginner of blockchain and Ethereum and all those related things. Here are my questions so far:

1) I have tried to follow truffle Quorum tutorial. That quorum-examples includes the 7Nodes. What if I need more than 7 nodes? And I have no idea how I can use Quorum, not the quorum-examples, to build my dapp. Are there any tutorials not using the example?

2) The trust system involves a number of actors. They have to login before accessing the real system through the frontend website. Admin will be responsible for creating the trust and relevant accounts. How should I set the account of admin? Should I use admin as the owner of the trust system?

3) How should I save those username, password, etc., if I don't want them to be saved on the blockchain?

Thanks in advance!


texts: Sent ether from wallet to bittrex, 12 hours later no balance on bittrex

texts: So I made an account on bittrex and I created a hex address so I could transfer over my ether, I went into my wallet and sent 0.1 ether to bittrex, 12 hours later my bittrex account still shows a 0 balance. Anybody got any ideas what I did wrong??


texts: How does solidity find positions within a bytes array?

texts:
My understanding of arrays is that the initial storage point of the array is used to find the beginning of the array, and finding specific items in the array from that point forward require even distribution of elements, as the product of the index number and the size of one element leads to the beginning of the desired element (so if I want bytes32[3], it starts at the storage point and moves ahead 2 x 32 bytes).  Also, since the machine "knows" that it is 32 bytes per slot, it knows where to stop reading.

However, in remix, it seems that when creating a bytes[], it allows each element to be of arbitrary length, and even much larger than 32 bytes.  Also, readthedocs.io states that bytes is cheaper and is "packed tightly in call data".  This suggests that there is no fixed allocation space for each element.

So then, how does this kind of array work, since it cannot be iterated through in the manner described above?  And if it is possible to iterate through an array with arbitrary-sized slots, why aren't all arrays made with this versatility?


texts:
I was following this article. When I saw that I've to have this keccak256-sum, I moved to this GitHub repo.

But, when I am building it, it's giving below issue.

    $ make
cc -Wall -Wextra -pedantic -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs -Wtrampolines -Wfloat-equal -Wshadow -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-variadic-macros -Wswitch-default -Wpadded -Wsync-nand -Wunsafe-loop-optimizations -Wcast-align -Wstrict-overflow -Wdeclaration-after-statement -Wundef -Wbad-function-cast -Wcast-qual -Wlogical-op -Wstrict-prototypes -Wold-style-definition -Wpacked -Wvector-operation-performance -Wunsuffixed-float-constants -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-attribute=format -Wnormalized=nfkc -std=gnu99 -O3 -c -o obj/keccak-224sum.o src/keccak-224sum.c
In file included from src/keccak-224sum.c:19:0:
src/common.h:24:23: fatal error: argparser.h: No such file or directory
compilation terminated.
Makefile:87: recipe for target 'obj/keccak-224sum.o' failed
make: *** [obj/keccak-224sum.o] Error 1

& even though I cloned and build this repo.

But, still I'm not able to resolve it.
is anyone using the keccak256-sum ?

My aim is to generate & get hold onto the complete key-pair generated for Ethereum. I'm not interested in generating just an address for Ethereum blockchain. If you can refer other node modules, I'm fine with that too.


texts: Convert string to uint with decimal places

texts:
I'm using an oraclize contract and would like to convert the string result to an integer, but somehow keep track of the decimal places (like show multiplied by 1000).
Say for instance the result is "290.025", I would like to get 290025 as the int.
Here is the oraclize call back code that doesn't work:

function __callback(bytes32 _oraclizeID, string _result) {
      require(msg.sender == oraclize_cbAddress());
      Value = mul(parseInt(_result),1000);
    }

The problem here is that parseInt (an oraclize function) drops the decimal places.  So how do I convert string to int and keep the decimal places for multiplication?


texts: What's next after compiling using Solidity Compiler command line and getting the binary?

texts:
I compiled my code using the command line:

solc --bin file.sol

It creates a binary like: 653980298309f02f03.......

What's the next step? I want to deploy it using the same command line.


texts: "Error! Missing Or invalid Action name" Etherscan API error

texts:
I created a utility in my function to get the status of transactions using Etherscan APIs. It was working well until recently. Here's the function:
def get_eth_or_usdt_transaction_status(transaction_hash, currency):
    action = "gettxreceiptstatus" if currency == ETHEREUM else "getstatus"

    url = f"{etherscan_base_url}?module=transaction&action={action}\
        &txhash={transaction_hash}&apikey={settings.ETHERSCAN_API_KEY}"
    url = strip_str(url, "url")

    response = requests.get(url, headers=headers).json()
    return response

The fucntion above returns:
{
    'status': '0',
    'message': 'NOTOK',
    'result': 'Error! Missing Or invalid Action name'
}

Nothing actually changed in the code. What could be wrong?


texts: Getting 'base fee exceeds gas limit' on a transaction which requires a small amount of gas

texts:
I have the following contract:

pragma solidity ^0.4.24;

contract MyContract {
    address public owner;
    bool public unlocked;

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

    function lock() external {
        require(owner == msg.sender);
        unlocked = false;
    }
}

I run Ganache v6.1.0 configured with --gasLimit=0xfffffffffff and --port=8545.

Then, I upload this contract and try to invoke the lock method via web3 v1.0.0-beta.34:

let fs = require("fs");
let Web3 = require("web3");

let web3 = new Web3("http://localhost:8545");

async function deploy(contractName) {
    let abi = fs.readFileSync(contractName + ".abi").toString();
    let bin = fs.readFileSync(contractName + ".bin").toString();
    let contract = new web3.eth.Contract(JSON.parse(abi));
    let handle = await send(contract.deploy({data: "0x" + bin}));
    return new web3.eth.Contract(JSON.parse(abi), handle.contractAddress);
}

async function send(transaction) {
    let gas = await transaction.estimateGas({from: PUBLIC_KEY});
    let options = {
        to  : transaction._parent._address,
        data: transaction.encodeABI(),
        gas : gas
    };
    let signedTransaction = await web3.eth.accounts.signTransaction(options, PRIVATE_KEY);
    let receipt = await web3.eth.sendSignedTransaction(signedTransaction.rawTransaction);
    return receipt;
}

async function execute() {
    let myContract = await deploy("MyContract");
    let transaction = myContract.methods.lock();
    await send(transaction);
}

execute();

Calling execute() --> send(transaction) --> web3.eth.sendSignedTransaction(...) yields:

  base fee exceeds gas limit

Any idea what's causing this?

The only observation that I've found useful so far, is that this specific transaction requires a very small amount of gas (around 13000) in comparison with at least twice for any other transaction executed in my script.

By the way, this problem does not occur when I use Parity instead of Ganache.

Perhaps this is another hint.

Thank you!


texts:
I created a genesis file and saved it in a folder called node1.
Then I entered the following command:

geth init "C:\rahul13615\blockchain\node1\genesis1.json"

Folder named chaindata was created and certain space was allocated to me.
Then I entered:

geth --fast --cache 512 --networkid 321 --datadir "C:\rahul13615\blockchain\node1" --identity "FirstNode"

Few more folders like dapp, keystore, nodes and a file named nodekey were created.
Then I used personal.newAccount("Test1") to create a new account on my newly created node.
I used the account's address and added the following in genesis file:

"alloc": {
    "0xb4c55eae41809524f570be88ef9be0b108b993b8" :
    { "balance": "20000000000000000000" }
}

I saved this file and re-entered commands in step 2 and 4 to read the updated genesis file.
Then I entered primary = eth.accounts[0]; this returned me the address of the account I created.
Then, balance = web3.fromWei(eth.getBalance(primary),"ether")

Ideally it should return 20 ethers but it is returning 0.
Please help me understand where i went wrong?


texts: What is the best OS to run an Ethereum node on?

texts:
It was recommended that running your own node is beneficial for learning as well as for the network and community.

Is there any reason to use one OS over another for running an Ethereum node?

I might dive into mining for research and study purposes but I don't plan on using it to mine Eth or anything of the sort.


texts:
I was looking into the ERC20 Token Standards and Crowdsale.
There are various sample contracts including the one from OpenZeppelin which exhibits locking the token transfers until the crowdsale is over.

Instead of a simple locking and unlocking mechanism, can we lock the tokens sold in pre-sale for a longer period than the tokens sold in the subsequent sales? How can we do that without changing the ERC20 standards?


texts:
I was able to use remix, an online compiler for solidity. However, I can't anymore. When I go to the website, I cant even see the files under "file explorer", it is just empty.
When I click "New File" on the home screen, it doesn't even create one. What is happening?
Website:
https://remix.ethereum.org/


texts: I created a offline paper ethereum wallet

texts:
I have been trying for days to try check this paper wallet to see if it has a balance so I can know if it is safe to move more ethereum to it please
My public address 0x9826eb8a401e88e121243e879e6f5442e4ec09de


texts: web3.eth.sendSignedTransaction takes too long time, which strategy?

texts:
Until now, I used rinkeby test network, where things are a lot faster, i discovered.

I was doing this

    const receipt = await web3.eth.sendSignedTransaction(signed_tx.rawTransaction);
    console.log(receipt.transactionHash);
    console.log(receipt.gasUsed);

So I can send signed transaction, ans simply wait to get the tx hash.

I tried on main net and, to keep gas cost lower, it takes also 15 minutes per transaction to be mined.

My caller script goes in timeout a lot earlier than 15 minutes.

Is there a way to simply 'fire' the sending but obtaining the transactionHash anyway without keep listening for a long time?

Have you other strategies to suggest me?

I recently discovered contract events. So i'm firing an event when the called function ends. But is this a good way to fight this problem?

Web3Js version is set as: "web3": "^1.2.6",


texts: How much total supply should I have to a newly created token?

texts:
I've created a BEP20 token and I can't figure out some steps.

The total supply? How big the number must be?


texts: How does secure communication (e.g. HTTPS) with a Smart Contract work?

texts:
I'm working on a smart contract to run a fair lottery game. The winner is chosen by way of random number generation. The current plan is to get the random number from an oracle source. However, this has made me wonder - how does the oracle communicate the number to the blockchain securely?

Because everything in a smart contract is visible (much like anything stored in a HTML file) they cannot hold a private key without it being visible so any public-private key encryption is no longer secure? Therefore how do you know that the externally generated random number has been sent to your smart contract securely and not been intercepted and changed along the way? The scenario that jumps to mind is when the random number is committed to the blockchain but miners could reject it if it didn't result in a win for them (same reason using an external random number generator is recommended). So how does it happen securely?

Any thoughts/explanation/instruction would be great!


texts: Is it convenient to use mappings as temporary KeyValue instances?

texts:
Consider the following contract that illustrates the problem. Here we have a dynamic array of mappings, add() is meant to add a fresh new mapping to the end of the array, return the value for mapping key 0 and change that value to true. remove() in turn is meant to remove the last mapping from an array.

contract ClearMapping {
    mapping(uint => bool)[] state;

    // 1. add -> false
    // 2. remove
    // 3. add -> true
    function add() returns (bool) {
        uint pos = state.length++;
        bool curr = state[pos][0];
        state[pos][0] = true;
        return curr;
    }

    function remove() {
        state.length--;
    }
}

One can think that removing a mapping element from an array effectively clears that mapping, and that adding a new mapping in place of the old one will have a fresh, all key* -> false, element. It turns out that it is not true.
Same thing happens if you try to swap elements that have mappings inside, everything will be swapped except of mappings.

The only solution I see to deal with this, is by manually delete/reassign every used mapping key, but it becomes costly in terms of gas usage very fast.

The questions I'm looking to answer is:

Is this a bug in EVM/Solidity?
Is there a convenient/effective way to clear/swap mappings?
Should I not use mappings as temporary KeyValue instances?

Thanks for the attention!


texts: How to provide balance to validator nodes after blockchain creation private blockchain POA

texts:
I'm working with a private Ethereum blockchain PoA with three validator nodes. I have initially added three wallet addresses to get some free ethers. However, when I checked the balance of one of the node today, it's showing zero.
So, my question is, how can we provide free ethers to that account after the chain is created?
Note: Gas price of all transactions are zero, I'm only sending 100 ethers when new user registered with the system.


texts: In Casper, theoretically how many validators could participate in consensus-by-bet (at any given block)?

texts: Is the number of validators (at any given block) limited, and what is the theoretical upper limit?


texts: How to allow an account to withdraw from another one?

texts:
The goal is to create a contract which allows party B to withdraw from party A's account according to some formula. I don't want to use an escrow model, rather just to:

Let A attest that they are okay with B withdrawing at some future point in time.
Set a threshold for how much/ long B can withdraw.

Are there any examples or best practices for this?


texts: Why does my smart contract method fail when called via Web3.js with more than one argument?

texts:
Observation(s):

When calling a compiled smart contract method via Web3.js, my contract method createOrder succeeds when the method only accepts (1) argument.

Upon updating and re-compiling the smart contract method such that the method requires (2) arguments, calling the method with the required 2 arguments produces an error: `Error: Returned error: VM Exception while processing transaction: revert.

Expectation(s):

I expect for the contract method createOrder to be executed successfully without error(s) when the method is supplied with arguments of the correct number and appropriate type.
I expect a new transaction to be created and for the ReceivedWebOrder event to be recorded with the arguments specified.

Notes(s):

The contract executes as expected when plugged into the Remix online IDE. To me, this suggests I'm not calling the Web.js method correctly

System Info:

Web3 version: 1.2.1
Node version: 12.10.0
Truffle version: 5.1.32
Ganache version: 2.4.0
Platform: MacOS Mojave (10.14.6)

Smart Contract
pragma solidity >=0.4.21 <0.7.0;

import "../lib/safemath.sol";

contract CuizzineWebOrder {

    event ReceivedWebOrder(string order_id, string customer_id);

    struct WebOrder {
        string order_id;
        string customer_id;
        string restaurant_id;
        address customerWalletAddress;
        address restaurantWalletAddress;
        uint256 totalETH;
    }

    function createOrder(string memory order_id, string memory customer_id)
        public
    {
        emit ReceivedWebOrder(order_id, customer_id);
    }
}

Web3.js Code
/** DEPENDENCIES */
const contractABI = require("./build/contracts/CuizzineWebOrder.json").abi;
const contractAddress = "0x0b82152Cc62e15Bd390649eCe96c170fc7375FBf";

/** APPLICATION */
(async function myApp({ contractABI, contractAddress }) {
    const Web3 = require("web3");
    const myWeb3 = new Web3();
    const wsProvider = new myWeb3.providers.WebsocketProvider("ws://localhost:7545");
    myWeb3.setProvider(wsProvider);
    const myContract = await new myWeb3.eth.Contract(contractABI, contractAddress);
    const [customerWalletAddress, restaurantWalletAddress] = await myWeb3.eth.getAccounts();

    const myWebOrder = {
        customerWalletAddress,
        restaurantWalletAddress,
        order_id: "XEO1reMLnJhlf7JcZNJB",
        customer_id: "UUCzbG5zdZ6VS4oPQyJK",
        restaurant_id: "8KbG1mFLeCMGSDZyEnL4",
        totalETH: myWeb3.utils.toWei("0.10082464543958122")
    };

    try {
        myContract.events.ReceivedWebOrder()
            .on("data", onReceivedWebOrder)
            .on("error", onError);

        const result = await myContract.methods.createOrder(myWebOrder.order_id, myWebOrder.customer_id).send({
            from: customerWalletAddress
        });
        process.exit(0);
    } catch (e) {
        console.warn("⚠  Ensure you are CONNECTED to a test network. If using Ganache, verify the workspace is configured properly.");
        onError(e);
    }

    function onReceivedWebOrder(data) {
        const { order_id } = data.returnValues;
        console.info(order_id);
    }

    function onError(error) {
        console.error(error);
        process.exit(1);
    }

}({
    contractABI,
    contractAddress
}));


texts: How does the constructor turn your compiled contract into a deployed contract?

texts:
The input is: you just compiled a contract

The output is: your contract is deployed

How did your constructor get from A to B? And how is the state storage reserved which is associated with your deployed contract.


texts: Remix warning - Is constant but potentially should not be.

texts:
I am getting the warning on the code shown below. Could you please assist me know to resolve this warning ?

warning message - "Is constant but potentially should not be"


texts:
The Baddies drained 3641694.241898506992612606 ETH via The DAO's child DAO #59.

When will the Baddies have access to the hacked funds on the Ethereum Classic chain?

See also:

Which split proposal was used to mount the recursive call vulnerability attack on The DAO?
How many ethers have been drained through the recursive call attacks on The DAO?


texts: I am now able to use truffle to deploy my contracts in my private blockchain. Now I want to understand how to integrate truffle with SWARM and IPFS for web app deployment. It will be helpful if you could share links giving actual examples this integration showing how to perform these operations.


texts: How to recover ether from Parity wallet with private key?

texts:
Given the multi-sig wallet vulnerability with Parity, I am curious why Parity wallet users are unable to access their ether using the private key provided by Parity?

Perhaps my understanding of the vulnerability (and the way Parity works, for that matter) is incomplete, but my assumption was that if you received ether to an Ethereum address that Parity created for you, you should be able to access that address using the private key. One could just use MyEtherWallet with their private key to access the funds in an address.

According to this answer, it appears Parity does not provide you with the actual private key and you would've had to use the ethkey generate random command to "export" the private keys?


texts: Are there apps to see total ether processed through a contract?

texts:
Building a TipFaucet for tipping a dev.

Using this contract, is it possible to look up how much has been payed through the contract?

contract TipFaucet {

    modifier isDev { if (msg.sender != // insert address here) { throw;} else { _;}}

    function withdraw() isDev {
        msg.sender.send(this.balance);
    }
}


texts: vm exception while processing transaction invalid opcode

texts:
I have been running this code in remix but getting error.

pragma solidity ^0.5.8;

// import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract DieselPrice is usingOraclize {

    uint public dieselPriceUSD;
    string public re;

    event LogNewDieselPrice(string price);
    event LogNewOraclizeQuery(string description);

    constructor() public {
        update(); // First check at contract creation...
    }

    function __callback(bytes32 myid, string memory result) public {
        // require(msg.sender == oraclize_cbAddress(),"cda");
        emit LogNewDieselPrice(result);
        re = result;
        // Log(result);
        // dieselPriceUSD = parseInt(result, 2); // Let's save it as cents...
        // Now do something with the USD Diesel price...
    }

    function update() public payable {
        emit LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer...");
        oraclize_query("URL", "xml(http://rss.cnn.com/rss/cnn_topstories.rss).rss.channel.item.0.title","asd");
    }
}

In truffle the error was invalid opcode,

in remix it shows  error: revert.
revert  The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value.

Please help


texts: Syncmode = full, and still getting "missing trie node"

texts:
I'm running on Rinkeby testnet with this command (I resynced the whole blockchain with this):

./geth --rinkeby --syncmode full --rpc --rpcapi "web3,db,eth,net,personal" --datadir /.../

and after the whole blockchain synced, I tried (again) to run this command:

I made this call:

{"jsonrpc":"1.0","id":"curltext","method":"eth_call","params":[{"data":"0x70a082310000000000000000000000004493b159852734e0112c2EfB4FB4aa3aBfb4827a","from":"0x4493b159852734e0112c2EfB4FB4aa3aBfb4827a","to":"0x7b1ad75e80606bc33ee19d7028290b14391429b6"}
,"0x186A0"]}

The block number there is an arbitrary number, 100000 (in hex). The call is to get the balance of some arbitrary token.

And received the error missing trie node.

Is there something else I'm missing?