texts:
I wish to automate the transfer of ether to a list of people. Assume the list is in a csv. I wrote some code to automate the process.

class Program
{
    int nonce = 0;
    static void Main(string[] args)
    {
        var account = SetupAccount();
        var recipients = ReadCsv();
        var web3Init = GetConnection();
        nonce = web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(account.Address).Result;
        //var recipients = new List<Records>() { new Records() { Value = 10000000000000000, Address = "0x5CC494843e3f4AC175A5e730c300b011FAbF2cEa" } };
        foreach (var recipient in recipients)
        {
            try
            {
                var web3 = GetConnection();
                var receipt = SendEther(account, recipient, web3).Result;
            }
            catch (System.Exception)
            {
                MessageBox.Show("Failed");
            }
            Thread.Sleep(30000);
        }
    }

    private static async Task<TransactionReceipt> SendEther(Account account, Records recipient, Web3 web3)
    {
        var transactionPolling = web3.TransactionManager.TransactionReceiptService;

        //var currentBalance = await web3.Eth.GetBalance.SendRequestAsync(account.Address);

        //assumed client is mining already
        //when sending a transaction using an Account, a raw transaction is signed and send using the private key
        return await transactionPolling.SendRequestAndWaitForReceiptAsync(() =>
        {
            var transactionInput = new TransactionInput
            {
                From = account.Address,
                //Gas = new HexBigInteger(25000),
                GasPrice = new HexBigInteger(10 ^ 10),
                To = recipient.Address,
                Value = new HexBigInteger(new BigInteger(recipient.Value)),
                Nonce = nonce
            };
            var txSigned = new Nethereum.Signer.TransactionSigner();
            var signedTx = txSigned.SignTransaction(account.PrivateKey, transactionInput.To, transactionInput.Value, transactionInput.Nonce);
            var transaction = new Nethereum.RPC.Eth.Transactions.EthSendRawTransaction(web3.Client);
            nonce++;
            return transaction.SendRequestAsync(signedTx);
        });
    }

    private static Web3 GetConnection()
    {
        return new Web3("https://mainnet.infura.io");
    }

    private static Account SetupAccount()
    {
        var password = "@Password";
        var accountFilePath = @"filePath";
        return Account.LoadFromKeyStoreFile(accountFilePath, password);
    }

    private static List<Records> ReadCsv()
    {
        string filePath = @"C:\Users\Potti\source\repos\ConversionFiles\XrcfRecipients.csv";
        if (File.Exists(filePath))
        {
            using (StreamReader stream = new StreamReader(filePath))
            {
                CsvReader reader = new CsvReader(stream, new Configuration
                {
                    TrimOptions = TrimOptions.Trim,
                    HasHeaderRecord = true,
                    HeaderValidated = null
                });
                reader.Configuration.RegisterClassMap<RecordMapper>();

                return reader.GetRecords<Records>().ToList();
            }
        }
        else
        {
            return null;
        }
    }
}

class Records
{
    public string Address { get; set; }

    public decimal Value { get; set; }
}

sealed class RecordMapper : ClassMap<Records>
{
    public RecordMapper()
    {
        Map(x => x.Address).Name("Address");
        Map(x => x.Value).Name("Value");
    }
}

How do i modify the process to execute all the transactions at once instead of waiting for each to complete? (Fire and forget) Also, are there any security considerations of doing this?


texts: No response in fetching ETH to USD current rate?

texts:
I'm trying to fetch the current ethereum to usd rate from following link: https://api.infura.io/v1/ticker/ethusd

This is my code snippet

pragma solidity ^0.4.11;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract ExampleContract is usingOraclize {
string public ETHUSD;
event LogConstructorInitiated(string nextStep);
event LogPriceUpdated(string price);
event LogNewOraclizeQuery(string description);

function ExampleContract() payable {
    LogConstructorInitiated("Constructor was initiated. Call 'updatePrice()' to send the Oraclize Query.");
}

function __callback(bytes32 myid, string result) {
    if (msg.sender != oraclize_cbAddress()) revert();
    ETHUSD = result;
    LogPriceUpdated(result);
}

function updatePrice() payable {
    if (oraclize_getPrice("URL") > this.balance) {
        LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
    } else {
        LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
        oraclize_query("URL", "json(https://api.infura.io/v1/ticker/ethusd).bid");
    }
}

}

but when I press updatePrice(), the transaction goes successful but no value is captured in ETHUSD variable. Any idea, what I'm doing wrong? I tried using this url and it works fine (for EUR,GBP) "json(http://api.fixer.io/latest?symbols=USD,GBP).rates.GBP"


texts: How can I trigger a PHP script when a transaction is received?

texts:
My goal is to have a PHP script be invoked whenever a transaction is received by a given address.

I know Javascript but this is my first sally into Node.js. I think the right approach is to run a node.js webserver in parallel to Apache, and for that to be running a script which uses web3.eth.filter to trigger a javascript which makes a HTTP request to Apache.

Is that right? If so, I don't know how to use web3.eth.filter, the documentation isn't great.

Some hints, please?


texts: Best practices with ERC20 forwarding and kill switches

texts:
Background
I have a system with 2 smart contracts; EventSender and Forwarder ("E" and "F" respectively).
E takes a construction parameter of type address payable and sets that to storage coldAddress. I also plan on adding an irreversible killswitch on E. This will set coldAddress to address(0) and cause all methods (including the forwarding/event emitter) to revert().
F takes the same type, but sets it as an instance of EventSender
So my deploy step is:

I have a cold wallet (Ledger etc) X
I deploy E with constructor param X
I deploy multiple (one per user) F with construction param of contract address of the one instance of E from step 2.

When ETH is sent to an instance of F, it forwards to E in step 2, E then emits a Deposit event and forwards to X. This way we can query the events of E to get all deposits.
I am looking to add a method for gathering ERC20 tokens (in the future we may add support, but don't wish to change the deposit address for everyone every time we re-deploy)
If a user sends ERC20 to their deposit address (F contract). I understand I can catch that by searching the Transfer events of the contract address of the token...
Questions

Is there a best practice around when / how to get the actual tokens from the F instance to my X cold address?
This would mean deposit address for ETH and any ERC20 token we have would be the same. Is there a reason why this would be bad?
The killswitch will not prevent people from depositing ERC20 to F. Should we just tell our users to stop depositing, and if they deposit, tough luck?
If I restrict the killswitch with coldAddress, and also add a method for coldAddress to change the coldAddress, we might lose the ability to kill the system... should the kill switch address be unchangeable? Or should we use a password parameter (which we'd only use once (since it can only be killed once) and can only be used to kill our system) with sha256/keccak256 comparison?

Possible Solutions I've come up with

Add a method to F that will take a token contract address as a parameter, wrap it in an ERC20 interface abstraction, check the balance, and if any, send all of it to the coldAddress attribute on the E contract stored in the F instance. This method could be callable by anyone, as the send-to address can only be E.coldAddress and if some rando wants to pay my fees then more power to them. (Is this assumption wrong/insecure?)... Then have my ERC20 deposit watcher (that watched the ERC20 events) also have some ETH on it to run this method after every time I see a deposit.

This seems like a waste of fees, especially if the same user is constantly depositing the same token. For those users it might be worth it to "batch" the retrievals to a time interval instead.
However, one goal I have is to minimize the time that any assets are sitting on any of these contract addresses, just in case.
If E.coldAddress is address(0), that means the system has been killed and ETH forwarding is blocked... but I can't block/revert an ERC20 transfer... perhaps leaving coldAddress as-is and adding isDead bool instead would allow us to continue sending ERC20... but a killswitch situation probably == our cold wallet was compromised...

Thanks for your time


texts:
I have the following ethereum node running as :

sudo geth --rpc --rpcaddr "127.0.0.1" --rpcport "8000" --rpccorsdomain "*" --datadir "/home/Ethereum/Data/node1" --port "30303" --maxpeers 2 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3,solc" --rpcapi "db,eth,net,web3,personal" --networkid 1900 --nat "any" --unlock "0" --nodiscover console init ~/Ethereum/Data/node1/customgenesis.json

I have installed web3 to connect to this node from nodejs as the following :

var Web3 = require('web3');
var web3 =Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8000'));
console.log(web3.version.api);

but, I am getting this error

  TypeError: Cannot read property 'version' of undefined

Any idea why this happens?


texts: transaction failed - out of gas (How can i return my ethereum and cancel Transaction)

texts:
How can i return my ether and cancel this transaction.??
and Ethereum will be return back fund Cryptopia right..??
Transaction link: 0x0991adfb4e316c920f32365b8949e46ae741c055547257e848c6fe92aa308757

thank you.


texts: Non ERC 20 coin sent by mistake to MyEtherWallet (MEW)

texts:
Newbie here - apologies for anything inappropriate and lack of tech expertise.
I made a dumb mistake and sent some THETA tokens to a MEW Ether address. My bad - I had not realised that THETA had moved over to it's own blockchain. The transaction did not go through on Ethereum (I checked on Etherscan) but the tokens somehow ended up in a THETA wallet which got created, with exactly the same public address as the MEW wallet. I can see this at wallet.thetatoken.org
I have been told that I can use my MEW private hex key to access the THETA wallet as they are based on the same SHA 3 hashing. The problem is that I do not have a MEW hex key, just my 24 word seed phrase. There is an "Unlock Your Wallet" option in the THETA wallet, but it seems to only accept a 12 word seed phrase or the hex key itself.
Question: Is there a way I can generate the MEW hex key from my 24 word seed phrase - there was a Reddit post for accessing this via the MEW site, but MEW seemed to have changed the way they do things and no longer provide access to the hex key? Or else is there any other way I could access the THETA wallet using my MEW 24 seed phrase?
Thank you in advance for any guidance.


texts: How to get the block number which is the closest to a given timestamp?

texts:
Is there any method(ology) in web3 which allows to get the block number at a given date?

In particular, I have two dates as an input and I want to effectively get all events between those two dates. I know that I can do this by having block numbers:

contract.Event({}, { fromBlock: 100000, toBlock: 121212 })

But is it possible to do so with Dates? Thanks!


texts: How to check Boolean variable is true in modifier?

texts:
I want to check that the Boolean variable "active" in the Account struck is true, for a modifier requirement.

Any logic on how to do this would be fantastic.

struct Account {
    address id;
    string company;
    string country;
    string industry;
    bool active;
}

mapping (address => Account) public Accounts;

modifier validAccount(address _accountId) {
    require (Account(msg.sender.active = true))
    _;
}


texts: my smart contract is not responding and error saying web3 is not defined

texts:
<script>
var myContract;
async function CheckMetamaskConnection() {
    // Modern dapp browsers...
    if (window.ethereum) {
        window.web3 = new Web3(window.ethereum);
        try {
            // Request account access if needed
            await ethereum.enable();
            // Acccounts now exposed
            return true;
        } catch (error) {
            // User denied account access...
            return false;
        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider);
        // Acccounts always exposed

        return true;
    }
    // Non-dapp browsers...
    else {
        console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
        return false;
    }
}

$(document).ready(async function () {
    var IsMetamask = await CheckMetamaskConnection();
    if (IsMetamask) {
        myContract = await web3.eth.contract(SmartContractABI).at(SmartContractAddress);
        getCandidate(1);
        getCandidate(2);

        await myContract.eventVote({
            fromBlock:0
        }, function(err, event){
            console.log("event :", event);
            getCandidate(event.args._candidateid.toNumber());
        });
        console.log("myContract :", myContract);
        console.log("Metamask detected!")
    } else {
        console.log("Metamask not detected");
        Swal.fire({
          icon: 'error',
          title: 'Oops...',
          text: 'Metamask not detected!',
          onClose() {
            location.reload();
          }
        });
    }
});

async function getCandidate(cad){
    await myContract.candidates(cad, function(err, result){
        if (!err) {
            console.log("result : ", result);
            document.getElementById("cad" + cad).innerHTML = result[1];
            document.getElementById("cad"+cad+'count').innerHTML = result[2].toNumber();
        }
    });
}

async function Vote(cad){
    await myContract.vote(cad, function(err, result){
        if(!err){
            console.log("We are winning!");
        } else{
            console.log("Can not connect to the smart contract");
        }
    })
}

i have node.js and metamask in my system(windows 10)
i cloned you project from github and runned it by following command
1.npm install
2.node index.js
the UI deployed perfectly in localhost:3000 but when i try to vote the transaction is not working!!!
then i saw content on smart contract is not rendering!!!
then i checked metamask , which was connected and have 1 ether on ropsten network!!!
then i try ganache (local blockchain provider) and still the transaction is not working!!!
then i paste the smart contract in remix and get the ABI and smart contract address and still not working!!!
then i goto developer tool of browser and saw below error!!!!...i have no idea of this error!!!!...how can i solve this???


texts:
I have created a private network by Geth follow this tutorial on github. Now I want to add “byzantiumBlock：1000” to config block of genesis.json.

Will I get a new network and lose all blocks of my old network after I execute the command geth init path/to/genesis.json ?


texts:
Suppose I have a contract that creates and returns a new contract. Something like:

contract TokenFactory {
  function createToken() returns (Token) {
    return new Token();
  }
}

From my experience, if I call createToken() from another contract, I am not allowed to implicitly convert the returned contract object to type address, which makes me think the Token object is more than just an address.

If I pass this Token object as an argument to another function, will it cost more gas than passing just its address? Also, can the token object be put on the stack or must it be in memory/storage?


texts: Send wei to payable function with web3 async

texts:
I want to send 100wei to a payable function in my deployed contract. But i don't want to sign the transaction because of to much effort to get this going. I just want to submit the transaction with metamask. Therefore i need the correct web3 command to call my 'depositFunds' method and send 100 wei.
Currently i have this command, but i get frankly an error.
myContractInstance.depositFunds().sendTransaction({from: web3.eth.accounts[0], gas: 3000000, value: 100}, function(err, res){});

What do i have to change to get this going?


texts: remote contract function call with solidity

texts:
I've deployed this very simple Contract:
contract Contract1
{
   function myfunction(uint param1) public returns (uint)
   {
       return param1+1;
   }
}

Now, I've deployed a second contract:
interface Contract1Interface
{
    function myfunction(uint) external returns (uint);
}

contract Contract2
{
   event log(string msg);

   Contract1Interface c = Contract1Interface(0x...deploymentadress_of_contract1);
   uint ret;
   bytes public data;

   function test1() public
   {
      // COMPILATION ERROR: try ret=c.myfunction(param) {  } catch {  }
      try c.myfunction(param) {  } catch {  }
   }

   function test2() public
   {
     bool success;
     (success, data) = address(c).call{value: 0 ether}(abi.encodeWithSignature("myfunction(uint)", 5));

     if (success) {
         emit log("ok");
     } else {
         emit log("nok");
     }
   }

   function test3() public
   {
     bool success;
     (success, data) = address(c).call(abi.encodeWithSignature("myfunction(uint)", 6));

     if (success) {
         emit log("ok");
     } else {
         emit log("nok");
     }
   }

I have 4 questions:

Is it a good practice to declare Contract1Interface this way ? We can imagine a situation where Contract2's developper do not have Contract1 source code. This developper only knows the functions signature (interface). Or is there a best way to do that ?
in test1 function, i cannot fetch returned value for myfunction. If i add ret=, i get a compilation error.
in test2 and test3 functions, success is equal to false. I do not understand why the call fails
In test2 and test3 functions, how can i "decode" data variable to uint ?

Thanks a lot


texts: geth fast sync is not really fast on Mac

texts:
I'm on MacOS Seirra with Geth 1.6.0-stable. Last few days, tried doing fast sync using the following command.

  $geth --syncmode fast --cache 4096

Every time, the sync process hangs with no active peers or ran for almost over night to find less than 10% of the blocks synced. BTW, I ran "syncmode fast" from scratch by clearing chaincode folder everytime.

I'm not on a lightning speed broadband line. even guess 14mbps should be better. My mac also can take more hammering with these specs. 2.93GHz i7 / 16GB RAM / 7500rpm

TIA


texts: How to implement multi-sig that allows only specific signer to pay gas

texts:
In case of simple multi-sig structure, I found that each signer have to pay gas to be executed.
However, is there any references that allows only specific signer to pay gas? Any advice would be appreciated!
Thank you.


texts: Change a pending transaction's "Gas Limit" & "GWEI"

texts:
a noob question here!
I'm using Metamask, I've sent a transaction to another wallet. I would like to increase the Gas Limit and reduce the gas price. Is this possible? If so, how?
Thanks!


texts: Getting an error while trying to store large payloads (13-20kB)

texts:
I've created a simple smart contract to store large amounts of data (13-20kB) on the Ethereum blockchain. But when I'm trying to make a transaction they fail sometimes (with little correlation to the amount of data) with a "Warning! Error encountered during contract execution [Out of gas]" error

The gas limit is 3000000 and there is no clear data threshold that causes the transaction to fail. Two transactions with the same content can behave differently (one gives an error while the other doesn't).

Here's the code that I'm using to store the data:

contract SimpleStorage {
    mapping(address => string) public Usersdata;
    function Storedata(string data) public {
        Usersdata[msg.sender] = data;
    }

    function getData() public view returns (string) {
        return Usersdata[msg.sender];
    }
}


texts:
A blog post says this about block proposals in Casper:

A NXT-style random number generator is used to determine who can generate a block at each height; essentially, this involves taking missing block proposers as a source of entropy.
…
Making blocks is a process that takes place independently from everything else: validators gather transactions, and when it comes time for them to make a block, they produce one, sign it and send it out to the network.*

How many of the (up to 256) validators have the right to make a block proposal at a given height?
If my understanding is correct, during block proposal, there may be parallel competing blocks at the current height because the consensus-by-bet process has not entirely converged yet. Can a validator place his block proposal on top of any of these top level blocks? While doing so, could he choose one or several of the remaining top level blocks as uncle(s)?


texts: How to build a web interface that allows users to carry out transactions on a private blockchain?

texts:
I'm just getting started with Ethereum. To understand the platform better, I intend to build a web interface for a voting contract.

User should be able to make authenticated transactions to vote on a private blockchain. What is best way to achieve this?

Background: I have looked at truffle as an option, but I could not find a way to carry out an authenticated transaction using the web interface.

Update: From what I understand, an Ethereum wallet can unlock an account (accept a passphrase to decrypt the private key) and send transactions on behalf of the unlocked account (sign transactions with the private key). I'm looking for a way for users to be able to send transactions to the blockchain using a web interface. I believe this possible with truffle, but not sure how.


texts:
I'm trying to find the details of the coming PoW to PoS transition, but all I could find were generic explanations why it was so good. Can somebody point me to a resource or just explain in a few words a couple of details?

In particular, suppose I run a Parity node, and the upgrade happens.

Do I just install the new version of Parity and continue running the same node?
If I run a PoW miner, will it still run after the upgrade? I know about the difficulty bomb, but does it mean PoW will still work, only with less profit?
What happens if I "forget" to upgrade? Will my node be still a part of the blockchain?
Is there a way to "prepare" for the upgrade so that it happened as smoothly as possible?


texts: Error in passing bytes32 data to a smart contract

texts:
I have a User Verification smart contract. I am generating an SHA-256 verification code for the users to be verified. I am accepting the verification code as bytes32 in my smart contract. But when I try to test the function, I always see this error:

Error encoding arguments: SyntaxError: Unexpected token B in JSON at position 48

Here is the function:

function verify(bytes32 verification_code) public {
        if(user_verified[msg.sender] == false &&
            sha256(verification_code)==user_codes[msg.sender]){
                user_verified[msg.sender] = true;
            }
    }

I would appreciate some help.

Thanks!


texts: Multiple Transactions as a single transaction

texts:
I would like to know how to send ether from multiple accounts. For example, suppose I have 3 accounts with 5 ether in each account, how do I send the total (15 ether) to an account in a single transaction? I’m asking because from what I understand the “from” parameter in “sendTransaction” only accepts a single account.

The reason I’m asking this is because I need to accept Ether payments in my system and I would like to generate a unique account for each deposit, but I’m not sure how to spend the Ether I receive without having to send multiple transactions.

I want my users to deposit tokens to my address. Now let us say 10 users send 1 token each. There would be 10 corresponding addresses.
Now how do I implement this such that my main address always show the total sum amount (10 tokens, in this case) and whenever I try to withdraw that amount, the transaction is actually happening on 10 different addresses , but how do I post it as a single transaction ?

Can it be possibly done using HD Wallets ?
How does coinbase internally handle the spending from multiple transactions as a single transaction ?


texts: How to pass argument to Chainlink selector?

texts:
I have a mapping with integer keys and struct values.
mapping (int => Client) public customers;

Each customer has its own proof argument which I am trying to update with a Chainlink API call.
Here is my struct.
struct Client {
    int id,
    bool proof;
}

Here is how I request API get call
   function checkProof(string memory JobLocation, bytes32 JOBID) public {

      Chainlink.Request memory req = buildChainlinkRequest(JOBID, address(this), this.fulfill.selector);

      req.add("get",JobLocation);

      req.add("path", "proof");

      sendChainlinkRequestTo(ORACLE_ADDRESS, req, ORACLE_PAYMENT);
}

And this function triggers the following function
     function fulfill(bytes32 _requestId, bool _isProofCorrect, unit val) public recordChainlinkFulfillment(_requestId){
            customers[1].proof = _isProofCorrect;
}

How can I update the proof argument of my Construct by using customer ID. For example:
customers[<customer_id>].proof = _isProofCorrect;


texts: Token allowance and locking compromised address

texts:
So i heard about token allowance checker https://tac.dappstar.io/. It allows you set allowance for tokens.
Is there a possible way to set the allowance so that your account wouldnt receive ethereum, or maybe like a time lock feature? Say ones account was compromised, could you stall it (lock it) so the unwanted party couldnt use said account?
Im completely green when it come to smart contracts.... could i write something like this for my account?


texts: How to code ADDRESS using opcodes in a solidity function?

texts:
Reference - http://solidity.readthedocs.io/en/develop/assembly.html

Objective - example of a function returning the contract address.

Code -

pragma solidity ^0.4.18;

contract d4{
    function showAddress() view public returns (address addr_v) {
        assembly {
            addr_v := mload(0x30)
        }
    }
}

This compiled but just returns 0.

I used this link for the opcodes - https://github.com/ethereum/pyethereum/blob/develop/ethereum/opcodes.py

Has anyone a code sample of using opcodes to determine the contract address?


texts:
Is there any specific software/hardware requirement for being a:
1- Miner
2- Node
on a public network or any system configuration will work? Are there any recommendations? What specification most miners use ?


texts: How to run multiple commands in single line in geth console?

texts:
Can I run multiple commands at once in geth's JavaScript console?

Can I do something like > api1.command1() && api2.command2("arg2") && api1.command3()?


texts: Parsing transaction receipts in Solidity similar to eth_getTransactionReceipt code

texts: I would like to have the functionality in my Solidity contract that when a user sends a transaction with a transaction hash, the contract parses it to get information of the timestamp etc. The best way I can think of doing this is using a method similar to eth_getTransactionReceipt. But I can't seem to find the code for that on Github. Could someone please point me to where this is implemented? (Any other solution to achieve the functionality I want it welcome too :) )


texts: not able to mine contract. geth shuts down automatically

texts:
i'm using the known crowdfunding and token contracts from ethereum.org only slightly modified

contract Token{
    function Token(tokenName,tokenValue,totalSupply){
      //assign these parameter values to contract variable by the same name;
    }
    function transfer(address to,uint amount){
       //perform transfer operation
    }
  }
contract crowdfunding{
   Token token;
    function crowdfunding(address tokenAddr){
    token = Token(tokenAddr)
    }
    function contribute(){
    token.transfer(msg.sender,amount);
    // transfer function of Token contract is called
    }
}

the 2 contracts deploy just fine. when i want to execute contribute function the following thing happens

i get this error everytime i try to mine :

panic: ethash_full_new IO or memory error.
goroutine 128 [running]:
panic(0xcfae80, 0xc083c00670)
    C:/Go/src/runtime/panic.go:481 +0x3f4
github.com/ethereum/ethash.(*dag).generate.func1()
    D:/builds/geth_win32/build-go-win-master/build/Godeps/_workspace/src/git

and so on

what should i do?

i was getting this error therefore i deleted the chaindata and started afresh and yet the error persists.


texts:
I am looking for a way to sign a transaction manually by having the necessary input without using any libraries. I haven't found how the signing process exactly works anywhere hence why I am asking here. I do not want to use a library because I want to attempt and sign a raw transaction within Solidity without gas constraints.

EDIT: To clarify, I am not looking to broadcast the transaction to the network. I am simply aiming to return the signed message to the caller.


texts:
I've been trying different kinds of mining.
I've tried to mine on windows using Claymore which, as I understand, uses a mining pool. After running for 1 hour, I can go to https://ethermine.org/miners/<my_adress> and see that I have a very very small "unpaid balance" and that the graphs are showing some output.

I've also mined on AWS following this tutorial using a more powerfull g3 instance. I presume Im minuing because I see output like this:

miner  22:54:10.327|ethminer  Mining on PoWhash #fd6bf22e… : 10689366 H/s = 5505024 hashes / 0.515 s
miner  22:54:10.849|ethminer  Mining on PoWhash #fd6bf22e… : 11069420 H/s = 5767168 hashes / 0.521 s
miner  22:54:11.370|ethminer  Mining on PoWhash #fd6bf22e… : 10566264 H/s = 5505024 hashes / 0.521 s
miner  22:54:11.885|ethminer  Mining on PoWhash #fd6bf22e… : 11198384 H/s = 5767168 hashes / 0.515 s
miner  22:54:12.396|ethminer  Mining on PoWhash #fd6bf22e… : 10794164 H/s = 5505024 hashes / 0.51 s
miner  22:54:12.925|ethminer  Mining on PoWhash #fd6bf22e… : 10902018 H/s = 5767168 hashes / 0.529 s

After 4 hours running, if I go to https://ethermine.org/miners/<my_adress> (its a different account than the one I using on windows), I dont see anything - no ether, no graphs.

My guess is that, on windows I joined a mining pool so Im getting very little reward for very litlle work and on AWS Im doing solo mining and wasnt able to mine anything yet. However, IM affraid that there may be something wrong on my AWS config and the ETH is not going to my account.

Does anyone know what's the case?
Thanks


texts:
I am trying to understand how to calculate the Earnings over a year for an ASIC Miner.

As an example I picked the Innosilicon A9 ZMaster. It has the following specifications:

These specifications where taken from Cryptocompare - Innosilicon A9 ZMaster.

I tried to calculate the ASICs miners ROI like the following:

Find below the spreadsheet where my calculations are laid out in detail:

ASIC Miner ROI Calculations

Compared to the Return per year that is calculated on coincompare my calculations are not as near there:

Any suggestions what I am doing wrong?

I highly appreciate your replies!


texts: Error sending transaction to the First Blood crowd sale contract

texts:
I have sent ether to First Blood crowd sale but have an error message:

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

I don't know what to do, please advice me.


texts: ReferenceError while running the truffle test

texts:
I am getting the ReferenceError while executing truffle test, I got it from a book:
//Greeter.sol
pragma  solidity >=0.4.0 <0.7.0;
contract Greeter{
   function greet() external pure returns(string memory){
      return "hello World";
   }
}

The test file is:
//greeter_test.js
describe("greet()", ()=>{
    it ("returns 'Hello World'",async()=>{
        const greeter = await GreeterContract.deployed();
        const expected = "Hello, World";
                const actual = await greeter.greet();
                assert.equal(actual, expected, "greeted with 'Hello, World'");
});
});

The 2_deploy_greeter.js file is:
//2_deploy_greeter.js
const GreeterContract = artifacts.require("Greeter");

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

The output of truffle test is:
$ truffle test
Using network 'test'.

Compiling your contracts...
===========================
> Compiling ./contracts/Greeter.sol
> Artifacts written to /tmp/test--6598-k6XhgnYyAOGZ
> Compiled successfully using:
   - solc: 0.5.16+commit.9c3226ce.Emscripten.clang

  greet()
    1) returns 'Hello World'

  0 passing (3ms)
  1 failing

  1) greet()
       returns 'Hello World':
     ReferenceError: GreeterContract is not defined
      at Context.it (test/greeter_test.js:3:19)

Somebody please guide me.
Zulfi.


texts: Are there any tutorials on how to use MS Visual Studio Code to write contracts in solidity?


texts:
In the paper describing Algorand,two reasons are given to use verifiable random functions/cryptographic Sortion:

  Sortition provides two important properties: First, given a random seed, the VRF outputs a pseudo random hash value, which is essentially uniformly distributed between $0$ and $2^{hashlen}-1$. [..] Second, an adversary that does not know $sk_i$ cannot guess how many times user $i$ is chosen, or if $i$ was chosen at all.

Why is the the second property important? What would be the attack scenario if adversaries could predict when user $i$ is chosen?


texts: what is the significance of geth node output?

texts:
Having recently fired up a node on the Ropsten testnet, I'm now in the position of staring at a wall of text cascading down my terminal, wondering what it all means. It looks something like this:

INFO [07-20|14:57:05] Imported new state entries  count=294 elapsed=13.828ms  processed=2898677 pending=59340
INFO [07-20|14:57:05] Imported new state entries  count=2   elapsed=1.387ms   processed=2898383 pending=59341
INFO [07-20|14:57:05] Imported new state entries  count=384 elapsed=20.456ms  processed=2899061 pending=59070
INFO [07-20|14:57:05] Imported new state entries  count=1   elapsed=861.854µs processed=2899062 pending=59069
INFO [07-20|14:57:05] Imported new state entries  count=1   elapsed=359.876µs processed=2899063 pending=59068
INFO [07-20|14:57:05] Imported new state entries  count=381 elapsed=11.559ms  processed=2899444 pending=58682
INFO [07-20|14:57:05] Imported new state entries  count=294 elapsed=10.836ms  processed=2899738 pending=58484
INFO [07-20|14:57:06] Imported new state entries  count=384 elapsed=45.579ms  processed=2900122 pending=59147
INFO [07-20|14:57:06] Imported new state entries  count=2   elapsed=1.187ms   processed=2900124 pending=59148
INFO [07-20|14:57:06] Imported new state entries  count=1   elapsed=191.576µs processed=2900125 pending=59146
INFO [07-20|14:57:06] Imported new state entries  count=384 elapsed=42.033ms  processed=2900509 pending=58912
INFO [07-20|14:57:06] Imported new state entries  count=1   elapsed=68.124ms  processed=2900510 pending=61886
INFO [07-20|14:57:06] Imported new state entries  count=293 elapsed=68.122ms  processed=2900803 pending=61886
INFO [07-20|14:57:06] Imported new state entries  count=384 elapsed=140.779ms processed=2901187 pending=61886
INFO [07-20|14:57:06] Imported new state entries  count=1   elapsed=253.884µs processed=2901188 pending=61889
INFO [07-20|14:57:07] Imported new state entries  count=384 elapsed=60.445ms  processed=2901572 pending=63181
INFO [07-20|14:57:07] Imported new state entries  count=375 elapsed=94.367ms  processed=2901947 pending=65289

For these entries we have (not in this order):

1, 1, 1, 1, 1,

2, 2,

293,

294, 294,

381,

384, 384, 384, 384, 384,

375

and as the node runs I keep seeing the same numbers coming up far more often than randomness would dictate, why for instance does 384 come up so frequently? What is the significance of count anyway?

While we're on the subject, what is Imported new state entries and how does it relate to Imported new block receipts?

  My naive hypothesis is that Imported new state entries means we just heard about a new transaction and Imported new block receipts means we now have a new highest block.

As far as elapsed is concerned, perhaps it's the time that has elapsed since the last block? It seems to be smaller when count is smaller and get bigger as count increases.

Since processed and pending both seems to be monotonically increasing- perhaps they're also related to block height?


texts: web3.eth.sendTransaction sends different messages on failure

texts:
I am using web3.js to interact with my contract. Now, I am using eth.sendTransaction, I am trying to send funds more than sender account posses. But, I am getting different error messages for the different sender and recipient addresses.
Code I am using:

web3.eth.sendTransaction({to:to, from: from, value:web3.toWei(amount,"ether")}, function(err1, resp1){
    if(err1){
        console.log(err1);
    }
    else{
        console.log(resp1);
    }
});

When I following params for sendTransaction:

to: "0x1f76f3dafecf68f316338a169ecd59d695a4b062"
from: "0x62720366ef403c9891e2bfbd5358ee3c8a57b113"
amount: 1099807516000000000000000
password: xxxxxxxx

I get error message stating:
    Error: Insufficient funds for gas * price + value

And When I change to/ from address as:

to: "0x54cfe4ee4ddd537a93ae8f8ff7d4d7f10c70a666"
from: "0x8cc99128e51217f91d5fdfe7182b2b2da218232e"
amount: 1099807516000000000000000
password: xxxxxxxx

The error message changes to:
Error: Account does not exist or account balance too low

I am quite amazed since the addresses are absolutely valid. I can see all the address on using eth.accounts. Can anyone explain why the error message changes? How can I be sure that the error caused due to low balance?


texts: Can't complete synchronize the blockchain

texts:
I've tried to perform removedb, I've tried to go to different internets (my house, Starbucks), but I still get the same errors:

INFO [06-09|20:10:17] Imported new block receipts              count=270  elapsed=46.835ms  number=368363 hash=d1482f…4868f9 ignored=0
INFO [06-09|20:10:18] Imported new state entries               count=381  elapsed=8.806ms   processed=69721 pending=149865
INFO [06-09|20:10:19] Imported new block receipts              count=1125 elapsed=208.087ms number=369488 hash=87e462…fc945b ignored=0
WARN [06-09|20:10:23] Rolled back headers                      count=2048 header=389432->387384 fast=369488->369488 block=0->0
WARN [06-09|20:10:23] Synchronisation failed, dropping peer    peer=6171bb158d288cfa err="retrieved hash chain is invalid"

I've also gotten the annoying lied about chain head error.

What can I do? Recently another user has gotten errors too - how can I fix this?


texts: What advantages and disadvantages does Ethereum have over Bitcoin? What can you do with Ethereum that you simply cannot with Bitcoin? What price do you pay for these additional functionalities?


texts:
For mining purposes one needs to generate a seed. I read some articles but still did not understand where this seed comes from. How is calculated, or what it is about? I found this on Ethereum wiki github:

def get_seedhash(block):
 s = '\x00' * 32
 for i in range(block.number // EPOCH_LENGTH):
     s = serialize_hash(sha3_256(s))
 return s

Can anyone explain this code to me please ?


texts: Is it possible for an attacker to exploit contracts that rely on incoming "msg.value"?

texts:
I am developing an eth2.0 fuzzer for my masters that has produced some interesting crashes - if these crashes are legitimate I believe I may have found a new vulnerability - otherwise, I still have a lot of work to do...
My question is - Is it possible for an attacker to exploit the msg.value field (or any message data fields)? Particularly I am interested if this is possible to achieve in memory.
I have identified a contract that relies on the incoming msg.value and am wondering if an attacker could send say 0 ETH to the external function of the vulnerable contract... while somehow altering the value of msg.value (to say 100 ETH) in the receiving contract's memory?
Example:
Vulnerable Contract:
contract Vulnerable {
  function transferOut(address sendTo) {
    sendTo.send(msg.value);
  }
}

Attacker contract:
contract Attack {
  function exploit(address vulnerableAddress) {
    call.transferOut(<attacker address>) {
      <somehow send 0 ETH, but set the recieving ETH in memory to 100 ETH>
    }
  }
}


texts: Permit pair on Uniswap for gasless swap on web3py

texts:
I've already successfully swapped tokens on uniswap using web3py so now i'm trying to use the permit function to approve my USDC via a signature, saving on gas fees for this approval state.
I've looked at the USDC/ETH pair contract from uniswap on etherscan at https://etherscan.io/token/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc#writeContract and found the permit function, I have to provide several parameters such as:
function permit(
address owner,
address spender,
uint value,
uint deadline,
uint8 v,
bytes32 r,
bytes32 s)
external;

I can do the 4 first (until deadline) and have already seen these 3 letters (v,r,s) while signing my raw tx when doing a swap on web3py, but I'm stuck on how to integrate these letters values returned as you normally get them afterwards and not before signing the tx (hope to make sense here, correct me if I'm wrong of course).
coding part:
usdcpermit = router.functions.permit(myethaddress, myethaddress, USDCvalue, deadline, v, r, s)


texts: Truffle test + Oraclize. Invalid Jump on the second call

texts:
I'm currently developping an Ethereum dApp using Truffle, Test-RPC, Oraclize and ethereum-bridge. So at the moment everything is local.

My issue: I notice that when I run more than one test calling a function with an Oraclize call, only the first call works. The other ones produce this error:

  Error: VM Exception while processing transaction: invalid JUMP at

I simplified my code to make it easier to understand:

Test-RPC

Two accounts unlocked with enough ethers.

testrpc --account="0x406e31ce4d46beaf4f8f4ccd380de8dccb2eef03e64ffd875b4dfe5e52bf6d84,100000000000000000000" --account="0x13277c2990ed19aeb733c58a4692c9f73ced1d8e3ae4ad3a51d90e02591484b7,100000000000000000000" --secure -u 0 -u 1 --hostname localhost --port 8545

Ethereum-Bridge:

Using the second account (no 1).

node bridge -H localhost:8545 -a 1 --dev

Contract:

Simple contract with one call to the dummy API https://jsonplaceholder.typicode.com/posts/1 and the callback stores the json attribute title.

pragma solidity ^0.4.8;

import './OraclizeI.sol';

contract MyContract is usingOraclize  {

    address constant oraclizeOAR = 0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475;
    string title;

    modifier onlyOraclize {
        if (msg.sender != oraclize_cbAddress()) throw;
        _;
    }

    function MyContract() {
        OAR = OraclizeAddrResolverI(oraclizeOAR);
    }

    function callOraclize() {
        oraclize_query("URL", "json(https://jsonplaceholder.typicode.com/posts/1).title");
    }

    function __callback(bytes32 _id, string _result) onlyOraclize {
        title = _result;
    }

    function getTitle() constant returns (string) {
        return title;
    }
}

Test

The test file below contains two identical tests.

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

function sleep (time) {
  return new Promise((resolve) => setTimeout(resolve, time));
}

contract('MyContract', function(accounts) {
    it("TEST 01", function() {
        return MyContract.deployed().then(function(instance) {
            return instance.callOraclize({from: accounts[0]});
        }).then(function(transaction) {
            return sleep(10000);
        }).then(function() {
            return MyContract.deployed();
        }).then(function(instance) {
            return instance.getTitle.call();
        }).then(function(result) {
            console.log("title="+result);
        });
    });

    it("TEST 02", function() {
        return MyContract.deployed().then(function(instance) {
            return instance.callOraclize({from: accounts[0]});
        }).then(function(transaction) {
            return sleep(10000);
        }).then(function() {
            return MyContract.deployed();
        }).then(function(instance) {
            return instance.getTitle.call();
        }).then(function(result) {
            console.log("title="+result);
        });
    });
});

So to conclude, The first one (TEST01) is correctly executed but the second one returns an Invalid Jump exception:

Other Information:

OS: Windows 8
truffle version: 3.1
test-rpc version. 3.0.3
ethereum-bridge: latest from branch master
Oraclize (ethereum-api): latest from branch master
The code is here


texts: How is the volume graph on poloniex calculated?

texts:
So it says volume, but I wondered how the graph was calculated (% change around a moving average?)

Could anyone explain what formula they're using?


texts: Difference between /* and /**? (Commenting contracts)

texts:
In some contracts I saw comments that are made with "/*" and "/**".
For me the only change would be in the IDE like Remix, that the color changes from green (/*) to blue (/**). I until now liked the "/**" more but now got an error and do not understand what the "/**" does. Following code:

/**
 * @event Transfers token
 */
event Transfer(address indexed from, address indexed to, uint256 value);

Gives me

  DocstringParsingError: Doc tag @event not valid for functions.

 but replacing "@event" with "@dev"

/**
 * @dev Transfers token
 */
event Transfer(address indexed from, address indexed to, uint256 value);

Works
 and using @event above almost anything else

/**
 * @event Transfers token
 */
public uint anynumber;

Also works.

So as I understand, in "/**" is more than just commenting. What is that and why does "@event" not work above an Event even it is just a comment?


texts: return function value instead of transaction receipt with web3

texts:
Currently I am getting the transaction receipt instead of return value from a contract function using web3. Is there anyway to get the actual return value from a contract function call using web3

example code

Solidity

pragma solidity ^0.4.22;
contract Testing {
    string name;
    function setName(string name) public returns(string) {
        name =name;
        return name;
    }

    function getName() public returns(string) {
        return name;
    }
}

JavaScript

myContract.methods.setName(Hello).send({
    from: 0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db,
    gas: 470000,
})
.then((receipt) => {
    console.log(receipt)  ==> not getting the result
    }
})


texts:
How can i generate random number in contract?
Like this:

uint8(uint256(keccak256(block.timestamp, block.difficulty))%251);

but we cannot trust miner, this is not 100% random
Or use Oraclize:

oraclize_query("WolframAlpha", "random number between 0 and 100");

If it's correct? Will i get a effective random number? And how much gas usage?


texts: Is there Smart Contract for IOTA distributed ledger technology

texts:
IOTA is a distributed ledger technology based on directed acyclic graph data structure such that there is neither block nor chain.

The question is that is it possible to develop a Smart Contract for this new technology similar to ethereum ? And if so, it's exactly similar to ethereum smart contract?

IOTA web site: https://www.iota.org


texts: Categorising tokens: is there pros and cons of ERC20 described anywhere & comparison with other subcurrency impl?

texts:
Almost everyone seems to be using ERC20, but not everyone is. I wasn't able to find a comprehensible overview of subcurrencies standards/usecases and pros & cons of using ERC20 in your system / resources that compare tokens implemented for different systems.

As far as I understood it is possible to have different divisibility and even affect gas costs for your contract or a system of contracts depending on your subcurrency parameters.

My impression was that the popularity of ERC20 by large explained by adoption - that it makes it easier for 3rd parties to integrate it in the outside of Ethereum contexts.

Can anyone recommend a good read explaining other reasons for ERC20 popularity that helps to wrap one's head around whether it makes sense to use it, spend time and effort on your own implementation or look for other implementations that have been tested to a certain extent.


texts:
what are the optimal geth settings if you just want to listen to some events that are fired by smart contracts?

I'm having a bit trouble to setup geth properly.

Thanks a lot.

PS: That is my current setup:

geth --cache=1024 --syncmode=fast --rpc --rpcapi "eth,web3,personal,net,network,debug,txpool" --ws --wsorigins="*"


texts: Signing and verification of messages using Ethereum key pair

texts:
What are some libs to sign and verify messages using an Ethereum key pair?
I tried Ethersjs but it seems that it only supports signing (not verify). I need to use the lib on a React Native dapp. The verification will be offchain.


texts: Ideal way to store hash on the ethereum blockchain

texts:
I would like to store a certificate on the blockchain. I only need to store its hash and if its been verified by both parties or not.

Should I create a struct that is made up of bytes32 for the hash, and a boolean to see if its confirmed or not. And then create a mapping of this struct. Do I need some sort of ID for the mapping? to map the id with the struct?

The certificate would be aimed for person X and his public key would be known on the frontend. This person will then have to sign with his private key and if its been signed then the boolean value should be set to true.

I will be using a database to store all the data. Upon someone searching for the certificate. The data will be pulled from the database. Hash the data and then confirm that the hash is on the blockchain.

On a side note: If i require permissions for different users, should the permissions be on the blockchain, in the struct I add a variable to store all the public keys that have permission to view this certificate.

This is what I think the frontend would look like:

     hashedData = web3.utils.sha3(JSON.stringify(certificate));
contracts.mycontract.deployed().then(function(result) {
           return result.createCertificate(public_addresskey,hashedData,{ from: account }); //get logged in public key from metamask
         }).then(function(result) {
            //send post request to backend to create db entry

         }).catch(function(err) {
           console.error(err);
           // show error to the user.
         });


texts: How can you connect to a private chain with the Android client library?

texts:
There doesn't seem to be much documentation for the mobile Ethereum libraries yet, at least that I could find.

I know they are still in development, but is there any way to set the Genesis file within the mobile libraries yet? More specifically in the Android library?

(additionally if there is any useful documentation of the mobile libraries a link would be greatly appreciated, as I cant find any!)


texts: How does the DAI keep its peg to a USD dollar?

texts: I learned recently that the DAI uses some kind of smart contract magic to peg itself to the dollar as a stable coin. How is this not centralized as it involves fiat pairs? And what are some of the downsides to this?


texts:
say i have a function that give away dividend based on how many shares that customer owns:

// Give away dividend based on how many balances of each customer has
function giveAwayDividend(uint _value) onlyOwner {
for(uint i=0;i<size();i++){
    //balances[customerAddress[i]] = balances[customerAddress[i]].add(balances[customerAddress[i]]*_value/totalSupply);
    //Transfer(msg.sender, customerAddress[i], (balances[customerAddress[i]] * _value / totalSupply) );
    customerAddress[i].send((balances[customerAddress[i]] * _value) / totalSupply);
   }
}

the problem is, how should I be able to send ether in decimals? If customer A has 100coins, total supply is 50000 coins, dividend total amount is 10 ether, he should get 100/50000 * 10 = 0.02 ether, but here I think (balances[customerAddress[i]] * _value) / totalSupply will give me 0?

How should I fix it?


texts: Give a summary of the fork state changes in block 1920000

texts: The hard fork during block 1920000 contained the execution of an irregular state change. For reference purposes it would be great to have a technical overview of these changes and how they were enforced.


texts:
Truffle not deploy contract updates. truffle migrate compiles it but falsely say network up to date.
OS: Windows
Truffle v5.1.39
npm 6.14.5


texts: How exactly does "importing a wallet" work?

texts:
I think I might import my old wallet using Geth but there's something that's not clear.

I have made a wallet backup a few months ago. However I've earned some ETH after that backup.

If I restore this old backup, will I get the ETH that I've earned after I've made my backup ? Or is a backup more like a system backup where you just get your wallet back the way it was ?

PS : My backup filename starts with "UTC--year-month-day". Is this the right file to import ?


texts: Is it possible to implement Beacon Chain in Solidity within EVM giving the assumption that we may have bigger blocks?


texts: Why does mist throw 'Uncaught invalid address'?

texts:
I'm trying to make a web page that gets a message from a simple "hello world" smart contract. Unfortunately, it isn't working. I'm seeing this in the Mist console.

Uncaught invalid address
v                     @ web3.min.js:2
p                     @ web3.min.js:2
(anonymous function)  @ web3.min.js:2
i.formatInput         @ web3.min.js:2
i.toPayload           @ web3.min.js:2
i.buildCall.e         @ web3.min.js:2
s.sendTransaction     @ web3.min.js:2
s.execute             @ web3.min.js:2
(anonymous function)  @ (index):26

The web page is here and the contract source code is here. I can't figure out what I'm doing wrong.


texts: Is it possible to set up a mechanism in a smart contract that periodically iterates over a list without being triggered by a transaction?

texts: I want my smart contract to offer a refund service. It must periodically check the start date of a reservation stored in a list of strucutures and if it coincides with the current date, a control mechanism starts.Is it possible in solidity?


texts:
After upgrading to geth 1.4.4 I am no longer able to from to reference the compiler from geth.

The solc compiler is installed in /usr/local/bin but this is what I get when I check for available compilers:

> eth.getCompilers();
I0520 10:22:45.501340 common/compiler/solidity.go:114] solc, the solidity compiler commandline interface
Version: 0.3.2-7a51852a/Release-Darwin/appleclang/JIT

path: /usr/local/bin/solc

[]

Then I try to set the compiler  path again:

> admin.setSolc("/usr/local/bin/solc")
I0520 10:25:49.234999 common/compiler/solidity.go:114] solc, the solidity compiler commandline interface
Version: 0.3.2-7a51852a/Release-Darwin/appleclang/JIT

path: /usr/local/bin/solc
"solc, the solidity compiler commandline interface\nVersion: 0.3.2-7a51852a/Release-Darwin/appleclang/JIT\n\npath: /usr/local/bin/solc"

When I check the compilers again I still get:

> eth.getCompilers();
[]

I get the same using:

> web3.eth.getCompilers();
[]

I have reinstalled go-ethereum, npm.

Can anybody give me a hint of what to do or where to look to look.

I had no problems before upgrading to geth 1.4.4

Thanks in advance


texts:
As I read Uniswap front end code, I see that they use contract.interface.getFunction to get the function fragment rather than use contract.methodName to trigger the function of the contract
I don't know what the purpose of using a function fragment or fragment in general in ethers.js is.


texts: How can I tell who has called a function / contract?

texts:
I am very new to Ethereum and don't really understand the problem spec very well, so bear with me.

There is a function named GetVotesCount() in the contract MordorVote which I must limit to only being called by a 'vote master'. How can I determine who is calling a function in the contract?

Also, when I invoke a function in Embark, I get a hex string returned, but not whatever the function returns. How can I find out what a function is returning?


texts: Why can I call contract methods containing a selfdestruct multiple times?

texts:
The following code is part of a Smart Contract I'm working with:

[...]
   function noComplain() allowed(receiver, stage.keyRevealed) public {
        selfdestruct(sender);
    }

    // function complain about wrong hash of file
    function complainAboutRoot(bytes32 _Zm, bytes32[depth] memory _proofZm) allowed(receiver, stage.keyRevealed) public {
        require (vrfy(2 * (n - 1), _Zm, _proofZm));
        require (cryptSmall(2 * (n - 1), _Zm) != fileRoot);
        selfdestruct(receiver);
    }
[...]

As you can see, there are multiple contract methods calling selfdestruct. I would expect that only a single call to e.g. noComplain would be allowed, since the the contract should be destroyed after that (yeah, I know, the code is still there, but the state should be lost etc, right?).

When working with the contract, I discovered that I can call complainAbouRoot after noComplain, also vice versa and even noComplain multiple times without getting an error (tx receipt says "status=1").

How can that be? How can I discover if a smart contract has been destroyed? What is selfdestruct actually good for if it doesn't block further calls?


texts: Is it possible to swap if the TransferFrom ERC20 function is unavailable in the contract?

texts:
I have in my wallet a certain ERC20 token.
However upon further examination I saw that the transferFrom function was a honeypot, meaning that only the owner's funds could be spent this way. Nobody else could.
I want to swap my tokens somehow since the liquidity is really high, but I cannot since the Uniswap uses transferFrom during my sell, which throws an exception.
Is there a way to manually sell, or send to a certain contract in order to successfully perform a swap?


texts: convert from bytes32 to bytes with format "\xFF\xFF\xFF"

texts:
I'm using the ECVerify library and in the test examples in that contract, function ecverify(bytes32 hash, bytes sig, address signer) returns (bool) {} expects bytes sig in the format "\xFF\xFF\xFF...", and it does not seem to work with a bytes sig = "0xFFFFFF..." format.

How do I convert bytes32 sig = 0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200 to bytes sig = "\xac\xa7\xda...?

Update: re: Edmund Edgars comment, in ECVerfiy.sol there are test examples,

function test_v0() returns (bool) {
    bytes32 hash = 0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad;
    bytes memory sig = "\xac\xa7\xda\x99\x7a\xd1\x77\xf0\x40\x24\x0c\xdc\xcf\x69\x05\xb7\x1a\xb1\x6b\x74\x43\x43\x88\xc3\xa7\x2f\x34\xfd\x25\xd6\x43\x93\x46\xb2\xba\xc2\x74\xff\x29\xb4\x8b\x3e\xa6\xe2\xd0\x4c\x13\x36\xea\xce\xaf\xda\x3c\x53\xab\x48\x3f\xc3\xff\x12\xfa\xc3\xeb\xf2\x00";
    return ECVerify.ecverify(hash, sig, 0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a);
}

If I replace bytes sig with "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200" then it fails. It seems to only work with the bytes sig = "\xac\xa7\xda..." format.

I'm using ECVerify for a dApp and will be passing a lot of signatures to it, and it seemed like those need to be in that format, so are there any libraries or something for converting to "\xac\xa7\xda" or how would I send signatures to ECVerify?


texts: Remove trailing zero from web3.toAscii() conversion


texts: web3: TypeError: 'toBytes' is not a function

texts:
The way I install web3: npm install -g web3

The way I connect into web3:

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

if(!web3.isConnected()){
    console.log("not connected");
    process.exit();
}

When I try to run web3.toBytes() function inside a geth-console on using node. I faced with following error:

TypeError: toBytes is not a function

> web3.toBytes(0)
TypeError: 'toBytes' is not a function
    at <anonymous>:1:1

The functions web3 returns;

  BigNumber: function a(e,n),
  createBatch: function(),
  fromAscii: function(str),
  fromDecimal: function(value),
  fromICAP: function(icap),
  fromUtf8: function(str),
  fromWei: function(number, unit),
  isAddress: function(address),
  isChecksumAddress: function(address),
  isConnected: function(),
  padLeft: function(string, chars, sign),
  padRight: function(string, chars, sign),
  reset: function(keepIsSyncing),
  setProvider: function(provider),
  sha3: function(string, options),
  toAscii: function(hex),
  toBigNumber: function(number),
  toChecksumAddress: function(address),
  toDecimal: function(value),
  toHex: function(val),
  toUtf8: function(hex),
  toWei: function(number, unit)

[Q] How could I fix this error?

Thank you for your valuable time and help.


texts: The security problem of tx.origin in Solidity

texts: The book Mastering Ethereum pointed out that it is not safe to use tx.origin in smart contracts. I want to know what is the reason for insecurity?


texts:
I set up a private clique POA chain with 3 nodes, all of them are sealers.

I launch two nodes only, the blocks can be signed by the two nodes.

when I call clique.getSignersAtHash('block hash value'), the result also include the third   signer, It's rather strange because the third node is not working.

How can I get correct signer address of each block?
Thanks.


texts: TypeError: web3.isConnected is not function

texts:
I coded the below program:
var Web3 = require("web3");

var web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'))

console.log(web3.currentProvider);

console.log('Connected?:' + Web3.isConnected());

It shows:

"TypeError: Web3.isConnected is not function"

How to solve the issue?
Thank you very much.
web3 version: 1.3.3


texts: Solidity integer division of different sizes

texts:
I'd like to divide integers of different sizes (uint16 and uint256). Do I need to cast the integers to the same size prior to the divide? Or can I just do the the following safely:

    import "../math/SafeMath.sol";
    using SafeMath for uint256;
    using SafeMath for uint16;

    uint16 public totalValid;
    uint256 public etherValue;

     function _calculatePayout() internal{
        require(this.balance > 0);
        etherValue = this.balance.div(totalValid); // uint256 this.balance
    }

Thoughts appreciated.


texts: How can a smart contract determine the address sending ETH to it?

texts:
I'm learning how to build a smart contract that is able to receive ETH and, if certain conditions are met, send ETH back to the address from which it received it.
My understanding currently is that a smart contract has a wallet address. That means that somebody could hypothetically just type in a smart contract address in Coinbase and send funds that way.
If that is the case, how can the smart contract be programmed to detect which wallet sent it the ETH and execute some action for each such situation? If that isn't the case, please explain to me where I'm wrong.
If that is the case but it is impossible to implement functionality like what I described in the previous paragraph, are there any other solutions you would suggest?
Links to wider tutorials, articles, etc. are much appreciated.


texts: transfer ether from smart contract to my wallet

texts:
Hi I awant to transfer transfer ether from smart to my wallet so I ceated a sendEther function in the smart contract

    function sendEther() public {
msg.sender.transfer(1 ether);
}

very basic function and when I try to call it from app.js

   App.contracts.MyContract.deployed().then(function(instance) {
   return instance.sendEther();
 })

I got this

I don't understand why it's from the account to the smart contract
why msg.value is 0


texts: Is there a way to access Parity UI running on AWS?

texts:
I am trying to run Parity UI on Amazon EC2 instance to be accessible on external IPv4 address, but failing miserably with this attempt. I think I tried all the startup options it provides but couldn't make it work:

./parity --jsonrpc-interface all --signer-interface 0.0.0.0 --signer-no-validation --dapps-interface 0.0.0.0 --dapps-hosts all --chain parity-spec.json

I either get redirected to URL with 0.0.0.0 in a browser or it goes into an endless loop of below calls:

status.js:54 GET http://127.0.0.1:8080/api/ping net::ERR_CONNECTION_REFUSED

Has anybody tried to achieve this before?


texts: What is the Ethereum network architecture? What are the major components of this?

texts:
I'm looking for a visual (preferred) or a description of what Ethereum "looks" like to a network architect.

For example, in contrasting Bitcoin, it consists of:

"Full nodes"

runs C++ code
Uses QT for cross platform graphics
Peers use a mesh P2P discovery engine that uses port 8333
Uses 80GB of disk space for the blockchain

Miners

ASIC hardware that calculates a hash

SPV Wallet

A lightweight method for a wallet to send and receive transactions without running a "full node"

(These are incomplete skeleton entries that describe Bitcoin.  This post is about Ethereum ;)

So, that being said, what are the major software components of Ethereum?

How do they connect?

What are they used for?


texts: How to call a function automatically when some condition gets false?

texts:
I am having a bidding session where every time a person Bids on some product it checks the condition if the bidding session is valid or not,

I want to trigger a finalize bid function which will finalize the bid and will proceed with other formalities?

Is it possible? As of my thinking, for executing a function in the EVM, gas is needed, provided by some of the account holders only, either an EOA or a Contract Account.

Feel free to share an approach for doing this.

Thank You .


texts: How to get Network Status to run with Parity?

texts:
I am trying to use this - https://github.com/ethereum/wiki/wiki/Network-Status

I get that installed and it seems to run but nothing shows in localhost. I get this nothing in the http://localhost:3000 display. The cli output is shown below. What is the cause and how should I correct it?

Applying action restartProcessId on app [node-app](ids: 0)
[PM2] node-app ✓
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user        │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼─────────────┼──────────┤
│ node-app │ 0  │ fork │ 23492 │ online │ 9       │ 0s     │ 0%  │ 13.4 MB   │ satoshimaca │ disabled

I also get the logs working and the connection is established so the present issue is accessing the logs via a UI, eg http://localhost:3000

Here are the logs -

  0|node-app | 2018-05-29 09:26 +00:00: [eth] =i= Starting web3
  connection 0|node-app | 2018-05-29 09:26 +00:00: [eth] =✓= Web3
  connection established 0|node-app | 2018-05-29 09:26 +00:00: [eth] ==>
  Getting info 0|node-app | 2018-05-29 09:26 +00:00: [eth] =i= { name:
  'parity0', 0|node-app |   contact: 'Trevor', 0|node-app |   coinbase:
  '0x00bd138abd70e2f00903268f3db08f2d25677c9e', 0|node-app |   node:
  'Parity//v1.11.1-beta-6654d02-20180515/x86_64-linux-gnu/rustc1.25.0',
  0|node-app |   net: '8995', 0|node-app |   protocol: 63, 0|node-app |
  api: '0.15.3', 0|node-app |   port: '30300', 0|node-app |   os:
  'linux', 0|node-app |   os_v: '4.13.0-1017-gcp', 0|node-app |
  client: '0.1.1', 0|node-app |   canUpdateHistory: true } 0|node-app |
  2018-05-29 09:26 +00:00: [wsc] =i= Starting socket connection
  0|node-app | 2018-05-29 09:26 +00:00: [eth] =✓= Installed chain filter
  0|node-app | 2018-05-29 09:26 +00:00: [eth] =✓= Installed pending
  filter 0|node-app | 2018-05-29 09:26 +00:00: [wsc] =i= The socket
  connection has been opened. 0|node-app | 2018-05-29 09:26 +00:00:
  [eth]     Trying to login 0|node-app | 2018-05-29 09:26 +00:00: [wsc]
  =✓= The socket connection has been established. 0|node-app | 2018-05-29 09:26 +00:00: [eth] =i= { id: 'parity0', 0|node-app |
  stats:  0|node-app |    { active: true, 0|node-app |      syncing:
  false, 0|node-app |      mining: false, 0|node-app |      hashrate: 0,
  0|node-app |      peers: 1, 0|node-app |      gasPrice: '0',
  0|node-app |      uptime: 100 } }


texts: If thief controls large percentage of total ETH supply, what effect will this have on viability of POS?

texts: If a softfork and hardfork were not adopted by majority of miners, and the thief is able to control a large percentage of the total supply of ETH, how will this affect the ability for ethereum to use POS consensus mechanism?


texts: How chainlink guarantees the authenticity and accuracy of the data it returns to the smart contract

texts: Given that the oracle and the "request/response" mechanism may be operated by multiple entities, the possibility of data being tampered with during transmission obviously exists. I want to know how chainlink guarantees the authenticity and accuracy of the data it returns to the smart contract.


texts: Truffle Migrations contract constructor argument

texts:
I'm reading the Truffle Migrations contract and looking at the code for upgrade():

function upgrade(address new_address) public restricted {
  Migrations upgraded = Migrations(new_address);  // *
  upgraded.setCompleted(last_completed_migration);
}

I can't work out what effect the new_address given to the constructor on the line I've highlighted has. Migrations's constructor doesn't take any explicit arguments:

function Migrations() public {
  owner = msg.sender;
}

Can anybody clarify what's going on in Solidity here? I can't find a doc that explains what this mysterious extra argument does.


texts: how to write backend for contract if you use infura ropsten metamask and remix

texts:
i'm using metamask with ropsten. deployed my contract on ropsten using remix. for the backend i used infura to create instance of web3.
ew Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/MY_API_KEY'));

i'm able to get data from blockchain by contract.getDetails(123);
but while sending the details i'm getting below error,
"The method eth_sendTransaction does not exist/is not available"


texts: Should mining multi-gpu rigs dedicate a gpu to each incoming job or...?

texts:
I'm coding mining software for multi-gpu rigs and I can't find the answer to this anywhere. The mining pool constantly sends out mining jobs and there are two possibilities how the software should deal with it:

As jobs arrive, each job is assigned to a dedicated gpu to solve. e.g. Job arrives with headerhash 0x1ab2c3d4... and is assigned to gpu0 to solve and then another job arrives with headerhash 0x6a4d9e7c... and this is given to gpu1 to solve etc.  So both gpus are working concurrently but on different jobs.

All gpus work together to solve one job at a time.  e.g. Job arrives with headerhash 0x1ab2c3d4... and given to both gpu0 and gpu1 to solve but each gpu is provided with a different extranonce. (subranged from the pool provided extranonce.)

Both approaches seem to be viable but I'm hoping someone who knows can give me a definitive answer which is better and/or which is usually the way it's done.


texts: Trouble Installing/Opening Mix IDE on OS X

texts:
I am trying to install and use the Mix IDE.  I have downloaded the disk image from the github page (https://github.com/ethereum/webthree-umbrella/releases/tag/v1.2.3).  There appears to be no issue when I download the .dmg or move it into my Applications folder.  However, when I try to open Mix (or AlethOne or AlethZero for that matter), I get a message that "Mix quit unexpectedly." I have tried installing a previous version of Mix, but I got the same result.

Are there any dependencies I need to install before hand? Or some other concern I should be aware of?  Any help would be greatly appreciated!

I am running OS X 10.10.5 (Yosemite) on a MacBook Pro


texts: Listing all the smart contracts deployed on ethereum

texts:
I want to list all smart contracts deployed on a private Ethereum chain, using Nethereum, and also those which were deployed by a certain address.

I have seen here and here but I cannot get anywhere

In the second link, an answer says

  For the present time (block ~ 5250000) there are ~2350000 contracts in ethereum blockchain. My search program worked for about a week.

Aren't contracts easily identifiable on a blockchain? and if not, is it possible to create some sort of off-chain reference in a database to re-identify them quickly or something?

I am looking for practical information on how to do this on a private blockchain


texts: Raw Transaction: GasPrice, Limit in Hex or Decimal?

texts:
When signing a raw Transaction like this: (example taken from Javascript API Docs)

var Tx = require('ethereumjs-tx');
var privateKey = new Buffer('e331b6d698.......................23123', 'hex')

var rawTx = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: ' 0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
}

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

var serializedTx = tx.serialize();

web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
  if (!err)
    console.log(hash); // "0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385"
});

It seems like it works to pass gasPrice and gasLimit in hex and decimal numbers. Why does it work? Does this work for every field (like nonce and value)?


texts: Let D be delay diameter of the network ,All the blocks will be either adopted or abondoned by all nodes at t+3D in the GHOST protocol?

texts: I have read GHOST white paper some time. and some problems abount Proposition 2(The Convergence of History) in Chapter 5.1 is confused to me.Does it imply that all  the blocks will be either adopted or abondoned by all nodes at t+3D? Assume here is a blocktree rooted by A and its left child and right child is B and C respectively,at time t a block D whose parenet is B is genereated,then according the GHOST rule,A B D will be the main chain. Assume at time t+d,the block E whose parent is C is generated, then what's the main chain of this block tree?


texts: Is it possible to exhaustively search through all Ethereum contracts in a local node

texts:
Currently building a stock exchange on Ethereum. Based on the current design, I have users creating individual buy orders as separate contracts tied to a central stock counter contract in the form of a list or mapping.

As certain operations on the exchange require the finding of the highest priced offer I was just wondering if it's possible for me to search through the list and sort the buy orders locally instead of running a function on the Ethereum blockchain which could possible cost alot of gas.

Any help provided would be much appreciated.


texts: Smart Contracts designing for desktop application

texts: Can I use smart contract for my desktop application? Even if I don't need blockchain. If yes, then which platform would you recommend?


texts:
I'm still new with the solidity and it seems to be a very basics question. What i'm trying to do is to call the link the compound smart contract with mine. And when i try to compile is complaining : "This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly." while i try input into the testnet .I would appreciate greatly if anyone could help:

pragma solidity ^0.5.12;

contract testCompound {

    address cethAddress = 0x42a628e0c5F3767930097B34b08dCF77e78e4F2B; //Ropsten - Mainnet 0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5
    address cusdcAddress = 0x43a1363AFB28235720FCbDF0C2dAb7759091F7e0; //Ropsten - Mainnet 0x39aa39c021dfbae8fac545936693ac917d5e7563

    ERC20 usdc = ERC20(0xFE724a829fdF12F7012365dB98730EEe33742ea2); //Ropsten - Mainnet 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
   // ERC20 eth = ERC20(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);

    address owner;
    //CompoundERC20 private cethCompound;
    CompoundERC20 private cusdcCompound;

    constructor() public {
        owner = msg.sender;
        usdc = ERC20(0xFE724a829fdF12F7012365dB98730EEe33742ea2);
      //  cethCompound = CompoundERC20(cethAddress);
        cusdcCompound = CompoundERC20(cusdcAddress);
    }

    function mint(uint256 mintAmount) external returns (bool){
        //cethCompound.mint(_mintAmount);
        //usdc.approve(cusdcAddress, mintAmount);
        cusdcCompound.mint(mintAmount);
        return true;
    }

}

contract CompoundERC20 {
  function approve ( address spender, uint256 amount ) external returns ( bool );
  function mint ( uint256 mintAmount ) external returns ( uint );
}

contract ERC20 {
    function totalSupply() external view returns (uint supply);
    function balanceOf(address _owner) external view returns (uint balance);
    function transfer(address _to, uint _value) external returns (bool success);
    function transferFrom(address _from, address _to, uint _value) external returns (bool success);
    function approve(address _spender, uint _value) external returns (bool success);
    function allowance(address _owner, address _spender) external view returns (uint remaining);
    function decimals() external view returns(uint digits);
    event Approval(address indexed _owner, address indexed _spender, uint _value);
}


texts: How to test a contract that uses a library in Truffle

texts:
I am learning Solidity and writing a contract that uses a library. I'm using truffle for the project. When I try to test the contract I get the following error

  Error: User contains unresolved libraries. You must deploy and link
  the following libraries before you can deploy a new version of User:
  IterableMapping

The code for the library is taken from iterable_mapping.sol and stored in IterableMapping.sol

The code of the contract looks like following and stored in User.sol

pragma solidity ^0.4.18;

import "./IterableMapping.sol";

contract User
{
    event ItemInserted(bool replaced);
    event ItemRemoved(bool success);

    // Just a struct holding our data.
    IterableMapping.itmap data;
    // Insert something
    function insert(uint k, uint v) public returns (uint size)
    {
        // Actually calls itmap_impl.insert, auto-supplying the first parameter for us.
        bool replaced = IterableMapping.insert(data, k, v);

        ItemInserted(replaced);

        // We can still access members of the struct - but we should take care not to mess with them.
        return data.size;
    }

    function remove(uint k) public returns (bool success)
    {
        success = IterableMapping.remove(data, k);

        ItemRemoved(success);
    }

    // Computes the sum of all stored data.
    function sum() public view returns (uint s)
    {
        for (var i = IterableMapping.iterate_start(data); IterableMapping.iterate_valid(data, i); i = IterableMapping.iterate_next(data, i))
        {
            var (, value) = IterableMapping.iterate_get(data, i);
            s += value;
        }
    }
}

The test code is

const User = artifacts.require('User');

contract('User', (accounts) => {

    it('should insert an item', () => {
        return User.new({
            from: accounts[0]
        }).then(instance => {
            return instance.insert.call(1, 1234, {from: accounts[0]});
        }).then(result => {
            assert.equal(result, 1);
        });
    });
});

I am aware in general the library code should be deployed before the contract using it and the linker at compilation is told to replace the __IterableMapping________ with the address of the deployed library. But in case of testing its not deploying the contract and I'm not sure when i do the User.new if and how can I pass which address to use for library.


texts: Who uses an Ethereum client directly? (Eg, using Geth)

texts:
Why would you run an Ethereum node locally when there’s so many tools meaning you don’t need to?

From what I can tell, no one is setting up a node locally for mining (takes a specialised mining setup now). You can use Metamask to create/manage accounts. If you’re a dapp developer, you can use Genache to simulate a blockchain for testing and infura when you’re ready to deploy to the test net/main net.

Is it to set up a private network? Something else I’m missing?

Thanks
Madeline


texts: I am transfering ethereum but showing 0 value and the transaction is successful

texts:
I am using web3j method sendFunds to transfer ether deducting the fee the transaction successful but showing 0 value in etherscan
Here is the link


texts: How the maker ensured the transaction was placed at a certain point within the same block?

texts:
I was observing the MARSH allocation recently and found a bot behavior of extreme luck. One single transaction outperformed many others and the maker paid 101 ETH to the miner for a single transaction.
I am interested in mechanics how this transaction was even possible, especially it's placement in the queue within the very same block.

Initial MARSH transaction
Actor transaction (point of interest)


texts:
Currently getting this error in my Browser's Console:

My current set up is as follows:

Truffle v5.0.3 (core: 5.0.3)
Solidity - 0.5.0 (solc-js)
Node v8.9.4

Here's my code - and note that I'm using .Contract with a CAPITAL C, which I believe is the new, Solidity - 0.5.0 way of doing this:

 App.MathContract = new web3.eth.Contract(
      [
        {
          "inputs": [],
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "constructor"
        },
        ....

Interestingly, when I used the old syntax - .contract with a lower-case c, I do not get this error:

App.MathContract = App.web3Object.eth.contract(
      [
        {
          "inputs": [],
          "payable": false,
          "stateMutability": "nonpayable",
          "type": "constructor"
        },
        ....

Any thoughts about what I'm doing wrong? (I'll be happy to upload any other code that might fill in the gaps.)

============================================

UPDATE:

Here's what my web3 version looks like:


texts: Sending Ether or messages to addresses that dont exist

texts:
I am reading the Ethereum white paper and needed clarity on the snippet below:

  Transfer the transaction value from the sender's account to the
  receiving account. If the receiving account does not yet exist, create
  it. If the receiving account is a contract, run the contract's code
  either to completion or until the execution runs out of gas.

Does this mean that if you send a message / transaction to an address that doesnt exist, it the call would succeed?
How does the key management work?
Is there any use case that would intentionally do this?
What is the rationale behind this design decision, because I would have thought throwing an error would have been the way to go.


texts: Always getting an empty address (0x) returned from a contract

texts:
I have the following method on a contract:

function addNode(address _address) constant returns (address) {
    nodes[_address] = Node(_address, balanceOf(_address), 0);
    return _address;
}

Here's the unit test calling it:

it("should add a node", function() {
    return LinkPool.deployed().then(function (instance) {
        meta = instance;
        return meta.addNode.call(nodeAddress, { from: account }).valueOf();
    }).then(function (address) {
        console.log(address);
        node = address;
        assert.equal(nodeAddress, address, "Address of node and the initial node address should be equal");
        return meta.balanceOf.call(node).valueOf();
    }).then(function (balance) {
        assert.equal(balance, 1, "Balance of node should be 0 ETH");
        return meta.getAmountStaked.call(node);
    }).then(function (amountStaked) {
        assert.equal(amountStaked, 0, "Amount staked on node should be 0 ETH");
        return true;
    });
});

Every time I use this method, with checking the parameter address is set, I get the following assertion error:

AssertionError: Address of node and the initial node address should be equal: expected '0x9a849eac304a334ef13682d51306fe3b715ea2ac' to equal '0x'

I've changed things around as many times as I can trying little nuances but cannot get any return value from the contract.

I feel like this is pretty basic, but I've tried as many different structures as possible and been Googling hard.


texts: I sent ETC to ETH on ledger nano s by mistake

texts:
I have checked and there is a receipt on emerald, following advice found on here. Then I got on ether wallet (again following advice from you guys)  and I am scrolling and scrolling through the addresses to try and find it, but i can't. What am I doing wrong? Or do I just need to go through every address more patiently until locate mine?
I just want to put the ETC on the nano in the ETC account to the ETH one cos I can`t see if it there.
TIA


texts: If you modify a contract how does the new contract keep the existing tokens?

texts: I understand that you can't edit a contract, you can only create a new version of one. However, its not clear to me how the new contract can manage tokens created by the old contract. How does this work?


texts: I purchased ether during the presale. Is there an easy way to import those ether and start using them?


texts: I'm running a smart contract locally on TestRPC and using MetaMask to interact with it. Repeatedly calling the same function with the same parameters seems to accumulate different gas consumption (including the gas estimate in MetaMask). Is it possible or am I missing something?


texts: Trigger Function When Sent To Specific Address

texts: Is it possible to write a Token contract which will trigger a certain function when the tokens are sent to a specific Address? Like let's say, if you send 5 tokens to 0x12345... a specific function will be called that sends another 5 tokens to 0x98765... This is just an example.


texts: How to send ether to a cold storage account?

texts:
Is it possible to do the following:

Back up the keystore on a usb drive.
Format the computer used to generate the keystore.
Send ether to a public address in the keystore.
Reinstall geth (or other ethereum cli), import the keys and have the updated balance?

Thanks


texts: How to create an account in a Dapp which developed with Parity

texts:
I’m developing a Dapp about image storing with Parity these days. And I try to make a new account with JSONRPC right now. But when I searched for some useful API, I found an API in this web:parity_newAccountFromSecret

In this API parity_newAccountFromSecret, it says creates a new account from a private ethstore secret key. But how and where to get it?

And there are some APIs about account, such as parity_accounts, personal_accounts, I don't know their differences clearly. Can you give me some advice? Thanks a lot~ :)


texts: How to send transaction using web3py using infura.io

texts:
I have connected to mainnet via

infura.io

and have used  http provider for connections now

i want to generate address
and

send transaction

And i wand to send real eth
so how can i do this?I have used web3 py for connection Is it that i have to connect to local node

And is it neccesary to deploy contract to send transaction

I have create account and generate address:
acct = Account.create('xxxxxxxxx')
print(acct.address)

So what are these addresses and how can i transfer balance using this address
Any help would be greatly appreciated


texts: Connect ethereum node on host machine to docker cluster in VM

texts:
My setup is as follows:
Windows host machine running an Ubuntu VM using virtual box. On the Ubuntu VM i'm running a private ethereum cluster using docker. This is working fine. I'm connecting them using a bootnode and this works instantly. No add-peer necessary.

What I'm trying to do now is connect a local node on my windows machine to the cluster. I want to run Mist locally for demo purposes, but also setup something of an easy to use local deployment environment.

In virtualbox I can either use a bridged network or nat. If I use a bridged network, it just works. I can connect my windows hosted node and Mist to the cluster. But I need to get it to work using nat.

I've basically tried everything and nothing works. Latest attempts included using --nat extip:[ubuntu_vm_ip]. Also did not work.

I then decided to run a node on the Ubuntu VM itself (so not using docker). This did not autosync, but by using addpeer I could actually get it to connect from my host.The docker nodes not so much. I found this post on connecting nodes on a different network, but the setup is somewhat different in my case. I'm not sure which nodes I need to provide with the --nat extip flag (and which address to use). It looks like that the connection to the bootnode and the direct connection to the nodes simply isn't working.

To provide some details:
My docker bootnode is using port 30301 and it's exposing it to the ubuntu host, both tcp and udp. My docker ethereum nodes are exposing 30303/udp and 8545 tcp. In the virtualbox nat networking settings I'm forwarding all these ports.

I'm wondering, looking at the above image, what the random port numbers are on the localnode/remote node under network settings.

So I know this is a bit of stretch and there are similar questions out there, but any hints, thoughts or experience is very welcome. I've been working on this for days and days, super frustrating.

I plan on sharing everything on github when done btw, for those interested.

EDIT: using host-only networking I can also use addPeer to connect a node without any issue, but peer discovery will not work. btw: I have diabled the firewall on the windows host.

So the question boils down to: why is peer discovery working on a bridged network and not on host-only or NAT, and where do I need to apply network changes? Expose more ports on my node containers (I tried all the usual suspects and have configured port forwarding). start geth using --nat extip:[someurl]


texts: Geth for ARM dynamic linker error in OpenWrt

texts: It looks like the Geth binary for ARMv5 architecture was compiled using ld-linux.so.3 for the dynamic linker. But I'm trying to run it in OpenWrt Linux, which uses Musl C standard library instead (ld-musl-arm.so.1) Is there a quick fix for this, like finding precompiled ld-linux.so.3 online and copying it to my OpenWrt lib directory, or do I need to cross compile ld-linux.so myself?... if I can find the source code (still looking) Or should I try to cross compile Geth myself using musl instead? Is there a way to edit the XGO cross compiler setup to change the dynamic linker??


texts: How to create in test regime "hello world"- my very first and simple contract in Parity Wallet for Win

texts:
Parity.exe
"Contracts"
"Develop Contract"
In window "New Solidity Contract" wrote:

/*
from here:
https://ethereum-homestead.readthedocs.io/en/latest/contracts-and-transactions/contracts.html#writing-a-contract
*/

contract HelloWorld {
        event Print(string out);
        function() { Print("Hello, World!"); }
}

Compile
Deploy
Then what?

I am stuck here (I do not have gas/any money in present account)

Note: The original doc from Parity about contracts is unclear to me:

https://github.com/paritytech/parity/wiki/Tutorial-Part-6


texts: Art registry site: isn't this just a centralized DB?

texts:
Just trying to wrap my head around the claims here:: https://www.artory.com/how-it-works/

Essentially they work with an industry partner (auction houses like Christie's), use all of the information related to a sale that is signed by the partner (seller) and time-stamped to create a hash. Artory then sends a no value transaction to themselves (no token is created or ether transferred, just the gas to record the hash), with the idea that record could be shared by the buyer with other potential buyers to prove ownership without revealing identity through their web interface.

Here's an example:
https://registry.artory.com/records/CHR-27R2E4D3/

Transaction: https://etherscan.io/tx/0x240a6e1ccf87146dc22a60b95cd4a207436044177ec38b5713a5ca6df266ac72

And here's how they describe the process: https://registry.artory.com/records/CHR-27R2E4D3/validate-record/

Setting aside the complexity/impossibility of tying these digital records to the actual things they represent, I'm really struggling with why this is anything more than a completely centralized process that could be more easily and cheaply accomplished with a traditional database (aside from the marketing they get from tying it to blockchain). There is no token, sellers and buyers are completely disintermediated from the blockchain transaction, and from what I can tell the only way to interact with the information written in the transaction is through their website (it's not open source, the hash is encrypted, so if their website is shut down there's no way to know what the hash written to the blockchain represents).

Am I missing something?


texts: Where is the source code for Ethereum stored?

texts: I am interested to see exactly what is coded for Ethereum. I know web3 is on github. Where is all the fundamental source code stored for the EVM and all the main components?


texts:
Is it possible to sign transaction on ARM Microcontroller and then somehow broadcast it?

I have read about ethereumjs-tx, but how to implement it without any OS on board?

UDPADE: I have found how to create a signed transaction in Go

https://ethereum.stackexchange.com/a/3401/7620

transaction := types.NewTransaction(nonce, recipient, value, gasLimit, gasPrice, input)
signature, _ := crypto.Sign(transaction.SigHash().Bytes(), key)
signed, _ := tx.WithSignature(signature)

Where can I find same code in C/C++ with lib?


texts:
I encountered a strange issue on Ropsten Testnet. I deployed a payable contract successfully and tried to send ethers to it. I didn't know how much gas it required, so I gradually increased gasLimit. After a few "out of gas" errors, I finally made a successful call.

I inspected the successful transaction on etherscan.io and noted down the Gas Used By Transaction field, let's say it was 30,123. Then I tried to send the exact same transaction (with 31,000 gas to be safe), and I was very surprised that this new call also failed with "out of gas", i.e. it consumed all of the 31,000 gas..

-How- can the same transaction require different amounts of gas? Is it up to the miner? It shouldn't be.

If relevant, my transaction does not change anything inside the contract. The contract just takes the money and sends it back to the sender, i.e. contract myContract{ function () payable { msg.sender.send(msg.value); } } But -I think- even if it did change something, the gas cost should remain constant. It should only depend on the contract code, and not the state, right?

Thanks for any help,

Update

I kept trying (and failing), until I increased gasLimit like crazy, up to 50,000 and it worked again! with the exact same 30,123 gas used. This makes sense, but it's still curious why it didn't work before, with more than enough amounts of gas.

Update 2

I created the contract with this source code:

contract c{ function () payable { msg.sender.send(msg.value); } }

I compiled it with Solidity and deployed here, and tried to send 1 wei (which it will send back to me), here are my trials:

With 50,000 gas, success! It used 28,520 of it. You can see it here.
With 28,521 gas, fail.. It's here
It also failed with 30,000 gas, here.

Feel free to send your test ethers to it, if you want to try. Don't worry, it won't keep them :)


texts: Error when calling the selfdistruct method in solidity

texts:
I am quite new to solidity, and I have not managed to find a solution for this problem.

I am passing the function an address but it says the following:
"Invalid type for argument in function call. Invalid implicit conversion from address to address payable request."

address admin;

function endSale() public {
 require(msg.sender == admin);
 selfdestruct(admin);
}


texts: Incorrect Usage. flag needs an argument: -rpcaddr = Ethereum private blockchain

texts:
I'm trying to make Ethereum private blockchain. But facing a error while running this

"geth --nodiscover --networkid 42 --datadir .ethereum/ --unlock 0x526d8a6baa472da27215f748236af96bc9f256d7--mine --rpc --rpcapi eth,net,web3 --rpcaddr"

While the error I'm getting is

"Incorrect Usage. flag needs an argument: -rpcaddr"


texts: Peer nodes of another server not getting connected in private blockchain

texts:
I'm doing setup of a private blockchain using PoA, and facing issue in connectivity with peers of another server.

I'm using geth 1.8.16, and created genesis file using puppeth.

Structure

Server-1
OS: Ubuntu 16.04
IP: XX.XX.4.5
|-node1 (geth port: 30304)
  |- geth
  |- static-nodes.json
|-node2 (geth port: 30305)
  |- geth
  |- static-nodes.json
|-node3 (geth port: 30306)
  |- geth
  |- static-nodes.json
|-genesis.json

Server-2
OS: Ubuntu 16.04
IP: XX.XX.4.6
|-node1 (geth port: 30304)
  |- geth
  |- static-nodes.json
|-node2 (geth port: 30305)
  |- geth
  |- static-nodes.json
|-node3 (geth port: 30306)
  |- geth
  |- static-nodes.json
|-genesis.json

static-nodes.json file looks as follows.

[
"enode://pubkey@XX.XX.4.5:30304",
"enode://pubkey@XX.XX.4.5:30305",
"enode://pubkey@XX.XX.4.5:30306",

"enode://pubkey@XX.XX.4.6:30304",
"enode://pubkey@XX.XX.4.6:30305",
"enode://pubkey@XX.XX.4.6:30306"
]

But the issue is; nodes from same server are connected, but from different server are not getting connected.

From server-1

>net.peerCount
2

From server-2

>net.peerCount
2

I have checked that both the server can communicate, so that's not the issue. Ports are also allowed