texts: Beginner - Design pattern for a hybrid dapp

texts: This is the first dapp I'm going to build and I was thinking about not doing it 100% decentralized due to some limitations I've been encountering with Solidity (This may just be because of the way I'm used to do things), basically the dapp is like a marketplace where each user can buy/bid for a digital good. What I'm having trouble right now is thinking a way of tracking everything an user owns in said dapp. Initially I was thinking about using a mapping for each address, each address would have an array of structs for the item they bought or whatever to later retrieve that information by address so I don't have to loop through the mapping (since this is discouraged for what I've read) but my problem here is that I can't return the whole array of structs and I don't want to destructure it and retrieve each field of it one by one. I was thinking of processing the transaction (This way it is available in the Blockchain) and depending on the output of said transaction I can send a request to an API with the information sent in the previous transaction to save it in a friendlier way to be retrieved later, this way I can track user ownership and everything we'd need. Is this a "valid" way of doing things or I'm breaking some crucial concept by saving that kind of information in a database from an API? What can I do to track each item an user owns (Maybe this'll help sync the UI too), make this look simpler and probably not having to use an API to save this information (If not at all)?


texts: Error: The contract code couldn't be stored, please check your gas amount during deploy

texts:
I know this issue was discussed before several times, but I cant get the solution to my problem.

I'm trying to deploy a contract with Truffle on Ganache.
During the deployment in 2_deploy_contracts.js I deploy some contracts and libraries which ones are deployed.
Then when I try to deploy the contract that has the libraries and the address of the contracts in the constructor I got the following Error stack :

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-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)

Here is 2_deploy_contracts.js :

deployer.deploy(A).then(function () {
        console.log("A deployed");
        deployer.deploy(B, A.address, accounts[0],accounts[1]).then(function() {
        console.log("B deployed");
        }).catch(err=>console.log("error B",err));
}).catch(err=>console.log("error A",e));

The problem occured on error B.

Anyone knows what can be the problem? I tried to add more gas but it didn't work.

Thanks in advance!


texts: Error encoding arguments: SyntaxError: Unexpected token e in JSON at position 2 while string concatenation

texts:
I am just adding 2 strings into one string but getting below error:

  transact to TestStrings.testCOntract errored: Error encoding
  arguments: SyntaxError: Unexpected token e in JSON at position 2

Below is my contract code:

pragma solidity ^0.5.1;

library Strings {

    function concat(string memory _base, string memory _value) internal returns (string memory) {

        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
        bytes memory _newValue = bytes(_tmpValue);

        uint i;
        uint j;

        for(i = 0;i<_baseBytes.length;i++) {
            _newValue[j++] = _baseBytes[i];
        }

        for(i = 0;i<_valueBytes.length;i++) {
            _newValue[j++] = _baseBytes[i];
        }
        return string(_newValue);
    }
}

contract TestStrings {

    using Strings for string;

    function testCOntract(string memory _base) public returns(string memory) {
        return _base.concat("_suffix");
    }
}

I have tried THIS accepted answer and it's working fine. But I am not sure what I am missing with my code.


texts: What does Error: Provided address "1.2870172725867908e+48" is invalid, the capitalization checksum test failed

texts:
I have assigned my variables here

> var contractAddress = 0xb5A5F22694352C15B00323844aD545ABb2B11028

> var cont = new web3.eth.Contract(abi, contractAddress)

I am getting the error :

  Error: Provided address "1.2870172725867908e+48" is invalid, the
  capitalization checksum test failed, or its an indrect IBAN address
  which can't be converted.
      at Object.inputAddressFormatter (/Users/tycooperaow/node_modules/web3/node_modules/web3-core-helpers/src/formatters.js:409:11)
      at Object.set [as address] (/Users/tycooperaow/node_modules/web3/node_modules/web3-eth-contract/src/index.js:92:69)
      at Contract (/Users/tycooperaow/node_modules/web3/node_modules/web3-eth-contract/src/index.js:217:26)
      at new Contract (/Users/tycooperaow/node_modules/web3/node_modules/web3-eth/src/index.js:149:22)

This is the variable I used to assign the abi

var abi = [ { constant: false,
    inputs: [ [Object], [Object] ],
    name: 'approve',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [],
    name: 'totalSupply',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [ [Object], [Object], [Object] ],
    name: 'transferFrom',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [],
    name: 'enableTokenTransfer',
    outputs: [],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [ [Object], [Object] ],
    name: 'unlockAddress',
    outputs: [],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [],
    name: 'walletAddress',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [],
    name: 'tokenTransfer',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [ [Object] ],
    name: 'burnTokens',
    outputs: [],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [ [Object] ],
    name: 'balanceOf',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [],
    name: 'owner',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [ [Object], [Object] ],
    name: 'transfer',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [ [Object] ],
    name: 'lockaddress',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [],
    name: 'creationTime',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [ [Object], [Object] ],
    name: 'allowance',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [],
    name: 'disableTokenTransfer',
    outputs: [],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [ [Object] ],
    name: 'unlockaddress',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { constant: false,
    inputs: [ [Object], [Object] ],
    name: 'lockAddress',
    outputs: [],
    payable: false,
    type: 'function' },
  { constant: true,
    inputs: [],
    name: 'lock',
    outputs: [ [Object] ],
    payable: false,
    type: 'function' },
  { inputs: [ [Object], [Object] ],
    payable: false,
    type: 'constructor' },
  { anonymous: false,
    inputs: [ [Object], [Object] ],
    name: 'TokenBurned',
    type: 'event' },
  { anonymous: false,
    inputs: [],
    name: 'TokenTransfer',
    type: 'event' },
  { anonymous: false,
    inputs: [ [Object], [Object] ],
    name: 'Locked',
    type: 'event' },
  { anonymous: false,
    inputs: [ [Object], [Object] ],
    name: 'Unlocked',
    type: 'event' },
  { anonymous: false,
    inputs: [ [Object], [Object], [Object] ],
    name: 'Transfer',
    type: 'event' },
  { anonymous: false,
    inputs: [ [Object], [Object], [Object] ],
    name: 'Approval',
    type: 'event' } ]


texts: DApp examples containing complete source code

texts: can someone provide me some high quality ethereum dapp codebase examples? This should comprise of not only the smart contract codebase but also the app codebase , complete with the front end UI (preferably React), middle end controller codes using Javascript and possibly drizze (or similar substitutes), and even possible server side scripts to derive off-chain data from APIs or databases, etc.


texts: Can I maintain my ethereum wallet on AWS?

texts: Can i download and sync my wallet on Amazon Web Services? Is there any security concern when using Cloud services assuming that all the cloud based servers are encrypted.


texts:
I'm making a simple program to track transactions in and out of an address, I have a function that gets the latest block and then I run it consecutively.

When I run the function sometimes the block I try to read is null, and some other times when I encounter a block full of transactions, the function takes more time to execute and I end up skipping a block.

How can I be sure the block number I'm checking is always <= of the latest block?

Is there any risk that I might scan an uncle block instead?

Here is my code:

const Web3 = require('web3')
const PROJECT_ID = 'myprojectid'

// Connect to the node
const web3 = new Web3( Web3.givenProvider || `wss://mainnet.infura.io/ws/v3/${PROJECT_ID}`)
const eth = web3.eth

async function listenToBlocks(addressToWatch){
    // Get the latest block and the transactions
    lastBlock = await eth.getBlock('latest','true')
   //Do stuff with the transactions here
}

const addressToWatch = 'myaddress'

const callback = async () => {
        eth.getBlockNumber().then(result => console.log(`Searching block: ${result}`))
        await listenToBlocks(network,addressToWatch)
        console.log('-'.repeat(30));
        setTimeout(callback,15000)
    }

setTimeout(callback,15000)


texts: Can I use delegatecall in a transaction?

texts:
I'm interested in techniques to perform multiple sends/contract calls inside of a single transaction but with the EOA that originates the transaction still being the sender for all operations (not a wallet contract or other non-EOA account).

Is it possible in either solidity or EVM assembly to have a transaction (as opposed to an inter-contract call) use delegatecall?
 It would be great if an EOA could claim the operations of a library contract as its own while retaining the EOA's msg.sender and msg.value.

Example flow:

My externally owned secp256k1 account delegatecalls a contract library X whose solidity code a) calls some other contract Y to check whether a certain variable is equal to a certain value, and then b) calls the method of a different contract Z if and only if it is, sending along 1 ETH.

Both the call to Y to check the variable in a), and the call to the method of Z in b) should have msg.sender being my externally owned secp256k1 account, and the outward send/call in b) should spend the balance of my externally owned secp256k1 account.  Neither X nor Y should think anything different has happened than just that they were directly called by my EOA.


texts: Any Idea Why Geth (1.4.1-rc-4b9de75) Is Such Heavy Disk I/O At Startup?

texts: So I am trying to figure why geth is such heavy disk I/O at startup, even after the chain is fully synced? The problem is that on a normal non-SSD hard drive it doesn't matter how fast the CPU is, Mist always falls out of sync at least initially and takes forever to get on the same page with geth. This affect is amplified on slower machines to the point I can't ever seem to sync up even after 30 / 40 minutes or more of trying. I had hoped the 1.4.x releases would help, but they do the same thing.


texts: Timeout while attempting to connect and deploy in the Ropsten network

texts:
I am trying to deploy the contract in Ropsten network. It fails with the timeout error
The same is deployed in Ganache without any issues. Please advice
truffle-config.js
require('dotenv').config();
const HDWalletProvider = require('truffle-hdwallet-provider');

const infuraProvider = network => providerWithMnemonic(
  process.env.MNEMONIC || '',
  `https://${network}.infura.io/${process.env.INFURA_API_KEY}`
);

 const providerWithMnemonic = (mnemonic, rpcEndpoint) =>
 new HDWalletProvider(mnemonic, rpcEndpoint);

module.exports = {

// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!

  networks: {

development: {
  host: '127.0.0.1',  //localhost
  port: 8545,
  network_id: '*', // eslint-disable-line camelcase
} ,

mainnet: {
  provider: infuraProvider('mainnet'),
  gasPrice: 10000000000,  // 10 Gwei
  gas: 4000000,
  network_id: '1'
},
ropsten: {
  provider: infuraProvider('ropsten'),
  gasPrice: 1000000000,  // 1 Gwei
  gas: 4000000,
  network_id: '3'
 },
kovan: {
  provider: infuraProvider('kovan'),
  gasPrice: 1000000000,
  network_id: '42'
}
 },

solc: {
optimizer: {
  enabled: true,
  runs: 200
}
}

};

Error Info
C:\Program Files\nodejs\node_modules\truffle\build\webpack:\packages\provider\index.js:56
    throw new Error(errorMessage);

Error: There was a timeout while attempting to connect to the network.
   Check to see that your provider is valid.
   If you have a slow internet connection, try configuring a longer timeout in your Truffle config. Use the networks[networkName].networkCheckTimeout property to do this.
at Timeout._onTimeout (C:\Program Files\nodejs\node_modules\truffle\build\webpack:\packages\provider\index.js:56:1)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7)


texts: Proof-of-Stake: How to prevent someone from being always selected as an author of block?

texts:
In proof-of-stake, by definition, each stakeholder deposits and locks some tokens (stakes) for more chances to be selected as an author of block in a random-based election procedure.
Till here, it's clear.
But, as the system is not centralized and there is no server which would do the election procedure, each stakeholder installs a client application on their machine to do the random-based selection procedure.
The question is what happens if a stakeholder manipulates the client application, such that he could always be elected as an author of block?
In other words, who (or which entity) does the random election procedure in each round?
Related question:
Fork in Proof-of-Stake?
How to select the next author of block in Proof-of-Stake?
P.S. If the question is not still clear enough, please let me know.


texts: Can MetaMask be used as remote node for back end, and not require users to have plug in?

texts: I am building a web app that would track events/transactions made by contracts on the chain. At this point I am considering hosting a geth node on AWS EC2 in order to use in my web3.js initialization object. Would it be possible to use the MetaMask service instead of hosting my own node, just to probe the chain, without requiring my client side users to download the metamask plug in in order to use it?


texts: ethclient.Client in go-ethereum unit testing

texts:
I am using backends.SimulatedBackend in unit testing.
however, backends.SimulatedBackend is not compatible with ethclient.Client.
Any one can advise how to create a ethclient.Client in unit testing?


texts: How to use window function in controller (node.js)?

texts:
So this is my users controller to upload a file :

exports.postUploadFile = (req, res, next) => {

    var ethereumURI = req.body.ethereumURI;
    var abi = JSON.parse(req.body.abi);
    var contractAddress = req.body.contractAddress;
    let web3 = new Web3();
    web3.setProvider(new web3.providers.HttpProvider(window.web3.currentProvider));
    . . .
}

as you can see when i set my provider with "window.web3.currentProvider" instead of to make my metamask pop up, i got an error "window is undefined" ?

So how to use "window" for backend in node js / express js? I am using web3.js (0.2.x)


texts: How do I transfer my Exodus wallet to Mist? I have some Eth based tokens (DRP) and I'd like to be able to see them, but they don't show up in Exodus. I'm baffled by the import function or opening GETH (it wants me to make some contract.


texts: Setting boolean variable does work in Remix but doesn't work is Mist

texts:
When I run the following code in Remix IDE it works well, but when I deploy the contract in Mist on the Main network or on Rinkeby it sets the string variable, but not the bool. users[msg.sender].isVerified stays false while users[msg.sender].fullName is "John Smith"

 struct User {
        string fullName;
        bool isVerified;
 }

mapping(address => User) public users;

function f() {
users[msg.sender].fullName = "John Smith";
users[msg.sender].isVerified = true;
}


texts: Which wallets lets you generate multiple ethereum addresses?

texts: Is there a wallet that lets you generate multiple ethereum wallet addresses? I don't like the fact that I only use one address and that everyone can see what I have. Or are there other ways to keep our privacy when making transactions with Ethereum? Is there a EIP to enable multiple addresses from one seed key like bitcoin?


texts: Why does this function not need a require statement?

texts:
Why does the following function not need a require statment?

function transferFrom(address from, address to, uint256 value) public returns (bool) {
    _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
    _transfer(from, to, value);
    return true;

This function is a part of the ERC20 standard from the OpenZeppelin library.

I would have thought that this function would first need to check the allowance of the msg.sender via a require statement that resembles the following:

require(_allowed[from][msg.sender] <= value);

Why is this require statement unnecessary?


texts: How to get my USDT (ERC20) balance with web3.py + geth?

texts:
I have Geth in full node on my server and I want to get my USDT balance with web3.py.
Here is my Code:
from web3 import Web3
from ethtoken.abi import EIP20_ABI

w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545'))
tether_contract_address = Web3.toChecksumAddress('0xdac17f958d2ee523a2206206994597c13d831ec7')
contract = w3.eth.contract(tether_contract_address, abi=EIP20_ABI)
amount = contract.functions.balanceOf(Web3.toChecksumAddress(w3.eth.coinbase)).call()

But I get this result:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/web3/contract.py", line 1372, in call_contract_function
    output_data = decode_abi(output_types, return_data)
  File "/usr/local/lib/python3.9/dist-packages/eth_abi/abi.py", line 96, in decode_abi
    return decoder(stream)
  File "/usr/local/lib/python3.9/dist-packages/eth_abi/decoding.py", line 118, in __call__
    return self.decode(stream)
  File "/usr/local/lib/python3.9/dist-packages/eth_utils/functional.py", line 45, in inner
    return callback(fn(*args, **kwargs))
  File "/usr/local/lib/python3.9/dist-packages/eth_abi/decoding.py", line 164, in decode
    yield decoder(stream)
  File "/usr/local/lib/python3.9/dist-packages/eth_abi/decoding.py", line 118, in __call__
    return self.decode(stream)
  File "/usr/local/lib/python3.9/dist-packages/eth_abi/decoding.py", line 186, in decode
    raw_data = self.read_data_from_stream(stream)
  File "/usr/local/lib/python3.9/dist-packages/eth_abi/decoding.py", line 293, in read_data_from_stream
    raise InsufficientDataBytes(
eth_abi.exceptions.InsufficientDataBytes: Tried to read 32 bytes.  Only got 0 bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/web3/contract.py", line 1105, in call
    return call_contract_function(
  File "/usr/local/lib/python3.9/dist-packages/web3/contract.py", line 1394, in call_contract_function
    raise BadFunctionCallOutput(msg) from e
web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced?

Also, my Geth synchronization is always between 50 and 100:
> eth.syncing.highestBlock - eth.syncing.currentBlock
62


texts: Can't approve a transaction via uport though i have balance.what is the reason?

texts:
I am using rinkeby network. I am try to save a information to rinkeby network.but a popup apera to sign or approve the transaction via uport. i have balance but i can't sign the transaction.

DonationContract.methods
    .setSponsor("raonak92@gmail.com",
    "0xAdED7F5eF369D7cc8cd41DdE5B71637d0CbbE85C",).send(
      transactionObject
      , function(error, transactionHash){
      console.log(error)
      console.log(transactionHash)
    });


texts:
Sorry for being stupid.
> web3.version
{
  api: "0.20.1",
  ethereum: "0x41",
  network: "1108",
  node: "Geth/v1.9.21-stable-0287d548/windows-amd64/go1.15",
  whisper: undefined,
  getEthereum: function(callback),
  getNetwork: function(callback),
  getNode: function(callback),
  getWhisper: function(callback)
}
>

My web3 version is 0.20.1, but https://github.com/ethereum/web3.js/blob/0.20.7/DOCUMENTATION.md doesn't mention admin.sleepBlocks at all.
admin.sleepBlocks(1) returns true immediately on my private chain. This behavior doesn't agree with http://adam.schmideg.net/go-ethereum/interface/JavaScript-Console.
Am I looking at a wrong place? Where is the documentation for admin.sleepBlocks?


texts:
I want to query all transfers regarding a contract with Nethereum. This means, in the end I want to have all transactions, so that I can print a statement of account.

I suppose with the web3.js library the call would be something like this on the contract:

contract.getPastEvents('Transfer', {fromBlock: 1, toBlock: 'latest'}, callbackFunc)

However, I didn't find a getPastEvents equivalent in Nethereum.


texts:
I've seen that during the course of tutorials I am following, the intructors have gradually shifted over to Visual Studio code rather than use remix. I could not find any such explanation as to why they did that and they haven't contacted me back yet regarding this query so I was wondering why one would opt VSC rather than remix?

Is it solely because of preference or is there any such advantage that VSC has over remix in developing smart contracts using solidity?


texts:
Am receiving "Expected token Semicolon got 'LParen' " error from the this line of code.

emit AuctionCreated(msg.sender, auctionId);
                   ^

when trying to deploy a contract through truffle.

any help ??

THANKS IN ADVANCE !


texts: What determines transaction costs (Remix)?

texts:
I've reviewed several related SE questions on this topic and I haven't seen an answer. In Remix, I've created two separate .sol files. The files are names file1.sol and file2.sol. The code for the two files looks like this:

file1.sol

pragma solidity ^0.4.0;

contract MyFirstContract {

}

file2.sol

pragma solidity ^0.4.0;

contract MyOtherContract {

}

When I review the transaction and execution costs, I'm slightly confused. The part that cons

          | transaction cost | execution cost |
file1.sol | 68926 gas        | 10862 gas      |
file2.sol | 68990 gas        | 10862 gas      |

Why are the transaction costs different when the contracts are virtually the same? At first, I suspected there was an added space or something else in the contract. However, I verified that wasn't the case. Why are there different transaction costs across these two contracts?


texts:
Bit of a noob question I'm afraid but can't find the answer anywhere.

I'm currently sourcing parts to build my first rig.
I have 6 rx580 sapphires on order, so waiting for them to come back in stock.
I've also got the usb risers, rig frame, motherboard and CPU on order (still trying to source PSU).
But what I'm struggling with is how to power the cards.  I've seen a couple of videos that look to be pcie to sata but I can't seem to find what I need anywhere.  I have seen a couple of 6 pin pcie to (double) sata.  But no 8 pin (or 6+2 pin) as I'm going to need some of these to power the sapphires.

Any help would be appreciated. :)


texts: How can you split calldata bytes to an arbitrary number of different log events?

texts:
The following code is incomplete.  What I want to do is split the bytes data (calldata) into two or more separate log functions for indexing reasons.

The problem is I can't figure out how to do it in Solidity. bytes is of arbitrary length, so I can't copy the calldata into memory as memory cannot be allocated that is of arbitrary length (AFAICT from the Solidity documentation).   I also note the code below is simplified - it won't be just half, it will be some fraction set as another parameter to logit.

I'm not completely sure but when I look at the compiled output of Solidity it seems to me I could implement this directly in EVM assembly.  the EVM instruction log1 takes a pointer and length of data as its input arguments, so it should be possible to do.  The code below works, so I know that somehow calldata of arbitrary length can be sent to log1. Solidity just won't let me do the pointer arithmetic to split the data up (or I can't figure out how).  I'd rather not have to code assembly...  (I can switch to Serpent if necessary).

Yes, I could make separate functions and split the data outside of Ethereum.  but then I incur the 21,000 gas penalty for each call. I'm trying to do this for low gas cost.

[EDIT] - yes I could use up to 7 function parameters (at most), but that only gives me 7 splits.  I need on the order of 64.  this is what I get for trying to simplify the question too much...

//
// attempt to figure out how to split incoming byte data into separate logs
//

contract HelpLogs {

  event LogFirstHalf(bytes _data);
  event LogSecondHalf(bytes _data);

  function logit(bytes data) external {
    // can't do the pointer arithmetic to LogFirstHalf and
    // then LogSecondHalf of data.  But I can log all of it...
    LogFirstHalf(data);
  }
}


texts: Best practices for generating a random uint256

texts:
I've read through this thread and this thread and they offer a lot of interesting techniques, but what's the minimal code snippet for the currently accepted method of generating a random number in solidity?

This isn't a super high security need, approximates and PRNG solutions are fine for my use-case, so long as it spans any of the values of uint with (not lottery level, but roughly) equal probability.


texts: Why does Gnosis' MultiSig passes less gas than available in external_call?

texts:
Gnosis' MultiSig Wallet substract a fixed amount of gas (34710) when calling an external address.

function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {
    bool result;
    assembly {
        let x := mload(0x40)   // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
        let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
        result := call(
            sub(gas, 34710),   // 34710 is the value that solidity is currently emitting
                               // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
                               // callNewAccountGas (25000, in case the destination address does not exist and needs creating)
            destination,
            value,
            d,
            dataLength,        // Size of the input (in bytes) - this is what fixes the padding problem
            x,
            0                  // Output is ignored, therefore the output size is zero
        )
    }
    return result;
}

It seems to reserve some gas for the worst case scenario. But it causes strange behavior in some circumstances.

gas available less than 34710: sub() will overflow, but EVM fill cap gas to the max available, so the call may succeed.
gas available slightly more to 34710: sub() returns a small amount of thas that will make the inner call to fail with out of gas.

Is there any reason for doing that instead of just sending all available gas?


texts: How can I determine which transactions have failed using a web3.js call

texts:
I am attempting to call transactions that execute methods on a contract in order to collect specific data. I am currently using web3.eth.getTransaction(hash) in order to view the transaction information.

I correctly receive a return value, however, I cannot see any data that helps me determine if this was a failed transaction. I want to be able to detect failed transactions so that I exclude failed transactions from my data.

When I called:

web3.eth.getTransaction('0xb818a71e2d8bc6b661f463fbf96c91ecbf60610042b39da7e8806b2e0b5c2575', (e,r) => {tx = r})

I received this return value:

{ blockHash:
   '0xfcce6583cfede31bd59b53ac4b562b391a0c1f1b8539f4961ded1418be50d241',
  blockNumber: 2856676,
  from: '0x852bCCfd7446D236C353C804881048124F2a32B1',
  gas: 21000,
  gasPrice: '25000000000',
  hash:
   '0xb818a71e2d8bc6b661f463fbf96c91ecbf60610042b39da7e8806b2e0b5c2575',
  input: '0x',
  nonce: 3,
  r:
   '0x60b4dcc69230b1a69775ad20d0c105dfbfc52c953031deb1dbeab8a726ece2d6',
  s:
   '0x2cbd567f6fcac3c5284f8b531e302ee8f037a695029164f1bc68bf1218e8361',
  to: '0x0F0F0fc0530007361933EaB5DB97d09aCDD6C1c8',
  transactionIndex: 0,
  v: '0x2d',
  value: '32000000000000000000' }

Is there anything in there that can tell me if the tx failed?


texts: How do Block Explorers keep their databases in sync?

texts:
If we take blockchain.info; how do they know when a new block has arrived?

I understand that there is a full node running on the background, how would they have setup their infrastructure, so that their db which serves the users, is in sync with the full node db? I cannot think of a way to be alerted of when a new block arrives. It's not like the full node will tell you that we have a new block right? So do they watch the leveldb for changes?

Also, is it possible that they have full nodes that only respond to requests from blockchain.info?


texts: Will Mist support just Trezor or any FIDO/U2F hardware secure key?

texts:
Trezor recently announced support for Ethereum specifically, as well as being able to act as a standard FIDO/U2F Security Key in the following Reddit Post.

It's also been discussed that Mist will integrate the Trezor into the Wallet. Can we expect this to be a specific integration of Trezor or will any U2F device be compatible with Mist?

Will Trezor be used for anything in Mist that is beyond what any other standard Security Key can do?


texts: What if difficulty exceeds the length of a fixed sha256 hash in proof of work?

texts:
Hello im a newbie in Blockchain, i got to know some basics, but im confused that what if the difficulty exceeds the length of a sha256 fixed length string
example :
The fixed length is here 64 (sha256)
And the difficulty is 65
But how can we calculate them, for the specific block to be mined requires 65 zeros but the length is only 64, in this case what is applied, and if im wrong correct me?


texts: Unable to Add 3rd Proof-of-Authority Sealer Node

texts:
I have a geth POA private blockchain setup and running with 2 sealer nodes. Now I have setup a 3rd node as a sealer, and ran the following command on the both existing sealer nodes
clique.propose("0x555c9e3d738837d14ebda7cad9359f840f3c650c", true)
> null

and we confirm that the 3rd node has been voted because we see the address of the 3rd node when we run clique.getSigners() along with the other two sealer nodes' address.
Problem: However after we start and restart the 3rd geth node that we are trying to add as a sealer node, we get the error

INFO [08-24|21:25:55.169] Commit new mining work                   number=1 sealhash=e935f6…e90182 uncles=0 txs=0 gas=0 fees=0 elapsed=256.472µs
WARN [08-24|21:25:55.170] Block sealing failed                     err=unauthorized

This error persists even when running clique.propose(...,true) on the 3rd node to for itself.
On Ethstats, we see that this 3rd node is stuck at block #0 and never tries to sync the blockchaibn.
Any help is greatly appreciated!


texts:
I've just started my journy with etherium, so now I am trying to  get my first script complied. I tried starting with this project
https://github.com/san-lee-ai/simple_auction
But I could not get the solidity script compiled. Clicking on the compile button, on the http://remix.ethereum.org, just make the arrows near the "compile SimpleAuction.sol" just turn enlessly, over more than 24 hours.
I got it down to This code:

pragma solidity ^0.4.0;

contract SimpleAuction {
  uint public auctionStart;
  uint public biddingTime;
}

That compiles without any fuss, to this code:

pragma solidity ^0.4.0;

contract SimpleAuction {
   uint public auctionStart;
   uint public biddingTime;
   function SimpleAuction(
   ) {
       auctionStart = now;
   }
}

That never gets compiled. It just spins endlessly without throwing any error.
This is a trend: any code that doesn't contain a function, compiles in seconds, but when I add a function, compiling never ends.

What can I do, to get my code to compile with functions? I am using compiler version 4.1 (I tried others, with similar results), and EVM Version default (again, tried others with similar results).

I am using a local node (not sure it has anything to do with this, but I just started, so I'm trying to stick to what I read).

Thanks in advance


texts: When transferring Ether, who needs to be in sync with the blockchain?

texts:
A transfers ETH to B: who needs to be in sync with the blockchain?
My comprehension is that A only needs to be sync, is that correct ?


texts: solidity wont compile contract from ethereum blog

texts:
I am trying to build tokens in Ethereum
when i tried to paste the referenced code into Ethereum wallet i get:

I have been all over the web and can't find a specific reference to this error. The code fails in the online solidity compiler. I could not get the new online compiler to load in chrome under win10.

[]


texts: I have deployed my ERC223Token contract in my private blockchain. I have transferred some tokens to my wallet It is showing tokens in my mist wallet and remix as well, but it is not showing tokens in meta mask.


texts: how to use addpeer in ethereum blockchain

texts: I am new to ethereum.And could you please tell me the proper use of addpeer to connect two nodes in a single machine.?


texts: Using truffle-contract.js to load contract

texts:
I am having an extremely easy contract called Friend.sol:

pragma solidity ^0.4.17;

contract Friend {

    string name;
    uint age;

    function setFriend(string _name, uint _age) public {
        name = _name;
        age = _age;
    }

    function getFriend() public constant returns (string, uint) {
        return(name, age);
    }
}

I deployed my contract on ganache-cli:

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0xa4d581c585527651c4a74a0d85ef2e21ac91a43e17f290f5f548d6e5f0686e22
  Migrations: 0xf741d74fb4d4eab8c044dc4b1c0dfb7a244a6922
Saving successful migration to network...
  ... 0xca51a8f5124ef4f1dc8dfba5b9a9c1388cda003686309ff152b776600a64cf81
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying Friend...
  ... 0x9195ced6c131afaf1e735fc90464f9b94dd4215e909f463f06e51565b5e7e804
  Friend: 0x8a260eec4c77f82bd885b730f782f9bbe680dd64
Saving successful migration to network...
  ... 0x008b78bf25c5aa93fb6b8f16367d006e68751a54550da32bcce382067ad1250d
Saving artifacts...

Within my frontend I am trying to access the contract via web3 and truffle-contract:

Truffle-Contract Test

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
    crossorigin="anonymous">

I am Friend with...

    Name:
    <input type="text" id="name">

    Age:
    <input type="text" id="age">

    <button id="button">Update Friend</button>

However, when running my lite-server I get:

The error is, when I want to interact with my contract on the following line:

    FriendContract.getFriend(function (error, result) {

I also created a small github repo to show my entire code.

Any suggestions what I am doing wrong?


texts: How do I check for the existence of a function in Solidity when I have an address that might implement that function?

texts:
If I'm writing an Ethereum smart contract in Solidity and I know I have an ERC20 address variable (let's call it some_erc20_token), but I don't know whether this address implements the interface of an ERC20 extension EIP (for instance ERC1404 with its detectTransferRestriction function) how do I check if the address implements that function so I can call it?
If this were Java I would use the instanceof operator to check for this, something like
void wagTail(Animal animal) {
  if (animal instanceof Dog) {
    animal = (Dog)animal;
    animal.wagDogTail();
  } else if (animal instance of Cat) {
    animal = (Cat)animal;
    animal.wagCatTail();
  }
}

In my solidity contract I want to do something of the form
if (some_erc20_token.detectTransferRestriction != 0) { // this function exists!
  some_erc20_token.detectTransferRestriction(to, from , amount);
}

However that doesn't compile and I get the compiler error: TypeError: Member "detectTransferRestriction" not found or not visible after argument-dependent lookup in contract MyContract.


texts:
I have 2 contracts

pragma solidity ^0.4.24;

contract C1 {

    event Sig(bytes4 sig);
    C2 c2;

    constructor(address c2Addr)public {
        c2 = C2(c2Addr);
    }

    function func1()public {
        bytes4 sigFromC2Func2 = c2.func2();
        emit Sig(sigFromC2Func2);
        bytes4 sigFromThisFunc2 = func2();
        emit Sig(sigFromThisFunc2);
    }

    function func2() pure private returns(bytes4) {
        return msg.sig;
    }
}

contract C2 {

    function func2() pure public returns(bytes4) {
        return msg.sig;
    }
}

Deployed C2 than C1 on remix and executed func1 of C1, got below result.

When calling from func1 --> C2.func2() the msg.sig is 0xb1ade4db
When calling from func1 --> this.func2() the msg.sig is 0x74135154

According to the docs:

msg.sig (bytes4): first four bytes of the calldata (i.e. function identifier)

It is the same called function (func2),
Why the signatures are different?

[
    {
        "from": "0xd25ed029c093e56bc8911a07c46545000cbf37c6",
        "topic": "0xcb04e53cd65d1928a26cbb70d9f1dae5ab09a5610fbf7fe897129c102325099f",
        "event": "Sig",
        "args": {
            "0": "0xb1ade4db",
            "sig": "0xb1ade4db",
            "length": 1
        }
    },
    {
        "from": "0xd25ed029c093e56bc8911a07c46545000cbf37c6",
        "topic": "0xcb04e53cd65d1928a26cbb70d9f1dae5ab09a5610fbf7fe897129c102325099f",
        "event": "Sig",
        "args": {
            "0": "0x74135154",
            "sig": "0x74135154",
            "length": 1
        }
    }
]


texts: How to add USDT ERC20 Token to private blockchain

texts:
I am running a private ethereum blockchain on my machine using geth. I want to send USDT token from one address to another, but I could not because neither address have any USDT token.
I have tried using Remix to deploy the USDT token contract to the local private blockchain, using the USDT source code: https://cn.etherscan.com/address/0xdac17f958d2ee523a2206206994597c13d831ec7#code
In Remix, I used the same Solidity compiler 0.4.18 as what it was shown on Etherscan, and used the Injected Web3 environment along with Metamask for deploying.
However, I get this message:

This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly.

How should I transfer USDT token in my private blockchain? What is the correct way to do this?


texts: How to save a number as bytes16 in a smart contract and retrieve the number in javascript?

texts:
I have the following smart contract to clarify the issue.

pragma solidity ^0.4.17;

contract Test {
    bytes16 number;

    function getNumber() public view returns(bytes16) {
        return number;
    }

    function setNumber(bytes16 _number) public {
        number = _number;
    }
}

So using javascript I convert a number to hex string like so let hex = ‘0x’ + (3456).toString(16) where hex is 0xd80. Then I pass the value as an argument to setNumber.
The challenge is when I call getNumber what I receive in return is  0x0d800000000000000000000000000000. Like 28 zeroes is appended to the end.
Parsing this gives a wrong value. I parse like so let num = parseInt(‘0x0d800000000000000000000000000000’, 16). And I get 1.7944577943096364e+37.
How can one get the right value from this ‘0x0d800000000000000000000000000000’ or how to save the number as bytes16 without the extra zero digits.


texts:
function _execute(Proposal memory p,
        bytes memory transactionBytecode) internal returns (bool) {
        ProposalType proposalType = p.proposalType;
        uint childID = p.childID;

        if (proposalType == ProposalType.Funding) {
            FundingProposal memory fundingProposal
                = fundingProposals[childID];

        return fundingProposal.recipient.call
                  .value(fundingProposal.amount)(transactionBytecode);

ERROR I GOT

/C/Users/uddin/dao/contracts/dao.sol:407:9: TypeError: Different number of arguments in return statement than in returns declaration.
        return fundingProposal.recipient.call
        ^ (Relevant source part starts here and spans across multiple lines).

Compilation failed. See above.


texts:
I'm trying to connect to the swarm testnet. I followed the swarmdemo.test tutorial (http://swarm-gateways.net/bzz:/swarmdemo.test/) and I referred to the official documentation (http://swarm-guide.readthedocs.io/en/latest/runninganode.html#connecting-to-the-swarm-testnet) but I'm already not able to connect to the testnet.

First, in the video tutorial when the command "$GOPATH/bin/geth --testnet --datadir=$HOME/Desktop/ethereum account new" is run, a sub-folder "testnet" is created within the datadir folder, in my case it is not. The files are created directly within the datadir folder, but it doesn't matter I think.

The biggest issue is that when I run swarm as followed "$GOPATH/bin/swarm --bzzaccount ADDRESS-GOES-HERE --datadir $HOME/Desktop/ethereum/testnet --ethapi $HOME/Desktop/ethereum/geth.ipc" , I should be connected to the Ropsten testnet right ?

My terminal output :

raucouyo@ubuntu:~$ ./go/bin/swarm --bzzaccount dad7b9c9b1dc38b5bf41a4f9ac0ffc76c233bac6 --datadir /home/raucouyo/Desktop/ethereum --ethapi /home/raucouyo/Desktop/ethereum/geth.ipc
Unlocking swarm account 0xdad7b9c9b1dc38b5bf41a4f9ac0ffc76c233bac6 [1/3]
Passphrase:
INFO [05-05|10:22:28] Starting peer-to-peer node instance=swarm/v1.6.2-unstable/linux-amd64/go1.8.1
INFO [05-05|10:22:29] Starting P2P networking
WARN [05-05|10:22:31] Starting Swarm service
WARN [05-05|10:22:31] Warning: error reading kaddb '/home/raucouyo/Desktop/ethereum/swarm/bzz-dad7b9c9b1dc38b5bf41a4f9ac0ffc76c233bac6/bzz-peers.json' (skipping): open /home/raucouyo/Desktop/ethereum/swarm/bzz-dad7b9c9b1dc38b5bf41a4f9ac0ffc76c233bac6/bzz-peers.json: no such file or directory
INFO [05-05|10:22:31] Swarm network started on bzz address: a3b31ff03db2128b0d4bc70d241e100e85401a4c3c7b63d02966ed64396ce026
INFO [05-05|10:22:31] RLPx listener up self=enode://1c9bdefbe58cbd8429707828933855699c0c365383a5529efa4112451911aee3c89f1b452e45b74fd62199d2d9379ebc46be444d3df9cf192402af32e718e9f9@[::]:30399
INFO [05-05|10:22:31] Swarm HTTP proxy started on localhost::8500
INFO [05-05|10:22:31] IPC endpoint opened: /home/raucouyo/Desktop/ethereum/bzzd.ipc

And I should see in my terminal the connections with other nodes (according to the video tutorial), but nothing happen (after more than 15 minutes). So, I tried to reach the swarm page (theswarm.eth / theswarm.test) from my localhost endpoint (localhost:8500/bzz:/theswarm.test), it doesn't work as well as using the hash (localhost:8500/bzz:/1b5d887cea699d18560ae6dcaf06676f5064f630978b8031d9beb6fbddd82a82). Then, I tried to upload files (swarm up) locally and it works.

Someone can help me ?
Kind regards


texts: How smart contract can take secret key from a user interacting through client?

texts:
I am coming from a traditional web background and is a very newbie in smart contracts and ethereum and have a basic question. Please excuse me if it is too obvious but I am struggling to understand this point and will appreciate any help/pointers.
Typical use case when using a web application:
A user U (having a secret key) logs into an (untrusted) portal application P. P reaches out to trusted server S. S presents its own webpage to U to take the user's secret key and performs an operation OP (such as decrypting the encrypted data using user's secret key). This is done using redirection. U can suppose to have a secure storage device such as dongle or his computer, but he may not have his own client software.
How can (or should) a similar thing be done using a smart contract?
S may host a smart contract with a method OP. P may call this method. Can Solidity allow this method OP to take secret key present its own page to a user for the user to provide his secret key? Does Solidity support redirection? I think it cannot be done. In that case, how S should take secret key from U?


texts: What is the difference between "eth.accounts" and "web3.eth.accounts"?

texts:
The instructions for creating a new account on the Geth console state:

  Tip: If you are using Geth then you can just use eth instead of
  web3.eth command.

Meaning accounts can be referenced by just using eth.accounts rather than having to use web3.eth.accounts.

Are these two commands doing anything different under the covers, or are they the same thing? Why can we leave out the web3 part of the command if we're using Geth?


texts: How much computing power is required to verify transactions on Proof-of-Stake?

texts: What is the theoretical computing power needed in order to verify transactions on the upcoming Proof-of-Stake switch. For instance, will this be something that we can do on a raspberry pi?


texts: What is chainID? Raw transaction from myEther wallet

texts:
So I just ran a function from a contract on Ropsten from myetherwallet.com.  It ran fine via metamask, but I was just wondering what chainID was in the rawTx file?

{
 "nonce":"0x2e",
 "gasPrice":"0x04e3b29200",
 "gasLimit":"0x14b40f",
 "to":"0x8d3cbc2cba343b97f656428eafa857ee01bda53b",
 "value":"0x2386f26fc10000",
 "data":"0x412a5a6d",
 "chainId":3
}


texts:
So the best way I can describe what I am trying to implement is with an example...
Let's say you have a bunch of journalists, and each journalist has beneath them all of the articles they have written or will write in the future. Journalist A is discredited as being a liar in an article they recently published. His reputation is now affected, and future articles written by him will be scrutinized until he repairs his credibility.
In essence I am looking to represent the journalist as a smart contract, in addition, his articles are also smart contracts directly linked below him. Sort of like parent and child in a binary tree except the child has no children of their own. Only 2 levels.
The standard I lean towards is ERC-1155 where the root contract's value is algorithmically pinned to the contracts below. If this were to be the right choice, would it even be possible to almost recursively create smart contracts within the journalist's contract to represent each article he writes? A sort of factory for subsidiary journal contracts?
P.S. I'm relatively knew to solidity smart contract development, I am a full stack engineer foraying into crypto. I apologize if this question appears too novice.


texts: Converting between USD and a custom ERC-20 token

texts:
Right now, the best way to convert USD to a custom ERC-20 token, like DEV is to first convert the USD to ETH and then convert the ETH to DEV with an exchange like Uniswap. Along the way, the ETH might also be wrapped to be compatible with the token.
Is there a service that is able to convert directly between USD and a custom ERC-20 token contract address or at least do the 2 aforementioned steps automatically?


texts:
All the existing questions explains to catch the event on client end or server. How to catch the event on smart contract itself?

Here's what I'm looking for:

Contract A emits the event
Contract B catched the event and stores the params.
Both of these contracts have different address.


texts:
I have a function with 4 return values which are in different types. Within the same contract, I want another function get this return values. For example,

function myFunction1() returns (uint, string, address){
       ......
}
funtion myFunction2(){
    String s = myFunction1();
}

I want string s get the second value returned by myFunction1. How can I do that?


texts:
I think I have a use case for a library, but I've yet to use one.

I want to deploy a Manager contract as a token, and another for a crowdfund, that will each hold all their respective storage variables, and simply delegate every function call down to libraries that perform the actual logic. In this way I can update bugs if they are found by re-uploading the Library and changing the Library address, and all of my storage will persist.

If I have a balances mapping in my ERC20 Manager contract, can the Library access that mapping? Do I need to pass it in as a parameter, or can I just pass in the parameters that I received in the Contract call? Do I even need to do that, since it is run in the context of the calling contract? In the library can I simply go balances[address] += whatever in my transfer function and because I will have a balances mapping on my contract, it will work and find the address in that mapping, and if I didn't have that mapping on my contract, the library function would just throw?

I guess the root of what I want is, to store no variables/struct/anything in the Library, just a list of functions, so I can simply replace the business logic of my app, kind of creating a server/database sort of thing. But is the library aware of the variables on my calling contract automatically?

EDIT: After more research, it seems you can not update a reference to a library once compiled. So, I would instead create a Contract that does what my Library does, no storage, just functions, and run delegatecalls to it. My question stands - does the contract have access to all of the storage of the calling contract automatically?


texts: Is data stored in a smart contract accesible without a 'getter' function?

texts:
Lets say I store some data into a variable in a smart contract on creation. Since everything is public/stored on chain and it isn't encrypted with smart contract private key(Where is the private key for a contract stored?).

Would I be able to find this the data stored in the variable if I don't create a getter function to return the value? Or can I look through the storage associated with this contract and find the data?

I understand that if the variable is public, solidity automatically creates a getter.
But if the variable is private, it says that only the contract can read that data.


texts: Should events logged by smart contracts be trusted as a source of truth? Or are there any known ways to exploit them?


texts: Where in the compile process do storage indexes get assigned to variable names and where can I sniff that data?

texts:
I have found the articles explaining how storage works and I understand that if I have a mapping that I need to know the key. What I'm trying to do is figure out how given, solidity code, abi, and storage that I can do one any of the following given:

contract test {
  uint16 public var1;
  uint16 public var2;
  mapping(address => int) public maps;
  address[] public mapItems;

  function test() {
      var1 = 4;
      var2 = 6;
      mapItems.push(0x7E57a31C7B88a92Be263f7a9Fd6D58E6a9CE4d7C);
      maps[0x7E57a31C7B88a92Be263f7a9Fd6D58E6a9CE4d7C] = 6;
  }

}

Know that var 1 is in the first 16 bytes of the storage at index 0.
Know that var 2 is in the second 16 bytes of the storage at index 0.
Know that maps is at index 2 so that I can do the keccaking necessary to get the real index.
Know that mapItmes is at index 3 so that i can do the keccacking necessary to get the real index.

I would assume that solc is calculating this at some point and integrating it into the bytecode, but does it every get output anywhere accessible.  It doesn't seem to be in the ABI (although that would be a cool place to put it).

I know that I should create a getter and setter for these in my contracts, but if I'm analyzing someone else's that hasn't done this I'd like to still get this data.


texts: what is the main difference between etherbase and coinbase? And what is the meaning of "uncle" in a transaction?


texts:
I'm creating a Dapp which provide the user with individual account. while developing, when i create a account by
const accounts = await web3.eth.personal.newAccount('test');

the account is created with 0 balance. So I want to transfer some eth from existing ganache account to the newly created account. And so, I did
web3.eth.personal.unlockAccount(accounts, 'test', 10000)
web3.eth.sendTransaction({to:accounts, from:0x1d28f28f0b9B27FeA2aCAd1428485334d1f7429E,value:web3.utils.toWei("5", "ether")})

where accounts contains the address of newely created account from contains an account in ganache. When i execute it, I get these two errors
Uncaught (in promise) Error: Returned error: sender account not recognized
Uncaught (in promise) Error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 1800000000000000 and the sender's account only has: 0

What i'm trying to do is, to create a new account when user signs up and transfer some ether to it so that the user can write something to the smart contract.
Is there any best way to create an account for the user and make it ready (with some ether in it) to write something to the smart contract. or how to manage this account creation when deploying to a testnet.


texts:
In JSONRPC WIKI page, there is an method called eth_newFilter, though this function, we can subscribe the specific event logs we need.

We can get the subscription via eth_getFilterChanges. And the return just like

removed: TAG - true when the log was removed, due to a chain reorganization. false if its a valid log.

logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.

...

But i found there it no removed field in the return json object.

the return value like that:

{u'blockHash': u'0xc9589fbc55d19d1b2071ef0b9a55ac0391ee6f2219b50264764faa8e81e46abc', u'transactionHash': u'0x7770cf630cc76edbe83ab2f10fd3a05995f9c8d21c6a94c8ef8c3311db4b0f0e', u'transactionIndex': u'0x7', u'topics': [u'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', u'0x000000000000000000000000414755edffa43707f7d51600edf9ecbe57152a8a', u'0x0000000000000000000000007b277e894b11daedaecfdd2b2d931c2270927f9e'], u'blockNumber': u'0x20ae14', u'address': u'0xafe6851c1d9ee2e759acdee8cfc827e22a9ec5d7', u'logIndex': u'0x1', u'data': u'0x00000000000000000000000000000000000000000000000000000000000004e1'}

So Is there my pyethapp version not correct or the geth client version not correct or this field has been DEPRECATED ? If this field has been DEPRECATED, how to detect whether this log is in a reorg block or a normal block?

My pyethapp version: 1.2.3
My geth version: 1.4.10-stable-585996f9


texts:
I'm new to solidity.
Someone please explain "for loop" in solidity and the for loop in the code below.
function delete_element(uint index) public returns (bool){
    if(index >= prices.length)
      return false;
  //please explain this for loop
  for (uint i = index; i < prices.length-1 ; i++){
      prices[i] = prices[i+1];
  }
  prices.length--;
  return true;
}


texts: Why do solc v0.4.17 and v0.4.18 behave differently with the allow-paths primitive?

texts:
Here's an example contract:
Nobody.sol
pragma solidity ^0.4.17;

contract Nobody {
    function die() public {
        selfdestruct(msg.sender);
    }
}

The solc JSON specification to compile the contract is
Nobody.json
{
    "language": "Solidity",
    "sources": {
        "./Nobody.sol": {
            "urls": [
                "./Nobody.sol"
            ]
        }
    }
}

If the contract is compiled with solc v0.4.17 on an Ubuntu 18.04 system, it errors out.
$ cat nobody.json | solc --standard-json --allow-paths .
{"contracts":{},"errors":[{"component":"general","formattedMessage":"Cannot import url (\"./Nobody.sol\"): File outside of allowed directories.","message":"Cannot import url (\"./Nobody.sol\"): File outside of allowed directories.","severity":"error","type":"IOError"}],"sources":{}}

But the same contract compiles fine with solc v0.4.18. Why do these solc versions behave differently when it comes to the error File outside of allowed directories? What does it mean even? What did change from Solidity version 0.4.17 to 0.4.18?


texts: contract deployment fine on rinkeby but pending on mainnet

texts:
I deployed smart contract on rinkeby using web3 script and it works fine, actually deployed many times.

Today I tried to deploy on main net and transaction is pending since 40 mins, gas limit is good enough and account has ether balance as well.

https://etherscan.io/tx/0x0f6ec341347dfd107c278c5af34b8d4de1822dd3bcc8ef5460e8865b21417543

Nonce is 0 as it is first transaction from this account.

What could be the reason of pending?


texts: Can I deploy smart contract written in an older version of solidity ? If yes how to recognize it in EVM?

texts:
If I can compile a smart-contract written in an older version say 0.1.3, can I still deploy it?

If I can, is there a way to look at EVM bytecode and tell that this smart contract is written with an older version of solidity?


texts: call other contract's external function , the error: The contract code couldn't be stored, please check your gas amount

texts:
when I deploy a contract, the truffle frame told me this error ：“The contract code couldn't be stored, please check your gas amount”。
the solidity code is:

1) Base.sol

pragma solidity ^0.4.22;
contract Base{
    uint public num;
    event mint(uint n);
    constructor() public {
    }

    function Minit(uint _n) external returns (bool) {
        num = _n;
        emit mint(num);
        return true;
    }
    function getN() external view returns(uint result){
        result =  num;

    }
}

2) Extend.sol

pragma solidity ^0.4.22;
import "./Base.sol";
contract Extend{
    Base public base;
    uint public num;
    constructor() public {
        base = new Base();
        base.Minit(10);
    }
    function setN() public{
        num = base.getN();

    }
    function getN() public view returns(uint){
        return num;
    }
}

3) I run these smart contracts in a private ethereum. the genesis.json is:

{

"config": {

"chainId": 168,

"homesteadBlock":5,

"eip155Block":0,

"eip158Block":0

},
"alloc" : {},

"coinbase" : "0x0000000000000000000000000000000000000000",

"difficulty" : "0x400",

"extraData" : "",

"gasLimit" : "0xffffff",

"nonce" : "0x0000000000000042",

"mixhash" :"0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" :"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}

4) the truffle.js file is：

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
    networks:{
        live: {
            host:"127.0.0.1",
            port:8545,
            network_id:"168",
            from:"0xd31457ba4448cf4ec0c9b9e87e06d633cd9e5406",
            gas:6500000

        }
    }

5) the deploy script is :2_deploy_contracts.js

var Extend = artifacts.require("./Extend.sol");
module.exports = function(deployer){
    deployer.deploy(Extend);

}

6) go's verions

go version go1.10 linux/amd64

7) geth's versions

Geth
Version: 1.8.15-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: linux
GOPATH=/home/hlf/Gopath
GOROOT=/usr/local/go

so, I want to kown why I could failed? and What should I do?

Now, I found that if one contract call other contract's external function and this function have a returns value,the gas will be burned all, sample:

1) Base.sol

pragma solidity ^0.4.22;

contract Base{
    address public owner;
    function Mint() payable external  returns(uint){
        return 1;
    }
    constructor() public {}
}

2)Extend.sol

pragma solidity ^0.4.22;
import "./Base.sol";
contract Extend{
    Base public base;
    uint public es;
    constructor (address  _baseAdd) public {
        base = Base(_baseAdd);
    }
    function mint() public {
     es =   base.Mint();
    }
    function getES() public view returns(uint){
       return es;
   }

}

when I call ExtendInst.mint() in truffle console, es = base.Mint() will consumes  all the gas. why? And Is it can't  use a contract's external function to return a value?


texts: how to represent "\x19Ethereum Signed Message:\n32" as java string?

texts:
How can I represent the this string "\x19Ethereum Signed Message:\n32" in java? The first character seems the length of 'Ethereum Signed Message:\n' string but it is escaped.

What I'm trying to do is to get the same sha3 hash for a given string using web3.sha3() and Web3j Hash.sha3() with the above prefix.


texts: How to install the Python bitcoin module on windows for presale wallet import?

texts:
I've been holding Ethereum since the pre-sale. I want to continue to just hold my presale wallet because its safe as cold storage (rather than importing into my wallet).

However, I want to be able to check that I still remember my password to my wallet.

There are instructions to do so here: Ether Purchase Troubleshooting posted by Vitalik Buterin on July 23rd, 2014.

I am a first time Python user, ran Python 2.7.11 and received message:

Traceback (most recent call last): File
"C:\Eth\pyethsaletool-master\pyethsaletool.py", line 9, in <module>
from bitcoin import * ImportError No module named Bitcoin

So this means that i'm supposed to load the python Bitcoin module. I'm not certain how to do this.

That said, I installed or rather should I say I upgraded pip:

python -m pip install -U pip

Now this is where I really am not sure what/how to do next:

I tried to install python-bitcoinlib and received a compatibility error
so next I went to pybitcointools and typed:

c:\Python27\python.exe C:\Eth\pybitcointools-master\setup.py

I received the following error:

error: no commands supplied

Note: I didn't configure Python to seamless work with my Command prompt which is why I am using python.exe command.

not sure what to do next... What to try do next?


texts: Concatenating a variable value to a bytes32

texts:
I am using Oraclize for randomness. The range of random numbers I want depends on a variable maxNumber, and will be 0 - maxNumber.

If you scroll to the right of my code snippet below, you'll see maxNumber which I intuitively attempted to concat using +.

Off course that doesn't work and I get a compiler error since I cannot concat uint to a bytes32.

What is the proper way to concat in this situation?

bytes32 queryId = oraclize_query(
            "nested",
            "[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random[\"data\"]', '\\n{\"jsonrpc\": \"2.0\", \"method\": \"generateIntegers\", \"params\": { \"apiKey\": \"keyGoesHere\"}\", \"n\": 1,\"min\": 0, \"max\":'"+maxNumber-1+"', \"replacement\": true }, \"id\": 14215${[identity] \"}\"}']",
            gasForOraclize
        );


texts: Converting Remix ABI JSON statements to ABI-encoded Constructor Arguments

texts:
I am using MetaMask wallet with test-Ether via the Rinkeby faucet on Rinkeby test network to create a smart contract via Remix and Etherscan.
The code is basically using the functions from the following code:
https://github.com/bitfwdcommunity/Issue-your-own-ERC20-token/blob/master/contracts/erc20_tutorial.sol
... and applying it to the following smart contract: https://www.evoketechnologies.com/blog/deploying-erc20-tokens-test-network/
The code compliles, and deploys without error on Remix, but when I try to "Verify and Publish" on Etherscan, I get the following errors.

1) I'm not sure how to convert the ABI JSON files from Remix to the ABI-encoded form that Etherscan requests.
2) The Bytecode presented on this page matches both the Etherscan's "Input Data" and the ByteCode on Remix.  I'm not sure why I'm getting issues here.
Things I've tried.
...Regarding converting ABI JSON to ABI-encoded

Click and paste ABI JSON code from Remix to https://abi.hashex.org/#
Find the ABI encoded key at the end of any version of the ByteCode
Read through specs: Contract ABI Specification


texts: Not syncing due to "unhandled trie error: missing trie node"

texts:
Having an issue. Was caused by Avast blocking a file after I sent some Ether to Dao. Have removed Avast now that I understand it was messing stuff up. Restarted computer... now when i try to sync it says "unhandled trie error: missing trie node" & "invalid receipt root hash"  Running latest version 7.4 of Mist wallet on a mac.  Seems when I sent the ether to dao, Avast blocked some part of the transaction.... now its stuck
Any help would be greatly appreciated :-)


texts:
I have a contract on chain and the deployed bytecode is 36.201KB, but EIP 170 limited the contract size to 24.576KB. Can anyone tell me how I was able to deploy a 36.201KB contract? https://etherscan.io/address/0x8c4317745f185534d645bff2b5e648c1d211edf5#code

Is there still a 24.576KB limit specified in EIP 170 ?


texts:
My code works with compiler 0.4.25 but not with the latest version.
I want to keep track of every "Contract 2" that "Contract 1" create.

Contract 1

uint public countContract;
address[] public deployedContracts;

function createContract(string memory _name)
public{
    address newContract = new Contract2(countContract++, _name);
    deployedContracts.push(newContract);
 }

Contract 2

uint public id;
string public name;

constructor(uint _id, string memory _name)
public{
    id = _id;
    name = _name;
}

The error I am receiving on Remix is:

  browser/temp.sol:9:5: TypeError: Type contract Contract2 is not implicitly convertible to expected type address.
      address newContract = new Contract2(countContract++, _name);


texts:
I'm using Remix to deploy onto Rinkeby.

I can deploy the contract fine, although I have to increase the 3000000 gas limit to 13000000.

When I trigger an event that updates a uint256 field, the transaction goes through fine.

However, when I change that to update a single array value myArray[0] = someint, it gives me callback contain no result Gas required exceeds block gas limit: 13000000, and doesn't matter what I set gas limit to.

Specifically:

address[] public addressList;
uint public someint;

function testit() payable {
  addressList[0] = msg.sender;   // This line always exceeds gas limit

  someint = msg.value;  // Only this line works

  sendFunds(); // does this: ownerwallet.transfer(msg.value);
}

Why would such a trivial call exceed the gas limit?


texts: Web3-eth-debug "Debug is not a constructor"

texts:
I use nodejs to execute a javascript that interacts with my local instance of Ganache. I would like to use the web3-eth-debug module to get information about my transactions. However after installing the module with npm i web3-eth-debug or npm i -g web3-eth-debug and running the following Javascript code I get the error TypeError: Debug is not a constructor.

My code:

const Web3 = require('web3')
const fs = require('fs');
const Debug = require('web3-eth-debug')
const options = {
    transactionConfirmationBlocks: 1,
}
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"), null, options);
const debug = new Debug(new Web3.providers.HttpProvider("http://localhost:7545"), null, options);
...

Is the debug module supposed to be imported or constructed differently? What am I missing?


texts:
What if a client malfunctions due to the corruption of data isn't it risky to stake?

With PoW this is no issue but with PoS this seems to be a real issue with the slasher protocol. I would be worried to lose my funds.

I mean the risk to reward is for sure good, but I don't care if I would stake everything.

Is this a valid concern?
Is there a risk?


texts: Can a smart contract create a wallet address?

texts:
Say I'm writing a staking smart contract (Staking Contract) but I don't want it to be taken advantage of by whales (ie YVault) so I would like to limit the deposit amount per address to 1000 eth.
Would a smart contract like YVault be able to create new wallet addresses, send their eth to these new addresses, and then have these new addresses deposit to the Staking Contract to fool it into thinking a new address has deposited?
Alternatively do smart contracts have derivative child addresses that it would be able to use to deposit to my smart contract?


texts: Best way to track block transactions as they happen

texts:
I found this repo, which retrieves recent gas prices using web3:

https://github.com/ethgasstation/gasstation-express-oracle/blob/master/gasExpress.py

I'd like to write a similar script that would stay running and get a callback every time a new block occurred with all the transactions in the block, and keep a running average of gas prices rather than invoke all these calls every time we need to check.

Seems like there is a websockets server option in the web3 library. I'm struggling with how to test this. Does testrpc allow me to observe block changes automatically? If so, how?


texts: Verified smart contract says beneficiary and token address 0x0000

texts:
I just deployed a token crowdsale contract here https://ropsten.etherscan.io/address/0x043acaa777f3e08d0b25d48c899a681a7a17db37#readContract

When I read smart contract, the tokenReward and beneficiaryWallet both shows 0x00000....

Any idea?
Thanks!


texts: Truffle test. Convert '0x0000000000000000' to zero. Assert it doesn't exist

texts:
I am writing a truffle javascript test and I need to test if a key in a mapping was deleted. After deleting it, its values are equal to '0x0000000...' . How can I test in a truffle javascript test that that equals to zero?
  magicSmartContract.delete_card('33');
  deleted_card = await magicSmartContract.get_card('33');
  assert(deleted_card[0], 0);  // This

It is a js question I know, I am just wondering if there is an easy way to do this. deleted_card[0] is '0x0000000000000000000000000000000000000000' .


texts: ENS: how to compute namehash from name in a smart contract?

texts: using Solidity in a smart contract, how is the namehash computed from name ("foo.eth") ?


texts: Solidity libraries with public visibility

texts:
Suppose I have the following Contracts and a Library:

pragma solidity ^0.4.21;

library UserLib {
  function insertUser(address dbAddr, bytes32 user) public {
      DB(dbAddr).setUser(user);
  }
}

contract DB {
  mapping(bytes32 => bool) private user;

  function setUser(bytes32 usr) public {
      user[usr] = true;
  }

  function isUser(bytes32 usr) public view returns (bool) {
     return user[usr];
  }
}

contract Parent {
   using UserLib for *;

   function insertUser(address db, bytes32 usr) public {
      UserLib.insertUser(db, usr);
   }
}

If I call Parent.insertUser(DB_ADDRESS, "wilco") Remix would output the following:

Notice that it says "Transaction mined but failed" but when I try to change UserLib.insertUser()'s visibility to internal everything works just fine.

I'm trying to move logic into Libraries as other resources says I should do to reduce gas cost upon deploying a contract... what do you think am I missing here?

I'm a newbie to solidity :)


texts:
So, I created a new wallet using parity and should have mistyped the password, I am not able to access the wallet at the moment.

Is there a tool like https://github.com/burjorjee/pyethrecover for brute forcing a wallet created by Parity?


texts: What block will be set on pending transactions?

texts:
I have faced with different pending transactions in Ethereum. This is one of its strange ones which is pending after 9 days! Total amount which has sent is 1 USDT, and the fee is 0.0003 Ether.
Regarding to this sample, I need the answer of 2 questions:

Why such transaction is still pending after a while? The fee was not low, and the from account had sufficient fund.
Imagine when I had sent that transaction, the highest block number was 1000, and currenctly it is 2000. If the transaction becaome success now, which block number will be set on this transaction?


texts:
Every transaction on the Ethereum blockchain must consume less gas than the block gas limit, which can fluctuate depending on the weighted average sentiment of miners. To help incentivize inclusion of transactions when the gas limit is low, relative to the number of gas being consumed, a higher gas price can be set.

Is there an upper limit on gas price? Put another way, is there an upper bound on an individual transaction's transaction fee which is equal to quantity gas price x gas consumed? Or is the limit simply the amount of ether that the transaction's sender is willing to spend and has available?

(I came up empty-handed after a quick scan of the geth source code and couldn't find the answer on the web)


texts: Calling signature functions in web3.js 1.0 reports invalid address and cannot read address property

texts:
I am doing a project with inserted Metamask to achieve on-click blockchain account login. When I am calling the signature function
web3.eth.sign("Hello world", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe")
.then(console.log);, the browser reports the error telling me "Invalid Address".

I have checked the function reference on web3.eth website, pretty sure the format is correct. However, when I change to use "web3.eth.personal.sign()", the browser also reports error. This time I just used the sample code from web3.eth website like thisweb3.eth.personal.sign("Hello world", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", "test password!")
.then(console.log);

However, the browser still reports error says"Uncaught TypeError Cannot read property 'sign' of undefined."

Here are my full codes, I am struggling in solving this problem. Hope you guys can help me.

<!DOCTYPE html>

function send(){
        if(!window.web3){
            alert("Please install Metamask!");
        }//end if
        //else{alert("You have installed Metamask");}

        if (!web3) {//5 check whether metamask is connected online
                web3 = new Web3(window.web3.currentProvider);
                const publicAddress = web3.eth.coinbase.toLowerCase();
                this.setState({ loading: true });
            }//else {
                     // set the provider you want from Web3.providers
              //  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
                //  }//end else
       //ask for authorization
              if(window.ethereum){
                  try{
                      if(typeof window.ethereum.selectedAddress === 'undefined'){
                          window.ethereum.enable();
                          console.log('enable');
                          window.web3 = new web3(window.ethereum);
                      }else{//end if
                          console.log('window.ethereum.selectedAddress');
                          window.web3= new web3(window.ethereum);
                      }//end else
                  } catch (error){
                      console.log("The request is rejected");
                  }//end catch
                 }else{//end outer if
                    console.log("Please Use Metamask");
                 }
                    //get account
                  if(typeof web3.eth.coinbase !== 'undefined'){
                alert(web3.eth.coinbase);
              }
              // sign the address
              var address = web3.eth.coinbase;
              web3.eth.personal.sign("Hello world", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", "test password!").then(console.log);
           // alert(sign);
            }//end define function


texts: How to send data to another address on the blockchain?

texts: I have been practicing writing smart contracts using solidity and testrpc. How can I write and test a simple script that will send a message (e.g. "hello world") to another user on the blockchain. All the smart contracts I've written so far just involve mutating data from one address. Where will the messages get stored, and how will users read the messaged? I'm having great confusion understanding the high level architecture of this problem, and would greatly appreciate any input.


texts: Deploy from Remix to Quorum using password? "authentication needed: password or unlock"

texts:
I can SSH into the box that is running Quorum:

run geth with the flag --allow-insecure-unlock
geth attach new-node-1/geth.ipc
personal.unlockAccount(eth.accounts[0])

I'm interested in knowing if I can use the password directly from Remix?

(I'm also running a virtual desktop on my box, that's why localhost:22000 works for me)
But why?
I had some troubles with network configuration and temporarily my AWS security policy is "wide open", all the ports accessible by the public.
I'm worried that if I do unlockAccount someone could mess with my stuff.
For the production environment majority of the ports will be closed but for the sake of learning I would like to know is there a way to use a password directly from the UI?

A little bit related: Truffle mingration: Error: authentication needed: password or unlock - interactive command prompt in Truffle script.


texts: Using a full archival node like Parity or Geth, how to query which is the last transaction which changed the value of a particular storage address

texts:
I tried various third party services like Infura, and there support all told me that this was unsupported and that I would have to run my own Parity full archival node for this.
But even if I would have my full archival node (something now requiring 5TiB of ram worth 92,000$ in order to be build) which api along function I should use in order to get the transaction or block number used to set the lastest value of a storage address from a specific contract s?


texts: What does address.send(amount) do, step by step?

texts:
When this is in the Solidity Contract ...

address.send(amount)

... what happens specifically on my node and blockchain? Step by step.

And, in this case is the throw state or the SuccessEvent() executed immediately?

if (!celler.send(dealAmount)){
    throw;
} else{
    SuccessEvent();
}

Thanks.


texts: Can I call a contract function in the "data" element via web3, especially when I am using conversion to bytes?

texts:
In other words, say In Python I have something like that:

signed_txn = w3.eth.account.signTransaction(dict(
    nonce=w3.eth.getTransactionCount('0x0000000000000000000000000000000'),
    gasPrice = w3.eth.gasPrice,
    gas = 100000,
    to='0x000000000000000000000000000000000',
    value=w3.toWei(0,'ether'),
data='a9059cbb000000000000000000000000583031d1113ad414f02576bd6afabfb302140225000000000000000000000000000000000000000000000000000000000000000c'
  ),
  '0000000000000000000000000000000000000000000000000000000000001')

w3.eth.sendRawTransaction(signed_txn.rawTransaction)

the "data" element above simply holds a sha3 conversion of the transfer function + its 2 arguments (send address and amount), as described by this chap here:

https://medium.com/swlh/understanding-data-payloads-in-ethereum-transactions-354dbe995371

I simply need a way to send the function call to contract via 'simple' way in bytes that I can get from Remix, instead of manually writing the call programically? Thanks!


texts: Smart Contracts and symmetric encryption

texts:
I am currently learning about smart contracts and there is a question I have.

I am trying to understand how smart contracts are executed. I read already different sources and I tinkered some ideas together but not sure if it is correct.

To deploy a smart contract, I have to send a transaction. A miner takes it, creates a smart contract address and as soon the block is valid, I have to possibility to work with the smart contract.

If I want to execute a smart contract I create a new transaction using the ABI of the smart contract to call a function(s). Since it is a transaction, a miner takes it, executes the code of the smart contract. But what happens now? Is the execution stored in the blockchain with the result of the execution?

I was wondering how this actually works. Let's consider I create a symmetric key encryption smart contract. I send a message and key and the smart contract sends the cipher back. Will the plain text be visible for everyone or just the cipher text?

Thanks in advance


texts: Is my Nvidia GeForce GTX 745 a good choice to do cryptocurrency mining (especially ethereum)?

texts:
I have a graphic card that is relatively great and I wondering if I could use it to win some extra money from cryptocurrency mining!
The graphic card is Nvidia Geforce GTX745. I searched all over the internet and didn't find it in any of the lists featuring great data mining graphic cards.
Thanks in advance.


texts: Simple event watching with testrpc - unexpected output


texts: EthersJS returns array double wrapped i.e [ ["0x838383...", "0x3BC2...", ] ]

texts:
I have a method that is supposed to return an array of deployed contract addresses, it works albeit the value that is returned client side is wrapped with an extra set of brackets and also when checking its type on the client side with typeof deployedInstances is shows object.
clonedAddresses[] public contractAddresses;

function getContracts() external view returns (clonedAddresses[] memory) {
    return contractAddresses;
}

and the client side JS looks like this
const instance = new ethers.Contract( contractAddress, abi, signerObject );

let deployedInstances: any = await instance.functions.getContracts();

The data being returned to me looks like this  [ ["0x838383...", "0x3BC2...", ] ] what I want is a simple 1 dimensional array which I can run forEach or map on, when i run forEach on this as it is it just dumps out all the addresses as a string.
Update in response to below question:
    [
        [
            "0x78dfd733877590257B00185879879B18698C4395",
            "0x637016b704d143b875f05e03406740Bc91757881",
            "0x5C5068504f3032d7D3e3a6750C31790a00CA95F4",
            "0x3bcA495aAdE569F1357a46e304f6D246061C2F2b",
            "0xba8D7BeFBC6de94D835F5C976057b2E36980375c",
            "0x489335Fd18cD4ade0dCCf70F729a6456E1dFE1C8",
            "0xC0718A6aD60228C2a8e6D5b4074013579E024d43"
        ]
    ]


texts: calling a contract function from another contract [out of gas]

texts:
Consider the following two contracts A and B. Suppose I store these in
a and b.  Then when I make a call and try to pass two addresses as follows:

a.reqswap(b.address,eth.accounts[0],eth.accounts[1])

it does NOT increment the counter.  I make sure there is ether in the contracts
a and b.

On the other hand, if I delete the address arguments x,y and all statements
that contain x,y  from the code  and  just call :

a.reqswap(b.address)

This time it works and the b.counter is incremented.

As I said, I do make sure  eth.defaultAccount   is set and that also
there are ethers in the contracts (so as to provide gas).

contract A {

    address  public owner;
    uint     public counter ;
    B b ;
    address public bc ;
    address public bo ;

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

    function A() {
        owner = msg.sender;
        counter = 1 ;
    }

    function increment(address x,address y) public {
       counter = counter + 1 ;
       bc = x ;
       bo = y ;
    }

    function reqswap(address baddr,address x,address y)  public {
        b = B(baddr)  ;
        b.increment(x,y) ;
    }
}

contract B {

    address  public owner;
    uint     public counter ;
    A a ;
    address public ac ;
    address public ao ;

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

    function B() {
        owner = msg.sender;
        counter = 1 ;
    }

    function increment(address x,address y) public {
       counter = counter + 1;
       ac = x ;
       ao = y ;
    }

    function reqswap(address aaddr,address x,address y)  public {
        a = A(aaddr)  ;
        a.increment(x,y) ;
    }
}


texts: how to solve VM Exception while processing transaction: out of gas

texts:
i am trying to call this function with help of web3.js in ganache testrpc but it is giving me error of  VM Exception while processing transaction: out of gas

i have tried to increas gas of ganache to 999999999999 still its not work...

  function initialEscrowDetail(uint transactionId,address partyB,uint
  amount,bool condition){

    escrowDetail[transactionId].originator=msg.sender;
    escrowDetail[transactionId].beneficiary=partyB;
    escrowDetail[transactionId].amount=amount;
    escrowDetail[transactionId].payoutCondition=condition;
    escrowDetail[transactionId].escrowCompleted=false;
}


texts: How are end-users meant to build trust towards smart contracts (and their originators)?

texts:
One of the benefits commonly associated with Ethereum is that it allows end-users to interact directly with smart contracts and thereby removing the need for trusted-third-parties.

In cases where:

the source of the smart contract is published, and
the contract running at an address can be securely traced to that source, and
the end-user is able and willing to audit the code before interacting with it

then the end-user can establish trust (or perhaps, rather, confidence) that the contract complies with expected behavior.

The reality is, however, that in most cases at least one of the above conditions will fail, and therefore the end-user will blindly interact with a contract they do not understand. And the odds are that for every well-intended contract there will be one that is either intentionally, or unintentionally malicious.

How is this solved without introducing yet another trusted-third-party that acts as a quality auditor?


texts: Having trouble with returning fixed-size arrays

texts:
So I'm having two problems with returning arrays from external functions:

Case One: arrays in getters

contract A {
  mapping(address => uint8[10]) public gameBoards;
}

// test.sol
function testGetGameBoard() {
  address myAddress;
  uint8[10] memory gameBoard = a.boards(address);
  Assert.equal(gameBoard[0], 0, 'uint8 arrays are initialized with 0');
  // TypeError: Member "equal" not unique after argument-dependent lookup in type(library Assert)

From this answer it looks like the compiler can't infer gameBoard[0] is a uint8?  I'm not sure what's going on.

Case Two: arrays in structs

contract A {
  mapping(address => Game) public games;
  struct Game {
    address player;
    uint8[10] board;
  }
}

// test.sol
function testGetGame() {
  address myAddress;
  var(player, board) = a.games(myAddress);
  // TypeError: Not enough components (1) in value to assign all variables (2).

From what I understand, return values need to be known in size, which prevents you from returning dynamic arrays and strings.  But a fixed array uint8[10] should be known in size, right?  It's not clear to me why I'm getting both of these errors.  Any explanation as to what's going on would be much appreciated.


texts: Is trustless BTC-LTC-ETH peg possible with Segwit?

texts: I thought there were some discussions in 2016 that a trustless peg was possible between ETH and BTC. (Probably related to rootstock). With segwit in place, can this be done now?


texts: Why separate DAO/ICO contract from token contract?

texts:
Whenever I see a DAO or ICO contract, the token contract is a contract at a different address...
Let's say I want to create a democratic DAO contract without an owner. When someone sends 1 ETH to the contract some tokens are generated by the contract and credited to the msg.sender (up to a specified maximum supply) wouldn't it make sense to pack them into one contract? What speaks against it or why are those contracts always separated from each other?


texts:
I am trying to run this code on remix IDE:

pragma solidity ^0.4.24;

contract Aa {

    string public result;

    function feedData(string _result) public {
        require(_result = "e" , "error");
        _result = result;
    }
}

I keep getting an error: No matching declaration found after argument-dependent lookup.
        require(_result = "e" , "error");

I looked up the error on stackexchange but the answer doesn't solve this issue. (No matching declaration found after argument-dependent lookup)

When I change the line:

require(_result = "e" , "error");

to => :

require(_result == "e" , "error"); // adding an extra equal sign.

I get the error:
 Operator == not compatible with types string memory and literal_string "e"
        require(_result == "e" , "error")

So now my question is: How can I use require() with a string variable or is there a better way to achieve what the code is trying to do?


texts:
Can I create my own Ethereum with name blah and people can create their tokens with Remix on my own Ethereum (blah)??
Because Ethereum is open source!!!


texts: Why does the new light-client example throw a warning?

texts:
Even though I use the new example, lightwallet throws me:

  The new KeyStore constructor has been deprecated in favor of KeyStore.createVault(), and will be removed in a future version. Read issue #109 for info.

This is the recommended sample instead of:

  Sample old-style usage with hooked web3 provider (still works, but less secure because uses fixed salts).

https://github.com/ConsenSys/eth-lightwallet

Should I be worried?

var lightwallet = require('eth-lightwallet');
// the seed is stored encrypted by a user-defined password
var password = 'Enter password for encryption';

lightwallet.keystore.createVault({
  password: password,
  // seedPhrase: seedPhrase, // Optionally provide a 12-word seed phrase
  // salt: fixture.salt,     // Optionally provide a salt.
                             // A unique salt will be generated otherwise.
  // hdPathString: hdPath    // Optional custom HD Path String
}, function (err, ks) {

  // Some methods will require providing the `pwDerivedKey`,
  // Allowing you to only decrypt private keys on an as-needed basis.
  // You can generate that value with this convenient method:
  ks.keyFromPassword(password, function (err, pwDerivedKey) {
    if (err) throw err;

    // generate five new address/private key pairs
    // the corresponding private keys are also encrypted
    ks.generateNewAddress(pwDerivedKey, 5);
    var addr = ks.getAddresses();

    ks.passwordProvider = function (callback) {
      var pw = prompt("Please enter password", "Password");
      callback(null, pw);
    };

    // Now set ks as transaction_signer in the hooked web3 provider
    // and you can start using web3 using the keys/addresses in ks!
  });
});


texts: So I'm reading up on Casper, and I see Consensus By Bet.  How does it protect the network in a POS system?


texts: Why Use App/Protocol Tokens instead of regular payment systems?

texts:
What advantages does an app coin/protocol token have over using a regular payment system in dollars, euro or even between currencies? In other words, why go to the trouble of creating a token that today only a few people uses instead of accepting regular payments?

I know that app coins are used for ICO's, but do they offer additional advantages?


texts:
I want to install webjs so I run the below command but it is showing an error.

  $ sudo npm install -g web3

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/web3-js/WebSocket-Node.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nithin/.npm/_logs/2019-09-18T09_41_14_857Z-debug.log


texts:
I have a user registeration logic defined in solidity which used to work fine when I set an registeration fees of 0.5 ETH for testing purpose.But now, when I remove the register fees, I'm not able to register any user, instead I get an empty object in console.
c {}__proto__
: constructor: ƒ c()
    arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at Function.o (<anonymous>:1:83)]caller: (...)length: 0name: "c"prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: index.js:35[[Scopes]]: Scopes[3]__proto__: Object'
   length: 0,
    name: "c"

Web3js

async function userRegisterationn() {
       var input = $("#refer_id").val();

        let ref = web3.utils.isAddress($("#refer_id").val());
        if (ref) {
            contract.methods
            .isUserExists(account)
            .call()
            .then((isUserExist) => {
                console.log(account);
                if (isUserExist) {

                  $(".success_tx").hide();
                  $(".tx").show();
                  $(".transaction_err").text("Already Registered");
                  console.log("Already exists");
                  return false;
                } else if(isUserExist == false) {

                let referral = $("#refer_id").val();
                contract.methods
                    .registeration(referral)
                    .call()
                    .then((res) => {
                        console.log(res)
                        if (res) {
                            localStorage.setItem("user_address", account);
                            $(".tx").hide();
                            $(".success_message").text("User Registered Successfully");
                            $(".success_tx").show();
                            window.location.href = "users/index.php";
                        }
                }
            })
        }
    }
 }

Solidity

struct User {
    uint id;
    address referrer;
    uint partnerCount;
    bool isRegistered;
}

uint public lastUserId = 2;

mapping(address => User) public users;

 function isUserExists(address _userAddress)  public view returns(bool) {
    // return users[_userAddress].id != 0;
    return users[_userAddress].isRegistered;
}

function registeration(address _referAddress) external  {
    userRegisteration(msg.sender, _referAddress);
}

function userRegisteration(address _userAddress, address _referAddress) internal returns(bool) {
    // require(msg.value == 0.05 ether, 'registeration cost 0.05');
    if(users[_userAddress].isRegistered == true) {
        return false;
    }

    if(users[_referAddress].isRegistered == false) {
        return false;
    }

    // require(!isUserExists(_userAddress), "User already exists");
    // require(isUserExists(_referAddress), "Referrer doesn't exist");
    // uint32 size;

    User memory user = User({
        id: lastUserId,
        referrer: _referAddress,
        partnerCount: 0,
        isRegistered: true
    });

    users[_userAddress] = user;
    users[_userAddress].referrer = _referAddress;
    users[_referAddress].partnerCount++;

    lastUserId++;
    return true;
}


texts: Truffle - multiple transactions per block

texts:
i try to simulate a large transaction load and therefore want to execute multiple transactions in a truffle test. I changed the block-time to five seconds and generate the transactions, but only one transaction per block is executed.
Here is my code:

And here the ganache blocks. Every block with only one transaction, i would like to have all 10 transactions in a single block.

I really need help, i dont understand the problem. I am able to get two transactions in a block when i manually send ether with metamask, but not with the truffle test.
EDIT - solved:
I changed the code to web3.eth.Contract and call the method with Contract.methods.myFunction(..), now it works but i dont know why ^^:


texts: Is there any Mobile Wallet like Jaxx, but with testnet(like, kovan, ropsten)? Please do suggest me, I am workin on the cryto coin transfer application.


texts: Why ethereum transaction fee has increased so high?

texts: I'm wondering what has caused this recent spike?


texts:
When we invoke an event as follows :

event MyEvent(uint256 indexed _id, bytes32 _action, bytes32 _player, bytes32 _actionState,  address _owner);

emit MyEvent(uint256(_public_id), bytes32(_action), bytes32(_player), bytes32(_actionState), _owner);

In EtherScan, we see an output as follows :

EtherScan Event Log

What does Topics   [0] 0x22b8025a23f25c3f52cdbc1f53a831dbd4e3b4aaeebe121d36c858abea974bc7 mean ?

In case of MyEvent, [1] 0x0000000000000000000000000000000000000000000000000000000000000001 means _public_id = 1

However, I do not know 0x22b8025a23f25c3f52cdbc1f53a831dbd4e3b4aaeebe121d36c858abea974bc7 comes from where ? and in general, the term of Topics what does it mean ?