texts: JSON on paper + password - how to access account?

texts:
When I created wallet on myetherwallet, I couldn't download the JSON file from unknown reason, so I just did the printscreen. Now, I'm stuck with the paper data of the json file (with encrypted private key) and the password for my wallet that I know.

How do I access the wallet with what I have?

Thanks in advance!


texts:
Trying to setup Parity and Kovan to use Melonport app. Downloaded latest stable version of Parity 2.0.7 from Github as instructed and double clicked parity.exe. Starts terminal session which seems to run endlessly - downloading, syncing blocks?

Although not explicitly instructed to do so I downloaded the .zip asset file for
Parity-Ethereum-2.0.7 and placed the parity.exe file in this main folder. This is the only .exe in the entire folder structure yet various online instructions indicate a ptray.exe which I assume launches the graphical UI.
Also added the --chain=kovan.json line to shortcut.

I noted somewhere that the sync can take some time.
Do I just check back in the morning when sync is finished or am I missing critical setup files?

Thanks In advance


texts: Sent Ethereum from Coinbase to Ledger Nano S ETC address by accident

texts:
Date- 20170420

Accidently sent about 46 ETH from Coinbase to Ledger Nano S Address.

The transactions shown below looks like a good transaction but not showing up on either ETH or ETC wallet on ledger nano s. Since i have the keys to the nano s address, shouldn't i be able to send them back to coinbase?

I contacted both ledger and coinbase support but both replies said they will get back to me but it could take a while.

Please tell me im not the only one whose done this! What are we supposed to do? My gut says to wait it out and it will time out by itself because it was sent from one chain to the other... but im not sure. Shouldn't the address exist on both chains?

Details are below. Thank you in advance for you time on this. Cheers.

−$2,300.22 USD TO Ethereum address
0x7D6f82315659316518de07084519C207D9e80dAc

STATUS Transaction confirmed
131 confirmations
6:32PM — April 20, 2017
COMPLETE

Transaction ID on etherscan - 0x65491f150ce5a4fa2fce0f2c3eb3c15911245105136ac30267ea2dd11f4ff116


texts: How to keep a geth node synchronised on a ubuntu machine?

texts:
The requirement is keep a geth node synchronised almost always for a DAPP . The geth node is running on a ubuntu machine. The command being used to expose the geth rpc server is

geth --testnet --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3 --rpcport 8545 --rpccorsdomain "*" --rpcaddr "127.0.0.1" --rpc

I usually connect to the server using putty . But when I close the putty session , the geth process also gets killed .I need to avoid this. What is required is to keep the geth syncing continuously , so that any user who uses the DAPP can make a transaction anytime.


texts: I just import the go-ethereum project in goland. But the configuration shows the error below, how to solve it?


texts: "consensus over state" vs. "consensus over events"?

texts:
Does someone know what is difference between "consensus over state" and "consensus over events" ?

I found just title of a reference i.e. "Ian Grigg, blog post “The Message is the Medium,” 2017."

However, I could not find any pdf, paper or article with this title. Just there is a very general and unclear information on this topic of consensus in "EOS - An Introduction". For example, it is not clear to me what does "Restart" mean in this document?

Is there better and more clear reference on this this type of consensus?


texts: truffle test: SyntaxError: missing ) after argument list

texts:
truffle test
Using network 'development'.

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

/home/ubuntutest/proyectoico/test/testMasterICO.js:18
  it("Does the first buy"; async function() {
     ^^^^^^^^^^^^^^^^^^^^

SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:743:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
    at Module.load (internal/modules/cjs/loader.js:666:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
    at Function.Module._load (internal/modules/cjs/loader.js:598:3)
    at Module.require (internal/modules/cjs/loader.js:705:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at /usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/usr/local/lib/node_modules/truffle/node_modules/mocha/lib/mocha.js:536:10)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:118:1
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

 Truffle v5.0.7 (core: 5.0.7)
Node v11.11.0

The code in the contract:

  it("Does the first buy"; async function() {
    const preBalance = await masterToken.balanceOf(addressTokenHolder1);
    const preTotalEth = await web3.eth.getBalance(addressEther);
    await masterToken.sendTransaction({
      value: web3.toWei(1),
      gas: 300000,
      gasPrice: "20000000000",
      from: addressTokenHolder1
    });
    const postBalance = await masterToken.balanceOf(addressTokenHolder1);
    const postTotalEth = await web3.eth.getBalance(addressEther);
    const currentBalance = postBalance - preBalance;
    const currentTotalEth = postTotalEth - preTotalEth;
    assert.equal(web3.fromWei(currentBalance), 1);
    assert.equal(web3.fromWei(currentTotalEth), 1);
  });
});

Thanks!


texts: Problem with truffle console : Cannot read property 'call' of undefined

texts:
I have a problem when executing the code

HelloWorld.deployed().balance.call().then(console.log)

This error introduced: Cannot read property 'call' of undefined
This problem is similar to this thread but it does not help on my case.

Thanks for your help!

My code is from this turorial

contract HelloWorld {
  address public owner;
  mapping (address => uint) balances;
  function HelloWorld() {
    owner = msg.sender;
    balances[owner] = 1000;
  }
  function transfer(address _to, uint _value) returns (bool success) {
    if (balances[msg.sender] < _value) {
      return false;
    }
    balances[msg.sender] -= _value;
    balances[_to] += _value;
    return true;
  }
  function getBalance(address _user) constant returns(uint _balance) {
    return balances[_user];
  }
}


texts: How to get deployed contract address using Truffle 3.x console?

texts: I opened truffle console and when I type my contract's name, I see a very long message on the console but not sure How do I deploy the contract and find the deployed contract address. Kindly advise.


texts: Resources on gas cost for particular actions in Solidity

texts:
Is there a good resource on Solidity gas costs, for instance the cost for a single read on a mapping (example code below)?
mapping (uint256 => bool) private table;

bool output = table[42];

I have the OPCODE spreadsheet, and of course estimateGas exists, but I want to get a more intuitive feel for the cost of things, like reading from or writing to a variable or map.
In the latter case, I'd also love resources on the time complexity of maps, which I imagine has a bearing on cost (for instance, if access is O(1) and insertion is O(n), then I assume gas cost for insertion scales with n).


texts: How expensive can a contract factory be?

texts: I have a Bakery.sol and Cookies.sol contract. Bakery has a function bakeCookie(). Since creation of contracts cost some ETH, how costly will it be to have new Cookie contracts being created very frequently? Is there a way to reduce the cost?


texts: How do I make a smart contract send a message to a user along with a transaction?

texts:
Smart contracts can obviously send transactions through the Ethereum network but can they also send a simple message along with the transaction?

Usaully you would put the message into hex code in the "data" field but how do you make a smart contract do that?

Thanks.


texts: How to Set "gas used by a transaction" value to a variable in a function?

texts: I want to assign the gas used by transaction to a variable in function and display the output . Please let me know how to do this


texts:
I've read about and understand the idea behind the ERC20 Token Standard, but is there an official contract people can download and use? Or is it an official list of functions a smart contract should include in order to be up to standard?

Anyone know where I can find a polished and ready to go version of ERC20?
I first read about it here: https://github.com/ethereum/EIPs/issues/20
And I also looked at this: https://theethereum.wiki/w/index.php/ERC20_Token_Standard

Or am I missing something super obvious?


texts: Is anyone working on a mobile wallet that can facilitate custom coin transactions?

texts:
I've met some people who are in need of a coin for their collective hackerspace. If I can get my custom coin into a decent mobile wallet (doesn't really need to be super robust) they can start using it for all their internal transactions.

It seems like it would be ideal, if a mobile wallet could import an address (or human readable registration name) of a coin contract. Then the user can click the coin they want to trade and make transactions.

Is anyone working on something like this?


texts: Get balance of a specific token in python using web3.py on polygon network

texts:
I am trying to get the balance in my wallet of specific tokens with no luck.
I have found examples online on how to do this task using web3.js, but the methods used seem to be different. I also found this helpful example: How to view custom token balance in ether wallet using web3, however it doesn't seem to be working for me.
Is anyone able to provide a short script that can do this?
As an example, on the polygon network I expect the wallet address 0xBeD5658e57F54301a23a899674b6593bBf039ab5 to contain 0.882 USDT. Is there anyway to get this programmatically?


texts: uint f = 0, f *= computationallyHeavyFunction(), does EVM run computationallyHeavyFunction()?

texts:
uint f = 0;
f *= computationallyHeavyFunction();

Does EVM run computationallyHeavyFunction(), or does it evaluate f = 0 and then omit further computation?


texts:
I have launched a blockchain testnet in a cluster with different nodes and I have some questions about how it works. If I run more than one geth client(a node in the blockchain) in one node of the cluster:

What is the difference between that and run them in different nodes of the
cluster?
Should all of them mine to obtain the last block added in the blockchain? If one of the geth clients running in a node of the cluster is mining, others geth clients running in the same node also get the last block? (I dont understand very well the interaction between different roles of a node that could be in the blockchain like miner node or full node).
Is there any difference sending a transaction between two clients in a node of the cluster and two clients in two different nodes?

E.g


texts: How can i see the balance of my geth wallet?

texts:
I am new to eth mining and i have some problem finding my balance.

I know that if you mine via pool you dont have to download the blockchain.

So, i downloaded geth, i made a new account and i am using this pool https://eth.pp.ua to mine with ethminer.

You can see my mining work here: 0x5654B64bD8Af7D053aC7705955Da287a150A6eF1

But how can i check my eth balance? When i give the command from the console to see my wallet's balance it returns me 0.

Must i sync the blockchain to my pc in order to see the balance?

Thanks!


texts: Type error: memory is not implicitly convertible to expected type

texts:
I have a function that returns a list of BetProposition smart contracts:

function getBetsForMatchup(uint matchupIdentifier) public returns (BetProposition[]) {
        return bets[matchupIdentifier];
    }

Later I initialize a local variable array as such, so I can loop through them:

   BetProposition[] betsToCancel = getBetsForMatchup(matchupIdentifier);

However, this doesn't seem to work and I get this error:

TypeError: Type contract BetProposition[] memory is not implicitly convertible to expected type contract BetProposition[] storage pointer.
    BetProposition[] betsToCancel = getBetsForMatchup(matchupIdentifier);
    ^------------------------------------------------------------------^

I'm not totally sure what this means. Any help appreciated. Thanks


texts: Why do we have to pay fees for transactions since miners have a reward for blocks they mine (5 per block)?


texts: Big discrepancy between the cost of deploying to the test net and the main net

texts:
I have a simple 100-line contract with 6 functions that I want to deploy to the main net. When I deploy it to the Rinkeby test net through Truffle, I get the following result:
Summary
=======
> Total deployments:   2
> Final cost:          0.01959998 ETH

However, when I try to deploy to the main net, I get the following:
Message:  sender doesn't have enough funds to send tx. The upfront cost is: 260000000000000000 and the sender's account only has: 11370852144167560

This is equivalent to over $500 USD. Surely this can't be accurate?
Following is my Truffle config:
live: {
  networkCheckTimeout: 100000000,
  provider: function() {
    return new HDWalletProvider(
      privateKeys.split(','), // Array of account private keys
      `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`
    )
  },
  network_id: "1",
  gas: 4000000,
  gasPrice: 65000000000, // 65Gwei
},

I deployed the contract to the test net on Remix and the estimated fee was 6721074 gwei which is about $15 currently.


texts:
I am looking at the following contract https://eips.ethereum.org/EIPS/eip-1822#erc-20-token
Look at the following line : Ensures no one can manipulate the Logic Contract.
IMPORTANT: I am going to assume that constructor1 in the MyToken contract is not a constructor, but the initializer function.
I don't understand how LibraryLock in this case helps at all.
Let's look at the updateCode function. As we can see, it has a modifier delegatedOnly which is just a parity hack prevention. Okay, now, I am a hacker and what I will do is first, run the constructor1 function which will call initialize and setOwner.  Now, owner and initialized=true is set in the context of MyToken.  So, if I call updateCode function now, it will successfully get run, hence I found an exploit. So, I am not sure how that example on that link makes sense.
I'd appreciate if you could explain in simple terms how it actually protects us.


texts: Understanding more about delete keyword in solidity

texts:
The blockchain is an immutable, append-only transaction set.
I have the following questions regarding delete keyword -

Then what is the purpose of deletekeyword in solidity?

Is it only for variables stored in memory?

Is it possible to delete variables stored in storage and stack?

What are all the possible cases in which delete keyword should be used and where it should not be?


texts:
I followed this way of deploying contracts using truffle.

// Deploy A, then deploy B, passing in A's newly deployed address
deployer.deploy(A).then(function() {
  return deployer.deploy(B, A.address);
});

But my contract, despite showing as deployed in the truffle console, is not recognized by my web3js code.

It works if i deploy the two contracts seperatly.


texts: How do I generate a TrustedCheckpoint(CHT) on my private chain?

texts:
I saw this link, but still don't know how to get CHTRoot and BloomRoot, only know that SectionHead is block[(SectionIndex+1)*32768-1].headhash

https://github.com/ethereum/devp2p/blob/master/caps/les.md#gethelpertrieproofs-0x11

ex:

// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
MainnetTrustedCheckpoint = &TrustedCheckpoint{
    Name:         "mainnet",
    SectionIndex: 227,
    SectionHead:  common.HexToHash("0xa2e0b25d72c2fc6e35a7f853cdacb193b4b4f95c606accf7f8fa8415283582c7"),
    CHTRoot:      common.HexToHash("0xf69bdd4053b95b61a27b106a0e86103d791edd8574950dc96aa351ab9b9f1aa0"),
    BloomRoot:    common.HexToHash("0xec1b454d4c6322c78ccedf76ac922a8698c3cac4d98748a84af4995b7bd3d744"),
}


texts:
I want my dApp to detect Lock/Unlock actions in MetaMask, just like in:
Remix=>"Deploy & Run transactions"=>"Injected Web3"
ethereum.on('accountsChanged'... - is not enough.
Is there a any solution other than setting the interval?


texts: Will Smart Contracts ever shape into full fledge application?

texts: We all know Ethereuem Smart contracts or DApps cannot take role of an enterprise applications, yet. There is a cost involved at every stage of Execution, only small data can be persisted or unless help of IPFS is taken, inter communication outside of Blockchain is still a challenge unless Oracle services are requested for which again there is a cost involved and list goes on and on. I understand we don't have a crystal ball, but how far are we in terms of firms adopting Smart contracts for there day to day running operations. I am not sure how far are we, but not close either. Thoughts are welcome.


texts: Running Ethereum Node for pending tx - beginner questions

texts:
I have been getting into blockchain development/solidity and started a project where I want to scan all pending tx for specific addresses. I am using python and web3.py and started by using Infura and running the command:
web3.eth.getBlock(block_identifier='pending', full_transactions=True)

but this way I wasnt able to receive all the pending tx, or filter through them. Now after some research I found that Geth is better to be used for this, but infura doesnt support Geth. So I paid for an ethereum node in the cloud (QuickNode). Now I needed to install Geth on my computer, which I did using Docker. Now here is where I am not too sure what I am doing/ have to do.
After installing Geth I thought that I had to config it and then attach it to the websocket or http provider that I got from QuickNode. I have tried several configurations, for both websocket and http. For some configurations Geth actually starts running and downloading blocks.
So my question is, if I host an ethereum node in the cloud, do I still need to download the blockchain to my computer? Like I said Geth started downloading blocks, but I am not sure if Geth is downloading the new blocks, or if its downloading the whole blockchain. I was hoping that I wouldnt need to store the blockchain (150gb+) on my harddisk if I got an ethereum node running in the cloud.
When Geth is running (using Power shell) I tried to run my script in Python to get pending transactions:
    w3 = Web3(Web3.WebsocketProvider(wss_link))
print(w3.geth.txpool.inspect())

but whatever I do I keep getting a value error -32601 'method not found'.
Can someone help a noodie out and stear me in the right direction. I might be totally wrong with how I go about it, but I'm trying to learn.
Thanks in advance!


texts: Is the Ethereum Subtleties page correct about value transfers under exceptions?

texts:
On the Ethereum Subtleties page (largely maintained by VB) it states the following under Exceptional Conditions:

  If a transaction triggers an exception, then:

  The value transfer from sender to recipient still takes place

This doesn't match my understanding, my tests or, I think, the Yellow Paper which says in section 8 (my emphasis),

  if the execution halts in an exceptional fashion (i.e. due to an
  exhausted gas supply, stack underflow, invalid jump destination or
  invalid instruction)... the state is reverted to the point
  immediately prior to balance transfer

Interestingly, chriseth added a notice in Feb 16 to the effect that some things about reverting Ether transactions were wrong. This notice was removed in June 17 by vbuterin.

So, is the Subtleties paper just incorrect on this, or am I misunderstanding something?


texts:
I have just started coding some basic smart contracts with solidity and have a question on how to approach a particular problem. I hope I can make it make sense.

If I were to create a smart contract for a simple game, lets say its a dice rolling game where two players can play once another and wager some sort of game token or Ethereum that they have a balance of in the smart contract.

One player challenges another, the dice is rolled, a function in the smart contract decides the winner and they get the winnings.

My question is whats the fastest way to handle the contract verifying both players balances when they enter their wagers and then verify that they both agreed to play on another.

Right now in my mind it seems like one player would challenge another with a wager, the next player would have to agree and set their own wager, and then the first would have to confirm that. This would take multiple smart contract operations and players would be waiting for everything to get mined and written to the blockchain, especially if one of them used a low amount of gas or something.

What would be the proper approach for something like this?


texts: Can function calls in other contracts change states?

texts:
In Solidity, is it possible to change states via function calls in other contracts?

For example, let's consider the code below, where we have three assumptions:

The function test2 is defined in the contract C2.
The contract object c2 of the type C2 is created at somewhere within C1.
We deployed C1 as a root contract.

Then, is it possible for the function call statement c2.test2() to change the values of variables in C1 (e.g., x1, x2, x3, etc)?

Contract C1 {
  uint x1;
  uint x2;
  uint x3;

  ...

  function test1 () public{
     /* can c2.test2() change the values of variables */
     /*   within C1? (e.g., x1,x2,x3, etc) */
     c2.test2 ();
  }
}


texts: What can i do if truffle doesn't execute commands?

texts:
First of all i can´t execute truffle writing truffle console. Instead of that I have to write truffle.cmd console. When im in the truffle console and I try to execute test over my contracts I get syntax error over test. I can´t solve this issue because in truffle docu the way toexecute test is that way.

Any help??


texts: Is mainnet and Homestead the same thing?

texts:
I understand that mainnet is the official public (real-world) Ethereum blockchain that everyone uses to send real Ether to each other.

However, sometimes I see Ethereum being refered to as Homestead. Does the terms refer to the same thing?


texts: Unable to contribute to crowdsale contract

texts:
I have the following two contracts :

contract Token {
   string public name;
   uint8 public decimals;
   address public owner;
   mapping (address => uint256) public balanceOf;

    function Token(uint256 initialSupply, string tokenName, uint8 decimalUnits)    {
        balanceOf[msg.sender] = initialSupply;
        name = tokenName;
        decimals = decimalUnits;
        owner = msg.sender;
    }

    function transfer(address _to, uint256 _value) {
        balanceOf[owner] -= _value;
        balanceOf[_to] += _value;
    }
}

contract Crowdsale {

    address public beneficiary;
    uint public fundingGoal;
    uint public amountRaised;
    uint public deadline;
    uint public price;
    Token public tokenReward;
    mapping(address => uint256) public balanceOf;
    bool public fundingGoalReached = false;
    bool public crowdsaleClosed = false;

    function Crowdsale(uint _fundingGoal, uint _duration, uint costToken, Token addressOfToken) {
        beneficiary = msg.sender;
        fundingGoal = _fundingGoal;
        deadline = now + _duration ;
        price = costToken;
        tokenReward = Token(addressOfToken);
    }

    function contribute() public {
        if (crowdsaleClosed) throw;
        uint amount = msg.value;
        balanceOf[msg.sender] = amount;
        amountRaised += amount;
        tokenReward.transfer(msg.sender, amount / price);
    }

    modifier afterDeadline() {
        if (now >= deadline)
            _
    }

    function checkGoalReached() afterDeadline{
        if (amountRaised >= fundingGoal) {
           fundingGoalReached = true;
        }
        crowdsaleClosed = true;
    }
}

I'm trying to execute contribute function but no change occurs to the amountRaised and the function transfer also doesnt get called. What am I doing wrong?

I deployed first token contract. then used its address as parameter for constructor call.
i'm using 2 nodes
the first node is deploying the contracts and the second is calling the contribute function as follows :
fundingGoal is 10000 (say)

var camp = eth.contract(abi).at(address)
camp.contribute.sendTransaction({from : eth.coinbase , value : 5000})


texts: Remix IDE: What is the purpose of Calldata and Transact Tab

texts:
I am trying to execute the following code on Remix IDE.

pragma solidity ^0.5.4;
contract GuessTheNumberChallenge {
    constructor() public payable {
        require(msg.value == 1 ether);
    }
    function () external payable {}

}

It shows me the Calldata box with Transact tab as shown in the Diagram. If I type 10 in the call data box and click transact, I got the following transaction receipt:

  [vm]from:0xca3...a733cto:GuessTheNumberChallenge.(fallback)
  0x692...77b3avalue:0 weidata:0x10logs:0hash:0xe19...310b7  status     0x1
  Transaction mined and execution succeed  transaction hash
    0xe199a02ea06f556f01175fb3e5726c60a30aee092b86f92ca72e6429fdf310b7
  from  0xca35b7d915458ef540ade6068dfe2f44e8fa733c  to
    GuessTheNumberChallenge.(fallback)
  0x692a70d2e424a56d2c6c27aa97d1a86395877b3a  gas   3000000 gas
  transaction cost  21086 gas   execution cost  18 gas   hash
    0xe199a02ea06f556f01175fb3e5726c60a30aee092b86f92ca72e6429fdf310b7
  input     0x10  decoded input      -   decoded output      -   logs   []

I can’t understand following:

  [vm]from:0xca3...a733cto:GuessTheNumberChallenge.(fallback)
  0x692...77b3avalue:0 weidata:0x10logs:0hash:0xe19...310b7

If I type "10 ETHER", I am getting the message "hexadecimal value required"
What is meant by
0 weidata:0x10logs:0
Is the Calldata with Transact used to transfer Ether? or its related to address?

Somebody please guide me.

Zulfi.


texts: How do you handle a chain re-org with contract events?

texts:
Given that events are fired whenever a transaction is included in a newly mined block, how do you handle the situation when the mined block containing the transaction gets orphaned?
Say I have a database that inserts data every time a Deposit event occurs:
myContract.on("Deposit", depositInfo => myDatabase.insert(depositInfo))

But then the block containing the transaction that did the did the deposit gets orphaned 4 blocks later. Now I am storing invalid data. Then 10 blocks later it turns out the chain in which the original transaction was mined on, is now the longest chain. So now the database is accurate again.
How can I be notified every time an event gets invalidated/validated again due to chain reorgs?
Then I can do something like this; Remove the event from my database if it is invalid and insert it if it is valid:
myContract.on("Deposit", (depositInfo, isValid) => {
    if (isValid) {
        myDatabase.insert(depositInfo)
    } else {
        myDatabase.findAndRemove(depositInfo);
    }
});


texts: Watch pending transaction from all nodes in network

texts: I have two geth nodes in my own private netwrok: nodeA and nodeB. When iam sending transaction from nodeA, i am able to see this transaction in pending pool after call method txpool.content if i have access to nodeA. But is it possible to get txpool from nodeA if i have access only to nodeB? And how i can watch all pending txpool from all nodes?


texts: do the contracts of ethereum have the access to the nonce of the blocks?

texts:
by this question I mean when we try to develop a gambling game contract we need some random input, can we just use the nonce data from some certain blocks?
(I just start learning blockchain, I'm from China, there may be some language problems about my expression)


texts: Changing "proxywallet" in "local.config" in ethOS, but I receive mining reward in previous address

texts:
I've changed my proxywallet from proxywallet 0xB4... to proxywallet 0x5B... in the local.config file.

However, I received mining reward again in previous address: 0xB4... .

Do I need to restart the rig miner after changing the wallet address? Or some additional actions are required to change proxywallet (address that you want your mined funds sent to) ?

Important 1: Here is gethelp link created by ethOS :
http://paste.ethosdistro.com/lazovidehu

Important 2: There is another local.config with extension of "save" : local.config.save , such that when I change local.config , yet local.config.save is not changed automatically. Do I need to make changes in both files every time?

Important 3: The content of remote.config is as follows:

#http://ethosdistro.com/pool.txt
#comment out or remove the top line to enable single-rig mode

Important 4: When I use  force-local command to disable remote config, I receive: "command not found".

If you need any other information, please let me know.


texts: How do I take value from array of objects?

texts:
I have a problem with my code.

contract Registration {
address public owner;
uint conceptPrice;
uint conceptValue;

function Registration(uint _conceptPrice) public {
    owner = msg.sender;
    conceptPrice = _conceptPrice;
    conceptValue = conceptPrice;
}
/////////////////////////////////////
/* Others code*/
/////////////////////////////////////
struct Request {
    uint reqId;
    uint amount;
    uint percentage;
    address modAdd;
    //0 for pending, 1 accept, 2 decline
    uint state;
}
//
Request[] public requests;
//mapping (uint => Request) requests;
function request(uint _amount, uint _percentage) public returns (uint numRequests) {
    bool present = false;
    for (uint i = 0; i <= participants.length; i++) {
        if (participants[i] == msg.sender) {
            present = true;
            break;
        }
    }
    //
    if (msg.sender == owner || _amount < conceptPrice || _amount < balances[msg.sender] || _percentage > 5 || present == false) return;
    Request memory req = Request({reqId : requests.length + 1, amount : _amount, percentage : _percentage, modAdd : msg.sender, state : 0});
    //bissogna togliere i soldi a chi fa l'offerta
    requests.push(req);
    numRequests = requests.length;
}

uint[] ident;
uint[] per;
uint[] amountV;

function pendingRequest() public {

    for (uint i = 0; i == requests.length; i++) {
        if (requests[i].state == 0) {
            ident.push(requests[i].reqId);
            per.push(requests[i].percentage);
            amountV.push(requests[i].amount);
        }
    }
}
function printReq() public constant returns (uint[] ident_){
    ident_ = ident;
}
}

I created two different request (numRequests =2) but when i try to take value from array of object Request through the function pendingRequest i have an error:
status  0x0 Transaction mined but execution failed.
Array requests have values inside for example requests at position one is:requests[1]
Why?


texts: Max number of tokens possible in Solidity?

texts:
So me and one of my friends are trying create our own token using Solidity for fun. It is supposed to have a total supply of the amount of atoms in the universe. I wanted to know if it is possible to have this much data fit in a contract since normally the contracts are bound to uint256. I tried finding a solution online but couldn't really find an answer anywhere. Anyone have any idea?
Thanks in advance!


texts: Account used to Deploy not same as account associated with contract

texts:
So I am testing out a new contract I have been working on in Remix.

I expected that the Account I selected would be the one associated with the actual contract, but it is not.

In fact, I tried it a second time and got a different contract again:

Could this have something to do with the fact that I am not currently logged in to Metamask?


texts: Is the gast cost of '<=' lower than the gas cost of '<'?

texts:
I've been debating on whether I should use < or <= in a for loop.

So I decided to conduct a small test and verify that their gas costs are the same.

Here is my contract:

pragma solidity 0.4.24;

contract MyContract {
    uint public value;
    function func1(uint x) external {
        for (uint i = 0; i < x; i++)
            value += i;
    }
    function func2(uint x) external {
        for (uint i = 0; i <= x; i++)
            value += i;
    }
}

And here is my Truffle test:

contract("MyContract", function(accounts) {
    it("func1", async function() {
        const myContract = await artifacts.require("MyContract").new();
        const response = await myContract.func1(11);
        console.log(response.receipt.gasUsed);
    });
    it("func2", async function() {
        const myContract = await artifacts.require("MyContract").new();
        const response = await myContract.func2(10);
        console.log(response.receipt.gasUsed);
    });
    it("func1", async function() {
        const myContract = await artifacts.require("MyContract").new();
        const response = await myContract.func1(101);
        console.log(response.receipt.gasUsed);
    });
    it("func2", async function() {
        const myContract = await artifacts.require("MyContract").new();
        const response = await myContract.func2(100);
        console.log(response.receipt.gasUsed);
    });
    it("func1", async function() {
        const myContract = await artifacts.require("MyContract").new();
        const response = await myContract.func1(1001);
        console.log(response.receipt.gasUsed);
    });
    it("func2", async function() {
        const myContract = await artifacts.require("MyContract").new();
        const response = await myContract.func2(1000);
        console.log(response.receipt.gasUsed);
    });
});

The results show in a conclusive manner that <= is cheaper than <:

Contract: MyContract func1: 94494
Contract: MyContract func2: 94436
Contract: MyContract func1: 567714
Contract: MyContract func2: 567386
Contract: MyContract func1: 5299978
Contract: MyContract func2: 5296950

Does that make any since at all? AFAIK, both operations (LT and LTE) cost 3 gas units!

I've disassembled the contract, here are the relevant parts:

For the < operation:

    /* "MyContract.sol":142:143  x */
  dup2
    /* "MyContract.sol":138:139  i */
  dup2
    /* "MyContract.sol":138:143  i < x */
  lt

For the <= operation:

    /* "MyContract.sol":247:253  i <= x */
  dup2
  dup2
  gt

They indeed look different (though mostly in the comments for some reason).

And to be honest, I'm not quite sure why gt is used in the <= case.

But other than that, it still doesn't strike me as to why the gas cost is different here.

For all it matters, I've used the default optimization settings (optimize-runs=200).

Thank you.


texts: Calling Solidity functions from Truffle console

texts:
This might be a double, but I have seen different answers so far, and it's very confusing. I have the following contract:

pragma solidity ^0.4.19;

contract Sum {
   event Summed(uint256 num1, uint256 num2, uint256 result);

   function getSum(uint256 num1, uint256 num2) public returns (uint256 result) {
       uint256 result;
       result = num1 + num2;
       return result;

       Summed(num1, num2, result);
   }
}

How to call the getSum() from the Truffle Console starting from initiating the contract (I'm using Ganache), and what is the difference (in terms of syntax) in calling the getSum() from the Console and by using the Web3js?

I'm using the latest versions of Truffle and Ganache.


texts: Why do smart contract languages need to be deterministic?

texts: I read somewhere that smart contract languages need to be deterministic. Why?


texts:
I have configured parity to listen on an IP (and not on localhost) and verified that port 8545 opens when I start parity. I can reach the parity UI via a browser but I cannot connect MetaMask to parity.

I checked connecting via https and http but it both does not work. How do I troubleshoot this?


texts: export Blockchain ETH wallet to Myether wallet

texts:
Thank you User for your answer. I need to now ask/present this additional information regarding my original question.

strong textI initiated a token purchase on CRPT. They are a ERC20 token. I tried to withdraw to a Blockchain ETH Wallet which does not support ERC20. Blockchain says I need to export key to a wallet that supports this. The instructions are very vague. I am trying to export key to a Myetherwallet that supports ERC20 (CRPT) Tokens.

I should note that the ERC20 tokens that were sent to blockchain are not visible in the account. It clearly states this in blockchains.

See Below Blockchain support info:

Your Blockchain wallet currently does not support ERC20 tokens. If you accidentally sent ERC20 tokens to your wallet, you will need to export your private key in order to access them. To export your ether private key, navigate to your Ether tab in the left hand side navigation. Click on Export Private Keys on the right side of the grey bar above your transaction history. Carefully read the warning message shown and click Continue. Enter your wallet password, then click Submit to view your private key. As stated in the warning, you should never share your private key with anyone. Anyone with access to your private key has the ability to spend the funds associated with it. Please note: your private key does not need to be exported to backup your ether funds. As long as you have your backup phrase written down and stored somewhere safe, they are already backed up.

Also:

At this time the Blockchain ethereum wallet does not support the sending of ethereum based tokens, known as ERC20 tokens. If you receive any of these tokens to your Blockchain wallet you will not be able to send them or see the balance of the tokens while logged into your wallet. Since you have complete control over your funds you are able to export the private key for your ethereum address and import it into any other ethereum wallet that supports ERC20 tokens.

This said, Will all contents be forwarded to MEW wallet automatically? Or will I need to somehow specify which contents I would like to export? If I need to specify, how do I do that If I cannot see any of the contents?

Help PLEASE!!


texts: Basic testing with Truffle (not changing contract's state)

texts:
I'm just starting to use Truffle to test this contract

pragma solidity ^0.4.11;

contract Basic {
    bytes32 value;

    function Basic() {
        value = "mcansado";
    }

    function getValue() constant returns(bytes32) {
        return value;
    }

    function setValue(bytes32 _value) constant returns(bytes32) {
        value = _value;
    }
}

The relevant test code is

it("Should set value to 40", function(done) {
    basic.setValue(40, {from:accounts[0], to:basic.address})
    .then(function(tx) {
      console.log(tx)
      //assert.isOk(tx.receipt)
      done()
    }, function(error) {
        assert.equal(true, false)
        console.error(error)
        done()
      })
  })

That test is followed by one to get value. I would expected to get 40 back but instead I get this output

Contract: Basic
0x7d32e47118fbc082af1350062f10efee2694ff15
    ✓ Should retrive deployed contract.
0x0000000000000000000000000000000000000000000000000000000000000000
    ✓ Should set value to 40 (43ms)
mcansado // returns the value made by constructor, not 40
    ✓ Should return the value set as 40

  3 passing (114ms)

How can I send the new value in the test?


texts: Windows: command "npm install drizzle" give me an ERR!

texts:
npm 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! path C:\Users\Ricca\Drizzle\app\node_modules\websocket

npm ERR! code EISGIT

npm ERR! git C:\Users\Ricca\Drizzle\app\node_modules\websocket: Appears to be a git repo or submodule.

npm ERR! git     C:\Users\Ricca\Drizzle\app\node_modules\websocket

npm ERR! git Refusing to remove it. Update manually,

npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\Ricca\AppData\Roaming\npm-cache_logs\2019-08-06T07_27_49_028Z-debug.log

this is the message what return when i'm trying to run this command.


texts: Ethereum node stuck can't sync. for Win. 8.1

texts: I've downloaded the latest Win. version but can't make the Ethereum node sync. I've also turned my firewall off but still not working. Can anyone help? I'm not a techie guy. Thanks.


texts: How does Remix Solidity compiler accept constructor arguments?

texts: I'm in the process of compiling code for a token, to test on a test network. How can I specify constructor arguments when compiling in Remix? The bytecode is available when I press compile, but no place to enter constructor arguments.


texts: geth sendTransaction error: insufficient funds for gas * price + value on private network

texts:
I tried with all available answers converting to hex and setting different gas prices, but noting is working for me.
I am on a private network with network id : 1 and chainId = 0
and the nodes are in sync.
geth version is 1.7.3
please help me out


texts: How is the state "undone/reverted" after a longer chain is determined?

texts: So say there is block_a, and block_b, both at height 1677. And a node accepts block_a, but then recieves block_b + block_c (which is mined on top of block_b), how exactly are the state changes made in block_a undone and reverted?


texts: Host Geth Mainnet on cloud or use existing mainnet?

texts:
We are planning to launch our DAPPS Smart Contracts and Token Sale Contracts on mainnet. For testnet we had setup on Digital Ocean. But for mainnet we are confused between to host on our own node on Digital Ocean or AWS or to utilise the service like https://infura.io/?

Is service like Infura reliable to go or better to setup on AWS/Digital Ocean? We will be developing more DAPPS in the future as well.


texts: How can I provide an ethereum public address to each user registering on my website.?

texts:
is it possible to do using web3.js  for a dapp that is going to be run on mainnet.?

I have a requirement to assign valid ethereum address to each user who are registering on my website. I want this to be created on user registration, Not planning to use a address book for mapping. What would be the best way to achieve it.?


texts: Recovering ETH after sending to wrong address

texts:
I'm struggling to find an answer to this. I have mistakenly sent all my ETH to a smart contract (used as a redemption address only for TaaS token - 0xa6b5e8df6553969de6006edb3a87ff5226f4a115). I got a reply from the company saying that there is no way to send ETH out from this address. But I find it so crazy that there was value there prior to my transaction and that there was really nothing the owner could do to get this money.
Transaction hash is 0x720f3ab54aa2d2f7b10489bf20b86d9c62adac3a82d9652b5b26da0e58d18274
It was a genuine mistake on my end, but really hoping there is something, anything, that could help to recover it. I also wasn't able to view the code for this contract to see if it is written in a way that it doesn't allow ETH to be sent out.
Any, and all, help would be greatly appreciated!


texts:
I sent Weth from Coinbase to Kraken, at the place of ETH (error of the mind)
hash : 0xcc12216a6219fbe9a7d94e16e9810f6bfa5854b200dae567c8295ae30a037352
All the adress From or To are correct.
do you have any solution to get it back...
thanks...
N T


texts: When a contract calls other contracts, is it an atomic operation?

texts: If a contract calls several external methods of other contract(s), is it as a whole one atomic transaction (reverted as a whole if an exception happens)?


texts: How to get transaction hash without waiting for await call?

texts:
for my demo I need the transaction hash instantly without waiting for callback of sync call.
Here my code:
aggiungiAllaBlockChain: async(u,n,c,e) => {

try {
  const web3     = new Web3(App.web3Provider);
  const contract_PartecipazioneContest = new web3.eth.Contract(JSON.parse(App.ABI_PartecipazioneContest), App.ADDR_PartecipazioneContest);
  const account  = App.account;

  //const receipt  = await App.sendUserInBlockChain(web3, account, contract_PartecipazioneContest.methods.addUser(u, n, c, e));

  const transaction = contract_PartecipazioneContest.methods.addUser(u, n, c, e);
  value = 0;

  const options = {
      to      : transaction._parent._address,
      data    : transaction.encodeABI(),
      gas     : await transaction.estimateGas({from: account.address, value: value}),
      gasPrice: await web3.eth.getGasPrice(),
      value   : value
  };
  const signed  = await web3.eth.accounts.signTransaction(options, account.privateKey);
  const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction)
  .on('transactionHash', function(hash){
      console.log("hash on(transactionHash " + hash);
      return hash;

  });

} catch (error) {

  console.log("errore Aggiungi utente alla blockchain" + error)
}
}

I print the hash of my transaction but the return value doesn't work.
I have got this result using truffle but now I need this following this path (not passing for meta mask)
Thanks a lot for your help.


texts: TypeError: Type contract Campaign is not implicitly convertible to expected type address

texts:
pragma solidity ^0.5.11;

contract CampaignFactory {
    address[] public deployedCampaigns;

    function createCampaign(uint minimum) public {
        address newCampaignAddress = new Campaign(minimum, msg.sender);
        deployedCampaigns.push(newCampaignAddress);
    }

    function getDeployedCampaing() public view returns(address[]memory) {
        return deployedCampaigns;
    }
}
contract Campaign {

    struct Request {
        string description;
        uint value;
        address payable recipient;
        bool complete;
        uint approvalCount;
        mapping(address => bool) approvals;
    }

    Request[] public requests;
    address public manager;
    uint public minimumContribution;
    mapping(address => bool) public approvers;
    uint public approversCount;

    modifier restricted() {
        require(msg.sender == manager);
        _;
    }

    constructor(uint minimum, address creator) public {
        manager = creator;
        minimumContribution = minimum;
    }

    function contribute() public payable {
        require(msg.value > minimumContribution);
        approvers[msg.sender] = true;
        approversCount++;
    }

    function createRequest(string memory description, uint value, address payable recipient) public restricted {
        Request memory newRequest = Request({
            description: description,
            value: value,
            recipient: recipient,
            complete: false,
            approvalCount: 0
        });

        requests.push(newRequest);
    }

    function approveRequest(uint index) public {
        Request storage request = requests[index];

        require(approvers[msg.sender]);
        require(!request.approvals[msg.sender]);

        request.approvals[msg.sender] == true;
        request.approvalCount++;
    }

    function finalizeRequest(uint index) public restricted{
        Request storage request = requests[index];

        require(request.approvalCount > (approversCount / 2));
        require(!request.complete);

        request.recipient.transfer(request.value);
        request.complete = true;
    }
}


texts:
I have a function that makes use of the current time (now). The Contract as a whole is a Crowdfunding token and the cost of tokens differ depending on the date and time that tokens are purchased.

How does one simulate different times when testing a Smart Contract? For instance, with regards to the code below, I would like to do unit testing to find out if the code for setting price is correct but I can't change the value of now.

Would it be a good solution to simply substitute the now keyword for another temporary testing variable, say now_sim and then manually changing now_sim during simulation?

    if (now < (startTime + 1 days)) {
        currentPrice = safeDiv(safeMul(price, 80), 100);  // 20 % discount (x * 80 / 100)
    }
    else if (now < (startTime + 2 days)) {
        currentPrice = safeDiv(safeMul(price, 90), 100);  // 10 % discount (x * 90 / 100)
    }
    else if (now < (startTime + 12 days)) {
        // 1 % reduction in the discounted rate from day 2 until day 12 (sliding scale per second)
        // 8640000 is 60 x 60 x 24 x 100 (100 for 1%) (60 x 60 x 24 for seconds per day)
        currentPrice = price - safeDiv(safeMul((startTime + 12 days) - now), price), 8640000);
    }
    else {
        currentPrice = price;
    }


texts: TransactionException: Cannot unmarshal invalid hex string when deploying contract in web3j

texts:
I have a java server that uses web3j library with geth as the provider. When I tried to deploy my contract on my private test net. I got this error:
org.web3j.protocol.exceptions.TransactionException: Transaction 0x70fed47c9d291f0818ff239be085b2dc3a87f436f56b9c0b6750e568a24dbdf1 has failed with status: 0x0. Gas used: 6721975. Revert reason: 'invalid argument 0: json: cannot unmarshal invalid hex string into Go struct field CallArgs.data of type hexutil.Bytes'.
    at org.web3j.tx.Contract.executeTransaction(Contract.java:377)
    at org.web3j.tx.Contract.create(Contract.java:422)
    at org.web3j.tx.Contract.deploy(Contract.java:456)
    at org.web3j.tx.Contract.deploy(Contract.java:506)
    at org.web3j.tx.Contract.lambda$deployRemoteCall$5(Contract.java:549)
    at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
    at java_ethereum.ContractController.deployContract(ContractController.java:41)

My java code looks something like this:
Web3j web3 = Web3j.build(new HttpService("http://localhost:8545"));
Credentials credentials = WalletUtils.loadCredentials("", "path/to/geth/keystore");
String contractAddress = deployContract(web3, credentials);
MyContract myContract = loadContract(contractAddress, web3, credentials);
@SuppressWarnings("deprecation")
    private String deployContract(Web3j web3, Credentials credentials) throws Exception{
        return myContract.deploy(web3, credentials, GAS_PRICE, GAS_LIMIT).send().getContractAddress();
    }

My web3j should be the latest version(4.8.4), I am not sure if I have missed anything. The content of the contract should not matter (I think) because the same error pops up even when I try to deploy a blank contract.
I suspect there is some problem with the credentials created from geth. Any help would be appreciated.
My command to initialize the geth node:
geth  --identity "TestNode" --rpc -rpcaddr "0.0.0.0"  --rpcport "8545" --port "30303" --nodiscover  --rpcapi "db,eth,net,web3,miner,net,personal,net,txpool,debug,admin"  --networkid 1900    --datadir C:/Users/Documents/Test --allow-insecure-unlock  --ipcdisable   --dev --dev.period 1

@Majd TL suggests testing it on ganache instead, and it returns different error this time:
java.lang.RuntimeException: java.lang.RuntimeException: Error processing transaction request: VM Exception while processing transaction: invalid opcode
    at org.web3j.tx.Contract.deploy(Contract.java:460)
    at org.web3j.tx.Contract.deploy(Contract.java:506)
    at org.web3j.tx.Contract.lambda$deployRemoteCall$5(Contract.java:549)
    at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
    at ContractController.deployContract(ContractController.java:52)
Caused by: java.lang.RuntimeException: Error processing transaction request: VM Exception while processing transaction: invalid opcode
    at org.web3j.tx.TransactionManager.processResponse(TransactionManager.java:162)
    at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:81)
    at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:127)
    at org.web3j.tx.Contract.executeTransaction(Contract.java:367)
    at org.web3j.tx.Contract.create(Contract.java:422)
    at org.web3j.tx.Contract.deploy(Contract.java:456)
    ... 11 more


texts: What are the secrets of geth --unlock. How can I tell if an account is locked?

texts:
geth --unlock and how it's used.
 I've looked in depth at all of the documentation I can and came across this problem, or failure to understand some of it really.
By the way, I'm using this on a Mac.

instance: Geth/v1.8.11-stable/darwin-amd64/go1.10.3

For example.
./geth account list
returns the following.

The first one, #0 was created in 2016. The next two, this week.

Account #0: {c9b74488b8e699b54803464a33d57cfff7eb052c} keystore:///Users/robert/Library/Ethereum/keystore/UTC--2016-05-27T11-31-47.551960099Z--c9b74488b8e699b54803464a33d57cfff7eb052c
Account #1: {b8baff0dcc88b9bf7aed45966938a30e2ab23ce4} keystore:///Users/robert/Library/Ethereum/keystore/UTC--2018-06-18T13-40-57.053229334Z--b8baff0dcc88b9bf7aed45966938a30e2ab23ce4
Account #2: {bf7042c963111a96bd4c8d86c179576ddfc07cb8} keystore:///Users/robert/Library/Ethereum/keystore/UTC--2018-06-19T06-11-21.589039961Z--bf7042c963111a96bd4c8d86c179576ddfc07cb8

Now, only account #1 and #2 can be unlocked. It's one I created with geth, using ./geth account new

To unlock this account, I use this

geth --unlock  0xbf7042c963111a96bd4c8d86c179576ddfc07cb8 --datadir=/Users/robert/Library/Ethereum --password password.txt

That works, BUT. accounts #0 and #1 will not unlock - because I have no idea what or if they are even password protected. locked or unlocked? How can I tell?

So, the first address, address #0 is actually a Blockchain.info created address, and is actually Unlocked. I never locked it when created. If indeed I ever could lock it.

Unlock account 0xc9b74488b8e699b54803464a33d57cfff7eb052c
Passphrase:
Error: could not decrypt key with given passphrase

The second address, #1, I don't know. I suspect I've accidentally created it. No idea if it's locked or unlocked.
So, using ./geth attach I do this.

> personal.unlockAccount('0xb8baff0dcc88b9bf7aed45966938a30e2ab23ce4', null, 1)
Unlock account 0xb8baff0dcc88b9bf7aed45966938a30e2ab23ce4
Passphrase:
true

And as you see, that works. Fortunately when I created that account, again it must have been with ./geth, I used my usual password.

So the question remains, how do I tell if an address is locked or unlocked?
How do I add an address to that keystore other than by creating it with ./geth address new? Which didn't happen with the #0 address, because that's a Blockchain.info created address. How did it get into the keystore?

As I think address #0 is unlocked, the error 'could not decrypt key' is actually telling me that it's already unlocked. Interesting stuff.


texts: The authenticity of msg.sender variable in smart contract

texts: We know that in a smart contract, msg.sender can be used to obtain the address of the user calling the contract. Is it possible for users to forge their own account addresses, causing the msg.sender variable we obtained in the smart contract to be not real?


texts:
I see the fallback function of a contract as a way of "depositing" an Ether value to the contract. My question is very simple I guess, but I couldn't find the answer yet.

Is it possible to develop a fallback function to deposit ERC20 tokens into a contract? What's the best way to deposit ERC20 tokens to a contract, VIA contract (by deposit I mean 'ownership transfer')? Like use the key payable but instead of sending ether, send ERC20 tokens.


texts:
I am trying to make a dapp to upload files on IPFS Infura.
I am using IpfsHttpClient in web browser by including the script

But when I get the instance using:

var ipfs = window.IpfsHttpClient('ipfs.infura.io', '5001', { protocol: 'http' });

I get the error and 400(Bad Request)

Access to fetch at 'http://ipfs.infura.io:5001/api/v0/add?stream-channels=true' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

And when I am using :

var ipfs = window.IpfsHttpClient('ipfs.infura.io', '5001', { protocol: 'https' });

I get the error:

Uncaught ReferenceError: https is not defined

What should I do?

I'm facing a very similar issue with Infura IPFS CORS. Here is a minimal code sample:

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Infura IPFS CORS issue</title>

readAsArrayBuffer to Buffer to Infura to IPFS

    <input type="file" id="upload">


texts: Is fully synced node required to access ethereum blockchain through geth?

texts:
Do i need fully synced node to access ethereum blockchain through geth using web3js?

PS. i want to access ethereum blockchain through geth only, not metamask, infura, etc.


texts: Solidity contract: How to deal with return parameters in solidity

texts:
i am having an issue with an function I would like to call.
Following case:
The function looks like this:

Params
Type

token0
IERC20

token1
IERC20

amount
uint256

parts
uint256

flags
uint256

and it returns

Params
Type

returnAmount
uint256

distribution
uint256[]

I tried to handle the variables as following but every time I try the function, it becomes reverted. Here the line:
(uint returnAmount, uint[] memory distribution) = exchange.getExpectedReturn(token0, token1, amount, parts, flags);

Maybe someone has an idea? Do I have to define a struct to handle the params correctly? Is the function itself correct and did I make a mistake with importing the right interface?
The return I would like to handle looks like this:
[3400158, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]


texts: In Raiden's source, why is a result of state transition called "iteration"?

texts:
Throughout the Raiden source code, the result of a state transition is called a iteration (for example
https://github.com/raiden-network/raiden/pull/4791#pullrequestreview-285494821 ).  Where does this word iteration come from?


texts: Does Quorum provide support for Windows?

texts:
I am new to Quorum.I want to build Quorum with windows.

But Windows isn't currently supported directly as stated in https://github.com/jpmorganchase/quorum/issues/178

Is there any alternate solution to use Quorum with windows?


texts: Will Serenity provide a practical built-in solution for contracts to get random numbers?

texts:
As discussed in How can I securely generate a random number in my smart contract?, it's currently quite hard to get a random number reasonably fast to use in a contract. In situations where you can make all parties do a commit-and-reveal it's OK, but where this isn't practical we're seeing people use some quite nasty solutions, for example trusting random.org (which can cheat undetectably), and also various shades of trust in an oracle service (which can certainly cheat detectably, and undetectably in some edge cases) to tell them what random.org is saying. I've been thinking of some ways to make this process somewhat less nasty, but I'm wondering if it will end up solving itself.

As I understand it Serenity will need random numbers to function, and there's a plan to do a RANDAO-style multi-party commit-and-reveal scheme. Will a by-product of this be to provide a random number that can safely be used fast by contracts?


texts: Getting txpool with python web3 and infura

texts:
I am trying to monitor pending transactions with python web3 and an infura node. I am currently using web3.eth.getBlock(block_identifier='pending', full_transactions=True) on a loop to fetch pending transactions, but it seems to be missing some transactions and completely ignores transactions with lower gas prices.
I have tried using w3.eth.filter('pending') but that just gives an error
ValueError: {'code': -32601, 'message': 'The method eth_newPendingTransactionFilter does not exist/is not available'}
Is there any way to access the full txpool on python with an infura node?


texts: Can't unlock address when using ganache-cli

texts:
I want to unlock an address and fund it with ETH in ganache that I don't have its private key. So I run this:

./node_modules/.bin/ganache-cli --hardfork istanbul --port 8545 --gasLimit 8000000 --fork https://mainnet.infura.io/v3/xxxxx -e 1000000 -u 0x42665308F611b022df2fD48757A457BEC12BA668

However, I get: Error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 7000000 and the sender's account only has: 0 when I want to send tx with the address. Please help.


texts: Block sealing failed err="unauthorized signer"


texts:
I'm trying to run my code but I get this error:

Could not compile the source code.

Undeclared identifier.
    require(available);
            ^-------^
However, I defined 'available' as a boolean in a struct

struct Car{
  address  VechileOwner;
  string make;
  string model;
  Renter renter;
  bool available;
  uint pricePerDay;
  uint deposit;
  uint entrycode;
  uint minRentalDay;
  uint maxRentalDay;
 }

Much Appreciated.


texts: How to use --trie-cache-gens value as performance tunning on downloading the blockchain (Geth)?

texts:
I would like to know how to use a specific command in geth.

Geth lists "Performance tuning options:

--trie-cache-gens value (number of trie node generations to keep in memory - default: 120).

Thing is, I have a HDD that is almost always 99% while I have used 2048 cache option to speed up things. While using chrome also, I am using 63% memory. I have 8GB ram memory.

How can I use trie-cache-gens to tune my computer to speed download the blockchain? Should I increase from it's default value of 120? How much can I speed it up before I run out of memory? Is there some math I can make or just try it some?

Can it speed it up by much?

Thanks in advance for the answers.


texts:
https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol
at this file.
  function createClone(address target) internal returns (address result) {
    bytes20 targetBytes = bytes20(target);
    assembly {
      let clone := mload(0x40)
      mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
      mstore(add(clone, 0x14), targetBytes)
      mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
      result := create(0, clone, 0x37)
    }
  }

i know mstore mean. but why must this special address?
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000


texts: How to see the frontend in ethercamp's cloud9?

texts:
I'm trying to run the example DApp on live.ethercamp.org but following the procedures the stated in ReadMe.md I cant get the webpage up with http-server

The browser says:

  This site can’t be reached

  http://172.17.0.21:8080/?_c9_id=livepreview0&_c9_host=https://xxx.by.ether.camp is unreachable.
  ERR_ADDRESS_UNREACHABLE


texts: Why does retrieving stored data cost so much compared to using calldata in Solidity?

texts:
I have a function that I need to pass an arbitrary length array of addresses to. In remix, just calling a function that has an address[] costs around 30k gas for an array of 5 addresses:
function fun(address[] calldata addresses) external returns (address[] memory) {
    return addresses;
}

The addresses that I want to call are of a finite set of about 2000 addresses, but it could be any of those addresses when I call my function, so I thought that I could store them in a mapping of uint=>address and call my function with an array of uint16's that I can then look up the addresses with (that I previously stored). Theoretically this should be much cheaper because the calldata is way smaller:
pragma solidity 0.5.17;

contract StoreIDToAddress {

    mapping(uint => address) public numToAddress;

    function getAddresses(uint16[] calldata  _IDs) external view returns (address[] memory) {
        address[] memory arr = new address[](_IDs.length);

        for (uint i; i < _IDs.length; i++) {
            arr[i] = numToAddress[_IDs[i]];
        }

        return arr;
    }

    // Other functions to initialize numToAddress etc
}

getAddresses costs 29378 gas with an input of [0, 1, 2, 3, 4].
This alone makes it no cheaper than just including the addresses themselves in the calldata, and when I tested with a 2nd contract that takes in an uint16[] and passes it to getAddresses it costs 34196 gas:
    function testUint16Arr3(uint16[] calldata _arr) external returns (address[] memory) {
        return storeIDToAddress.getAddresses(_arr);
    }

Using bytes and decoding that in to a uint16 to call getAddresses is 35095 gas.
So my question is, why does getAddresses cost so much gas when (AFAIK) the biggest operation is 5 x SLOAD = 1000 gas? How can I reduce the gas cost of getting addresses in to my functions?


texts: I can't connect to eth-netstats I need help

texts:
I already created a node with geth and a blockchain with a private network but when connecting the eth-net-intelligence-api to the eth-netstats I don't get anything, I don't get an error, it just stays without doing anything, I don't know if someone else has this error. Here he left the images:
eth-net-intelligence-api:

Here is the app.json file to see if I'm doing something wrong.


texts:
I would like to ask about ethtrader.org.

Could anyone prove please, that they are not a scam and part of the ethereum community?

Many thanks...


texts:
Apologies in advance if this is a silly question but I can't figure out why my metamask private key is 66 characters long instead of 64? I'm attempting to use this key with the MakerDao Dai.js library and getting an error of "Invalid Private Key Format" its failing on this check - github

What am i missing?


texts:
I'm using WEB3JS for generate some operations against a ganache environment. I'm able to generate new address in the environment, but I don't know how to add ether to this account
  let newAccount = await web3.eth.personal.newAccount();
  console.log(newAccount);

Any idea?


texts: Does transaction hash in Ropsten ( testnet) deprecate ever?

texts: I want to know whether transaction hash created in testnet stay forever or after sometime it gets deleted? Like in IPFS garbage collector deletes unpinned files after two weeks. IPFS is also decentralized.


texts: Oraclize querying multiple API's in one call

texts:
I wonder if it's possible to call oraclize JUST ONCE, and get results from different APIs.

oraclize_query("URL" , "['json1' , 'json2']");

The problem that I have is that the API that I'm using does not allow to get two values from one call. Therefore I need to call it twice. So I wonder if I can call oraclize one time and get those two values.

Thanks


texts: How to determine the contract method called and with what parameters from a transaction hash?

texts: Suppose I have a transaction hash and it belongs to some transaction which was done on a smart contract. From the hash, how do I determine what was the contract method which was called and with what parameters?


texts: As we know, the blocks are spreading through the network via gossiping. Due to the network latency or some other reason, is it possible that a node mining a block before it sync the latest block? namely it's not mining on the top of longest chain. and will this block be considered invalid?


texts:
I'm building a simple contract with inheritance as part of a tutorial and I'm getting an error “No data is deployed on the contract address” on the newBrand contract.

The contract is executing, but isn't deploying any data.

The code complies correctly, with no warnings before I deploy. I've seen the other questions on the forum, for cases with the same error, but I cannot see why this simple contract will not deploy normally. The solution to this issue has not been provided, just extra nuggets of information that do not explicitly explain 1) the mistake being make, and 2) the solution to the mistake.

The mortal contract deploys with no problems. Code below:

pragma solidity ^0.4.6;

contract mortal{

  address public owner;

  function mortal(){
    owner = msg.sender;
  }

  modifier onlyOwner{
    if (msg.sender == owner){
        _;
    }else{
        throw;
    }

  }

  function kill() onlyOwner{
    suicide(owner);
  }

}

contract newBrand is mortal{

  string public brandName;

  function newBrand(string _brandName){
    brandName = _brandName;
  }

  function changeBrandName(string _newBrandName) onlyOwner {
    brandName = _newBrandName;
  }

}

Simple stuff for most people on here I'm sure - any explanation would be greatly appreciated...


texts: Is it secure to run public ethereum node?

texts:
I'm creating my first Ethereum contract with truffle. I want the web application to be usable without MetaMask so I was wondering if it is a good idea to run my own private node and to
connect from the frontend like this:

this.web3 = new Web3(new Web3.providers.HttpProvider('http://my-public-ip:8545'));

Are there any security risks with this approach ?


texts:
I would like to do a division in my solidity smart contract but the result is always 0, I found some stuff on stackoverflow about this problem, this is working with this function but not with SafeMath, someone know why?

    uint amount1 = 100;
    uint amount2 = 142;

    result = SafeMath.div(amount1, amount2); // return 0

Regards


texts: Casper: will you need to buy the right to be a validator or will it be free?

texts:
According to this document: https://docs.google.com/document/d/1Xf_iHGI51Lp6nVHPZo0SdUw60-NA6YJUvk2s-eYaxLE

citation 1:

  maxDeposit - the maximum deposit allowed to become a proof of stake
  validator. If you want to deposit more, you must purchase multiple
  slots. Set to 50000

citation 2:

  Alongside this, another question is how to target the minimum entry
  size and a possible entry fee. One approach is to auction entries,
  thereby resolving many preference revelation issues and allowing
  targeting a fixed PoS participation rate, but at the cost of
  introducing or exacerbating selfish-mining attacks.

Looks like there is a talk about to make paid participation. And maybe there be a market of participation. With which, I'm, personally, perfectly fine and I think this is very good thing (see conversation in this question).

The path how I found it was:
Ethereum documentation --> Other Ethereum Links: Giant Ethereum Resource List --> Proof-of-Stake Resources: Vitalik's CASPER Spec Google Document

Can't be sure is it relevant now.

So is there such a plan?


texts: Where can I get latest Ethereum2 information?

texts: Somtimes Ethereum developers like Vitalik mention about Ethereum2. Where can I get latest information about Ethereum2 ideas or roadmap?


texts: How to deploy a contract using web3@1.0.0-beta.51 and solc@0.5.7

texts:
I want to write some tests using mocha and ganache-cli for my contract. I tried to deploy a compiled contract like so:

//ZombieFactory.test.js

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());

const compiledZombieFactory = require('../ethereum/build/ZombieFactory.json');

let accounts;
let factory;

beforeEach(async () => {
    accounts = await web3.eth.getAccounts();

    factory = await new web3.eth.Contract(compiledZombieFactory.abi)
        .deploy({data: '0x' + compiledZombieFactory.evm.bytecode.object})
        .send({from: accounts[0], gas: '3000000'});

});

describe('ZombieFactory', () => {
    it('deploys the zombie factory', () => {
        assert.ok(factory.options.address);
    })
});

When I run this using npm run test, I get the following error:

ZombieFactory
    1) "before each" hook for "deploys the zombie factory"

  0 passing (2s)
  1 failing

  1) "before each" hook for "deploys the zombie factory":
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

I did some research and I suppose this error occurs because the code fails to deploy the contract successfully.
I would like to know if this issue is due to the deploy code or something else.


texts: How can I create an ethereum wallet and get the 12 key words by using the ethereum rpc? I cannot find the rpc api.


texts: How can contract ownership be transferred from one account to another?

texts: I have a contract belonging to one of my accounts. How can I transfer ownership to another account?


texts: MetaMask not showing the testrpc accounts

texts:
I run testrpc on the terminal and I get the 9 accounts but when I go on crhome and check on metamask after selecting the testrpc blockchain it won't show any of the 9 accounts from metamask but instead 2 random generated wallets...what can i do?
Thanks


texts: how to correctly calculate amountTokenMin and amountETHMin for UniSwap removeliquidityeth?

texts:
https://uniswap.org/docs/v2/smart-contracts/router01/#removeliquidityeth
How do i safely/correctly calculate the amountETHMin and amountTokenMin when calling this function from a contract? I could just use 0's but my tx will probably get frontrun/sandwiched.
Thanks!


texts: I am wondering what the best way to store a SHA-256 hash is in solidity. The SHA-256 output is a 64 byte hex string when I pass the hash from my web app to my contract. The issue I run into is that I start getting errors such as inaccessible dynamic type when I use strings - since strings are actually just dynamically sized arrays. Any ideas?


texts: Why is Geth.exe flagged by Malwarebytes as malicious?

texts: I installed Mist to setup an ETH wallet. Mist comes packaged with geth.exe, but when starting the application it attempts to connect to 95.79.46.241:30303 which gets flagged by Malwarebytes. An IP lookup of that address reveals it is registered to a holding company in Russia. What is going on here?


texts: I've bid 1ETH for ENS domain and was the only bidder - revealed during the 48 hours period - how do I get the refund?

texts:
Please have a look at tx: https://etherscan.io/tx/0x4831dbed82aaf859b484beae26ed8a24be2fce4c3912a5958d0b35950a72c90e

It seems like I've correctly revealed my bid:

How do I get the refund?

Tried checking internal transactions but nothing there...

Full history of my account: https://etherscan.io/address/0x85A363699C6864248a6FfCA66e4a1A5cCf9f5567 - you'll see two recent transactions to ENS.

EDIT:

http://docs.ens.domains/en/latest/faq.html

  If only one bid is revealed, that bidder deposits 0.01 ether, the minimum bid. The remainder of their bid is refunded as soon as they finalise the auction.

How to finalise the auction?


texts: What is the difference between getPastEvents() vs events.MyEvent({ fromBlock: 0})?

texts:
What is the difference between using myContract.getPastEvents() to get past events and using myContract.events.MyEvent({ fromBlock: 0, }) ?

Also, if I pass to fromBlock a block number that has not been mined yet, does it work as expected?


texts: How to get wallet seed for account created using geth

texts: I have private net and created 2 accounts using geth...I connected private net to metamask but accounts were not visible...I didn't get any seed while creating accounts using geth...Is the only option is to import account in metamask?


texts: How can I set the price of my cake token into bnb in pancakeswap

texts: Where can we set the price of the cake tokens so that we can easily convert bnb to cake tokens and vice versa in the pancakeswap contracts? Any help?


texts: How to let the user sign a nonce in frontend and check the authenticity in the backend?

texts:
My frontend code:
html (using cdn, couldn't make the npm run...):
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>

javascript:
web3.eth.personal.sign(nonce, from[0], "test password!")
                    .then(signature => {
                        console.log('signature', signature);
                        sendSignatureToServer(signature);
                    });

In the backend:
const util = require('ethereumjs-util');

function checkSignature(nonce:string, signature:string) {

    nonce = "\x19Ethereum Signed Message:\n" + nonce.length + nonce;
    nonce = util.keccak(Buffer.from(nonce));
    const sig = signature;
    const {v, r, s} = util.fromRpcSig(sig);
    const pubKey  = util.ecrecover(util.toBuffer(nonce), v, r, s);
    const addrBuf = util.pubToAddress(pubKey);
    const addr    = util.bufferToHex(addrBuf);
    return addr;

  }

let possibleOwner = checkSignature("Hello world",req.body.signature);
    if(possibleOwner === myKnownAccountAddr){
        res.json({yes: 'YES!', sender: req.body.owner, signature: req.body.signature});
    }else{
        res.json({yes: 'NO!', sender: req.body.owner, signature: req.body.signature});
    }

It is always "NO!" - What am I missing here?
I know I could use:
web3.eth.personal.ecRecover("Hello World!", signature).then(console.log);

which is working well in the browser with metamask, but 1. I could not make web3.js run without a provider (metamask?) int the backend.
I tried anyways with web3 on node.js side:
import Web3 from 'web3';

 let web3 = new Web3("https://cloudflare-eth.com");
    let hash = web3.utils.sha3("Hello world");
    let possibleOwner;
    if(hash){
        possibleOwner = await web3.eth.personal.ecRecover(hash, req.body.signature)
    }

and get this error:

web3-shh package will be deprecated in version 1.3.5 and will no
longer be supported.
web3-bzz package will be deprecated in version 1.3.5 and will no longer be supported.
(node:59630) UnhandledPromiseRejectionWarning: Error: Returned error: Method not found

so what is the right way to do this in 2021?


texts: Connect to separate geth with Ethereum Wallet

texts:
I am fed up with the slow syncing progress of the Ethereum Wallet from ethereum.org. Every time I start it up I have to wait.

It would be much more convenient to have a geth instance running remotely and connect it to the Ethereum Wallet.

Is there a way to do so?


texts: Trying to mine - AlethOne on OSX is not doing anything

texts:
I have geth on an OSX retina iMac 5K and got it working and synchronized.

Tried running AlethOne and it just sits there displaying Status 11:05:57 New block#0 regardless of whether I "start mining" or not.

Tried turning geth off and ran AlethOne and got the same result.

Do I need to do something special with my router to make AlethOne synch inbound and outbound with the Ethereum network? Or do I need to install anything else? Is there a manual for AlethOne?

Thanks


texts:
I've been working with ens via web3.js and ensutils.js but I'm stuck at  startAuctionsAndBid function.

If I try :

var sbid = ethRegistrar.shaBid(web3.sha3('name'), eth.accounts[8], web3.toWei(0.01, 'ether'), web3.sha3('my secret phrase'))
ethRegistrar.startAuctionsAndBid(0x12345670159e0506114fee112628a969f587bf4b7bf4a728661705c08fa9ce82, sbid);

I'm getting:

TypeError: 'forEach' is not a function
    at web3.js:1553:13
    at web3.js:694:16
    at map (<native code>)
    at web3.js:693:20
    at web3.js:4059:46
    at web3.js:4130:19
    at apply (<native code>)
    at web3.js:4223:16
    at <anonymous>:1:1

Other functions, like startAuction, newBid, unsealBid work as expected,  only startAuctionsAndBid gives me an error.
Any idea why?

Update:

The forEach error was fixed by providing an array as first argument.
The function is now executed but it fails on contract execution

startAuctionsAndBid expects 2 arguments:

hashes bytes32[]
sealedBid bytes32

How can I construct the elements of the hashes array?
I tried hashes = [web3.sha3('name')], but no luck.


texts:
I've got multiple large contracts. I've been able to deploy to Rinkeby with truffle fine after about 2 or 3 tries with 2 gwei.

I tried two times now to deploy to the mainnet. Each time I get invalid JSON rpc response. I have a feeling that if i just keep trying eventually it will get through, like it does with Rinkeby, but its kind of expensive.

The odd thing is that I can see that the transactions are "successful" on etherscan. However my ABI is screwed up because truffle never finished building it. I went in manually and changed the network id to "1" so that it matched the mainnet, but then when I used that ABI to talk to the contract it told me that some if its values were 0x000 even though they were supposed to be instantiated in the constructor.

Is there some way to tweak my ./build directory so that I can interact with the contracts?
If the contract deploy was recorded as successful on etherscan does that mean the constructor executed?
Is there some place I can read about ways to increase my chances of having a successful deploy?

Thanks!


texts: Uncaught at initializeDrizzle TypeError: Cannot read property 'apply' of undefined

texts:
I am working a Drizzle truffle box project, and this is my first intro to React so I am struggling a little bit. I keep getting this error and I cannot for the life of me seem to fix it.

The contract ABI is getting passed in successfully and I have made sure the contract is referenced in Drizzle Options. I'm baffled as to why this is happening. Please advise. I can provide any other info as necessary

https://user-images.githubusercontent.com/33706156/44631233-2ee73580-a937-11e8-8214-307f1214c902.png

Anyone have any ideas? Here is a link to the code repo for the whole project. https://github.com/hashoshi/nft_token_project

FIXED repo link


texts: Possibility of creating a token where transfers have to be approved by a third party

texts:
just wondering if anyone here knows if it is possible to create a token  contract where by the token transfers have to be approved by a third party.

Thanks!


texts: I am trying to query historical blocks for specific events from my contract. Is a full node required for this? Or is a light node or fast node fine?

texts:
I am having difficulty seeing any events for my contract. They show up in etherscan but not when trying to view them using web3. I am running a light node. Do I need a full or fast node to have access to these events?

I am also using the python implementation of web3: https://github.com/pipermerriam/web3.py

Using the following code. I can confirm my transaction is in-between the block limits provided to the filter.

from web3 import Web3, HTTPProvider, IPCProvider
import json
ROPSTEN_RPC = 'http://localhost:8546'
ContractWithEvents = '0x...'
ABI = json.loads("""[{...}]""")
web3 = Web3(HTTPProvider(ROPSTEN_RPC))
contract = web3.eth.contract(address=ContractWithEvents, abi=ABI)
contract.pastEvents('newUpload', filter_params={'fromBlock':1564421, 'toBlock':1564441}).get()

This returns an empty list. When there is at least 1 event fired according to etherscan.


texts: How to assign a value to a bytes variable?

texts:
The function keccak256 () takes a bytes variable. You can't pass it bytes3 or byte []; it has to be of type bytes.
How do you set that to a specific value?
Here are some things I've tried, and the error messages I got.
bytes memory a = 0x05;
Error: Type int_const 5 is not implicitly convertible to expected type bytes memory.

bytes memory b = bytes (0x05);
Error: Explicit type conversion not allowed from "int_const 5" to "bytes memory".

bytes1 c = 0x05;
bytes memory d = c;
Error: Type bytes1 is not implicitly convertible to expected type bytes memory.

bytes memory e = bytes (c);
Error: Explicit type conversion not allowed from "bytes1" to "bytes memory".

Is it even possible to create a variable of type bytes and set it to specific hex bytes?


texts:
Does the Besu client support Plasma?

I guess this question could also be asked about other clients such as Geth and Parity as well.


texts: Transaction stuck in 'Pending' state when using 'sendSignedTransaction'

texts:
I am trying to execute a transaction by first signing it with my private key using ethereumjs-tx and then using sendSignedTransaction to send the transaction to the network. But somehow the transactions are stuck in pending state and I am not getting any receipt.

Below is the complete code that I am using.

const Web3 = require('web3') // ^1.0.0-beta.55

const abi = [
    {
        "constant": false,
        "inputs": [
            {
                "name": "name",
                "type": "string"
            }
        ],
        "name": "addName",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "current_name",
        "outputs": [
            {
                "name": "",
                "type": "string"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    }
]

const address = "0xffae257a6c0734ffbfb4c74fac865d95882d1153"

const network = {
    ropsten: "https://ropsten.infura.io"
}

var web3 = new Web3(new Web3.providers.HttpProvider(network.ropsten))

//Test Keys
const keystore = {
    ropsten: {
        address: "0x232D1038Ca6d21DF85F2109E6155E3f7c0Eea808",
        privateKey: "dd3853d79745bd65a3a2691052e9fe27c39a314e45780b389e5ceb236d615f6c"
    }
}

const TestContract = new web3.eth.Contract(abi, address,{
    from: keystore.ropsten.address,
    gas: 3000000,
  })

const sendTRX = async () => {
    let data = TestContract.methods.addName("vasa").encodeABI()

    const Tx = require('ethereumjs-tx')
    const privateKey = new Buffer(keystore.ropsten.privateKey, 'hex')

    let nonce = await web3.eth.getTransactionCount(keystore.ropsten.address);

    console.log("nonce: ", nonce)

    const rawTx = {
        nonce: nonce,
        gasPrice: '100',
        gasLimit: '300',
        to: address,
        data: data
    }

    const tx = new Tx(rawTx);
    tx.sign(privateKey);

    const serializedTx = tx.serialize()

    web3.eth.sendSignedTransaction('0x' +
    serializedTx.toString('hex'))
    .on('receipt', (receipt)=> {
        console.log(receipt)
    });
}

sendTRX()


texts: Error "does not exist" using web3.eth.personal.sign

texts:
In Error using web3.eth.personal.sign , the problem with the number of arguments was resolved. But now that I can try the actual call, I'm getting a "does not exist" error.

console.log("Calling personal.sign");
this.web3.eth.personal.sign(this.bottleDataToSign, this.addressProdFrom, this.passwordProd)
  .then((sig)=>{
    console.log("sig="+sig);

Console:

Calling personal.sign
ERROR
Error: Uncaught (in promise): Error: Returned error: The method personal_sign does not exist/is not available ErrorResponse onreadystatechange wrapFn onInvokeTask runTask invokeTask invokeTask globalZoneAwareCallback

In node_modules/web3-eth-personal/src/index.js, it looks like "sign" actually calls "personal_sign":

new Method({
        name: 'sign',
        call: 'personal_sign',
        params: 3,
        inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null]
    }),

Poking around in other node_modules/web3 directories/files, I didn't see any declaration for it:

$ grep -r "personal_sign" web3*
web3-core-helpers/src/formatters.js: * Hex encodes the data passed to eth_sign and personal_sign
web3-eth-personal/src/index.js:            call: 'personal_signTransaction',
web3-eth-personal/src/index.js:            call: 'personal_sign',

So does this imply the code is just missing? Am I calling it correctly? I'm still using npm web3 package: 1.0.0-beta.33, and used it from an import  Web3  from "web3";
Anything else to try? Thanks.


texts: How to find the largest Ethereum token holders on a given day?

texts: Here is the Bitcoin Rich List. Is there something similar for Ethereum?


texts:
Will it be faster for my system, in terms of number of transactions per second, if my network has a lot of nodes?
Does the number of nodes in PoA is related to the throughput?

Particularly I am interested in making a PoA network with Parity, using the AuthorityRound engine.

How does the AuthorityRound engine work for parity? Any resources to check?
Should a transaction be validated by the majority of the validators defined in the chain specs file?


texts: Set just a couple of parameters in a Struct

texts:
I have a struct with 10 parameters. The idea is to apply this struct for represent the flow of a trace. So I have to set variables values in a stepped way. Now i´m trying to call a function to set the first three values, but the compiler gives me a error.

pragma solidity ^0.4.24;

import "browser/DateTime.sol";

contract Travel {

address private owner;

struct TravelStruct
{
    //Origin
    address clientAddress;
    string originAirportName;
    uint32 originTime; //In timestamp
    uint16 originBagWeight;
    //Tape
    uint32 tapeArrivedTime; //In timestamp
    //Plane
    bytes8 flyCode;
    uint32 takeOffTime; //In timestamp
    //Destiny
    string destinationAirportName;
    uint32 destinyTime; //In timestamp
    uint16 destinyBagWeight;
}

mapping(uint => Travel) travels;
uint public travelsRegistryCount;

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

modifier ownerFunc
{
    require(owner == msg.sender);
    _;
}

function setOrigin (string _originAirportName, uint32 _originTime, uint16 _originBagWeight) private
{
    travels[travelsRegistryCount] = TravelStruct(owner, _originAirportName, _originTime, _originBagWeight, 0, "", 0, "", 0, 0);
}
}

  browser/Travel.sol:45:41: TypeError: Type struct Travel.TravelStruct memory is not implicitly convertible to expected type contract Travel.
          travels[travelsRegistryCount] = TravelStruct(owner, _originAirportName, _originTime, _originBagWeight, 0, "", 0, "", 0, 0);
                                          ^----------------------------------------------------------------------------------------^

First I try to set the first trhee values of the struct but the IDE tell me that the struct have more parameter than the three parameters that I load. So I put the trhee real values and the other 7 fake values. But the problem persist and now is telling my the block quote message.

How can I solve this??
It´s posible to load just the values that I want(something like: travels[travelsRegistryCount] = TravelStruct(owner, _originAirportName, _originTime, _originBagWeight)??
And for a traceability project is the correct way to make all the values in the same struct or is a better practice to make this cain of flow??


texts:
Is there a way with the Etherscan API so that you can get all the erc20 token balances for a specific address?

As explained here, you can see them with their web UI (the token tracker dropdown). Does their API provide equivalent functionality? As far as I have seen, you can only query for a specific token of which you already have the address. I need functionality equivalent to Ethplorer's API endopint getAddressInfo/{address}.


texts:
I am trying to create a smart contract that holds static data (resembling a paper contract) that is able to be sent around different users (a trade).

The tricky part is that I would like different permissions for different account types such as requiring multiple people to authenticate the transaction (buyer, seller and middle-men).

I am struggling to understand a few basic concepts and overall structure of the smart contracts in solidity.

Do I create a "factory" contract that controls the system and assigns different users a 'role' and based on the role the contract will need to be verified by all the required users of each 'role' before being sent?

Maybe if there is an example I can follow or see or even if someone can sketch a basic diagram on how this would work.

I forgot to mention that as a contract is swapped between users, I am not really interested in any monetary representation to be exchanged.


texts:
I'm running Windows and have around 50-80GB that I can dedicate to running a full node until I add a Hard Drive in a couple of months. I have around 200-400 download/upload and a decent processor. I could install Geth but I want to run Mist instead as a full node. How should I do this?

Edit: Sorry I didn't make it clear. I already have Mist running and syncing but I want to run a full node to help the network and act as a peer.


texts:
If one wants to create a trading wallet for ETH what Ethereum JSON-RPC events one needs to listen for incoming balance updates? Idea would be to reflect Ethereum account state in a local database.

Or is there another way to do this... read Ethereum wallet database direcly?

I am using Python as the server-side programming language. I guess purely cliet-side trustles JavaScript wallet might work as well.


texts: Possible to create Dapp using EthereumJ?

texts:
I am familiar creating Dapps by using Web3.js , I could able to do so , even in a normal browser ( without Mist). But wondering if that is possible by using EthereumJ ?

So instead of browser ( web3.js) connecting directing to the network and getting it done, the request should go through our hosted server which serves the data by using EhtereumJ ?

My Intention to use spring mvc web application.


texts: Creation of smart contracts (contract accounts)?

texts:
When I create a new Externally Owned Account it is not yet in the Ethereum blockchain. Information about this account appears (gets stored) on the blockchain only when the account balance changes.

But how does it work with Contract Accounts (smart contracts)? I wrote the contract, it now sits on my computer, and when I want to make it publically available I simply post it to the blockchain by some sort of a transaction and it will be stored there in some block after verification by miners? Is this understanding right?

Thank you!


texts: How to make recurrent payments based on smart-contract?

texts:
Need to make a smart-contract, which is signed once and executed on a regular basis.

For example, a salary contract.

Say, an employee signs the contact with the employer on the conditions that a certain amount will be transferred to him monthly. Then the contract is executed monthly and the movement of funds is made without  parties involvement.

How this type of contracts is called?


texts: Checking values of variables before storing them

texts:
It is common practice in programming to have some validity / integrity checking of data before storing it in a database.

For instance, before storing something which is supposed to be an URI, you check that it matches the URI syntax. Before storing something which is supposed to be a PGP key, you check that it has the right format.

But, in Ethereum, there are two problems for these verifications:

First the lack of existing libraries; (I program with Solidity) which will probably be solved with time.
Second the cost of gas; these verifications can be costly (I cannot imagine the gas needed to check a crypto signature with ECDSA).

Do you think it is today good practice to check input data or is it better to accept everything and store it in the blockchain?


texts: i cant withdraw my EWT tokens that are in a Custom RPC account. It says Send Eth. ? I added ETh to the Ethereum Mainnet account but still the EWT wont send. If i try to speed up the processing time i just get the speed up option of 0 Eth...


texts: MetaMask shows "UNKNOWN FUNCTION" when calling method send function

texts:
I'm trying to configure communication between a web front end and a deployed Ethereum contract (on Rinkeby).  I'm trying to call a simple method that updates a value, which looks something like this:

uint public value;

function someFunction(uint newValue) public {
    value = newValue;
}

And I'm calling the function like this from the client:

myContract.methods.someFunction(newValue).send({
    from: myAccount,
});

When MetaMask pops up, it says "UNKNOWN FUNCTION" above the value to be sent to the client (it's also doing this when I try to call methods that actually require ether value).  Is there any way to address the issue?  It seems that this would probably be distressing for users if actual ether were involved.


texts:
installed web3
and follwed steps int he image


texts: How can I peek into the stack using inline assembly?

texts:
I am specifically interested in calling a function whose return-type is unknown to me.

More precisely:

The contract which owns the function has had several versions over time
My contract may call this function on any of the instances deployed to the network
The function's return-type is (uint256) some cases and (uint256, uint256) in other cases

I've figured that I can call the function without storing its returned-value, so compilation by itself will not be a problem. Then, assuming that the actual values are still on the stack (is this assumption possibly wrong, due to compiler optimization or other reasons?), I can read the two topmost slots in the stack and continue as planned from that point.

Alternatively, I thought I could declare an interface of the contract in doubt, with the function in doubt returning (uint256, uint256), and then use that interface in order to call the function.

However, I tried it, and the function which returns a single uint256 has reverted:

pragma solidity 0.4.25;

contract NotMyContract1 {
    uint256 a = 1;
    function func() external view returns (uint256) {
        return a;
    }
}

contract NotMyContract2 {
    uint256 a = 1;
    uint256 b = 2;
    function func() external view returns (uint256, uint256) {
        return (a, b);
    }
}

interface INotMyContract {
    function func() external view returns (uint256, uint256);
}

contract MyContract {
    INotMyContract private notMyContract;
    constructor(INotMyContract _notMyContract) public {
        notMyContract = _notMyContract;
    }
    function test() public view returns (uint256, uint256) {
        return notMyContract.func();
    }
}

contract("MyContract", function(accounts) {
    it("", async function() {
        await test("1");
        await test("2");
    });
    async function test(id) {
        const notMyContract = await artifacts.require("NotMyContract" + id).new();
        const myContract = await artifacts.require("MyContract").new(notMyContract.address);
        try {
            const [a, b] = await myContract.test();
            console.log(id, a.toString(), b.toString());
        }
        catch (error) {
            console.log(id, error.message);
        }
    }
});

So I would be happy to hear any idea on how to do this in assembly, as well as any alternative suggestions.

The assembly operations which I had in mind are dup1 … dup16 and swap1 … swap16.

Thank you!


texts: how to declare address[] payable memory in solidity 0.5.8

texts: I wrote likeaddress[] payable memory thisAddress in function argument but compiler not passing it