texts: Port 30303 error in Mist when I run geth with a different datadir

texts:
I run geth with the following command. When I try to start Mist I get an error 30303: bind: address already in use. Why and how can I fix it?

This is the command I use to run geth:

geth --datadir /media/user/sdcard/chaindata --ipcdisable console

The command specifies that the blockchain data should be downloaded to the SD card rather than to the internal hard drive. It works fine for running geth itself.

But when I try to start Mist I get various error message such as:

Node type: geth
Network: main
Platform: linux (Architecure x64)

...11.167721 ethdb/database.go:82] Alloted 512MB cache and 1024 file handles to /home/ativera/.ethereum/chaindata
I0531 20:35:11.464852 ethdb/database.go:169] closed db:/home/ativera/.ethereum/chaindata
I0531 20:35:11.465825 ethdb/database.go:82] Alloted 512MB cache and 1024 file handles to /home/ativera/.ethereum/chaindata
I0531 20:35:11.587973 ethdb/database.go:82] Alloted 16MB cache and 16 file handles to /home/ativera/.ethereum/dapp
I0531 20:35:11.844313 eth/backend.go:170] Protocol Versions: [63 62 61], Network Id: 1
I0531 20:35:11.844786 eth/backend.go:199] Blockchain DB Version: 3
I0531 20:35:11.845385 core/blockchain.go:206] Last header: #0 [d4e56740…] TD=17179869184
I0531 20:35:11.845421 core/blockchain.go:207] Last block: #0 [d4e56740…] TD=17179869184
I0531 20:35:11.845440 core/blockchain.go:208] Fast block: #0 [d4e56740…] TD=17179869184
I0531 20:35:11.846587 p2p/server.go:311] Starting Server
Fatal: Error starting protocol stack: listen udp :30303: bind: address already in use

Why do I get the error message and more importantly, what should I do to be able to make Mist actually run when I start geth the way I do as specified above?


texts:
I been trying to create a crowdsale using this as (reference)[https://www.ethereum.org/crowdsale]. I have a doubt in this process (though I have tried it on test network multiple times but no success yet and hence asking this question).
Whose address should I use in field If successful send to - address shown in the below screen.

P.S I have tried using the association address over there but all my transactions are failing... I don't know why. Below are the screenshots for failed transactions. I tried one transaction with 1 ether and 2nd with 2 ethers both failed.


texts: command line brings up code instead of running commands

texts:
I am trying to run truffle commands on commandline but it brings up the code file instead

like this


texts:
In a scenario where a contract represents a buyer-seller agreement, sellers need to publish for each new bid a new contract/ or new entry in an array within a single same contract, and then a buyer selects the most appropriate offer by consulting the different existing bids (contracts/array).

My question is, how buyers can easily search and consult a blockchain to view the existing bids (contracts) and then select the non selected and appropriate one for him?

To my understanding, the buyer needs to know the address of the different contracts and then send Tx to each of them in order to read the bid content of each of them, is that correct?

What is the best design to implement such business logic in solidity?


texts: How to connect remix ide to geth running on localhost?

texts: Previously, according to tutorials, remix IDE had cube icon to connect to geth on localhost. Now the icon is gone and its not clear if the function is still there. Is it possible? How? I take remix here: https://github.com/ethereum/browser-solidity/blob/gh-pages/remix-7daae65.zip


texts:
Can I get a list of all transactions that are sent to a particular contract on Eris?

I see that there's a similar solution for the Ethereum API.
How can I get a list of of transaction data which are sent to a specific contract?

I'm hoping there's one for Eris.


texts: Accessing Deployed Token methods (containing modifiers) from a Separate Crowdsale contract

texts:
Is it possible to deploy the Token contract (T) & CrowdSale contract (S) separately and still be possible to access (T)'s modifier protected methods from (S).

Code of (T)

 contract Token {
    function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) {
     totalSupply = totalSupply.add(_amount);
     balances[_to] = balances[_to].add(_amount);
     Mint(_to, _amount);
     return true;
 }

Code of (S)

contract SellToken {
  TokenInstance instance;
  function SellToken(address _address) {
    instance = TokenInstance(_address);
  }

  function () payable {
    uint256 weiAmount = msg.value;

    // calculate token amount to be created
    uint256 tokens = weiAmount.mul(rate);

    // update state
    weiRaised = weiRaised.add(weiAmount);

    instance.mint(beneficiary, tokens);
  }

}

For some reason, when i'm trying to send ether to (B) I get the following error

EDIT: I also tried the method of having an Abstract interface but that didn't seem to have much luck either (Ref: Stack exchange Post)

Abstract Interface

contract TokenAbstractInterface {
    function mint(address _to, uint256 _amount) returns (bool);
    function finishMinting() returns (bool);
}

Modified Code of (S)

contract SellToken {
  TokenAbstractInterface instance;
  function SellToken(address _address) {
    instance = TokenAbstractInterface(_address);
  }

  function () payable {
    uint256 weiAmount = msg.value;

    // calculate token amount to be created
    uint256 tokens = weiAmount.mul(rate);

    // update state
    weiRaised = weiRaised.add(weiAmount);

    instance.mint(beneficiary, tokens);
  }

}


texts: Can miners freely chose the order of transactions within a block?

texts: Can miners freely choose the order of transactions within a block or are there any restrictions like the transactions need to be sorted by gas price?


texts: I want to move a small amount of OMG tokens to a different address. I have no ether at this address, so I guess I have to transfer some to this address in order to pay the transaction fee. If I want to send ~0.6 OMG, how do I calculate the transaction costs in ether?


texts: How to set different signer and gas payer for a single transaction

texts:
I am trying to make a transaction of DAI tokens from user wallet 0xDAIUserWallet to some random token contract say 0xRandomContractAddress. In this scenario I am using the private key of DAI User to sign the transaction as well as to pay gas fee, as he the owner of tokens.

What I am looking for, is to sign the transaction using the DAI user private key, but the gas fee should be paid by some other wallet.

I am using standard ERC20 Ethereum smart contract designed using solidity, and using ethers.js to interact with the smart contract.


texts:
I can't run Ethereum Wallet /Mist 0.8.0 on Ubuntu 16.04 using the release files
https://github.com/ethereum/mist/releases

Error messages:

  ./Ethereum-Wallet: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

  ./Mist: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory


texts: How to store an array of structs containing an array of structs?

texts:
I'm trying to create an array of structs that contain an array of structs.

https://gist.github.com/anonymous/65260d973a5640741a7d6174bf8fe7e6

From various searching it seems like it is not possible to initialize a struct with an array of structs to be pushed onto a stored array and that the best way seems to simply set a non-struct-array variable at a certain position in the outer array.

Unfortunately, I can't seem to get this to work. I've tried a variety of things, but mostly around the above.

If I run truffle test I get:

Error: VM Exception while processing transaction: revert

If I try running the createBar function in console I get the slightly different:

Error: VM Exception while processing transaction: invalid opcode

I'm not sure what I'm doing wrong. Any light shed or pointers would be greatly appreciated.


texts: How do I get event logs in transaction receipt, when I trigger event defined in other contract?

texts:
I'm trying to trigger event defined in another contract and get the event logs in transaction receipt but it's not working this way -

Base Contract --

pragma solidity ^0.4.0;

contract DataStore  {

    event Borrow(uint indexed bookId, address indexed borrower, uint timestamp);

    function borrowEvent(uint id, address borrower) {
        Borrow(id, msg.sender, now);
    }
 }

My Contract --

pragma solidity ^0.4.0;
import "./DataStore.sol";

contract Organisation {

    function borrowBook(address bookStore, uint id) payable {
        DataStore(bookStore).borrowEvent(id, msg.sender);
    }
}

Test Case -

it.only("should generate Borrow event log", async function() {
    let res = await org.borrowBook(orgAdr, 1, {from: accounts[1], value: web3.toWei(0.1)});
    let log = res.logs[0].args;
    assert.equal(log.bookId.valueOf(), 1);
    assert.equal(log.borrower, accounts[1]);
    assert.isAtMost(log.timestamp.valueOf(), Math.floor(Date.now() / 1000));
    assert.isAbove(log.timestamp.valueOf(), Math.floor(Date.now() / 1000) - 300);
});

In test case res.logs[0] is coming as undefined, which seems correct to me since the event is triggered via parent contract. How can I get that event logs in borrowBook function transaction receipt?


texts: How Do I Call a Function If I Know Only One ABI Function?

texts: OpenSea published a token contract without verifying the source code in which I know the token functions of the contract from the log (Its an ERC1155 contract). How do I transact with the contract only knowing one function?


texts: How to compute SHA-3 of an array of numbers in Javascript?

texts:
The documentation says that sha3 calculates the hash of the tightly packed arguments. Numbers seem to be converted to ASCII chars.

Consider using sha3(values) in Solidity with the type int8[3] values, and the Javascript array let values = [-1, 0, 1];, how can I calculate the web3.sha3(...) hash in Javascript to get the same result as in Solidity?

What I tried so far:

web3.sha3(values.map((x) => String.fromCharCode(x)).join(''))

Also, why are these two different:

> sha3([int8(-1), int8(0), int8(1)])
0x485d3017777c5ed1be9073116ba54b48f208c386ab83497d9c3a015a8382849e
> sha3(int8(-1), int8(0), int8(1))
0x8404dcb0a81bbb8eccbf96f10e1874b12380080d2143c02c8e44db200aaff384

I found this issue on Github, which doesn't seem to handle my case of negative numbers. Maybe I should convert to uint in Javascript?


texts: What really happened to the Ethereum blockchain after you created an ERC-20 token?

texts:
I'm trying to understand on what's happening underneath with the Ethereum blockchain after I created a completely a new ERC-20 token.

So, if I'm not mistkaen, an ERC-20 token is just a "smart contract" on the top of the ETHEREUM blockchain?

Thus, when you're creating this new ERC-20 token, you're just building a smart contract that is on the top of ETHEREUM blockchain, in which the nodes will validates its existence and who owns what, is that correct?


texts: getting error on max invalid genesis file: hex string has odd length


texts: How to prevent an attack on a contract creation service

texts:
Say there is a smart contract that involves a buyer and seller. Anyone can instantiate this contract but eventually two parties, the buyer and seller, will register with the contract. A seller would like to create a service that invites buyers to accept contracts with them, so they create a (centralized) web site that instantiates new contracts on the server whenever a buyer is interested, and then shares the address of the new contract with the buyer so that they can register through a transaction on the blockchain.

Given this model, how does one prevent a malicious user from draining the seller's funds by repeatedly triggering contract creation through the website with no intention of registering as a buyer?

Is there any way to prevent or discourage that attack while maintaining the constraint that the seller is instantiating the contract?


texts: Is there an on-blockchain way to host the frontend of a Dapp?

texts:
I understand that the whole backend of a dapp can exist on the blockchain, but it still seems like you need something to serve the frontend UI to make it realistically usable.

Are there any standards or protocols that allow the hosting of frontends to exist on the blockchain, so that one could simply load the entirety of a Dapp via the smart contract address?


texts: How the following pairing equality be verified in Etherum Smart contracts?

texts:
I have found available precompiled contracts in solidity. For example, this answer enter link description here points out a precompiled contract that can verify BLS signature. However, looking to the given code in the answer, I found that the bilinear pairings are based on elliptic curves.

My Question, by looking in the image attached, a smart contract is required to verify pairing equality given in step (5), Could someone suggest a way or even an existing available precompiled contract so I can call it with the given arguments so it can verify step (5)?
Note that, I wrote the protocol follow and attached an image since it is not allowed to write math equations here.


texts: Using Openzeppelin's crowdsale contract as a base, how can I set the rate to be a decimal number?

texts:
For example if rate = 10 then for every wei the buyer gets 10 "token units" which are each 1*10^18 of a full token (as the default decimal for the erc20 token is 18).

If I want the users in a presale to get 15% more tokens, how can I set the rate to a number equivalent to 11.5 so that each wei receives 11.5 "token units"?

I am struggling to see how I can implement this.

Thank you.


texts: Given a private key, I would like to sign a transaction offline, so it can be sent to a node or Infura without unlocking an account first. I can find many examples in javascript using ethereumjs-tx but I am using Rust and rust-web3 and can't find a single example that writes data. I need to be able to call functions, not just send value, so how to construct the function parameters is of particular interest. Also, how can I wait and process the return value if the function has a return value?


texts: Merkle Audit Proofs of Certification vs. Ethereum Merkle Proofs

texts:
The following article explains the process of "Merkle Audit Proofs of Certification". (Link to the article)

Is the process the same as "Merkle Proofs in Ethereum" ?
If their process is not the same, what are differences?


texts: Find address of a contract before deployment in Hardhat and Ethers.js

texts:
I have 2 contracts which take each other's addresses as constructor arguments. Here's the pseudocode,
constructor A(address B)
constructor B(address A)

I am deploying contracts using
const Contract = await ethers.getContractFactory(contractName)
const contract = await Contract.deploy(...args)
await contract.deployed()

console.log(contract.address) // I want to find address before, not after deployment

How to find the contract address before deployment?


texts: API in Node.js for Solidity smart contract

texts:
How to make API for Ethereum smart contract in Node.js? Can anyone send good examples? Is it even a standard way to make API in Node.js so it can interact with any interface because most examples I can find function from front-end only?
I have made the code with web3, shows expected output but doesnt commit anything to a new block like it does with truffle.
My code-

var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
console.log("Talking with a geth server", web3.version.api);

function test(){
  var sourceCode = fs.readFileSync('contracts/digitalToken.sol','utf8')
  var compiled = solc.compile(sourceCode);
  console.log(compiled.contracts[":digitalToken"]);
  var abiArray = compiled.contracts[":digitalToken"].interface;
  abiArray = JSON.parse(abiArray);
  var MyContract = web3.eth.contract(abiArray);
  var address = "0x1f81b5fa31d049b70556628cc01f22d362c41084";
  var contractInstance = MyContract.at(address);
  console.log(contractInstance);
  var value=executeAddvid(contractInstance)
      console.log({message: "Success",value:value});
      console.log('after passing--');
      console.log({message: "Success",value:value});
  var value1=readVidByUser(contractInstance);
    console.log({message: "Success",value:value1});
      console.log('after passing--');
      console.log({message: "Success",value:value1});

}

function executeAddvid(contractInstance){
  record = contractInstance;
  return record.addVid.call('0x0000000000000000000000000000000000000124',5,"ronaldo","0xc9f5a0572d95d5dea1331edcc192dacef51ecbb7",1000000000000000000);
}

function readVidByUser(contractInstance){
  record = contractInstance;
  return record.readVidByUser.call('0x0000000000000000000000000000000000000124','0x1f81b5fa31d049b70556628cc01f22d362c41084');
}

test();


texts: Should a new node on the network execute all the transactions since the very first?

texts:
This question might be dumb, I'm sorry in advance. I only had that much time for gaining expertize.

Say there is a huge working blockchain full of smart contracts and transactions on those smart contracts.

As far as I understand, all the nodes must execute all those smart contracts and all the transactions that change state of those contracts.

Then there is a new node joining this old blockchain. In order to have a correct state of all the contracts it should download the entire blockchain and then execute all the transactions related to smart contracts?

Is this vision correct, where do I miss something? Thanks!


texts: I am having trouble transferring my coin from coin-base wallet to coin-base pro

texts: Hello guys i am trying to transfer my coin from coin-base wallet to coin-base pro. it shows me a message " you are trying to send an erc20 token which are issued on the Ethereum  blockchain. This mean you need ETH to pay the miner;s fee to send this coin. I completely do not understand that


texts: I can't see any events triggered in tests

texts:
I'm using Truffle Framework and TestRPC.  Sometimes I can see events, but not always, so how do I show events in the console when running:

 truffle test

?


texts: Can 'your own crypto-currency' (created in the Ethereum Ecosystem) be mined as a standalone crypto-currency?

texts:
As I understand it (please correct me if I'm wrong) a typical Litecoin derived alt coin has its own blockchain and can be mined entirely separately from any other crypto-currency. Some alt coin miners may choose to mine the coin because they speculate it may increase in value (amongst other reasons).

If I create my own crypto-currency based on the Ethereum Ecosystem, is it intrinsically bound to the Ethereum Blockchain? Therefore mining will occur only by those already mining Ether?

I did see this post where the author suggests:

  Alternatively, I could accept gas fees in a currency other than Ether, by statically checking contracts to make sure they are guaranteed to pay me in some alternative token.

I guess that could occur if you reward miners with your own crypto-currency using:

balanceOf[block.coinbase] += 1;

However, this would require altering the mining software?

Putting all this together, to replicate the concept, withing the Ethereum ecosystem, of an typical Bitcoin derived altcoin (and mining of it). I'd need to create my own token, include the balanceOf[block.coinbase] += 1 within the contract and offer my own mining software (or modification of an existing software) that filters for payments of my token?


texts:
I don't know if I'm going a little bit mad here, or if this is actually an Ethereum address collision. I have installed Parity onto a brand new computer that I had custom built. The machine had not been turned on before today.

During Parity set up I created an account like normal. But the first thing that I noticed was that the balance of the account was none zero.

https://etherscan.io/address/0x00a329c0648769a73afac7f9381e08fb43dbea72

I'm gathering more info. But this is weird.

Ok update, I definitely have control over this account. I've made this transaction: https://etherscan.io/tx/0x33a1b81eae1c1d5f542c69960e3ace67177d61dd633639d41972ec603c73a96b . In it you can see that I sent 0.0016347 Ether which is the same number as appears in this URL Did I generate an existing Ethereum address in Parity?, the URL for this question.

I don't know how to prove that I have never controlled this account before, but I have never controlled this account before. This is definitely an address collision.

I'm not sure what this means, did I hit a one in a bazillion chance just randomly? I'd really like for some feedback about what I can do to prove my case. What are the implications for the Ethereum network?

Update

Ok I've had a look over what happened. I think this issue maybe related to an empty seed phrase account.

When I got to the create account stage, the computer froze for over 30 minutes, I restarted the parity client. Once the application loaded up again I was prompted to create a new account, I did and this time was able to create a new account, but no option for a seed phrase.

The next thing I noticed was that Parity gave me notifications of Ether deposits, I thought, "hmm! Parity must be giving you some faucet money now", but then I saw that the account had lots of transaction history.

This looks a lot like user error / Parity bug.

From the look of it, it seems like others are able to access this account from the more recent transaction history.


texts: How to pass arbitrary bytes to a function in Remix

texts:
According to this question I could write a simple contract like:

contract SimpleStorage {
  bytes input;
  function setInput(bytes enterBytes){
    input = enterBytes;
  }
}

Using "0x1234" as a parameter in Remix "does not work" and stores "0x307831323334" in the storage array. If I change the code to bytes2 then everything works as intended with the same command. How can I do the same using a dynamic array?

contract SimpleStorage {
  bytes2 input;
  function setInput(bytes2 enterBytes){
    input = enterBytes;
  }
}


texts: Problem while setting private ethereum network on AWS using bootnode

texts:
I'm trying to set up a private ethereum network using bootnode. I created two instances on EC2 (t2.medium) having the same security group.Firstly i created boot key by using

 bootnode -genkey boot.key

then i set up the bootnode by using following command

 bootnode -nodekey boot.key -verbosity 7 -addr "172.31.20.13:30310"

The bootnode was set up successfully with enode value =enode://52c75d5bb8f8287a5942151dabb35756b2ee664faa8a1f98b8fb5ae778953bf0dde553b0d574e85cbfcbd8adf4068a0c7611f270e673776c7e67225b38eadcd2@172.31.20.13:30310

I initialised both the nodes using the genesis file and following command

geth --datadir "./mydatadir" init genesis.json

Genesis.json

{
"config": {
"chainId": 1337,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"timestamp": "0x00",
"parentHash":      "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x00",
"gasLimit": "0x8000000",
"difficulty": "0x01",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x238dd521ad221b37cc176fa9f4bf88cf19fe39f1",
"alloc": {
 "0x238dd521ad221b37cc176fa9f4bf88cf19fe39f1" : {
 "balance" : "200000000000000000000000"
 },
 "0xaebc7588345fc7963505dd6de9d12390980fc13d" : {
 "balance" : "10000000000000000000"
 },
"0xa5c77bd6319a5eaba9494acd90cac9712f9e15c9" : {
 "balance" : "20000000000000000000"
}
}
}

I tried connecting now two nodes (two instances) to bootnode one node being on the same instance that of bootnode. I used th following command

geth --networkid 1337 --datadir "./mydatadir" --bootnodes                              "enode://52c75d5bb8f8287a5942151dabb35756b2ee664faa8a1f98b8fb5ae778953bf0dde553b0d574e85cbfcbd8adf4068a0c7611f270e673776c7e67225b38eadcd2@172.31.20.13:30310" --port 3003 --ipcdisable --syncmode full console

This nodes gets joined to bootnode successfully interacting with it

TRACE[05-24|21:01:55] << FINDNODE/v4                           addr=172.31.20.13:3003 err="unknown node"

TRACE[05-24|21:01:55] >> PONG/v4                               addr=172.31.20.13:3003 err=nil

TRACE[05-24|21:01:55] << PING/v4                               addr=172.31.20.13:3003 err=nil

TRACE[05-24|21:01:55] Starting bonding ping/pong               id=33c0695b8d4f9ff6 known=false failcount=0 age=424221h1m55.666391609s

TRACE[05-24|21:01:55] >> PING/v4                               addr=172.31.20.13:3003 err=nil

But when i run the same command on other instance (node)

geth --networkid 1337 --datadir "./mydatadir" --bootnodes "enode://52c75d5bb8f8287a5942151dabb35756b2ee664faa8a1f98b8fb5ae778953bf0dde553b0d574e85cbfcbd8adf4068a0c7611f270e673776c7e67225b38eadcd2@172.31.20.13:30310" --port 3004 --ipcdisable --syncmode full console

The node is launched successfully but i don't see it interacting with the bootnode and when i type admin.peer command on both the nodes i get empty list.Am i doing something wrong? Please help me out


texts: Anonymity preserving approaches in smart contracts?

texts:
What approaches are practicable to enhance anonymity in smart contracts?

P.S.1: Some proposals have been proposed such as Hawk or ZoE project ;however, I am looking for other approaches.

P.S.2 : Address clustering: A common approach to analyze the anonymity is to extract information of the transactions in the blockchain, meaning that from which addresses the coins comes and to which addresses it goes. Address clustering is one of the approaches to de-anonymize users. Different techniques are employed for such clustering [1, 2, 3, 4]. So, relying only on pseudonymity seems cannot be enough to preserve anonymity of users.

P.S.3: Mixing: Another approach to anonymize transactions is Mixing. One of mixing approaches is CoinJoin [5] in which several users create together a transaction with multiple input and output addresses. One of the problems of this method is transaction validation such that a valid transaction must be signed by all participated users and so anonymous participants can prevent transaction validation when they does not sign mixing transaction in which they take part. So, Mixing approach is vulnerable.

References:

Reid, Fergal, and Martin Harrigan. "An analysis of anonymity in the bitcoin system." Security and privacy in social networks. Springer, New York, NY, 2013. 197-223.
Androulaki, Elli, et al. "Evaluating user privacy in bitcoin." International Conference on Financial Cryptography and Data Security. Springer, Berlin, Heidelberg, 2013.
Ron, Dorit, and Adi Shamir. "Quantitative analysis of the full bitcoin transaction graph." International Conference on Financial Cryptography and Data Security. Springer, Berlin, Heidelberg, 2013.
Meiklejohn, Sarah, et al. "A fistful of bitcoins: characterizing payments among men with no names." Proceedings of the 2013 conference on Internet measurement conference. ACM, 2013.
Maxwell, Greg. "CoinJoin: Bitcoin privacy for the real world." Post on Bitcoin forum. 2013.


texts: What is the websocket URL in Ethereum on Geth?

texts:
I've lunched an Ethereum server based on Geth. Now, I need to be notified about all incoming transactions on my generated accounts.
In my previous Bitcoin Core server, I had an option in its config file like this:

walletnotify=php -f /path/notify.php %s

Through this code, Bitcoin server sends all events to the specified file, and then, I process other things.
But I don't know what is the exact mechanism to do that in Geth and Ethereum. The official documents, only said use --wsaddr, --wsport, --wsapi flags. But, where do I have to listen to notifications?


texts:
I was around block 2.5 million on a "full" sync and I think it would've taken months to fully sync. At times the blockchain grew faster than my computer was syncing.

I moved that directory over to a new name and now had an empty directory to restart. I used geth -syncmode="fast". This worked for about 48 hours. My cellphone is my wifi hotspot and it gave out on me. So it finished the "fast" portion and started going over the blocks again. I assume downloading the "real data."

Things were good... until I hit block # ~2.2 million. I'm on a 50mpbs fiber connection at work and getting 1,2 maybe 3 blocks anywhere between 1-3 minutes. After my cellphone gave out I went to the library and was getting 60-110 blocks every 8 seconds (1.7-2.2 million).

I wish I had speed tested all the networks I've been on but none are slow. My phone isn't 100% reliable due to my location but until I hit 150GB this billing cycle it was pretty fast.

Is there anything that can be done to help it along? Is this a "slow spot" in the sync?

I assume after the "fast" portion is done and the program goes back over the chain to download the actual blocks... it no longer is downloading the headers of the new blocks? Would this be true?

Trying to get my tokens off an exchange into a private wallet. Intended on using Mist. Not having much luck. Been a very slow crawl to block 2335167. Anything I can do? Thanks.


texts:
thank you so much for your help
I really appreciated
this contract give me error in the line with (length)
"ParserError: Expected primary expression.
returns candidate.length"

pragma solidity ^0.4.21;

contract Election {

    struct Candidate {
        string name;
        uint voteCount;
    }

    struct Voter {
    bool authorized;
    bool voted;
    uint vote;
    }
    address public owner;
    string public electionName;

    mapping(address => Voter) public voters;
    Candidate[] public candidates;
    uint public totalVotes;

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

    function Election(string _name) public {
        owner = msg.sender;
        electionName = _name;
    }

    function addCandidate(string _name) ownerOnly public {
        candidates.push(Candidate(_name,0));
    }

    function getNumCandidate() public view returns(uint){
        returns candidates.length;
    }

    function authorize(address _person) ownerOnly public{
        voters[_person].authorized = true;
    }

    function vote(uint _voteIndex) public {
        require(!voters[msg.sender].voted);
        require(voters[msg.sender].authorized);

        voters[msg.sender].vote = _voteIndex;
        voters[msg.sender].voted = true;

        candidates[_voteIndex].voteCount +=1;
        totalVotes +=1;
    }

    function end() ownerOnly public {
        selfdestruct(owner);
    }
}


texts: Is it possible to give away ownership to another user regardless of dApp UI?

texts: A user purchased service from certain dApp. Although the dApp does not support any function (or UI) to transfer service purchased between users, is it possible that user give it (ownership) away to others by himself without any support of dApp?


texts:
I have installed Parity on Ubuntu successfully, but unable to install its UI. The following command:

sudo snap install parity-ui

is not working and ending up with an error:

user@ant-a7-surinder:~$ sudo snap install parity-ui
[sudo] password for user:
error: cannot perform the following tasks:
- Fetch and check assertions for snap "parity-ui" (10) (Get https://api.snapcraft.io/api/v1/snaps/assertions/snap-revision/suvnLkTtQB2e2zZlvi9tBKGBLoISrVIOmJNelKAcVdTuwaPXV0VzizWZZnU6ED45?max-format=0: dial tcp xx.xx.xx.xx:443: getsockopt: connection refused)

any help would be appreciated.


texts: Error: Failed account unlock attempt, is this an attack?

texts:
If I use my

geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain "*"
--datadir Users/xxxx/TestChain1 --port "30303" --rpcaddr
"127.0.0.1"  --nodiscover --rpcapi "db,eth,net,web3,personal" --
networkid 123 init /Users/xxxx/CustomGenesis.json

 geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain
 "*" --datadir Users/xxxx/TestChain1 --port "30303" --nodiscover --
 rpcapi "db,eth,net,web3,personal" --networkid 123 console

Everything works fine. But if I change rpcaddr "127.0.0.1" to a static address like 129.215.199.18 and run the above code, i will get the following warning in geth:

Failed account unlock attempt
address=0x621C385fe616fBe096322E71d6f02631d520C1Ca
err="could not decrypt key with given passphrase"

Note that this is the only account I had. Even if I try to unlock my account once I keep getting the above warning. It also prevents me to deploy the contract to the blockchain if I use remix and metamask. But I will not have any issue if I use rpcaddr "127.0.0.1"  in the above command line.

Also, when I send only one transaction via geth, the console keeps saying that a transaction has been submitted.

Question: What is the problem?


texts: JSON RPC sendTransaction data paramether

texts:
I'm trying to make a sendTransaction json rpc call and I don't know how to calculate the data paramether.

From the documentation:

data: DATA - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI

There is no specification how this should be made: the hash of the invoked method signature and encoded parameters


texts: How do I find the exact solidity compiler version used by truffle?

texts: I'm trying to verify a contract I have compiled and deployed onto the network using Etherscan. The contract was compiled using truffle. How do I work out exactly which version of the solidity compiler to select on Etherscan?


texts:
I am creating a pool as a pet project and using open-ethereum-pool as reference. I am working at share verification phase right now. But for some miner sends invalid shared. After viewing logs I found that difficulty is much lower than I set in my pool (2000MH).

Logs for both mine and open-ethereum-pool from Claymore (I just run it at the same time on 2 different GPU's): https://gist.github.com/ssbb/6266b783896ef56ab8e1b19c5874c3f9

You can see from open-ethereum-pool:

07:19:22:520    8e0 buf: {"id":0,"jsonrpc":"2.0","result":["0xd10ad5d96675e0b6758637046cc0537158201392a8f5cd927c00d5a805c57485","0xcdf42a47e552f9b4eb01d44a7b6a2b057fbfa1070f3148fd8e7f937a417ffdc1","0x0225c17d04dad2965cc5a02a23e254c0c3f75d9178046aeb27ce1ca574"]}

07:19:22:536    8e0 parse packet: 236
07:19:22:536    8e0 ETH: job changed
07:19:22:551    8e0 new buf size: 0
07:19:22:551    8e0 ETH: 06/14/17-07:19:22 - New job from 192.168.1.34:8888
07:19:22:567    8e0 target: 0x0000000225c17d04 (diff: 2000MH), epoch #21

And from my pool:

07:19:23:630    12b4    buf: {"result":["0xd10ad5d96675e0b6758637046cc0537158201392a8f5cd927c00d5a805c57485","0xcdf42a47e552f9b4eb01d44a7b6a2b057fbfa1070f3148fd8e7f937a417ffdc1","0x225C17D04DAD2965CC5A02A23E254C0C3F75D9178046AEB27CE1CA574"],"jsonrpc":"2.0","id":3}

07:19:23:646    12b4    parse packet: 235
07:19:23:646    12b4    ETH: job changed
07:19:23:661    12b4    new buf size: 0
07:19:23:661    12b4    ETH: 06/14/17-07:19:23 - New job from 192.168.1.34:9999
07:19:23:677    12b4    target: 0x000000225c17d04d (diff: 125MH), epoch #21

As you see - header, seed and diff are the same. But for some reason it's 2000MH for open-ethereum-pool and only 125MH for my pool.

Why this may happen? Which values will affect this?


texts:
I want to build a listener in python using web3 as usual.
The issue is that I have a lot of event on my contract (let say 30), and depending the event I have an action to do. Here is my code, and I'll explain just after my issue :
def handle_event(event):
    receipt = w3.eth.waitForTransactionReceipt(event['transactionHash'])

    # TO IMPROVE
    result_event_temp = contract.events._Event1().processReceipt(receipt)
    if len(result_event_temp) == 1:
        result_event = result_event_temp

    result_event_temp = contract.events._Event2().processReceipt(receipt)
    if len(result_event_temp) == 1:
        result_event = result_event_temp
    #END TO IMPROVE

    my_event = result_event[0]['event']
    if (my_event == '_Event1':
        dosomething
    elif (my_event == '_Event2':
        dosomethingelse

def main():
    block_filter = w3.eth.filter({'fromBlock': 'latest', 'address': address})
    log_loop(block_filter, 2)

def log_loop(event_filter, poll_interval):
    while True:
        for event in event_filter.get_new_entries():
            handle_event(event)
            time.sleep(poll_interval)

maybe you understand my issue : I cannot know the name of the event (variable my_event) before getting the result for all my possible event. Here I put example for 2, but if I have 10, or 100, it can be a nightmare to test them one by one with  contract.events._EventXX().processReceipt(receipt)
Is there any possibilities to get the name of the event directly in one shot or not?
something like :
my_event = event['eventName']

with that I will be able to delete all the box between "# TO IMPROVE" in my code
Thanks


texts: Can contracts access the block header extraData field?

texts:
The yellow paper (see section 4.4) defines an extraData header field as follows:

  An arbitrary byte array containing
  data relevant to this block. This must be 32 bytes
  or fewer

Can contracts natively read this extraData?


texts: Understanding Binance withdrawal fees measured in ERC20/transmitted via the ERC20 network

texts:
Let's say I'd like to withdraw 1inch from Binance to any sort of crypto wallet.
On the Binance fee schedule webpage one finds the following (column names above, screenshot of fees below):
Coin/Token | Full Name | Network | Minimum Withdrawal | Deposit fee | Withdrawal Fee

From what I understand, I can choose between two networks, the BEP20 and ERC20.
Now, to carry out the transaction successfully, both the sending and the receiving wallet need to support the chosen network (e.g. the ERC20). (?)
I'm wondering because the introduction video of Binance states that funds will be entirely lost, if one tries to transfer on a chain (e.g. ERC20) which is not supported on the receiving end.
As for the fees, I'm not entirely sure whether they are calculated in the transfer-network token, or in the original token:

3.86 ERC20 = 0.016551 $ (according to this price converter platform)
3.86 1inch = 19.8404 $ (according to coingecko)

This discrepancy is huge, so I'd like to know which of the two will be the actual network payment price.
Moreover, due to this price converter platform I'm pretty sure that 1 ETH is not the same as 1 ERC20, i.e. these are also two different tokens.
This question arose because of the following screenshot of ETH - withdrawal fees depicted on the same Binance fee schedule webpage:
Coin/Token | Full Name | Network | Minimum Withdrawal | Deposit fee | Withdrawal Fee

In the beginning, I thought the transaction fees were super high, but if I'm not mistaken, as 0.008 ERC20 = 0.000034 $, the actual transaction fees should be quite affordable.

Well, am I missing something here? Thanks in advance for your help.


texts: how to deploy a smart contract in ethereum using web3j

texts:
i am following this tutorial tutorial

under the section Working with smart contracts with Java smart contract wrappers i followed the same steps but i am getting RunTimeException here is the full stack trace

java.lang.RuntimeException: java.lang.NoSuchMethodException: smartcontract.Counter1.<init>(java.lang.String, org.web3j.protocol.Web3j, org.web3j.crypto.Credentials, org.web3j.tx.gas.ContractGasProvider)
    at org.web3j.tx.Contract.deploy(Contract.java:366)
    at org.web3j.tx.Contract.deploy(Contract.java:403)
    at org.web3j.tx.Contract.lambda$deployRemoteCall$5(Contract.java:426)
    at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30)
    at smartcontract.CounterDemo.deployContract(CounterDemo.java:37)
    at controllers.SmartContractController$$anonfun$counterContractDemo$1.apply(SmartContractController.scala:64)
    at controllers.SmartContractController$$anonfun$counterContractDemo$1.apply(SmartContractController.scala:58)

and here is my code
a code snippet of Counter1.java

public static RemoteCall<Counter1> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(Counter1.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
    }

    public static RemoteCall<Counter1> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(Counter1.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
    }

    public static Counter1 load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return new Counter1(contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    public static Counter1 load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new Counter1(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

CounterDemo.java

public class CounterDemo {

    public String deployContract() {
        String deploy = "";
        BigInteger GAS_LIMIT = BigInteger.valueOf(6721975L);
        BigInteger GAS_PRICE = BigInteger.valueOf(20000000000L);
        try {

            Web3j web3j = Web3j.build(new org.web3j.protocol.http.HttpService("http://localhost:8080"));
            Credentials credentials = WalletUtils.loadCredentials("pswd",
                    "path to privatekey/UTC--2018-12-15T12-06-10.************************************1");
            System.out.println("credentails address " + credentials.getAddress());
            Counter1 counter = Counter1.deploy(web3j, credentials, GAS_PRICE,
                    GAS_LIMIT ).send();

            //Counter.deploy(web3j, credentials, GAS_PRICE,GAS_LIMIT);
            deploy = counter.getContractAddress();
            System.out.println("address is {}" + deploy);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } // defaults to http://localhost:8545/
        catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return deploy;
    }

}

and here is the play controller action on which i am getting a contract deployed address

def counterContractDemo() = Action {
    val web3j = Web3j.build(new HttpService("http://localhost:8080/"))
    val CounterDemo = new CounterDemo();

    Ok(CounterDemo.deployContract())
  }

i am using playframework 2.3.4  and passing the right amount of parameters for Counter1's deplo method still the exception shows NoSuchMethodException how is this happening is there anything missing ?which is causing the issue any help would be appreciated


texts: Calling external contract running out of gas?

texts:
hope you can assist.

I have this very basic template setup, where contract TokenVote should simply store some data on the SimpleStore contract (Sort of eternal storage)

Yet my code always runs out of gas. What's wrong with my approach?

pragma solidity ^0.4.18;

contract ABSTRACTING {
    function addToWhitelist(address _ad) public;
}

contract SimpleStore {

    address[] public UserList;

    function addToWhitelist(address _ad) public {
        UserList.push(_ad);
    }
}

contract TokenVote {

    ABSTRACTING tokenContract;

    constructor(address token) public {
        tokenContract = ABSTRACTING(token);
    }

    function doStuff () public  {
        tokenContract.addToWhitelist(msg.sender);
    }

}


texts:
I'm getting this message on Parity

  "Connecting to the Parity Node. If this informational message
  persists, please ensure that your Parity node is running and reachable
  on the network."

I guess I pressed the wrong button, learning how to use it.

How to fix this?

Thank you


texts: Sent transaction from exchange to ICO (transaction failed)

texts: I sent a transaction from an exchange to an ICO and my transaction failed. Is there any way to retrieve my Eth from the ICO smart contract address? I guess somehow my transaction failed. please help if you can.


texts: How Proof-Of-Learning can be implemented?

texts: Seen a paper on Proof-Of-Learning and wanted to know-how the consensus works and how to implement it in ethereum?


texts: How do you normalize client-side web3 libraries?

texts:
In my web front-end, I need the ability to interact with the Ethereum blockchain.

It's possible a user has MetaMask installed.
It's possible a user is using the web without MetaMask installed.
It's possible a user is using an old dApp browser.
It's possible a user is using a modern dApp browser.

The following code takes care of all possibilities, and injects ethers.js as a last resort:

if (window.ethereum) { // Modern dapp browsers...
    window.web3 = new Web3(ethereum);
} else if (window.web3) { // Legacy dapp browsers...
    window.web3 = new Web3(web3.currentProvider);
} else { // Non-dapp browsers...
    window.web3 = ethers; // ethersjs provided library
}

It works! Great! I can make web3.eth.getBalance() calls and such.

Here's where it gets hairy:

It appears that the exposed interface for dealing with Contracts is not uniform across libraries, both in terms of the constructor and order of parameters.

Have I approached this entirely wrong?


texts: Freeze an amount in address until I unfreeze it

texts:
I would like to send a specific amount to another address. That amount is on the account but is freeze/blocked so is not possible to use it until I unblock it based on a contract.

Is it possible to achieve this with solidity?


texts: Forgot to add gas before sending Crypterium. What can I do?

texts: I tried to send about $120 worth of Crypterium from Etherscan to my wallet and forgot I didn’t have ETH to use for gas. The transaction has been stuck on “pending” for weeks now. Is there something I can do to fix this situation? Please help.


texts: Truffle migrate code with library, interface and contract

texts:
Suppose that I have a token contract as follow. How can i write the new migration.js file in truffle to deploy the contract?

TestCoin.sol

import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

contract ERC20 is IERC20 {

}

contract TestCoin is ERC20 {

}

1_initial_migration.js

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

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

I am thinking of something like this but not sure if it is correct

var SafeMath = artifacts.require("./SafeMath.sol");
var TestCoin = artifacts.require("./TestCoin.sol");

module.exports = function(deployer) {
  deployer.deploy(SafeMath);
  deployer.link(SafeMath, TestCoin);
  deployer.deploy(TestCoin);
};


texts: What is the point of variable transaction fees in Ethereum (and Bitcoin as well)?

texts: After reading through the docs and through this post, I understand the concept and need for gas, but I do not understand why each transaction can have a variable fee associated with it. It seems to be a way for the rich to get priority over the poor, or those willing to pay a premium to get their transactions confirmed before anyone else. To me, this sounds unsustainable. Is there another reason for these changeable fees?


texts: Metamask to Private ethereum communication issue

texts:
When i connect to my private ethereum network using the 'Custom RPC' of the metamask, it is getting connected from the MetaMask. FYI, i am connecting from outside the network of my server, and all necessary ports are open.

But the problem is the account information and the account balance of the Private ethereum network is not getting reflected in the MetaMask wallet.

Q: Do i need to import any seed phrase associated with the Private ethereum network on my MetaMask wallet?

If answer is yes, where can I find the seed pharase on the private ethereum network.

If answer is no, what do I need to do, to get the account numbers and balance reflected to my Metamask wallet?


texts: How does proof of stake prevent past blocks from being changed?

texts:
I have a question about Proof of Stake.
Are there any protections against a user just creating an entirely new chain, since there is no computational penalty for creating a really long chain, couldn't a malicious actor create a chain larger than the one most nodes agree on with a completely different history?
Or remove past transactions easily? Does Casper or other PoS implementations just have nodes check against their existing chains to check that they haven't been fully altered?
Because the proof of work protects against this by making it extremely time confusing to change one block because you have to redo all the proofs for each block in front of it, but if you don't need to do a large amount of CPU work to change history, couldn't nodes give new nodes a blockchain missing a block or transaction?


texts: Which Mobile Wallet support *data* field?

texts:
Referring to this link ERC: Standard URI scheme with metadata, value and byte code #67

Since it was proposed in 2016, may I know if there is any mobile wallet that can scan QR code with these 4 fields?

  address, value, gas, data

Especially the data field. Thanks


texts: Web3 - OR condition between multiple filters in getPastEvents

texts:
Take as an example the event PairCreated(address indexed token0, address indexed token1, address pair, uint); defined in UniswapV2Factory's contract.
Let's say that I want to fetch all the past events where one of the tokens used to create the pair was WETH.
I would write something like this:
await factory.getPastEvents("PairCreated", {
  filter: { token0: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
  fromBlock: 0,
  toBlock: "latest",
});

The problem  with the code above is that it fetches only the events where WETH was token0, ignoring the events in which WETH was token1.
A solution to this issue would be to do something like this:
const firstPart = await factory.getPastEvents("PairCreated", {
  filter: { token0: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
  fromBlock: 0,
  toBlock: "latest",
});

const secondPart = await factory.getPastEvents("PairCreated", {
  filter: { token1: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
  fromBlock: 0,
  toBlock: "latest",
});

const allEvents = firstPart.concat(secondPart);

The code above works fine, the problem with it is that it performs two calls.
Is there a way to do everything in only one call? I tried specifying filter as an array of objects (I.E.: [{ token0: "0x1234..." }, { token1: "0x1234..." }]) but Web3 just ignores it.


texts: Is POW required for a private blockchain?

texts:
PoW is a mechanism to keep block chain incorruptable from malicious nodes.
Now in a private block chain where all nodes are supposed to be honest, what purpose PoW would serve? Would it not be just a waste of computational power?


texts: What unit of time is used to calculate downtime penalties for Validators?

texts: Is the penalty a function of the number of blocks you missed or is it calculated in some time unit like seconds?


texts:
Is there any stablecoin except for DAI that is stable against the dollar without actually being backed by physical dollars?

Perhaps backed by CDP or some other method?

Vesa


texts: How to use ICO tokens to pay for ethereum dapp smart contract transactions?

texts:
Assume I had a successful token sale and sold all my tokens, now I have built an awesome dApp for the users using solidity smart contracts. Now my questions in this regard are -

How will my users with ICO tokens pay for dApp transactions fee on Ethereum, should I send them in ether or token ?

How to use tokens in a private chains built on Ethereum ?

How to use tokens to make transactions on another blockchain lets assume Ethermint for example here ?


texts: How do I redirect my .eth domain with eth.link?

texts:
Let's say I want to redirect somewebsite.eth.link to www.otherdomainiown.com.  http://spacex.eth.link/ does this and the redirect works on chrome.  However, I don't see an A record and I do see IPFS content in the records: https://app.ens.domains/name/spacex.eth

I read http://eth.link/ but did not understand it all.

It seems that if I set a DNS A record to somewebsite.eth.link then the redirect will automatically happen?

What should that DNS A record look like in this scenario?

What field and attribute in the resolver do I fill with that record (text record, something else)?

I'd like to make this work without IPFS / Swarm.


texts: Getting HTTP/1.1 403 Forbidden when i want to get account balance

texts:
Some months ago, I was able to get the balance of my account using this code (I run the code in Unity 2018 and get the code from tutorial in github. I modified some parts of the code). This is the link :https://gist.github.com/hafidkhoiruddin/992275be71f63bc5e9e8a9aac6339e2c, but since yesterday I can't get the balance. Would anybody help me? Here is the error :

  HTTP/1.1 403 Forbidden UnityEngine.Debug:Log(Object) Nethereum.JsonRpc.UnityClient.d__7:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

  RW: Get Account Balance gave an exception : HTTP/1.1 403 Forbidden UnityEngine.Debug:Log(Object) c__Iterator0:MoveNext() (at E:/Unity-and-Ethereum-project-final - Copy/Assets/RW/Scripts/TestBalanceAnd Account Script/PlayerBalanceController.cs:87) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)


texts:
Where can I find how to create my own chain parameters like the chain ID, maxTransactionSize, or gasLimitBoundDivisor chain specifications for a private chain?
For example, my initial test will be an encryption parameter that encrypts data in parameters for a smart contract.


texts: How to get address of contract during migrations

texts:
There 2 contracts: Token and Crowdsale. To deploy crowdsale contract we have to know address of Token contract. How to get this address in migrations?

var Migrations = artifacts.require("./Migrations.sol");
var ERC20Token = artifacts.require("./ERC20Token.sol");
var ERC20Crowdsale = artifacts.require("./ERC20Crowdsale.sol");

module.exports = function(deployer, accounts) {
  deployer.deploy(Migrations);
  deployer.deploy(ERC20Token, 1000, "Test Coin", "TCT");
  deployer.deploy(ERC20Crowdsale, THERE SHOULD BE TOKEN ADDRESS);
}

Thanks!


texts: Are there any implementations of smart contracts in Python?

texts: I want to implement some smart contracts and I am strongest in python.


texts: Ethereum V1 json with ETH in it ( on the blockchain)

texts:
I have an Ethereum V1 json  with ETH in it (on the blockchain).. Is there ANY method to use with this file and its associated password to access the ETH within?

Thanks


texts: What exactly is multicall and the benefits of it, compared to Single call? What is multicall contract and the purpose of it, I can't find any proper definition of it. Some source said that multicall merges all call into a single RPC call, I don't understand what is the benifits of doing so


texts: Does the address of an event get automatically indexed?

texts:
I understand that I can add indexed to a param in my event and it should speed up the retrieval of events later on.

I also know that 'address' comes back from these .filter.get() requests and corresponds to the address of the contract that sent the event.

What I don't know is if geth or other blockchain client indexes the address in the same way that it does an indexed param.

The specific question: Is there any adavantage to doing:

Event MyEvent(indexed address sendingContract, indexed address sender, int value)

and calling it with

MyEvent(address(this), msg.sender, 10)

or do we get that first parameter of the contract address for 'free?'


texts: How does eip1014 (create2) make collisions possible?

texts:
In the Clarifications section of EIP 1014 (create2) it says that "This EIP makes collisions possible."

It doesn't explain how collisions are now possible, but it links to EIP 684 (Prevent overwriting contracts), which says "Currently this is not an issue because there is no way to create a contract with the same address twice without spending >2^80 computational effort to find an address collision, but with #86 this will change."

So, now I'm a little confused. Is it that create2 now requires less than 2^80 to find a collision? Or does this sentence refer only to the case when a create2 is called twice with the same arguments resulting in the same address?


texts: Storing name values off-chain in events and web3.js

texts:
Somewhere I read the advice to store name (title, geographical name, people name, etc.) value off-chain in events.

But if a value is stored in an event, is there an efficient way to retrieve its value from a web3.js script (which is not running all the time and so cannot effectively subscribe to events)?

If I indeed decide to store in a contract, should I make a second contract specifically for name storages? (because storing names in the main contract storage would break single responsibility principle and abstraction pattern)


texts: RPC access to a Private Blockchain Error (-32600)

texts:
I am building a private blockchain for testing. I have a droplet at digital ocean and I installed the latest geth. The blockchain has mining but only headers and there is no data for content.

I am trying to get access to the browser from the solidity browser, chrome, and finally truffle.

I am connecting as follows -

geth --datadir "/home/zgeth/zdata" --port 30303  --rpc --rpcaddr "104.236.58.158" --rpcport "8545" --rpccorsdomain "*"  console 2>console.log

I am using Ubunti 14.04. The error in Chrome is when I attempt http://104.236.58.158:8545/

{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

In browser solidity I get

callback contain no result Error: Invalid JSON RPC response: ""

In truffle the command (migrate) fails as follows -

Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:544:12)
at ClientRequest.<anonymous> (/usr/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:414:24)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:191:7)
at Socket.socketErrorListener (_http_client.js:358:9)
at emitOne (events.js:96:13)

I think this is all the same error and somehow the rpc connection is not working. I have tried all kinds of variations and nothing works.

Has anyone any suggestions?

Note - since posting someone in Gitter suggested this is a memory issue. I have 512MB.


texts: Convert with JS a Solidity bytes32 to a Solidity string

texts: I have functions which are forced to return a bytes32 object, but then in my webapp I need to reconvert them to a classic string. How can I do that?


texts: truffle-contract: cannot test method before real consume ether method

texts:
I am using truffle-contract for connecting between frontend and smart contract. Currently, I can call method on smart contract and can consume ether successfully.

const result = await instance.adoptCreeptomas(
aquaQuantity,
firaQuantity,
aetherQuantity,
gaiaQuantity,
referrer,
{ from: accountAddress, value: ether(sendingEther) }

);

But before that, I want to test method first. So I move to this method:

 const data = await instance.adoptCreeptomas.call(
    aquaQuantity,
    firaQuantity,
    aetherQuantity,
    gaiaQuantity,
    referrer,
    { from: accountAddress, value: ether(sendingEther) }
  );

But when calling this, I meet following exception:

  errors.js:38 Uncaught (in promise) Error: Invalid JSON RPC response:
  {"id":6,"jsonrpc":"2.0","error":{"code":-32603}}

I am using ganache for local blockchain and metamask for provider. Please help me figure out why.

Thanks


texts: Invalid number of parameters for " ". Got 0 expected 2!

texts:
I have the function below which doesn't take any arguments when i call it from truffle console i get the below error, any idea on how i can fix this:

uint ownerCounter = 0;

function getNumberOfTokenOwners() public view onlyOwner returns ( uint ) {
    return ownerCounter;
}

  Thrown:
  Error: Invalid number of parameters for "getNumberOfTokenOwners". Got 0 expected 2!
      at Object._createTxObject (/home/linuxbrew/.linuxbrew/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:699:1)
      at Object.InvalidNumberOfParams (/home/linuxbrew/.linuxbrew/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-helpers/src/errors.js:32:1)

i am using

  Truffle v5.0.19 (core: 5.0.19) Solidity - 0.5.2 (solc-js) Node v12.3.1
  Web3.js v1.0.0-beta.37


texts: What does msg.sender call from a function called from another function return?

texts:
I have written a solidity contract which looks something like this:

function A(){
       a = B();
}

And B() is defined as:

function B() returns(address){
       return msg.sender;
}

I am getting a random string instead of the address of the sender as the output of a. Is it because it is called by a function and not by a user?


texts: Is it possible to have a contract run whenever a wallet address receives a transaction?

texts:
I'd like to build some code that monitors a wallet address, and performs an action whenever that wallet receives a transaction.

I could do this with say javascript or whatever, but that doesn't offer any guarantees to people that I will actually run it. Hence my desire to look into smart contracts or the like for this, where a contract is published to the blockchain and people can verify that it will run, so when they submit their transaction to the wallet address, the expectated behaviour will occur.


texts: How to define non-exploitability in the difficulty update algorithm?

texts:
In enter link description here, it is said that "We have already determined that our current algorithm is highly suboptimal on low volatility and non-exploitability, and at the very least we plan to switch the timestamps compares to be the parent and grandparent, so that miners only have the incentive to modify timestamps if they are mining two blocks in a row."

What does the 'switch' mean here? Besides, I think the homestead version is good enough. Where is the disadvantage?


texts:
I want to know how to take a backup of Private Ethereum Blockchain (chain data folder) while the chain is running.

The problem is that suppose my chain height is at 1000 and it gets crashed or if I kill the process manually and after that I start the chain again then it never starts the chain from the height where it has stooped.

But if I close the chain properly then it gets started from where it has stooped.
After closing the chain properly I get the message as

Blockchain manager stopped.
Stopping ethereum protocol
Ethereum Protocol Stopped
Transaction pool stopped.
Database Closed

I think the reason is it is keeping the blocks in RAM for some time and after some height it is storing it in the database.

I tried to take a backup from geth console :

admin.exportChain()

and it worked well, but the problem is as we can't use admin from web3 module so it is not possible from application.

I even tried import and export option of geth, but to do that the chain should not be running.

so is there any way to take a backup of chaindata folder.


texts:
I have a token contract that is already deployed in the mainnet, Is it possible for me to inherit the properties of that contract for my new contract that is going to implement the use-cases for the deployed token.

My doubts are,

Is it possible to write a new use-case contract inheriting the properties of the old contract..?
Do I need to deploy the token contract again to achieve it..? Or is it possible by deploying the new contract from the same address where the token contract got deployed..?

Please let me know the best approach..


texts: eth.getBalance(eth.coinbase) = 0, node/client not fully synced yet

texts:
I just started to get my fingertips wet with Ethereum and Dapps.
After receiving some ether on Ropsten to test with:

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

I can't verify the amount on an attached console (to my syncing geth instance):

eth.getBalance(eth.coinbase)
Result: 0

Is this an issue of the node not being synced completely yet?

Cheers,
Mario


texts: Random contract address generated by sendTransaction when receiver is undefined

texts:
I am new to Ethereum, trying to get the hang of using geth and web3js.
Looked around and could not find a similar issue, would appreciate some explanation over the following.

I tried to create a transaction using web3js console:

eth.sendTransaction({from:sender, to:receiver, value:amount});

Following a silly mistake, instead of setting the receiver as an address string, I have set it to:

receiver = eth.accounts['public key string here...'];

Obviously, I do not have an account with such an index, so seems like receiver should be undefined and thus sendTransaction throw an error.

However, the transaction did initiate, and created a contract with a seemingly randomly generated address.

I realise that setting a wrong address for receiver will set the funds available to that random address only, making them unspendable. What is the meaning of a transaction to an undefined receiver. Why does it create a contract?


texts: How was Solidity conceived and what design tradeoffs were made when building it?

texts:
Solidity is a new language designed specially for writing Ethereum smart-contracts. As compared with Serpent, which is an extension to Python semantics, Solidity is completely new and borrows semantics from other languages to be JavaScript-like.

What was the motivation for designing the language and features it should have and were any specific tradeoffs made during the process of building it?


texts:
I have three addresses a1, a2, a3 to which I want to send one third of a contract's balance in the minimal number of transactions (ideally, just one) and without storage. I could have a function as follows:

function withdraw() {
    uint split = this.balance/3;

    a1.send(split);
    a2.send(split);
    a3.send(split);
}

The problem is in regards to atomicity and out-of-gas. As I understand, an out-of-gas exception will revert operations, but send operations are an exception:

  When exceptions happen in a sub-call, they “bubble up” (i.e.
  exceptions are rethrown) automatically. Exceptions to this rule are
  send and the low-level functions call, delegatecall and callcode –
  those return false in case of an exception instead of “bubbling up”.

So it is possible for a1 to repeatedly call withdraw() with just enough gas for the first send, thereby draining the contract for itself.

One could try do some mechanism design so that the caller withdraws last. For example:

function withdraw() {
    if(msg.sender != a1 && msg.sender != a2 && msg.sender != a3) return;
    uint split = this.balance/3;

    if(msg.sender != a1) a1.send(split);
    if(msg.sender != a2) a2.send(split);
    if(msg.sender != a3) a3.send(split);

    // msg.sender goes last
    msg.sender.send(split);
}

The problem here is that a1 and a3 can collude to cheat on a2. Indeed, a3 can repeated call withdraw with just enough gas to drain the contract to a1.

I guess it is possible to keep track of withdrawals that have occurred with storage, but that seems like overkill.

Is there a way to make several send operations atomically, similar to how Bitcoin can have multiple UTXOs in a single transaction?


texts: Retrieve the signature of a transaction on the blockchain

texts: How can you find the signature of a transaction? web3.eth.getTransaction() doesn't appear to make that available.


texts: How does MetaMask knows that a precondition of a contract will fail?

texts:
I'm working with an standard ERC20 token, I have a transfer function:

 function transfer(address _to, uint256 _value)  public returns (bool) {
        require(_to != address(0));
        require(_value <= balances[msg.sender]);

        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        emit Transfer(msg.sender, _to, _value);
        return true;
    }

I have an address A that has 20 of my ERC20 tokens, and I'm using web3.js to send transactions to a smart contract that is deployed on a Geth private node. MetaMask is intercepting those invocations.

I'm curious about the behaviour of MetaMask in these two scenarios:

Send 19 tokens from address A to adddress B, the transaction succeeds, now A has 1 token
Try to send 21 tokens from address A to address B, metamask shows this message:

It is as if MetaMask knows that the precondition of the contract will fail:

    require(_value <= balances[msg.sender]);

I'm curious to know if MetaMask has its own state of the contract and can determine if a transaction will fail or not, previous to invoking the contract, or while it is invoking the contract.


texts: Ganache -f how can I fork the whole chain?

texts: Im developing locally but I need a full copy, Im using ganache for local dev, also providing -f option to fork another blockchain (BSC), is it possible to download the complete chain somehow?


texts:
I need help from anyone..
My ethereum mining rig having 6 Rx470 cards, get restart every minute,
When I reduce Mhs of few cards it keep running for some time...
Pls give me suggestions ,How can I resolve this


texts: How can i get the name of an emitted event through the event abi (log entry, topics) of solidity?

texts:
I want to get the name of an emitted event from my contract using the event abi and web3j.
This is the contract i'm using as an example for this question:
pragma solidity ^0.5.7;
contract NumberContract2{

uint256 number;

event newNumberStored(uint256 number);
event calledRequestNumberFunction();

function storeNumber(uint256 num) public
{
    number = num;
    emit newNumberStored(num);
}

function requestNumber() public returns (uint256)
{
    emit calledRequestNumberFunction();
    return number;
}

}
This is where i hope to get the information out of (see event abi):
 topics[0]:
 keccak(EVENT_NAME+"("+EVENT_ARGS.map(canonical_type_of).join(",")+")")

I created a listener in my code that prints out every event that gets emitted:
EthFilter filter = new EthFilter(DefaultBlockParameterName.LATEST, DefaultBlockParameterName.LATEST, numberContract2.getContractAddress().substring(2));
    web3j.ethLogFlowable(filter).subscribe(log -> System.out.println(log));

When an event is emitted (in this case through storeNumber(1234)) it prints out the following:
Log{removed=false, logIndex='0x0', transactionIndex='0x0', transactionHash='0xde7ea1ed3ca6cae5e3fb2478cc0212a2fc4d71c4c82b2edabde61c88629f667c', blockHash='0xb86c2af91b32492ee06e7ca632a56b973dfb5bbb4af045c627727547819c298f', blockNumber='0x89', address='0x820dbe91d4ee217b518b7be2cd7c30ea47e5ee1e', data='0x00000000000000000000000000000000000000000000000000000000000004d2', type='mined', topics=[0xa7f1c945da9b165cf9d2d173e7bf823eb59569ecffef3d150fe6c74b6e78933f]}

Which is kind of what i expected, but how can i get the name of the event now? Is it even possible? If not is there another way to do it?
When i look at the transaction log in remix it clearly shows the name of the event but i don't see that in the log that i print out.
    [ { "from": "0x820Dbe91D4Ee217B518B7BE2CD7c30ea47e5ee1E", "topic": "0xa7f1c945da9b165cf9d2d173e7bf823eb59569ecffef3d150fe6c74b6e78933f", "event": "newNumberStored", "args": { "0": "1234", "number": "1234" } } ]

My goal in the end is to add a listener that listens to all events, and filter them by name later (outside of web3j).


texts: Truffle Console: How to print the value of a variable using get function

texts:
I want to printthe value of iVar:
pragma solidity ^0.5.1;
   contract PRetVal {
      uint8  iVar =0;
      function testFunc() public returns (uint8) {
         iVar = iVar + 10;
         return iVar;
      }
   }

I am trying the following :
truffle(development)> PR = await PRetVal.at(0x596D30c26211B4Dab998F63D6Bf5eba55B0B1d2D)
undefined
truffle(development)> await PR.getIVar
undefined truffle(development)>

But I am not getting any value. Somebody please guide me.
Zulfi.


texts: How to time how long it takes to mine a block?

texts: I've recently created a private ethereum blockchain and would like to time, personally, how long it will take to mine a block in the private blockchain I have created. I'm using the command line/geth JSON-RPC interface, so if there's a way to time how long it takes to mine a block from within the JSON-RPC CLI interface and put it in a file that would be very helpful.


texts: Is it possible to pass in the price of the token as a parameter?

texts: Lets say I want a token which has a dynamic emmission rate based on the price of the token on an exchange like uniswap. Is this possible and how would I go about doing that. Is it possible to get this information from the blockchain itself or do I need to use an api that keeps track of the price?


texts: Ethereum ecrecover signature verification and encryption

texts:
The question of signing and verifying signatures with Solidity has been asked in these questions, both of which I have tried to study:

How can I sign a piece of data with the private key of an Ethereum address?

How can I verify a cryptographic signature that was produced by an Ethereum address key pair

However, there are still pieces of information that I appear to be missing.

First off, I would like to start with the question about signing. In the example, the string Schoolbus is signed by the address 0xd1ade25ccd3d550a7eb532ac759cac7be09c2719, and the resulting signature is 0x2ac19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601.

So far, so good. Now, what I'd like to do is verify using ecrecover that the signature is indeed correct for the given address and datum. The thing is, ecrecover takes four arguments: ecrecover(h, v, r, s). Aside from h being the hash, and {v, r, s} somehow comprising the signature, what exactly do v, r, and s stand for? And how do I obtain all the values necessary from the single string 0x2ac19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601?

What I know is that ecrecover returns an address, and verifying a signature is essentially a matter of comparing the resulting address with the expected one. Yet the whole procedure seems unnecessarily complicated.

Aside from this, I was also wondering how I could produce a signature, either like this 0x2ac19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601 or a set of {h, v, r, s} using Solidity alone, without the RPC-JSON detour as is the case in the question – provided I know a private key?


texts: Whether the proof created by prover can be tampered in ZoKrates?

texts:
I am studying zokrates recently. I know that the prover will finally generate a proof, and then the verifier can use this proof and public input as input to verify whether the prover has certain knowledge. I want to know if it is possible for the prover to tamper with the proof, and then the tampered proof can also pass the verification of the verifier. I guess it should not work in theory, but I want to know why.
Hope you can help me, thanks!


texts: Is it more efficient to create multiple contracts or one contract with lots of storage?

texts:
I've been curious about something for a while.  If you wanted to create a state object to track a bunch of the same object, is it more efficient(cheaper) to create a contract for each object or one contract for all the objects?

For instance, say you wanted to keep track of the state of a piece of fruit.  Is it more efficient to create a contract for each piece of fruit:

(in pseudocode)

init(id) {
    self.id = id
    self.is_peeled = false
}
peel() {
    self.is_peeled = true
}
isPeeled() {
    return self.is_peeled;
}

Or a contract that uses a lot of storage to track all of the fruit:

init() {
    self.fruit = []
}
addFruit(id) {
    self.fruit[id] = {
        is_peeled: false
        isPeeled: function() { return self.is_peeled }
    }
}
getFruit(id) {
    return self.fruit[id]
}

And what if it ends up being thousands of objects; does that change the efficiency?

I guess the cost of storage versus the cost of deploying a new contract isn't something I fully grasp yet.


texts: Acceptable Gas Usage of Smart Contract functions

texts:
So I've been building a smart contract where users can register and store their projects at. I'm wondering if the gas usage of functions within my contract is acceptable or not ( I'm new to solidity :) ).

Here's the current Gas Cost of my Smart Contract functions:

Registration: 92k+ Gas
Project Creation: 177k+ Gas

Is there a tool (like eth gas station) that shows real-time Gas usage per contract function call?


texts:
"I have tried every which way to get the flaw to go away, I tried to debug, I have _erc under-scored it, I just cannot seem to put my finger on it. here is the original contract:
import "./MOOREToken.sol";
import "./DaiToken.sol";

contract TokenFarm {
    string public name = "TokenFarm";
    address public owner;
    ERC20 public MOOREToken;
    ERC20 public daiToken;

    address[] public stakers;
    mapping(address => uint) public stakingBalance;
    mapping(address => bool) public hasStaked;
    mapping(address => bool) public isStaking;

constructor(address _MOOREToken, address _daiToken) public {
        MOOREtoken = ERC20(_MOOREToken);
        daiToken = ERC20(_daiToken);
        owner = msg.sender;
    }

    function stakeTokens(uint _amount) public {
        // Require amount greater than 0
        require(_amount > 0, "amount cannot be 0");

        // Trasnfer Mock Dai tokens to this contract for staking
        daiToken.transferFrom(msg.sender, address(this), _amount);

        // Update staking balance
        stakingBalance[msg.sender] = stakingBalance[msg.sender] + _amount;

        // Add user to stakers array *only* if they haven't staked already
        if(!hasStaked[msg.sender]) {
            stakers.push(msg.sender);
        }

        // Update staking status
        isStaking[msg.sender] = true;
        hasStaked[msg.sender] = true;
    }

        // Unstaking Tokens (Withdraw)
    function unstakeTokens() public {
        // Fetch staking balance
        uint balance = stakingBalance[msg.sender];

        // Require amount greater than 0
        require(balance > 0, "staking balance cannot be 0");

        // Transfer Mock Dai tokens to this contract for staking
        daiToken.transfer(msg.sender, balance);

        // Reset staking balance
        stakingBalance[msg.sender] = 0;

        // Update staking status
        isStaking[msg.sender] = false;
    }

    // Issuing Tokens
    function issueTokens() public {
        // Only owner can call this function
        require(msg.sender == owner, "caller must be the owner");

        // Issue tokens to all stakers
        for (uint i=0; i<stakers.length; i++) {
            address recipient = stakers[i];
            uint balance = stakingBalance[recipient];
            if(balance > 0) {
                MOOREtoken.transfer(recipient, balance);
            }
        }
    }
}

then here you have the error:
truffle(development)> truffle migrate

Compiling your contracts...
===========================
> Compiling .\src\contracts\DaiToken.sol
> Compiling .\src\contracts\MOOREToken.sol
> Compiling .\src\contracts\Migrations.sol
> Compiling .\src\contracts\TokenFarm.sol
> Compiling .\src\contracts\DaiToken.sol
> Compiling .\src\contracts\MOOREToken.sol

/C/Users/Nmlm99/MOORETokenFarm/src/contracts/TokenFarm.sol:9:5: DeclarationError: Identifier not found or not unique.
    ERC20 public MOOREToken;
    ^---^
,/C/Users/Nmlm99/MOORETokenFarm/src/contracts/TokenFarm.sol:10:5: DeclarationError: Identifier not found or not unique.
    ERC20 public daiToken;
    ^---^


texts:
I cannot deploy my contract so I test with simplestorage but I cannot verify it either.

pragma solidity ^0.4.24;

contract SimpleStorage {
uint storedData;

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

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

Look at the solidity compiler version and optimize option.
https://remix.ethereum.org/#optimize=true&version=soljson-v0.4.24+commit.e67f0147.js

And the configuration I used to verify the contract deployed on ropsten.

Is there anything I am missing?
Thanks


texts: PIVX fork CryptoDezire Coin SendRawTransaction not working

texts:
A CDZC coin basically fork of PIVX . I am trying to send coin via rpc calls. Successfuly created RawTxn, SignRawTxn but unable to SendRawTxn.

    `await rpc.listunspent().then(async r  => {
         await rpc.createRawTransaction(r.result{'DA3agGab9SxNptHygVkQfyNjBW4YR3ujXm':0.1}).then(async tx  => {
    await rpc.signrawtransaction(String(tx.result),r.result).then(async signtx  => {await rpc.sendRawTransaction(Object.values(signtx.result)[0]).then(async send  => {   console.log("send:",send) }) .catch(err => console.log(err))
                 });
       });

});


texts: How is the Ethereum Classic gas limit enforced?

texts:
According the the Ethereum Classic Technical Reference:

  For security reasons, the amount of gas that can be purchased and used by blocks is limited.

How is it limited? Do miners choose to limit it, or is there a limit in the protocol itself?

More broadly, is there an explicit or implicit block-size limit with Ethereum Classic? My understanding is that on Ethereum the gas limit is a concensus limit, that miners can increase it, and at some points they have done so. Is Ethereum classic also like this? Or does it have a hard limit in code?


texts: How do I control users balances from an external contract?

texts:
I'm developing a blockchain project where I have two separate contracts, the ERC20 token contract and the Main one that contains the application logic.
I need to be able to move users' tokens as I like from the main contract without having them do anything. How can I control users balances from the external contract?

Thank you a lot, I'm new to Ethereum developing and trying to learn.


texts: The contract code couldn't be stored when deploying to rinkeby

texts:
I was finally able to get some ether funded and geth/mist working and now i am getting the following error when attempting to deploy my contracts to the rinkeby test network. My project is based on the dotta-license project https://github.com/cryppadotta/dotta-license but i am using the standard migrate and deploy scripts instead of the typescript ones in the project

The contract code couldn't be stored, please check your gas amount.

Ive been googling and it seems that the problem could be literally anything. Can anyone give me some help tracking down the issue?

Truffle.js

 module.exports = {
      networks: {
    development: {
      host: 'localhost',
      port: 9545,
      network_id: '*' // Match any network id
    },
    rinkeby: {
      host: 'localhost', // Connect to geth on the specified
      port: 8545,
      from: 'xxxxxxxxxxxxxxxx', // default address to use for any transaction Truffle makes during migrations
      network_id: 4,
      gas: 4700000, // Gas limit used for deploys
      gasPrice: 30000000000 // 30 gwei
    },
  },
};


texts:
I am a cyber security analyst who is new to ethereum and working on a project to study crypto security. It's a series of 22 vulnerable smart contracts that you're supposed to exploit. For anyone who is interested, here's the challenge:

https://ethernaut.zeppelin.solutions/

I'm trying to configure a truffle project for the challenge using this guide: https://www.notonlyowner.com/ethereum/solving-zeppelin-ethernaut-ctf-fallback/ and after I run the installation command:

npm i truffle@4 ganache-cli@6 openzeppelin-solidity@2.0.0

I'll try to deploy the contract and I get a bunch of errors. I started trying to fix them and knocked out a few, but I feel like there's gotta be a better solution. If an experienced blockchain dev would help me get this deployed I'd really appreciate it, been bashing my head against my desk at work all day. I've posted the source code and my errors below:

pragma solidity ^0.4.18;

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

contract Fallback is Ownable {

  mapping(address => uint) public contributions;

  function Fallback() public {
    contributions[msg.sender] = 1000 * (1 ether);
  }

  function contribute() public payable {
    require(msg.value < 0.001 ether);
    contributions[msg.sender] += msg.value;
    if(contributions[msg.sender] > contributions[owner]) {
      owner = msg.sender;
    }
  }

  function getContribution() public view returns (uint) {
    return contributions[msg.sender];
  }

  function withdraw() public onlyOwner {
    owner.transfer(this.balance);
  }

  function() payable public {
    require(msg.value > 0 && contributions[msg.sender] > 0);
    owner = msg.sender;
  }
}

The errors:

Compiling ./contracts/Fallback.sol...
Compiling ./contracts/Migrations.sol...
Compiling openzeppelin-solidity/contracts/ownership/Ownable.sol...

/home/awile/smart_contracts/ethernaut/contracts/Fallback.sol:16:48: TypeError: Type function () view returns (address) is not implicitly convertible to expected type address.
        if(contributions[msg.sender] > contributions[owner]) {
                                                     ^---^
,/home/awile/smart_contracts/ethernaut/contracts/Fallback.sol:17:4: TypeError: Expression has to be an lvalue.
            owner = msg.sender;
            ^---^
,/home/awile/smart_contracts/ethernaut/contracts/Fallback.sol:17:12: TypeError: Type address is not implicitly convertible to expected type function () view returns (address).
            owner = msg.sender;
                    ^--------^
,/home/awile/smart_contracts/ethernaut/contracts/Fallback.sol:31:3: TypeError: Expression has to be an lvalue.
        owner = msg.sender;
        ^---^
,/home/awile/smart_contracts/ethernaut/contracts/Fallback.sol:31:11: TypeError: Type address is not implicitly convertible to expected type function () view returns (address).
        owner = msg.sender;
                ^--------^
Compilation failed. See above.

Edit: fixed by downgrading openzeppelin-solidity to 1.11.0

npm uninstall openzeppelin-solidity
npm i openzeppelin-solidity@1.11.0


texts: bn256 and Boneh-Boyen digital signature in solidity

texts: I am looking to have a full-fledged implementation of bn256 in solidity. And  Boneh-Boyen digital signature. Is there is any available built-in libraries or implementation in solidity to bn256 and Boneh-Boyen digital signature?


texts: Error: No Keyring found for the requested account

texts:
I am an student and in this moment practicing how to create a simple smart contract in remix.ethereum.org.
I got compiled the small program with function get without problem.
When I deploy the program the Metamask provide an error in the title of this question. The environment Injected Web 3 is correct and my account is connected properly.
I am not an expert, I am following a simple exercise provided by my institutions.
Regards


texts: how does gas get taken from the account?

texts:
Let's say we call the function:
 function nice(uint a) public returns(uint256){

        k = 100;
        z = 100;
        f = 100;

        require(a == 5);

        o = 100;
        s = 100;

        return 170;

 }

Let's say we passed in a = 15. So, what will happen is transaction is going to be reverted due to require. Now, the transaction cost for the first 3 lines of code(assigning 100 to k,z,f) takes 81000 (this includes transaction data) too. It seems like after transaction is done, from my account, only 81000*price of gas is taken from my balance, which is correct.
What I am curious about is how this happens. Specifically,

does it take all my gaslimit * gas price from my account, executes the code, and whenever it's done, it checks if there's any remaining and if there's, it gives back the remaining value. In above case, that could happen, since because of require , it wouldn't make us spend all gas. But if this is how it does, why don't I see the balance reduction and then increase again between pending transaction and finished transaction states ?

OR

I have no idea how else it could do.  Any idea ?


texts: Microsoft Coco Framework, how does it speed up transaction?

texts:
According to Microsoft

  Coco achieved approximately 1,700 transactions per second using a
  private version of the ethereum blockchain, compared to about 13
  transactions per second without the framework

and follow,

  blockchain was being processed in a trusted environment, allowing for
  a "simplified consensus mechanism," in this case, RAFT.

If my understanding is correct, a new block is simply generated by a designated machine equipped with TEE as an added security to prevent malicious actor from tempering with the consensus mechanism, so proof of work can be replaced by something lighter. Am I right to say?


texts: When calling a smart contract function, who gets paid and how much does the caller pay?

texts:
This is an extended question to What is "gas" and transaction fee in Ethereum?.

Who gets paid and how much does the caller pay?

Let's make some assumptions:

There is a function F which costs 1,000 gas;
There are 2 miners, M1 and M2;

Their gas prices are 1 GWei/gas and 2 GWei/gas respectively;

There is an external address A.

The questions are:

When a caller A invokes F, how much does A need to pay (ignoring data transfer fees)?
Is it the total (3 kGWei) or is it determined by whoever mines it first (1 kGWei or 2 kGWei)?
If M1 mines it first, will M2 just trust the result or will it do it all over again to check the correctness?

Then M2 should also get paid, right?

Will the result be stored in all full nodes, or just the miner nodes, or just the miner nodes that are "willing" to store it (with matching gas price)?

Then other nodes should get paid too?


texts: could you tell me how to use the Executables evm？

texts:
i use a contract as follows :

pragma solidity ^0.4.0;
contract TestContract
{
function multiply(uint a, uint b) returns (uint)
    {
        return a * b;
    }
}

and solc --bin-runtime TestContract.sol to get its runtimecode.

then evm --code 0x[runtimecode] --input 0x165c4a1600000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000007 run
(input value is got from Remix and solc --hashes xxx.sol ,input parameter 5,7)

but the result displayed in cmd is 0x .what's wrong?
if deploy in privatechain and execute the local method , it will return the correct answer 35.


texts: I have no idea what happened, but all of a sudden, the file explorers in remix ide is gone. I tried all I can to recover it, including restarting it, switching back and forth between new and old versions, reinstalling it and rebooting the pc. None of these worked. I'm wondering why this is happening and how I can get it back! Thanks.


texts: Once Ethereum makes the switch to proof of stake how will one choose to stake Ether? Will they have to use a special program or will Ether not in use be considered staked and be used to gain more Ether?


texts: Javascirpt 18 decimal number for parameter?

texts:
I have created an 18 decimal crypto token in ethereum. When executing smart contract method from javascript for uint256 input parameter, how can I specify the number with 18 zeros? Because javascript doesn't support that large number.

here is my nodejs function

    let initiateAddLoyaltyTransaction = function (fromWallet, toWallet, companyName, amount, callback) {
    let functionName = 'transferWithAddLoyalty';
    amount = amount*1000000000000000000 ;
    let params = [fromWallet, toWallet, amount, companyName];
    W3JSR.prepareSignSend(config.ethereum.rinkeby.ABI_DEFINITION, config.ethereum.rinkeby.CONTRACT_ADDRESS, functionName,
        config.ethereum.rinkeby.WALLET_ADDRESS, privateKey, params, 10000000000).then((result, error) => {
        callback(result, error);
    });
};


texts:
I have an event defined like this:

event Created(
    address indexed target,
    string indexed name
);

I do

emit Created(..., _name); // called function with _name = "comment"

which gives

0xd69ce70c72e2e7191b71ef82881773fbf30510f24a3450f02d555b5f04ac9702

or

0x2361458367e696363fbcc70777d07ebbd2394e89fd0adcaf147faccd1d294d60

in the Ganache event explorer:

How can I convert this back to comment? web3.toAscii() just returns garbage.


texts:
I am looking for an approach to creating a connection between two blockchain-networks.
I found out that I can use oracles to get data from extern systems (= second blockchain-network). But how can I proof the data (=trust) in the first blockchain-network from the second blockchain-network?
Are there specific approaches for this?


texts: Web3js can not touch smart contract, always return 0

texts:
web3js can not touch smart contract.

var id = dragoncore.getGenesNum(); has no error, but always return back 0, never changed.

-----------------------------web3js code -----------------------------

app.get("/createGenesTest", function(req, res) {
    var _genes = "333";
    dragoncore.createGenesTest.sendTransaction(_genes, _owner,{
        from: web3.eth.coinbase
        }, function(error, transactionHash){
            if (!error) {
                res.send(transactionHash);
                console.log(transactionHash);
            } else {
                res.send("Error");
                console.log(error.toString());
            }
        });
});

app.get("/getGenesTest", function (req,res) {
    var id = dragoncore.getGenesNum().toString();
    var details = dragoncore.getGenesTest.call(id);
    res.send(details);
});

-----------------------------smart contract code -----------------------------

uint256[] public geneses;

function createGenesTest(uint256 _genes, address _owner) public returns(uint256 id) {
    id = geneses.push(_genes);
    dragonIndexToOwner[id] = _owner;
}

function getGenesTest(uint256 _id) public constant returns(address) {
    return dragonIndexToOwner[_id];
}

function getGenesNum() public constant returns(uint256){
    return 1000;
    //return geneses.length;
}

I also upload source code here

Thank you for your help first!!!


texts:
I am trying to execute the following code obtained from`Solidity Tutorial

pragma solidity 0.5.4;
contract ERC20Token {
    string name;
    mapping(address => uint256) public balances;

    function mint() payable public {
        balances[msg.sender] += msg.value;//use tx.origin,
    }
}
contract MyContract {
    address public token;

    address payable wallet;

    constructor(address payable _wallet, address _token) public {
        wallet = _wallet;
        token = _token;
    }
    function() external payable{
       buyToken();
    }
    function buyToken() public payable {
        ERC20Token _token = ERC20Token(address(token));
        _token.mint();
        wallet.transfer(msg.value);
    }
}

The tutorial says that I have to use tx.origin instead of msg.sender but tx.origin is a vulnerability. Somebody please guide me how to solve this problem.


texts: Casper slashes nodes with poor network connection?

texts:
Moving from PoW to PoS sounds reasonable as it's more environmentally friendly and costs less to compensate miners.

However, I heard Casper will slash uncles to disincentives them from forming a fork. There are some undesired generated uncles right now because of network delay/slow propagation of block creation. Would those miners who created an uncle because of those reasons be punished as well?


texts: web3 error: private key length is invalid

texts:
I was trying to create my own wallet on etherum test network Rinkeby. When I successfully created wallet:

const newAccount = await web3.eth.accounts.create()

and got wallet address 0x267634Db8890Ad1F05e214dD9De961484c078895
and wallet private key 0x27fc2c9ba1cba2c519f5423ab4dde5777cfe1f4d462c5bb64ba223a570f3efeb

I added some test ether on my new account (3 ether) , and tried to send some value on other account which I was also create

const main = async () => {
  let nonce = await web3.eth.getTransactionCount(web3.eth.defaultAccount)
  let gasPrices = await getCurrentGasPrices()
  let details = {
    "to": DESTINATION_WALLET_ADDRESS,
    "value": amountToSend,
    "gas": 21000,
    "gasPrice": gasPrices.low * 1000000000,
    "nonce": nonce,
    "chainId": 4,
  }
  const transaction = new EthereumTx(details, { chain: 'rinkeby', hardfork: 'petersburg' })
  await transaction.sign(Buffer.from(PRIVATE_KEY_DESTINATION_ACCOUNT, 'hex'))
  const serializedTransaction = await transaction.serialize()
  const transactionId = await web3.eth.sendSignedTransaction('0x' + serializedTransaction.toString('hex') )
  process.exit()
}

main()

but i got error message : "private key length is invalid", and when I cleared 0x from my private key I got other error "insufficient funds for gas * price + value"

Can anyone help me?


texts:
I would like to accept Ethereum on my website but can not find information how to do this. I already accept Bitcoin. With Bitcoin it is quite easy to link unique Bitcoin address with the order number. When I see the incoming transaction I know the order number customer trying to pay.
But the difference between Bitcoin and Ethereum that it is not recommended to use new account for each new transaction. Am I right?

If I have one account for all incoming payments how I can know what order customer is paying? There is no payment memo or other information coming with the transfer.

Could anyone write a short algorithm or give some ideas?

I already have VPS (Ubintu), geth running with HTTP JSON-RPC support.


texts:
Somebody please tell me what is a Ether Wallet?

I got the following answer:

  A blockchain wallet is a digital wallet that allows users to manage
  bitcoin and ether.

Is it like a account?

Zulfi.


texts:
Facebook, Instagram and Onlyfans are all centralized social media platforms. You don't have full control over your content once shared, it becomes metaphysically subject to the company's rules and distribution so that they get a cut in commissions, whether by ads or fan purchases.
What are some good examples of decentralized apps, besides exchanges and are not financially-related,  that are purely for social media (photos, videos, other media) where many users meet to share/view one another's content?