texts: artifact.require() statement with inheritance?

texts:
Hi guys my question i very simple.
I have this contract:

B.sol

...
contract A {
    ...
}
contract B is A {
    ...
}

When i migrate to blockchain my B.sol i need to deploy every single contracts inside?
Choose one of the answers and explain why please.

var B = artifacts.require("B");

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

var A= artifacts.require("A");
var B= artifacts.require("B");

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


texts:
So I understand Proof-of-work high level, where nodes work to solve a "puzzle". And once they've created a valid block they then broadcast it to the network. So that node receives the reward (assuming valid).
But in Proof-of-stake, the winner is selected by how much it has staked. So lets say there are 10 validators, and each one has 32 Eth staked. Who chooses who the block creator is? Or if each validator creates their own block and proposes it, who chooses which one to accept?


texts: Who does the computation of a function that only reads state?

texts:
I'm starting to learn smart contracts in ethereum and have some questions about the concept of "Reading / Writing" state.

I know reading state doesn't cost gas.

But when we execute a read state and compute with it in the smart contract (without posting any transaction)

Who's doing the computation? is it the node that initiated the contract function?
If the computation is done locally, is it safe to use encryption algorithm in the function?
Is there any network cost? ( or the node will just compute from its chaindata? )

Thanks!


texts: Parity does not compile contract without error

texts:
When I input the following contract into Parity's develop field it does not complain but I also doesn't compile the contract which makes it impossible to deploy. Any suggestions? I tried linting the contract but it seems syntactically correct.

pragma solidity ^0.4.11;

/// @title Name Resolver for multiple contracts
/// Resolves contract names to their current version's address
contract Register {
    address owner;
    mapping (string => address) public backends;

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

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

    function changeBackend(string contractName, address newBackend) public onlyOwner() returns (bool) {
        if(newBackend != backends[contractName]) {
            backends[contractName] = newBackend;
            return true;
        }

        return false;
    }
}


texts: Ethereum wallet accounts all use same password though I made different ones?

texts:
(tech level, beginner)

installed wallet version win64-0-11-1

deployed a contract, made a token using the example code on ethereum site.

had two accounts in the wallet.  used main account to send to second and test coin.  all worked fine.

when i went to send from second account to a third, kept getting "wrong password" message.   impossible.

made another account, typed the password out on a wordpad and saved it.   copy and pasted it so no typos possible.

it was a password that utilized upper and lower case letters, numbers, and special characters.

i tried pasting the password entirely and tried pasting whatever was prior to first special character just in case.  same results.

all this time, the first password worked for first account.  I said what the heck and tried it in other accounts.  they work.

why is my first password authorizing my other accounts, all of which i specifically made unique passwords for?

Thanks


texts: How can someone accept or deny a smart contract in Ethereum?

texts: Let's say peer A has deployed some contract and releases the ABI to peer B to be the part of the network as peer. If B wants to modify the contract or B is not agree with the contract then what he can do? Can he deny the contract some way in Ethereum so that peer A can be updated about that decision?


texts: I want my private Ethereum blockchain to work like the Main net, I want to fix the number of mined ether (Set Max Cap over minded ether), and don't want that miners earn by mining empty blocks.


texts: "Centralized Relational Databases" vs. "Decentralized Blockchain " : Which one is really more scalable?

texts:
There are many research papers on problem of scalability of blockchains:

Just as an example : An Overview of Blockchain Technology: Architecture, Consensus, and Future Trends

However, (usually by some companies which uses blockchain technology), it's mentioned that one of the advantages of blockchain against centralized relational databases, is scalability.

Just as an example : WePower White Paper.

  Quote from this white paper:

  Relational databases are adequate in many applications and situations.
  However, sustainability and scalability are limited with these
  databases. From the perspective of sector transformation in trading
  and digital infrastructure creation, transforming energy production to
  100% renewable, the answer was to utilize a public blockchain.

Is it a correct proposition?


texts: Detect or verify reception of ERC20 tokens by contract

texts: I'm looking into writing a contract that can accept an (unknown in advance) ERC20 tokens, from several different users. Is there a way to detect, or at least verify, that a user has deposited the token with my contract?


texts:
I am trying to update a tuple in my array in solidity. I currently have an array that looks like this
Array[(a,b),(x,y)].
What i would like to do is to later be able to update it to look like so Array[(a,b,c),(x,y,z)].
Is this possible?


texts: Transfer from EtherCamp to local geth does not work (testnet) - Balance is Zero

texts:
I am playing around with Ethereum testnet.

I created an account at https://test.ether.camp/. I received free Ether and sent 1 Ether to an account address on my local geth client, which I created on my Macbook with the following commands:

  geth --fast --cache=2048 --testnet console

(..... after it finished synchronizing .....)

  personal.newAccount("###_my_passphrase_###")

This is the only account I have here.

The EtherCamp account address is 0xd2812d264e9895e8c31122aaffedb6f444c1a2d0.
The transaction is completed successfully.

However, I only see '0' when asking for my balance:

  web3.fromWei(eth.getBalance(eth.coinbase), "ether")
  web3.fromWei(eth.getBalance(web3.eth.accounts[0]), "ether")

Now, I started mining for ~15 minutes ago with

  miner.start(2)

It still shows '0' even though I read that you should get some Ether relative quickly.

Therefore, I wonder If I check the wrong balance !? Or does my local geth client use another testnet than EtherCamp?

UPDATE:
I found out that I am on the right testnet, because I also sent me one Ether via http://faucet.ropsten.be:3001/. This worked and after a few minutes I received the one Ether. My balance is 1 now.
I doublechecked via EtherScan that this is the Ether from faucet: https://testnet.etherscan.io/tx/0x4dee8036ac3df3d6ab68126d109a6df3de54aff674230bd4e2dd605acb37e890
Therefore, I really wonder why I do not get my Ether from EtherCamp (and also none via mining yet).

Thanks for help.


texts: Problem with sha3.keccak_256() update method in Python

texts:
I made a simple SHA3 Python script to generate Ethereum addresses and priv/pub keys. After that I sent some ETH to those addresses but then found out that priv keys do not correspond to the addresses I have.
I think I misunderstood behavior of update method in Python keccak_256 implementation.
Do I still have any chance to get priv keys for the addresses I got using this script?

from ecdsa import SigningKey, SECP256k1
import sha3, sys

n = 5
full_file = "addresses.txt"
keccak = sha3.keccak_256()
with open(full_file, "r") as f:
    for i in range(n):
        priv = SigningKey.generate(curve=SECP256k1)
        pub = priv.get_verifying_key().to_string()
        keccak.update(pub)
        address = keccak.hexdigest()[24:]
        print address
        pr_key = str(priv.to_string().hex())
        pub_key = str(pub.hex())
        address_str = "0x" + address
        f.write(address_str + " " + pr_key + " " + pub_key + "\n")

Thank you


texts: ETH transaction not received. Can someone help?

texts:
I made a transaction to my Ledger Nano S ETH wallet from Wirex that has not been credited. Instead of a Normal Transaction it's showing as an Internal Transaction (0.333 ETH) which means that I have no ac:

https://etherscan.io/address/0x3BbDa23d01EF536Ceee82520dFcC6CF96412De7e#internaltx

Wirex have told me 'contact the receiving party so they process the payment' but I do not understand what does that mean? Who is the receiving party and how is the payment processed?

Can someone assist?


texts: How to check if bytes variable is empty?

texts:
I have a mapping in my smart contract with bytes32 keys and bytes values. How can I check if bytes value exists for specific key?
Mapping is something like this:

mapping(bytes32 => bytes) public Countries;


texts: Some questions about altering new Tokens from a non developer (ELI5 Please).

texts:
I am not a developer and have a basic understanding of Ethereum. I apologize in advance if these questions really seem strange and silly but don't have anyone to ask these questions - I tried searching but didn't find similar questions.

So if anyone can answer the questions that I have, I would really appreciate it:

1- Can an app be programmed such that it creates a new token every week or every month - so if it issues Token A and Token B on launch - say after a few weeks, I want to issue Token C on app - can an app do that?

Can the app's code be updated to launch as many different tokens I want?

So suppose the app launches with Coin A and Coin B - both coins have a fixed total number each - can the app's code be updated to create a new Coin C and then a new Coin D and then a new Coin E (all of them with fixed supply in existence) - and so on - can the app developer create as many different type of coins he wants to exist for his app?

I have read around that a person can increase the total supply of coins in existence, but I am not sure about whether a completely different coin can be introduced in the app.

2- If an app has Tokens A and B and C - and users are transferring the tokens between each other - is there some gas required by Ethereum Blockchain to handle those transactions or is there some way that those tokens can be moved around and app only pays gas for other functions and not every transaction.

Basically will the app developer need to cover the gas costs if some user is just sending around a few of Token A between various wallets that they own? Is there some way to tackle that?

Can the app somehow remove only Token A from its custom issued wallets to users and just keep Tokens B and C in the system? Or freeze all Token A's so that they cannot be moved around and only Tokens B and C can be moved around etc.

3 - So let's say an app has coin A and then coin A1 and then coin A2 - can only the app creator and developer create new coins or can the community create another coin say A2 and it's hard to tell which A2 coin is the original one.

4- Is there a way to serialize tokens - add some number of identification to each individual token - so if an app wants - it can tell which wallet has Token # 345 of Token A

Thanks.


texts: Why is Geth trying to connect to private network IP addresses (RFC1918)

texts:
I have geth running on a Hetzner machine and I got an abuse warning from the provider flagging that my machine is sending UDP/TCP packets to private network IP addresses like for instance 192.168.., 10...* and 172.16..

Is this a part of the node discovery protocol? It would only make sense, if geth would be assuming that there are other nodes in the local network.


texts: Forgot password to Etherbase wallet (version 3)?

texts: I created an Ethereum wallet through the Ethereum application. I subsequently forgot my password and am now trying to recover it using Pyethrecover. The problem is, the keystore wallet file created within the application (version 3) does not explicitly provide the encrypted seed; something that is required for pyethrecover to work. Is there a way to convert to wallet version 1 without a password? Or is there some other way that I can run Pyethrecover without the encrypted seed?


texts: Cannot verify Solidity contract code on etherscan.io

texts:
I am unable to verify the contract below on Etherscan. No errors in Remix. I tried all of the solutions recommended in answers to similar questions, which were:

Remove the ^ in pragma
Compile contract with and without optimization turned on

The contract is currently deployed on address 0x113b1D84A5D25b9A921434F8131b71aDa45dAeac

Any ideas why this happens?
Thanks!

// Version of Solidity compiler this program was written for
pragma solidity ^0.5.14;

// Heads or tails game contract
contract HeadsOrTails {
  address payable owner;
  string public name;

  struct Game {
    address addr;
    uint amountBet;
    uint8 guess;
    bool winner;
    uint ethInJackpot;
  }

  Game[] lastPlayedGames;

  //Log game result (heads 0 or tails 1) in order to display it on frontend
  event GameResult(uint8 side);

  // Contract constructor run only on contract creation. Set owner.
  constructor() public {
    owner = msg.sender;
    name = "Heads or Tails dApp";
  }

  //add this modifier to functions, which should only be accessible by the owner
  modifier onlyOwner {
    require(msg.sender == owner, "This function can only be launched by the owner");
    _;
  }

  //Play the game!
  function lottery(uint8 guess) public payable returns(bool){
    require(guess == 0 || guess == 1, "Variable 'guess' should be either 0 ('heads') or 1 ('tails')");
    require(msg.value > 0, "Bet more than 0");
    require(msg.value <= address(this).balance - msg.value, "You cannot bet more than what is available in the jackpot");
    //address(this).balance is increased by msg.value even before code is executed. Thus "address(this).balance-msg.value"
    //Create a random number. Use the mining difficulty & the player's address, hash it, convert this hex to int, divide by modulo 2 which results in either 0 or 1 and return as uint8
    uint8 result = uint8(uint256(keccak256(abi.encodePacked(block.difficulty, msg.sender, block.timestamp)))%2);
    bool won = false;
    if (guess == result) {
      //Won!
      msg.sender.transfer(msg.value * 2);
      won = true;
    }

    emit GameResult(result);
    lastPlayedGames.push(Game(msg.sender, msg.value, guess, won, address(this).balance));
    return won; //Return value can only be used by other functions, but not within web3.js (as of 2019)
  }

  //Get amount of games played so far
  function getGameCount() public view returns(uint) {
    return lastPlayedGames.length;
  }

  //Get stats about a certain played game, e.g. address of player, amount bet, won or lost, and ETH in the jackpot at this point in time
  function getGameEntry(uint index) public view returns(address addr, uint amountBet, uint8 guess, bool winner, uint ethInJackpot) {
    return (
      lastPlayedGames[index].addr,
      lastPlayedGames[index].amountBet,
      lastPlayedGames[index].guess,
      lastPlayedGames[index].winner,
      lastPlayedGames[index].ethInJackpot
    );
  }

  // Contract destructor (Creator of contract can also destroy it and receives remaining ether of contract address).
  //Advantage compared to "withdraw": SELFDESTRUCT opcode uses negative gas because the operation frees up space on
  //the blockchain by clearing all of the contract's data
  function destroy() external onlyOwner {
    selfdestruct(owner);
  }

  //Withdraw money from contract
  function withdraw(uint amount) external onlyOwner {
    require(amount < address(this).balance, "You cannot withdraw more than what is available in the contract");
    owner.transfer(amount);
  }

  // Accept any incoming amount
  function () external payable {}
}


texts: Resell or Refund the tokens after the ICO ends

texts:
I have 2 questions about ICO:

1.What are the available methods to resell the tokens after the ICO ends?

2.Can the user return the tokens after the ICO ends and get a refund? For example they buy X token for 1 BTC. Can the users can get back the 1 BTC after the ICO ends if they regret their decision?


texts: What are the incentives of holding ETH if developers and businesses can issue their own cryptocurrency for use in their Dapps running on Ethereum?

texts:
Will these new Ethereum based cryptocurrencies be able to transact freely between fiat and other cryptos outside of Ethereum?

Or would they be able to only convert between ETH?

The only way ETH maintains or increases in price by design is if there are incentives for people to purchase and hold onto it. If ETH is designed to ultimately be used to pay for computational power required to secure the network and execute transactions, what then determines the price for computational power.


texts: Sweeping ETH from a 2 year old paper wallet, help?

texts:
I have a paper wallet from an ETH atm from 2 years ago. I am trying to sweep the funds onto a digital wallet. I have used multiple ETH wallet apps on my phone but none of them were able to recognize my private key. The public key functions properly and I am able to access it with etherscan.
The ETH atm support I reached out to stated that the blockchain for ETH has changed much in the past 2 years and therefore my keys are outdated. Supposedly it is possible to translate my private key into wallet compatible format. Support said I could get a trusted programmer to do this for me.
I'm not sure what to think of this. There seem to be no people with the same issue as me online. Maybe the ETH atm I purchased from uses a proprietary format?
Thank you very much.


texts:
I'm running an Ethereum Parity node on my home laptop (i7-7500U @2.7ghz, 2CPUs, w/ SSD) and getting massively more RPC throughput than on a dedicated Amazon AWS linux instance (i3.xlarge, 4vCPUs, w/ NVME SSD).

On my laptop, I can process ~500 "trace_transaction" calls per second, vs. around 100 on my AWS node. I assumed the node performance of my laptop and this i3.xlarge instance would be pretty similar.

I also tried bumping up --jsonrpc-threads and jsonrpc-server-threads and neither of them seemed to increase AWS RPC performance. My AWS vCPUs are nowhere near fully utilized.

Any ideas? Are there certain settings on Linux or on AWS I should look out for that could be causing this?

Thanks!


texts: How to make this function more gas efficient?

texts:
I have this function:

function foo(uint256 _a, uint256 _b, uint256 _c) {
    require(map[msg.sender].a == 1);
    require(map[msg.sender].b < 1);
    require(map[msg.sender].c > 1);

    deposits[msg.sender].a = _a;
    deposits[msg.sender].b = _b;
    deposits[msg.sender].c = _c;
}

Is this extremely wasteful?

How could i make it more gas efficient?


texts: Idiomatic way to call a state mutating function while returning a result through Web3

texts:
I'm trying to create a function that inserts an item and returns the resulting ID through web3 to my frontend. It looks like this:

function newTranslation(string str, uint lang1, uint lang2) payable returns (uint translationID) {
    if (msg.value > 0) {
        translationID = translations.length;
        Translation memory t;

        t.originAddress = msg.sender;
        t.originStr = str;
        t.originLanguage = lang1;
        t.destLanguage = lang2;
        t.bounty = msg.value;  // use the amount in txn
        t.time = now;
        t.completed = false;

        translations.push(t);
        numTranslations++;
    }
}

Problem is, when I try to call instance.newTranslation() through web3, I get the transaction object rather than the actual uint id. However, if I do instance.newTranslation.call(), I get the uint id, but the function doesn't actually change the state of the contract.

I also found another SO post about this issue and it recommended using events to do this. However, I found this to be a little too hacky and wondered if there was a preferred method of accomplishing the same thing? Or if there isn't, am I architecting my code in a non-standard way?

Much thanks for any help.


texts: How to use bytes to get the same hashed output

texts:
I previously asked a question here: link to previous question.

Found out the answer is to use string instead of bytes here:

    pragma solidity ^0.4.18;

contract C {
    bytes32 public temp;

    function hashingsha3 (bytes s)   {
        temp= sha3(s);
    }

    function hashingsha256 (bytes s) {
        temp= sha256(s);
    }
     function kec (bytes s)  {
        temp= keccak256(s);
    }

}

To get the matching hash.
However my question now is how to take input in bytes and not with "" to still get the correct answer.
Thankyou


texts: How could I view tx pool on rinkeby via infura?

texts:
I use rinkeby test network over infura provider from nodejs app.
Some of my transactions stuck in pending state. They are not shown in etherscan explorer pending list, but could be found by the hash. So I believe they stuck in a mining node local pool.
I want to get list of my pending tx to check if they are underpaid or something else.

How could I view rinkeby node local pool transaction list (like web3.txpool.inspect in geth), bearing in mind that I'm connecting from my app over Infura provider?


texts: Any company out there offering enterprise-grade support/maintenance for geth?

texts: In strictly regulated enterprises, like banks for instance, often it is required to have support/maintenance for the software in usage. From the Ethereum community I know that Parity Technologies is offering something like this for parity. Is anything similar existing for geth?


texts: Difference between Registrant and Controller of .eth domain?

texts:
Usually the registrant and controller are the same for .eth domains, meaning the same Ethereum address appears in both fields, so what does it mean when they are different?

Finally, what or who is  the Resolver?


texts: How to make functions for other accounts available?

texts:
I am currently learning how to create contracts on how everything works. I am using the Ethereum Wallet which allows me to deploy contracts. I created there 2 accounts.

I created a small contract:

contract Math{
    function Math(){}

    function addition(uint256 a, uint256b) returns (uint256){
        return a+b;
    }
}

I deploy this contract with the main account in the ethereum wallet, the first in the picture.

As soon it is deploy I call the function using the main account. This works perfectly.

Now I would like to do the same with Account2 but it is not working. After some time it just tells me that it can't execute the function and that's it.
What am I doing wrong? I am fiddling on this since 2 days :(

Here you see how I call the function in the ethereum wallet. First I pick the main account and after that I pick Account2.
And in the last picture I captures the terminal output for Account2.


texts:
assuming the following scenario:

a user A calls a function in contract CA which in turn calls a function in contract CB which call a function in contract CC

I would like to discover who called CB within CC. User a is the tx.origin. Is there a way to get the call stack from within a function?


texts:
I understand that the generic blockchain faces a problem where it can choose to optimize between scalability, security and decentralization. I can see easily why scalability and decentralization are at odds (for those who haven't seen it, a great blog post here explains this).

However, what does it mean to have a blockchain that is scalable and decentralized but insecure? No matter how I formulate the problem, I always end up at a compromise between block size/rate and decentralization.


texts: Subscribe to all token transfers for entire blockchain

texts:
I am looking how to subscribe to all token transfer events within entire blockchain. I wonder how is this is implemented on etherscan.io

https://ropsten.etherscan.io/tokentxns

I searched thought web3.js api and googled wherever is there on the internet but it seems to me that there is no simple solution for that. Can I get this data somehow via any available API or I have to go deeper and run my own EVM with embedded listeners?


texts: Internal transactions don't affect balance?

texts:
https://ropsten.etherscan.io/address/0x74fafc61782bdaf8abedc526cd18dbf51e0890d1#internaltx

There is an internal transaction sending 0.000000000000001 ETH to this address yet balance is still 0. What am I missing? Thanks!


texts: How to architect scalable ethereum blockchain network?

texts:
I have set up the private ethereum block by doing the following steps.

1- Initialised same genesis.json on 2 systems.

2- Started geth console by using same network id.

3- Added these two systems (node) by adding them as peer using admin.addPeer command.

Now I am able to do all the transactions.

Questions :

1- Now this private blockchain is ready and if I have to add any new user does that mean I have to start a new server and on that server, I have to follow the above steps?

2- How do these wallets (ETH wallets) are setting up their infra? Do they have one server which is connected to public ethereum blockchain? and any new user who is joining/buying-ether from these wallets is basically getting added in these wallets as an account, not as a new peer?

3- From above two questions I have figured out that basically there are so many exchanges or wallets who are connected as peers to public blockchain and individual who is buying or selling using these wallets are basically accounts of these wallets. (added a new account eg: personal.newAccount("xux"))

I am new to blockchain and trying to understand the infra how it is being set up so that I can replicate same for my private blockchain. Please correct me if I am wrong and please clear my doubts.

Thanks In advance.


texts: What is the consensus mechanism used in Parity for 'Proof of Authority' chains?

texts: The Ethcore Parity wiki states that it supports 'Proof of Authority Chains'. What distributed byzantine consensus mechanism is used?


texts: Geth signing stops after a period of time

texts:
I have 5 clients setup (1 boot, 1 geth, 3 signers using Clique) - Most of the time they work no problem and mining starts, sometimes mining just stops with no warning nor issue/error message.

Another time I noticed that after coming to consensus on an additional external signer that mining will also stop - I have tried to find information on the order with which signers take turns and what can stop mining from happening, from looking at the code it seems that signers are chosen more so by timing than randomly but can a signer who misses their "turn" for whatever reason cripple or stop the other nodes from signing/validating blocks ? I would hazard a guess that this is not the case but I cant seem to tract down the issue and its is rendering my dev network useless. I know I'm not giving much to go on but there is no errors like usual such "as bad propagated block" all that happens is siging stops and everyone is on "signed recently, waiting to sign again"

for what its worth im running my signers with this

    ```
    geth --datadir ~/test-net/data --mine --cache=1024 --syncmode 'full' --bootnodes="enode://enodeurlgoeshere@ipgoeshere:port" --networkid 47592 --rpc --rpcapi admin,db,eth,debug,miner,net,txpool,personal,web3 --rpcport "8545" --rpcaddr "0.0.0.0" --rpccorsdomain "*" --unlock 914be90b2a0dd6a5b0789c2cee5836dd1f1c030 --password <(echo "password") console --nat "extip:pubIPgoeshere"
    ```

and this is the output from signing when it stops

    ```
    INFO [03-28|18:15:34] Commit new mining work                   number=21271 txs=0 uncles=2 elapsed=315.821µs
    INFO [03-28|18:15:34] Successfully sealed new block            number=21271 hash=0e4d19…b0854b
    INFO [03-28|18:15:34]  mined potential block                  number=21271 hash=0e4d19…b0854b
    INFO [03-28|18:15:34] Commit new mining work                   number=21272 txs=0 uncles=2 elapsed=434.638µs
    INFO [03-28|18:15:34] Signed recently, must wait for others
    INFO [03-28|18:23:07] Regenerated local transaction journal    transactions=0 accounts=0
    INFO [03-28|19:23:07] Regenerated local transaction journal    transactions=0 accounts=0
    INFO [03-28|20:23:07] Regenerated local transaction journal    transactions=0 accounts=0
    INFO [03-28|21:23:07] Regenerated local transaction journal    transactions=0 accounts=0
    ```


texts: Bytes16 event topic not being decoded (or encoded?) correctly

texts:
I'm having an issue with a UUID in bytes16 form being emitted as an indexed event topic, and I'm not sure where in the stack this is originating.

The event being emitted in Solidity looks like the following:

event ObjectOperation (
        bytes16 indexed uuid,
        ObjectOperationType indexed opType,
        Organization indexed organization,
        address senderAddress,
        uint8 changeScore
    );

I can see the event in the log:

       "logs": [
         {
           "logIndex": "0x0",
           "transactionIndex": "0x0",
           "transactionHash": "0x6cb6eae33b6d0f229cf2b50e5fe1b51e236e6fb951ffe1fec5db21d741478cd9",
           "blockHash": "0x7c69af4c298845244007d97e3de292dad1cf1d0ba34e65482fe0d224c6cbb73e",
           "blockNumber": "0xc",
           "address": "0x6596907f5db0df9330e1bc0d69c967909256a059",
           "data": "0x000000000000000000000000da9b53ac0609c634ad9e177c58ea73d043c9e94000000000000000000000000000000000000000000000000000000000000000ff",
           "topics": [
             "0xeb235a1202ba8b829dff4d9f5fe6160bbe61bf07275989a692c92cbe3a8a3195",
             "0x4906bf6a230a11e990653a00205a280100000000000000000000000000000000",
             "0x0000000000000000000000000000000000000000000000000000000000000000",
             "0x000000000000000000000000efc927089de2cfb25325c103c1616ca6c7bcd9d4"
           ],
           "type": "mined"
         },

Here, "0x4906bf6a230a11e990653a00205a280100000000000000000000000000000000" is the UUID 4906bf6a-230a-11e9-9065-3a00205a2801, but I notice this is right padded, as opposed to the other topics that are left padded.

In my application using go-ethereum's abi bindings, I get back a [16]byte of all zeros, which I assume has to do with this padding, based on the go-ethereum code's assumptions.

I've reproduced this behavior in both ganache and parity.  Is this a bug in go-ethereum's log parsing, or in solidity (0.5.3)?


texts: What's mean Solidity instruction: "this;" alone?

texts:
I have this fragment of code from Ethernaut (link):
pragma solidity ^0.4.18;
...
 function() public {
    if(delegate.delegatecall(msg.data)) {
      this;
    }
  }

What's means this; ?


texts: Sustainable business models for decentralized applications

texts:
I have following questions in my mind regarding decentralized application -

How to monetize the efforts of the organization who are creating decentralized applications?

Let us consider an example of the Google and Facebook. Although they are offering their services for free they are gathering data of users and using it show relevant ads. With the help of decentralized application, the user will be an owner of data and user will able to control the access of their data.

Will users be paid for sharing their data? How will blockchain change the current data economy?


texts: Problem while compiling a solidity contract with truffle

texts:
Each time that I compile a contract with truffle I get this error: (cmd)
# Compiling your contracts...
> Compiling .\contracts\HW.sol Error executing vyper: 'vyper' is not recognized as an internal or external command, operable program or batch file. Truffle v5.1.58 (core: 5.1.58) Node v14.15.1

Any Idea on how to fix it? I tried installing vyper v1.0.0 but nothing changed


texts: TypeError: contractInstance.voteForCandidate is not a function

texts:
When I am calling voteForCandidate('Rama') function I am getting above mentioned error.

pragma solidity ^0.4.18;

contract Voting{

    mapping(bytes32 => uint8) public votesRecived;
    bytes32[] public candidateList;

    function Voting( bytes32[] candidateNames) public{
        candidateList = candidateNames;
    }

    function totalVotesFor(bytes32 candidate) public view returns(uint8){
        require(validCandidate(candidate));
        return votesRecived[candidate];
    }

    function voteForCandiadte(bytes32 candidate) public {
        require(validCandidate(candidate));
        votesRecived[candidate] += 1;

    }

    function validCandidate(bytes32 candidate) view public returns(bool){
        for(uint i = 0; i<candidateList.length; i++){
            if (candidateList[i] == candidate)
            {
                return true;
            }

        }
        return false;
    }
    function candidateNamesFun() view public returns(bytes32[]){
        return candidateList;
    }

}

but other function are working properly but the call contractInstance.voteForCandidate("Rama") is returning error in node (web3js) cli using ganache-cli but its working fine in remix ide.


texts:
I have a contract that looks like this -
contract Calculator {
    uint public result;
    event Added(address caller, uint a, uint b, uint res);

    constructor() public {
        result = 777;
    }

    function add(uint a, uint b) public returns (uint, address) {
        result = a + b;
        emit Added(msg.sender, a, b, result);
        return (result, msg.sender);
    }
}

So I expected that invoking add function will add supplied two numbers and replace the old value persisted in result variable. But my invocation produces -
Before:  777
Transaction hash: 0xeef135d7838a2f6093918d3b055fe5ea2ce4c3c3c54c8a8c8328def95465f8e4
After:  777

Above transaction hash is valid and you can see details here.
Here is my code -
async function addWithTx() {
    return new Promise(async (resolve, reject) => {
        const senderAccount = rtUtil.getFirstAccount();
        const contract = await rtUtil.getCalculatorContract(senderAccount.calculatorContractAddress);

        let result = await contract.methods.result().call();
        console.log("Before: ", result);

        const accountPkBuffer = Buffer.from(senderAccount.accountPk, "hex");
        const data = await contract.methods.add(5, 74).encodeABI();

        const web3 = rtUtil.getWeb3();
        const taxCount = await web3.eth.getTransactionCount(senderAccount.accountAddress);

        const txData = {
            nonce: web3.utils.toHex(taxCount),
            to: rtUtil.getSecondAccount().calculatorContractAddress,
            value: web3.utils.toHex(web3.utils.toWei('0', 'ether')),
            gasLimit: web3.utils.toHex(2100000),
            gasPrice: web3.utils.toHex(web3.utils.toWei('6', 'gwei')),
            data: data
        };

        const tx = new EthereumTx(txData, {chain: 'ropsten'});
        tx.sign(accountPkBuffer);
        const serializedTx = tx.serialize();
        const raw = web3.utils.toHex(serializedTx);

        const transaction = await web3.eth.sendSignedTransaction(raw);

        result = await contract.methods.result().call();
        console.log("After: ", result);

        resolve(transaction);
    });
}

addWithTx()
    .then(receipt => {
        console.log("Transaction hash: ", receipt.transactionHash);
    })
    .catch(error => {
        console.error(error);
    });

My questions are -

Why the value is not persisted? Even though its a valid transaction and mined.
If i don't supply the to field then a new contract creation transaction is created. Why the transaction is creating a new contract? What is the content of the contract?


texts: How to get rid of "Visibility for constructor is ignored" warning

texts:
In VS Code I get this warning in my contract constructor:

Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.

So I remove the visibility, leaving my constructor as
constructor()

Which removes the warning, but when running
$ truffle migrate --reset

I get this error

SyntaxError: No visibility specified. Did you intend to add "public"?
constructor() {
^ (Relevant source part starts here and spans across multiple lines). Compilation failed. See above.

The migration runs fine with the warning
Does anyone know how I can resolve this?
Truffle v5.2.5 (core: 5.2.5)
Node v12.16.3


texts: Parity: Determine if Transaction is an Internal Transaction from JSON-RPC call


texts: Preset testRPC account balances not showing up in Solidity contract mapping, during truffle console session


texts: Oraclize: Difference between random methods

texts:
I write a smart contract and want to use oraclize for getting random number. Are there any differences between those methods:

Using WolframAlpha:

oraclize_query("WolframAlpha", "random number between 1 and 2^64");

Using Random.org:

oraclize_query(
     "URL",
     "json(https://api.random.org/json-rpc/1/invoke).result.random.data.0",
     '\n{"jsonrpc":"2.0","method":"generateIntegers","params":{"apiKey":"9844ab4d-52ef-4587-9cf3-20a6930a7f6e","n":1,"min":1,"max":1000,"replacement":true,"base":10},"id":1}');

Using oraclize random method:

bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);

In term of price, I see that:

WolframAlpha: 0.03$/query. unlimited queries.
Random.org: 0.01$/query. only 1000 requests/day (limited by random.org)
oraclize_newRandomDSQuery: 0.05$/query.

Please tell me differences in functionality.
Thanks


texts: Can incentive be provided for non-mining Ethereum nodes?

texts:
Setting up a full-time mining rig is a tremendous resource commitment - and you either have to be all-in or go home if you want to ever actually see any return (yeah, I know - I'm ignoring syndicate/collective mining).

On the other hand, running a full node that doesn't mine is really not that expensive a thing to do - and provides all of the transaction validation, consensus voting, and block propagation that a mining node does.

For developers (and perhaps for users who just, well, use Ethereum a lot) there is a direct benefit to running such a node, but I wonder if there could be some way to provide incentive for other people to run these sorts of nodes. When I think about it I'm not seeing anything obvious and/or elegant.

I guess a corollary is whether or not it would even be a good idea. Seems to me the more nodes the better, though.


texts: How to get erc20 contract deploy time / block number

texts:
I am building a framework for ERC20 tokens.

Aim is to scan all events (Transfer and Approve) generated by ERC20 contract, for which I am using web3.js getPastEvents.

I have set the toBlock to web3.eth.getBlockNumber() i.e. latest block

Now, to avoid scanning unnecessary blocks, I have to set fromBlock option. Can someone explain how to get block's number of the block in which erc20 token was deployed?


texts: How to know the return result if I call a method from another contact

texts:
In solidity, how do I know the return result if I call from another contract?
From contract B, call contract A's method methodA,
if contract B, can I write:

Contract B{
     bool callResult=contractA.methodA(param);
}

or something similiar to this in solidity, any example?


texts: SendSignedTransaction web3 v1.0 smart contract method call

texts:
Running parity node, connected to Kovan testnet.
Contract Address: 0x354Db5AE17b11fbc01A8a146B63506b1d90872E0

Using a nodejs app + web3 to send/sign transactions with the private key corresponding to this address :
https://kovan.etherscan.io/address/0x02c52ceee9671b99152dff00172a53759d8b081a

which is non-empty.

With an instance of the contract, its method calls run fine, eg:
    var response = await tokenContract.methods.awardToken(addressParser(address),1).send({from:Account.public})
    console.log(response)

Pulls up the parity ui signer in order to sign.  Transaction goes through fine.

However, I must sign and send this transaction using just web3 -- I eventually want to deploy this to an IoT device.  There will be no parity ui.

let tx = {}
tx.nonce = await web3.eth.getTransactionCount(Account.public)
tx.from = Account.public;
tx.to = tokenContract.options.address;
tx.data = tokenContract.methods.awardToken(addressParser(address),1).encodeABI();
// //tx.gas = await web3.eth.getGasPrice();
tx.gas = 22888

which yields a tx object.

I have Account object containing the private/public key pair, from:

var Account = web3.eth.accounts.privateKeyToAccount(privateKey);

But when I sign and send the signed transaction, I get insufficient gas from the sender's account:

let signedTx = await Account.signTransaction(tx, Account.privateKey);
console.log(signedTx)

  { messageHash: '0xaa18a8ce5eb123ce13ed1b64c0653b4846fc0303bfc3814da06d9ae92dd42f2a',
    v: '0x78',
    r: '0x0f04a9fb70676a7e47d9673399c9e2339ab425b53df389e19e68342e9cc9f56e',
    s: '0x2adf857a27b95fe43fa69073b2d3ff40d5c7f963d04aa91afe6b388152e05746',
    rawTransaction: '0xf8ab108609184e72a0008302710094354db5ae17b11fbc01a8a146b63506b1d90872e080b844ded2d0f4
  000000000000000000000000db12813b2fd2651f11278218b4ebf69b7d1a8a7d00000000000000000000000000000000000000000
  0000000000000000000000178a00f04a9fb70676a7e47d9673399c9e2339ab425b53df389e19e68342e9cc9f56ea02adf857a27b9
  5fe43fa69073b2d3ff40d5c7f963d04aa91afe6b388152e05746' }

var receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
console.log(receipt)

  Error: Returned error: Insufficient funds. The account you tried to send transaction from does not have e
  nough funds. Required 114440000000000 and got: 0.

I must be missing something basic... web3.eth.defaultAccount = public key, which was derived from corresponding supplied private key, and there is a sufficient balance in the account ( verified using web3.eth.getBalance(Account.public)).

Parity, when receiving the rawtransaction is associating the signature with an entirely different publickey/wallet address (of 0 balance).


texts: Why variable A's value does not change by calling function to change it?

texts:
This contract first asks user to set variable A's value and after that calls function, which should change A's value to zero. But A's value does not change to zero. Why?

contract test {
    uint A;

    function set(uint SetA) {
        A = SetA;
        changeA(A);
    }

    function changeA(uint A) private {
        A = 0;
        return;
    }

    function variable() constant returns(uint variable) {
        variable = A;
    }
}


texts: how to use backup node in web3 connection?

texts:
node1= running on port 8545 => current synced block is 2000, and
  node2= running on port 3545 => current synced block is latest

When i am using web3 into another page and print web3 object it returns connection for node1, According to my web3.js file it should return connection for node2 because in my node1 has only 2000 block synced

I also used timeInterval() but it didn't worked

-------------------------------web3.js------------------------
var node1='http://localhost:8545'
var node2='http://localhost:3545'

    var Web3 = require('web3');
    var web3 = new Web3(new Web3.providers.HttpProvider((node1));

    if(!web3.isConnected()) {
        web3 = new Web3(new Web3.providers.HttpProvider((node2));
    }
    else {
        web3.eth.getBlockNumber(function(er,blck){
            if(blck>7300000){
                console.log('==> ETH connection to node1);
            }else{
                web3=undefined
                web3 = new Web3(new Web3.providers.HttpProvider((node2));
                console.log('==> ETH connection to node2);
            }
        });
    }
    web3.eth.getBlockNumber(function(er,block){
      console.log(block,web3)
      // here code works fine, web3 object is for node2
    })
    module.exports = web3;

    --------------------------------------------------

.

   ----------------------demo.js---------------------
    var web3 = require(./web3);
     web3.eth.getBlockNumber(function(er,block){
          console.log(block,web3)
          // here code did not work, web3 object is for node1
     })
    -----------------------------------------------------


texts: What happen to the transaction that in the uncle block?

texts: If a block realize it is an uncle block, what happen to the transaction that in the uncle block? Will the transaction in the uncle block be allocated into the transaction pool again or the sender need to submit the transaction to the blockchain again?


texts: `.at()` function no longer available for web3.eth.Contract?

texts:
I'm following a guide that uses some web3 code written 3 years ago.
I am trying to use the TimeLockedWallet.info() call to get information about a wallet.
Below are my two smart contracts.
TimeLockedWalletFactory.sol
pragma solidity ^0.4.18;

import "./TimeLockedWallet.sol";

contract TimeLockedWalletFactory {

    mapping(address => address[]) wallets;

    function getWallets(address _user)
        public
        view
        returns(address[])
    {
        return wallets[_user];
    }

    function newTimeLockedWallet(uint256 _unlockDate)
        payable
        public
        returns(address wallet)
    {
        // Create new wallet.
        wallet = new TimeLockedWallet(msg.sender, _unlockDate);

        // Add wallet to sender's wallets.
        wallets[msg.sender].push(wallet);

        // Send ether from this transaction to the created contract.
        wallet.transfer(msg.value);

        // Emit event.
        Created(wallet, msg.sender, now, _unlockDate, msg.value);
    }

    // Prevents accidental sending of ether to the factory
    function () public {
        revert();
    }

    event Created(address wallet, address to, uint256 createdAt, uint256 unlockDate, uint256 amount);
}

TimeLockedWallet.sol
pragma solidity ^0.4.18;

contract TimeLockedWallet {
    address public owner;
    uint256 public unlockDate;
    uint256 public createdAt;

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

    function TimeLockedWallet(address _owner, uint256 _unlockDate) public {
        owner = _owner;
        unlockDate = _unlockDate;
        createdAt = now;
    }

    // keep all the ether sent to this address
    function() public payable {
        Received(msg.sender, msg.value);
    }

    // callable by owner only, after specified time
    function withdraw() public onlyOwner {
        require(now >= unlockDate);
        //now send all the balance
        msg.sender.transfer(this.balance);
        Withdrew(msg.sender, this.balance);
    }

    function info()
        public
        view
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        return (unlockDate, createdAt, this.balance);
    }

    event Received(address from, uint256 amount);
    event Withdrew(address to, uint256 amount);
    event WithdrewTokens(address tokenContract, address to, uint256 amount);
}

And my frontend code tries to get information about the wallet from TimeLockedWallet.sol (unlockDate, owner, createdAt) using the contract.at() function. However, I get an error
VM3368:1 Uncaught TypeError: c_timeLockedWallet.at is not a function

App.js
import TimeLockedWallet from "./contracts/TimeLockedWallet.json";
import TimeLockedWalletFactory from "./contracts/TimeLockedWalletFactory.json";

const c_timeLockedWalletFactory = new web3.eth.Contract(
  TimeLockedWalletFactory.abi,
  deployedNetwork && deployedNetwork.address,
);
const c_timeLockedWallet = new web3.eth.Contract(
  TimeLockedWallet.abi,
);

const accounts = await web3.eth.getAccounts();

await c_timeLockedWalletFactory.methods.newTimeLockedWallet(unixTime).send({ from: accounts[0], value: web3.utils.toWei("1", "ether") });
const wallets = await c_timeLockedWalletFactory.methods.getWallets(accounts[0]).call();

c_timeLockedWallet.at(wallets[0]).then(function(walletInstance){return walletInstance.info();}).then(function(info){console.log(info)})

Is there another method to use to make this call? I've tried reading the web3 docs, but have come up short.


texts: Identify crypto from a given wallet address?

texts:
While relevant to ETH and all of its supported tokens. I am wondering if there is a regex or service available to return a cryptocurrency from a given address.

0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8 --> ETH

AdtZpLNgvhyQmiGE9v7XixVDkDWWQh8wY1 --> ARK

XfmZzu5LGin8sLx6gHtFRxa6y38UoCufqC --> Dash

Thanks


texts: How do I prove that transactionsroot is correct?


texts: BTC sent to my ether wallet for swap into ETH, but its not showing BTC or even ETH

texts: I have sent some BTC into myetherwallet account from unocoin,from unocoin it took time of 48 hours in transferring the BTC to myetherwallet (due to some technical issue). And now, BTC is transferred from my unocoin account to myetherwallet account, but its not showing my BTC or respective value ETH. Please help me out in getting my BTC/ETH which I have lost(without any reason). Dropped mail to myetherwallet support team, even they are also not responding. Please help me out.


texts: Calling function on ERC20 contract through staticcall gives wrong result

texts:
I've made two functions to interact with a local ERC20 token. Here they are:

pragma solidity ^0.5.0;

contract GardenTestContract {

    function getBalanceOf(address _address) public view returns (bool, uint, uint, address) {
        address sender = msg.sender;
        (bool _success, bytes memory data) = _address.staticcall(abi.encode(bytes4(keccak256('balanceOf(address)')), (sender)));
        (uint amount) = abi.decode(data, (uint));
        return (_success, data.length, amount, sender);
    }

    function getTotalSupply(address _address) public view returns (uint) {
        (bool _success2, bytes memory data) = _address.staticcall(abi.encode(bytes4(keccak256("totalSupply()"))));
        (uint amount) = abi.decode(data, (uint));
        return amount;
    }

}

The address I'm passing to these functions is the address of the ERC20 token which is implemented like this:

pragma solidity ^0.5.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Detailed.sol";

/**
 * @title GardenTestToken
 * @dev Simple ERC20 Token example yielding 10000 tokens pre-assigned to its creator.
 */
contract GardenTestToken is ERC20, ERC20Detailed {
    // modify token name
    string public constant NAME = "GardenTestToken";
    // modify token symbol
    string public constant SYMBOL = "GTT";
    // modify token decimals
    uint8 public constant DECIMALS = 18;
    // modify initial token supply
    uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(DECIMALS)); // 10000 tokens

    /**
     * @dev Constructor that gives msg.sender all of existing tokens.
     */
    constructor () public ERC20Detailed(NAME, SYMBOL, DECIMALS) {
        _mint(msg.sender, INITIAL_SUPPLY);
    }
}

I'm working in remix, which is why the github import works as far as i know.

When i call getTotalSupply i get back the correct number of total supply (the INITIAL_SUPPLY value from the token contract). When i call getBalanceOf, things get confusing. I dont get the balance of the address that I'm calling from, but i just get 0. The decoded output from the remix console looks like this:

{
    "0": "bool: true",
    "1": "uint256: 32",
    "2": "uint256: 0",
    "3": "address: 0xf348328786984162e70f08d54a272427D810124b"
}

If i copy the address in this output into the remix GUI belonging the my deployed ERC20 contract, I get back the correct balance, and i do not know why or how this could be.

My remix is running against a local ganache chain through metamask and I'm compiling with 5.13. It also doesn't with the JavaScript VM.

I'm at a loss, any suggestions are welcome.


texts: Use private ethereum blockchain for storing data

texts:
I am new in ethereum blockchain technologies. I have some question that

Is possible to use ethereum blockchain to store data (Like MySQL)..???
If yes... (for first question) have any documentation available regarding this topic..???
I already learned the solidity language is a contract based language. Is have any way to get api(Like Rest api) for front end app devoloping...???

Thanks in advance....


texts: on a way of supporting multiple inheritance in Solidity

texts:
Question in one sentence:

Regarding function calls, to infer the what the most derived function is, is it enough to track functions in base contracts for each contract, or do we also have to consider the final inheritance graph?

An example below clarifies my question:

contract B {
    function testb() public{ }
}
contract C{
    function testc() public{ }
}

contract D is B,C {
    function testd() public{ }
}

In the above code, are no functions copied into the contract C? Or, should the function testb in contract B be copied into the contract C as the final inheritance graph is D->C->B?

Solidity docs says that:

  the code from all the base contracts is copied into the created contract.

Based on the description above, it seems that no functions may be copied into the contract C, as the C has no base contracts.

However, I am still confused because I do not know when we have to consider final inheritance graph. Solidity docs explains only one such case (super call).


texts: What property makes Proof of Stake easier to apply in permissioned blockchains?

texts:
There are a number of efforts driving towards the transition from the current proof-of-work towards proof-of-stake (more info here). Meanwhile proof-of-stake is already in use in some permissioned blockchains (including Ethereum adaptations such as Eris).

What makes this transition feasible now for permissioned blockchains, but still work-in-progress for public blockchains?


texts: How to set a timer in web3 event watcher?

texts:
I have a web3 event watcher set up in a Javascript file as such:

var a;
contract.events.allEvents(function(error, event){
   if (event.event == "Set") {
        a = event.returnValues['val'];
   }
});

When I run this file with node eventWatcher.js it will loop indefinitely and run the code within my conditionals every time an event occurs.

However, I want to keep a timer concurrently such that when a certain amount of time passes, I can unset the value of a. Is this possible?

Thanks!


texts: How can I make an off-chain call to get the data stored at a specific storage slot on-chain?

texts: I want to get data from on-chain that is not explicitly available through a getter. For example, if I know that there is data at position 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc at address 0xd0A7333587053A5BAe772BD37b9AAe724E367619, how can I retrieve that data if there is no getter function in the contract?


texts:
The words in the stack are 256-bit, therefore 32 bytes in hexadecimal representation.
The Ethereum Yellow Paper states “the stack as a size of 1024”, although it does not say what (bits/words).
A smart contract analysis tool, Rattle, states there can not be more than 32 elements in the stack , so I am assuming the answer to the question of how many words of 256-bit can there be at the execution stack of the EVM is 32. Is this right?
Also, what can anybody tell me about the memory? The MLOAD and MSTORE opcodes only take one element from the stack to indicate the memory position. So the memory can only expand till 2^256 entries?


texts:
I am new to mist wallet

I had installed mist wallet and I want to connect mist wallet to private network

What are the steps do i need to follow to connect ethereum mist wallet with ethereum local private network??


texts: debug_traceTransaction returns massive json of opcodes

texts:
I ran debug_traceTransaction on tx "0x7faf48b09018e507c49c1c44b139fa05c262fb1e3425a43ae80e6c9ccb3fcf0e" (block 1805546, txindex 1: contract creation), and I received back a massive 157MB json of opcodes.  Apparently there are 571,986 opcodes in this, which I can't even load into Firefox for easy viewing.  Etherscan.io says that the input for the tx is "0x5b620186a05a131560135760016020526000565b600080601f600039601f565b6000f3", and the contract code is "0x".  My eth_getCode also returns "0x".  Upon further inspection, there are a whole bunch of contract creations starting around block 1805540 that have similar massive debug_traceTransaction results.
What am I looking at here, and why is there no contract code?


texts:
Is there a transaction confirmation for ethereum like there is for bitcoin?
I sent 73 etherium to an exchange and they show only 64. How can I verify that they received all 73?


texts: Do we really need smart-contracts for duplicable/replayable business logic or will event/logging suffice?

texts:
I have not found any place where this topic is well covered. I've been playing around with smart-contracts and trying to figure out what advantages an smart-contract has over plain logging of input parameters.

Mentally I'm just comming to the basic of software development, where I have an algorithm reading input data, processing it according to some algorithm and writing output data/results.

As I see it, if I just keep/save the inputs into the ethereum logs and then use such logs as input to any external software outside the blockchain I can keep a consistent distributed state reusing ethereum infraestructure:

Advantages of Log approach:

No risk for buggy smart-contracts. The log have no logic or state, just "probe of fact". If the external program processing them is buggy we can just fix it.
Much cheaper. Logging is a few weis per byte, (much much) cheaper than executing a transaction.
Much easier to port from one block-chain implementation/environment to another (just replay the logs).
Any others?

Disasvantages of Log approach:

smart-contracts that depends on the current state of the ethereum block-chain (non-idempotent) or external oracles (input sources) depending on time.
No automatic clearing for contracts using "virtual money" (ethers) as payment method.
Every client needs to "download" the logs from the block-chain and re-process the computation (Could this be problematic / disallowed in public networks?).
Any others?

Postcript: I tried to add the "idempotent" tag but I have not enough reputation. Still I consider "idempotent" is a very important topic for smart-contracts for obvious reasons.


texts: Web3j and Transaction with null receiver

texts:
I am trying to get the list of all transactions using the method web3j.catchUpToLatestAndSubscribeToNewTransactionsObservable but a lot of them have a null receiver (Transaction.to).

Using etherscan.io and the tx hash I can see that the receivers of those transactions are Contracts.

Example:

https://ropsten.etherscan.io/tx/0xea0b41af0ea0aa295cf1b42dc283ae3f276f58be4b9be0c1653765516c38fdb0

So is it correct to say that a transaction with null receiver is always a transaction to create or to interact with a smart contract?

Are there any other cases?

Thanks!


texts: Could private values be read by other contracts?

texts:
While studying blockchain interoperability (like BTC relay or a Dogecoin relay), it came to my mind that if the Ethereum blockchain can read another blockchain, we could use the same process to make the Ethereum blockchain read itself including private values of contracts.

This would defeat the goal of making some contract variables private.

What would prevent someone from setting a contract (using a Ethereum-Ethereum relay) reading a private value?

If this is effectively possible, shouldn't we simply stop making variables private, as it would be misleading and leading to security issues?


texts: Cannot Connect to Geth Web Socket from Other PC on LAN

texts:
I have a geth node running on one PC, IP 192.168.0.105 and on my main dev machine IP 192.168.0.102, I'm trying to connect to it via web sockets but keep getting connection not open. Both are on the same LAN.

My program and the connection works fine when I use HTTP provider.

const endpoint = 'http://192.168.0.105:8545'; //works fine

//using
const endpoint = 'ws://192.168.0.105:8445'; //connection not open
const wsProvider = new Web3.providers.WebsocketProvider(endpoint);

geth --rpc --ws --wsaddr "192.168.0.105" --wsorigins "*" --wsport "8445"


texts:
In order to enable purchases of MyToken, where do I include the RATE (token/ETH) such as the below code from Openzeppelin docs on crowdsales into my deploy_contract.js or MyToken.sol? And how to insert it?
new Crowdsale(
    1,             // rate in TKNbits
    WALLET,     // address where Ether is sent
    TOKEN  // the token contract address
);

Here are the Simpletoken, Crowdsale, and deployment contracts from Openzeppelin:
/ contracts/SimpleToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.5;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol";

contract SimpleToken is Context, ERC20, ERC20Detailed {
    constructor(
        string memory name,
        string memory symbol,
        uint256 initialSupply
    ) public ERC20Detailed(name, symbol, 18) {
        _mint(_msgSender(), initialSupply);
    }
}

// contracts/SimpleCrowdsale.sol
// SPDX-License-Identifier: MIT
    pragma solidity ^0.5.5;

import "@openzeppelin/contracts/crowdsale/Crowdsale.sol";

contract SimpleCrowdsale is Crowdsale {
    constructor(
        uint256 rate,
        address payable wallet,
        IERC20 token
    ) public Crowdsale(rate, wallet, token) {}
}

// migrations/2_deploy.js
// SPDX-License-Identifier: MIT
const SimpleToken = artifacts.require("SimpleToken");
const SimpleCrowdsale = artifacts.require("SimpleCrowdsale");

module.exports = async function (deployer, network, accounts) {
  await deployer.deploy(SimpleToken, 'Simple Token', 'SIM', '10000000000000000000000');
  const token = await SimpleToken.deployed();

  await deployer.deploy(SimpleCrowdsale, 1, accounts[0], token.address);
  const crowdsale = await SimpleCrowdsale.deployed();

  token.transfer(crowdsale.address, await token.totalSupply())
};


texts: Own private key of smart contract to sign a line of text

texts: For my project it is necessary for smart contract to sign a message (for example, EC-signature) I have not found a way to generate a pair of public and private keys inside the contract so that the private key remains invisible to anyone, and smart contract could sign a line of text with it. Maybe the contract has its own private key that can be used in this way? Thanks in advance for the answer.


texts: Is it possible to make Zeronet p2p websites as client of Ethereum Dapps?

texts:
Is it possible and does it make sense?

You can browse some cool P2P-websites (work without any servers) inside the network through this gateway.

Or you can browse them without any gateways if install Zeronet binaries: Zeronet.io

Is it possible to make some Ethereum smart contract be the owner of a site like ZeroID?


texts: To varify documents, how documents attached and who will verify and if miners how will they verify?

texts:
I need a help to develop a function to check the customer's eligibility /proof of identity.

For example I am very very rich people (Practically NOT). Now i have decided to buy a big house in Las Vegas-USA through the help of Ethereum and Smart Contract. So Ethereum miner nodes will verify my account balance and check really i have enough money or not. Now for example Las Vegas city has a rule no foreigner can buy a house there only adult USA citizen can buy. So to buy a house i have to submit my passport or any other official documents that prove i am USA citizen and i am >= 18 years old.

So my question is in smart contract how can i submit my documents and who will verify my documents and how? Is it possible to attach something during conducting with smart contract?

However after attaching the relevant proving documents, who will gonna verify that documents in Blockchain (the Ethereum nodes??). And if it nodes how they will read the data from image/pdf of passport/other documents to verify.

And finally in solidity how can i accommodate this functionalities.

Thanks a lot in advance.


texts: Is it possible to know which will get the next pending block?

texts: Is it possible to predict which miner will mine the next pending block on ethereum mainnet?


texts:
When calling to start() function in a Smart Contract, transaction fails with this message:

  Warning! Error encountered during contract execution [Bad jump destination]

According to Error During Token Contract Execution ... an invalid array index definitely generates this message. So I have been thinking about it, trying to figure out when my code is using an invalid index, but I can't find it.

This is the method requested:

function start(address seller, address thirdParty) returns (uint escrowId) {
    escrowId = numEscrows;
    numEscrows++;
    escrow e;
    e.thirdParty = thirdParty;
    e.seller = seller;
    e.buyer = msg.sender;
    e.amount = msg.value;
    e.recipient = seller;
    e.status = 1; // started

    escrows[escrowId] = e;

    return escrowId;
}

The only array there is escrows[] declared as mapping (uint => escrow) escrows;

After trying different things, I came to conclusion that problem surely is located at last line: escrows[escrowId] = e;

Is not possible to make such an assignment escrows[0] = e;? Why not?

What am I doing wrong? How can I debug it?


texts:
I have a simple contract as below:-

contract MultiAsset {
    address public creator;
    mapping(string => address) assetOwner;

    event NewAsset(string  indexed assetName, address indexed to);
    event AssetTransferred(string indexed assetName, address indexed from, address indexed to);

    function MultiAsset() {
        creator = msg.sender;
    }

    function assignOwner(string assetName, address to) {
        if (msg.sender == creator) {
            //new asset entry
            if (assetOwner[assetName] != 0x0) {
                throw;
            } else {
                assetOwner[assetName] = to;
                NewAsset(assetName, to);
            }
        } else {
            throw;
        }
    }

    function getAssetOwner(string assetName) constant returns (address owner){
        owner = assetOwner[assetName];
        return owner;
    }

    function transfer(string assetName, address to) {
        //transfer can be done only by the owner
        if (msg.sender == assetOwner[assetName]) {
            assetOwner[assetName] = to;
            AssetTransferred(assetName, msg.sender, to);
        } else {
            throw;
        }
    }}

The contract is to save a key value pair of assets like as below:-

"Asset1" - Addr1
"Asset2" - Addr2

Now my assignOwner  function is working fine but when I call transfer function it doesn't work. I get an invalid jump in the debug.traceTransaction of the transfer tx.

Is there something wrong with the transfer function code?

Also if I am watching for events, nothing is getting printed?

var event = assetContract.NewAsset({}, '', function (error, result) {
    if (!error) {
        console.log("Asset Creation: " + result.args.assetName + " to To address:" + result.args.to);
    } else {
        console.log('error:' + error);
    }
});


texts: Will a smart contract get deleted once Geth's console is closed?

texts:
Is there anyway to deploy a contract permanently on my private chain?

I tried the greeter contract and closed the console. After running the console again and trying to invoke my greet function I received the following error.

Error: 'greeter' is not defined


texts:
I'm trying to generate a typed signature for an array in JavaScript based on EIP-712 and using eth-sig-util.

My problem is that I need to sign an array. It says in the specification to use Type[] or Type[n] for arrays.

  Definition: The reference types are arrays and structs. Arrays are either fixed size or dynamic and denoted by Type[n] or Type[] respectively. Structs are references to other structs by their name. The standard supports recursive struct types.

But when I do that, I get the error:

Error: Arrays currently unimplemented in encodeData

Here is how my property and data look:

const signStable = ({ data, prvtKey, properties }) => {
  const trimmedPrivateKey = prvtKey.replace('0x', '');
  const prvtKeyBuffer = Buffer.from(trimmedPrivateKey, 'hex');
  const payload = createPayload({ message: data, properties });
  return ethSigUtils.signTypedData(prvtKeyBuffer, { data: payload });
};

const createPayload = ({
  message,
  properties,
  primaryType = 'RequestParams'
}) => ({
  types: {
    EIP712Domain: [
      { name: 'name', type: 'string' },
      { name: 'version', type: 'string' },
      { name: 'verifyingContract', type: 'address' }
    ],
    ...properties
  },
  primaryType,
  domain: {
    name: 'Fortmatic',
    version: '1',
    verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
  },
  message
});

const prvtKey = 'abc...';
const foo = 'foo';
const bar = 'bar';
const id = 'ck35k2yol000bn4op6u0vbteq';
const num = 42;
const arr = [num];
const MyObj = [{ name: 'arr', type: 'number[]' }];
const RequestParams = [
  { name: 'foo', type: 'string' },
  { name: 'bar', type: 'string' },
  { name: id, type: 'MyObj' }
];
const obj = { [id]: { arr }, bar, foo };
const properties = { MyObj, RequestParams };

signStable({ data: obj, properties, prvtKey });

Is there any way to do a typed signature for arrays?

Edit: Based on the comments :)

The line triggering the error is

return ethSigUtils.signTypedData(prvtKeyBuffer, { data: payload });

in my code. And within eth-sig-util its in line 108.


texts:
Situation:

I am using web3.js with geth for my application to know which clients are depositing money into 1 specific account (instead of making a new wallet for each new client). The way I am attempting to do this is via the data value in the transactionObject:

transcationObject = {
  from: sender,
  to: receiver,
  value: amount,
  data: 2134235141 //uniquely generated value for this user
}

Problem:

The problem is I need a way for my application to store all the transactionObjects of the accounts that are sending Ether to my account. From there it's pretty easy to know who sent how much by looking at the data value.

Potential Solution:

After searching online, I found the function eth.setFilter. To my understanding, what this does is filters all the transactions that are being added to the blockchain of the local node, and only saves the ones that pass through the filter.

source of learning about eth.setFilter: How to trace state of transactions in ethereum

Question:

Is the previous explanation how eth.setFilter actually works? Is it integrated with the process of saving new transaction information into the blockchain?

AND could someone provide an example of how it is used? I saw some examples with curl online (the link above), but I had no idea what that code actually does. Does it modify how the blockchain operates indefinitely? Or does it need to be re-run? Is there a better way to do it?

Note: If some of the questions above are irrelevant to the answer you are providing, it's completely fine. I am mostly trying to find a solution of how to use eth.newFilter and understand what it is doing with that code.


texts: Mist 0.8.6 crashing with Couldn't connect to node? See the logs for more

texts:
I have updated Ethereum-Wallet to 0.8.6. My accounts were not showing up in Wallet, so I deleted the .ethereum folder (after taking a backup) and restarted Wallet, but now I was unable to run wallet, I was hit by pop-up screen displaying Couldn't connect to node? See the logs for more.

  Fatal: Could not open database: write /home/gemini/.ethereum/chaindata/029001.ldb: no space left on device

I currently have 2GB RAM, I added 4GB of swap memory but still geth consumes all memory and crashes.What could be the possible reason? How can I solve this problem?


texts: How to run Private Ethereum Node forever

texts: I want to run my Private Ethereum Node continuously, even if it stops in between,it should get started automatically. Like forever npm in node which ensures that a given script runs continuously. so is there any tool which can be used to monitor the Ethereum node, and should start the node automatically if it stops.


texts:
I had a functioning dapp until yesterday. But contractInstance.methods.x().send().on('receipt') and contractInstance.events.y().on('data') suddenly stopped to work. I can't even find the reason.
Why would receipt and data stop to work for no reason? The functions and events works fine but they don't return receipt and data.
The transactionHash works fine.
I use window.ethereum as provider. and metamask as wallet.
I know they stopped supporting window.web3 but window.ethereum should work fine right?


texts: What are some of the most interesting single contracts on Ethereum?

texts:
What are some of the most interesting contracts on Ethereum, where a contract may not necessarily be a system or dApp, but a code snippet?  A contract may not have a UI but could still be quite interesting for other reasons.

This question is hard to phrase without losing it's point, but examples of "interesting" could be the way the contract is designed, what it does, how it does it, etc.


texts: Wallet on private chain not watching contracts?

texts:
I set up an ethereum private chain for testing smart contracts a while back. Recently, I've been unable to deploy and interact with contracts successfully. Here is what used to work:

1) I created a chain in the command line:

geth --identity "testChain" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir
"C:\Users\<user_name>\Desktop\testChain" --port "30303" --nodiscover --rpcapi
"db,eth,net,web3" --networkid 1999 init C:\Users\<user_name>\Desktop\customGenesis.json

Using this genesis:

{
    "nonce": "0x0000000000000042",     "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",     "gasLimit": "0x8000000",     "difficulty": "0x400",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",     "alloc": {    }
}

2) I run my chain:

geth --identity "testChain" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir
"C:\Users\<user_name>\Desktop\testChain" --port "30303" --nodiscover --rpcapi
"db,eth,net,web3" --networkid 1999 console

3) Start ethereum wallet/mist and it automatically connects to my 'private-net'

4) Proceed to create an account, and start mining ether through geth attach

5) Navigate to 'Deploy Contracts' and paste my contract code. In this example, I am using the code provided by ethereum for issuing your own token.

6) Deploy contract.

7) Miner.start() and watch the 12 confirmations.

8) I am now able to view the currency I've created. I can also go manage the contract, as my account is the owner. Transfer assets, etc.

When I attempt this now, I run into problems at steps 6 and 8. In step 6, I sometimes get a gas limit error. I resolve this by exiting the wallet and trying again. When the contract is successfully deployed, I watch as the confirmations are completed. The problem is that my account never shows my ownership of 'shares' as the ethereum guide says it should. I am not able to transfer any of my 'shares', and there is no place to manage the contract.

Any thoughts?


texts: How to store user specific data in ethereum private chain

texts: I want to store data specific to each user, like a hash of his ipfs file. How to store this data so that later i can query with user id.


texts: When and why should one choose to use tokens over ether?

texts:
I'm developing a prototype on credential management using blockchain and have been using Ethereum for the same. Having stumbled on TokenFactory and its ability to build ERC-20 compatible tokens. I was confused as to why exactly and when should one consider using tokens rather than rely on the Ethereum's currency of ether?

Is it just to tap into the "network ownership effects" to give an advantage to the early adopters of the Dapp?


texts: How to execute the Transfer function from Remix

texts:
I deployed this ERC-20 contract https://github.com/sijo0703/solidity-contracts/blob/master/MyToken.sol in Remix via the JavaScript VM.
How can I transfer some Tokens from the contract creator's address (me) to another address from within Remix?  When I call the Transfer function using the Orange Button it fails.  I assume the Transfer function is being called using the Contract address which has no Tokens.
How can I initiate the Transfer function via the contract creator's address (me) from within the Remix IDE?
Thank you


texts: How can I connect my Rails app to an ethereum network?

texts: At this time I'm just trying to setup the simplest of apps where I click a button and that will send the most basic of transactions to my testrpc network. It's easy to do with JS and web3, but how can I do this with Ruby on Rails ?


texts: A list of token holders at a specific time

texts: What's the best way to get the list of token(ERC20) holders with their balance at a specific time? Thank you.


texts: How to access a public function in solidity?

texts:
I have a smart contract deployed on the Testnet here -
https://ropsten.etherscan.io/address/0xD99ea28F24317F28291556754edd24AA1352c26e
This contract has a public function triggerAgeCount
   function increaseAge() internal {
     totalSupply += 1;
     balaceOf[owner] += 1;
   }

function triggerAgeCount() public {
    if ( (now-creationTime) >= 365 days ){
        increaseAge();
        creationTime = now;

    }
}

I want to know how can I trigger this event once the contract is deployed, also where can I check the totalSupply for the current contract.
The whole code is
pragma solidity >=0.5.0;

contract Jeevan{

   string public constant name = "Jeevan";
   string public constant symbol = "JA";
   uint8 public constant decimals = 18;
   uint public totalSupply = 30;
   uint256 public creationTime = now;
   address owner;

   mapping(address => uint256) public balaceOf;

    constructor() public{
       balaceOf[msg.sender] = totalSupply;
       owner = msg.sender;
   }

   event balanceTransferred(address _from, address _to, uint256 _value);

 function _transfer(address _from, address _to, uint256 _value) internal{
    require(_to !=_from);
    require(_to != address(0));
    require(balaceOf[_from] >= _value);
    uint previousBalance = (balaceOf[_from] + balaceOf[_to]);
    balaceOf[_from] -= _value;
    balaceOf[_to] += _value;
    assert(balaceOf[_from]+balaceOf[_to] == previousBalance);
 }

   function transfer(address _to, uint256 _value) public {
       _transfer(msg.sender,_to,_value);
       emit balanceTransferred(msg.sender,_to, _value);
   }

   function increaseAge() internal {
     totalSupply += 1;
     balaceOf[owner] += 1;
   }

function triggerAgeCount() public {
    if ( (now-creationTime) >= 365 days ){
        increaseAge();
        creationTime = now;

    }
}

}

I want that after every 365 days, I call the triggerAgeCount() function and it increase the totalSupply by +1.


texts: call opcode gas consumption on a non EOA address depends if the addres is "new" or not

texts:
I have the following contract, reduced to the minimum for testing reasons:
pragma solidity ^0.6.11;

contract PackedMultiplexer {
    function multiTransfer(address  _address1, uint _amount1, address  _address2, uint _amount2) payable public
    {
        assembly {
            pop(call(2300, _address2, _amount2, 0, 0, 0, 0))
            pop(call(2300, _address1, _amount1, 0, 0, 0, 0))
        }
    }
}

Now, I generate 2 new private keys.
I get 2 new public addresses 0x0c73c24c841ddDF2d476E7E2C1552Ea04364cc9A and 0xC16F1C0241B1204BC123650CfCb3A03046F2d91C, previously unknown to the network. Then I call the contract with those addresses and some random (constant) value for the amounts.
I get a first TX which consumes 87,191 gas.
I call a second time the contract with exactly the same parameters and get a second TX which consumes 37,191 gas.
My question: why is the gas consumption of the first execution of the contract and the second execution is different? It seems to me in both cases the same code is executed? What am I missing?
As you can see in the debugger, the first TX call opcodes consumes 37000 gas each; the second TX call opcodes consumes 12000 gas each. Why is that? How can I prevent the 37000 gas consumption?
(Note: the question holds true if you replace 2300 (first argument of call) in the code by gas() or 0.)


texts: SafeMath preventing contract initialization?

texts:
I'm deploying via Remix and Metamask.

I'm using this SafeMath function, which seems to be preventing my contract from initializing all its state variables (contract deploys, but all vars are zero):

function add(uint256 a, uint256 b) internal constant returns (uint256) {
  uint256 c = a + b;
  assert(c >= a);
  return c;
}

The library function seems to be causing the problem in the following function. To be clear, the deposit function below isn't even being called during deployment. But when I deploy the contract with the FIRST line in the if-block enabled (which uses the .add SafeMath formula), the contract deploys but none of the state variables are set.

Everything works fine when I use the second line.

Am I using the SafeMath library incorrectly?

function deposit(address addr) payable {

  uint256 amt = msg.value;

  uint alreadyDeposited = deposits[addr]; // deposits is an address => uint mapping

  if (alreadyDeposited > 0) {
    // deposits[addr] = alreadyDeposited.add(amt); // When this line is enabled, my contract doesn't initialize (for example, "ownerWallet", which should be msg.sender, is not set when the contract deploys).
    deposits[addr] = alreadyDeposited + amt; // this line lets contract vars initialize appropriately.
  }

  sendFunds();
}

PS can someone explain how add knows how to use itself as the first parameter?


texts: Smart Contracts and Insurances, how is an event determined?

texts:
I recently came across this article:

https://dailyfintech.com/2016/01/14/what-does-the-future-hold-for-blockchain-and-insurance/

There they claim to have built an Flight Insurance Smart Contract called InsurEth (to insure against flight delays), and they say this:

  "In this case, a delayed flight is a matter of fact and public record.
  It does not rely on anyone’s judgement or individual assessment. It is
  what it is. If the event occurs, the smart contract gets triggered and
  the pay out is made. Automatic and immediate, with no claims
  processing costs for the insurer and satisfaction for the customer."

How is this possible?

As far as I know a Smart Contract cannot execute itself out of nothing, someone or something has always to do a transaction calling a payback method, and only then, the funds can be paid out.

As far as I can see, for insurances, there always needs to be a human validation, to confirm that an event really happened.

Or how could this work in the way they describe?


texts: buyTokens throws error when is is getting called

texts:
Whenever I the buyTokens function is getting executed, I am getting below error
Reason provided by the contract: "ERC20: transfer amount exceeds allowance". Debug the transaction to get more information.
I am using openzeppelin v3.
Please find attached source code
pragma solidity >=0.4.22 <0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyFirstToken is ERC20, Ownable {
    uint256 rate;
    constructor() public ERC20("MyFirstToken",'MFT'){
        _mint(msg.sender, 1000000000000000000000000);// 1 million tokens
        rate = 1;
    }

    event TokensPurchased(
      address account,
      address token,
      uint amount,
      uint rate
    );

    event TokensSold(
        address account,
        address token,
        uint amount,
        uint rate
    );

    modifier contractHasEnoughBalance() {
        // Calculate the number of tokens to buy
        uint tokenAmount = msg.value * rate;
        // Require that MyFirstToken has enough tokens
        require(balanceOf(this.owner()) >= tokenAmount,"Contract doesn't have enough balance");
        _;
    }

    function buyTokens() public payable contractHasEnoughBalance {
        // Calculate the number of tokens to buy
        uint tokenAmount = msg.value * rate;
        // Transfer tokens to the user
        transferFrom(this.owner(), msg.sender, tokenAmount);
        // // Emit an event
        // emit TokensPurchased(msg.sender, address(this), tokenAmount, rate);
    }

    function sellTokens(uint _amount) public {
        // User can't sell more tokens than they have
        require(balanceOf(msg.sender) >= _amount, "User doesn't have enough balance");
        // Calculate the amount of Ether to redeem
        uint etherAmount = _amount / rate;

        // Require that Contract has enough Ether
        require(address(this).balance >= etherAmount);

        // Perform sale
        transferFrom(msg.sender, address(this), _amount);
        msg.sender.transfer(etherAmount);

        // Emit an event
        // emit TokensSold(msg.sender, address(this), _amount, rate);
    }

}


texts: A python module equivalent to Nethereum codegen

texts: Does anyone know a Python module that can help me convert an ABI for a contract to a python class automatically. Nethereum has Codegen for C#, is there anything like that for python ?


texts: 'curl: no URL specified!' Installing Parity on AWS (Ubuntu)

texts:
The accepted answer found here does not seem to work for me:  https://ethereum.stackexchange.com/a/46926/11266

I created an EC2 instance of Ubuntu 16.04 LTS (HVM)

$ bash <(curl https://get.parity.io -Lk) -r stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   170    0   170    0     0   1465      0 --:--:-- --:--:-- --:--:--  1452
100  3847  100  3847    0     0  21491      0 --:--:-- --:--:-- --:--:-- 21491
Release selected is: stable
Upgrading parity from 0.0.0 to 1.11.10
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
/usr/bin/sha256sum: /tmp/tmp.NnKCndYjTQ/parity: No such file or directory
cp: cannot stat '/tmp/tmp.NnKCndYjTQ/parity': No such file or directory
rm: cannot remove '/tmp/tmp.NnKCndYjTQ/*': No such file or directory

I tried wrapping the url in quotes, but I'm getting the same result.

$ bash <(curl 'https://get.parity.io' -Lk) -r stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   170    0   170    0     0   1360      0 --:--:-- --:--:-- --:--:--  1349
100  3847  100  3847    0     0  21857      0 --:--:-- --:--:-- --:--:-- 21857
Release selected is: stable
Upgrading parity from 0.0.0 to 1.11.10
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
/usr/bin/sha256sum: /tmp/tmp.VZclpPZSN8/parity: No such file or directory
cp: cannot stat '/tmp/tmp.VZclpPZSN8/parity': No such file or directory
rm: cannot remove '/tmp/tmp.VZclpPZSN8/*': No such file or directory


texts: How does the Merkle proof mechanism exactly work in Ethereum? This is straightforward in bitcoin but

texts:
I've searched this site and elsewhere but can't find anywhere this is explained.
In bitcoin, it's straightforward. If you're a light client (SPV) in bitcoin, I understand how with the regular Merkle Tree there you simply concatenate the hashes and rehash them upward in the path toward the root USING with the Merkle Proof provided by the full node in order to verify data integrity.
But how is this done in Ethereum? Because from what I understand about the Merkle Patricie Trie, it's different from the Merkle Tree in that you can't construct/calculate it by concatenating hashes and rehashing them along the path toward the root hash. What exactly is the process used here to calculate the hashes upward eventually leading to the calculation of the root hash? I suppose, in other words, how does the Merkle proof look format-wise?
I'm not trying to program anything by the way. Just trying to understand conceptually.


texts: Problem in fetching return values in solidity contract function using web3 js

texts:
solidity function:

function getCredentials(uint id) public constant returns(string,string,uint)
{
    address ad=acadr[id];
    uemail=email[ad];
    ulocation=location[ad];
    ugid=gid[ad];
    return (uemail,ulocation,ugid);
}

web3 calling code:

myInstance.getCredentials(1,function (error, result) {
                             if (!error) {
                                 console.log(result);
                             } else
                                 console.log(error);
}

this prints a hexadecimal value in log instead of string and int

please help !


texts:
I am developing a large database of exploitable contract addresses and creating a website to host such a database for users to use to see if contracts are safe.

Is there a way to get all contract addresses from the ethereum blockchain?. Currently, I am using a web scraper, but I often get temporarily banned, even when using proxies and fake user credentials.


texts:
I am trying replicate the program given at the following link:
What is a function Selector

However, I am not using the function selector. I am using the name of the function explicitly to invoke it by associating it with contract'ss address and calldata syntax. I have two problems first I can't understand how to retrieve the arguments returned by the called function. Secondly I am getting the syntax error:

      solc calwoFSelector.sol calwoFSelector.sol:12:25: Error: Member "func" not found or not visible after argument-dependent lookup in
      address.
           bool success      =dest.func.value()(uint256(789), uint8(123));

                    ^-------^

My complete code is:

pragma solidity ^0.5.1;

  contract Contract1 {
    function func(uint256 x, uint8 y) public returns (uint32, uint32)  {}
  }

  contract Contract2 {
     Contract1 public contract1 = new Contract1();
        function func() public returns (uint32, uint32) {
           uint32[2] memory ret;
           address dest = address(contract1);
           bool success      =dest.func.value()(uint256(789), uint8(123));
           return (ret[0], ret[1]);
       }
   }


texts: How to read public variable from contract using ethers.js

texts:
I am trying to read public variable from contract on chain using ethers.js.
Calling the methods work but I could not manage to read public property (without getter).
The methods works like this:
const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://bsc-dataseed1.binance.org:443');

const contract = new ethers.Contract(address, [
    'function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256)',
], provider);

let works = await contract.getMultiplier(5, 10);

However, if I try accessing public property, it doesn't work. In fact, I receive error with the ABI.
const contract = new ethers.Contract(address, [
    'uint256 public totalAllocPoint',
    'PoolInfo[] public poolInfo'
], provider);

Error: unsupported fragment (argument="value", value="uint256 public totalAllocPoint", code=INVALID_ARGUMENT, version=abi/5.2.0)

poolInfo is even different because it needs a parameter.
How can I read totalAllocPoint and poolInfo from the contract?

Shouldn't it be like something like this:
let x = await contract.totalAllocPoint;
let y = await contract.poolInfo(2);

In the docs, unfortunately it only shows how to access methods


texts: No ABI produced with online remix compiler if any libraries defined above main contract

texts:
I am using remix online http://remix.ethereum.org/ to compile smart contracts, but the ABI is not being produced if the contract has any libraries or other definitions above the contract code itself. Example simple code follows. If I leave the library definitions in, the ABI is blank (copy it just gives "[]"). I am working on more advanced contracts and need to be able to specify many libraries, interfaces, and even other contracts before the main contract for which I want the ABI. Can I get the ABI for the bottom (main) contract somehow even if lots of libraries, interfaces, and even other contracts before the main contract?
P.s. I am not able to use import calls for this application, I prefer to define libraries in code. It DOES compile, but no ABI at all. Somehow if I could get the ABI just for the bottom contract (right now no ABI at all unless I delete all the library definitions before the main contract).
/* We will be using Solidity version 0.6.8 */
pragma solidity ^0.6.8;
library Math {
/**
 * @dev Returns the largest of two numbers.
 */
function max(uint256 a, uint256 b) internal pure returns (uint256) {
    return a >= b ? a : b;
}

/**
 * @dev Returns the smallest of two numbers.
 */
function min(uint256 a, uint256 b) internal pure returns (uint256) {
    return a < b ? a : b;
}

/**
 * @dev Returns the average of two numbers. The result is rounded towards
 * zero.
 */
function average(uint256 a, uint256 b) internal pure returns (uint256) {
    // (a + b) / 2 can overflow, so we distribute
    return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);
}

}
contract TestContract {
// Container of the greeting
string private greeting;

// Initialize the greeting to Hello!!.
constructor() public {
    greeting = "Hello!!";
}

/** @dev Function to set a new greeting.
  * @param newGreeting The new greeting message.
  */
function setGreeting(string memory newGreeting) public {
    greeting = newGreeting;
}

/** @dev Function to greet.
  * @return The greeting string.
  */
function greet() public view returns (string memory) {
    return greeting;
}

}


texts: How can I see required hashrate to mine?

texts: I'm trying to mine on ropsten testnet. My hashrate is 108905. I think this is very low. Are there any ways to see required hash rate to mine?


texts: How to call "geth attach" on --testnet better than writing full path?

texts:
I want to connect to my running geth --testnet.

If I run geth --testnet attach, just like geth attach I get :

Fatal: Unable to attach to remote geth: dial unix /user/.ethereum/geth.ipc: connect: no such file or directory

Which is normal, because geth.ipc is not in .ethereum but in .ethereum/testnet.

Is there a way to use an option to make geth look for geth.ipc in the right folder when I'm using the testnet ?

It can be a little heavy to write full ipc path every time (Right now I use geth attach ipc:/path/to/ipc and often start it by hand).

Edit:
I found an open issue on github that suggests there is no way to use options with attach yet. I'm now only asking for ways to do it faster than writing full path.


texts: Different compiler versions in OpenZepplinn ERC721 folder

texts:
We have created a contract by inheriting ERC721Burnable, Ownable contract from openzepplin.
The compiler version we are using in our smart contract is 0.6.0. I flattened the smart-contract by using truffle-flattener into one single .sol file, but i am getting an error while i am trying to analyze our smart contract through Mythx
Error: Error compiling source with solc v0.6.0: contracts/flattened.sol:60:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.6.2;
^---------------------^

        > command: `/home/graphicaldot/.solcx/solc-v0.6.0 --allow-paths /home/graphicaldot/Programs/python_programs/dgm-contracts-security-audit-env/dgm-contracts-security-audit --standard-json`
        > return code: `0`
        > stderr:
        {"errors":[{"component":"general","formattedMessage":"contracts/flattened.sol:60:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version\npragma solidity ^0.6.2;\n^---------------------^\n","message":"Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version","severity":"error","sourceLocation":{"end":1971,"file":"contracts/flattened.sol","start":1948},"type":"ParserError"}],"sources":{}}

When I looked at the Openzepplin code, different smart contracts in the ERC721 folder of openzepplin master branch, have two different -0.6.0 and 0.6.2 - solidity versions.
My question is, how to solve this issue without changing the solidity version in the flattened smart contract ?


texts:
I want to secure data for my NodeJs+Express+Mongodb website :

ABI
Contract address
Infura.io API key

Those data are very important because if an attacker can change them, it can steal ETH from my user.
Is there a way to run NodeJs with ABI+Contract address encrypted, and decrypt them with a passphrase ?
Or can I store a file with this 2 data that need root access to be modified ?


texts:
Well i am new trying to mine and i did the "C:>geth --rpc" and its still going how will i know when its done? i did all the steps leading to this but my pc just keeps running the

INFO [05-18|23:32:54] Imported new block receipts              count=36   elapsed=56.012ms   number=3277546 hash=01c020…980ee0 ignored=0
INFO [05-18|23:32:56] Imported new state entries               count=41   elapsed=1.918s     processed=8876747 pending=36176

Just keeps going on, How to tell if geth is done syncing?


texts: Will homestead increase Ether's issuance rate?

texts:
This question is really simple, I was wondering if when homestead arrives Ether's issuance rate will increase as it was originally planed, because quoting Ethereum's blog post "Ethereum Launch Process"

  Homestead is where we move after Frontier. We expect the following three major changes. Ether mining will be at 100% rather than 10% of the usual reward rate