texts: How can I give a wallet to my user and prevent cost for them?

texts:
I would like to integrate in my website just a simple contract integration.

This is my first exercise on Dapp world and I'm not sure which is the best way to do things.

What I want to do is to enable a logged user to vote for a specific product in a brand.

What I think to do is deploy a Brand contract that store all my brands and a contract for all products associates to the brand (I think I can use just Brand's contract ).

The decision to not give a wallet for every user is because I don't understand how to prevent user to charge his wallet. I can't say "pay eth to vote, nobody will vote on whether it should pay". How can I give a wallet to my user and prevent cost for him?

So what I want to do is:

Deploy a Brand contract.
provide a web3 connection to smart contract.
call a contract function to increment vote.
call a contract function to get all votes for a product.

I know that it sound like a stupid question but I don't know where to start.

Sorry for my bad english.


texts: Ledger nano s unrecoverable - have ethereum private keys - How do I get this ETH?

texts:
Lost the 24 word recovery sheet, and the pin number...

I"ve resolved that the BTC is gone, but if I opened in myetherwallet - and produced private key and UPC code - I'm told I could get the ETH back.

What are the steps to doing this? Very scared to mess up, and no I'm not sending private keys to anyone.

Could I just log in and open via private key on myetherwallet?
Or do I need to do this first? Restore the code in some way? :
https://support.ledgerwallet.com/hc/en-us/articles/115005197905

Please advise.

Tone


texts: Are there any open source accounting systems

texts:
I am looking for some accounting system for my project. I am developing an app where people have their own accounts, just like on any centralized exchange. Users will be able to deposit some ERC20 tokens to their address (one account = one address). Users won't be able to trade because I am not building another crypto exchange, but they will be able to send their tokens to other accounts (simple transfer). Of course, these transfers will happen offchain. Thus, I need to observe real balances on my own. I mean, if user A deposited 100 USDT tokens, there are 100 USDT on his address. But, the user can transfer let's say 20 USDT to user B. The transfer happens entirely offchain, so technically from the blockchain perspective user A still has 100 USDT. The problem is I have to build an accounting system on my own and keep all balances. If the user B also received 20 USDT from users C and D and wants to withdraw his 60 USDT, I have to make a transaction when inputs (addresses) are from users A, C and D. But it would cost a lot, maybe it would be better to take one input from the other address that has more than 60 USDT? I don't want to solve these problems on my own.
Is there any open-source solution that has the following features:

it's not a Smart Contract (I want transfers with 0 fees)
support for Ethereum's ERC20 tokens
one user = one account = one address (I need unique addresses to figure out who made a deposit)
offchain transfers
accounting system to track user balances, which are not the same as balances on their deposit address
deposits
withdrawals (combining tokens from addresses)

It would be great to run this service in Docker and to have a REST API with methods for checking balance, transfers, withdrawals, opening an account.


texts:
I need to find out how to:

Connect web3 to the smart contract that contains the TOKEN token via a ethereum node URL running parity, and use getter function on this contract to obtain the 'total sold' (as per ERC20 standard interfaces)
get current eth value from any exchange or the node running parity and multiply by x which is the fixed exchange rate for each TOKEN token

Any idea how to do it?


texts: Define variables inside tests for contract

texts:
I write a bit more than plain contract on solidity and working on test to it. I faced with issue to put pass variables inside.

If I define variable as let I receive compilation error like this:

  BigNumber Error: new BigNumber() not a number: entity

My attempts to define it as solidity variable are failed, seems test doesn't support any type except let

Here is a sample of the contract and test for it.

contract Market {

    struct good {
        address owner;
        bytes32 goodName;
        uint amount;
    }

    mapping(bytes32 => good[]) market;

    uint counter;

    function Market() {}

    function putGood(bytes32 name, address owner, uint quantity) public returns (uint) {
        good memory newGood = good(owner, name, quantity);
        market[name].push(newGood);
        counter++;
        return counter;
    }

  function getGood(bytes32 good) public view returns (bytes32, uint)     {
    return (market[good].owner, market[good].goodName, market[good].amount);
}
}

Related test

const Market = artifacts.require('../test/Market.sol')

contract('Market', function(accounts) {

let market;

beforeEach(`create subject instance before each test`, async function() {
    market = await Market.new();
})

it(`client put good on the market - one good - one good is available on the market`, async function() {
    let testGood = stringToUint("test good");

    await market.putGood(testGood, accounts[0], 1);

    let good = await market.getGood(testGood);

    assert.equals(good.owner, accounts[0]);
})

Could you please help me with place where I can learn more about defning different types in solidity tests?


texts: Gas estimation errored with the following message error upon contract deployment

texts:
I am trying to deploy my contract CoinFlip on Remix using Injected Web 3 (Ropsten, Metamask) but I am getting the gas estimation error. I'm not sure where the error is coming from. I also tried deploying the sample contracts in Remix but it's also showing the same problem.
Any help is greatly appreciated!
pragma solidity 0.5.12;

import "github.com/provable-things/ethereum-api/provableAPI.sol";

contract CoinFlip is usingProvable{

    address public owner;
    uint public contractBalance;

    uint256 constant NUM_RANDOM_BYTES_REQUESTED = 1;
    uint public latestNumber;

    constructor() public payable{
        require(msg.value > 10 wei);
        contractBalance = msg.value;
        owner = msg.sender;
    }

    struct betConfig {
        address player;
        uint coinSide;
        uint bettingValue;
    }

    struct callbackMapping{
        uint randomNumber;
        uint side;
        address payable playerAddress;
        uint betValue;
        bool winOrLose;
    }

    mapping (address => betConfig) public betInfo;
    mapping (bytes32 => callbackMapping) public waiting;

    //Events ---------
    event LogNewProvableQuery(string description);
    event generatedRandomNumber(uint256 randomNumber);

    event mappingUpdated(string description);
    event playerInfoAdded(string description);

    event result(string description);

    //Game proper ---------

    function bet(uint _coinSide) public payable {
        require(msg.value > 5 wei);
        uint valueToBet = msg.value;

        uint256 QUERY_EXECUTION_DELAY = 0;
        uint256 GAS_FOR_CALLBACK = 200000;

        bytes32 queryId = provable_newRandomDSQuery(
            QUERY_EXECUTION_DELAY,
            NUM_RANDOM_BYTES_REQUESTED,
            GAS_FOR_CALLBACK
            );
            emit LogNewProvableQuery("Provable query was sent, standing by for the answer");

        waiting[queryId].playerAddress = msg.sender;
        waiting[queryId].side = _coinSide;
        waiting[queryId].betValue = valueToBet;

            emit mappingUpdated("Mapping updated. Waiting for random number.");
    }

    function __callback(bytes32 _queryId, string memory _result, bytes memory _proof) public {
        require(msg.sender == provable_cbAddress());

        uint256 randomNumber = uint256(keccak256(abi.encodePacked(_result))) % 2;
        latestNumber = randomNumber;

        emit generatedRandomNumber(randomNumber);

        processResults(_queryId, latestNumber);
    }

    function processResults(bytes32 id, uint number) private {
        waiting[id].randomNumber = number;

        if (waiting[id].randomNumber == 1){
            waiting[id].winOrLose == true;
                uint prize =  waiting[id].betValue * 3;
                waiting[id].playerAddress.transfer(prize);

                emit result("You won!");
        }
        if (waiting[id].randomNumber == 0){
            waiting[id].winOrLose == false;

                emit result("You lost.");
        }
    }
}


texts: How to Circulate Token in a network from one peer to another?

texts: I am creating a token contract and try to ciruculate that token in other peers, how could i do that?


texts: Control of the accreditation of investors

texts:
If it is necessary, that the smart contract should distribute tokens only to the accredited investors. To do this, the smart contract must contain a list of accredited investors, as well as update it as new information becomes available. Tell me, please, does the Ethereum platform allow for such functionality in smart contracts?
Thank you!


texts: Is it possible to build stand alone application which can interact with ethereum client and block chain?

texts: I am trying to develop a stand alone application in c++ using the c++ libraries provided for building cpp-ethereum client (http://www.ethdocs.org/en/latest/ethereum-clients/cpp-ethereum/building-from-source/linux.html), is it possible to do so?


texts: Using Hardware Security Modules to generate and store private keys on private ethereum / quorum

texts:
For a private ethereum networks, has anyone used Hardware Security Modules (HSM) to generate and store Ethereum private keys?

I am keen to know how public/private keys are managed without a PKI (Public Key Infrastructure)


texts: confused about the concept of overriding

texts:
Question in one sentence:
Solidity does not support the variable overriding?

Consider a following code:

contract B {
  function set() {}
  function f() {
    set();
  }
}

contract A is B {
   function set() { }
}

Supposing the contract A is deployed, when we call f(), the function set() inside A (not B) will be called, because the most derived function set() is defined in A (i.e., the function set() is overridden).

My confusing part is the following. Let me show another example:

contract B{
    uint public n;

    function test2() public { n = n + 1; }
}

contract A is B{
    uint public n;
}

Based on the previous example, I guessed that if the deployed contract is A and we call the function test2(), the variable n inside A would be increased, because the variable is overridden.

However, when I tried the above example in Remix, I found that my guess was wrong. It seems that Solidity supports the function overriding, but not the variable overriding.


texts: Are there any simple, simulated smart contracts to try out?

texts:
The barriers to buy, sell and trade cryptocurrencies are fairly low. Anyone can try it now. But very few of the same people can say that they've ever tried to enter into a smart contract.
Are there any good (simulated, therefore free) smart contracts on a simulated blockchain out there to try out so that someone can say that they experienced what it's like?
Beyond simulated contracts, how about actual, cheap ones that are actually on the blockchain? I don't mean smart contract templates to implement. looking for an open contract that is ready, sitting and waiting for a second party to deploy it


texts: Unable to connect to 'Web3 Provider' on Remix using http connection

texts:
I am using an http connection to connect to the Web3 Provider using Remix. The port 8454 is listening as expected.

I am getting the following error:

Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC).

You can see the error in the below image.

What is the possible solution for this? I need to use the Web3 Provider and not Injected Web3


texts: how to get contract creation code (bytecode) from etherscan api?

texts:
I tried etherscan api to get the contract creation code (bytecode for depolying contracts). I tried both getContractABI and getSourceCode, but the return values are not what i am expecting.

I need the cotract creation code as in: https://etherscan.io/address/0xd26114cd6EE289AccF82350c8d8487fedB8A0C07#code

for any contract which i have its address


texts: Quorum blockchain transactions visibility

texts:
I am wondering if the content (transaction) of the consortium blockchain or Quorum blockchain can be visible only for the validators.
In other words, the registered users (who can access the nodes) cannot read the content of the blockchain. Is this case possible on the consortium (or Quorum) blockchain?


texts: i am very confused on what's wrong on line 16. balances[msg.sender] = totalSupply;

texts:
pragma solidity ^0.8.2;

contract Token {
    mapping(address => uint)public balances;
    mapping(address => mapping(address => uint))public allowance;

    int public totalSupply = 10000 * 10 ** 18;
    string public name = "JeddCoin";
    string public symbol = "JEDD";
    uint public decimals = 18;

   event Transfer(address indexed from, address indexed to, uint value);
   event Approval(address indexed owner, address indexed spender, uint
value);

   constructor() {
       balances[msg.sender] = totalSupply;
   }

   function balanceOf(address owner)public view returns(uint){
   return balances[owner];
   }

   function transfer(address to, uint value)public returns(bool){
       require(balanceOf(msg.sender)>= value, 'balance too low');
       balances[to] += value;
       balances[msg.sender] -= value;
       emit Transfer (msg.sender, to, value);
       return true;

   }
   function transferFrom(address from, address to, uint value) public
returns(bool) {
       require(balanceOf(from) >= value, 'balance too low');
       require(allowance[from][msg.sender] >= value, 'allowance too low');
       balances[to] += value;
       balances[from] -= value;
       emit Transfer(from, to, value);
       return true;
   }

   function aprove(address spender, uint value)public returns(bool){
       allowance[msg.sender][spender] = value;
       emit Approval(msg.sender, spender, value);
       return true;
    }
}


texts: How to access ethereum smart contract(already deployed) in a Java application via its address using web3j?

texts:
I have an existing Smart contract address,abi,binary code.
I need to access it from a Java application.Is it possible to do this without creating a java wrapper class?


texts:
I have a simple contract with a function that should return a byte32 which is passed as a parameter.

This is a snippet of my contract

contract SimpleContract{
   function simple(byte32 toReturn, byte32 otherArg) public returns (byte32){
        //Work with the values
        return toReturn; //Unmodified
   }
}

Now, if I test it in Solidity, works seamlessly, but since I want to run more complex test, I turned to Truffle and used its JS library to run the test. Specifically, simple is tested this way:

contract("SimpleContract", function(accounts){
   it("should return the passed value", function (){
       SimpleContract.deployed().then(function(instance){
          var arg1 = 0xec40808d22324ec2fd140c398284c2a263871d111f54eb6f1b308c874ea1abc9;
          var arg2 = 0x1234567890;
          instance.simple.call(arg1, arg2).then(function(returnedValue){
              expect(returnedValue).to.equal(arg1);
          });
       });
   });
});

Then I get this error:

AssertionError: expected 'ec40808d22324ec2fd140c398284c2a263871d111f54eb6f1b308c874ea1abc9' to equal '0xbd4419d46aafe6c72f31a89e54fd9976c34fe7cd385253d36e4226f94376e6dd'

I suspect there is some encoding issue, but I still haven't been able to wrap my head around it.


texts: Solidity, Ethereum ICO, Truffle and my head exploding

texts:
I am trying to somehow end up with a solidity code (for an Ethereum token and a Crowdsale contract), that I can paste in the source code bar in Ethereum Wallet and deploy the Token and the Crowdsale ICO.

Most of the sample/example/finished codes online are for an older solidity version and don't function anymore. I am also not capable of changing them to make it work. Despite my low to zero coding experience, I have a feeling that most of the changes in solidity versions include fundamental improvements, which leads me to think older examples are not the thing I should look for.

I found https://github.com/OpenZeppelin/zeppelin-solidity where everything is up to date and has examples of most of the smart contracts that one may need.

Using various tutorials I extracted some of the files from Zeppelin and made some on my own (one for the coin and one for the crowdsale).

Most of the files in Zeppelin have other files linked in their code. For me to deploy a contract, I need one code without linked libraries.

I thought the word "compile" is what I am looking for and using Truffle managed to compile them, but I just got all the separate files, but in .json.

How can I make one single code, that could be used in apps like Ethereum Wallet to deploy a contract. Will it work if I just copy-paste everything together (should work, but I have a feeling that this is not the smart way).


texts: How to let evm execute one function from a smart contract and receive outputs in a handy way?

texts:
I am a newbie to this field so I apologize in advance if this seems trivial.

Say I have written some code in Solidity, for instance something like the quick sort code (https://gist.github.com/subhodi/b3b86cc13ad2636420963e692a4d896f).

Now I want to locally run it with my evm virtual machine (due to certain reason, we prefer to run it locally with virtual machine, instead of using some web services...), so I would use commands like:

solc --bin --optimize -o . qs.sol
./evm --debug --code $(cat QuickSort.bin) run

So after executing the above commands, I do see some logs printed out; however, I am still unclear about:

How exactly can I specify a function to execute? In the above quick sort case I only have one "public" function, but what if I have many?
How to pass in parameters into the evm when executing certain functions?
Is there any convenient way I can expect to read some output? For instance can evm return a sorted array and somehow print it out, or write into some log files?


texts: What does it mean to declare an item of type contract?

texts:
Wasn't quite sure how to word the title, but in the following code:

contract KittyInterface {
...
}

contract ZombieFeeding is ZombieFactory {

KittyInterface kittyContract;

}

what is the declaration KittyInterface kittyContract; creating? I saw that it can be be initialized with KittyInterface kittyContract = KittyInterface(ckAddress); where ckAddress is the address of the interface contract that is being used.

I read the contracts section of the solidity documentation but it hasn't really answered my question. If anyone can forward me to a resource to better understand this I would be very appreciative!


texts: Memory variables vs storage variables in Vyper

texts:
Is there a way to specify if a variable is memory or storage like we do in solidity ?
Thanks


texts: Which version of web3 shall i be using now?

texts:
I found the documentation of version  1.0.0 which was released on the 6th of August here. I was told that v1 is not stable and very different than earlier versions. But when i check the available versions using command `npm view web3 versions it shows

  '1.0.0-beta.55',
  '1.0.0-beta1',
  '1.0.0-beta2',
  '1.2.0',
  '1.2.1',
  '2.0.0-alpha',

these many versions.  Can you suggest me which verison shall i go for if i want to follow the given documentation.

And what is the difference in version 0.* and 1.*?


texts: is the gas price on test net equal to main net?

texts:
I have 1 contract deploying on test net, let say it use 300,000 gas for executing 1 function.

On main net, this contract will cost 300,000 gas per function also?

Thanks


texts: Do I need a Ethereum node on my device to access blockchain data from our app javascript web client?

texts:
Our app has a javascript web client.
For the purpose of this question, our client is only interested in knowing if the user has a ECR20 token, i.e. query the users token balance.
To get this knowledge, the web client has to run web3?
So does this mean the device running the web client has to also have a local Ethereum node with the whole blockchain data?
And, as just querying the balance is not a transaction (?) requiring something to be written and does not require new block, does the whole network of nodes run the balance query?


texts: How much gas does looking up block.timestamp consume?

texts:
Trying to get some insight as to whether or not it's more optimal to call block.timestamp repeatedly for comparisons or to set a (memory) variable to hold the value and use it instead.

I've looked at the gas cost table here:

http://ethdocs.org/en/latest/contracts-and-transactions/account-types-gas-and-transactions.html

but am not certain about where block.timestamp fits in.


texts: Problem understanding the owner assignment

texts:
Suppose I have 3 contracts, namely Owner, B and C:

contract Owned {
    address public owner;

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

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

Contract B

contract B is Onwed{
     constructor() public{
        uint256 totalSupply = 10000000000;     // any amount
     }
}

Contract C

I want to create an instance of contract B, in contract C. There are  2 ways to do it

contract C{
     constructor() public{
          B instance = B(address_of_deployed_B);  // Method 1
          B instance = new B();                   // Method 2
          B instance2 = new B();                  // 2 instances of B
    }

}

What I actually want here is, the owner of the contract is set to contract C's address.

But the following is happening.

Method 1 works fine when I try to instantiate this way, but since it's already deployed, I can't set owner properly.
Method 2 is not able to deploy 2 instances of the contract in the constructor(shows revert).

[Edit 1] Method 2 is working fine. But it isn't working if you initialise 2 instances of the same contract.


texts:
I want to use the OpenZeppelin Merkle proof library, but I am not able to figure out the hashes I have to provide in the proof parameter in the verify function of the library.

Let's say I have these hashes as leaf nodes:

[
  {hash: 'b21bf46774e26d1371efa237de5882f526119eecaa45dbf39c7818600e375e2d'},
  {hash: '3da8c00fbec86f6ede0cca827e032dc7ebbe839dc80dc97b862df3d3aec8b78d'},
  {hash: '5a9c997d4c2508b4e29870855eab0d80b39952d024c716505066d8705070947b'},
  {hash: '8f4082b2891ad69b64b2c4753dae488d6666d4d7cfd34d87c67efb2b9fde8a3c'},
  {hash: '815fdfa8e1af3674398bb50aa2023bc2eee26ad0effa73fbc6e8bfca6d0d3d32'},
  {hash: '9d282b8f2019001b06c0f6ab08989dd39403459da38c8c56c908ac59c543989c'},
  {hash: '9847b72c2efe0fc6d7bddcf948de2a8c87f12e25e09c66cf01168a904addf4c9'},
  {hash: '2ff257c0d15996467140c11a3076bc56b4d85e32d93437608d6728a46b15045c'},
  {hash: '664bbbb4b2835f058a4c618707cb2103b15a602aca55d00f764d546fd262e529'},
  {hash: '039f9def43c7130659dbe112ab4ed877964b253cea54ece430c013154e1ed1ab'}
]

Then what all hashes I will have to provide in the proof parameter.


texts: Why is delete on arrays implemented in an energy and gas wasting way?

texts:
If I delete the whole array (static/dynamic), then all elements of an array are set to default value. So, it means that if an array has a million elements, then I have to pay gas for setting up of million elements to zero, and likely exceed the limit of Ethereum.

However, delete in blockchain is different than delete in a memory of a machine. Nothing can be deleted from blockchain ever, and thus the only reason why delete operation may exist is just "to mark some field to be invalidated" for the purpose of a smart contract code. There is no other reason. In the case of value types (int, float, etc), it does not matter whether we just invalidate by zeroing the storage variable or adjusting its property. However, The problem comes with arrays - there is no reason to zero all the fields of an array just due to their invalidation. Instead, just the length attribute of an array should be set to zero, and index check for accessing an array added.

Am I wrong?


texts: How do i get the amount of tokens received for a swap on Uniswap/Pancakeswap so i can exchange them back later


texts: Solidity cross programming language method calling

texts:
I was wondering if it is possible for solidity to call functions of other languages. More specifically, I am planning on developing a basic distributed search engine using the ethereum blockchain and I was wondering if I could write the web crawling and indexing in a different language (Python etc) and then have solidity to either gather the local results from this or call the methods directly. I am aware solidity is turing completing but being able to develop in another language would save time with library use and then just use solidity to interact with the blockchain.
Hopefully this makes sense, thanks in advance,


texts: Does "delete" on mapping really frees the memory space?

texts:
I have the following mapping(uint => Foo[]) data structure. I have mapped 10 unique ids with 10 Foo structs, where each Foo is an arraylist of 10 items.

Step 1:

for(int i = 0; i < 10; i++)
   for(int j = 0; j < 10; j++)
       add(i, j);

Step 2: I delete the items pushed before. I'm not sure which one is the correct approach among a) and b) below. Approach b) leaves holes by only resetting the members in the struct

a)  for(int i = 0; i < 10; i++)      | b) for(int i = 0; i < 10; i++)
           delete(i);                |      for(int j = 0; j < 10; j++)
                                     |          delete_items(i, j)

Step 3: I push new items with different mapping uint id.

for(int i = 20; i < 30; i++)
   for(int j = 20; j < 30; j++)
       add(i, y);

[Q] Would delete mapping_array[id] actually free the memory that was allocated by the array list within the mapping? Or would it only zero out the memory as if delete was used on Array List, and the item remains in the mapping as empty, but still taking memory space?

[Q] In total, I have mapped 10 unique ids with 10 Foo structs, where each Foo is an arraylist of 10 items. Later I delete the items in my mapping data structure then insert new items into it. So would the newly inserted items get new memory allocated for them, or would they be overwritten in memory of recently deleted items?

These matter because I am using a mapping data structure of very large size and items get inserted and removed frequently. I know delete won’t free memory on an Array, but not sure if it’s the same in mapping.

I am using the following code piece from this question's answer: https://ethereum.stackexchange.com/a/1458/4575

  struct Foo{
    uint x;
  }
  mapping(uint => Foo[]) mapping_array;

  function add(uint id, uint _x) public {
    mapping_array[id].push(Foo(_x));
  }

  function get(uint id, uint index) public returns(uint){
    return mapping_array[id][index].x;
  }

  function delete_(uint id) public {
    delete mapping_array[id];
  }

  function delete_items(uint id, uint index) public {
    delete mapping_array[id][index];
  }

  Delete:

  delete a assigns the initial value for the type to a. I.e. for integers it is equivalent to a = 0, For structs, it assigns a struct with all members reset.

  delete has no effect on whole mappings (as the keys of mappings may be arbitrary and are generally unknown). So if you delete a struct, it will reset all members that are not mappings and also recurse into the members unless they are mappings. However, individual keys and what they map to can be deleted.

  It is important to delete a really behaves like an assignment to a, i.e. it stores a new object in a.

Link: http://solidity.readthedocs.io/en/develop/types.html

Thank you for your valuable time and help.


texts: How to load contract from address- remix?

texts: Hi I just found that remix added "Load contract from address" option. So I tried to load contract from address "0x67601d7a7cbbD77368785122c508503f168B1dAa" . You can see this contract is in function in https://www.stateofthedapps.com/dapps/cute-kitty-farm . I connected to main network using meta mask but it is not loading any contract. Instead it just deploys my own contract. How can I load contract from this address? Thank you.


texts: Solidity is the official language for ethereum. I wander that can this language process images or would it support library like OpenCV?


texts: Flash loan security considerations and attacks

texts:
What do developers need to be aware of to make their contracts and systems safe against flash loans?
What do they have to think about and protect against?


texts: How can I distribution to multiple addresses at a time?

texts:
I have a contract now distributing the tokens but I'm tired of sending individually. Can I get the solidity code to simply send to many addresses?
Edited:::: In brief about the question
1.I want to send the same number of tokens to multiple addresses.
Help me with the complete contract code not that single function :( .

This code seems working to me but i am bit confused
1.First do i need to create the contract and then send tokens to the created contract address and then give the values addresses and number of tokens and then click on sendTokenSingleValue area?
please guide me

pragma solidity ^0.4.16;

contract Ownable {

  address public owner;

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

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

  function transferOwnership(address newOwner) onlyOwner {
    require(newOwner != address(0));
    owner = newOwner;
  }
}

interface Token {
  function transfer(address _to, uint256 _value) returns (bool);
  function balanceOf(address _owner) constant returns (uint256 balance);
}

contract AirDrop is Ownable {

  Token token;

  event TransferredToken(address indexed to, uint256 value);
  event FailedTransfer(address indexed to, uint256 value);

  modifier whenDropIsActive() {
    assert(isActive());

    _;
  }

  function AirDrop () {
      address _tokenAddr = 0x; //here pass address of your token
      token = Token(_tokenAddr);
  }

  function isActive() constant returns (bool) {
    return (
        tokensAvailable() > 0 // Tokens must be available to send
    );
  }
  //below function can be used when you want to send every recipeint with different number of tokens
  function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external {
    uint256 i = 0;
    while (i < dests.length) {
        uint256 toSend = values[i] * 10**18;
        sendInternally(dests[i] , toSend, values[i]);
        i++;
    }
  }

  // this function can be used when you want to send same number of tokens to all the recipients
  function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external {
    uint256 i = 0;
    uint256 toSend = value * 10**18;
    while (i < dests.length) {
        sendInternally(dests[i] , toSend, value);
        i++;
    }
  }

  function sendInternally(address recipient, uint256 tokensToSend, uint256 valueToPresent) internal {
    if(recipient == address(0)) return;

    if(tokensAvailable() >= tokensToSend) {
      token.transfer(recipient, tokensToSend);
      TransferredToken(recipient, valueToPresent);
    } else {
      FailedTransfer(recipient, valueToPresent);
    }
  }

  function tokensAvailable() constant returns (uint256) {
    return token.balanceOf(this);
  }

  function destroy() onlyOwner {
    uint256 balance = tokensAvailable();
    require (balance > 0);
    token.transfer(owner, balance);
    selfdestruct(owner);
  }
}

when i tried with this code i got this error?
what to do ?
transact to browser/ballot.sol:AirDrop.sendTokensSingleValue errored: Gas required exceeds limit: 3000000.  An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).


texts: Call to other contract method return false when two parameters are passed

texts:
Caller Contract

  Called.call(abi.encodeWithSignature("test(address, address)"),empAddress, empContAddress)

Called Contract

  event ad(address);

 function test(address e, address f)public{
     emit ad(e);
 }


texts: Whether usdt or usdc freeze people accounts often?

texts:
Whether usdt or USDC will freeze the accounts often?
This happened a lot or?


texts: How to sign a message using secp256k1 in Ruby?

texts:
I'm trying to write a sign function in Ruby for Ethereum using secp256k1.

I have access to this sign_compact function which seems to be for Bitcoin:

https://github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin/ffi/secp256k1.rb#L207-L232

I'm trying to use this to sign for Ethereum but there seems to be some steps missing. Specifically, something to do with the head, r-value and s-value. Someone seems to be doing this properly using OpenSSL instead of secp256k1 here:

https://github.com/se3000/ruby-eth/blob/master/lib/eth/open_ssl.rb#L58-L97

The lines that seem to be different are:

if signature.get_array_of_pointer(0, 2).all?{|i| BN_num_bits(i) <= 256 }
  4.times{|i|
    head = [ Eth.v_base + i ].pack("C")
    if public_key_hex == recover_public_key_from_signature(hash, [head, r, s].join, i, pubkey_compressed)
      rec_id = i; break
     end
  }
end

How would I go about using the secp256k1 sign_compact function to sign Ethereum messages? Is there something I need to change for the signature? Or is there somewhere to find the protocol for this?


texts:
I'm following the first tutorial on Ethereum wallet. I have created a custom token (HelloWorldToken) based on the MyToken contract. The contract creation transaction has been validated but the tokens don't appear in my wallet. When I check the balance from the contract, everything seems fine. I can even transfer my tokens from my main account to my secondary account. But only using the contract transfer function.

How can I have my wallet display the custom token balance ?

I know you probably need some more info, but I don't know which ones. So apologies for the noobness.


texts: How to handle remaining funds after a crowdfund closes (from the tutorial)

texts:
The tutorial crowdfunding app has the following function:

/* checks if the goal or time limit has been reached and ends the campaign */
function checkGoalReached() afterDeadline {
    if (amountRaised >= fundingGoal){
        beneficiary.send(amountRaised);
        FundTransfer(beneficiary, amountRaised, false);
    } else {
        for (uint i = 0; i < funders.length; ++i) {
          funders[i].addr.send(funders[i].amount);
          FundTransfer(funders[i].addr, funders[i].amount, false);
        }
    }

    beneficiary.send(this.balance); // send any remaining balance to beneficiary anyway
    crowdsaleClosed = true;
}

If in the 'else' statement all the funders get the amount they funded back, how there can be any left over balance to send to the beneficiary?


texts: Are makeLog instruction functions opcodes or not?

texts:
The following code snippet is a constituent piece of the instructions.go file, where our lieblings opCodes all live.

// make log instruction function
func makeLog(size int) executionFunc {
    return func(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
        topics := make([]common.Hash, size)
        mStart, mSize := stack.pop(), stack.pop()
        for i := 0; i < size; i++ {
            topics[i] = common.BigToHash(stack.pop())
        }

        d := memory.Get(mStart.Int64(), mSize.Int64())
        evm.StateDB.AddLog(&types.Log{
            Address: contract.Address(),
            Topics:  topics,
            Data:    d,
            // This is a non-consensus field, but assigned here because
            // core/state doesn't know the current block number.
            BlockNumber: evm.BlockNumber.Uint64(),
        })

        evm.interpreter.intPool.put(mStart, mSize)
        return nil, nil
    }
}

// make push instruction function
func makePush(size uint64, pushByteSize int) executionFunc {
    return func(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
        codeLen := len(contract.Code)

        startMin := codeLen
        if int(*pc+1) < startMin {
            startMin = int(*pc + 1)
        }

        endMin := codeLen
        if startMin+pushByteSize < endMin {
            endMin = startMin + pushByteSize
        }

        integer := evm.interpreter.intPool.get()
        stack.push(integer.SetBytes(common.RightPadBytes(contract.Code[startMin:endMin], pushByteSize)))

        *pc += size
        return nil, nil
    }
}

// make push instruction function
func makeDup(size int64) executionFunc {
    return func(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
        stack.dup(evm.interpreter.intPool, int(size))
        return nil, nil
    }
}

// make swap instruction function
func makeSwap(size int64) executionFunc {
    // switch n + 1 otherwise n would be swapped with n
    size += 1
    return func(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
        stack.swap(int(size))
        return nil, nil
    }

The question is, are these make log instruction functions themselves opcodes?

If they are- why are they not called as such?

If not- what are they doing living in the file with all of the opCodes?


texts: Use same argument name in modifier and function

texts:
If I have a function

function b(address _foo) verifySomeClause {
}

and a modifier that can take different addresses as an argument, so that msg.sender can be one of those,

modifier c(address _foo) {
}

and the function modifier is called like this

function b(address _foo) verifySomeClause(_foo) {
}

and like this,

function b(address _foo) verifySomeClause(msg.sender) {
}

is there any problem with having the same argument name for the modifier and function?


texts:
Is it possible to have a mapping inside a struct for vyper? For example:

struct Teddy:
    id: uint256
    year: uint256
    component: map(uint256, uint256)

teddies: private(map(uint256, Teddy))

So for the above, component takes a component number as a key and returns the id of the component (e.g. component[0] = 1234, component[1] = 2438...).
If this is possible, how do you instantiate an instance if you do not not need to do anything initially for component. Would it be just:

def __init__():
    teddies[0].id = 0
    teddies[0].year = 2019


texts: Solidity Undeclared identifier. s not (or not yet) visible at this point. but it is

texts:
I'm making if else function and if price == stopOrder it should do executeOrder but it's giving me error
    function sellLogic() public {
        require(StopOrder != 0 || LimitOrder != 0, "stop order or LimitOrder are 0!");

        //if else to se if it will sell during the dump

        if (price >= LimitOrder){
            sell = true;

        }
        else if (price == StopOrder){
            executeOrder;

        }
        else {
            sell = false;
        }
}

 function executeOrder(uint orderId) external returns (uint[] memory) {
            sellLogic();

            Order memory order = orderBook[orderId];
            require(sell == true, "Price is lower than your limit order,or stop order didnt got reached");
            require(order.traderAddress != address(0), "Invalid order");
            require(order.orderState == OrderState.Created, 'Invalid order state');

            updateOrder(order, OrderState.Finished);

            address[] memory pair = new address[](2);
            pair[0] = order.assetIn;
            pair[1] = order.assetOut;

            uint[] memory swapResult;

            if (order.orderType == OrderType.EthForTokens) {
                swapResult = uniswapV2Router.swapExactETHForTokens{value:order.assetInOffered}(order.assetOutExpected, pair, order.traderAddress, block.timestamp);
                TransferHelper.safeTransferETH(stakeAddress, order.stake.mul(STAKE_PERCENTAGE).div(100));
                TransferHelper.safeTransferETH(owAddress, order.stake.mul(100-STAKE_PERCENTAGE).div(100));

            }
            else if (order.orderType == OrderType.TokensForEth) {
                TransferHelper.safeApprove(order.assetIn, address(uniswapV2Router), order.assetInOffered);
                swapResult = uniswapV2Router.swapExactTokensForETH(order.assetInOffered, order.assetOutExpected, pair, order.traderAddress, block.timestamp);
                }

            else if (order.orderType == OrderType.TokensForTokens) {
                TransferHelper.safeApprove(order.assetIn, address(uniswapV2Router), order.assetInOffered);
                swapResult = uniswapV2Router.swapExactTokensForTokens(order.assetInOffered, order.assetOutExpected, pair, order.traderAddress, block.timestamp);
                }

            TransferHelper.safeTransferETH(msg.sender, order.executorFee);
            emit logOrderExecuted(order.id, msg.sender, swapResult);

            return swapResult;

    }


texts:
I am using Infura, Ropsten Test network, Web3@0.20 in the back-end of my Express website. I want to listen events in my ERC20 contract. I tried a lot of methods, but still failed. How do I revise it? Thanks a lot.

contract.Transfer({}, { fromBlock: 0, toBlock: 'latest' }).get((error,
eventResult) => {
  if (error)
      console.log('Error in myEvent event handler: ' + error);
  else
      console.log('myEvent: ' + JSON.stringify(eventResult.args));
});


texts: How do large Ethereum dapps get iteratively developed?

texts:
There are some extremely large projects on the Ethereum blockchain, like Augur. These dapps aren't short 100-line smart contracts, and are not uploaded once to the blockchain and done.
Question: how are new features of a dapp iteratively released to the blockchain? One option is that contracts can be updated through a pointer-to-implementation idiom, where the contract owner can update the original contract to delegate its execution to newer contract addresses, but even then, that feels like it'd become spaghetti really quickly in large projects.


texts: ICO crypto-currencies accepted during the sale: ETH, BTC, or even fiat?

texts:
ICO contracts are meant to accept Ether as payin for the tokens sold, for example https://cartaxi.io/pre-ico or https://www.herocoin.io/

But there are a lot of ICOs running on Ethereum that accept BTC and even fiat money. For example, https://blackmooncrypto.com/ accepts BTC, ETH and LTC. How is that possible?

The ICO contract payable endpoint that delivers tokens accepts only Ethers. If an investor wants to buy tokens using Bitcoins, must he first exchange them into Ethers? Or is the very ICO organizer who performs the exchange task?

Is BTC Relay http://btcrelay.org/ a reliable, advisable solution to this problem?

Same question for fiat? Thx!

Refs.:

How are Tokens issued to Bitcoin investors for ICO based on Ethereum
Is it possible to create ICO crowdsale seamlessly accepting multiple assets?


texts:
Is there a way to sign some data right out from a smart contract?
Let's say I want to create a smart contract, that will represent my Digital Identity and I want it to have sign() method. Maybe something like this:

pragma solidity ^0.4.24;

contract DID {

address owner;

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

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

function sign(string _msgToBeSigned) public onlyOwner returns (bytes32) {
    // here to sign the message
    // and here to return the signed message
}

function verify(bytes32 _signedMessage) public view returns (bool) {
    // here to verify if owner == ecrecover(..., v, r, s)
    // here to return true or false
}

}

So the question is:
Is it possible to perform these two actions from within a smart contract without use of client code like web3.eth.sign()?

Thank you.


texts: Error While Compiling In Remix During Tutorial

texts:
During a tutorial on my first compile I received this error:

:1:1: Parser error: Expected import directive or contract definition.
pragma solidity ^0.5.12;
^

What's that about? How do I fix it? I'm an absolute beginner with ready to make his first dapp with illustrated assets and marketing ready to go.

Mentors and partners welcome.


texts:
I understand there are accounts and we unlock them in geth/eth. If we are providing a service to a user community what is the design pattern envisaged to enable users to perform transactions under their own accounts?

I am led to believe you cannot unlock an account in the web3 API. Maybe I am not understanding something but I am struggling to see how to provide a service to a user base.

I want to enable my users to create instances of my prescribed contracts and have their counterparties collaborate with functions on that contract.


texts: Run geth looking for peers forever on AWS

texts:
I am new on blockchain.. sorry for asking very basic question:
I am running my first geth private node on AWS using ubuntu using this command:
geth --datadir ~/ethdata/ --networkid 12345 --verbosity 3 --ipcdisable --rpc --port 30301 --rpcport 8545 --rpcaddr ec2-3-238-204-220.compute-1.amazonaws.com console 2 >> ~/ethdata/eth.log

My code is running for ages. Is there something I should do?

INFO [04-08|12:15:48.358] Looking for peers
peercount=0 tried=99  static=0 ERROR[04-08|12:15:58.263] Snapshot
extension registration failed   peer=89027a8b err="peer connected on
snap without compatible eth support"


texts:
I don't understand how a client works. I try to explain my doubts. Since a client in the classic client-server paradigm is a lightweight application, I don't understand how this application can use the blockchain technologies. A smart contract client is a final user that could use his smartphone to access to contract API. To do this, of course, is impossible to download the blockchain on the smartphone. So, I don't understand how this client can use the smart contract without downloading a BC.

Moreover, web3js (just for citing a library) is only for nodeJS and the initialization downloads the blockchain or there are some mechanisms to avoid the download and run it on a browser like, sorry for the stupid parallelism, Angular or JQuery does? In order to imagine some application on mobile device.


texts:
I tried to de-compiled a code from Etherscan which is not yet verified. I understood most of the part from code but I got totally confused. Can anyone tell me what this function doing.
   function unknownfunction(address varg0, uint256 varg1) public payable {
        v0 = new bytes[](varg1.length);
        v1 = msg.data.length;
        CALLDATACOPY(v0.data, 36 + varg1, varg1.length);
        require(msg.sender == _owner);
        v2 = v3 = 0;
        while (v2 < v0.length) {
            MEM[v2 + v4.data] = MEM[v2 + v0.data];
            v2 += 32;
        }
        v5 = v6 = v0.length + v4.data;
        if (0x1f & v0.length) {
            MEM[v6 - (0x1f & v0.length)] = ~(256 ** (32 - (0x1f & v0.length)) - 1) & MEM[v6 - (0x1f & v0.length)];
        }
        v7 = varg0.call(v4.data).value(msg.value).gas(msg.gas);
        require(v7);
    }

For reference this is entire code:
// Data structures and variables inferred from the use of storage instructions
uint256 _owner; // STORAGE[0x0] bytes 0 to 19

// Events
Deposit(address, address, uint256);
OwnershipTransferred(address, address);

**function unknownfunction(address varg0, uint256 varg1) public payable {
    v0 = new bytes[](varg1.length);
    v1 = msg.data.length;
    CALLDATACOPY(v0.data, 36 + varg1, varg1.length);
    require(msg.sender == _owner);
    v2 = v3 = 0;
    while (v2 < v0.length) {
        MEM[v2 + v4.data] = MEM[v2 + v0.data];
        v2 += 32;
    }
    v5 = v6 = v0.length + v4.data;
    if (0x1f & v0.length) {
        MEM[v6 - (0x1f & v0.length)] = ~(256 ** (32 - (0x1f & v0.length)) - 1) & MEM[v6 - (0x1f & v0.length)];
    }
    v7 = varg0.call(v4.data).value(msg.value).gas(msg.gas);
    require(v7);
}**

function transferOwnership(address varg0) public nonPayable {
    require(msg.sender == _owner);
    require(varg0);
    emit OwnershipTransferred(_owner, varg0);
    _owner = varg0;
}

function fallback() public payable {
    v0 = _owner.call().value(msg.value).gas(msg.gas);
    require(v0);
    emit Deposit(msg.sender, _owner, msg.value);
}

function transferToOwner(address varg0, uint256 varg1) public nonPayable {
    require(msg.sender == _owner);
    require(varg0.code.size);
    v0 = varg0.transfer(_owner, varg1).gas(msg.gas);
    require(v0); // checks call status, propagates error data on error
}

function owner() public nonPayable {
    return _owner;
}

// Note: The function selector is not present in the original solidity code.
// However, we display it for the sake of completeness.

function __function_selector__(uint32 function_selector) public payable {
    MEM[64] = 128;
    if (msg.data.length >= 4) {
        if (function_selector == 0x8568523a) {
            transferToOwner(address,uint256);
        } else if (0x8da5cb5b == function_selector) {
            owner();
        } else if (0xb76ea962 == function_selector) {
            0xb76ea962();
        } else if (0xf2fde38b == function_selector) {
            transferOwnership(address);
        }
    }
    fallback();
}

Contract link : EtherScan


texts:
eloiim:~ iivri.andre$ brew install eris docker-machine virtualbox
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
megatools

Error: No available formula with the name "virtualbox"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
These formulae were found in taps:
Caskroom/cask/virtualbox-extension-pack
Caskroom/cask/virtualbox
Caskroom/versions/virtualbox-beta
Caskroom/versions/virtualbox-extension-pack-beta
To install one of them, run (for example):
brew install Caskroom/cask/virtualbox-extension-pack

THIS is the error I am getting when trying to install eris. How do I fix this ?


texts:
Taking this ERC-20 Contract standar structure:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol
Its it unalterable by developer?
Could I change the name of contract (without ERC20)?
Could I change the name os structure of mappings variables?
Could I change the events structure? Could I remove the events? Could I change the events name?
What is the EVM real standar and unalterable ERC-20 for proper functioning of a token?


texts: Can anyone point me in the direction of how to figure this out. I have a erc20 that I created. I want the website to generate a wallet that sees this new token upon creation and to be stored on the website. I can't seem to find out how to do this.


texts:
I want to use delegatecall in one function to populate an event from the contract I'm calling. Here's a minimal example:

contract Caller {
    address public callee;

    function Caller(address _callee) {
        callee = _callee;
    }

    function delegate() {
        callee.delegatecall(bytes4(keccak256("call()")));
    }
}

contract Callee {
    function call() {
        Log(msg.sender);
    }
    event Log(address sender);
  }

However, the receipt I get in my truffle contracts return an empty array for the logs. Does delegatecall not push the log into the receipt?

I want to be able to "return" a value from the delegatecall.


texts: Make sure payable function receives the same ether amount in USD?

texts: I want to enforce that a public payable function in my contract always charges $25 in ether. Is it feasible to create a function that does this? I know I might need to use an oracle but I'm not sure how to do this, thanks.


texts:
I have some basic questions about implementing Tokens. I want to use the ERC20 standard, which defines the following interfaces:

balanceOf(address _owner) constant returns (uint256 balance)
transfer(address _to, uint256 _value) returns (bool success)

Therefore i must somehow save, which address has got how many tokens. I looked around the internet and they implement it alwasy with an array definded by "mapping (address => uint256) public balanceOf". I know how to implement the transfer(..) function with this array, but i still i have two questions:

The array balanceOf becomes bigger and bigger when more addresses own Tokens. Isn't there a risk, that the array becomes so big that i can't search users in it anymore because of the gas limit of a block?
The array balanceOf is some kind of user registration, which i don't want. Is there a way how i can send tokens directly to a user wallet? If yes, how would it look like in solidity?

Thanks for your help,
DerBär


texts: UnimplementedFeatureError: Copying of type struct Question memory[] memory to storage not yet supported

texts:
How can I resolve this error: "UnimplementedFeatureError: Copying of type struct EthereumOpinionRewards.Question memory[] memory to storage not yet supported"? My code is provided below.
pragma solidity >=0.5.0 <0.6.0;

contract EthereumOpinionRewards {

uint count = 0;

mapping (address => uint) private EthereumPoints;

mapping (address => Question[]) private a;
mapping (uint => Question[]) private b;

mapping (string => uint) private answers;

struct Question {
  string question;
  string[] options;
  uint limit;
  address[] participants;
}

function exchangeEther(uint amount) public {
  assert(msg.sender.balance >= amount);

  address(this).call.value(amount);
  EthereumPoints[msg.sender] = EthereumPoints[msg.sender] + amount;
}

function exchangeEthereumPoints(uint amount) public{
  assert(EthereumPoints[msg.sender] >= amount);

  msg.sender.call.value(amount);
  EthereumPoints[msg.sender] = EthereumPoints[msg.sender] - amount;
}

function createSurvey() public {
  count = count + 1;
  a[msg.sender] = new Question[](0);
  b[count] = a[msg.sender];
}

function addQuestion(string memory question, uint limit) public {
  assert(EthereumPoints[msg.sender] > a[msg.sender].length * 1000 * limit);
  assert(bytes(question).length > 0 && bytes(question).length < 500);

  a[msg.sender].push(Question(question, new string[](0), limit, new address[](0)));
}

function addOptions(uint x, string memory option) public {
  assert(x <= a[msg.sender].length);
  assert(bytes(option).length > 0 && bytes(option).length < 500);

  a[msg.sender][x].options.push(option);
}

function terminateSurvey() public {
  delete a[msg.sender];
}

function answerQuestion(uint x, uint y, uint response) public {
  answers[b[x][y].question] = response;
  b[x][y].participants.push(msg.sender);
}

function reward(uint x, uint y) public {
  for (y = 0; y < a[msg.sender][x].participants.length; y++) {
    EthereumPoints[msg.sender] = EthereumPoints[msg.sender] - 1000;
    EthereumPoints[a[msg.sender][x].participants[y]] = EthereumPoints[a[msg.sender][x].participants[y]] + 1000;
  }
}

}


texts: Back of the envelope Oraclize callback cost calculations for

texts:
How does one do a back of the envelope calculation about how much the Oraclize callback will cost? Does it cost more if a query is returning a large amount versus a small amount of data? Does it cost more if you are asking Oraclize to search for specific json keys in the result of your query? For example, does the callback for

xml(http://rss.cnn.com/rss/cnn_topstories.rss).rss.channel.item.0.title

cost more than

xml(http://rss.cnn.com/rss/cnn_topstories.rss).rss

?

Or does it only depend on the computation associated with your actual __callback function?


texts: Unlocking account web3.js 1.0 on AWS Lambda

texts:
I'm getting following error message when trying to unlock account on AWS Lambda:

Error: Node error: {"code":-32601,"message":"The method personal_unlockAccount does not exist/is not available"}
    at Function.validate (/var/task/node_modules/web3-providers/dist/web3-providers.cjs.js:111:18)
    at HttpProvider._callee$ (/var/task/node_modules/web3-providers/dist/web3-providers.cjs.js:674:61)
    at tryCatch (/var/task/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/var/task/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.(anonymous function) [as next] (/var/task/node_modules/regenerator-runtime/runtime.js:97:21)
    at asyncGeneratorStep (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
    at _next (/var/task/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

'use strict';

const AWS = require('aws-sdk');
AWS.config.update({region: 'ap-northeast-1'});
const documentClient = new AWS.DynamoDB.DocumentClient();

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider(process.env['INFURA_ENDPOINT']));
const abiSource = require('./lib/myToken.json');
const abi = abiSource.abi;
const contractAddress = process.env['CONTRACT_ADDRESS'];
const myToken = web3.eth.Contract(abi, contractAddress);

.
.
.

exports.handler = async (event, context) => {
  event = event.body || event;
  const senderAddress = event.sender_address;
  const privateKey = event.private_key;
  try{
    await web3.eth.personal.unlockAccount(senderAddress, privateKey, 600);
  }catch(error){
    console.log(error);
    return getResponse(200, 'Internal server error');
  }

  .
  .
  .
};

My contract is deployed on Ropsten network,
Although I have some code for processing transaction in following, which raises same error.
Any ideas how to fix that / what the cause of error is?

Node version: 8.0 Web3: 1.0.0-beta50

Thanks in advance!


texts: Is there any way to get all token transfers of a specific block number?

texts:
I am looking for a way to get all erc20 token transfers with specifying block number only.

For ETH there is already a way exists here.

I have done some search and found this method to find transfers of a specific address.

https://api.etherscan.io/api?module=account&action=tokentx&sort=desc&address=SOME_ADDRESS&startblock=BLOCK_NUMBER

Is there any way to list all token transfers of a specific block by just providing a block number as a parameter in any way ?


texts:
I am thinking about getting all the data from the block which is stored from 1st transaction.

Assume we have done 4 txns from an address to another address
and the data passed/saved in block for each transaction.

Now , i want to retrieve the data of all transaction from 1st to 4th txn (like history of data stored or passed between FROM and TO address or in block).

I tried getting the data from blocks using BLOCK and TRANSACTION object but it all gives HASH and not the raw data.

Currently working using Javascript,HTML, Geth and web3 for basic implementation.

Suggest if there is any ready API

UPDATE

Sample problem

let's assume each txn stores data of firstName and address of some person. Txn1 - "A" "place1" , Txn2 - "B" "place2" , Txn3 - "C" "place3" , Txn4 - "D" "place4".. now w.r.t the txn hash or anything of that kind i need to retrieve - A place1, B place2, C place3 ,D place4( the data stored at particular txn)


texts: Which node to use in Merkle Patricia Tree when there are single and shared nibbles at the same point?

texts:
If I understood well, extension and leaf nodes should be used when there are shared nibbles, and branch nodes when there are differences.

Which type of node should be used when storing a different nibble and a shared one at the same point?

For instance, what would be the type of node used in the root for these data:

'ac4f' : 'data1', //shared nibbles 'ac'
'ac03' : 'data2', //shared nibbles 'ac'
'5e5f' : 'data3'  //different nibble '5'


texts: I can not get geth commands to work. I read a lot of information that says use "this" command for "this". Such as --upgradedb or --removedb. These are not working. They reason im trying these different commands is something is going on with my ethminer not working for anything and Im trying to figure out what files I can delete that might be causing a problem or be corrupt and if some geth folders or databases is causing a problem with ethminer. Also if I --remove data base does this delete the blockchain and have to download again?


texts: What should be the input for getStorageAt function in web3 js?

texts: I am trying to trace history of transactions in ethereum. I am using a function called getStorageAt(). Now what should be the input to this function, a contract address or account address(account no)?


texts: The Ropsten bootnodes of the Eth Foundation are down, can anybody share any other?

texts:
Running geth in verbose 5 mode, I get this:

TRACE[01-11|12:45:26] Dial task done                           task="discovery lookup"
TRACE[01-11|12:45:26] Skipping dial candidate                  id=6ce05930c72abc63 addr=13.84.180.240:30303 err="recently dialed"
TRACE[01-11|12:45:26] New dial task                            task="discovery lookup"
TRACE[01-11|12:45:29] Starting bonding ping/pong               id=6ce05930c72abc63 known=false failcount=0 age=421020h45m29.948607054s
TRACE[01-11|12:45:29] Starting bonding ping/pong               id=20c9ad97c081d633 known=false failcount=0 age=421020h45m29.948655691s
TRACE[01-11|12:45:29] >> PING/v4                               addr=13.84.180.240:30303 err=nil
TRACE[01-11|12:45:29] >> PING/v4                               addr=52.169.14.227:30303 err=nil
DEBUG[01-11|12:45:30] No discv4 seed nodes found
TRACE[01-11|12:45:30] Dial task done                           task="discovery lookup"
TRACE[01-11|12:45:30] Skipping dial candidate                  id=20c9ad97c081d633 addr=52.169.14.227:30303 err="recently dialed"
TRACE[01-11|12:45:30] New dial task                            task="discovery lookup"
TRACE[01-11|12:45:33] Starting bonding ping/pong               id=6ce05930c72abc63 known=false failcount=0 age=421020h45m33.955656378s
TRACE[01-11|12:45:33] Starting bonding ping/pong               id=20c9ad97c081d633 known=false failcount=0 age=421020h45m33.955745485s
TRACE[01-11|12:45:33] >> PING/v4                               addr=13.84.180.240:30303 err=nil
TRACE[01-11|12:45:33] >> PING/v4                               addr=52.169.14.227:30303 err=nil

The command I use to start geth is this one:

geth --testnet --rpc --fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"  --verbosity 5

Thanks!


texts: web3js get all properties of contract in one promise

texts:
I'm implementing an app with a Factory design pattern. My Factory is creating instances of myContract, that I load thanks to myContract.at(address) like below:

this.myContract = TruffleContract(Contract)
this.myContract .setProvider(this.web3Provider)
this.myContractABI = this.web3.eth.contract(this.leaseContract.abi.abi);
this.myContractInstance = this.myContract.at(leaseAddress)

This is working fine! I can then get my properties from a promise:

this.myContractInstance.propertyContract().then((propertyContract) => {
          this.setState({ property = propertyContract })
        })

This works fine!

But the problem is that I've 15 properties in my smart contract.
If I have to get them one by one I'm thinking it's ugly code and it's not really efficient?

Can I get a promise on the whole smart contract and get all my properties in one promise ?
Something like this maybe:

this.myContract.at(leaseAddress).then((contractInstance) => {

  this.setState({ propertyA = contractInstance.propertyA })
  this.setState({ propertyB = contractInstance.propertyA })
  this.setState({ propertyC = contractInstance.propertyA })
  etc...
})

I think you get the idea :) Is that possible?

Thanks!


texts: Truffle Migrate Rinkeby - Error: PollingBlockTracker - encountered an error while attempting to update latest block: Error: ETIMEDOUT

texts: I am facing this error when on running truffle migrate on Rinkeby network with my infura


texts: Retrieve CHAIN_ID of the executing chain from a Solidity contract

texts:
Is there a way to directly be able to retrieve CHAIN_ID information about the executing chain from a smart contract?

I know that for any chain that has EIP-155 implemented, CHAIN_IDs are retrievable from the v component of a signature but would require the passing of one for extraction.

Since CHAIN_ID is information about the chain I suspect that there should be a way to access this. Is there a way for Solidity to directly get this information?


texts: Why return to String need so many operations when develop a smart contract?


texts: Is it possible to establish a conditional gas limit in a transaction?

texts:
Imagine a contract that rewards the first user that publish a specific big piece of data into the blockchain. The transaction may cost an appreciable cost if the information size is big.  The problem for the publisher is that he must specify a high gas limit that may lose if there is another publisher that sends a transaction at the same moment and miners inserts that transaction before the first's one.

Is there a way to say to the miners to accept only transactions if no other transaction is send to a contract in the same block?

I was also thinking in a contract with two steps:

The first one to reserve a slot to publish with a deposit
A second step to actually publish it.

The problems of this strategy is that it will add a publication delay, and fill the blockchain with more transactions. Imagine the case where there are hundreds of possible publishers.


texts:
function encodePackedTest(address a, uint b, string c) public pure returns(bytes32, bytes32){
    return (keccak256(a, b, c), keccak256(abi.encodePacked(a, b, c)));
}

From the results of the function, the returned value is the same, is it necessary for abi.encodePacked to use it?


texts:
I am passing an array of addresses into a contract from a parent contract. Using that I am generating a mapping with those address to quickly verify the msg.sender is part of the set mappings.

To check if a msg.sender is part of the mappings I am using the restricted modifier.

contract Upload{

    mapping(address => bool) managerAddresses;
    string public ownerName;
    string public location;

    modifier restricted(){
        require(managerAddresses[msg.sender]);
        _;
    }

    constructor(address[] _managerAddressesArr,string _ownerName,string _location)  public {
        for(uint i = 0;i<_managerAddressesArr.length;i++){
            managerAddresses[_managerAddressesArr[i]] = true;
        }
        ownerName = _ownerName;
    }

    function setLocation(string _location) restricted public{
        location = _location;
    }

}

But the setLocation function is unable to change the location when the restricted modifier is on and the transaction is mined but doesn't execte.
Even though the address passed by the managerAddressesArr are correct and without the modifier I can execute the functions.

Also solidity gives a

  Gas requirement of function Upload.setLocation(string) high:
  infinite

Does anyone have any idea whats wrong with the restricted modifier?


texts: XMLHttpRequest() does not work probably in a Truffle project

texts:
I want to connect to my smart contract in a Truffle project and get some information from it. The smart contract's name is "TEST". The follow is my app.js code that should communicate with my smart contract:
var Web3=require("web3");
var web3= new Web3('ws://localhost:8545');
   web3.eth.getAccounts().then(console.log);
let request=new XMLHttpRequest();
    request.open("GET","E:\Emrooz\build\contracts\TEST.json");
    request.send(null);
var jsonFile=JSON.parse(request.responseText);
var myContract=new
    web3.eth.Contract(jsonFile,"0xC8129A44979263D578A8BD52d403d6537820e969",{
    account:"0xeB2a9E0338616e35B5e844Bd38924C79D99d7346", balance:"99.98990494"});
var acc=myContract.defaultAccount;
    console.log(acc.toString());

Here, "Emrooz" is name of file of Truffle project. But when i complie app.js with Nodejs the following error occurrs:

Even, i added var XMLHttpRequest=require('xmlhttprequest').XMLHttpRequest; to the code but that error occurrs again. Whats the problem? What should i do?


texts: I have a four node setup and have get method in smartcontract to get the status of certain application. Currently the api invocation is happening at any node ( any of  four nodes). For example if one of the node is syncing to other nodes ( was down for some time) in the network and if my api call is triggered at the syncing node the data which I am getting won't be the latest one. So is there anyway to identify the node is in sync with network and then perform the api get call or am I wrong with my understatnding.


texts: Ganache-cli Fork unlocked account to make transactions

texts:
I'm trying to use ganache-cli on a fork of the Main Network.
I use the following command to start ganache.
ganache-cli --fork https://mainnet.infura.io/v3/MY_API_KEY -- unlock 0x6EBaF477F83E055589C1188bCC6DDCCD8C9B131a
Ganache will still give me the 10 account and non of them have this address.
This account is not mine but has a lot of ether in it. So how do I work on the fork with this account?
Truffle will also see me as the first ganache account. And contract deployment will be made under this address and not the one I unlocked.
How do I work from this account without the private key?
It' seam like truffle isn't seeing this unlocked account.


texts:
I have a function in my contract which normally return uint

function insertPerson(
  bytes32 personAddress,
  bytes32 email,
  bytes32 fname,
  bytes32 lname)
  public
  returns(uint index)
{
  if(isPerson(personAddress)) return;
  persons[personAddress].email     = email;
  persons[personAddress].fname     = fname;
  persons[personAddress].lname     = lname;
  persons[personAddress].index     = personIndex.push(personAddress)-1;
  LogNewPerson(
    personAddress,
    persons[personAddress].index,
    email,
    fname,
    lname);
  return personIndex.length-1;
}

but instead of getting the index i'm getting information about the transaction something like this

{"tx":"0xcfe28fe4cffeb7aa97c2db856920f7a3275d55a656f0550e7f78b76d446970b8","receipt":{"transactionHash":"0xcfe28fe4cffeb7aa97c2db856920f7a3275d55a656f0550e7f78b76d446970b8","transactionIndex":0,"blockHash":"0xcaa35831f7652155de33af8a349e4d5727026d20ec2f280c45d5a8109c8ca1e4","blockNumber":14,"gasUsed":134146,"cumulativeGasUsed":134146,"contractAddress":null,"logs":[{"logIndex":0,"transactionIndex":0,"transactionHash":"0xcfe28fe4cffeb7aa97c2db856920f7a3275d55a656f0550e7f78b76d446970b8","blockHash":"0xcaa35831f7652155de33af8a349e4d5727026d20ec2f280c45d5a8109c8ca1e4","blockNumber":14,"address":"0xf3b5fccbaea5a0bd10542d13c58d808e18aaef9f","data":"0x0000000000000000000000000000000000000000000000000000000000000008646576407369622e636f6d000000000000000000000000000000000000000000646576000000000000000000000000000000000000000000000000000000000061646d696e000000000000000000000000000000000000000000000000000000","topics":["0xa7cb2773240099bbe7a853382f1c2141cd85ac771e1ca8b9c8778fa5a901076e","0x3035343734393837000000000000000000000000000000000000000000000000"],"type":"mined"}],"status":1},"logs":[{"logIndex":0,"transactionIndex":0,"transactionHash":"0xcfe28fe4cffeb7aa97c2db856920f7a3275d55a656f0550e7f78b76d446970b8","blockHash":"0xcaa35831f7652155de33af8a349e4d5727026d20ec2f280c45d5a8109c8ca1e4","blockNumber":14,"address":"0xf3b5fccbaea5a0bd10542d13c58d808e18aaef9f","type":"mined","event":"LogNewPerson","args":{"personAddress":"0x3035343734393837000000000000000000000000000000000000000000000000","index":"8","email":"0x646576407369622e636f6d000000000000000000000000000000000000000000","fname":"0x6465760000000000000000000000000000000000000000000000000000000000","lname":"0x61646d696e000000000000000000000000000000000000000000000000000000"}}]}

can someone help me please,
thanks.


texts: SAI - DAI Symbol Not Captured Right Web3.py

texts:
trying to capture the symbol of the receipts of transaction using web3.py. I am getting the DAI, DAI and DAI... while this should return SAI, SAI, DAI. Although, I checked that the correct SAI contract is being picked up under the logs of the transaction. Can someone tell me if this is a bug in my code or a bug with how web3.py pick up the symbol from the node?

import json
import urllib.request
from web3 import Web3
import web3

provider = Web3.HTTPProvider('https://mainnet.infura.io/v3/XXXXXXXXXXXXXXXXXXX')
w3 = Web3(provider)
ether_scan_api ='XXXXXXXXXXXXXXXXXXXXXXXX'
tx_hash = '0x52caaf79bf913064a70a6c9d917fd4190cdb099fe79e7d3a9dfe0600e1cfbc81'
receipt=  w3.eth.getTransactionReceipt(tx_hash)
transfer_event = "Transfer(address,address,uint256)"
transfer_event_hashed = w3.keccak(text=transfer_event)
transactions = list()

def get_abi(erc_20_address):
    requrl  = 'https://api.etherscan.io/api?module=contract&action=getabi&address='+erc_20_address+'&apikey='+ ether_scan_api
    while True:
        with urllib.request.urlopen(requrl) as url:
            if url.code != 200:
                raise NotImplementedError('I don\'t know how to handle HTTP code {} :('.format(url.code))
            else:
                result = json.loads(url.read())

                if result['status'] == '1':
                    break
    return  json.loads(result['result'])

for log in receipt.logs:
    if log["topics"][0]==transfer_event_hashed:
        contract_address = w3.eth.web3.toChecksumAddress(log["address"])
        token_contract = w3.eth.contract(address=contract_address ,abi=get_abi(contract_address))
        symbol = str(token_contract.functions.symbol().call()[:3])
        print(symbol)

Printing the receipt returns this

AttributeDict({'address': '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359',
 'blockHash': HexBytes('0x9e48b35141e53758171239d618a02a9a0e073506b12a5fecca59240c0e032487'),
 'blockNumber': 9560511,
 'data': '0x00000000000000000000000000000000000000000000000000d529ae9e860000',
 'logIndex': 156,
 'removed': False,
 'topics': [HexBytes('0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'),
  HexBytes('0x00000000000000000000000017b11c26f6cb263864610379a6ebec29da49aa2d'),
  HexBytes('0x000000000000000000000000c73e0383f3aff3215e6f04b0331d58cecf0ab849')],
 'transactionHash': HexBytes('0x52caaf79bf913064a70a6c9d917fd4190cdb099fe79e7d3a9dfe0600e1cfbc81'),
 'transactionIndex': 111})


texts: How to specify Truffle contracts directory

texts:
I am looking to use Truffle for testing.

For JS tests (in test/*.js), Truffle expects (requires?) all my solidity files (mocks, contracts) to be located in contracts/.

I would prefer if my mocks live in test/mocks to reduce confusion of people that are reading contracts/ and don't care about my test mocks.

It is possible for a Truffle JS test to references Solidity mocks OUTSIDE of the contracts/ folder?


texts: Truffle exits with "Error: The contract code couldn't be stored, please check your gas amount." error when migrating the 1_initial_migration.js

texts:
I am trying to migrate the basic truffle example (the one created via truffle init) to rospten using Parity but I get the following error even thought the contract is correctly deployed on Rospten:

  Using network 'development'.

  Running migration: 1_initial_migration.js   Deploying Migrations...
  ... 0x3f8cd1b1e98935feb4616e810f4ce0d6ebfbd7355ea8a8e9695a490173d8446e

  Error encountered, bailing. Network state unknown. Review successful
  transactions manually.
  Error: The contract code couldn't be stored, please check your gas amount.
      at Object.callback (/usr/lib/node_modules/truffle/buil/cli.bundled.js:218485:46)

at /usr/lib/node_modules/truffle/build/cli.bundled.js:34886:25
at /usr/lib/node_modules/truffle/build/cli.bundled.js:220423:9
at /usr/lib/node_modules/truffle/build/cli.bundled.js:72910:11
at /usr/lib/node_modules/truffle/build/cli.bundled.js:204149:9
at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:205574:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:73069:18)
at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:73359:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:73514:12)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:73474:24)

As you can see from here the contract is correctly deployed: https://ropsten.etherscan.io/tx/0x3f8cd1b1e98935feb4616e810f4ce0d6ebfbd7355ea8a8e9695a490173d8446e

This is the code for 1_initial_migrations.js:

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

module.exports = function(deployer) {
  deployer.deploy(Migrations, {from: "0x004995b1caD48E77e7A53e535Bb82c8189B80632", gas:2000000});
};


texts: Best Practices for Verifying Ownership of an NFT ERC-721 Token

texts:
I am developing a Smart Contract (SC) and a front-end Dapp which will be used to sell some NFT ERC-721 tokens. When a user/address buys one of the NFT tokens, the token will be minted to his benefit by the SC, while my Dapp will register the said purchase in a local database. Considering that a user could potentially sell his token at a later date without going through my front-end Dapp, what is the best practice to synchronise the token ownership for a specific user, found in the SC with my local database? Should I query the SC every time the user accesses the site and wishes to display his tokens owned in the front-end Dapp? Wouldn't this take too long? Should I query the SC only if the user tries to sell one of his tokens in order to verify if he is the legitimate owner?
Thank you. J


texts: Implementing ERC-20 token as main payment method on website - hiring

texts:
I own a content writing self-service platform and want to start my own ERC-20 token that becomes the main payment method.

The process currently works like this (with fiat):

1) Client pays through Paypal in dollars
2) Client places an order and funds get frozen
3) Writer accepts job and submits work
4) Client approves the work and funds are released (to the writer)

I want to change this to:

1) Client buys tokens at the platform or at an external exchange
2) 0.1% from funds that client sends to the platform are deducted
2a) This 0.1% ends up in platforms account to take care of gas payments
3) Client places order, funds go to escrow account
4) Writer accepts job / submits work
5) Client approves work and tokens are released to writer
6) Writer cashes out their tokens at external exchange or keeps them.

However I have no idea how to make this work so I'm looking for someone that can help me with this and sent me a quote.

I understand this is perhaps not the way this exchange section works but I figured this is the best place to get started.

I'm familiar with PHP and a tiny bit of jQuery but that's about it. The platform itself is 99.9% PHP.


texts: goethereum getting publicKeyBytes from given public key

texts:
Trying to follow this documentation on verifying a signature: https://goethereumbook.org/signature-verify/

Where I am a bit confused is this line:

publicKeyBytes := crypto.FromECDSAPub(publicKeyECDSA)

How do you get publicKeyECDSA from a given public key such as:

0x99877b0ab19d67ec313842df746Ce7Cd99BAADfD

At the top of the documentation it reads you need "3 things to verify the signature: the signature, the hash of the original data, and the public key of the signer." However the publicKeyECDSA is not the public key as shown above. How can I get the provided public key into the publicKeyBytes?

There is an example a bit lower on the page that does this:

publicKey := privateKey.Public()
publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey)

but you need the private key initially to get this. But if I am trying to verify a signature of some unknown address, I wont have their private key.


texts: what does "Depth" column mean(VM Trace Transaction)?

texts:
What does "Depth" column  mean in VM Trace Transaction ?

How it is for opcodes?

for example here: https://rinkeby.etherscan.io/vmtrace?txhash=0xbb7323b02276aeed76b22fa50e2eefb76d5647560b8c15f23541ec5990d0e855


texts: When we have to annotate that function is payable in smart contract?

texts:
I have used solidity smart contracts since 3 months ago,  but I never used the decorator "payable".

Is it sometimes necessary to use a payable function?


texts: How to get notify if transaction got failed, dropped, or successes

texts:
I am new in dapps world and I want to deduct balance/points when a user buys an item currently I am unable to update balance because sometimes transaction got failed, dropped, or successes after 30 seconds to 2 minutes time, so how to subscribe or listen to transaction event than I can perform some action.

redeemPoints(from, to, price, (err, res) => {
    if(!err){
      console.log(res) //old value of balance
    }
})

Thanks in Advance.


texts: Difference between address parameter and contract parameter?

texts:
Suppose we have a contract Foo and another contract Bar that receives the address of some instance of Foo in its constructor.

Is there a difference (in functionality or gas usage) between doing:

function Bar(address _foo) public {
  foo = Foo(_foo)
}

and

function Bar(Foo _foo) public {
  foo = _foo
}


texts: Two wallets running on same keystore file?

texts: I created a wallet @ myetherwallet. I received some ethers here and it worked fine. But I didn´t understand where the ethers were at first, so I openend another wallet locally on my mac: ethereum wallet. It shows 0 ethers when I import the same keystore file I use with myetherwallet online. I bought some new ethers now, in which wallet will they show up as they are being sent to the keystore address that is used by both wallets?


texts: web3.eth.net.isListening() throws Error: Invalid JSON RPC response: "" (web3@1.3.4)

texts:
I am using the latest web3 version 1.3.4.
When I connect to web3 and print web3 I get the following response.

But when I try to execute the command web3.eth.net.isListening().then(console.log). I get the following error.

Not only for this command but any command executed to fetch details from the Network shows the same error. Commands like web3.eth.getAccounts(), web3.eth.getCoinbase(), etc.
Network Configuration
Local Quorum Node : quorum-v2.4.0
Geth Version: v1.8.18
web3: v1.3.4

Can anyone please help me with a solution.


texts: Pushing A Struct Instance Into An Struct Array Of A Different Struct Mapping

texts:
How can I push a struct instance into a mapping which contains a distinct struct which contains a struct array of the attempted struct instance type?

Example:

contract NewBook {

    struct ChapterData {
        string chapterID;
        string title;
        uint pages;
    }

    struct BookData {
        string bookID;
        ChapterData[] chapters;
    }

    mapping(string => BookData) public books;

    //This is where the problem occurs, how do I add a struct instance
    //into a struct containing an array of the struct that I'm trying to add?
    function addChapter(string memory _bookID, string memory _chapterID) public {
        books[_bookID].chapters.push(ChapterData[_chapterID]);
    }
}


texts: How to create a RawTransaction for contract interaction Web3j

texts:
I want to sign a transaction that calls a smart contract function and send it to the Rinkeby network.

I  found on Web3j documentation the RawTransaction class that supports the methods for the contract creation and for Ethereum exchange, however I'm not able to send a raw transaction that calls a function from the smart contract.

How can I do this? is there a way to use createFunctionCallTransaction from the Transaction class and sign it with my credentials?


texts:
Here are my declarations and code:

struct Key
{
    bytes32 blindedKey;
    uint deposit;
    address player;
    bool revealed;
}
mapping(address => Key[]) public keys;

function seating(bytes32 _blindedKey)
    onlyBefore(seatingEnd)
    {
    //each player gives hash verifies key later
    keys[msg.sender].push(Key({
        blindedKey: _blindedKey,
        deposit: msg.value,
        player: msg.sender,
        revealed: false
    }));

The function seating has more to it as well.  I am trying now to call a specific entry from another function. I'd like it to be, for example, the second msg.sender's address (player).  So I am trying something like keys[2].player which is seemingly wrong but might give an example of what I am looking for.

Typically I pull the information up like this: var key = keys[msg.sender][0];

And can use: key.player but how do I specify the 2nd key.player etc.

Thanks!


texts:
Shares are designed to provide owners with:

ownership
profits/losses

How would Ethereum based ownership make sure each owner, gets their share profits?

Is this even possible with Ethereum / smart contracts?


texts: Miner APIs are not found in web3.js package

texts: How can I start and stop miner( miner.start(), miner.stop()) from my DApp if Miner APIs are available in web3.js package? I am using web3 v0.20.6.


texts: How do I connect to a remote Parity node from web3.js?

texts:
I’ve installed parity on a AWS EC2 instance following these instructions and started parity with the --jsonrpc-apis 'web3,eth,net,parity' flag. I've also tried many other flags, such as --rpccorsdomain '*'

However I’m struggling to connect to it using web3.js.

Also I’ve, temporarily, opened all inbound traffic from my IP


texts:
Why the usual way to create a contract with evm opcodes use add and mload, for example:
bytes memory bytecode = hex"600580600c6000396000b800602a600052b8";
...
assembly {
    _address := create(0, add(bytecode, 0x20), mload(bytecode))
}

I can't understand why adds 0x20 to the initial position and why mload(bytecodes) returns the size of bytecodes. Is someone can point me doc related I'll appreciate.
Thanks.


texts: ecSignHashAsync() giving INVALID_SIGNATURE Error

texts:
I'm trying to create an order in 0x but when I try to sign the order I get INVALID_SIGNATURE error?

I'm using 0x version 2

onSubmit = async (event) => {

    event.preventDefault();

    const { makerAmount, takerAmount, makerToken, takerToken, maker } = this.state;
    const contractAddresses = getContractAddressesForNetworkOrThrow(KOVAN_NETWORK_ID);
    const zrxTokenAddress = contractAddresses.zrxToken;
    const etherTokenAddress = contractAddresses.etherToken
    const contractWrappers = new ContractWrappers(web3Wrapper._provider, { networkId: KOVAN_NETWORK_ID });

    const makerZRXApprovalTxHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(
        zrxTokenAddress,
        maker,
    );

    const makerAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(makerAmount), DECIMALS);

    // the amount the maker wants of taker asset
    const takerAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(takerAmount), DECIMALS);

    // 0x v2 uses hex encoded asset data strings to encode all the information needed to identify an asset
    const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxTokenAddress);
    const takerAssetData = assetDataUtils.encodeERC20AssetData(etherTokenAddress);

    // Set up the Order and fill it
    const randomExpiration = getRandomFutureDateInSeconds();
    const exchangeAddress = contractAddresses.exchange;

    // Create the order
    const order = {
        exchangeAddress,
        makerAddress: maker,
        takerAddress: NULL_ADDRESS,
        senderAddress: NULL_ADDRESS,
        feeRecipientAddress: NULL_ADDRESS,
        expirationTimeSeconds: randomExpiration,
        salt: generatePseudoRandomSalt(),
        makerAssetAmount,
        takerAssetAmount,
        makerAssetData,
        takerAssetData,
        makerFee: ZERO,
        takerFee: ZERO,
    };

    // Generate the order hash and sign it
    const orderHashHex = orderHashUtils.getOrderHashHex(order);

    console.log(orderHashHex);
    console.log(maker);
    console.log(web3Wrapper._provider);

    const signature = await signatureUtils.ecSignHashAsync(web3Wrapper._provider, orderHashHex, maker);
    const signedOrder = { ...order, signature };

    const uuidv1 = require('uuid/v1');
    const session = driver.session();
    await session.run(
        'CREATE (a:Order {id:$id, maker:$maker, makerAmount: $makerAmount, takerAmount:$takerAmount, makerToken:$makerToken, takerToken:$takerToken})',
        { id: uuidv1(), maker: maker, makerAmount: makerAmount, takerAmount: takerAmount, makerToken: makerToken, takerToken: takerToken, signedOrder: signedOrder }
    );
    session.close();
    this.setState({ errorMessage: '', makerAmount: 0, takerAmount: 0, makerToken: 'zrx', takerToken: 'weth' });
};


texts: Is there an advantage rollbacking the transactions with 'throw' over returning an error code?

texts:
Most of the code I read out in the wild follow the precondition pattern if (condition) throw;

But this approach is cumbersome for clients to read. For example, with web3js you would have to check if the full consumption of gas means that a throw happend or you ran out of gas. With Geth at least you can examine the callstack for an invalid jump via debug.traceTransaction()

It seems much more appropiate to follow this approach:

if (condition)
{
 ExceptionEvent();
 return ERRCODE;
}

By doing that you are capable getting the exception right.

Since using throw is so common in the codes I examined, what are possible drawbacks of my proposition, beside that you have to handle the error in all parts of the callstack correctly?


texts:
I deployed a smart contract to Ropsten testnet I want to call its only public function to test it on the network. How can I do such a thing and where I will see the result?

The TxHash is:
0xf321cc101ea280baf13a260bca734cfff73945cf85103a212fc933f3df74e3bd

I wrote it using Solidity on Remix and deployed it using MetaMask.


texts:
When installing the wallet, an error pops up
Checksam mismathg in downoalded node
MD5 e05524cc4f6e8711645f40ef5921918a
Please install the Geth node version 1.8.23 manually
Please help.


texts: Can contracts pay the gas instead of the message sender?

texts: Is it possible for a contract to pay the gas costs (or part of it) that result from the contract being called?  Or does the sender of a message always pay the resulting gas costs no matter what?


texts: Need help understanding whats happening in transactionhash details

texts:
Can someone explain to me what exactly is happening here?
https://etherscan.io/tx/0x8f3e1ae0c440eef8d7f298dec5d5e7f707b961a606b87907e0b5cd71bde92c19
I want to track token transfers from a list of wallets I have gathered. So when the transaction FROM is matching one of my observed addresses, I want to extract the data but it confuses me.
In the tx example above, what exactly is happening in terms of token transfers?  Whats confusing me is that there are 2 tokentransfers conv and weth. I would like to have a simple explanation what exactly is happening in that transaction.


texts:
I am programming a button for a transaction which shall only appear if the transaction is possible. Therefore, I am using the following code

contract.methods.function(parameters)
  .estimateGas({...},(error,result) =>
  {
    if(!error)
    {
      \\ show button
    }
    else
    {...}
  })

However, there is always a MetaMask error in my javascript console if the transaction would fail. Is there a way to catch this error? I just do not want it to appear in the console.


texts: web3.js without installing a browser extension

texts:
I want to make users not having MetaMask installed to use my dApp.
I thought MEWConnect will do the thing, but it requires installing an app at the phone :-(
Any alternative way? For example, MEW directly from the browser, without phone?


texts: What does this solidity code do in crowdsale contract?

texts:
Trying to level up on my solidity skills. I understand most of the crowdsale contract except these lines
balances[teamWallet] = 3000 ether;
        emit Transfer(address(0x0), teamWallet, (3000 ether));
        frozenBalances[teamWallet] = 3000 ether;
        timelock[teamWallet] = teamReleaseTime;

Any help is appreciated, thank you!


texts: Coinbase wallet 12 word seed used on metamask?

texts:
I have a couple of issues.

I have a Coinbase acct. I have a number of coins on there. And, of course I have the 12 word seed. If I use this 12 word seed and import it on metamask will all my coins show up from Coinbase wallet to metamask? Will they be risk at being lost on Coinbase wallet if I sign back in later?

If I import the 12 seeds onto metamask will I be able to still use and access my Coinbase wallet with the coins I still own?Can I use both Coinbase and metamask wallets interchangeably.

3.I have a item pending on etherscan. I tried to sell some PIKA (V1) for ETH on uniswap- the reason being is that PIKA is going to version 2 and I wish to get rid of before the swap happens otherwise the coins are rendered useless. I have Paid the gas fees for the initial swap and the transaction is still pending 12 hours later. I’ve read up that I must throw ETH in metamask and send back 0ETH (to my Coinbase ETH wallet address) to fix this issue? Is this true & correct.

I am also unable to send ETH out to another wallet of mine (as this tranaction) also pending. There seems to be a issue with Coinbase or something on etherscan getting that order finalised.

Ro


texts: ERC-20 tokens parked (now trapped) in smart contract pre-mist and after Ethereum Wallet sunsetting

texts:
I have the keystore file, paper wallet and passphrase for the wallet.
On my very first day learning about ethereum I installed Ethereum Wallet that does not get supported anymore. I downloaded the blockchain without corruption in time sync because it was small enough to not require months to get the entire blockchain.
I was told to use my wallet to create a contract because ERC-20 tokens were to be sent to me and they needed to be sent to a contract, not the wallet. I got the tokens. I also created an new 2nd contract and I easily used the graphic user interface to pass those tokens back and forth between the contracts. I stopped doing that because I learned I was paying gas. I was satisfied that everything was in order.
Now today I want to move those ERC tokens out of the contract. I can't use Ethereum Wallet because that project is dead now. I can't use geth to download the blockchain because after months of downloading it will grow to be corrupted at the end and never finish syncing due to errors.
Can ethereum wallets hold ERC-20 tokens? Or is it true that only contracts can hold them?
What is an ABI/JSON interface that I can use to move the tokens out? Whatever I try never looks like the GUI I was using on the Ethereum Wallet application. I see commands I can select but there is no explanation for the fields I need to enter. I see commands I can select but there is no explanation if I am only moving ETH and not the tokens.
I've spent years trying to untie this knot. I will read responses to this thread and try everything I am told. Then I will respond with an explanation how that idea never worked, either.
Thank you because it is really crazy trying to do my own research on this one. It has been a massive waste of effort over here on my end. I don't want to create a new token. I want to use the tokens I have that were created only 3 or 4 years ago.


texts:
Unhandled Rejection (Error): No valid "from" address specified in neither the given options, nor the default options.
▶ 4 stack frames were collapsed.
(anonymous function)
C:/mydapp1/client/src/App.js:38
  35 | await ipfs.add(this.state.buffer, (err, ipfsHash) => {
  36 | console.log(err,ipfsHash);
  37 | this.setState({ ipfsHash:ipfsHash[0].hash });
> 38 | storeMyValue.methods.set(this.state.ipfsHash).send({
  39 | from: accounts[1]
  40 | }, (error, transactionHash) => {
  41 | console.log("transaction hash is ",transactionHash);


texts: Is it possible to divide ownership in solidity?

texts:
Suppose i have a struct called product,
struct product{
uint prodcode;
string prodname;
uint quantity;
uint price
}
and if i have 1000 units(quantity) of a product p1 and i want to send 200 units of p1 to another person's address. So the ownership of the 200 units of p1 will belong to that person but the ownership of the remaining 800 units should still be mine.
Is there a way to implement this?


texts: Having trouble getting uint value from contract

texts:
I'm trying to retrieve a public variable from a contract:

pragma solidity ^0.4.4;

contract Test_Uint {
    uint public something;

    function Test_Uint() {
        something = 42;
    }
}

Note the hard-coded value 42. Here is the test code in truffle:

var thing = artifacts.require("./Test_Uint.sol");

contract('Test_Uint', function(accounts) {

  it("should provide access to something", function() {

    thing.deployed().then(function(instance) {

      instance.something.call().then(function(res) {
          console.log(res);
      });
    });
  });
});

I was hoping for 42 or even "42", but it always prints:

{ [String: '42'] s: 1, e: 1, c: [ 42 ] }

What is the right way to access the value?


texts: Invalid TxHash 0x2d03f2319fdd3e122379164e79a1dceae991f525 entered

texts:
I bought 0.09 ETH via remitano today . It has been 2-3 hours , but I haven't received ETH yet in my binance ETH account .

The transaction summary on remitano shows , that the ETH was indeed sent to the same address.

But when I check on etherscan.io , I get an erro

Not sure why this error is there and what it means. This was my first ETH transaction. Can anybody please help ?