texts: How can I reverse or cancel a transaction or recover lost ethers?

texts:
Transactions (using a smart contract like a token or sending ether), by design, are immutable on the blockchain. What methods can be used to (more or less) unilaterally reverse a transaction made by myself or someone else? Situations where one might like to reverse a transaction:

Sent a transaction to the wrong account/wrong contract/wrong address.
Sent a transaction with the wrong amount of ether.
Buyer's remorse (e.g., transaction recipient was a scammer).
Recipient is not acknowledging transaction or is holding on to tokens/ether sent as part of the transaction (such as an exchange might).
Contract has a bug.
Compromised account (e.g., How to reduce the chances of your Ethereum wallet getting hacked?)
Transaction is "stuck" due to low gas and no longer worth performing.
Contract called with wrong arguments.


texts: How can I convert an element of a byte32 array to number?

texts:
The array contains an SHA256 hash. I want to add up 2 hexadecimal values, and later multiply them by 1.125 (only keeping integer). The resulted number would represent an alphanumerical character, it would be random.

"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" (length is 36)

So I want to pick random letters from this string, and what I have is a SHA256 hash.

function GenerateSixDigitCode() private view returns (bytes32) {
    uint8[6] TwoHashDigit;                     //We add up 2 hex digit, than multiply it by 1.125 (32 to 36 conversion)

    //The CryptoZombies tutorial mentioned that this is not the best source of randomness, but in some cases this is sufficient.
    //This will be a ticket buying app just for learning purposes so it should be good enough
    bytes32 seed = (keccak256(abi.encodePacked(
        block.timestamp + block.difficulty +
        ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)) +
        block.gaslimit +
        ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)) +
        block.number
    )));

    //The user should get a 6-digit code, like this: X4C9BA
    //I'm trying to generate the 6-digit code from sha256

    TwoHashDigit[0] = (seed[0] + seed[1]) * 1.125;
    TwoHashDigit[1] = (seed[2] + seed[3]) * 1.125;
    TwoHashDigit[2] = (seed[4] + seed[5]) * 1.125;
    TwoHashDigit[3] = (seed[6] + seed[7]) * 1.125;
    TwoHashDigit[4] = (seed[8] + seed[9]) * 1.125;
    TwoHashDigit[5] = (seed[10] + seed[11]) * 1.125;

    //TwoHashDigit should contain random numbers now, in the range of 0-36

    //Later I would map numbers to alphanumeric characters, using this string  alpha = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    //For example alpha[10] == 'A'
    //alpha[20] == 'K'
}

The error I get:

contracts/ticketpurchaser.sol:43:27: TypeError: Operator * not compatible with types bytes1 and rational_const 9 / 8
        TwoHashDigit[5] = (seed[10] + seed[11]) * 1.125;


texts:
I need to store the following JSON object in a struct.

{
   "id":"ea6d69b3-f1",
   "type":"ofoo",
   "channel":"website",
   "funding":[
      {
         "type":"xxx",
         "amount":"1",
         "cohort":"xxx",
         "promotion":"53a16648-07"
      },
      {
        "type":"xxx",
         "amount":"1",
         "cohort":"conl",
         "promotion":"53a16648-3"
      }
   ],
   "createdAt":"2019-11-16T01:30:28.538789516Z",
   "totalAmount":"2" // Total amount of sum of amounts in funding tag
}

I know storing it as a simple nested struct is trivial, but having to add funding.amount + funding.amount to arrive at totalamount.

So far, I have tried this:

pragma solidity ^0.5.11;
contract Analytics {
  struct Field {
    string typeOfFunding; // type is a reserved word in solidity https://solidity.readthedocs.io/en/v0.4.21/miscellaneous.html#reserved-keywords
    uint amount;
    string cohort;
    string promotion;
  }
  struct Entry {
    string typeofEntry; // lack of better terminology
    string channel;
    Field[] funding;
    string createdAt;
    uint totalAmount;
  }
  mapping(string => Entry) entries;

  function updateEntry (string memory id,
                        string memory _typeOfEntry,
                        string memory _channel,
                        Field[]  _funding,
                        string memory _createdAt) public
                        returns (bool sucess)
  {
    Entry storage e = entries[id];
    e.typeofEntry = _typeOfEntry;
    e.channel = _channel;
    // e.funding = _funding;
    // e.funding = "0";
    // e.funding.push(_funding);
    e.createdAt = _createdAt;
    // e.totalAmount = updateFunding(_funding);
    return true;
  }

  function updateFunding(string memory id,  Field[]  _fundingP) private view returns (Field[] _funding)
  {
    Field[] memory funding;
    Field[] memory amount;

    for _fundingP.amount
    {
      funding.push(_funding.amount)
    }
  }

I would appreciate pointers on this issue


texts: What are the steps to launching a Safemoon clone on PancakeSwap?

texts:
I have created a contract on bsc mainnet and sent half the token supply to pancakeswap liquidity.
What are the remaining steps, in detail, that need to be accomplished on my end in order to ensure a fair and balanced token launch?


texts: Transfer from contract address to another address

texts:
I created ERC-20 token, and send other ERC-20 token to created contract address.

Can I transfer that token?


texts:
I am currently running some tests on ganache using web3.js connector.

Most of my transactions run OK if I supply the same amount of gas that is suggested by web3.eth.estimateGas(), however, one of the transactions uses about 3x the gas estimate provided by web3.eth.estimateGas(....), is this normal??

My concern is that once I deploy this on the mainnet and if this recurs randomly then I could be out of a lot of gas due to aborted operations resulting from inadequate gas supplied for the transaction.

What is the best practice for handling this kind of situation, should I normally supply x times the gasEstimate just to be on the safe side...what is a good value for x.

as a side note, the function call in question has three require statements, does that impact gas consumption in a big way??


texts:
If I have several transactions in the same function, can I be sure that they will be executed one just after the other.

Example with a dummy code:

Contract store {
    constructor() public returns(bool){
        return true;
    }
    function withdraw(){
        msg.sender.transfer(address(this).balance)
    }
    function() payable(){}
}

contract Exploit  {

    function execute(uint amount) public {
        store s = store();
        s.tranfer(amount);
        // Other code
        s.withdraw();
    }
}

If we take this example: if I send money to a contract, execute some code, and call the withdraw function to retrieve money from the contract.

Can I be sure that nobody will be able to call withdraw() before I do ? ie:

Can a miner put his transaction in the middle in hope of mining the block ?
Can someone listening to an Ethereum node, send a withdraw transaction with a high gas as soon as he sees a payment to the store contract?

Regards,


texts: How to find out if a certain struct exists in a mapping

texts:
i am trying to verify in a contract method, that a struct exists in a mapping while having it's address. here is what i tried.
Note : i have the UserAddress.

function DeleteAUser(address UserAddress) onlyOwner{
    require(users[UserAddress] > 0);
    delete users[UserAddress] ;
}

AND

function DeleteAUser(address UserAddress) onlyOwner{
    require(users[UserAddress] != bytes4(0x0));
    delete users[UserAddress] ;
}

EDIT : As you can see i only have the Address as input to the function.

but still has an error of operator compatibility :

TypeError: Operator == not compatible with types struct Ownership.User storage ref and bytes4

Is there anyway to solve this ?


texts: truffle migrate on ropsten shows Error: insufficient funds for gas * price + value

texts:
I'm using ropsten test network for deploying my contracts. I'm using

"geth --fast --cache=1048 --testnet --unlock "0x35f5164d941de22942288808C1E6e406ec148336" --rpc --rpcapi "eth,net,web3,personal" --rpccorsdomain '*' --rpcaddr localhost --rpcport 8545"

for syncing. On my account I've 14eth as shown by etherscan.io and metamask but on "geth attach" after syncing it shows that the balance in 0. When i run "truffle migrate --network ropsten" its gives me error

"Error: insufficient funds for gas * price + value"

This is my truffle -config.js

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 9545,
      network_id: "*", // Match any network id
      gas: 4500000
    },
    ropsten: {
      host: "localhost",
      port: 8545,
      network_id: 3,
      gas: 4600000,
      gasPrice: 10000000000,
      from: "0x35f5164d941de22942288808C1E6e406ec148336"
    }
  }
};

Thanks in advance


texts: Delegated Proof of Stake (DPOS) vs. Proo of Stake?

texts:
What is the main difference between Delegated Proof of Stake (DPOS) vs. Proof of Stake? Is there any significant advantage for security? (since PoS in general suffers security problems.) And which DLTs / Blockchains use DPOS?

P.S. A similar question asked HERE, but without any answer.

Update: According to answer of user vaz, my opinion is as follows:

We can say that in DPOS additional validators promote delegated validators. This could lead to make delegated validators more powerful and as a result more centralized consensus. Becasue we have fewer and more powerful validators. In my opinion, this even decrease security against failure and also rebellion of validators. However, it would be faster thanks to being more centralized.


texts:
I sent some ether from kraken to my ethereum wallet in January 2017. Recently, I decided that it is time to receive it.

Etherscan.io shows that it was successfully sent and was in block 3012342. My ethereum wallet is syncing for several weeks now and I still don't see my ether, although, it claims to work on block 4000000+.

This is my wallet address: 0x54f8fbf1915c7a4a6f35faa3d1a3d0ac5907e516

Could you please suggest a way of recovering my ether?

Thank you!


texts: Can I run multiple public mainnet ethereum nodes on different machines that return the same external IP address, on internal home network. What I mean is if I hit this site, http://www.nirsoft.net/show_my_ip_address.php, from all machines they show the same IP address. It appears to work when I run two nodes, but am slightly afraid they will confuse/corrupt each other somehow.


texts: No data consistency between ganache and my contract's view functions

texts:
I created a solidity contract like this:
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.1;

contract Users{

struct User{

    string name;
    bool enabled;
    bool isAdmin;
    bool exist;

}

User[] public usersList;
mapping(address => User) public addressToUser;

function isEnabled(address _adress) public view returns(bool){
    return addressToUser[_adress].enabled;
}

function getName(address _adress) public view returns(string memory){
    return addressToUser[_adress].name;
}

function getUser(address _adress) public view returns(User memory){

    return addressToUser[_adress];

}

function addNewUser(string calldata _name) public{

    require(bytes(_name).length > 0, "User's name can't be empty");
    require(addressToUser[msg.sender].exist == false, "Address is already bind to an existing user");

    User memory newUser = User(_name, false, false, true);

    usersList.push( newUser );
    addressToUser[msg.sender] = newUser;

}

function setEnabled(address _adress) public{

    require(addressToUser[msg.sender].exist == true, "Address is not bind to any existing user");

    User storage user = addressToUser[_adress];
    user.enabled = true;

}

}

After i deployed it on ganache and do that:

let user = await Users.deployed()
user.addNewUser('test')
user.setEnabled('MY_ADDRESS')

After i tried to see the name associed to MY_ADRESS like this:

user.getName("MY_ADDRESS")

result:

But it's weird because in ganache i see:

In addition ganache seems to not refresh datas because "enabled" is always false but when i tried:

user.isEnabled("MY_ADDRESS")

return is "true".
So to be sure i have done:

user.getUser('MY_ADDRESS')

result:

WHAT ??? now exist = false and name = "" ???
What's happend ? I really don't understand why :/
Can someone help me ? Thanks !


texts:
I just finished the GDAX account setup. Now I need to deposit fund. I clicked the button, the web page was redirected to Coinbase web site.

Then there are two options.

Link Bank
Wire transfer

Because I only want to deposit $200 for initial trial, so I select "Link Bank"

My question is that is there a transfer fee for that? I heard that GDAX is free but the operation is linked to Coinbase.


texts:
When I type testrpc cmd in console, client is working, then many many "eth_getBlockByNumber" appear,  why ???  please give me some advice.

Then I open other window, type "truffle test"  cmd,  it can not work...

D:\www\smartContract\demo3>truffle test

Could not connect to your Ethereum client. Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle.js)


texts:
What (distributed) mechanism for broadcasting transactions and messages does Ethereum's P2P implement?

I know that each node on the Ethereum network is only connected to a (small) subset of the other network nodes.

So, how is the P2P broadcasting of transactions and messages implemented? - Is it by means of a gossip protocol (https://en.wikipedia.org/wiki/Gossip_protocol)?


texts: How the Ethereum Swarm connects nodes and several related questions

texts:
Read everything after https://swarm-guide.readthedocs.io/en/latest/usage.html and leave an article.

Some questions about etherium swarm

Where is the uploaded data stored? And how do you find it? I want to know the size of the chunked data.
I upload 2GB of data but I do not get any response. Do you have a data size that can be maximized? (Being built in private)
When you connect two nodes and activate the swarm could not determine ENS contract address, using default "4E : 2 # B J err = "unknown version and genesis hash: 930810 X $% ` | ȩ $ \" ( ov "--
It comes out like this. This is my Genesis file name for 930810 .. Could you tell me why?
On a swarm network, when one node hovers a file, the other node is able to access that node's localhost: 8500, right?
If the hash value says to look for data in the swarm, then is the hash value the first of the chunk data? Can you see the second chunk when you approach that first?


texts: Why does adding a view function make write functions cost more gas?

texts:
When I add a view or pure function to a contract, it sometimes impacts the gas costs for unrelated write functions in the same contract - requiring another 22 gas.

pragma solidity ^0.5.0;

contract Test {
    function testWrite() public {}

    function get() public pure returns (bytes memory) {
       return bytes('yo');
    }
}

If you run this sample and call testWrite it will cost 144 gas.  Now comment out the get function and try again, the cost to call testWrite reduces to 122.  You can also copy paste the get method into get2 and see the impact grow with each instance (but not consistently):

no get: 122
1 get: 144
2 gets: 166
3 gets: 188
4 gets: 210
5 gets: 232
6 gets: 210 ! (diverge from pattern)
7 gets: 210
8 gets: 232
9 gets: 232

I'm testing using Remix with optimization enabled, however this investigation begun because I saw the same in our Truffle project.

Why might this be happening? And is there a way to avoid the increased costs?


texts:
I am trying to deploy multiple dependent contracts with truffle on testrpc.

For example,Migration script are as follow:

deployer.deploy(a,10000).then(function(instance){
   owner = web3.eth.accounts[0];
   _a = instance;
   return deployer.deploy(b,_a.address)
}).then(function(){
  return b.deployed();
}).then(function(instance){
   _b = instance;
   gasEstimate = 2000000;
   return deployer.deploy(c, _b.address, {from: owner, gas:
          gasEstimate+40000});
}).then(function(){
   c.deployed();
}).then(function(instance){
   _c = instance;
   return _b.setUpgrade(_c.address);
});

While migrate gives error as,

The contract code couldn't be stored, please check your gas amount.
    at Object.callback (C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:207913:46)
    at C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:31866:25
    at C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:209746:9
    at XMLHttpRequest.request.onreadystatechange (C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:208522:13)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:210395:18)
    at XMLHttpRequest._setReadyState (C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:210685:12)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:210840:12)
    at IncomingMessage.<anonymous> (C:\Users\as\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:210800:24)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)

Is there any suggestion?
Thanks in advance.


texts: My Transaction is pending for over 20 hours now - initiated a call to the transfer function using Web3

texts:
I'm making a call to the transfer(address _to, uint256 _value) function within the contract through Web3. Here's my code;

var Contract = web3.eth.contract(ContractABI);
 var ContractHandle = Contract.at(ContractAddress);
 ContractHandle.transfer(toAddress, tokens, {
        from: deductGasFromAddress,
        gasPrice: gasPrice,
        gasAmount: gasAmount
    }, function(error, result) {
        // write something
    });

I've specified 22 Gwei as the gasPrice, I think that's good enough for a faster transaction. However, it's in pending state for more than 20 hours.

Am I missing something in this regards? Would appreciate any quick help pertaining to this.


texts: How to properly define an interface in Solidity 0.6?

texts:
One of the breaking changes of solidity 0.5 was making explicit function visibility mandatory, hence all interface functions must be defined as external today.

In solidity 0.6, there seems to be two new function modifiers introduced: virtual and override.

How do they overlap with the previous rules for interface functions?


texts: how to pass value to contract via php (no java script)?

texts:
I wrote a contract that get a unit and do something

My question :

How to pass a value to this contract function via PHP? (not js,py,MetaMask, ... . just in php)

For example, I use this and install success in my Ubuntu server and run

geth account new

and get the result.

But I don't know how to use next step (Developer/Management API).

Please describe a real example by details with any packages or something that familer for you from how to install package on Ubuntu server and a simple contract that get a value and write a PHP file that if I run in my Lampp, send a value to my contract

  I saw a lot of same question in google, but most of them done with js
  or in short form in PHP and I cant figure out

  I'm new in use GitHub and Composer.JSON files


texts: Solidity variable definition: (bool sent, )

texts:
In Solidity, this sentence:
(bool sent, ) = msg.sender.call{value: _amount}("");

What is the sense of that "," after sent variable?
Any link to offcial documentation?
Many thanks.


texts:
I am kinda new to blockchains and solidity. I am trying to create a smart contract that can keep track of inventory as well as be able to order new things if necessary. I would like it to have some kind of access control to make sure not everybody in my "firm" is able to order things. All I can find is the "onlyOwner" modifier which makes sense but is there a way to make it so that an owner and someone else can do it? Or just some specified person that is not necessarly the owner?
Thank you so much in advance!


texts: Mycontract.deploy().send() does not work

texts:
I am trying to deploy a contract with web3 1.0.0 like:

myContract.deploy({})
.send({
    from: '0x1234567890123456789012345678901234567891',
    gas: 1500000,z
    gasPrice: '20000000000000'
}, function(error, transactionHash){ ... })
.on('error', function(error){ ... })
.on('transactionHash', function(transactionHash){ ... })
.on('receipt', function(receipt){
   console.log(receipt.contractAddress)
})

and I get the following error:

  Script failed: Error: Returned error: invalid argument 0: json: cannot
  unmarshal hex string without 0x prefix into Go struct field
  SendTxArgs.data of type hexutil.Bytes

Previously I am using the same address to get the contract, and it is in hex format(0x...).

let contract = new web3.eth.Contract(abi, {from: '0x1234567890123456789012345678901234567891', gas: 47000, data: bytecode});

and it is correct. So I do not know what can be the problem.


texts: What happens in the account state when we pre-send ethers to a smart contract?

texts:
I'm asking this question in relation to this one : pre_sending Ether where the OP asked in a comment of the answer about what happens at the low-level when pre-sending ethers to a smart contract.
As smart contract addresses are computed in a deterministic way, it is possible to pre-send ethers to these ones before the deployement. The future deployed contract will then have a non zero balance.
I understand the address of the smart contract is first registered as an EOA with the "pre-sending" and then updated as a contract address (codeHash is set to non default value). My question is about the transition between EOA and smart contract address.
From my understanding, here is the process :
Pre-send ethers to a non deployed smart contract
Let's say I am a smart contract developer and I want to pre-send ethers to my future contract.
I have finished the development of my contract and my account nonce is n. I compute the address of the contract using address = sha3(rlp.encode([my_account_address,n+1])). We will call it the pre-smart contract address. Then I send 1 ether to this address and wait for the transaction to be mined.
Once my transaction is included in a block, the state changes include the following :

My account nonce is now n+1

Nodes register the pre-smart contract address as an EOA in their world state trie with the following account sate :
   nonce: 0
   balance: 1000000000000000000
   storageRoot: default value
   codeHash: default value

Contract deployment
Now I deploy the contract. The transaction is mined and the nodes detect the address is already present in their local database. They update the account state for this address as follow :
 nonce: m, the number of contract creation made by the account
 balance: 1000000000000000000
 storageRoot: hash of the root node of the account storage contents trie where the contract data resides
 codeHash: hash of the EVM code of this account

If this is true then in this statement about the codeHash in the yellow paper :

it is immutable and thus, unlike all other fields, cannot be changed after construction.

the term construction  refers to the attribution of a non default value to codeHash (and not the creation of the field).
Am I correct about all of this ? A clarification would be appreciated.


texts: Optimizing web site to interact with ethereum Network Main net

texts:
I have been testing my dapp over rinkeby network, after about 2 months it began to be very slow when asking information to the blockchain. so we decide to change to ropsten network, where we saw it was working as it should, our opinion was there was a problem with rinkeby network. Today we decide to go to mainnet, after everything was working on ropsten. But looks like when our site tries to read the blockchain looking for events is taking loooon time, som pages can take about 3 minutes to get 5 tx from blockchain. you can see the website cryptogol.io Any idea where can we look at?

Thank you


texts:
The now keyword in Solidity returns a uint256 with the current block timestamp.

Is the timestamp in UTC time? (ie. the number of seconds since 1st January 1970)


texts: React + Web3, making call from componentDidMount but web3 not ready?

texts:
I'm trying to load some data from a smart contract from within componentDidMount. Calling the contract from within here didn't seem to work as web3 provider wasn't ready, so I added an event listener for 'load' and did it in there.

However, it seems like my web3 object still is not yet ready to be called.

Here's what my code looks like:

  componentDidMount(){
    window.addEventListener('load', function() {

      if (typeof web3 !== 'undefined') {

        MyContract.methods.getValue().call(function(error, result){
          if (error) { console.log(error); }
          if (result) {
            console.log(result);
          }
        });
      }
}

I get this error upon making the contract call:

Error: Provider not set or invalid

I can confirm that logging web3.currentProvider.isMetaMask returns true right before this contract call. A bit confusing, any ideas?

** Upon further investigation, it appears that MyContract.currentProvider is not yet set at this point. So its not the web3 injection from MetaMask.


texts: update balance into database [logic help]

texts:
If a user deposit money to his Ethereum address that is generated for user after signup.

So how to get amount transferred by the user to update that amount into database field?

I'm using web3 with full node


texts: what is the scope of msg.sender in a contract.

texts:
Well I am trying to understand this code

pragma solidity ^0.4.11;

contract hello {
uint public totalTickets;
uint constant price = 1 ether ;
address owner ;
address hacked = 0x583031d1113ad414f02576bd6afabfb302140225;

mapping (address => uint) public buyers ;

function hello () {
    totalTickets = 5 ;
    owner = msg.sender ;

}

function buyTickets(uint amount, address _from) payable{
    if(msg.value != (price * amount) || amount > totalTickets){
        throw;
    }

    buyers[msg.sender] += amount ;
    totalTickets -= amount;
   selfdestruct(owner);

}

}

my issue is that in mapping key is msg.sender, and as per my understanding msg.sender is the one who creates the contract, now on the other hand when we use some-other address to pay for tickets it successfully gets mapped (why is that? cause they havent created the contract and they should by accessed by some other way) and then can be viewed latter against that address but on the other hand when selfdestruct(owner) is executed all the funds go back to the actual creator of contact. So how this msg.sender is behaving why it does not send all the funds back to last updated address.


texts: What is an efficient method to append a dynamic array to a dynamic array?

texts:
I'm looking for the most efficient method to append a dynamic array to an existing dynamic array.
I know I could do:
bytes4[] private _array1 = [1,2,3];
bytes4[] private _array2 = [4,5,6];

for( i = 0; _array2.length > i ; i++ ){
  _array1.push(_array2[i]);
}

But would something like this work?
bytes4[] private _array1 = [1,2,3];
bytes4[] private _array2 = [4,5,6];

_array1.push(_array2);

If there a different more efficient method then just iterating over one array pushing each entry into another array?


texts:
What is the big difference between:

contract Crowdsale {
    MintableToken public token;
    uint256 public someInt;
    [...]

    function Crowdsale (uint256 _constructorArgument){
      someInt = _constructorArgument;
      token   = createTokenContract();
    }

    function createTokenContract() internal returns (MintableToken)
    {
      return new MintableToken();
    }

and

contract Crowdsale {
    MintableToken public token = new MintableToken();
    uint256 public someInt     = theValueIWouldPassAsConstrArgument;
    [...]

    function Crowdsale (){

    }

The second version is much cleaner imho. I have less code. No need for constructor Arguments...

What is the difference? I would prefer the second version. But maybe I am wrong.


texts:
The contract of 0xf263292e14d9D8ECd55B58dAD1F1dF825a874b7c can be found on Etherscan

But the token holder is not shown, pls see here

Can someone help?


texts: Output of log.memory.slice in Geth debug_traceTransaction

texts:
Has anyone else used the JavaScript-based tracer that Geth provides, as part of its debug_traceTransaction method?

I want to look at segments of memory during a transaction's execution (specifically, I want to retrieve "input" data made by internal CALLs).

Using the JS tracer, one can access memory using log.memory, which has a method called log.memory.slice. The documentation says it,

  "returns the specified segment of memory as a byte slice".

But I can't figure out what format this byte slice is in.

For example, when I request a segment 4 bytes long, I get this back: "FscnIQ==". How do I interpret that?

When I run debug_traceTransaction without the JS tracer, and print out the memory, I see that those 4 bytes should be "0x16c72721".

Similarly, when I ask for the first byte in memory when memory is all 0s, the JS tracer's log.memory.slice returns the string "AA==".
The encoding is clearly not hex, and it doesn't seem to be ASCII either.

What kind of encoding maps "0x00" to "AA=="?


texts:
I installed and used Akasha but then when I opened Mist next it said it was on Private-net. I tried "geth --networkid 1" but that didn't do anything.

What are some things I could try to fix this?


texts: Error encountered during contract execution - Out of gas

texts:
I try to create a smart contract (Simple TokenERC20) with sendRawTransaction().

    var firstMainadress = '0x3c7B83E0Fa6f19B1B61e80A73630cB5Db48b700C';
    var secondAdress = '0x38ebbB608fbb40fca07e0EcBAc89e20520BD33f1';
    var privateKey = new Buffer('xxxprivateKeyThatIcantShowHere...','hex')
    var data =  this.byteCode;
    var nonce = this.web3.toHex(this.web3.eth.getTransactionCount(firstMainadress));
    var gasPrice = this.web3.toHex(1000000000);
    var gasLimitHex = this.web3.toHex(1253608);
    var rawTx = { 'data': data, 'nonce': nonce, 'gasPrice': gasPrice, 'gasLimit': gasLimitHex, 'from': firstMainadress};
    var tx = new Tx(rawTx);
    tx.sign(privateKey);
    var serializedTx = '0x'+tx.serialize().toString('hex')
    this.web3.eth.sendRawTransaction(serializedTx, function(err, txHash){
      console.log(err, txHash);
      this.deployedContract = txHash;

    })

the txHash is not null, and when i put it on etherscan, i see the bellow error :

Can someone help me to found why i have this error message :
Warning! Error encountered during contract execution [Out of gas]

Thnaks a lot for your help :)


texts: Return multiple values from a mapping in contract call

texts:
I have been stuck on this for a while, I have a mapping
mapping (uint => bytes) idToEmail;

A function to populate the mapping
function addRecord(uint id, bytes email) public payable { idToEmail[id] = email; }

I need a function to fetch multiple values for an input of multiple keys, like
function fetchRecords(uint[] ids) returns (bytes[]) {..}

How do I go about doing this?


texts: Is it possible to unlock a geth wallet through JSON RPC?

texts: I'm currently developing an application on top of Ethereum's JSON RPC. I would like to be able to unlock and lock the wallet as needed, similar to how Bitcoin does it. However, it seems that at the moment it's only possible to unlock a geth wallet with the console through personal.unlockAccount. I'm wondering - is that the only way to unlock a geth wallet, or is there some way to do it through some other means, ideally with JSON RPC?


texts:
I am using python package py-solc-x for compiling the smart contract.

os.path.abspath("D:/new.sol")

Gives path where my test contract exits. 'D:\\new.sol'

Then i  use compile_files to compile the contract compile_files([os.path.abspath("D:/new.sol")]) , it gives KeyError.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Muvi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\solcx\main.py", line 137, in compile_files
    contracts = _parse_compiler_output(stdoutdata)
  File "C:\Users\Muvi\AppData\Local\Programs\Python\Python36-32\lib\site-packages\solcx\main.py", line 73, in _parse_compiler_output
    data['ast'] = sources[source.split(':')[0]]['AST']
KeyError: 'D'

How can i solve this problem?


texts: How do I Encrypt Transaction Input Data Encode ABI

texts:
I'm buying erc20 token how can I encrypt my transaction input data . I using Javascript WEB3.JS method Can you help me with this?
like this when try on check etherscan. Warning: Unable to decode input data
Example:

0xc48fdfca000000000000000000000000fca59cd816ab1ead66534d82bc21e7515ce441cf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Please explain with a practical example I have been searching this for about 3 days and I could not find a solution.


texts: How can I update contracts after they are created?

texts: Once I create a smart contract and submit it to the blockchain, how can I go about updating it? I might want to do this because I have found a bug in the current version, I want to change some of the settings or simply release a new and improved version.


texts:
how connect to mainnet with geth?

I used this command before for rinkeby test network

geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "/home/mahdi/.ethereum/geth.ipc"


texts: Different hash values for keccak256 functions?

texts:
In solidity i used the following command:

keccak256(firstName, lastName, studentId);
->0x157effbe0a2f53d887ad79b0dc3e9eb6084c3025ae0114a253b8f94f83c1462d

And, in NodeJS i used the following command:

keccak_256(firstName, lastName, studentId);
->488e3bd05d8d3fa46e2ef71387dafdc2341c603a60972da583206f39920c6350

I am getting different values for the same parameters passed in the same function, but in solidity and one in nodeJs. I need the exact same output for both the versions. What should i do?


texts: Simple Open Auction example - how to run it?

texts: I'm trying to run Simple Open Auction, compiled successfully in Remix. I receive "Exception while processing transaction: revert" when I try to enter recipient account addresses from Ganache, or "Attempting to run transaction which calls a contract function, but recipient address 0xf26a88E8DC89f97273BE2B9211852534E65C1299 is not a contract address", when I enter created contract address from Transactions Ganache tab. How to run this contract?


texts:
I am trying to make a decentralized android application. It is an online two player Tic-Tac-Toe game.  I have implemented the back-end with solidity and  a part of the front-end in android studio. More specifically, I got a wrapper class for my contract using solc and web3j, then included it in the android studio project. So I can call different functions of this wrapper class. Right now, a user can create an account and log in and create a game with this front-end. When a second player joins a created game, my contract emits an event to inform the creator that some player has joined the game. Besides, during a game, whenever a player makes a move, an event is emitted to let the other player know.
Now, the difficulty is that I don't know how to catch this event using Java. I have searched a lot about this, but did not find anything useful. Could anybody please explain how to do this or provide a link containing some example?


texts:
What is the concept of "bounty" in ERC20 tokens?

How can this be implemented and what are the advantages of implementing bounty?

I am not able to find any document which states the concept of bounty. Any reference or example would be very helpful.


texts: Do events get emitted when calling selfdestruct()?

texts: Are event emitted when a contract calls selfdestruct?


texts:
I'm new to the study of Blockchain and most recently began to study Ethereum.

I create a web application, and I need to create an ETH address for each new user. But the important condition is that I do not want to deploy my own node.
I want to use some external API for this simple task.

Can anyone advise such a service?

Thank you in advance.


texts: transfer hash verification on contract side

texts:
I want to verify if message-hash has a particular contract method.

Like below web3 code generates a rawTransaction having,messageHash,v, r, s, rawTransaction

let rawTransaction = {
        'from': fromAddress,
        'gasLimit': web3js.utils.toHex(310000),
        'to': contractAddress,
        'gasPrice': web3js.utils.toHex(20 * 1e9),
        'value': "0x0",
        'data': contract.methods.transfer(toAddress, amount).encodeABI(),
        'nonce': web3js.utils.toHex(count),
    }
  web3js.eth.accounts.signTransaction(rawTransaction, PK);

i.e if message hash from the above signed transaction is 0x9de6f7321d6374c8e26a1cd043daa71719175af97ed0f098260bf117db48dcbf

How can I create same hash in contract by passing above data for verification that given transaction hash is for transfer with all given values?

I have tried keccak256(abi.encodePacked()) using above data but it is generating different hash, may be I am doing something wrong.


texts: Evaluation of DApp (Smart Contract) storage concept with IPFS

texts:
i hope you can help me improve or validate my storage concept. I am glad for each suggestion. Since this is my first DApp, i might not consider all possible options for my problem.

To understand the Background: I plan to realize a DApp (based on Ethereum) that compares prices and search the cheapest price for a product in an certain area. The product itself is homogeneous, only the price matters. To keep it simple: Its a complicated product, it takes several days for the supplier to confirm an order and several month to deliver the product. The prices for the product are volatile, so there is a possible incentive for suppliers to cheat, meaning that they offer a low price in the beginning and demanding a higher price when they confirm the order a couple of days later.

The reason why i want to use the blockchain is transparancy and tracebility for the customer. So the customer should be able to easily validate, that the price that is suggested by the DApp is really the cheapest one in his area. Furthermore the Customer need to proof, that the supplier really offered a certain price at a certain time and cant claim a higher price later in the order confirmation.

So the interaction with the blockchain need to deliver two things: a. Evidence that the result is really the cheapest price in his area b. That the supplier itself offered the suggested price at this time.

Here are my thoughts and solutions so far:

The easiest and most transparent way would be one huge smart contract with all the data (prices, areas, suppliers) stored inside. The suppliers would update the prices in the smart contract with transactions.

a. The customer could simply check the smart contract attributes to validate the lowest price suggestion of the DApp.

b. The customer can proof the origin of the price through the transaction history of the contract.

Since data storage is extremely expensive on the blockchain, the interaction with this contract is not really an option. Updates of prices are very expensive because of the amount of data that is shoveled around (I tried it already). Instead the storage on the Blockchain for each supplier should be smaller, but still have the same transparency. I thought about using IPFS as datastorage and just store the Hash, but IPFS itself does not really proof anything because its mutable. So the important data need to be on the Blockchain, at least for my understanding, maybe you have a better idea?

So this is my last idea where I ask your help for. I tried to draw it in a use-case class model mix, I hope it becomes more clear this way.

Each supplier has its own contract (Supplier). The suppliers update the prices within their contract through transactions. Each contract supplier references to the same IPFS datastorage. The Datastorage just contains a list of all supplier smart contracts (adresses).

The Smart Contract HashStore just contains the IPFS Hash to this list.

To get the lowest price, I will in javascript (Class Price Search) simply read the Hash out of the Smart Contract HashStore. Then I will access the datastorage on IPFS and get all the addresses. I don’t use the prices stored on IPFS. Instead I loop through the addresses and call each time the GetData Method of each smart contract Supplier. After I collected all prices I simply choose the cheapest one.

a. The customer could check the datastorage on IPFS for an Overview of all prices. Since I read the price directly out of the Smart Contract, there is nothing to win for the supplier to manipulate the IPFS Table.

b. The Customer can easily check each supplier and its transaction history through the individual smart contract. So he can easily proof price changes.

I think this solution might work, but i still feel that I miss a part. Maybe Swarm offers some options I don’t know? Or there are some cool functions in Solidity I am not aware to handle this problem?

Thanks for your help!!!


texts: How to access input variables when event is fired

texts:
I tried multiple methods but I still can't access the data that is passed to the event in the code. Let's say I have the following contract with an event:

contract EtherBay {
    event NewEvent(address addr, uint intValue, bytes32 name);
    function withdraw() returns (bool) {
        NewEvent({ addr: 0, intValue: 10, name: 'someString'});
    }
 }

Then in the js file I am using web3 to catch thrown event. Here is the code:
   web3.eth.filter("NewEvent")
    .watch(function(error, result) {
        console.log(result)
    });

The app enters the filer above but I am not sure of how to retrieve the data I passed when fired event (addr, intValue, name). I followed multiple tutorials online but none of them worked. I also tried to access the transaction by transactionHash but I could just retrieve intValue and name. Moreover, when I try to convert name to Ascii I get some weird characters along with the name itself. The version of solidity is 0.4.18.


texts: How to interact with a network without a wallet installed?

texts:
I'm making a Dapp for users who don't have a wallet installed and have no ETH address. I would like users to use my account for all transactions.

I'd like to sign my transactions with the contract owner address using his private key.

But I can't find a way to doing that.
Please gimme some help

I'm using web3@1.0 (web3.js)
For the moment, my contract is deployed throw the Ropsten Testnet


texts:
I am trying to run a geth node just to learn what I can do with it. I started geth with fast syncing. The problem is that it never syncs and always lags behind ~100 blocks. My datadir is on my HDD and I know that that's the issue but I don't have space in my SSD. Is there any way I can continue with an HDD.

Windows 10 64bit

32GB RAM

geth --fast --rpc --cache=8192 --datadir ./Ethereum

I also port forwarded port 30303 for UDP with advice on some other forum.


texts: Does packing bools alongside addresses reduce storage costs?

texts:
Say I have a struct like this:

struct MyStruct {
    bool foo;
    uint256 bar;
    uint256 baz;
    address qux;
}

If I rewrite it like this:

struct MyStruct {
    bool foo;
    address qux;
    uint256 bar;
    uint256 baz;
}

Would storage become less expensive, since address is an alias for uint160 and bool can only be 0 or 1? What if foo was of type address?


texts: Deploy Contract (compiled by Truffle) without using Truffle

texts:
A contract SimpleStorage.sol has been compiled by Truffle using truffle compile. Its artifact is found at build/contracts/SimpleStorage.json.

However, this contract should only be deployed to the Ethereum network when a user clicks a button.

When handling the button click, what should be done to deploy the artifact once I get the TruffleContract object?

Can we also get the transaction hash and contract address after it is deployed?

import SimpleStorageContract from '../../../build/contracts/SimpleStorage.json';

onDeployButtonClick() {
    const contract = require('truffle-contract');
    const simpleStorage = contract(SimpleStorageContract);
    simpleStorage.setProvider(this.props.web3.currentProvider);

    // How to deploy this contract to the Ethereum network?
    // then get the TX hash and contract address
}

Tried this code on testrpc

onDeployButtonClick() {
    const contract = require('truffle-contract');
    const simpleStorage = contract(SimpleStorageContract);
    simpleStorage.setProvider(this.props.web3.currentProvider);

    this.props.web3.eth.getAccounts((error, accounts) => {
        simpleStorage.new([], {from: accounts[0]})
    })
}

but in the JS console, when onDeployButtonClick is triggered, I get an error

Uncaught (in promise) Error: VM Exception while processing transaction: out of gas
    at Object.InvalidResponse (errors.js:35)
    at requestmanager.js:86
    at XMLHttpRequest.r


texts: Private Ethereum Cluster showing ENR Errors

texts:
I am trying to run a 3 node cluster, 1 among three is miner. When I try to make  sendTransation its seems be signed but seems to halt forever with message signed and must wait for others.

The logs also show ENR request failed which doesnt seems okay:

Other details, I have a bootnode which serves at peer discovery node. My nodes runes with command

geth --nousb --bootnodes "enode://$bootnodeId@$bootnodeIp:30301"  \
--rpc  --rpcaddr "0.0.0.0"   --networkid "15" --verbosity 5 --maxpeers 3  \
 --rpccorsdomain "*" --rpcapi "eth,net,web3,miner,debug,personal,rpc" --syncmode full


texts: In bitcoin it's bad to reuse addresses (less security, as public key has already been revealed), how about ethereum? Is the public key revealed when the first transaction (first nonce) is used?


texts: Global variable problem, event is missing and not fired

texts:
I have a contract like below:

contract SimpleBidding {

    address contractOwnersAccount;

    // request information
    address public client;
    uint barcode;

    // bidding information
    uint expectedProposals;
    address bestVendor;
    uint bestPrice;

    // events
    event AssetRequested(address client, uint barcode);

    /* Constructor */
    function SimpleBidding(address _account) {
        contractOwnersAccount = _account;
    }

    /* checks if the time limit has been reached and ends the contract */
    function dispose() {
        suicide(contractOwnersAccount);
    }

    /* Used by clients to request assets and start bidding.     */
    function requestAsset(uint _barcode) {
        // save the requester
        client = msg.sender;

        // save the asset barcode
        barcode = _barcode;

        // create the event
        AssetRequested(client, barcode);

        // initialize the bidding process
        expectedProposals = 2;
        bestPrice = 999999;
    }
}

I realized that somehow the global variable address public client; does not work (it does not create the event). When I change it to var client = msg.sender;, it works and creates the event. I know it, because I have a watcher printing a log when the event is fired.

By the way, I call the function as below:

simplebidding_sol_simplebidding.requestAsset(5555, {from: eth.accounts[2]})

Any ideas? There is no error message or something like that I found.


texts: dynamicArray.push(struct) possible in solidity?

texts: Can push functionality of arrays be used for structure in solidity? Any example will help a lot.


texts:
When I call a solidity function to get a struct element, is it a best practice to use require and check if the element exists or should I just return the empty values?

Without require:

function getStruct(uint256 _id) returns (address, bool) {
  return (structs[_id].addr, structs[_id].boolean);
}

With require:

function getStruct(uint256 _id) returns (address, bool) {
  require(structElementExists(_id));
  return (structs[_id].addr, structs[_id].boolean);
}

Should view functions fail or should they just return empty results?


texts:
In https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol the function detecting contract

function isContract(address account) internal view returns (bool) {
    // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
    // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
    // for accounts without code, i.e. `keccak256('')`
    bytes32 codehash;
    bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
    // solhint-disable-next-line no-inline-assembly
    assembly { codehash := extcodehash(account) }
    return (codehash != accountHash && codehash != 0x0);
}

The comment says that there is a distinction between not-yet created accounts and account without code. I don't understand it, I thought all the possible accounts are already technically created just their balance and code are 0, resp. empty in the beginning.


texts: Can I withdraw Ether from exchanges to a contract wallet?

texts:
I was making a withdraw from Bittrex to a contract wallet. I never received the ether.

On the transaction it says:

  "Warning! An error occurred during contract execution"

Is there a way to resolve this? How to access the funds?

Can't I withdraw Ether from exchanges to a contract wallet?


texts:
I really need some help, at least an answer so i can put this back to rest for good, you see, when the DAO hack happened, back in 2016, I had my Dao tokens already in Poloniex and panic sold...  I owned my loss and moved on, never looking back, literally, till just yesterday, October 2-2020, I was watching a crypto documentary and my mind began bussing after it heard the words "Ethereum Rollback", I don't want to get my hopes up, even if by some miracle I could hypothetically have those Eths back, I still sold those damn Dao tokens, also I heard Mist wallet got deprecated, to many "IFs" already… Anyway, without the tokens the "rollback" is useless am I right? Or do I got the Dao tokens back to the wallet as well? Luckily I store everything, so here's the wallet from which I participated: https://etherscan.io/address/0x1110c6983efcefaac70044fb53d3b6cf9abeeb25
I just need Y/N, thank you in advance.


texts: Sign Function of web3.js for Authenticating users via MetaMask

texts:
I am trying to follow the example found at this site in order to authenticate users using the MetaMask functionality. Furthermore, the web3.js documentation at the following site, specifies this sign function:
 web3.eth.personal.sign(dataToSign, address, password [, callback])

I have no issue in passing the dataToSign and address values to this function, however, how can I pass it the password?
Otherwise, is this the proper function to use in order to sign a nonce used for authenticating a user? Perhaps I need to use another function? This is my promise calling the function (with different possible alternative function):
 return new Promise((resolve, reject) =>
   // NOt sure which function among the ones below to use:
   this.web3.eth.personal.sign(this.web3.fromUtf8(nonce), account, (err, signature) => { // Or
   this.web3.eth.sign(nonce, account, (err, signature) => { // Or
   this.web3.eth.accounts.sign(nonce, account, (err, signature) => { // Or
   this.web3.eth.personal.sign(nonce, account, password, (err, signature) => {
       if (err) return reject(err)
       return resolve([account, signature])
     })
   )

I did not have much success with any of them.
Thank you. J


texts: How to dynamically load contracts data with their ABI from etherscan API?

texts:
Im wanting to pull data from a smart contract I've loaded via user address and etherscan API for the ABI.

But how would I go about programmatically adding all the functions from the ABI into my front end?

Basically, say I want to look up the crypto kitties contract and get the ABI via etherscan API.

But how would I know what functions to call or list?

Say I want to do what etherscan does and let you call different functions from the abi?

Basically workflow:

User puts in address.
Pull ABI from etherscan
Load contract with ABI
??? How to add all the functions to my front end via the ABI, using JS. ???

How do I call a function without knowing the function name such as getKittyData


texts: Getting hold of web3 from inside a Truffle JS test

texts: How do I access a web3 instance from inside a Truffle Javascript test?


texts: Listen to filtered events using web3js 0.19 (provided by infura)

texts:
I am working on a uport dApp. uPort by default uses web3 from rinkeby.infura.io which is web3 version 0.19. So no WebSocket available. I tried ZeroClientProvider but that leads to this error:

Error in ./~/eth-block-tracker/src/index.js
Module parse failed: C:\Users\Rahul\Desktop\projUport\node_modules\eth-block-tracker\src\index.js Unexpected token (38:8)
Module parse failed: C:\Users\Rahul\Desktop\projUport\node_modules\eth-json-rpc-infura\src\index.js Unexpected token (25:54)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (25:54)
 @ ./~/eth-json-rpc-infura/src/createProvider.js 3:31-49

My code for it was:

const ProviderEngine = require('web3-provider-engine/index.js');
const ZeroClientProvider = require('web3-provider-engine/zero.js');
const engine = ZeroClientProvider({
  getAccounts: function(){},
  rpcUrl: "https://rinkeby.infura.io/INFURA_KEY",
})
const web3 = new Web3(engine);`

Using contractInstance.eventName({<filters..>}).watch(callback) or anything similar shows the following error: 405 POST ERROR rinkeby.infura.io I have seen their github issues (https://github.com/INFURA/infura/issues/13, https://github.com/INFURA/infura/issues/10), but nothing seemed to be useful.
No matter whatever I do, I can't seem to get web3 1.0 (tried setting providers as wss://rinkeby.infura.io/ws or rinkeby.infura.io/INFURA_KEY.

Its been over 2 hours and I have tried several different approaches.
Please post any that works with either web3 0.19 or uport dApp!

EDIT: MINIMUM CODE:-
SOLIDITY:

public uint id;
event TaskCreated(uint _id);
function addTask(uint _id) {
    id++; emit Taskcreated(_id); }

JS:

contractABI = <abi>
contractInstance = contractABI.at(<contract_address>);
var taskCreatedEvent = contractInstance.TaskCreated( {fromBlock:0, toBlock: 'latest' })
await taskCreatedEvent.watch((err,res) => {
            if (!err) {
                console.log(res);
                let id = res.args.id.toNumber();
                console.log(id)
            }
        })


texts: Not getting any results from Web3j querying of ERC20 token's balanceOf() function

texts:
I am trying to use Web3j to query the balanceOf() function of a standard ERC20 token as shown in the code below:

try {
        String encodedFunction = FunctionEncoder.encode(function);
        String contractAddress = "0x4330e0c338b48128a4534d90fd83579ef5539998";
        Address[] addressInput = new Address[]{new Address(fromAddress)};
        Function function = new Function(
                "balanceOf",
                Arrays.<Type>asList(addressInput),
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
                }));

        String fromAddress = "0x266d3299d8ede74e9dce770366bbe59179f676ef";
        EthCall response = web3j.ethCall(
                Transaction.createEthCallTransaction(fromAddress, contractAddress, encodedFunction),
                DefaultBlockParameterName.LATEST)
                .sendAsync().get();

        if (response == null) {
            System.out.println("Nothing was returned !!!");
        } else {
            if (response.getValue() == null) {
                System.out.println("Nothing was returned !!!");
            } else {
                System.out.println("Detected response ...");
                List<cryptocurrency.proto.eth.abi.datatypes.Type> someTypes = FunctionReturnDecoder.decode(
                        response.getValue(), function.getOutputParameters());

                System.out.println("Return Value(s)");
                System.out.println("===============");
                for (int i = 0; i < someTypes.size(); i++) {
                    System.out.println("" + someTypes.get(i).getValue());
                }
            }
        }
} catch (InterruptedException | ExecutionException ex) {
    Logger.getLogger(TestERC20.class.getName()).log(Level.SEVERE, null, ex);
}

The response is no response as shown below:

Detected response ...
Return Value(s)
===============

I am trying to querying this contract (https://ropsten.etherscan.io/token/0x4330e0c338b48128a4534d90fd83579ef5539998) using a token owner address of (https://ropsten.etherscan.io/token/0x4330e0c338b48128a4534d90fd83579ef5539998?a=0x266d3299d8ede74e9dce770366bbe59179f676ef).

What am I missing to get the above code to work on the balanceOf() method and return me the answer of the current holding amount of 999,981,060.605788211684519359 ZEN tokens belonging to the above token owner address ?


texts:
For the call of a smart contract funtion i want to call it from a different account then the one i have currently in meta mask. So i want to call this method by:

myContract.setFinished(true, {from: web3.eth.accounts[1], gas: 3000000}, function(err, res){});

But currently web3.eth.accounts[1] is undefined, so how can i set this account with a given private key or/ and address?


texts: Contract NOT created when using "new" on testnet

texts:
I've got a contract which one of his functions creates a new contract in the following manner: (Solidity)

function createCarrier()
public
{
    P2Carrier newCarrier = new P2Carrier(msg.sender);
    emit contractCreated(address(newCarrier));
}

I've deployed this to Rinkeby TestNet.
When making a transaction to call this function (from android using web3j, and infura as http provider) The event is emitted, but when I look for the address emitted in the event, There is nothing there (using rinkeby.etherscan.io).
also, I can see the transaction sent to call the function in etherscan, but I cant see any additional contract creation transaction.

you can see the contract info and transaction here:
https://rinkeby.etherscan.io/address/0x7ca846b6d52ccec650187e5ed8e793701de4d00e

Any ideas what's wrong?

Thanks.


texts: What sort of malware is this? Is my wallet compromised?

texts: Received a malware type desktop notification (not web) that had my address on there. Is my wallet compromised? Should I change wallets? I was using mist wallet.


texts: Javascritp app.js function returning Undefined

texts:
I'm trying to write a simple function retrieving the contract address with a simple call. Anyway while the address value is correct in the function scope, the return value calling the function in that way is giving me an undefined error.

//Here the call

console.log("Indirizo con chiamata",App.getContractAddress());

//Here the function code

getContractAddress: function() {

RevenueShare.setProvider(web3.currentProvider);
  myContractInstance=RevenueShare.deployed();

myContractInstance.then(function(instance){
    return instance.address;
}).then(function(address){
  console.log("Indirizzo in funzione:",address);
  return address;
});
},

Any Help???


texts: Problem with running truffle code with node.js

texts:
I am trying to run truffle code with Node.JS in the backend to deploy contracts. I want to be able to do this interactively and I am intending to use the Express Library to interact with the Node backend.

However, in the first instance I am just trying to run a .js in node to deploy a contract. I can do so easily in the deploy script but want to be able to do it on the fly. Here is the code I am talking about:

const Web3 = require("web3");
const HDWalletProvider = require("truffle-hdwallet-provider");
const mnemonic = "..."

var httpProvider = new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/<my API>');
var provider = new HDWalletProvider(mnemonic, httpProvider);

var contract        = require("truffle-contract");
var myContractJSON  = require('./build/contracts/Insurer.json');

// Read JSON and attach RPC connection (Provider)
var myContract = contract(myContractJSON);
myContract.setProvider(provider);

myContract.new("0x20202020202020202020204931303031", "0x20202020202020202020436f66616365")
    .then(function(instance) {
    return instance.getInsurerInfo.call()
    }).then(function(result) {
        console.log(result[0], result[1]);
        res.send('Insurer contract made successfully: '+result[0]+' '+result[1]);
        }, function(error) {
    console.log(error);
    });

and here is the relevant contract code:

    contract Insurer {
    bytes16 public insurerUIC;
    bytes16 public insurerName;

    constructor(bytes16 _insurerUIC, bytes16 _insurerName) public {
        insurerUIC      = _insurerUIC;
        insurerName     = _insurerName;
        } // constructor(bytes16 _insurerUIC, bytes16 _insurerName) public {

    function () payable external {
        // fallback function to receive funds
    } // function () payable external {

    function getInsurerInfo() view public returns (bytes16, bytes16) {
        return (insurerUIC, insurerName);
        } // function getInsurerInfo() view public returns (bytes16, bytes16)

    } // contract Insurer {

The contract takes 2 parameters. When I run the code above it seems to run but nothing actually happens.

Any idea what is wrong? Also how can I debug Node code without being able to use the console?

Sorry for beginner questions but I am struggling!

Thanks,

Phil


texts:
I am able to generate the contract just fine, and able to create a wallet, but when I try to deploy the contract on testrpc, I always get an exception saying I dont have enough funds. How can you initialize a wallet using web3j that has initial funds in it?

I create the wallet using WalletUtils, and then use the following code to initialize that account I created with ether while launching testrpc

byte[] keys = Keys.serialize(wallet.getCredentials().getEcKeyPair());
String result = new String(Hex.encodeHex(keys));
String privateKey = result.substring(33, 65);

Then I try to deploy a contract using that wallet I created.

Sorry, edit to the original question, I cannot launch testrpc because I getting 'private key length is invalid'

My real question should be, how do I create a wallet using web3j, get the private key from it, and use that to initialize testrpc with that private key having funds?


texts: How a full node knows which chain to follow?

texts:
After Istanbul fork, my full node followed the longest chain which has:

Longest Chain
Highest TotalDifficulty

It seems that the shorter chain of the core-dev closing the gap - total difficulty increasing faster than on the longer chain.

Now the totalDifficulty of the shorter, core-dev chain is larger and still my node didn't switch to it.

What are the parameter to decide which chain to follow?

Is it supposed to happen automatically, what actions do I need to take right now?


texts: Embedding image data in the contract of ERC20 compliant tokens?

texts:
I've seen plenty of ERC20 token sales and ICOs lately, and a few sites have sprung up to track the value of various ERC20 compliant tokens. Most of these sites show images or logos associated with the tokens alongside the token ticker symbols. But as far as I know, these sites are just getting the images online or from the token creators to display on their sites.

I'm sure that it's possible store a tiny logo inside your token's contract, such that these sites could just grab the logo from the blockchain. It would probably cost a lot of gas depending on the resolution of the image, but it's theoretically possible.

So are any tokens that do this already, or is are there proposed additions to the ERC20 standard that includes the addition of tiny logo image data in the contracts?


texts:
Im trying to figure out the best way to deploy a contract programatically using ethers.js
with web3 I can just do:
 const contractInstance = new this.web3.eth.Contract(contractObject.abi)
    var deployTx
    debug(contractInstance)
    if (params === undefined || params.length === 0) {
      deployTx = contractInstance.deploy({
        data: contractObject.bytecode
      })
    } else {
      deployTx = contractInstance.deploy({
        data: contractObject.bytecode,
        arguments: params
      })
    }
    const data = await deployTx.encodeABI()

How ever with Web 3 I also seem to need an address? and to get that address I have to firs manually deploy it; Some clarity around the topic would really help.
I've tried to find resources specifying this but they are not what what im looking for I think?
Thanks in advance


texts: Why does Ethereum POW work fine in spite of short confirmation time?

texts:
Bitcoin confirmation time is about 10 mins.
Ethereum confirmation time is about 12 sec.

Why does Ethereum POW work fine even though confirmation time is shorter than Bitcoin's?


texts: Is the only way to store some data (some hash value) in the blockchain is with contract store?

texts:
I have a hash value and I need to store it in the blockchain as part of a transaction. and I need to look for that transaction with that hash later in time.

So creating a contract and storing it in its array/mapping. is this the only solution in Ethereum?


texts: Unable to test allowance and transferFrom function in a ERC20 contract?

texts:
I am learning ERC20 contract and stuck with allowance and transferFrom part.

Approve function approves an allowance for an address (spender) to transfer tokens from owner's contract to another address. After approval, the address (spender) could call transferFrom to send to other address from owner's contract, any amnt within allowances approed.

The point I am stuck is, how do I test this. I tried both Remix and deploying in Ethereum Wallet with test node but in vain.

Q1: In remix, I could create owner's contract and then call its functions. But how do I call contract function's from another address?
For eg,
owner's contract address: 0xca35b7d915458ef540ade6068dfe2f44e8fa733c
spender address: 0x1111111111111111111111111111111111111111

how do I call (0x1111111111111111111111111111111111111111).approve or transferFrom to carry out this operation?

Q2: I tried deploying in Ethereum wallet in test node, but in vain. Contract created successfully with tokens, function calls shown as success for transfer, approve, transferFrom but  no value shows up either reduced from owner's contract or as received in recipient account.

Can anyone you please check my code below and help?  (I could not paste entire code here with proper formatting, so giving a link)
https://gist.github.com/parthi2929/f2d535253fcb0b9ebccbfb980ff52c1d


texts: How to add website link to erc20 token on etherscan.io

texts:
How can we add this official site link to our deployed contract? Like in the image below:

Here is my deployed contract address: https://etherscan.io/address/0xab73a739729a21b2299761408507556d2719af89#code


texts: Correct way to deterministically compute contract address in Python

texts:
To begin with, I have already gone through the approach outlined in the following thread: How is the address of an Ethereum contract computed?

I wanted to test if the approach actually works. On my local testnet (Parity client), I deployed a contract through a transaction 0x23ca2b2dccc2635d6cd12a90438751949b9c5074b21ad27bb99e3facfdf73051

The relevant information from getTransactionByHash :

{
    "jsonrpc": "2.0",
    "result": {
        "from": "0x004ec07d2329997267ec62b4166639513386f32e",
         "nonce": "0x8e",
    } }

and from getTransactionReceipt

{
    "jsonrpc": "2.0",
    "result": {
        "blockHash": "0x255bed2220ca551aed77ab3075faf4388d74f6cb2f8ba45cb03d8f1f2ea4b43e",
        "blockNumber": "0x220",
        "contractAddress": "0x8d7bb25141ff9c4c77e9e208b6bf4d1d3ca684b0" }}

So the deployed contract address is 0x8d7bb25141ff9c4c77e9e208b6bf4d1d3ca684b0 . And I wanted to verify if the code I write to automate a piece of contract deployment functionality is correct so I can return the deterministically expected contract address on the chain.

import rlp
from sha3 import keccak_256
sender = "0x004ec07d2329997267ec62b4166639513386f32e"
nonce = int("0x8e", 16)
dd = keccak_256(rlp.encode([sender.encode('utf-8'),nonce])).hexdigest()[24:]
'7316d007c2dfd30ff33536803bc07e747818e2c1'

The computed address according to the given formula isn't what I expected it to be.

I am confused about:

  The correct data types of the arguments to be passed to rlp.encode(). I encoded the sender address because pyrlp 1.0.1 doesn't
  accept strings.
  Am I using the right cryptographic keccak function?

Any guidance or pointers will be really appreciated.


texts: How does zocrates process zk-SNARK step by step?

texts:
I'm trying to understand my zokrates code and how it processes zk-SNARK step by step in accordance to this article.

The article breaks down the zk-SNARK into three steps.

A key generator, G, takes in a secrete parameter lambda and a program C to produce the pk, which is the proving key, and the vk, which is the verification key:

(pk, vk) = G(C, lambda)

C here is just a function that takes in the preimage and the returns true if the hash value is the same as the preimage:

// w is the preimage, x is the hashed value of w
function C(x, w) {
  return ( sha256(w) == x );
}

The prover uses the preimage s, the known hash H and the proving key pk and generates the proof prf through the proof generating algorithem P:

prf = P(pk, H, s)

Finally, the verifier runs the verification function using the proof from the prover:

V(vk, H, prf)

The result is true if the prf is correct, which essentially proves that the prover knows the witness.

Now, I have a zokrates code here that takes it two values "a" and "b".

def main(private field a, field b) -> (field):
  field h = if a * a == b then 1 else 0 fi
  return h

My first question is, what are these two values equivalent to in the aforementioned example?  Is one of them lambda?  Also, is the expression "a * a == b" equivalent to the function C mentioned above?  I'm having difficulty understanding what these values and the expression are.

When I execute:

~/zokrates setup

I get the following output:

zokrates@0a96d8e9989b:~/code/square$ ~/zokrates setup
Performing setup...
def main(_0, _1) -> (1):
    (1 * _0) * (1 * _0) == 1 * _4
    # _2, _3 = ConditionEq((-1) * _1 + 1 * _4)
    ((-1) * _1 + 1 * _4) * (1 * _3) == 1 * _2
    (1 * ~one + (-1) * _2) * ((-1) * _1 + 1 * _4) == 0
    (1 * ~one) * (1 * ~one + (-1) * _2) == 1 * ~out_0
     return ~out_0
WARNING: You are using the G16 scheme which is subject to malleability. See zokrates.github.io/reference/proving_schemes.html#g16-malleability for implications.
Has generated 7 points
Setup completed.

I'm not sure where the proving key and the verification key are in this output.  How does fit into the example above, in terms of what the lambda value is or the C function is?:

My second question is, what exactly am I doing when I am "creating a witness"?

When I execute the following, a witness is supposed to be created:

~/zokrates compute-witness -a <a> <b> ... <n>

I was under the impression that a "witness" is the preimage that the prover already has.  Isn't "witness" something that prover is wanting to prove to the verifier that she has knowledge of this?

The output given to me when I executed the command was this:

zokrates@0a96d8e9989b:~/code/square$ ~/zokrates compute-witness -a a b
Computing witness...
def main(_0, _1) -> (1):
    (1 * _0) * (1 * _0) == 1 * _4
    # _2, _3 = ConditionEq((-1) * _1 + 1 * _4)
    ((-1) * _1 + 1 * _4) * (1 * _3) == 1 * _2
    (1 * ~one + (-1) * _2) * ((-1) * _1 + 1 * _4) == 0
    (1 * ~one) * (1 * ~one + (-1) * _2) == 1 * ~out_0
     return ~out_0
Could not parse argument: a

What exactly is happening here?


texts:
I'd like to fork Ethereum code (hypothetically) to create my independent Ethereum-like network (another world-like computer network with its own structure).

How can I reset or create new sets of ethers, so they can be mined from scratch at the original pace, so knowledge about existing discovered pools from the Ethereum network won't interfere in my new independent network?


texts:
I've created a paper wallet at myetherwallet. Recently I've heard wallets need to be updated since the homestead release.

Do paper wallets need to be updated in some way?

I was under the impression that a paper wallet could be created then left for years without having to do any kind of updates. Thanks.


texts: How to convert hashed result into readable format?

texts:
I'm trying to convert a hashed block number "30054a" into readable format but I'm getting logs something like this:

0J

For another hashed value:

Y����#�(�J�d��F,ĦJ/

I'm using the following code on my NodeJS server:

const util = require('ethjs-util');
const value = util.toAscii('30054a');
console.log(value);

I had even tried toUtf8. I'm using ethjs library.

Where am I wrong?


texts:
The documentation example for a complex bet contract includes a "Weather feed" service. How would such a feed/service/contract work?

For a weather feed, either there needs to be a temperature sensor hooked up to a computer running an Ethereum node, or someone needs to be manually entering the feed data? Is this a contract where it would have to be reputation-based and powered by some maintainer (the owner of the contract is the only one allowed to use an addFeedEntry method, which fires events)?

Or is there a way to bind some data source (remote website, or sensor off the computer running the node) more provably, so the trust in a maintainer doesn't need to be there?


texts: Frontrunning Uniswap horror story transactions

texts:
From the Ethereum is a Dark Forest post, the rescue plan was:

Deploy a Getter contract which, when called by its owner, would make
the burn call ONLY if activated, and otherwise revert.

Deploy a Setter contract which, when called by its owner, would
activate the Getter contract.

Submit the set transaction and the get transaction in the same
block.

But a key detail is missing to study the incident and when the frontrunning succeeded.
What are the transaction hashes of the rescue team and the frontrunner?


texts: No data is deployed in the contract address

texts:
I have followed the previous solutions to this problem as mentioned in this question: Mist: "No data is deployed on the contract address!"

I also checked if the Estimated consumption fee is > Provide Max fee. There were some cases when not using they keyword "payable" was the problem where msg.value was called. I have checked it as well. Still, I am getting "No data deployed"  error. Following is my code:

pragma solidity 0.4.8;

contract SGBFactory {

    event FundsReceived(address indexed sender, uint256 amt);
    mapping (address => uint256) public investmentFrom;
    address public owner;

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

    function SGBFactory() {
        // constructor
        owner = msg.sender;
    }

    function() payable {
        investmentFrom[msg.sender] += msg.value;
        FundsReceived(msg.sender, msg.value);
    }

}

Is there a problem in the code leading to this? The error message is not very helpful.


texts: browser/Lottery.sol:26:1: ParserError: Expected token LBrace got 'RBrace' } ^

texts:
pragma solidity ^0.4.18;

contract Lottery
{

    mapping (address=> uint256) public winnings;
    address[] public tickets;

    string public name = "Lottery";
    string public symbol = "LOT";
    uint256 public maxTickets=100;
    uint256 public remainingTickets=0;
    uint public ticketCount=0;
    uint256 public randomNum =0;
    address public latestWinner;

    function Lottery(string tokenName, string tokenSymbol, uint256 maximumTickets)
    {
        name=tokenName;
        symbol=tokenSymbol;
        maxTickets=maximumTickets;
        remainingTickets=maxTickets;
    }

    function Buy() public payable
    {
        require(msg.value == 1000000000000000000);
        uint256 val= msg.value/1000000000000000000;
        require((remainingTickets - val) <= remainingTickets);
        remainingTickets-=val; //remove from unspend supply
        tickets.push(msg.sender);
        ticketCount++;
    }

    function ChooseWinner() public
    {
        require(ticketCount>0);
        randomNum=uint(block.blockhash(block.number-1))%ticketCount;
        latestWinner=tickets[randomNum];
        winnings[latestWinner]=ticketCount;
        ticketCount=0;
        remainingTickets=maxTickets;
        delete tickets;
    }
    function WithDraw() public
    {
        require(winnings[msg.sender]>0);
        uint256 amountToWithdraw = winnings[msg.sender];
        winnings[msg.sender]=0;

        //convert into wei

        amountToWithdraw*=1000000000000000000;

        // Transfer to wei

        msg.sender.Transfer(amountToWithdraw);

    }

}


texts: How to store dates before 1970-01-01 in a contract

texts: It is recommended to store dates in a uint. Can I use int if I want to sore a date before 1970-01-01 (for example a birth date) which is before 1970-01-01? If I use int int date = now; doesn't work anymore.


texts: Help! How to Transfer ERC20 TOKENS from a WALLET CONTRACT (Mist) to a Normal Address

texts:
Since Mist wallet no longer works, at all, I am trying to retrieve my tokens from the WALLET CONTRACT which can be natively created by Mist (not multisig). I can't recall why I set this up but I think it was recommended by the foundation for some reason so thats where I kept them.

I have tried using other platforms like mycrypto and myetherwallet but when interacting with the contract it only offers the basic functions like 'kill' which will kill the wallet contract but only transfer the Ether, not the tokens.

I have checked google and pretty much no one has the same problem as me. Does anyone know how I can do this whether it's via an online or desktop wallet? Or even using a script if it's possible?

In the final screenshot, this is what happens when I try to write the transaction on the OMG account, it fails with an rpc error. My plan was to take the transaction data from this to then execute in the account that holds the wallet contract.

Thanks

P


texts: How can I estimate gas on a transaction with custom data?

texts:
How can I estimate the gas I need for a string which may be quite long?

I've found an example here, but in this estimate, it doesn't include any custom data.

In my app I would like to save a string on-chain, though the estimateGas's data property appears to require the bytecode for the contract.

How would I go about dealing with this?


texts:
Only one question: How can I convert string to hex in ethers.js
I need some alternative to:
web3.utils.utf8ToHex() - but in ethers
Any help is appreciated


texts: Error: Error: Exceeds block gas limit TestRPC

texts:
I'm new to eth and dapp development and I'm running my own private test chain for development/ testing purposes and keep running into the above error when running truffle test.

Is there a way to increase the gas limit for my tests services? I have the following

testrpc '--debug --account="0xaa73b5c98e60d589e71ce7cff59c02f82e12c7ce676ee356da8e058a285ccd61,912082343256218" --account="0x52f3a1fa15405e1d5a68d7774ca45c7a3c7373a66c3c44db94a7f99a22c14d28,9023291452436789"

and my genesis file

{
 "nonce": "0x0000000000000042",
 "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "difficulty": "0x40",
 "alloc": {},
 "coinbase": "0x0000000000000000000000000000000000000000",
 "timestamp": "0x0",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "extraData": "0x",
 "gasLimit": "0x8000000",
 "coinbase": "0xaa73b5c98e60d589e71ce7cff59c02f82e12c7ce676ee356da8e058a285ccd61",
 "config": {
    "chainId": 4224,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
 }
}

Would increasing the gas limit solve my problem?
Can i set my prices
so I can keep within the range of the limit?


texts: What is the most efficient way to emulate sum types on Solidity?

texts:
Suppose you had two structs,

struct Weapon {
    int atk;
    int duration;
}
struct Armor {
    int def;
    int duration;
}

then, how do you write this:

struct Equipment {
    /* can be either an Weapon or an Armor */
}
function atkOrDef(Equipment equip) returns(int) {
    /* returns the atk if an Weapon, or the def if an Armor */
}

If that isn't possible, how would you do that?


texts:
I'm building a browser extension that uses web3.js over websocket to Infura and for some reason all my contract calls are returning null in my production build. When testing the app as a web app in the browser all calls work just fine. But when I build and load the app as an extension, all calls just silently return null without any errors or warnings. There are no CORS warnings or errors either, so that doesn't seem to be the issue.

My question is what all could cause a contract call to return null?

It's a bit annoying that I have to ask this question because there should be an error but instead it silently just returns null


texts:
I'm new to this business. I tried to make my first transfer from ETHER.LI to another wallet and the message is:

Request initiated by 0xc1588b9c4da3f992bd2b17b49f50719e32783c31

And nothing else happens.
The balance does not decrease.
I do not know what to do.
Somebody help me please


texts:
What is it and why is it written like that. I check pre-sale contract and it was defined in integer.

  uint constant TOKEN_LIMIT = 444 * 1e6 * 1e18;

Specifically that part: 1e6 * 1e18

I really didn't get it and I tried to google it but I'm out of ideas.


texts: Ethminer "No GPU device with sufficient memory was found"

texts:
I have two Sapphire Nitro+ RX 480 OC cards. When only one is inserted into a PCIe slot, I am able to mine ETH with no issues. When both are inserted into PCIe slots, my terminal returns:

"No GPU device with sufficient memory was found. Can't GPU mine. Remove the -G argument."

This happens despite my devices.bat file returning:
Listing OpenCL devices.
FORMAT: [deviceID] deviceName
[0] Ellesmere
        CL_DEVICE_TYPE: GPU
        CL_DEVICE_GLOBAL_MEM_SIZE: 8589934592
        CL_DEVICE_MAX_MEM_ALLOC_SIZE: 4244635648
        CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
[1] Ellesmere
        CL_DEVICE_TYPE: GPU
        CL_DEVICE_GLOBAL_MEM_SIZE: 8589934592
        CL_DEVICE_MAX_MEM_ALLOC_SIZE: 4244635648
        CL_DEVICE_MAX_WORK_GROUP_SIZE: 256"

My .bat file for Ethminer is:
start cmd /k "cd miner & ethminer -G -F http://eth-eu.dwarfpool.com:80/0x51df06C26B3FA5bb0509015Ef3fC4D815f1f02F2"

Update: Both cards work perfectly with Folding@Home, so it is not a hardware issue. There is something going wrong with my Ethminer execution. Any advice is appreciated!


texts: If I had some ETH on the exchange - shall I own ETH and ETC (Ethereum Classic) now?

texts:
I cannot recall the exact dates and balances, but in principle - is my assumption corrent?

EDIT: Comment is right, it's a duplicate.

TODO: Check accounts and balances, and why the heck I didn't think about it untill now?


texts:
Using bytes[] foo as a function argument

contract b {

function c(bytes[] foo) {

}

}

in https://remix.ethereum.org gives error

UnimplementedFeatureError: Nested arrays not yet implemented.

Why?


texts: Transfer X% of Eth. sent to smart contract, to contract owner on buy function call

texts:
I use this "buy" function in a smart contract, to receive Eth. for a token.
I would like to extend the function, so if the Eth amount in a transaction is higher than X Eth. then send Y% to smart contract owner.

I'm not sure about what would be the best way to do this, so I'm looking for any suggestions.

Thanks in advance :-)

/**
 @dev Buy tokens with ether.
 @param minPurchaseReturn The minimum number of tokens you will accept.
 */
function buy(uint minPurchaseReturn) public payable {
    uint amount = formulaContract.calculatePurchaseReturn(
        (tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this),
        (address(this).balance + virtualReserveBalance) - msg.value,
        weight,
        msg.value);
    amount = (amount - ((amount * fee) / 1000000));

    //Now do the trade if conditions are met
    require (enabled);
    require (amount >= minPurchaseReturn);
    require (tokenContract.balanceOf(this) >= amount);

    //Accounting - so we can pull the fees out without changing the balance
    collectedFees += (msg.value * fee) / 1000000;

    emit Buy(msg.sender, msg.value, amount);
    tokenContract.transfer(msg.sender, amount);
}


texts:
Is there any documentation to state how can we have redundant nodes configured in Quorum network so that even if a single node goes down, the data in blockchain is still retrievable by the app?

Thanks


texts: How to check whether a uint256 is null in solidity?

texts: I want to check whether a uint256 variable is null. How can I do so in solidity?


texts:
Given the address of a token, how I can get all the transactions related to that address using JSON RPC or an external api such a api.etherscan.io?

The transactions that gives a Ethereum address are different that the transaction that gives an ERC20 token. Example:

https://etherscan.io/address/0x9f7dd5ea934d188a599567ee104e97fa46cb4496 https://etherscan.io/token/Aragon?a=0x9f7dd5ea934d188a599567ee104e97fa46cb4496

I need to get the two transaction that are registered for Aragon via API.


texts: Why am I Getting: Transaction Error. Exception thrown in contract code in Real?

texts:
WE Had Create A Dapp Like POWHD, we Already Deployed It And Some Of Transactions Are Already Done well. But After Some Time The issue I'm encountering with my real contract (Dapp) is that trying to send any amount of ETH produces this warning: "Transaction Error. Exception thrown in contract code. Gas limit set dangerously high. Approving every transaction is likely to fail."

Can anyone explain why I am getting this error? I can't understand why an error is producing when someone sends an amount of ETH every time.
“Contract 0x25a06d4e1f804ce62cf11b091180a5c84980d93a”
  Warning! Error encountered during contract execution [Out of gas]
For example failed Tra.Hash  : https://etherscan.io/tx/0x8da0cc8887aaec2203a0e78f8e56c31482d2c3b5637f2456ec07cc6a8f2e8d1b
Smart contract (TRS)
https://etherscan.io/address/0x25a06d4e1f804ce62cf11b091180a5c84980d93a


texts:
I am creating cryptocurrency exchange and want to test my app and for that purpose I need to add dev account balance.
Please help me to generate ether for testing purposes in my private network.

NOTE

I am using geth to run ethereum node.


texts: Burn the rest of the token after airdrop is complete

texts:
I have started to develop blockchain and learn solidity.

I tried making a smart contract with the 200M supply, the creator only held 50M of the total supply and the rest was in the smart contract for airdrop.

If the airdrop is finished and there are still tokens left there, I plan to burn the remaining tokens on the smart contract.

The question.
How do you burn the remaining airdrop tokens from the smart contract?


texts: What get my FIAT currency when I deposit into a Crypto-Exchange Bank Account?

texts:
Someone obviously gets my FIAT money when I deposit EUR / USD into a Crypto-Exchange bank account.

What happens to that? Who gets to keep it? How is it spent? Owners of the exchange?


texts: How to interact with a smart contract which is deployed in a quorum network (Alastria)?

texts:
I have already deployed the contract using tuffle in my private network. Now, I would like to know what i have to do to interact with the contract.
I don't need ethers in my wallet and actually i don't have it because it is a quorum network and the gas price is 0.
How could I interact with the contract?

Thank you


texts:
I have deployed one contract named Storage using truffle console
code for Storage.sol

pragma solidity ^0.4.8;
contract Storage {

  struct EntityStruct {
    string str_address;
    uint entityData;
    //more fields
  }

  EntityStruct[] public entityStructs;

  function newEntity(string entityAddress, uint entityData) public returns(uint rowNumber) {
    EntityStruct memory newEntity;
    newEntity.str_address = entityAddress;
    newEntity.entityData    = entityData;
    return entityStructs.push(newEntity)-1;
  }

  function getEntityCount() public constant returns(uint entityCount) {
    return entityStructs.length;
  }

  function getEntityByRowNumber(uint rowNumber) public constant returns(string entity, uint data) {
    string a = entityStructs[rowNumber].str_address;
    uint b =  entityStructs[rowNumber].entityData;
    return (a,b);
  }
}

Now I want to access the functions of this contract from another contract named Access1

code for Access1.sol

pragma solidity ^0.4.8;
import 'storage.sol';
contract Access1{
address storgeContractAddress = "0xcd53170a761f024a0441eb15e2f995ae94634c06";

 function createEntity(address entityAddress,uint entityData){
        //Storage s = Storage(storgeContractAddress);
        storgeContractAddress.newEntity.call(entityAddress,entityData);
    }

    function getEntityCount()public constant returns(uint entityCount){
        //Storage s = Storage(storgeContractAddress);
        uint count=storgeContractAddress.getEntityCount.call();
        return count;
    }
}

The problem I am facing is while compiling Access1.sol from truffle using

  truffle compile

I get the error message

Error: Source "storage.sol" not found: File not supplied initially.
import 'storage.sol';
^-------------------^

I cant understand why this happens, I have checked that contract Storage is successfully deployed and working, I have checked many examples online which are importing contract in same way.

Any help is highly appreciated, Thanks in advance


texts: Is it impossible for a deployed contract to call another contract, if it is not written in code within itself?

texts:
Basically what I am doing is I am passing ownership of contract A to contract B.

The function below is only in contract A. I do not give contract B any code to call this function.

  function setOwner(address _owner) onlyOwner {
    pause();
    balances[owner] = initial_supply - public supply;
    owner = _owner;
    balances[owner] = public_supply;
  }

So I want to know, once I pass ownerhsip of A to B, is it impossible for it to change hands again? I want it to lock the ownership so I am hoping this is true! Thanks!


texts:
I have seen here that we can return struct for internal functions.
Why can we return struct for non-internal function?

Also, I can see in the same link "structs would have to be integrated into the ABI". What does this line means?


texts: why are Ethereum transaction fees so high?

texts:
I transferred some ETH earlier on today (see txn info here) - as you can see it was for $18 dollars. The transaction fee was $0.41

I did another transfer few days so (see txn info here), this time transferring $0.93 for which the associated transaction fee was $0.59 !!!

On both occasions, I used MyEtherWallet to do the transfers.

I thought one of the big pluses for decentralized cryptocurrency exchange over traditional routes, was that transaction costs would be negligible.

I often here cited that the availability of such decentralized platforms like Bitcoin and Ethereum is that they will herald in the age of micropayments - if so, why the relative high transaction fees in my two instances? Certainly, Ethereum is not a viable platform for doing micropayments going by my two examples above.

Interested to get others thoughts as to whether I'm missing something here and/or whether my expectations are way out of whack in terms of what I thought would be possible with Ethereum.

thanks


texts: vm exception while processing transaction: invalid opcode error

texts:
I've been running this code on remix ide on injected web3 with my ganache server in on state, then also i'm getting this error of invalid opcode. The code runs perfectly in rinkeby test network.

pragma solidity ^0.5.7;
contract cust{

    struct a{
        uint id;
        string name;
    }

    a[] arr;

    function set(uint x, string memory y ) public
    {
        a memory temp;
        temp.id=x;
        temp.name=y;

        arr.push(temp);
    }
    function get(uint x) public view returns(uint,string memory){
        uint i;
        for(i=0;i<arr.length;i=i+1)
        {
            if(arr[i].id==x)
            {
                return(arr[i].id,arr[i].name);
            }
        }
    }
}


texts: what is the miner that includes the transaction in their block to mine it

texts: When user send transaction, all evms execute automatically smart contract and which miner include this transaction inside block to mine ?


texts: How can the owner of a ICO smart contract access the ether raised?

texts:
I have been following this! tutorial for setting up an ICO contract. I was following pretty solid in my understanding of the process until I hit the following section:

  Notice that this will not create new tokens but change the balance the contract owns. The contract can hold both its own tokens and ether and the owner of the contract, while it can set prices or in some cases create new tokens (if applicable) it cannot touch the bank's tokens or ether. The only way this contract can move funds is by selling and buying them.

Note Buy and sell "prices" are not set in ether, but in wei the minimum currency of the system (equivalent to the cent in the Euro and Dollar, or the Satoshi in Bitcoin). One ether is 1000000000000000000 wei. So when setting prices for your token in ether, add 18 zeros at the end.

When creating the contract, send enough ether to it so that it can buy back all the tokens on the market otherwise your contract will be insolvent and your users won't be able to sell their tokens.

The last section in particular was confusing. What does

  send enough ether to it so that it can buy back all the tokens on the market otherwise your contract will be insolvent and your users won't be able to sell their tokens.

mean? It made me start to think, How does the owner of the contract gain access to the ether that the contract holds through the buy/sell functions? How can a contract send enough ether to buy back the tokens, when the whole point is to raise funds. Am I missing something? Thanks!


texts: Experiencing a lower hash rate when mining after changing motherboards.

texts:
I've been mining for a couple of months now, with a basic rig setup of single GPU R9 380x on a Gigabyte 970 AM3+ motherboard (all pre-used hardware).

My setup and settings are posted here for details.
After a recent thermal paste renewal on the GPU heatsink, and adding a couple of fans to the casing, I was getting a decent ~25.3 MH/s on this setup. But few days ago, the motherboard went kaput and the PC just went dead. Ofcourse I verified the Mobo as the culprit, by plugging in another PSU.

Now I got another used Mobo, an MSI 970A-G43, keeping all the rest hardware the same. The PC is back online now, and after installing/updating all the required drivers, as I started mining again, the hashrate now showing just ~20.1 MH/s with phoenixminer. I even checked the Bios settings of the new Mobo and set everything to "no power saving" and set for high performance, but don't see any improvements to the hashrates.

Now I'm really at my wit's end; can't figure out why the hashrate dips so low all of a sudden?

Can any one please point out anything missing or any settings I need to change to get back the hashrate?


texts:
I use web3.js to read all events and I get the return values when convert this field to original string (string indexed name) original name like mmmm the hex retrund is ("0x112f105bcd1b36ffb28f1725fb287832340e8853e2607a9e9945d200d7c0899e")
I use web3.utils to convert the hex to string web3.utils.hexToAscii("0x112f105bcd1b36ffb28f1725fb287832340e8853e2607a9e9945d200d7c0899e") it returns /[Í6ÿ²%û(x24Sâ`zEÒ×À
smart contract
event play(uint indexed id,string indexed name);
lib ver I used
"web3": "^1.3.0"
can anyone help me?
Thanks.


texts:
i have declared a string variable in struct like

struct test{
     string  testString;
  }

I have written a function to access the variable like

 function getteststring(uint256 index)public returns (string memory)
      {
              return test[index].testString;
      }

when i try to call this function using web3.js i get "0xc05205ee00000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000001" , converting this to UTF8 fails Error: Invalid continuation byte

can anyone guide me on how to access  this var and convert in readable format


texts: How do you call a function of a deployed contract from another contract?

texts: How would I call one contract's function from within another contract? I tried to find documentation on this all morning and wasn't able to find anything.