texts: setting value using address.call() doesn't works

texts:
I am trying to run a setter function (testCallBar) in Caller contract which should run setVal() of Receiver contract using call method. But it does not works. testCallFoo() works as expected but testCallBar() always returns false.
What I want to achieve is to run any function of Receiver contract from Caller contract using call() method.
What am I doing wrong here? Also, what is the better way to run any function with any datatype arguments to run using address.call() method in such scenarios?
pragma solidity ^0.8.3;

contract Receiver {
    event Received(address caller, uint256 amount, string message);

    uint256 bar = 9;

    function foo(string memory _message, uint _x) public payable returns (uint256) {
        emit Received(msg.sender, msg.value, _message);
        return _x + 1;
    }

    function getVal() public view returns(uint256) {
        return bar;
    }

    function setVal(uint256 _bar) public payable returns (uint256) {
        bar = _bar;
        return bar;
    }

}

contract Caller {
    event Response(bool success, bytes data);

    // Let's imagine that contract B does not have the source code for
    // contract A, but we do know the address of A and the function to call.
    function testCallFoo(address payable _addr, uint256 z) public payable {
        // You can send ether and specify a custom gas amount
        (bool success, bytes memory data) = _addr.call{value: msg.value, gas: 5000}(
            abi.encodeWithSignature("foo(string,uint256)", "call foo", z)
        );

        emit Response(success, data);
    }

    function testCallBar(address payable _addr, uint256 z) public payable {
        // You can send ether and specify a custom gas amount
        (bool success, bytes memory data) = _addr.call{value: msg.value, gas: 5000}(
            abi.encodeWithSignature("setVal(uint256)", z)
        );

        emit Response(success, data);
    }

}


texts: How can I force geth to create accounts in a different keystore?

texts:
In geth using Mist I noticed that I have 2 keystores in two different places. One for the main blockchain in Users/<user>/Library/Ethereum/keystore/ (OS X) and on testnet in Users/<user>/Library/Ethereum/testnet/keystore/.

I also have a private chain that I am setting up in an entirely different directory.

I haven't mined yet because I want to create a new account, but when I did create one from the command line geth account new it placed it in the keystore for mainnet.

I would say this is potentially very confusingat best dangerous at worst, especially if you demo using private blockchains and backing them up.

I'm guessing I'm missing a command argument of some kind to force the creation of a different keystore. How do I do that?


texts: Connecting geth and openethereum on a private network

texts:
Private network, running geth 1.9.15 and openethereum 3.0.1.
Parity converter was used to create the chain.json file for openethereum.
The two node show the exact same:

genesis block
network id

However, I can not connect them. I have a hunch the problem is with openethereum. I am trying to do all of this on 127.0.0.1, but my openethereum enode string has @192.168.1.38:30305 at the end of it. Among the parameters I called it with were --interface 127.0.0.1 and --jsonrpc-interface 127.0.0.1, so I'm not sure why it appears to be using a different ip address. When I try to use admin.addPeer() in my geth console, it returns true, as always, but it doesn't add the peer.
I have not found a way to add the peer in openethereum because it doesn't seem to have the admin api. openethereum doesn't seem to have a console like geth does. I have to open a separate node console and create the web3 object, which doesn't provide any admin api like the geth console does, at least not that I can find.
Also, when I send a transaction to the openethereum node, it doesn't mine it. It says it is mining, but no receipt ever shows up and no new blocks get added to the blockchain. The openethereum node periodically outputs lines like
2020-07-11 12:20:16     0/25 peers   792 bytes chain 3 KiB db 0 bytes queue 528 bytes sync  RPC:  0 conn,    0 req/s,   44 µs

You'll notice that way over on the right side it says 0 req/s. As soon as I send it a transaction, that changes to 1 req/s. Then, when it times out after 750 seconds with no receipt, it changes back to 0 req/s again. So it seems to know the transaction was sent.
I have never got openethereum to mine a transaction no matter what I try. When I run it, it runs just fine. I can connect to it with web3. But it always says it is mining and appears to receive transactions but does nothing.
Has anyone else got openethereum (a newer version since the name changed) to mine transactions?
Anyone have any ideas why these two nodes that have the same genesis block and the same network id won't connect?


texts: Why lot of Smart Contract implementations are using a single instance to hold all accounts?

texts:
I found a lot of example of tokens (like ERC20) using this pattern:

contract MyCoin {
    mapping (address => uint) balanceOf;

    ...
}

Those contracts are deployed once, the "balanceOf" mapping being responsible for holding balances of all users owning some of MyCoin.

Coming from the traditional world of RDBMs this is pretty counter intuitive... A class is commonly implemented with a table, and an instance of the class would be a line in this table. No one would create a table with a single line containing a blob for all data for every users. So my first idea for a coin implementation would rather be:

contract MyCoin {
    address owner;
    uint balance;

    ...
}

One instance of the contract would be deployed for each user holding some of MyCoin.

I understand this pattern raises many security issues (anyone can forge a contract with the same interface but different behavior, or just deploy an instance with a lot of coins coming from nowhere). No doubt those issues can be resolved but it would increase the complexity of my code, increasing the risk of bugs.

What I don't get is how the mapping in the first example could be an efficient way to store millions of accounts? Is there a limit? Are performances of such call affected by the number of items in the mapping? How?

Last question: is there some working / efficient / secure example of the second pattern?

Thanks a lot,


texts: How to initialise a mapping of a struct inside a function?

texts: Mappings are normally declared in the top part of the contract, however is there any way to instantiate a mapping - which belongs to a struct - while in a function?


texts: Smart Contract Encryption and Decryption so that only parties involved can read the content of Contract

texts:
I am trying to make a document sharing app after signing the NDA between 2 parties.

My Smart contract saves the address of involved parties as Sender(Party1 who makes the NDA) and recipient(Party2 who signs the NDA).

Once both parties signs NDA I want to share the documents between 2 parties for via smart contract.

I am planning to upload the encrypted document(which is encrypted by user while uploading) on a Server and keep the address and decryption key inside the smart contract itself and once NDA expires delete all the decryption keys from Contract so that users can not access documents anymore.

Problems I am facing are :

1, User do not want the name and address of parties to be readable in Smart contract so I need to encrypt everything inside Smart contract and only the involved parties should be able to decrypt and read the details of contract.

If I can do this then the address of document and encryption key to document will also remain safe.

What kind of en/decryption can I use for this situation?

I do not want to pass the encryption/ decryption keys between users.

Is there any public and private keys attached to Ethereum accounts?,
If Yes, How can I make use of those?

Please advise If my whole approach seems doubtful to you.


texts: What is the receive keyword in solidity?

texts: Solidity has a receive keyword. What is it and how do I use it?


texts: Understanding Low-Level Interface to Logs

texts:
This question is about Low-Level Interface to Logs, Solidity Documentation.

In given examples we are able to emit event normally:

pragma solidity ^0.4.0;

contract ClientReceipt {
    event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value
    );

    function deposit(bytes32 _id) public payable {
        // Events are emitted using `emit`, followed by
        // the name of the event and the arguments
        // (if any) in parentheses. Any such invocation
        // (even deeply nested) can be detected from
        // the JavaScript API by filtering for `Deposit`.
        emit Deposit(msg.sender, _id, msg.value);
    }
}

Or on a low-level:

pragma solidity ^0.4.10;

contract C {
    function f() public payable {
        bytes32 _id = 0x420042;
        log3(
            bytes32(msg.value),
            bytes32(0x50cb9fe53daa9737b786ab3646f04d0150dc50ef4e75f59509d83667ad5adb20),
            bytes32(msg.sender),
            _id
        );
    }
}

After the example there is this note:

  where the long hexadecimal number is equal to
  keccak256("Deposit(address,hash256,uint256)"), the signature of the
  event.

Questions:
1) What is hash256?
2) Why not bytes32?
3) hash256 == bytes32?


texts:
Hi I am running the Ethereum Wallet Ethereum-Wallet-win64-0-7-2.
1. I want to import an unencrypted private key without running some additional software, is this possible ?
2. Is is possible to import an unencrypted private key using the command line within the wallet ? (Wallet UI/Console)
3. Is it possible to import an unencrypted private key using import per-sale account ?

Now I am running Geth.exe on the console while the Geth is loading the blockchain I am using another consol window to import the private key.
The error massage is : Could not create the account encoding/hex invalid byte
Is this because the txt file is not encoded ?
Any ideas how I could import this private key without studying computer science for three years. Thanks


texts: Quorum Maker for recovery of blockchain data in secondary node

texts:
We are trying to setup multiple nodes in QUorum maker to make one node as a backup to be used in case the primary node fails for some reason. We are able to deploy our smart contract successfully but we find that the node directory gets populated with the contract address in the first node only but not in the second node.

Can quorum maker be used to have two nodes configured in "fault-tolerance" mode in such a way that if one node goes down, the front end application can still recover the blockchain data from the second node configured in quorum maker?

If so, kindly let us know the procedure for the same.


texts:
i'm trying to run truffle migrate and it gives me always this error. Error: The contract code couldn't be stored, please check your gas amount.

 MBP-de-Alicia-2:smartContracts alicialombarte$ truffle migrate
Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x7291b9d65712a87c6c9937fc7c6bc110398d718d49ca18cb8399ecdaf04f6a7f
  Migrations: 0xef1878e96466e0c68d47f8124cd7518f694256a7
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying idFactory...
  ... 0x0e1b9dbb9f4a2d12c1e57757b13ffce046ff32a719643fe0cf671542cce4898b
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
    at Object.callback (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:147:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-migrate/index.js:225:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Does anyone know why? i'm using Ganache CLI v6.0.3 (ganache-core: 2.0.2)
Thanks !

EDIT. here is my truffle.js

module.exports = {
  networks: {
    development: {
        host: "localhost",
        port: 8545,
        network_id: "5777" // Match any network id
      }
  }
};


texts: Unable to verify my contract on etherscan

texts:
I created a contract ERC20 but i unable to verify on etherscan.
https://etherscan.io/address/0x087aec9af9dac8259e5d5051044c45b51a1efa87#code

Error is :

Sorry! The Compiled Contract ByteCode for 'TokenERC20' does NOT match the Contract Creation Code for [0x087AeC9af9DAC8259E5D5051044c45b51a1EfA87].

Contract name(s) found: 'TokenERC20' , 'tokenRecipient'
Unable to Verify Contract source code.


texts: Processing speed for swapExactETHForTokens vs swap

texts: Is there a difference in transcation processing speed in UniswapV2 when using a swap function versus using the swapExactETHForTokens?


texts: Deployment of DAPP smart Contract on Ethereum MainNet

texts:
We are developing a DAPP based on ethereum. Current we are developing based on testrpc and its working perfectly.
We do want to decide on where to deploy DAPP.
Can we deploy on public Ethereum blockchain.
Is there any other variables that need to be considered when deployed a smart contract of the  decentralised application other than token in ethereum network ?

What about decentralised private ethereum blockchain.


texts:
I have three Ethereum nodes created with Geth. Two of them are on my machine (MacOS) and the third one is running on a virtual machine with Ubuntu. Because I used the same genesis.json and also the same networkid I can connect them, but the problem is that they don't gossip about already connected nodes.

Let's consider A, B and C being the nodes:

I start node A.
I start node B with the argument --bootnodes "enode of A" and after a while they are connected (they see each other in admin.peers).
I start C without bootnodes. Manually, I add B as a peer using admin.addPeer(). At this point B and C are connected BUT B doesn't gossip with C about A.

At the end of the scenario A knows about B, C knows about B and B knows about both A and C.

On this page: https://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network they say that Ethereum nodes gossip about each other. Am I doing something wrong?


texts: Easiest way to check which Ethereum network is being accessed?

texts:
Does anyone know of any Web3 queries that can be used to determine whether the underlying node is running for example, Ethereum vs Ethereum Classic?

Would eth_protocolVersion be a suitable query for determining this?


texts: Reverted tx on Ropsten but gas limit not reached

texts:
This is a timed crowed sale contract
https://ropsten.etherscan.io/tx/0xaa3fa69a32060ad578cb9bc2a94fcc4cf7109f4e743f54c527c18f764f634ebb

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.

If you look at the tx on etherscan the contract has plenty of gas to use.
Here is the migration that is being run

const ICOCoinCrowdsale = artifacts.require('./ICOCoinCrowdsale.sol');
const ICOCoin = artifacts.require('./ICOCoin.sol');

module.exports = function(deployer, network, accounts) {

//const openingTime = web3.eth.getBlock('latest').timestamp + 2; // two secs in the future
const openingTime = Math.round((new Date()).getTime() / 1000);
const closingTime = openingTime + 86400 * 20; // 20 days
const rate = new web3.BigNumber(1000);
const wallet = accounts[0];

return deployer
    .then(() => {
        return deployer.deploy(ICOCoin,
            {
                gas:1842978
            });
    })
    .then(() => {
        return deployer.deploy(
            ICOCoinCrowdsale,
            openingTime,
            closingTime,
            rate,
            wallet,
            ICOCoin.address,
            {
                gas:1834640
            }
        );
    });
};


texts:
tronbox.cmd migrate --reset --network shasta
Using network 'shasta'.

(node:17820) UnhandledPromiseRejectionWarning: Error: Invalid URL provided to HttpProvider
    at new e (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\node_modules\tronweb\dist\webpack:\src\lib\providers\HttpProvider.js:7:19)
    at Object.create (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\build\components\Provider\index.js:1:1403)
    at Config.get [as provider] (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\build\components\Config.js:1:6101)
    at C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\node_modules\@truffle\expect\index.js:4:18
    at Array.forEach (<anonymous>)
    at Object.options (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\node_modules\@truffle\expect\index.js:3:19)
    at Object.run (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\build\components\Migrate\index.js:1:3283)
    at C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\build\lib\commands\migrate.js:1:1229
    at Object.needsMigrating (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\build\components\Migrate\index.js:1:6092)
    at runMigrations (C:\Users\User\AppData\Roaming\npm\node_modules\tronbox\build\lib\commands\migrate.js:1:1096)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:17820) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:17820) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

tronbox.js
module.exports = {
  networks: {
    development: {
// For trontools/quickstart docker image
      privateKey: process.env.PK,
      userFeePercentage: 30,
      feeLimit: 100000000, // or fee_limit
      fullNode: "http://127.0.0.1:8090",
      solidityNode: "http://127.0.0.1:8091",
      eventServer: "http://127.0.0.1:8092",
      network_id: "*"
    },
    shasta: {
      privateKey: process.env.PK,
      userFeePercentage: 30,
      feeLimit: 100000000, // or fee_limit
      fullNode: "https://api.shasta.trongrid.io",
      solidityNode: "https://api.shasta.trongrid.io",
      eventServer: "https://api.shasta.trongrid.io",
      network_id: "*"
    },
    production: {
// Don't put your private key here, pass it using an env variable, like:
// PK=da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0 tronbox migrate --network mainnet
      privateKey: process.env.PK,
      userFeePercentage: 30,
      feeLimit: 100000000, // or fee_limit
      fullNode: "https://api.trongrid.io",
      solidityNode: "https://api.trongrid.io",
      eventServer: "https://api.trongrid.io",
      network_id: "*"
    }
  }
};


texts:
int  x; // Storage slot #0
    mapping (uint => uint)  y; // Storage slot #1
    uint []  z; // Storage slot #2

    function element() public  returns (uint a, uint b, uint c) {
      z.push(45);
      assembly {
          c:=mload(0)
      }

    }

z array is stored in storage. Running the below code returns c as 2. If I remove z.push(45), then c returns 0.
Why does it return 2 in case I have z.push(45). z is in storage, so why is it related to 0th address of memory(heap) ? I know 0th address is scratch space for hashing methods in memory, but i am curious why solidity stored number 2 in memory(heap) after doing z.push(45).


texts: Are events emitted from a contract synchronously?

texts:
Does anyone know how events emitted from a contract?

I can't seem to find an authoritative answer while googling and I am kind of worried that they are synchronous.


texts: Do SLOAD operations get cached in solidity?

texts:
When I access an unchanged value from storage multiple times, in the same function or transaction, does it get cached, or do I pay the SLOAD cost for each time I access it?

I can easily cache it in memory if not, but I'm not sure if I need to or not.


texts: What is INIT_CODE_HASH and how is it calculated / used in DeFi smart contracts

texts:
I am forking the Sushiswap Exchange code for educational purposes, and I have come across a variable in the code called INIT_CODE_HASH. I am struggling to understand exactly how this variable works, and how it is used in the various DeFi platforms.
My limited understanding is that INIT_CODE_HASH is used to verify which function of a contract a caller is calling, by using the hash of the init code (Not really sure what the init code is). For some reason I don't quite understand, this is both for security and efficiency purposes.
My Question:
What is INIT_CODE_HASH, and how is it calculated / used?


texts:
Is it possible to verify contracts on etherscan.io using the yul optimizer? Example truffle-config.js relevant section:
  compilers: {
    solc: {
      version: "0.5.16",
      settings: {
        optimizer: {
          enabled: true,
          details: { yul: true }
        }
      }
    }
  },

I am also using ABIEncoderV2 but I've read other questions and that doesn't seem to be the issue. It seems like I cannot get the bytecodes to match up.


texts:
Ever since I installed the necessary softwares to mine Ethereum, all the websites requiring passwords are asking to verify that's it's really me. Some using special code sent to email, some asking my secret question etc..

Does it mean that these Ethereum softwares are actually tracking me somehow? After all I just followed instructions which I don't know what are actually doing.. ?


texts: Ethminer connected and seems to be running fine (simulation was successful) but doesn't seem to be getting any jobs, is this normal?

texts:
Playing with ethminer, I can't tell if it's actually mining. I ran the simulation fine, then I connected to a pool but I am simply getting '''ethminer 0:06 A0 0.00 h - cl0 0.00'''
It looks like everything is running fine, but I'm not getting jobs. Is that normal?


texts:
In ethers.js,

provider.sendTransaction(rawTransaction).then((transaction) => {
    // A full Transaction Response is returned
    // - from
    // - to
    // - gasLimit, gasPrice
    // - nonce
    // - r, s, v
    // - wait() => Promise that resolves the Transaction Receipt once mined
    //             and rejects with an error is the stats is 0; the error
    //             will have a transactionHash property as well as a
    //             transaction property.

    let hash = transaction.hash;
});

Here it will return the receipt after wait() how can I write the wait in my code?

I use:

.then(function(tx){
wait()=>{}
｝）

This will not work.


texts:
I generate a code to create wallets for a private chain made with ethereum.

String password = unlockAccountParameter.getPass();
        ECKeyPair keyPair = Keys.createEcKeyPair();
        WalletFile wallet = Wallet.createStandard(password, keyPair);

        System.out.println("Private key: " + keyPair.getPrivateKey().toString(16));
        System.out.println("Account: " + wallet.getAddress());

        String fileName = WalletUtils.generateNewWalletFile(unlockAccountParameter.getPass(), new File("C:\\Users\\emendez\\Wallet"), true);

        System.out.println("File name: " + fileName);

Thats return me this output:

  Priate key: 67f7a218d5d595dff19cafca9384b5a6e0693bc085d7c16468b8a8a44e20135a
  Account: bf29892787a79bb66188f9c44ca9ffd9ccff37aa

  File name: UTC--2018-11-15T12-26-51.672000000Z--252209a58e16be3c43776e38ff4bfaeb70660cfb.json

The JSON file is in the path that write in code (in the real machine). But when I go to the geth console for list the account that are created in the node (virtualmachine) the account that I just created does not appear.

So i think that i cant make transaction between them.

Any help??


texts: Such as ERC20token smartcontract, just is the token balance of accounts, i want to make a smart contract to use token contract address and account address to find out the token balance of different accounts or different token


texts: Using web3 to sign a transaction without connecting to geth

texts: Is it possible to use the web3.js library in a client's browser to let them generate an address and sign a transaction without them connecting to an ethereum node?


texts:
I'm trying to import a contract from GitHub:

pragma solidity ^0.4.18;
pragma experimental ABIEncoderV2;
pragma experimental "v0.5.0";

import "github.com/ethereum/dapp-bin/library/stringUtils.sol";

However, it says, Error: Could not find github.com/ethereum/dapp-bin/library/stringUtils.sol from any sources;. What am I doing wrong?


texts: How to limit number of tokens that can be transfered in a given timeframe?

texts:
How can one ensure that an ERC20 token holder can’t send/transfer/other more than X token in given period Y where Y could an hour, day, week, month etc.

Would be better if this can be done without taking up any more storage space.


texts: Returns TX Object instead result in Truffle test

texts:
I'm getting

  AssertionError: expected { Object (tx, receipt, ...) } to be true

Here is my testing code

let apprOrOwnr = await this.erc721.isApprovedOrOwner(owner, tokenId);
expect(apprOrOwnr).to.be.true;

My contract

function isApprovedOrOwner(address _spender, uint256 _tokenId) external view returns (bool) {
        return _isApprovedOrOwner(_spender, _tokenId);
}

What am I doing wrong?

EDIT (add _isApprovedOrOwner function):

/**
 * @dev Returns whether the given spender can transfer a given token ID
 * @param spender address of the spender to query
 * @param tokenId uint256 ID of the token to be transferred
 * @return bool whether the msg.sender is approved for the given token ID,
 *    is an operator of the owner, or is the owner of the token
 */
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
    address owner = ownerOf(tokenId);
    // Disable solium check because of
    // https://github.com/duaraghav8/Solium/issues/175
    // solium-disable-next-line operator-whitespace
    return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}


texts:
Here's a snippet from the DAI stablecoin permit function:
uint wad = allowed ? uint(-1) : 0;
allowance[holder][spender] = wad;
emit Approval(holder, spender, wad);

(full source code can be found here)
Differently from the EIP-2612 which defines a "value" for the allowance DAI's approach appears to approve an unlimited allowance for the spender address.
Is it safe to permit a protocol to spend DAI on my behalf?
If not, to which use cases is DAI-style permit targeted to?


texts: is it possible to use IPFS Hash to ensure file integrity?

texts:
My question is if i can use the IPFS Reference/Hash to ensure file integrity. In other words if i have a file can i use a specific Hashfunction to ensure that the generated Hash of that file is equal to the IPFS Hash of that file and therefore the file didnt change. Or do i need to generate an extra Hash for this purpose (f.e. sha256)?

thanks in advance.


texts: How to find which smart contract forwarded funds to account

texts:
I have a website where I need to receiving ETH payments from my users. I have a smart contract that successfully forwards any transactions sent to it to another address (my storage account), and each user gets their own unique smart contract to send to so we know who to credit:

pragma solidity 0.4.21;

contract Forwarder {

  address public destinationAddress;
  event LogForwarded(address indexed sender, uint amount);

  function Forwarder() public {
    destinationAddress = msg.sender;
  }

  function() payable public {
    emit LogForwarded(msg.sender, msg.value);
    destinationAddress.transfer(msg.value);
  }

}

Is it possible for me to subscribe to all transfers into my storage account, and view the smart contract that created the transfer so that I can associate it with a user on my website and credit them? If not, is it at all possible to do what I'm trying to do without subscribing to each smart contract individually?


texts:
In Bitcoin the PoW mining has very little overhead in terms of bandwidth. The miners simply need to produce the PoW, which I believe is 32 bytes per 10 minutes.

In Casper I understand every validator can vouch for a block by signing it. Assuming the signatures are ECDSA with 80 bits of security, then each signature is 320 bits. If there are 1000 PoS nodes signing each block, that is 320,000 bits (40kB) per block.

If blocks come out every 17 seconds that is 84MB every 10 minutes, several orders of magnitude above the 32 bytes per 10 minutes in Bitcoin.

Are my numbers correct/reasonable? What is the expected network overhead for Casper's PoS mining? Does this affect blockchain bloat?


texts: Ethereum wallet shows "no accounts yet" and 0.00 balance

texts:
I last used Ethereum wallet in June or July this year. Yesterday I upgraded on macOS to 0.8.7. It is syncing very slowly; at this rate it will take a week to finish the remaining 189,000 blocks.

In the meantime I see the disturbing Message "You have no accounts yet" and it shows a balance of 0.00 Ether.

Is it possible I have to wait for sync to see my account reappear and my balance show up?

If that's not what's happening, what files on macOS should I look at, or recover if lost?

To be clear, this isn't an issue of losing a password. I just see "no accounts yet" and zero balance.


texts:
Here is a Geth command line option for miners:
--miner.noverify

The description in the documentation says that it "Disable remote sealing verification". But what does that mean? What is remote sealing in a mining context?


texts: Deploy contract with web3 with ABI in JSON file give me "SyntaxError: Unexpected token o in JSON at position 1"

texts:
I got problem with my deploy.js script to te deploy my smart contract with web3.

When I run it, I always got this error:

Attempting to deploy from account XXXXXXXXXXXXXX
(node:25929) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at deploy (/louis/ethereum/deploy.js:16:53)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:25929) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:25929) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

my deploy.js:

const Web3 = require('web3');
const fs = require('fs');
const compiledFactory = require('../ethereum/build/MandatFactory.json');
const provider = new HDWalletProvider(
    'stable setup lunar pyramid another another apple install load citizen check fame',
    'https://rinkeby.infura.io/v3/913ea7dd990444a58cc903fb97acc4a8'
);
const web3 = new Web3(provider);

const deploy = async () => {
    const accounts = await web3.eth.getAccounts();

    console.log('Attempting to deploy from account', accounts[0]);

    const result = await new web3.eth.Contract(JSON.parse(compiledFactory.interface))
        .deploy({ data: compiledFactory.bytecode })
        .send({ gas: '1000000', from: accounts[0] });

    console.log('Contract deployed to', result.options.address);
};
deploy();

I tried many things like
to change this:

const compiledFactory = require('../ethereum/build/MandatFactory.json');;

to this

const compiledFactory = fs.readFileSync('../ethereum/build/MandatFactory.json', {encoding: "utf8"});

and change this

 const result = await new web3.eth.Contract(JSON.parse(compiledFactory.interface))

to this

const result = await new web3.eth.Contract(JSON.parse(compiledFactory).interface)

I read that it could come from the version of web3, so I tried with many versions like 1.0.0-beta.35

But actually this my package.json:

"author": "",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "express": "^4.17.1",
    "fs-extra": "^9.0.0",
    "ganache-cli": "^6.9.1",
    "mocha": "^7.1.1",
    "next": "^4.1.4",
    "next-routes": "^1.4.2",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "semantic-ui-css": "^2.4.1",
    "semantic-ui-react": "^0.88.2",
    "solc": "^0.6.6",
    "truffle-hdwallet-provider": "^1.0.17",
    "web3": "^1.2.7"

And this is my compile.js to compile my contracts in JSON file :

const path = require('path');
const solc = require('solc');
const fs = require('fs-extra');

const buildPath = path.resolve(__dirname, 'build');
fs.removeSync(buildPath);

const mandatPath = path.resolve(__dirname, 'contracts', 'Mandat.sol');
const source = fs.readFileSync(mandatPath, 'utf8');
//const output = solc.compile(source, 1).contracts;

var input = {
    language: 'Solidity',
    sources: {
        'Mandat.sol' : {
            content: source
        }
    },
    settings: {
        outputSelection: {
            '*': {
                '*': [ '*' ]
            }
        }
    }
};

output = JSON.parse(solc.compile(JSON.stringify(input)));
fs.ensureDirSync(buildPath);

for (let contract in output['contracts']['Mandat.sol']) {
    fs.outputJSONSync(
        path.resolve(buildPath, contract.replace(':', '') + '.json'),
        output['contracts']['Mandat.sol'][contract]
    );
}

Thanks you for your help and sorry for my english


texts: How to call a smart contract function in a DAPP?

texts:
I am trying to make a DAPP.

I followed this link -

https://medium.com/@takleakshar/how-to-build-a-decentralized-full-stack-app-in-ethereum-and-react-42e63d45a208

This is how my 'Setup.js' looks.

import Web3 from 'web3';

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

const marketplaceContract = new web3.eth.Contract( ABI , 'Smart
Contract Address', {
from: '0x123....', // default from address
gasPrice: '20000000000' // default gas price in wei, 20 gwei in this
case
});

//const marketplaceContract =
web3.eth.contract(MarketABI).at(MarketAddress);
export { marketplaceContract };

As you can see, I am importing the smart contract with the name 'marketplaceContract'.

When I call a function from the smart contract using-

marketplaceContract.addGoods(name, user, age, brand, size, sp);

I get the output as

TypeError: _Setup__WEBPACK_IMPORTED_MODULE_5__.marketplaceContract.addAccounts is not a function

Although, addAccounts is a function.

I don't know if this is a problem with the version of web3. Please kindly help. Is there any other way to call the functions in my React-JS file?

PS - I don't know if I have to put the whole code here. If required, please tell me, I will put both the smart contract and the React file here. I didn't put it because it's very big.
Please don't start scorning me.

EDITS

When I have a .call() function, it works well. But when I have a function that stores some data in a struct datatype in the Blockchain, it does not work.
I used .send({from: accounts[0]}) for that function. Then the error pops up

Unhandled Rejection (TypeError): Cannot read property 'match' of undefined

I searched for this error. I deleted my package-lock.json file and node_modules and then did npm install.
Still, I get the same error.
How should I proceed?


texts: Why is there a difference between eth.estimateGas and the real cost in testRPC?

texts:
When I want to deploy a smart contract, I use the eth.estimateGas before deploying my smart contract. This gave me 688180 Gas.

let bytecode = compiledContract.contracts['Document'].bytecode;
let gasEstimate = web3.eth.estimateGas({
    data: bytecode
});

But somehow this estimation is false, and I have to set manually the gas to some value e.g. 4700000.

var myContractReturned = MyContract.new(param1, param2, {
   from:mySenderAddress,
   data:bytecode,
   gas:4700000 // gasEstimate not working here},
function(err, myContract){....}

Using web3.eth.getTransactionReceipt, I can see that the real cost was 817540 Gas. I know that the gas that is not used is automatically refunded, so there is no real problem but I'm curious to know why such a difference!

Thanks in advance!


texts: Ethereum Deposited Using Bitcoin Not Showing

texts: On 6/13, from Mist, I went through the "Deposit using Bitcon" option. My BTC are in Coinbase and as far as Coinbase is concerned, the transaction is confirmed. But, the Ethereum are not showing in my wallet. I tried looking up my address in Etherscan, but it also shows 0 Ethereum. Any idea?


texts:
I'm looking at https://stakingether.com/ for the list of staking pools with the possible earning and fees the pools are charging. As I understand it, a fee is charged by these pools to provide their infrastructure and service running validator nodes.

Based on the screenshot above, what is the relationship between the fee and earning percentage? For Coinbase, surely the nett earning couldn't be -16.04% (8.96% - 25%).
Could it mean that the fee is charged at 25% of ETH earned (25% * 8.96% = 2.24%)?


texts: app.vote(1, {from: web3.eth.accounts[0] }) not working

texts:
I am following a tutorial from Dapp University about building Election Smart Contract. When I run this command in the console:

app.vote(1, {from: web3.eth.accounts[0] })

I get the following error:

Thrown: <Error: The send transaction "from" field must be defined!

I know that "web3.eth.accounts" has been depreciated and I have tried a few ways to solve it but so far no luck.


texts: Can the Merkel trie state entry download period of a fast sync extend between geth runs, and how many trie state entries currently exist?

texts:
When initial synchronization (i.e., from block 1) is performed with --fast, both blocks and chainstates are downloaded separately.  In my current ongoing download (and apparently others) full synchronization is held up not by waiting for block downloads by waiting for state importation and processing.

What are the state database entries and how can I learn how many exist in the current full blockchain?  I'm not finding a status on https://ethstats.net or similar sites.

There is some discussion of the chainstate database entries here and here, and previous size here but I'd like to understand this more thoroughly.

UPDATE:
It appears these state database entries are the Merkel Patricia state trie that has to be downloaded before the pivot point is defined and geth moves on to a classical synchronization.  This state download period is taking many days and I've had to restart it multiple times.  The state count appears to always start at zero each time I restart geth.

So my new question is: Does the Merkel state trie download have to be done at one time, or is the state trie being appended from the previous geth run each time I restart geth?


texts: Two smart contracts interacting, should they know each other?

texts:
This may sound like a very naïve question. It's the first time I'm making interact two smart contracts (in general, I'm not very proficient with blockchain development).
I have these two smart contracts, one should call the other, and the second one should first check that the call received is from the first smart contract in order to execute what it is supposed to do.

My questions are: 1) can this be done? In the constructor of both smart contracts I have to include both the addresses, but each time I truffle migrate the addresses change...
2) is this scalable? Does it make sense to model my application in a way that all the contracts are kept in mind by one single smart contract that, once it receives updates from an oracle, it updates in cascade all the contracts he is storing the addresses?

Thanks!


texts:
yesterday 2.3.2021 at 18:25 i was hacked. they stole all my founds from metamusk wallet from my address 0xeD14989682D3770AC0a9AEB2608Aa2315cF312Df and took everything to this address 0x963904bf5962c7D7c9aE1F145B6b609Df848F4A4. Some of crypto is still there.
was reporting yesterday to etherium.io, metamusk, even report a scam but 10 hours later nobody did nothing. how can i get my crypto back.

SHIBA INU 50173B
SWISSBORG 900
POLKASTARTER POLS 100
TELCOIN 551,513
ETH 1.1


texts: How to return the index value of transaction?

texts:
I wish to return the new index value once the transaction is done.

pragma solidity ^0.4.18;
contract Courses {

    struct Instructor {
        uint age;
        string fName;
        string lName;
    }

    mapping (address => Instructor) instructors;
    address[] public instructorAccts;

    function setInstructor(address _address, uint _age, string _fName, string _lName) public {
        var instructor = instructors[_address];

        instructor.age = _age;
        instructor.fName = _fName;
        instructor.lName = _lName;

        instructorAccts.push(_address) -1;
    }

    function getInstructors() view public returns(address[]) {
        return instructorAccts;
    }

    function getInstructor(address _address) view public returns (uint, string, string) {
        return (instructors[_address].age, instructors[_address].fName, instructors[_address].lName);
    }

    function countInstructors() view public returns (uint) {
        return instructorAccts.length;
    }
}

So in the setInstructor I wish to return the index value like 0,1,2 (Whatever the index value will be there of public key index).

Can anyone help me with this?


texts: Calling contract with web3 keeps running out of gas

texts:
I am trying to test executing a method on an existing contract, but the transaction keeps running out of gas, and I can't figure out why. I am trying to call an Etheroll contract on the Rinkeby test network. (etheroll)

I am running a Geth node attached to the Rinkeby network and the node is fully synced and has an account with Ethereum in it (account) I am using web3 over a WS connection to this test Geth node. This is the code for the latest transaction I tried:

let abiObj = [.....]; // ABI object obtained from Rinkeby blockchain explorer
let myContract = new conSce.web3.eth.Contract(abiObj, '0xf5e8c6a9F35E79B7A632fD7A9FE4A1f0D5021837')

myContract.methods['playerRollDice(uint256)'](90).send({ from: "0x25921ee056a5add0c4952d8c060944afeba470b9", value: '200500000000000000', gasPrice: '2000000000', gas: '5000000' }).then(receipt => console.log(receipt)).catch(err => console.log(err))

When running this, it returns the following error, along with the transaction receipt:

Error: Transaction ran out of gas. Please provide more gas

I have tried upping the gas, the gasPrice, the value. My account should have more than enough Eth to cover the transaction. I have tried estimating the cost of the transaction as well, which returns a slightly different error:

Error: Returned error: gas required exceeds allowance or always failing transaction

I've been struggling with this and cannot figure out how to get this contract working, as you can see from the history of failed transactions linked to that account. If someone could help me tweak the code above to get it working or can post an example of themselves calling the Etheroll contract, or another similar contract I could try to call, that'd be great.


texts:
I am renting a linux server and would like to have access to an ethereum node on the server for a dapp. It seems impractical to host an entire node on the server as it would take up so much space. Is it possible to communicate with the blockchain without running a node? I haven't been able to find much support for light nodes.

How can I read from and write to the blockchain without having a full node?


texts: How are Ethereum security bugs fixed? what is the process?

texts:
When a security vulnerability (or a high risk bug) is found in Ethereum code. What are the actual steps of detection, report, fix and deployment that are in place to resolve the issue?

Are the bugs first discussed in a special forum dedicated to such bugs?

Do the bug fixes need the vote of miners or is the miners vote only for when there is a fork? Who votes on weather the bug fix is a go or not?

Who approves the fixes that are pushed to Ethereum code base if its an emergency situation and time is a factor?


texts: How did this address steal my Ethereum ERC-20 Tokens using Uniswap? 0x2b5b060d57b1333c9b2739e9c15b039726dd51ec

texts:
I was using my Trust wallet on my mobile and tried to do a swap from ETH to an ERC20 token but realized a day after that it got drained to this account: https://etherscan.io/address/0x2b5b060d57b1333c9b2739e9c15b039726dd51ec#comments
It also seems that this person was able to steal from others too. My main question now is how did this happen?
When I did the swap, I received my ERC-20 tokens, and it was sitting in my account fine. But looking at the blockchain, 5 hours later it moved to this person's wallet. However I bought another ERC20 token and managed to get it out when it arrived. So its safe to assume this "loophole" is done manually and there isn't a bot monitoring my address. Currently my ETH account still has $150 worth of ETH that isn't drained.
So I'm not sure what type of loophole did this hacker is using to steal my ERC20 tokens. Right now the possibilities is either trust wallet or Uniswap is comprised.


texts: Naive question: (Background - just started studying truffle framework) - in one place it mentions "it is possible to write your deployment as a single promise chain if you find that syntax to be more clear" - can some one give me an example of that? Thanks.


texts: Can I use Mist only as a wallet for a blockchain node in another machine?

texts:
I have a Mist wallet on Machine 1 and a private Geth node running a blockchain on Machine 2. Is it possible for me to submit a transaction from Machine 1 to the blockchain on Machine 2?

If yes, how?


texts: Reasons to develop DApp when you have to pay for executing logic

texts:
I am relatively new to the blockchain technology. I understood that DApps have some advantage over regular web apps such as no payment services as paypal are needed, no login is required etc.

However, since you have to pay for every logic that is executed in the blockchain, isn't it much more expensive to base a project on a DApp compared to a regular web app? Is it worth the extra costs?

EDIT:

Thank you for the thorough answers which helped me a lot in understanding the topic.


texts: Why is balanceOf() marked as constant in ERC-20

texts:
in. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md

it is written:

function balanceOf(address _owner) constant returns (uint256 balance)

I understand the usage of the constant modifier in decimals() and name() - but I am having trouble understanding why balanceOf() is constant


texts:
This question was asked in the comment section of What does TheDAO counter-attack by spamming actually do? (suggested by Stephan Tual).

Background links:

The attacks used a recursive call vulnerability as described in What is a recursive calling vulnerability?.
You can find a list of the accounts used in Which accounts are involved in mounting the recursive call vulnerability attacks on The DAO?.
You can find the period when the attacks occurred in Is there any way to determine how long it took for the DAO attacker to deploy the attack?.

Did the spamming counter-attack on The DAO attack work to slow down the attacks?


texts:
I'm trying to deploy a contract and I don't require Migrations.sol in any of my migrations. I don't even have this file in my contracts folder. And I run truffle migrate inside my project folder.
But it says that can't deploy cause can not find artifacts for Migrations.sol. And shows me that

  Error encountered, bailing. Network state unknown. Review successful transactions manually.
  Error: Could not find artifacts for ./Migrations.sol from any sources
      at Resolver.require (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:69108:9)

Please help me understand what's happenning and how do I solve it?


texts:
The virus in my wallet, when I transfer eth,my wallet will be emptied and the eth will be transferred to an unknown address.
I want to know if geth is running correctly，
and I don't know what it is
"auto geh"
I'm pretty sure I didn't start it
In fact, I don't know where there is a problem, it seems to be all right


texts: using block.blockhash instead of block.timestamp for 30 minutes

texts: I would like to check if the time has passed 30 minutes before executing a function in my contract. I know how it is done using block.timstamp .. But I want to use block.clockhash as it is more secure... how do I do that?


texts: How do I pass arguments to a contract-constructor with web3Js (>=version 1.0)

texts:
I was on https://www.myetherwallet.com/#contracts and wanted to deploy a contract.

It worked with a contract with a constructor without arguments, but my contract constructor looks like this:

  function CrowdFunding(address _arg1, uint256 _arg2, uint256 _arg3) public {
    arg1 = _arg1;
    arg2 = _arg2;
    arg3 = _arg3;
  }

But how do I pass my arguments (arg1, arg2 and arg3)? I'm using web3JS.


texts: Can we transfer ethers using a EOS smart contract

texts:
Suppose we  want to transfer ether from our EOS smart contract. I know atomic swaps is not possible between ether and EOS blockchain, may be in the future but not now. Is there any other ways round to solve this problem?

I am also want to ask that if EOS can be transferred using ethereum contract?


texts:
I have listed the versions of web3 versions installed in my system

 npm ls web3
        inbox@1.0.0 /home/mdvenkatesh/Desktop/etherium solidity programes/inbox
        +-- truffle-hdwallet-provider@0.0.6
        | `-- web3@0.18.4
        `-- web3@1.0.0-beta.26

In my code i am using async await.  i want to compile my code and run

But i am getting error

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

SyntaxError: await is only valid in async function

1) How to use version 1 without uninstalling the previous version of web3

2)In  My previous projects i am using promise's if i uninstall the old version will it effect my previous code while compiling

3) I tried to remove  using npm but showing me error

npm remove web3@0.18.4
npm WARN truffle-hdwallet-provider@0.0.6 requires a peer of truffle@4.x but none is installed. You must install peer dependencies yourself.
npm WARN inbox@1.0.0 No description
npm WARN inbox@1.0.0 No repository field.


texts:
How to encode an object with ABIEncoder V2?

For example, this one:

{
  items: [
    {
      str: "str",
      num: 5,
      bol: true
    }
  ]
}

Solidity struct:

struct Item {
  string str;
  uint   num;
  bool   bol;
}

struct Arg {
  Item[] items;
}


texts: How Listen to an smart contract event using web3 and angular?

texts:
I am using web3@0.20 inside angular to call smart contract functions,

I want to know how to watch a smart contract event in angular?

using javascript is easy and it works :

sEvent.watch(function(error, result){
        if (!error)
        {
            console.log(result);
        } else {
            console.log(error);
        }
    });


texts: Transaction cost exceeds current gas limit. (Take II)

texts:
I am working on a private blockchain using Parity.  I have changed the gasLimit parameter to read "4712388" instead of the default (0x1388) and when I try to truffle migrate a contract, I get this error:

  [-32010] Transaction cost exceeds current gas limit. Limit: 4700036,
  got: 4712388. Try decreasing supplied gas.

Q1: Where does this 4700036 value come from?  Be specific.  What actual chain spec parameter handles this?

Q2: Can you confirm that this is taken from a different place than the gasLimit parameter, which is set to 4712388?

EDIT: Weeks, later, I have a new issue.  It's possible this relates to my other question:

Why would gasLimit be read as 4,700,036 instead of 4,712,388?


texts: Deploying smart contract with undefined state variables

texts:
I have a factory contract (Factory.sol) that creates new contracts (YourContract.sol). The createNewContract function in the factory defines some state variables that the new contract picks up in its constructor.

When I try to deploy my project in Truffle I'm unable to deploy YourContract.sol because of the undefined variables ("Invalid number of parameters for "undefined". Got 0 expected 3!")

Question 1.
Do I have to deploy YourContract.sol for my Factory.sol to work?

Question 2.
Is there some way I can define the state variables in YourContract but still have them change with the new variables passed through the createNewContract function?

Factory.sol:

pragma solidity ^0.5.1;

import "./YourContract.sol";

contract Factory {

    //
    // Factory general info
    //
    address Admin;

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

    function createNewContract(string memory Name, string memory Type, uint Fee) public returns(YourContract) {
        address YourContract = address(new YourContract(Name, Type, Fee));
    }

YourContract.sol:

pragma solidity ^0.5.1;

import "./Factory.sol";

contract YourContract {

    //
    // The state variables that per now are undefined
    //
    string public Name;
    string public Type;
    uint public Fee;
    address owner;

    //
    // the constructor that pulls info from the function
    //
    constructor(string memory Name, string memory Type, uint Fee) public {
        owner = msg.sender;
        Name = Name;
        Type = Type;
        Fee = Fee;
    }


texts:
Please help me and it is quite urgent.

Started from last week, I could not use the Mist and Ethereum wallet on a window environment. I always uses the test-net, however, it just stop sync again. I have removed and reinstalled it. I tried the latest version. It stopped to sync once the initiation of the Application was finished (once the full testnet downloaded). Sometimes, it just re-downloaded everything again. Thank you for your help.


texts: Drizzle react app , how to display functions return values?

texts:
I have written an asset transfer contract wherein a function createAsset returns a uint256 assetNo and emit an event (event NewAssetNo(string _message, uint256 _assetno);
I am not able to display the function return values and event emit data in drizzle . My MyComponents.js code is as follows
import React from "react";
import { newContextComponents } from "@drizzle/react-components";
import logo from "./logo.png";

const { AccountData, ContractData, ContractForm } = newContextComponents;

export default ({ drizzle, drizzleState }) => {
  // destructure drizzle and drizzleState from props
  return (

VATZCAR SMART CONTRACT

          DEMONSTRATION OF ASSET TRANSFER

Your Present Active Account & its Balance is :

        <AccountData
          drizzle={drizzle}
          drizzleState={drizzleState}
          accountIndex={0}
          units="ether"
          precision={0}
        />

Vatzcar Asset transfer

        A blockchain contract for storing and sharing data and other parameter of an asset.

          Lets create an asset!

        <ContractForm
        drizzle={drizzle}
        contract="Asset"
        method="createAsset"
        labels={["Name of Car.", "ETH Address of Owner" , "Other Details" , "Year of Manufacture"]}
        />

Now herein , I need to display the function return values and event emit data.
Please suggest
Complete project on github at https://github.com/ashishk74/Vatzcar
Thanks


texts:
I can't seem to understand where this error comes from. Maybe someone can help

My token solidity file :

pragma solidity >=0.4.2 <0.6.0;

    contract LairToken {
    //Name
    string public name = "Lair Token";
    //Symbol
    string public symbol = "LAIR";
    string public standard = "Lair Token v1.0";
    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    constructor (uint256 _initialSupply) public {
        balanceOf[msg.sender] = _initialSupply;

        totalSupply = _initialSupply;
        // allocate the initial supply
    }

        // Transfer tokens

      function transfer(address _to, uint256 _value) public returns (bool sucess) {
        // Exception if the account doesnt have enough

        require(balanceOf[msg.sender] >= _value);
        // Return a boolean
        // Transfer Event
        // Transfer

      }

}

My test file js:

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

contract ('LairToken', function(accounts) {

var tokenInstance;

it('initializes the contract with the correct values', function() {
return LairToken.deployed().then(function(instance) {
    tokenInstance = instance;
    return tokenInstance.name();
}).then(function(name) {
assert.equal(name, 'Lair Token' , 'has the correct name');
return tokenInstance.symbol();
}).then(function(symbol) {
 assert.equal(symbol, 'LAIR', 'hast the correct symbol ');
 return tokenInstance.standard();
}).then(function(standard) {
assert.equal(standard, 'Lair Token v1.0', 'has the correct standard' );
});
})

it('allocates the initial supply upon deployment', function(){
 return LairToken.deployed().then(function(instance) {
    tokenInstance = instance ;
    return tokenInstance.totalSupply();
}).then(function(totalSupply) {
    assert.equal(totalSupply.toNumber(), 1000000, 'sets the total supply
to 1,000,000');
    return tokenInstance.balanceOf(accounts[0]);
}).then(function(adminBalance) {
    assert.equal(adminBalance.toNumber(), 1000000 , 'it allocates the
initial supply to the admin');

    });

 });
});

it('transfers token ownership', function() {
return LairToken.deployed().then(function(instance) {
  tokenInstance = instance;
  // Test `require` statement first by transferring something larger than
the sender's balance
  return tokenInstance.transfer.call(accounts[1],
 99999999999999999999999);
}).then(assert.fail).catch(function(error) {
  assert(error.message.indexOf('revert') >= 0, 'error message must
contain revert');

});

});

Error that shows upon testing


texts: Unable code fails when initializing mapping of structure

texts:
Hi I have this structure, but when I call the function joinLottery, the mapping for gamblers[0] is not updated. Need help to understand why is this happening.

struct Gambler {
    uint token;
    uint encRandomNumber;
    bool exist;
    address gamblerAdd;
    address issuer;
}

mapping (int =>  Gambler) public gamblers;
uint public currentNumofGamblers=0;

function joinLottery (uint _token, uint _RandomNumber,
    address _issuer){
    Gambler newGambler = gamblers[int(currentNumofGamblers)];
    newGambler.token = _token;
    newGambler.encRandomNumber = _encRandomNumber;
    newGambler.exist = true;
    newGambler.gamblerAdd = msg.sender;
    newGambler.issuer = _issuer;
    currentNumofGamblers++;
    winningNumber = RandomNumber;
}


texts:
I have an API (expressjs - nodejs) listening for different events from my contract.

var web3 = new Web3(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
var tokenContract = new web3.eth.Contract(tokenAbi, URL.tokenAddress);

tokenContract.events.EventTest({
    fromBlock: 'latest'
}, function (err, event) {
   console.log('event triggered');
});

For this, I need a provider. When I'm using parity:

parity --chain ropsten

Everything works fine.

But when I try with Geth, I NEVER received events from my contract:

geth --testnet --ws --wsport=8546 --wsorigins="*"

I'm well connected to the network because :

web3.eth.net.getId().then(function (id) {
     console.log('ID network chain', id);
});

Return me the id 3.

Do I miss something?
Thank you in advance.


texts: How can I call arbitrary function with arbitrary parameters from Solidity?

texts:
I am working on a voting library that allows members of a voting-DAO-like organization to vote on arbitrary actions. Security considerations (I know, arbitrary code execution is evil...) and efficiency (this.call is a CALL and not JUMP hence more expensive in terms of gas and not able to call internal functions) aside, how would I implement this without knowing the function to be voted upon at compile time of the voting library?

I know of this method:

bytes4 functionSig = bytes4(sha3("myFunc(uint256,address)"));
uint parameter1 = 123;
address parameter2 = 0xdf190dc7190dfba737d7777a163445b7fff16133;
// now wait for voting to be completed and upon positive outcome do:
this.call(functionSig, parameter1, parameter2);

but this requires me to know at least the number and types of parameters. How could I generalize this? I guess there must be something along the lines of

bytes callDataGeneratedSomehow = ...
this.call(callDataGeneratedSomehow)

But how can I generate the callDataGeneratedSomehow?


texts: How to construct the network and account at client side

texts:
I am doing a project which is related to the Ethereum. But I faced the problem, so I want to ask you something.

I’ll explain my project briefly. After a team meeting or purchase of materials, the application will be used to recognize receipts issued and deploy them in a block chain using Etherium's smart contract.
I use centOS10 server and maria database. I want to build a smart contract on a private network with browser solidity using the Remix platform.

We use the application to register the team and save it as a server. At this time, I would like to know whether it is possible to automatically create a user in the block chain every time a server is registered on the server, and if possible, please tell me a brief idea.


texts: Please Help! ReplaySafeSplit contract not working after sending too much ETH

texts:
I am hoping someone has a answer to what I think is a relatively simple question. I started splitting my ETC from ETH using the ReplaySafeSplit contract. Some test and smaller transactions worked fine, so I decided to send the rest of my initial ETH/ETC balance through the contract.

The contract worked fine on the ETH chain, but didn't get replayed on the ETC chain because I neglected the gas cost so there were insufficient funds to execute. All my ETH is fine which is the main concern, but now the ETC is "blocked" with this invalid call. When I subsequently tried to send smaller amounts of ETH through the splitter contract, nothing ever arrived on the ETC chain.

Does anyone have any ideas how to reset the ETC side to allow the valid splitter calls to go through? Thanks for your wisdom.


texts:
I'm writing a smart contract where participants are asked to submit a value (1 to 1000000) in the submission period, and then reveal what that value is in the revealing period.

In order to hide it from other participants, I'm thinking of using the built-in SHA3 hash function.

Originally I thought of simply asking the player to provide a SHA3 hash of the value, but then realized anyone could figure out the original value, since it's easy to compute SHA3 hashes of all numbers from 1 to 1000000 and just find the matches.

The alternative is to concatenate the number with an arbitrary local value, send the hash of that, and in the reveal phase ask the participant to provide both values.

Is this method workable? Is this a standard way of hiding moves in Ethereum? Are there better alternatives?

Thanks!


texts: Why do some contracts use multiple balance and supply variables?

texts:
I'm trying to understand smart contracts. Now I do understand the basic template. However, many token's I see on the internet use different code. Many of them have a different way of storing balances and supply. Example: https://github.com/HogeFinance/token/blob/main/contract.sol. In this contract you see the supply is kept in these 2 lines
uint256 private constant _tTotal = 1000000 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));

and balances are kept in these 2 lines
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;

What does the t and r stand for and why do they use 2 variables?


texts:
Uncaught (in promise) Error: invalid address
    at inputAddressFormatter (formatters.js:271)
    at inputTransactionFormatter (formatters.js:97)
    at method.js:89
    at Array.map (<anonymous>)
    at Method.formatInput (method.js:88)
    at Method.toPayload (method.js:114)
    at Eth.send [as sendTransaction] (method.js:139)
    at SolidityFunction.sendTransaction (function.js:136)
    at SolidityFunction.execute (function.js:219)
    at contract.js:188

code reference:https://github.com/dappuniversity/ipfs_image_uploader

Script.js

this is the script to get account

 this.state.web3.eth.getAccounts((error, accounts) => {
     simpleStorage.deployed().then((instance) => {
        this.simpleStorageInstance = instance
        this.setState({ account: accounts[0] })
        // Get the value from the contract to prove it worked.
        return this.simpleStorageInstance.get.call(accounts[0]);

      }).then((ipfsHash) => {
        // Update state with the result.
        return this.setState({ ipfsHash })
      })
    })
  }


texts: What are the most notable and game changing features of the new Constantinople Ethereum upgrade?

texts: The Constantinople Ethereum upgrade is a big upgrade to the network. What are some of the most notable and game changing features of this new upgrade?


texts: Are there any downsides to if...else logic versus rejecting in a function

texts:
Pretty much all examples of contract functions I see use the require(...) pattern. If the initial condition is not as expected, an error is thrown and the transaction is reverted.

I don't like this pattern because the consumer will not know why they got an error, especially if the function logic is complex. Is there any downside to simply using if...else + events instead?

Instead of:

function AddUser(address _user) {
    require(!userExists(_user));
    ... add the user ...
}

I would do:

function AddUser(address _user) returns (bool) {
    if (userExists(_user)) {
        UserExistsEvent(_user);
        return false;
    } else {
        ... add the user ...
        return true;
    }
}

This way the caller will know exactly what happened in the callee function (by return value and/or event) instead of getting some generic error.

Am I missing something? Why are most functions I see follow the require/throw pattern instead? Is it cheaper?


texts:
I'm interacting with the blockchain using MetaMask.
Here's my JS code:
var filter = web3.eth.filter('latest');
    filter.watch(callback)

function callback(error, result){
    console.log(result);
}

After I run this code I start to recieve 32 byte hashes (1 hash in 10 - 15 seconds).
VM183:5 0x58e2dee05f23f4eed79505c5bf206a9f0a40fa63b7292e0e6e74f7d617cc96c0
VM183:5 0x6e4bde273ade0e8a6f89043e984fa9868f9a5be8f872ebd49886d151575e71c4
VM183:5 0xea0a0d730a6a478adda9d612b4a17451732d3a570ff8d8cd3c19ea0b7808c944
VM183:5 0xa28edff62ecd25fe579f1bd369d215f5587dee6f6be1d69f85d3995f0d7bb0c8
VM183:5 0xe382fc446246e83124205535b915768c16f5d2e1ebb72e9a171da770ec827c89
VM183:5 0x2f246cb4f09e88f05b4f19539d4aac2a4bcfd8294f18899cb5df14cd7941885c
VM183:5 0x1621d5b8eda67208a146b043b3c23f1bc89c918cfec011106c6714f05ccd37bf
...

Here's a browser console snapshot:

What are those? There are not txhashes/blockhashes, because when I put any of them into the search field on https://testnet.etherscan.io I get:

Unable to locate Transaction entry

Maybe they are signatures of events that fire on the blockchain when the new block is mined. I'm really confused.
From web3 api docs:

filter.watch(callback): Watches for state changes that fit the filter and calls the callback.

What are state changes in this case?


texts: From which HD wallet node is the private key in ethereum generated from?

texts:
I know how to generate a valid mnemonic and a valid address associated with that mnemonic. However I'm unsure how to generate a private key in ethereum. In Bitcoin, the master node is where you'd get the private key (sometimes called the master private key)

However in ethereum, it seems that generation is kept very straight (the path is a standard "m/44'/60'/0'/0" and it seems that ethereum wallets do not take advantage of more than one account or in some cases more than one address.

Therefore, which node is the private key generated from? The root node and the child node in the path have different extended private keys?

Tag on question, how can I format the extended private key so it is not extended anymore?


texts: How do I send an arbitary message to an Ethereum address?

texts: How can I send a message to another Ethereum address? And how would that user receiving know that its a message? Is there an Ethereum wallet that will show that I sent a message to that address? And what is the max size I can send?


texts:
I am continuously receiving "Bad Jump" Error. I followed a guide found here:
Why did my withdrawal from EtherDelta fail?

and have figured out my token value for deposit and withdraw is set to 0. Here is the transaction:
https://etherscan.io/tx/0x77224b7b7b71326e8bbcbb5fdcd4dc6d9daabc0729a8eb05c1b24e61bc11df1b

I need to change the deposit and withdraw amount to do my entire balance if desired. Will pay .5 ETH to first person that resolves this issue for me step by step.


texts:
I've created a token on testnet out of curiosity. Token was created I'm able to transfer token to other testnet wallet I created.

I'm interest to run an airdrop to all of this testnet wallet but I'm struggled to find an easy guide on how to do that. (I'm not from programming based though)

My logic behind an airdrop should consist of :

Recipient address and number of token they entitled to (unsure in what format this data should compile in)
The main wallet that hold all the token (rather than a contract)
A script that execute the airdrop by matching the "amount of token recipient entitled to" and "their wallet address"
A mass send script to perform the airdrop.

Anyone can assist on this please? Although I'm not profiting from it but still, I find it interesting if I'm able to do the whole "basic" thing.


texts: How can I reliably induce a blockchain fork for testing purposes?

texts:
I would like to reliably induce a fork on a private testnet so that I can test the behavior of off-blockchain code that interacts with contracts.  (see related questions as to why I would want to do that).  Would probably useful for automated testing of geth and other node implementations as well.

By reliable, I mean repeatable, with the same result every time, so that I can run this in an automated test system.

A similar question appeared on the ethereum forums.


texts: Accessing public variables of smart contracts

texts:
I've got the following contract:

pragma solidity ^0.4.11;

contract Zusatzaufgabe {

    struct Student {
        string name;
        string vorname;
        uint matnr;
        uint punkte;
        bool[] solved;
    }

    address[] public addressen;

    mapping(address => Student) public studenten;

    modifier hurdle(uint _n) {
        require(_n == msg.value/2);
        _;
    }

    modifier onlyTillTest() {
        require(block.timestamp < 1499702400);
        _;
    }

    function Zusatzaufgabe(){

    }

    function register(string _name, string _vorname, uint _matnr) onlyTillTest(){
        studenten[msg.sender] = Student(_name,_vorname,_matnr,1,new bool[](3));
        addressen.push(msg.sender);
    }

    function onepoint() payable hurdle(10000) onlyTillTest(){
        if(studenten[msg.sender].solved[0] == false){
            studenten[msg.sender].solved[0] = true;
            studenten[msg.sender].punkte += 1;
        }
    }

    function twopoints(uint _value) onlyTillTest(){
        if(studenten[msg.sender].solved[1] == false
        && _value == studenten[addressen[0]].matnr
        ){
            studenten[msg.sender].solved[1] = true;
            studenten[msg.sender].punkte += 2;
        }
    }

    function sixpoints(bytes32 _h, uint8 _v, bytes32 _r, bytes32 _s) onlyTillTest(){
        if(
            studenten[msg.sender].solved[2] == false
            && ecrecover(_h, _v, _r, _s) == msg.sender
            && _h == sha3(this)
        ){
            studenten[msg.sender].solved[2] = true;
            studenten[msg.sender].punkte += 6;
        }
    }
}

To sucessfully use the function twopoints, I need to get the value of studenten[addressen[0]].matnr.

How can I access this by console with web3?

MyContract.studenten[addressen[0]].matnr doesn't work, even though it is public.

ReferenceError: addressen is not defined

How do I access this value?


texts: How to connect web3.js 1.0.x to Metamask

texts:
I am using web3.js 1.0.0-beta.36 to connect to the blockchain.

But unfortunately this code cannot connect to Metamask, if it has been enabled.

var metamask = false;
if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
    metamask = true;
    web3.eth.defaultAccount = web3.eth.accounts[0];
} else {
    web3 = new Web3(new
    Web3.providers.HttpProvider(infuraUrl));
    var address = web3.eth.accounts.create().address;
}
myContract = new web3.eth.Contract(abi,contractAddress);
myContract.methods.Register((Name,Id).send({},function(error,result){
    if (! error)
        console.log(result);
    else
        console.log(error);
});

When we run this program with Metamsk it displays this error:

Error: Returned error: Error: MetaMask Tx Signature: User denied transaction signature.

but when I mention a fixed address it works:

myContract.methods.Register((Name,Id).send({from: '0x...'},function(error,result){
        if (! error)
            console.log(result);
        else
            console.log(error);
    });

For some reasons I can't bring the address itself in the source code and I want it to get the address from Metamask.
What should I do?


texts: How to map multiple time and index value on same address

texts:
I wish to map the time to the address key. But currently it is working on the index key only. I just want to map time as well. Means the current time. So that I can able to get the record with time as well.

pragma solidity ^0.4.17;

contract Experment2 {
uint public creationTime = now;
struct Record {
  // address owner;
   //uint id;
   string name;
   string senderaddress;
   string reciveraddress;
   string scheduletime;
   string scheduledate;
  // uint Index;
   uint time;
}
mapping (uint => Record[]) records;

function setRec (uint id, string name, string senderaddress, string reciveraddress, string scheduletime, string scheduledate, uint time) public {
     records[id].push(Record(name, senderaddress, reciveraddress, scheduletime, scheduledate, time =now));
}

function getrec(uint id , uint index) constant returns(string, string, string, string, string, uint){ {
    var a = records[id][index].name;
    var b = records[id][index].senderaddress;
    var c = records[id][index].reciveraddress;
    var d = records[id][index].scheduletime;
    var e = records[id][index].scheduledate;
    var f = records[id][index].time;

}
return(a,b,c,d,e,f);
}

function get_last_ten(uint id) constant returns (uint[10]){
    //uint[10] memory lastItem1;
    uint[10] memory lastItem2;
    for(uint i=0;i<10;i++){
        if(records[id].length>i){
          //  lastItem1[i] = records[id][records[id].length-i-1].index;
            lastItem2[i] = records[id][records[id].length-i-1].time;
        }
    }
    return (lastItem2);
}
}

Like in the above code the mapping is only through with index value. I can onl manage to return the current time. But I want to map the data on time as well.

So that I can run

function getrec(uint id , uint time) constant returns(string, string, string, string, string, uint){ {
    var a = records[id][time].name;
    var b = records[id][time].senderaddress;
    var c = records[id][time].reciveraddress;
    var d = records[id][time].scheduletime;
    var e = records[id][time].scheduledate;
    var f = records[id][time].time;

}
return(a,b,c,d,e,f);
}


texts: How can I store structure items in a variable

texts:
I am learning to code in solidity and stuck with view functions.
I am trying to return values taken dynamically in a structure using view function. Is there a way to do it is solidity? I tried it but it always throws an error "invalid opcode" or if I use loops it gives warnings like unreachable code.


texts: does vyper support contracts making contracts?

texts:
I am trying to create manager contract that generates player contracts for a game. Right now I am using vyper to try and generate new contracts but that seems to be failing. I know you can have a contract make new contracts in solidity but that not work for vyper?
Thanks


texts:
Is it likely to receive more token airdrops to one of the original Ethereum addresses from the crowdsale?

Hi there,

I participated in the original Ethereum crowdsale and I used to store a certain amount of ETH on that address.

I still have the address but now it's rather empty.

I used to receive airdrops ever so often but ever since I emptied that account it seems like the airdrops are coming less frequently.

Is it a good idea to keep storing ETH on an address which participated in the original crowdsale? Does that increase the chances of airdrops, compared to storing value in say DAI on a non-original crowdsale ETH address?

Vesa


texts: How do I check if a bytes32 variable in a mapping has been assigned value?

texts:
For example, for:

mapping(address => bytes32) public addressName;

which one of the following syntax is correct?

address _address = 0x...; //an actual address
require(addressName[_address]!="");
require(addressName[_address]!=0);
require(addressName[_address]!=null);
require(addressName[_address]!=bytes32(""));
require(addressName[_address]!=bytes32(0));


texts:
Is there a best practices method for running Parity through a SOCKS5 proxy?  Or should I try to figure one out.

This question was not considered long enough, so this is filler.  But I think I'm right that the above question was clear and complete I hope.


texts: ERC721 - Create 1000 tokens in one function call

texts:
I have implemented a contract where a set of ERC721 tokens should be generated with a function call in private net. Code as follows :

function mint(
    address _owner,
    uint256[] _id
)
    onlyOwner
    external
    returns (uint256)
{
    for(uint i = 0; i<_id.length; i++){
        super._mint(_owner, _id[i]);
    }
}

It creates up to 33 ERC721 Tokens, then the gas hits the gasLimit and loop ends. I am running it on my private net with genesis file as follows:

{
  "config": {
  "chainId": PrivateNetworkID,
 "homesteadBlock": 0,
  "eip155Block": 0,
  "eip158Block": 0
},
"alloc": {
"0x0000000000000000000000000000000000000001": {"balance": "111111111"},
"0x0000000000000000000000000000000000000002": {"balance": "222222222"}
},
"coinbase"   : "0x0000000000000000000000000000000000000001",
"difficulty" : "0x20000",
"extraData"  : "",
"gasLimit"   : "0x8880000",
"nonce"      : "0x0000000000000042",
"mixhash"    :
"0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" :
"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp"  : "0x00"
}

JS :

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

 //randomtoken - Array containing 33 tokenID
  return instance.mint(account, randomtoken, { from: account, gas: 4600000 }).then(function (result) {

    console.log('Result = ' + JSON.stringify(result));

  })
});

In js if I change the gas:4600000 to a higher value, gaslimit exceeds error occurs.

How can I resolve this?Is it possible to create at least 1000 tokens in a function call? Help will be appreciated :)


texts: Slither Error: Invalid compilation: Solidity version not found ['']

texts:
I work with Truffle Fluidity to get an analysis on my contract. My contract is in contracts  file that Truffle determines that. I preformed all steps that Truffle mentioned in document. I work with Windows 10 and installed Ubuntu 18.04 as its subsystem, So i can work with Ubuntu Terminal in Windows. Now, i have Truffle Fluidity and all its tools in my directory. But, Whenever i command slither ., to get an analysis, the followed message emerges in the terminal:
ERROR:root:Error:
ERROR:root:Invalid compilation:
Solidity version not found ['']
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues

I don't know what this error tells me and how i can solve it. The solidity version, that used in the contract, is 0.7.x and Truffle's compiler is set up to that. What is the problem that i can't see that?


texts: Stop Data mining on Private Blockchain running on Etherrum platform

texts: We have setup a private blockchain platform using Ethereum and we are using Java based UI layer for it. Can we stop mining process as it is taking lots of time and making the transactions slow?


texts: I went on the site, got my Keystore file number and my Private Key number but I cant figure how to get my address? Tryed for hrs.


texts: Call a smart contract from the protocol level

texts: I am wondering if it is possible to call a function of a smart contract every time a block is mined, perhaps as part of the coinbase transaction? The result of the call would be to send a percentage of the block reward to a storage contract.


texts: What does it mean to get rewards on the DAO?

texts:
How are the reward tokens generated on the DAO?

I don't really understand. If I back a project it gets funding right? Are the managers of the project required to "give back" to the DAO if the project is very successful (economically speaking)?


texts: Why raise a Created event in a Smart Contract constructor?

texts:
Reading through the Bancor code I see this:

function SmartToken(string _name, string _symbol, uint8 _decimals)
    public
    ERC20Token(_name, _symbol, _decimals)
{
    NewSmartToken(address(this));
}

What is the purpose of raising an event in the constructor? What value could it be adding to a client? Is it just an easy way to get the block the contract was created at? I imagine this is doable in any case.


texts:
I already have my light nodes working but in fast sync mode does not work the version of geth 1.9.3, I got these settings

Geth Version: 1.9.13-stable
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.13
Operating System: linux
GOPATH= GOROOT=/usr/local/go

and I already downloaded all blockchain without errors or stoping the sync, but at the end does not work, show me all transactions and blocks details by by hash or other operations but wallet's balance = 0 does not work :(

thanks a lot.


texts:
After I finished my single node PoA setup, I wanted to test how many TPS it can handle.

During the load testing, I noticed that the transactions have stopped mining.

Instead, I am getting "Transaction culled...." logs.

Any idea what's happening?


texts:
When using for example ropsten testnet as a provider like https://ropsten.infura.io/<infura_token>

How do I identify the account address of my transactions?


texts: truffle flattener cannot find part of path

texts:
I am trying to flatten a solidity file but I keep getting cannot find part of path error as shown below
out-file : Could not find a part of the path 'D:\Blockchain\bullrun\src\contracts\ERC721.sol'.
At line:1 char:1
+ truffle-flattener ./node_modules\@openzeppelin/contracts/token/ERC721 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

The command Im trying to run is truffle-flattener ./node_modules@openzeppelin/contracts/token/ERC721/ERC721.sol > src/contracts/ERC721.sol. Can anyone tell me what is wrong in the command


texts: Truffle solidity tests are executed before end of deployment

texts:
My contract hierarchy is Token which calls function on TokenBase. The deployment is defined like so:

var Token = artifacts.require("./Token.sol");
var TokenBase = artifacts.require("./TokenBase.sol");

module.exports = function(deployer) {
  //deployer.deploy(Accounts);
  deployer.deploy(Token, "SweetCoin", "SWC")
  .then(function() {
    console.log("deployment log Token address is", Token.address);
    deployer.deploy(TokenBase, Token.address, 0, 0, 1000).then(function() {
        console.log("deployment log TokenBase address is", TokenBase.address);
    });
  })
};

this seems to work fine as the output of truffle migrate is

deployment log Token address is 0xf10382227656670bc71d5433ae51e6826fabfff1
deployment log TokenBase address is 0xf0d762e793e1691cc2f80787e74ce3715479652e

when truffle test is run it looks like TokenBase is instantiated after the start of the test contract. This is the output after truffle test

deployment log Token address is 0x87a224644edcac90885cc6ca8099dc989d89ed36

TestToken
deployment log TokenBase address is 0xfefe73e3abd10d82461161298e0db6f1b1225da7
    1) testSetUp
    > No events were emitted

0 passing (446ms)
1 failing

1) TestToken testSetUp:
    Error: VM Exception while processing transaction: invalid opcode
    at Object.InvalidResponse (/Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
    at /Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:86:36
    at XMLHttpRequest.request.onreadystatechange (/Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:118:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpResponseEnd (/Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:509:12)
    at IncomingMessage.<anonymous> (/Users/mroon/.nvm/versions/node/v7.9.0/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:469:24)
    at endReadableNT (_stream_readable.js:975:12)

And finally this is the test contract:

pragma solidity ^0.4.10;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";

import "../contracts/Token.sol";
import "../contracts/TokenBase.sol";

contract TestToken {
    Token token;
    TokenBase tokenBase;

    function testSetUp() {
        token = Token(DeployedAddresses.Token());
        tokenBase = TokenBase(DeployedAddresses.TokenBase());
    }

}

The reason I suspect a sync issue is that if I remove the second line in the test: tokenBase = TokenBase(DeployedAddresses.TokenBase()); the test passes.

The question obviously is: how can I make my test pass?


texts: How to get ethereum gasPrice from a transaction hash?

texts:
I need to get the gasUsed and gasPrice so that I can calculate the correct amount of gas required for a transaction.

I can get the gasUsed using:

var accountOneReceipt = await contractInstance.functionName(parameterOne, {from: accountOne});

var accountOneGasUsed = accountOneReceipt.receipt.gasUsed;

But there is no gasPrice parameter in transaction receipt.

Info: getTransactionReceipt


texts:
I want to sanity check my geth installation before unlocking my wallet.
My geth version on Ubuntu is
Geth
Version: 1.9.18-stable
Git Commit: f5382591874220287de253bfc08b10afd5244927
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.14.2
Operating System: linux
GOPATH=
GOROOT=/build/ethereum-epTfUQ/.go

The md5sum /usr/bin/geth is 3b4fef56c1cc0a357fa9524d7b295ba5, sha1 is 9dbc9772eb4127eba6de77bda4c5e7fba2974040.
At the moment when I visit https://geth.ethereum.org/downloads/ to check the sums I get "Retrieving packages from release server..." for ages followed by failure.

I suspect the essential data is in this URL but if I wget that I get lots of "connection reset by peer" errors.
Also the <Content-MD5> tags in the partial download look base64-encoded, but if I try one of them e.g. echo "XZzyT22t79PD18TFbS5jNQ==" | base64 -d yields nothing and echo "XZzyT22t79PD18TFbS5jNQ" | base64 -d yields an "invalid input" error.

When I google the above sums directly I get no results.
Based on the above version and md5sums, is my installed geth version legitimate?
How to I verify this information if https://geth.ethereum.org/downloads/ is unavailable?


texts: Geth service gets killed on multiple concurrent requests of web3.personal.importRawKey function

texts:
I have an ethereum-POA node setup on a VM having below mentioned configurations. Using NodeJS Web3 client, I am trying to create new wallets using the web3.personal.importRawKey function.
VM Configurations
Azure VM - Standard D2s v3 (2 vcpus, 8 GiB memory)
As part of our Stress testing, I tried concurrently creating the wallet for 5-10 users, it worked. But when I try to create 15-20 wallets concurrently then the geth process gets killed abruptly and the node stops.
On a 1 CPU, 4 GB memory VM, I was able to create at max 4 concurrent wallets. While on 2 vcpus, 8 GiB memory CM, I could process max 10-12 concurrent users.
My concern is the number of concurrent users wallet creation compared to RAM seems very low and I can't understand why geth processes get killed.
How would I be able to handle at least 1000 concurrent requests to the above-mentioned function to create Blockchain wallets?
Any help will be appreciated.
Thanks in advance!


texts: Lost my deployed contract code. Anyway of viewing this?

texts: Long story short I lost the contract code that I deployed. This is deployed to the live net. Is there anyway of being able to view the source of the contract code that has been deployed?


texts: How to get a list of ALL block hashes yet?

texts:
I'm looking for a way/link/service to get a list of ALL (~4400000) block hashes yet.

Any idea how to get that?

Thanks


texts: Where truffle save the compiled contract

texts: I'm trying to find where truffle store the compiled code. I'd like to take this bytecode and to deploy it manually with MyEtherWallet


texts: How do miners profit post-PoS, if at all, how will new miners get their start, and who will execute the EVM byte code (and why)?

texts:
I've been following the release of Casper/PoS closely, and I'm curious about a few details.

How will miners make money (even if GPUs are less valuable)? Are spare compute resources (say RAM, CPU) still somehow "usable" to create value by securing the block chain in a PoS world?
How will miners new to Ethereum gain a foothold if they start with no stake and have no ability to mine their first ETH coin?
If spare computing power isn't the resource that drives mining, who will be incentivized to participate? Will the mining/consensus system be entirely driven by users of the network, who hold ETH for other reasons entirely (e.g. users of ETH-powered contracts)? And if so, how can they simultaneously use their ETH to power contracts, collateralize contracts (potentially), and simultaneously serve as a "deposit" for Casper?
Who will execute the contracts/EVM bytecode?
Does PoS make computing power no longer "redeemable" for financial value using the Ethereum block chain?

Thanks very much, and looking forward to the next gen of Ethereum!


texts: Can I send ALL my Ether to a Payable function? or should a little be saved to pay for Gas?

texts:
I have this big doubt about how the EVM works,

Let's say I have an Ether balance of 1000000000000000000 in Wei (1 Ether) and I want to pass ALL of it to a payable function, let's call the function buy():

Contract.buy({ from: '0x0...', value: 1000000000000000000 });

Will that work? meaning; Will that in itself deduct GAS costs?

Or, on the contrary... I have to estimate Gas cost and deduct it myself from the Ether I'm sending? for example, If I estimate 50000 in Gas, I'd do it like this:

Contract.buy({ from: '0x0...', value: 999999999999950080, gas: 50000 });

Which approach is the correct one and Why?

Thanks in advance!

EDIT (Code in Swift):

    var options = Veev.options(gas: nil, from: addressFrom)
    let contract = web3.contract(contractABI, at: EthereumAddress(Rinkeby.address))
    let parameters = [EthereumAddress("0x0.."), amountToBuy] as [AnyObject]
    guard let estimatedGas = web3.contract(contractABI, at: EthereumAddress(Rinkeby.address))?.method("buy", parameters: parameters, options: options)?.estimateGas(options: nil) else { return }
    options.gas = estimatedGas
    let value: BigUInt = BigUInt(ether) - BigUInt(estimatedGas) * BigUInt(5000000000) - 1 // 5000000000 is gas Price
    options.value = value


texts: Quorum Raft: Is the leader validates each transactions in the block before broadcasting it?

texts:
I read about how the raft consensus works in Quorum to reach consensus and broadcast blocks (https://github.com/jpmorganchase/quorum/blob/master/docs/raft.md). I don't know if the following is correct or not:

The leader in the raft network does not "validate" each transaction before inserting it in the block to be added. It only ensures that all nodes receive the same copy of a block without validating it?

I mean by "validate" the fact of verifying each transaction signature to be sure that the transaction is sent by a legitimate user, as well as the transaction has not been modified.

Can anyone respond to me?


texts: Smart contract with authorized actions based on addresses

texts:
I want to build a service where users can sign up (off-chain) to get credentials which give them the right to perform certain on-chain actions.

For example, lets pretend I'm building a service where someone can buy my time by holding my token (and burning it, or spending it or whatever), but I only want people who know me to be able to buy the token. So I have a site where my friends can give me their addresses, and then trading of my token will be restricted to within those addresses.

I want this list of valid owners to be updatable. How can I accomplish this?

For bonus points, lets assume the whitelist changes relatively frequently. Frequently enough that changing the contract becomes expensive. Is there a way around updating the contract itself?


texts: Difference between ethereum private network and bitcoin network

texts:
I'm new to this technology and trying to understand it thoroughly. I'm working with smart contracts using Ethereum Wallet but I'm not able to figure out what exactly is the difference between bitcoin network and ethereum network from perspective of peer-to-peer network concept.

This is my understanding about ethereum and bitcoin:

In Bitcoin network each user has given one address which is treated as a node in the network(i.e. a node has single address). But in ethereum private network we can create multiple addresses in a single node and there can be multiple such nodes in that private network(i.e. a node can have multiple addresses).

Please correct me if my understanding is wrong and let me know how these two networks differ from each other or are analogous to each other.


texts: Creating Ethereum Account on sing up through webpage

texts: I am creating a voting dapp in which the voter comes to the poll for voting and after the id verification of the voter an account is made for them which is printed as QR code and handed to them for voting purposes, is it possible to creating the account through the contract deployed for voting (and is it feasible) or can the account be created on the go? or do I have to create the numbers of accounts before the voting process to hand it to the voter? which one is more feasible? And if the accounts are pre-created, should I verify the account in contract or the webpage(Web3js) code?


texts: JSON RPC transfer of ERC20 Tokens with Parity

texts: How can I use Parity with JSON RPC to send and receive ERC20 tokens?


texts: How to determine the network hash rate of last 12 hours?

texts:
I want to determine the network hashrate as etherscan.io shows.

As I know,difficulty is the times of hashing to find the next block.

So, the sum of difficulty should be the times of hashing in last 12 hours.

So I think this way should be right:

Sum the difficulty of the last 12 hours
Div the sum by seconds of 12hours (43200)

It show me that the hash rate should be 219,446 GH/s

But etherscan.io show me that hash rate is 262,744.29 GH/s

What is the difference?


texts: How to send ether to the smart contract from an ethereum address?

texts:
I would like to automatically after an event occurs to withdraw an amount of money from a certain ethereum address and keep the money with the contract. How can I do this? Any hint is appreciated.

I tried calling an internal payable function from my contract POD_PhysicalItems:

Here is how I call it, sender is an ethereum address defined in the constructor, but there is an error at the line below Type error Member "value" not found or not visible after argument dependent look up in the function address:

POD_PhysicalItems.withdrawAgreedUponCollateral.value(2*itemPrice)(sender);

This is the function:

 function withdrawAgreedUponCollateral(address entityAddress) payable internal  {
    require(state == contractState.DoneVerificationofTerms);
    collateralWithdrawnSuccessfully("Double deposit is withdrawn successfully from: ", entityAddress);

}


texts: Retrieve size of Ethereum state on a local Go-Ethereum node

texts:
I have a local go-ethereum node and I would like to measure the size of its state on disk. The chain DB is under a .ethereum directory but measuring the size of this dir would also include space used by all the blocks and transactions.
I'm looking for the space required by state only. Does anyone knows how to retrieve this info?
Thanks


texts: Will same contract consume different gas in different network?

texts: I have a contract deployed both in test and main network and if i execute same method with same parameters, will gas used differ?