texts: Why are parameters of external functions not lvalue types?

texts:
When a function's visibility is external, trying to modify the function parameters within that function gives the error:

TypeError: Expression has to be an lvalue.

However, if I change the visibility to anything else, Remix gives no errors.

An example function which causes the error:

function d(uint num) external pure {
    num += 2; //<-- This line causes the error
}

But changing the visibility to public removes the error:

function d(uint num) public pure {
    num += 2;
}

Why does external visibility cause function parameters to not be lvalues?


texts: How to call smart contract from asp.net form

texts:
i am new at block chain. Please help how do i call contract from asp.net form.
I am using c# and SQL Server


texts:
I can't find where is address where it was sent my ether.

TX Hash 0x1407cffd5c1a8dd541b3e9d636d76a9787b52c69239d5564bc0df21020f1a1a8
From Address    0x6Ef6d5Cd57b8f69899D8E4c4BeE71E7B6Cf0487A
To Address  0x72Eb589cD05986C37a4f85D2826C5575ffDB22c3
Amount  1.178278 ETH

I didn't sent from myetherwallet that or it was a mistake.

Thank you,
Andrej


texts: Transaction only included if miner is running in the same node (private blockchain)

texts:
I have a private ethereum network with two nodes (geth), where one node is a miner.

There are two accounts in the network, one for each node, both having ether.

If I try to send a transaction from the miner node, it works fine.

> balance = web3.fromWei(eth.getBalance("0x30b4d1516775c89b59bdfc2e17a72aa250cdff7a"), "ether");

150

eth.sendTransaction({from:"0xe7d3b4f60d7baea5b6309b7601ad4785c98d46da", to:"0x30b4d1516775c89b59bdfc2e17a72aa250cdff7a", value: web3.toWei(50, "ether")})

> balance = web3.fromWei(eth.getBalance("0x30b4d1516775c89b59bdfc2e17a72aa250cdff7a"), "ether");

200

Balance is correctly reflected in both nodes.

But, if I try to send a transaction from the non-miner node, it doesn't get included (balance of the sender account stays the same).

If I stop the miner node, and then start mining in the previous non-miner node, previously sent transaction gets included and balance of the sender account gets reduced. If I start the stopped node again, it too reflects the new balance.

What could be the reason for this?


texts: Geth behind mainnet during fast sync on an SSD

texts:
I'm trying to sync a full node on my desktop but I'm not able to get past the state download phase.
After the block download phase completes (64 blocks behind mainnet) geth is not able to keep up with the network and the block difference between my node and mainnet increases overtime.
Restarting geth brigs it back at a 64 block distance from mainnet.
I've seen a couple of similar questions both here and in geth's repo, but most of those were caused by attempting to store geth's data on an HDD.
I'm currently running geth 1.9.19 with the following options:
geth --syncmode=fast --cache=8192 --datadir=F:/Ethereum

Here are some of my desktop specs:
Windows 10
16 GB RAM DDR4
Intel I7 8700
SSD Samsung 860 EVO V-NAND
I've also read somewhere that this issue might be caused by Windows, would running geth on a Linux VM work?


texts:
In plasma cash, if Alice sends the same coin to both Bob and Charlie and they both try and cash out, who gets the coin?

Does the plasma sidechain have to periodically commit its plasma blocks to the mainchain to avoid this situation? If yes doesn't that mitigate all the supposed speed benefits we get from Plasma cash?


texts: Geth -- Is this possible to setup a private chain that only mining when accept TXs

texts: If I do not use the options dev and dev-period , can I  setup this kind of  private chain


texts:
thanks all of guys help me. thanks very much.
I created contract in rinkeby test network. the contract address is:
https://rinkeby.etherscan.io/address/0x5dedcba9851e5c7ff464d5ee6ef75301a8c43d8b

I try to write code run contract transfrom method for move ERC2.0 token from A address to B address. but is always stop and show error message:Transaction has been reverted by the EVM.  I am not sure what's trouble. hope someone help me.

fs = require("fs");
Web3 = require('web3');
url = "https://rinkeby.infura.io/v3/29129372289d49dca8ecec82d0aa8e7a";
web3 = new Web3(new Web3.providers.HttpProvider(url));
var contractAddress ="0x5DedCBa9851E5C7FF464D5Ee6Ef75301a8c43d8b";
var abiArray = JSON.parse(fs.readFileSync('kct.json', 'utf-8'));
abi = JSON.parse(abiArray.result);
var contract = new web3.eth.Contract(abi,contractAddress);

web3.eth.getBlock("latest",function(err,block){
const gasLimit = block.gasLimit;
console.log('gas limit:',gasLimit);
prkey="0xDE9EAD9D7DE97A3F94D66F9D8D7BF437AA76A28D4A13202B446D48AB1979DBDB";
data = contract.methods.transferFrom("0x410E6a1be27424091ABb15aA096D492958fD55f1","0xf17f52151EbEF6C7334FAD080c5704D77216b732","12").encodeABI();
console.log("data",data);

    console.log('gasPrice:',gasPrice);

    console.log("contractAddress",contractAddress);
    var tx = {
    from:"0x410E6a1be27424091ABb15aA096D492958fD55f1",
    to:contractAddress,
    data:data,
    gasPrice: web3.utils.toHex(4200000000),
    gasLimit: web3.utils.toHex(4300000),
    };
    web3.eth.accounts.signTransaction(tx,prkey).then(tx => {
            console.log('Result++: ', tx);
            var raw = tx.rawTransaction;
            web3.eth.sendSignedTransaction(raw).on('receipt', res => {
                    console.log('操作成功');
            }).on('error', err => {
                    console.log(err);
            });
    }).then(receipt => console.log("Transaction succeeded", receipt)).catch(error => console.error(error))
})


texts: Is it possible to the dev program a mint for later?

texts:
So, i bought a token this week and suddenly it was minted and all the money drained. But here is the thing, i cheked and the ownership was rennounced and i didn's see any mint function, how is this possible?
This is the link
https://bscscan.com/address/0x4f2327d32f6d38c419b2b06fc68a587bfc6e9d5e#code


texts: Why the balance that I see in the Ropsten isn't reflected in Truffle console?

texts:
This is my account #1: http://ropsten.etherscan.io/address/0x6bc701e7c3b642fc12a3a6f7d1144b8200a26401

and I sent some ETH to account #2: https://ropsten.etherscan.io/address/0xb1862a4949553c993267054dfc10a8e76d83819b

Here's how I ran geth:

➜  voting_truffle geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024  --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"

But why I'm still seeing 0 balance through the Truffle console?

truffle(development)> web3.personal.unlockAccount('0xb1862a4949553c993267054dfc10a8e76d83819b', 'somepass', 15000)
true
truffle(development)> web3.eth.getBalance('0xb1862a4949553c993267054dfc10a8e76d83819b').toString()
'0'
truffle(development)>

Here's few info about my env:

truffle(development)> version
Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)

Thoughts?


texts: Logs and events: How are arguments of "watch" defined?

texts:
In order to watch an event we can use:

var temp;
eventx.watch (function(error, result){ temp = result.args.val.toNumber();});

Question 1: What is the role of:

function(error, result){ temp = result.args.val.toNumber();}

and why does not it have any name?

Question 2: What does it return?

In general, what are the arguments of watch function?


texts: How to retrieve current date and time in solidity?

texts: I need to store date in one variable and time in variable. Are there any methods to get date and time in solidity?


texts:
I have
<script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.2.9/web3.min.js"></script>

How to use this web3.js on browsers without MetaMask (for read-only Ethereum queries):
const web3 = new Web3(window.web3.currentProvider);

fails because window.web3 is undefined.
I think, I can initialize Web3 by specifying a provider manually. But how to decide what exactly to pass as the argument to new Web3 (for mainnet and for rinkeby)?
I need to use my own Infura account? Maybe I can pass the MetaMask's account (is it legal? what is the MetaMask provider URLs for mainnet and for rinkeby)?


texts: Can browser-solidity access contracts values with the in memory tester?

texts:
I was reading an interesting answer and wanted to make a quick test in browser-solidity.

My contract code is below and I'd just like to get the string I passed in the constructor.

contract testConstant{
string testString;
// {"_testString":"this is a test"}
function testConstant(string _testString) {
    testString=_testString;
}
function gettestString() public constant returns(string) {
    return testString;
}
}

Attached a screenshot, maybe I'm overlooking something but it seems to me the gettestString in blue should return the arg I passed in the constructor : "this is a test"


texts: Hi I'm trying crawl the Ethereum network to get a full list of nodes including IP and client info in nodejs. I know that it's hard to achieve 100% accuracy on a p2p network but I would like to get close. I'm wondering how I would do this? I know there are sites like ethernodes.org but they don't have an API and the html scraping is difficult and unreliable. I know that you can get the peer info of your own peers using Web3 but how do I do this recursively? Meaning, for each one of my peers, how do I find a list of their peers?


texts: Find the private keys to a derived ETH address from BIP39 mnemonic

texts:
I'm trying to find the private keys to a derived ETH address from a master BIP39 mnemonic / 12 word seed phrase. I can import the seed into MetaMask and can see/access the funds for the primary/master ETH address (m/44'/60'/0'/0), but cannot identify any of the derived addresses (these are generated for each new transaction, then a internal transaction transfers to the primary/master).
I've run a few tests with the seed and the https://iancoleman.io/bip39/ tool to iterate around 100k derived addresses, but cannot identify any of the known/used ETH addresses that were derived.
For reference: the seed is from a Coinbase Commerce checkout https://www.reddit.com/r/CoinBase/comments/i5sl3b/mods_is_coinbase_commerce_bip39_bip44_complaint/g18rqhc?utm_source=share&utm_medium=web2x&context=3


texts: How I will know if synchronization with testnet is finished

texts:
How I will come to know that synchronization is complete. Also what is potential rewrite attack?

I am using geth --testnet --fast --cache=1024

last couple of results

  I1026 08:43:50.011852 eth/downloader/downloader.go:711] Peer
  b274dd4c49d951d2 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss
  0, rtt 20s]: potential rewrite attack: #1715594 [00000000…] <=
  1715594 limit I1026 08:45:18.157176 core/blockchain.go:1001] imported 1 block(s) (0 queued 0 ignored) including 18 txs in 19.219834ms.
  1805595 [11e04fc8 / 11e04fc8]


texts: How to autonomously trigger transactions from Node.js?

texts:
I have a a JS file running on NodeJS on multiple devices which interact to each other, trying to write data on the Blockchain and send transactions.
The problem is that every time I have to manually insert the password. I have been using personal.unlockAccount in the client console but this doesn't really solve the situation...

I am trying to develop a micro-electricity-market where multiple autonomous transactions are sent every 15 minutes, I can't stay in front of the screen all the time.

Is there any way to achieve what i would like to do?

Thanks in advance


texts: Understanding first evm word of reference types in assembly

texts:
Given the following function:
function getArrayItems(bytes calldata) external returns (
    bytes4 _signature,
    bytes32 _wutIsThis,
    bytes32 _length,
    bytes32 _firstItem
) {
    assembly {
        _signature := calldataload(0x00) // trim the first 4 bytes
        _wutIsThis := calldataload(0x04)
        _length := calldataload(0x24)
        _firstItem := calldataload(0x44)
    }
}

I get the following output when I run the code in remix with the input 0xcafe:
{
    "0": "bytes4: _signature 0x38626302",
    "1": "bytes32: _wutIsThis 0x0000000000000000000000000000000000000000000000000000000000000020",
    "2": "bytes32: _length 0x0000000000000000000000000000000000000000000000000000000000000002",
    "3": "bytes32: _firstItem 0xcafe000000000000000000000000000000000000000000000000000000000000"
}

I fully understand the 1st, 3rd and 4th items. _length was tricky, but according to the docs:

The length of a dynamic array is stored at the first slot of the array and followed by the array elements.

It's the 2nd item, _wutIsThis, that is causing me trouble. My hunch is that it's about the data location of the array. That is, data is offset by 0x0000000000000000000000000000000000000000000000000000000000000020, which means that the first item of the array is located 32 bytes after the said location's position in calldata (I know, this is so meta).
Is that correct? If yes, why do we do this and where can I find some further documentation? The solidity docs on type data location are a bit vague and only explain that reference types must specify a keyword (memory, storage or keyword).


texts: Always use "memory" for variables created within functions. Bad practice?

texts: Is it bad practice to systematically use the memory keyword for variables declared within a function (other than constructor)?


texts: Are there other Vanity Address generators available?

texts:
Are there any Ethereum vanity address generators available other than:

Vanityreum (python)
Vanieth (go)

Which is the fastest? Can they be optimized further?

What is the use-case of vanity addresses compared to normal addresses?


texts: How do exchanges transfer tokens from user wallets?

texts:
I am wondering how exchanged like Binance are able to transfer out tokens from user wallets that have no ETH in them?

For example if I create a new binance account and say I transfer ADA from say MEW to the address given to me by binance, I can see the tokens transfer on the adderss, then when I exchange those tokens on Binance they are moved from the address even though I did not transfer any ETH to that address and I do not see any ETH being sent to it before the token transaction is made.

How does that work? Or am I missing something?


texts: How does EIP 150 change the call depth attack?

texts:
It seems that EIP-150 introduced a more expensive gas based restriction on the call stack and completely removed the previous 1024 hard stack limit. Is this true? It seems it took cues from EIP-90 & EIP-114, but not entirely sure what was implemented.

How does the new gas based limit work?


texts: gasprice mechanism of ethereum gas station api (ethgasstation)

texts: i try to understand the gas price mechanism of ethgasstation but i cannot understand the varibale used in the dataset like block_posted and block_mined in line 29 in the picture can someone help me


texts: How to initialize empty struct array in new struct?

texts:
Trying to do this:

contract Foo {
    mapping (bytes32 => Thing) things;

    struct Thing {
        Item[] items;
    }

    struct Item {
        uint number;
    }

    function Foo(bytes32 id) {
        Thing memory thing = Thing(); // What to do here to create empty array of type Item[]?
        things[id] = thing;
    }
}

and I get the error message:

Untitled:13:30: Error: Wrong argument count for function call: 0 arguments given but expected 1.
   Thing memory thing = Thing();


texts: Why is PoW needed to confirm transactions and add new blocks

texts:
I have read and I vaguely understand about how Proof of Work works and what does it do. But why PoW?

Or more bluntly, why do we need any algorithm at all to add new blocks.

What would happen if there wasn't any PoW algorithm in place?

If someone has any ref. links that would help me understand this better, please share.

Thanks in advance.


texts: How to send ERC-20 tokens to many different addresses in one transaction?

texts:
kindly help.
How to send the same ERC-20 tokens to many different addresses in one transaction and save the gas fees?


texts: How long does it take to validate transactions?

texts: It seems to be a common sense that validation process on the blockchain is very fast. I wonder how fast the process could be? How long does it usually take to validate a transaction? What will be done to validate a transaction?


texts: Does creating account with geth command "geth account new" make a new key store holder?

texts:
There are multiple ways of creating a ethereum account through geth.

geth account new
newAcc, _ := am.NewAccount("Creation password"); by importing import "github.com/ethereum/go-ethereum/accounts"

Does geth account new also create a new Keystore holder for the new account? And if it does where is it store?


texts: I need help understanding the best implementation of function modifiers

texts:
pragma solidity ^0.4.0;

contract SomeContract{

   address public owner;

    modifier ownerOnly{
        if(msg.sender == owner) _;  //would this use less gas than the modifier below?
    }

    modifier ownerOnly{
        if(msg.sender != owner) revert();  //is this modifier more secure?
        _;
    }

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


texts: Is there a way to safely send ether from a contract without the recipient triggering it?

texts:
In an auction-like setup, I'd like to be able to automatically "refund" players if they get outbid.

It seems like everyone recommends a manual "safe withdraw" pattern, where the player would have to trigger the withdraw function on the Auction contract in order to be refunded, but this seems like terrible UX. Is there any way around this without compromising security?


texts: How does the 'secret chain' catch up with the real chain in the long range attack?

texts:
I'm trying to dig deep into Casper and one of the things that keep coming up is the long-range attack in PoS. I understand the attack at a high level - basically you would go back some large amount of blocks where you had a large stake in the network and start forging blocks such that when you arrived at the height of the main chain, you would hold a large amount of the currency and take over the chain.

I saw a similar question here regarding the attack whose answer quoted the below excerpt from the Ethereum blog:

  In a naively implemented proof of stake, suppose that there is an attacker with 1% of all coins at or shortly after the genesis block. That attacker then starts their own chain, and starts mining it. Although the attacker will find themselves selected for producing a block only 1% of the time, they can easily produce 100 times as many blocks, and simply create a longer blockchain in that way.

The question I have regarding this quote is how exactly would the secret chain outpace parent chain? From my understanding, the general way to mine a block in PoS 3 is to solve this equation:

hash(kernel) ≤ target × balance of UTXO

Where the kernel is derived from the below:

nTimeTx : current timestamp (incremented every second)
nTxPrevTime: Timestamp of the UTXO
nPrevoutNum: Output number of the UTXO
nTxPrevOffset: Offset of the UTXO inside the block
nTimeBlockFrom: Timestamp of the block which provided the UTXO
nStakeModifier : a 64-bit string seeded from the block chain

How can you manipulate this to mine blocks faster than the parent chain? Would it be the timestamps?

Thanks!

EDIT: After thinking about this a bit more, I'm not sure if this attack is actually feasible... it seems purely theoretical. My logic is as follows: suppose the attacker created his own chain with even 50% of the total 'mainchain' coins. Since he is on his own chain, he will have 100% of the total staked coins on his own chain. With the 100% of the total coins on his own chain, he will certainly be the only minter on the secret chain and will be selected for half of the total possible 'minting opportunities' on the chain.

Indeed, because he is the only staker online in his own chain, he will mint every block, but the issue is the attacker is still subject to the 1 transaction per UTXO per second, so he cannot produce blocks faster. He can certainly produce a massive blockchain much larger than the mainchain because the time for him to accelerate through a couple years is only maybe a couple seconds in the simulation, but the issue will be that the head timestamp might be twice as long as the mainchain (perhaps a year), and clients will simply not accept a chain whose head is years into the future.

If anyone has any additional insight or has another approach to thinking about the problem, I would appreciate it! I found this source to be quite good.


texts:
Would you be willing to share your expert knowledge and your opinion? Please note the following contract:

pragma solidity ^0.4.4;

contract Eternal {

    string engravedText;

    function Eternal(string eT) payable {
        engravedText = eT;
    }

    function getEngravedText() constant returns (string) {
        return engravedText;
    }

}

Once it has been mined, it is meant to reside in the blockchain unchanged and forever. Its sole purpose is to provide its engraved text. Ako engravement in a granite brick that may be dug up in centuries from now.

Is that the case? Can it be killed by an outside force? If not, is it likely that any removal mechanisms will be created in the future that shortens its expected lifetime.


texts: How to incentivize a smart contract DApp without issuing a native token?

texts:
Premise: I’m still learning here so I apologize if my question is too basic.

My understanding is that technically a smart contract could be built using Ethereum blockchain... no need for native tokens, right?

Tokens are needed not for building the DApp’s features but as an incentive for miners to use the platform, right?

If so, then would it be possible to build a Dapp without native token and still provide a good incentive for miners to use your DApp???


texts: Offline transaction like lightening network on Ethereum

texts:
I want to implement transaction process like lightening network.
When 2 people do number of transactions between each other, for instance they did 10 transaction with each other. I want to keep all this to be offline and once they both want to settle down, the final transaction will publish on network instead of all the 10 transaction.
How can i achieve/implement this?


texts: How to generate test funds for Infura Ropsten Network wallet

texts:
I have been using Web3.py, and Web3's TestRPCProvider to create some utility functions in Python to deploy a smart contract meant to generate an ERC20 Token, and then communicate with that smart contract to transfer funds. I would now like to try it on Infura's Ropsten test network. I created a wallet on the network using MyEtherWallet, and used web3 with the private/public keys of the wallet to build and sign the transaction necessary to deploy the ERC20 contract, however I am getting this error

ValueError: {'code': -32000, 'message': 'insufficient funds for gas * price + value'}

My question is this since it is a test network, is there a way to generate test Ropsten ether in my new wallet using Web3.py or MyEtherWallet? To me it seems a little more pointless to use a test network if you have to top up your account with real money anyway.

Code "As method of class"

def deploy(self):
    instance = self.w3.eth.contract(abi=self.abi, bytecode=self.bin)

    construct_txn = instance.constructor().buildTransaction({
        'from': self.pub,
        'value': 0,
        'gas': 100000,
        'gasPrice': w3.eth.gasPrice,
        'nonce': self.w3.eth.getTransactionCount(self.pub),
    })

    signed = self.acct.signTransaction(construct_txn)
    tx_hash = self.w3.eth.sendRawTransaction(signed.rawTransaction)
    print(tx_hash.hex())


texts: Cannot sign a message with web3js (invalid from address)

texts: So I am trying to create a signature of a string, but I cannot do that, as I always get error stating MetaMask - RPC Error: Error: WalletMiddleware - Invalid "from" address. (code: -32603). I am creating a message with window.web3.eth.sign(hash, userAddress) function, where user address is response of window.ethereum.enable() function.


texts: exchange Eth to Fund(real cash), then..?

texts:
I'm just learning Ethereum, and I have two questions.

Is the total number of ethers capped in the main Network? I mean, there are 10,000,000 ethers, for example, in the network, and all currencies are rotating with transactions. Am I right...?
If I exchanged 5 ethers to the cash(fund), where the ethers has gone,,? who got the ethers that I exchanged..?

I am not sure I understand exactly the concept of Ethereum,, but I am just curious..


texts:
I was searching on how to convert a uint to bytes in Solidity and found this answer.

function toBytes(uint256 x) returns (bytes b) {
    b = new bytes(32);
    assembly { mstore(add(b, 32), x) }
}

From the docs mstore(p, v) is mem[p..(p+32)] := v

Which means mstore(add(b, 32), x) translates to mem[(b+32)..(b+64)] := x

What did I understand wrong here? Surely b is 32 bytes and the value of x should be copied inside b not right after it.

Thanks


texts: Invalid device symbol on CUDA (ubuntu 20.04 ethminer)

texts:
I'm mining on ubuntu 20.04 with an Nvidia rtx 2060 6gb. The miner was working about 2 weeks ago on 18.04 but broke recently.
I thought switching to a newer version of ubuntu would help, but I get the same error: Unexpected error CUDA error in func set_constants at line 125 invalid device symbol on CUDA device 01:00.0.
Can someone tell me what this means or how to fix this?
When I looked for it on the internet, the problem only occurred for people using rtx 3060 not 2060. My cuda version is 11.3, and I tried to downgrade to 8 or 9 but couldn't because 20.04 does not really support it.
I'm assuming my cuda version is the issue, but any other suggestions might help.


texts: How lost bids on ENS are credited back to my wallet ? Is it automatic or is there any manual process?

texts: I have lost few bids on ENS and so far the ethers that I have used for auction is not credited back. So I would like to know if there is any process to get back the ether or is this an automated process


texts: What is the current distribution of ERC Token Standards in the top 100-1000 most active token contracts?

texts:
From ERC 677

  Motivation
  ERC20 requires a multistep process for tokens to be transferred to a contract. First approvemust be called on the token contract, enabling the contract to withdraw the tokens. Next, the contract needs to be informed that it has been approved to withdraw tokens. Finally, the contract has to actually withdraw the tokens, and run any code related to receiving tokens. This process typically takes two to three steps, which is inefficient and a poor user experience.

There have been other proposed solutions to this problem, including: ERC 223 and ERC 777.

This leads the motivation for my question.

Presumably, there are active token contracts that implement any one of these token standards including ERC 20.  I want to create a single PaymentReceiver contract that can handle all of these standards and will then call my other contracts on paymentRecieved(address payer, address token, uint amount, bytes data);.

What is the best way to achieve my goal? Is it worth it to support all of the token standards? Can someone point me to contract that already does this?

Thanks


texts:
Each non leaf node of a Merkle tree is just the hash of the
  concatenation of it's children.

Does this literally mean stick the 2 hashes together or is there a more intricate process involved?

i.e.

Cat(hash1,hash2) => Cat(b5e187f15f1a250e51a7856..,e29ccfc0a7f48e06d19ce02..) =>

Output: b5e187f15f1a250e51a7856..e29ccfc0a7f48e06d19ce02

Cannot find description of this process anywhere! Thanks

ref: https://en.wikipedia.org/wiki/Merkle_tree


texts: Ethereum upgrades to 1.8.20 sync data, data compression causes synchronous data to stop

texts:
The following situation occurs in the log during the Ethereum synchronization process.

 INFO [12-24|14:14:24.470] Imported new chain segment               blocks=39 txs=5439  mgas=265.638 elapsed=8.072s    mgasps=32.905 number=5094982 hash=f4584c…a81f3a age=10mo1w4d  cache=0.00B
 INFO [12-24|14:14:32.712] Imported new chain segment               blocks=40 txs=6200  mgas=304.909 elapsed=8.242s    mgasps=36.994 number=5095022 hash=dff296…d2db97 age=10mo1w4d  cache=0.00B
 WARN [12-24|14:14:41.858] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:15:42.133] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:16:42.197] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:17:42.788] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:18:43.037] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:19:43.461] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:20:43.906] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:21:44.201] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:22:44.668] Database compacting, degraded performance database=/data/eth_data/geth/chaindata
 WARN [12-24|14:23:45.280] Database compacting, degraded performance database=/data/eth_data/geth/chaindata

Geth version

 Geth/v1.8.20-stable-24d727b6/linux-amd64/go1.11.2

The 1.7.x version did not happen like this
If this happens, continuing to synchronize for a while after reboot will still result in data compression.
A similar problem on github also seems to be unresolved, seeing someone replying to version 1.8.11 after about 3.5 days of compression, starting normal synchronization
I hope to get help, thanks to everyone who responded


texts: Remix IDE: Cannot create an account: Not running in personal mode

texts:
I'm trying to create an account from Remix IDE on remix.ethereum.org. When I try to create an account it gives me an error

Cannot create an account: Not running in personal mode

What does this mean? How to correct this?


texts: Research/projects on trust in smart contracts

texts:
In this previous question, it is discussed how one can trust a smart contract. If you assume smart contracts are autonomous agents, then certain parts of this trust are enforced by the Ethereum platform: cryptographic measures (identities, message signing etc.) and consensus (valid transactions etc.).

In multi-agent systems, computational models of trust and reputation exist. I was wondering if there is any research or project done on how to implement computational trust in smart contracts. More specifically, how could another entity (human or agent) trust the application code of smart contracts in a computational fashion.


texts:
i'm newbie in this topic and  i have so many doubts about dapps:

Can Dapps run on the browser? I've just seen dapps wich should be installed, and i think this is a big obstacle to reach normal users, even to solve real life problems and revenue.

-Is there someone solving a real life problem with a Dapp and getting revenue for that? ie: social network, ecommerce platform, etc...

Can you provide me a url of a tutorial to develop?

Thanks.


texts: What is ether? How is it different from other tokens such as bitcoin?

texts: What is ether? How does it differ from past tokens such as bitcoin and litecoin? What are all the usages of ether?


texts: Is it secure to call function without any encryption?

texts:
I mean, if I have a contract with function like:

string current_password;
function set_password(string password, string new_password) {
    if (password == current_password) {
        current_password = password;
    }
}

Is it ok to call set_password just as it is, without any ecryption? I'm asking because in my understanding every miner node, which receiveing this transaction is able to read all the data, so it's pretty dangerous to use this code.

And if I'm right, how can I prevent this? Maybe there are some techniques or patterns of secure contract development?


texts: Need to use function modifiers however little confuse when implement and how

texts:
Hi I need help for writing below auction code.
I want to use modifier however there is some changes in solidity which make me confuse.

I have mentioned below where I need changes within "//"

pragma solidity^0.4.18;

import './AuctionHouse.sol';

contract BidChain is AuctionHouse {

struct biddingData {
    uint endTime;
    uint highestBid;
    address bidder;
    bool initialized;
    mapping (address => bool) flaggedUsers;
}

mapping (uint => biddingData) itemToBiddingMap;

event newBidPlaced(uint itemId, uint bidAmount, address bidder);

//1. add itemOwner modifier
function initiateBid(uint _itemId, uint _endTime) public {
    //2. refactor
    require(msg.sender == itemToOwnerMapping[_itemId]);
    itemToBiddingMap[_itemId] = biddingData(_endTime, 0, msg.sender,
 true);
}//1. add itemOwner modifier
function initiateBid(uint _itemId, uint _endTime) public {
    //2. refactor
    require(msg.sender == itemToOwnerMapping[_itemId]);
    itemToBiddingMap[_itemId] = biddingData(_endTime, 0, msg.sender, true);
}

//3. add itemOwner modifier
function flagUser(uint _itemId, address _flaggedUser) public {
    //4. refactor
    require(msg.sender == itemToOwnerMapping[_itemId]);
    require(itemToBiddingMap[_itemId].initialized == true);
    itemToBiddingMap[_itemId].flaggedUsers[_flaggedUser] = true;
}

function placeBid(uint _itemId) public payable {
    require(now < itemToBiddingMap[_itemId].endTime);
    require(msg.value > itemToBiddingMap[_itemId].highestBid);

    returnBidAmount(itemToBiddingMap[_itemId].bidder, itemToBiddingMap[_itemId].highestBid);

    itemToBiddingMap[_itemId].highestBid = msg.value;
    itemToBiddingMap[_itemId].bidder = msg.sender;

    emit newBidPlaced(_itemId, msg.value, msg.sender);
}

function returnBidAmount(address _sendee, uint _amount) internal {
    _sendee.transfer(_amount);
}

//5. add itemOwner modifier
function transferItem(uint _itemId, address _newOwner) public {
    //6. refactor
    require(msg.sender == itemToOwnerMapping[_itemId]);
    require(now > itemToBiddingMap[_itemId].endTime);

    itemToOwnerMapping[_itemId] = _newOwner;
    ownerToItemCount[_newOwner]++;
    ownerToItemCount[msg.sender]--;

    msg.sender.transfer(itemToBiddingMap[_itemId].highestBid);
}

//We already moved this modifier here for you
modifier itemOwner(uint _itemId) {
    require(msg.sender == itemToOwnerMapping[_itemId]);
    _;
   }
}


texts: Sending ETH from Mist on testnet does not show up in Metamask account

texts:
I am doing some test with Mist on the testnet. I am trying to send some ETH to my Metamask account (0xffC6b55a3CaB36D9E7079F8C5dEAfe10e7Ede953) on Ropsten but it never arrives. Here is the transaction in Mist:

The transaction is also not visible at https://ropsten.etherscan.io/tx/0x888d8d0eca7769a4d5f48d37f6fc4fa102abd1dee13ab2ef00ea28b797ee2061

Or any of the other testnets. Any suggestions much appreciated.


texts: Changing geth cache while geth is running

texts:
I removed chaindata db by doing "geth removedb" and am doing a fresh download of the blockchain. I allocated 2048 MB of RAM to my geth sync by submitting "geth --syncmode 'fast' --cache=2048 console". After running that for a few minutes, I opened my Mist briefly and then closed it (don't know why I did that, but I did) and after a few hours, my geth RAM allocation is now up to 4 GB...did my opening of Mist accidentally double the geth RAM allocation in downloading the blockchain?

My geth version is:

Geth
Version: 1.6.1-stable
Git Commit: 021c3c281629baf2eae967dc2f0a7532ddfdc1fb
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.8.1
Operating System: linux
GOPATH=
GOROOT=/usr/lib/go-1.8

Also, my Mist wallet is the most up to date version as currently seen on github today.


texts: How to get curl response from remote geth through ssh?

texts:
My geth node is located in a remote machine (running on Ubuntu). The safe connection is provided by SSH protocol. Now I am trying use JSON RPC API.
So, the command geth --rpc returns response like this: HTTP endpoint opened: http://localhost:8545 Listening on [::]:30303 ...
Next I send the first JSON-RPC request. For example, curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67} http://localhost:8545'
However my client get the same command from server, without any response.
Why can this behaviour occur?


texts: How can i create an enum in a vyper file

texts:
Is there a way to create an enum in a vyper file ?
I have tried this:
from enum import Enum

But it does not work
Any idea ?
Thanks


texts: Asset Tokenization: How to issue security tokens for different companies and trade them on the same exchange market?

texts:
Premise: I’m still learning here so I apologize if my question is too basic.

Let's suppose that someone is developing a digital market for equity shares using blockchain (because it could save huge costs to the whole banking industry by removing the need for big Back-office departments).

Question #1: The equity shares would (probably) be represented by ERC-20 token contracts on the Ethereum blockchain, right?

Question #1.1: ERC-721 (Non-Fungible Tokens) cannot be used because one equity token is fungible with another equity token issued by the same company, right?

Question #2: Using ERC-20, would the tokens issued by each different company have a different name and symbol?
For instance, Apple tokens would be "AAPL", Google tokens would be "GOOGL", Coca-Cola tokens would be "KO" and so on... Right?

Question #3: If indeed each company has a different token, how does a user on a block explorer or other trading platform know that AAPL, GOOGL, KO all represent equity shares in some company and not some cryptocurrency or some utility token? In other terms, how do I know that AAPL, GOOGL and KO belong to the same asset class?

Question #4: If I'm correct (that it's not possible to distinguish different types of tokens on a same block explorer), then does it mean that a separate platform needs to be created for the exclusive trade of AAPL, GOOGL, KO and other equity tokens?


texts:
I've got a Smart Contract that works perfectly when deployed to localhost: 8545 (using Ganache) with my Web3 Dapp. But when I put it on Rinkeby, I'm running into problems,.

The Contract is super-simple: all it does is let you Set and Get the value uint variable x:

pragma solidity ^0.4.16;

contract Incrementor {

    uint x;

    constructor() public {
       // Give x in initial value of 10:
       x = 10;
    }

    function getX() external view returns (uint xValue) {
        return (x);
    }

    function incrementX(uint byThisMuch) public {
        x += byThisMuch;
    }

}

After running it successfully on localhost: 8545 I've now deployed it to the Rinkeby TestNet (via Remix) and am using Infura to connect to it - but I'm suddenly experiencing inconsistent behavior there. Specifically, my getX() function works, but my setter incrementX() function gives me errors:

Its basically not picking my address.

NOTE: this problem has been happening even BEFORE the Nov. 6 2018 Metamask update

Here's how I'm setting up Web3 in my HTML:

if(typeof(web3) !== 'undefined') {
            console.log("Web3 provider found! Current Provider is WORKING!");
            web3 = new Web3(web3.currentProvider);
        }
        else {
            console.log("1. NO Web3 provider found!  Gonna set one up...");

            // Connect to Infura:
            web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/v3/<MY API KEY"));

            // Or use this when connecting to `localhost`:
            // web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

            console.log("2. OK, NOW we DO have a PROVIDER --> HttpProvider = ", web3.providers.HttpProvider);

            web3.eth.defaultAccount = web3.eth.accounts;
            console.log("3. ALL ACCOUNT - web3.eth.accounts = ", web3.eth.accounts);
            console.log("4. web3.eth.defaultAccount = ", web3.eth.defaultAccount);

            // Also tried with 'getAccounts' (same as `.accounts` - but asynchronous)
            console.log("5. web3.eth.getAccounts() ==> ", web3.eth.getAccounts());

            web3.eth.getAccounts(function(error, result) {
                if(error != null)
                    console.log("7. Error! ", error);
                else
                    console.log("7. Result = ", result);
            });

            console.log("Exiting the WEB3 JAM!");

        };

Again, refer to console log above to see what's happening.

What's strange is that I am definitely connecting and talking to the Smart Contract on Rinkeby - and I know this because my getX() button-click action is returning the right values:

But when I try to set it - that's when I get that error.

Really, its more about the fact that my address keeps coming back as undefined - which I think is the real issue here:

And here's a quick screen grab of what the App's interface looks like:


texts:
I'm trying to catch up with Ethereum 2.0, but Vitalik's keynote at devcon4 confused me. Is that keynote an official update?
If it's official, Casper FFG will no longer be implemented, correct?

I don't know where I can get an official, like formal, update on things about Ethereum.

Thanks.


texts: How get private key or password from my keystore

texts:
I had wallet from 2016, but i'm forget password login by keystore.
Current i just had keystore, how i can get private key or password keystore?

Thank so much


texts:
Running geth --exec starts an interpreter. It allows to run geth console commands.
I want to load a javascript function that runs continuously in background in geth. It basically continuously looks for pending transactions and if found, it mines them else doesn't mine continuously (empty blocks unnecessarily).

Currently, I have to manually mine every time and stop mining.

geth --jspath "/root/files/js" --exec 'eth.mining;loadScript("mine_pending_transactions.js");eth.mining;' --datadir=/root/.ethereum/devchain attach

However, I don't want to mine this manually. In order to automate this, I want to load the script and mine it, as if it's a something like background command that runs in the geth console interpreter.

but I learnt from this Stack-overflow post - (Executing custom javascript snippets through non-interactive console) that one needs to access the same interpreter.

Is there a way to do that? Even in case of non-interactive console?
Couldn't find anything on official Ethereum documentation.


texts: Reformatting contract to one line for solc: really necessary?

texts:
https://github.com/ethereum/go-ethereum/wiki/Contract-Tutorial#compiling-your-contract

Is that really necessary? Is there no option such that the compiler can do this itself at compiletime?


texts: How to check if a mapping has not been written yet?

texts:
I have this mapping:

mapping (uint256 => string ) private storedData;

I am trying to do this:

modifier dataNotStored(uint256 _index) {
        require( keccak256(abi.encodePacked(storedData[_index])) == keccak256(abi.encodePacked('')) );
        _;
    }

    function set(uint _index, string calldata _data_to_store) external dataNotStored(_index) {
        storedData[_index] = _data_to_store;
    }

My goal is to allow only one write for each entry of the mapping.

I think it is working, because from Remix IDE I get error only when trying a rewrite.

Is there a more efficient and intelligent way to avoid to overwrite a mapping?


texts: How to call Library Function from a Contract? => [error] The contract code couldn't be stored, please check your gas amount. undefined

texts:
When I compiled following code at "https://ethereum.github.io/browser-solidity/" it gives me two Web3 deploy code for:

var libraryContract  = web3.eth.contract(...); //Web3 deploy code
var contractContract = web3.eth.contract(...); //Web3 deploy code

Then I have copy paste Web3 deploy code for (libraryContract, contractContract) into geth in order to mine my contracts.

My code (I have trimmed most of it for simplicity):

library Library {
    function func () constant returns (uint8) {
        return 5;
    }
}

contract Contract {
    uint8 value;
    function call_library_function () {
        value = Library.func();
    }
}

"Library"'s Web3 deploy code mines perfectly fine,
but when I try to mine "Contract"'s Web3 deploy code, I get the following error:

> Error: The contract code couldn't be stored, please check your gas amount. undefined

If I remove the following line from my Contract Link code, newly generated "Contract"'s Web3 deploy code mines! without any problem:

value = Library.func();

[Q] My question is, how could I fix this problem I am having? What should I do to call my function inside a Library from a Contract, which will allow me to mine it?

How I did setup my private Ethereum Blockchain:
Please see on the following link:
How could I update default homesteadBlock value on my private Ethereum blockchain?

Thank you for your valuable help and time.


texts: How do I send an arbitrary message to an ethereum address?

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


texts: how to reach consensus berween only 2 peers?

texts:
Can consensus take place between only 2 peers?

Scenario:
I am a patient who is visiting a doctor and all the communication/transaction between the both of us happen via a blockchain based app. So the transaction at that time would mainly be about my diagnosis, medicines prescribed and so on. And before this data gets committed on the ledger it needs to get validated via a consensus algorithm. So how would consensus take place in such a scenario.

All the suggestions/helps/comments are appreciated and welcome.
Thanks!


texts:
i hope that you are doing well!
I wanna build an Blockchain interoperability approach based on side chain and i don't know how to start, so if someone can help me please don't hesitate to text me i really appreciate your helps.


texts: Storage vs Memory in the context of Gas Cost

texts:
I have two snippets -- one using memory, the other referencing storage:

function winnerName() public view
            returns (string memory winnerName_)
    {

        string memory winnerName_ = proposals[0].name;
    }

function winnerName() public view
            returns (string memory winnerName_)
    {

        string storage winnerName_ = proposals[0].name;
    }

The gas used for executing both snippets is the same (as per ganache). This seems surprising to me, given that memory creates a copy and thus is more expensive.
Is this an optimization under the hood? I've used truffle compile to compile the contract.


texts: Calling web3 in front end layer or back end layer?

texts:
I'm building a Dapp using NodeJS and Express with ejs files. I wonder should I call web3 API in the Backend JS file or front end EJS/HTML files?

Some thoughts I have is:

calling web3 api in backend is more easy to control, but the problem is when the code is executing concurrently, it is possible that some blocks has not been mined and the future function is already being called which requires the previous function to be completed first.
calling web3 api in front end EJS file would be a little complicated since I need to pass the contract and account addresses and require all the ethereum modules at front end.

I'm new to Dapp development, please correct me if I'm wrong and please give me some advices or examples.

Thanks


texts:
I have seen the phrase "Epoch Switch" when looking at an open source mining pool program.  Just wondering what the term refers to.

It would also be nice to know how a mining pool can calculate when it will take place?


texts:
So I started using geth with --fast and it is still syncing (after more then 12 hours). Is there a way to make it happen faster?

I have tried light before, the same happened but it stopped it after 6 hours.

Regards

NB: I have a 2 Mbps internet.


texts: _transferFrom vs. _burnFrom order of operations (Zeppelin ERC20burnable.sol)

texts:
I have question, more for my understanding than anything.
Here’s the transferFrom function in the ERC20 standard:
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
       _transfer(sender, recipient, amount);
       _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, “ERC20: transfer amount exceeds allowance”));
       return true;
}

Shouldn’t it be:
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
       uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, “ERC20: burn amount exceeds allowance”);

       _transfer(sender, recipient, amount);
       _approve(sender, _msgSender(), decreasedAllowance );
       return true;
}

(or even calling _approve before the _transfer)
So that the 1st line triggers the condition (SafeMath) that the msg.sender has enough allowance.
??
I also looked at the burnFrom function and it’s implemented with the decreasedAllowance 1st, then approve, then _burn.
I wonder why it’s not the case for transferFrom. (gas limits?)
function burnFrom(address account, uint256 amount) public virtual {
       uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance");

       _approve(account, _msgSender(), decreasedAllowance);
       _burn(account, amount);
}

Thanks for your explanations!


texts:
When I start ganache-cli in one terminal window and run ./node_modules/.bin/solidity-coverage (command from documentation) in another I get

  Error: Exceeds block gas limit
      at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-core/~/truffle-migrate/index.js:225:1
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
      at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
      at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
      at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
      at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
      at IncomingMessage. (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
      at emitNone (events.js:111:20)
      at IncomingMessage.emit (events.js:208:7)
      at endReadableNT (_stream_readable.js:1064:12)
      at _combinedTickCallback (internal/process/next_tick.js:138:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)

I even deleted all tests and contracts and I still receive this error. truffle test and truffle migrate works. Any help appreciated

Here my truffle.js exports

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*",
      gas: 6700000
    },
    coverage: {
      host: "localhost",
      network_id: "*",
      port: 8545,         // <-- If you change this, also set the port option in .solcover.js.
      gas: 0xfffffffffff, // <-- Use this high gas value
      gasPrice: 0x01      // <-- Use this low gas price
    }
  }
};

and my .solcover.js

module.exports = {
    port: 8545,
    norpc: true,
    skipFiles: ['contracts/Migrations.sol'],
    copyPackages: ['zeppelin-solidity']
}


texts: Receive ERC20 tokens on ethereum, for example, Parity wallet

texts: I'm new to ethereum, but as I see ERC20 tokens use the same blockchain as the main currency ETH. What will happen in case I send ERC20 complaint token to some ether wallet? I will "receive" them, but not as ETH... For example this transaction: https://etherscan.io/tx/0x42f7a2f62ef2f229b0d34fae09a89587c9a5e41c4283e13bb842170b956c483c OmiseGo to my parity wallet. It appears as 0 ETH, but how can I guess that OmiseGo was received via JSON RPC or some other method in my wallet?


texts:
I want to develop a method in a smart contract that act as a listener,
what i mean is when i use eth.sendTransaction(from:, to:@ of smart contract) it will be executed, without calling any smart contract's methods, thank you


texts: Where the constructor is invoked when sending a transaction with no 'to' field?

texts:
I understand it's possible to create a contract with a "no to field" transaction.
I suppose all the byte code was send to this special contract. But how and where the constructor was called ?

Where I can find a documentation to use the "no to field" contract ?


texts: Transaction dropped and replaced in etherscan

texts:
I have transfered my ETH to my friend and the transaction status shows as "Dropped & Replaced" in etherscan, but it's still pending:
https://etherscan.io/tx/0x9d60ea69e3796607cc52e50a680051fb5d54abd5657d441d0bccdfe8a3935180
So basically my wallet is stuck. Is there something I can do about it?


texts:
So I want to get the token holders of a token like this: https://ropsten.etherscan.io/token/0xfa68d281e7ff1a8e9393428ba0abe8961cf342cb#balances

Via my Ethereum node. I tried: https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-events but it returns empty.

What method / function do I use to get all the token holders of a specific token?


texts: How do I implement a Fee/Recall function on Uniswap trades?

texts:
Please note this is a second attempt because this previous question had some mistakes!
We want to have a fee/recall function on Uniswap trades that takes a percentage of the token, not the price of the token, and returns it to the admin address.
For example, someone buys 100 of our token on Uniswap. At a 3% fee/recall, 3 of these tokens would be sent to our admin wallet.
Would this be possible in the token smart contract, would we need to create this functionality in a new contract, or would we need to speak to Uniswap?
Thanks!


texts:
I am about to start designing a smart contract intended to be the backbone of a platform in the finance domain.

My question is what are the challenges and problems that I may face or have to deal with when designing the contract, other than the business ones ?


texts:
pragma solidity ^0.6.6;

import "./newERC20Interface.sol";  //ERC20 interface

  contract timeLock2 {
      mapping(address => uint256) _balances;
      event Transfer(address, uint256);

      newERC20Interface token;
      address receiver = 0xAdB2cbbAb6764643ec15789F8428d5cD9510342b;
      uint256 amountToSend = 100;
      uint256 relaseTime = 1589180400;

      function releseToken() public {
          require(msg.sender == receiver);
          require(now >= relaseTime);

          msg.sender.transfer(amountToSend);
          emit Transfer(msg.sender, amountToSend);

      }
      function balanceOf(address account) public view returns(uint256){
         return _balances[account];
      }
  }

how to lock 100 tokens for next 30 minutes and send automatically


texts: Sound but incorrect change in Merkle-tree

texts:
From the whitepaper, The first step in in verifying block validity is:

  Check if the previous block referenced by the block exists and is valid.

With regard to a merkle tree propogating change upwards upon a change in any of the comprised notes:

  The reason why this works is that hashes propagate upward: if a
  malicious user attempts to swap in a fake transaction into the bottom
  of a Merkle tree, this change will cause a change in the node above,
  and then a change in the node above that, finally changing the root of
  the tree and therefore the hash of the block, causing the protocol to
  register it as a completely different block (almost certainly with an
  invalid proof of work).

Would it not be possible to make a change in the merkle tree such that the present block being verified does not change and hence, is Valid.


texts: Truffle Dapp only works when I first use `truffle migrate --reset`

texts:
When I first load my Dapp with testrpc the functionality doesn't work until I use the command truffle migrate --reset

Any ideas why?


texts: Any reputable Smart Contract peer review services out there?

texts:
I was wondering if anyone had any reputable organization that would perform a peer review of a smart contract?

Thank you in advance!


texts: Assigning variables to multiple fields in a structure

texts:
As asked in this question for C,
https://www.linuxquestions.org/questions/programming-9/assigning-variables-to-multiple-fields-in-a-structure-is-tiresome-897337/, is it possible to assign variables to multiple fields in a structure, without referencing the structure for each variable? Something like
struct Foo {
   uint   x;
   uint   y;
   uint   z;
}

Foo foo;

foo = { .x = 2, .z = 12 }

Edit: the post I referenced seems to be about initializing structs, I'm asking more about updating multiple variables at once. When this is convenient, here is an example:
mapping(uint => Data) data;

function schedule() returns (uint);

and then
data[schedule()].x = ;
data[schedule()].z = ;
data[schedule()].otherRandomThing = ;
data[schedule()].foo = ;
data[schedule()].lala = ;

vs
data[schedule()] =
{
x: ,
z: ,
otherRandomThing: ,
foo: ,
lala:
}

I'm all for that its a dumb question, don't really care, my code is more readable if I don't have to write data[schedule()] in front of every variable I update, and that's what I care about here. The question on calling functions in contexts I asked earlier is obviously related to this, as it is another approach to increase readability.


texts: Relationship between Ethereum block and Whisper

texts: When a message is sent to another node with a whisper, it is immediately visible regardless of the block. If so, does the block have a record of using whisper?


texts: Uncaught TypeError: Cannot read property 'fromWei' of undefined, working good in one tab and failing in another tab

texts: I'm getting this error when I'm trying to convert Wei to Ether using the code window.web3.utils.fromWei("200000",'ether'). This error shows only on the single page and when I console.log in the same window it shows the same error. But when I'm console.log in other windows it is working fine. Please find below screenshots for both.


texts: Calling "balanceOf" in a contract from another contract that imports it. Expected 1 Got 0

texts:
I have an ERC20 contract that calls BalanceOf in a ERC721 contract;
In my ERC20 contract;
import "./NFT.sol";

    contract ERC20 {

     NFT public nft;

     constructor (NFT _nftAddress) public {
      nft = _nftAddress;
    }
    function getNFTBalance(address _nftOwner) public view returns (uint256 result){
           nft.balanceOf(_nftOwner);
           return result;
       }

I'm using the ERC721PresetMinterPauserAutoId from OpenZeppelin
My NFT contract import ERC21.sol
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

In the ERC721.sol the BalanceOf function;
function balanceOf(address owner) public view override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");

        return _holderTokens[owner].length();
    }

This is how I pass the contract address on deployment in 2_deploy_contracts.js
module.exports = async function(deployer) {
  // deploying the ERC20 Token
  const accounts = await web3.eth.getAccounts();

  await deployer.deploy(Token);

  // deploying the NFT
  const NFT_NAME = "ID Exclusivity Token";
  const NFT_SYMBOL = "IDET";
  const NFT_API = "https://example.com/nft/api/token/"

  await deployer.deploy(NFT, NFT_NAME, NFT_SYMBOL, NFT_API)

  .then( async () => {
    nftContractAddress = NFT.address;
    console.log('NFT ADDRESS : ',nftContractAddress)
    const feeAccount = accounts[0];
    const feePercent = 10;
    //Deploying Exchange with the NFT address
    await deployer.deploy(Exchange, nftContractAddress, feeAccount, feePercent);
  })
};

I can confirm that the address is the right one with the console log.
Once deployed, in truffle console:
nft = await NFT.deployed()

await nft.mint("0x851ffbF315d9d32E8DBE75b10B1E0b8C030320cf")

exchange = await Exchange.deployed()

await exchange.getNFTBalance("0x851ffbF315d9d32E8DBE75b10B1E0b8C030320cf") // return 0

await nft.balanceOf("0x851ffbF315d9d32E8DBE75b10B1E0b8C030320cf") // return 1


texts: What is best practice for adding a fee to charge for a function call?

texts:
I am trying to create a function that charges a user for calling the function. I came across an old example here and I am wondering what the currenct best practice is?
Add a transaction fee for each time a function is called
I have a modifier and a simplified function as shown below but it doesn't seem to charge a fee when I test it through metamask and check on etherscan, the transaction goes through normally but without the 0.02 eth fee. Is there something I am missing here?

    modifier requiresFee(uint fee) {
        require(msg.value == fee);
        _ ;
    }

    function simple() requiresFee(0.02 ether) payable external {

      owner.call.value(0.02 ether).gas(20317)("");

     // other parts of the function

    }

Thank you


texts: Is it still possible to reach call stack depth 1024?

texts:
In the past it was possible to reach call stack depth 1024 in EVM. However I heard that now it is impossible due to gas costs.

Is this true?


texts:
Hey so I have been just messing around with truffle and I keep getting an out of gas error when I test out the commands after a certain point. Even if I uninstall and reinstall testrpc, the problem persists.

I apologize for the code formatting issues.

Keep in mind, all I want to do is just have unlimited gas in my test environment.

here is my code `

  contract Organization {

 struct Proposal {
   uint code;
   uint amount;
  string description;
  uint numberOfVotes;
  string name;
}

Proposal[] public proposals;
uint public numberOfProposals;

 event ProposalAdded(uint code, uint amount, string description, int
 numberOfVotes , string name);

 function addProposal(uint amount, string description , string name)
 returns (uint) {

proposals.push(Proposal(numberOfProposals,amount,description,0,name));
ProposalAdded(numberOfProposals,amount,description, 0, name);
numberOfProposals++;
return numberOfProposals;

}

 function proposalExists (uint code) returns (bool) {
   for(uint i = 0; i < proposals.length; i++) {
     if (proposals[i].code == code) {
        return true;
      }
    }
     return false;
 }

function numOfProposals() returns (uint){
    return numberOfProposals;
  }

function getProposalName(uint index) returns (string){
    return proposals[index].name;
}

function getProposalDescription(uint index) returns (string){
    return proposals[index].description;
}

function getProposalIndex(string name) returns (uint){
  for(uint i = 0; i < proposals.length; i++) {
      bytes memory a = bytes(proposals[i].name);
      bytes memory b = bytes(name);
    if (a.length == b.length) {
        return i;
    }
  }
  return 1000000;
}

function voteFotProposal(uint index) {
    proposals[index].numberOfVotes++;
  }

function getProposalVotesIndex(uint index) {
    proposals[index].numberOfVotes;
  }

struct Memmber {
  uint id;
  string name;
}

struct Commitee {
  uint id;
  string name;
  string missionStatement;
  uint balance;
  string [] memmbers;
}

event MemmberAdded(uint id, string name);
event CommiteeCreated(string name,string missionStatement );

string [] public memmbersArray;
string[] public comitees;
uint public numOfComitees = 0;
uint public numOfTotalMemmbers = 0;
Commitee [] fullComitees;

  function convertMemmberStrings (bytes32 [] values) internal returns
  (string []){

        for(uint i=0;i<values.length;i++){
            MemmberAdded(numOfTotalMemmbers,
            bytes32ToString(values[i]));
            memmbersArray.push(bytes32ToString(values[i]));
            numOfTotalMemmbers++;
    }
    return memmbersArray;
}

function addCommitee
(string name, string missionStatement , uint funds, bytes32 [] values)
returns (string)
{
  comitees.push(name);
  CommiteeCreated(name,missionStatement );
  fullComitees.push(Commitee(numOfComitees, name, missionStatement, funds, convertMemmberStrings(values)));
  numOfComitees++;
  return name;
}

function getComitees (uint index) returns (string){
  return comitees[index];
}

function numberOfCommitees () returns (uint){
  return numOfComitees;
}

 function bytes32ToString(bytes32 x) constant returns (string) {
    bytes memory bytesString = new bytes(32);
    uint charCount = 0;
    for (uint j = 0; j < 32; j++) {
      byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
      if (char != 0) {
        bytesString[charCount] = char;
        charCount++;
     }
 }
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
    bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}

 function uintToBytes(uint v) constant returns (bytes32 ret) {
    if (v == 0) {
      ret = '0';
   }
   else {
    while (v > 0) {
        ret = bytes32(uint(ret) / (2 ** 8));
        ret |= bytes32(((v % 10) + 48) * 2 ** (8 * 31));
        v /= 10;
    }
 }
 return ret;
}

}

`


texts: My Ethereum Solidity automatically connects to parity, how do I switch it to Metamask?

texts: I want to run on a test network using metamask but Solidity IDE auto connects to my real parity wallet. How can I switch that?


texts:
I was trying to migrate a contract in windows, I am getting the following pop-up message.

I already installed truffle node module.


texts: ENS Reveal execution error from MyEtherWallet

texts:
good day!  I have experienced execution errors from revealing the ENS bids.  I've tried two different bids, and the error occurs to both bids. I use Trezor vis MEW btw.  Is there anything that I'm missing?

Many thanks!!


texts: What is the most efficient way to read ERC20 balances without knowing the tokens that the address might hold?

texts:
There are plenty of examples of reading the balance of an ERC20 token from an address via a balanceOf.call when knowing the token contract address beforehand. However, how would one go about reading the balance of an address without knowing which tokens the address might hold?

For example, a user wishes to know the total balance (ETH + tokens) of his address. What would be the most efficient way of retrieving this information without doing any unnecessary calculations?

Should I just loop through an array of the most popular token contract addresses? Look at the incoming token transfer events? or are there more efficient ways?

Just to specify, I am looking for a solution with a private node not an API.

Examples of pages that have achieved this:

https://etherscan.io/
https://ethplorer.io/
https://qwallet.io/

Any help would be greatly appreciated!


texts: What are the popular API to get current exchange rates for Ethereum to USD

texts:
Can you please list all the API providers for cryptocurrency to USD

Thanks in advance.


texts: "Gas estimation failed" on Ropsten with Invalid RPC JSON

texts:
I'm running into an issue going through a basic example in "Mastering Ethereum"...

I have a Faucet contract (on Ropsten) per the book that looks like...

pragma solidity ^0.5.1; //mastering ethereum uses ^0.4.19;

//our first contract is a faucet!
contract Faucet {

    //give out ether to anyone who asks
    function withdraw(uint withdraw_amount) public {

        //limit withdrawal amount
        require(withdraw_amount <= 100000000000000000);

        //send the amount to the address that requested it
        msg.sender.transfer(withdraw_amount);

    }

    //accept any incoming amount
    function () payable external {}
}

I can deposit funds using MetaMask but when I use Remix to withdraw I see this message...

"Gas estimation failed
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
gas required exceeds allowance or always failing transaction"

Then if I force Remix to send the transaction anyway, the debugger only gives me:

Debugger: Invalid JSON RPC response: ""

Any ideas how to troubleshoot this further?  I have enough ETH in MetaMask to afford the gas so I'm guessing that perhaps the withdraw function I'm using is outdated in some way and needs to return a value?


texts: How to sweep Ether from multiple private keys at one go?


texts:
is it possible for 2 owners to own an NFT but one of them will have 70% and the other 30% for example, or the ownership has to be equally given?
thanks


texts: How to connect to testrpc from another machine local network?

texts:
I have a testrpc running on a machine but I want to connect the Remix IDE to it which is on another machine. I can connect to the testrpc with Remix IDE if both are on the same machine.
Tried with adding "-h 0.0.0.0" parameter while initiating testrpc or same combination with machine's IP address but no success yet.

Can someone please help me on how to start testrpc server on a machine so that I can connect to it from another machine running remix IDE on the same network.

Also I tried to forward the 8545 port from the testrpc machine using ngrok and adding https ngrok address for Web3 provider in other machine's remix IDE result in success. Any way without using the ngrok as the machines are on same network and I don't want to expose the 8545 port to the world unnecessarily.


texts: GETH node maxpeers performance and benefit

texts:
I'm trying to optimize my node for transaction propagation speed.
Expanding on this question:
Can we improve the performance of Geth server by setting maxpeers to 0?
Are there any data available regarding transactions propagation speed and number of peers?  I've read a number of times to use "reasonable" amount of peers.  What is "reasonable"?
Thanks


texts: Detecting an existing account: coinbase or getAccounts?

texts:
When detecting web3 or even an existing node, one typically needs to detect an account - which also gives an indication if the account needs to be unlocked.

Should the check for an account be a lookup for accounts[0] from getAccounts or the coinbase property?

I believe the ordering of accounts is based on the name and that it is possible that coinbase != accounts[0] if running a private node?

So which would be better, particularly for MetaMask?
Does it matter?

Thanks


texts: Truffle develop freezing. Trying to check variable values

texts:
truffle-config.js

module.exports = {
    compilers: {
      solc: {
        version: "^0.6.0"
      }
    },
    networks: {
        development: {
            host: "127.0.0.1",
            port: 8545,
            network_id: "*" // Any network
        },
        develop: {
          host: "127.0.0.1",
          port: 8545,
          network_id: "*" // Any network
      }
}

ganche-cli

Listening on 127.0.0.1:8545

Yet when I run

$ truffle develop

Truffle develop freezes and won't load anything. How do I run an instance of my contract so that I can see what it's doing?

I tried running tests but I can't see any return values. I can only use assert to verify if variables are what I want them to be.

How can I make what's happening less opaque so I can make sure everything is working how it should?


texts: I copied one account file in keystore folder from one computer to another. Mist reconnized the new account but complains "wrong password" when I use it. Is there more than just copying a file to importing an account?


texts: Can I recover a blockchain transaction to a phishing address

texts:
I was scammed and sent 3 eth to a phishing address.
0x2ed31556f20db283569ae040d6968f65efa240ca a.k.a (Fake_Phishing4397)
It is possible to recover my losses? Thank you so much!


texts: Signing a transaction: What is actually signed? [noob question]

texts:
I'm trying to wrap my head around how signing transactions actually works. As I understand ECDSA signatures roughly work like this: There is a magic function, let's call it sign that takes two parameters. The private key and the message. It outputs the signature or in the case of web3.py or web3.js, three weird values v, r, and s.

So when users sign a message they are basically signing a blob of data which is the message value in the sign function. Am I correct in this assumption?
So when users sign a message they are basically signing a blob of data which is the message value in the sign function. Am I correct in this assumption?

How can I access that data blob? Is it possible to get it from a public transaction via web3?

I found this article and there it says that the data hash that will be signed is created from rlp + hash. Has anyone an idea what rpl means or how to get the output hash with web3?


texts: How to add an amount of ether to function calling?

texts:
I have a function in my contract, suppose

 function foo(uint _param1) payable {
     require(msg.value == 1000);
     someArray.push(x);
 }

Then I have my Javascript code:

 contract = web3.eth.contract(abi).at(address);
 contract.foo("Hello World!", function(err, res){
   alert("Transaction sent");
 });

Now, I have the web3 injected by Metamask, so I must use the asynchronous method because MetaMask doesn't support the synchronous method without the callback.
I have tried several ways to add an amount to my transaction, e.g. I've tried

 contract.foo("Hello World!",
   {from: web3.eth.coinbase, value: 1000},
   function(err, res){
    alert("Transaction sent");
   }
 );

but there is nothing that works!

So, how to solve it?


texts: how to know smart contract gas price and gas limit when deploying the contract using web3j

texts:
I am new to smart contracts and ethereum I am using web3j to deploy contracts on the private network
Following this as a guide
https://github.com/web3j/web3j

In the below section of code, it asks for gas limit and gas price of the contract

Web3j web3 = Web3j.build(new HttpService());  // defaults to http://localhost:8545/
Credentials credentials = WalletUtils.loadCredentials("password", "/path/to/walletfile");

YourSmartContract contract = YourSmartContract.deploy(
        <web3j>, <credentials>,
        GAS_PRICE, GAS_LIMIT,
        <param1>, ..., <paramN>).send();  // constructor params

how should I determine the GAS_PRICE, GAS_LIMIT?
before that, I was using ethereum wallet to deploy contract it automatically estimates the gas price and limit. I am a beginner i do not know gow to estimate gas price and limit without ethereum wallet ?


texts: This answer mentions a "basic ICAP address".  What is a basic ICAP address and what are its benefits and disadvantages over "regular" ICAP addresses?


texts: Truffle v5 runs out of gas but Truffle v4 deploys the contract

texts:
Truffle v4 used to deploy the contract successfully, but Truffle v5 truffle migrate command fails.

My process to deploy:

1) delete buidl/ folder

2) truffle compile

3) truffle migrate

Truffle v5

The error I get is:

Error:  *** Deployment Failed ***
"ContractName" ran out of gas. Something in the constructor (ex: infinite loop)
caused gas estimation to fail. Try:
* Making your contract constructor more efficient
* Setting the gas manually in your config or as a deployment parameter
* Using the solc optimizer settings in 'truffle.js'
* Setting a higher network block limit if you are on a
 private network or test client (like ganache).

at C:\Users\dziug\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-deployer\src\deployment.js:364:1
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.0 (core: 5.0.0)
Node v10.4.0

My truffle-config.js looks like this:

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*',
  compilers: {
    solc: {
      version: "^0.4.24",
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }

Then I installed truffle v4 and tried to migrate the same contract:

1) npm uninstall -g truffle

2) npm install -g truffle@4.1.15

3) delete buidl/ folder

4) truffle compile

5) truffle migrate

And it works. I can deploy it on the rinkeby too.

Remix doesn't deploy it with

  javascript VM: "creation of ContractName errored: transaction
  execution failed"

However, I can deploy it to Rinkeby through Remix

I need this contract to be deployed with truffle v5, because I will develop Solidity 0.5.* contracts that will communicate with the one I am trying to deploy right now, otherwise I won't be able to test with javascript.

The contract I am trying to deploy is: https://github.com/cryptocopycats/awesome-cryptokitties/tree/master/contracts

with couple fixes and additions. Contract starts from KittyCore.sol


texts:
I have created an ERC20 token, but how does it get value?

Right now, 100,000,000 BST tokens are worth 0 Ether.

Can someone help me learn how to get the tokens to gain value?


texts: Will a higher stake make more money in PoS?

texts:
Since I'm very new to this I'm just going to assume I'm getting it wrong. But here it goes anyway...

The higher my stake, the more money I make. This is my raw understanding of how proof of stake works. Say I have a good machine with a decent GPU but no money to invest upfront > then I have no stake > and without a stake I make no money > thus I have no interest in working with Ethereum.

  The rich get richer and the poor get poorer

Why would poor people contribute to the network if the ones making all the money are the ones which already have bucketloads of it? Doesn't this create a snowball effect leading most of the small fish to simply pack and leave?


texts: Is there a way to get proper block object of pyethereum with RPC?

texts:
I am running a geth node and I would like to connect to the node with python and get instance of the Block class:

https://github.com/ethereum/pyethereum/blob/develop/ethereum/blocks.py#L164

is there some existing solution to this?
I was playing with web3.py but that does only return result as dictionary...


texts: Can an Ethereum account be used by several users at the same time?

texts:
I am developing a DApp for donations (the donations are not in cryptocurrencies). I want the donor to make donations without registering on the platform. In fact, I don't need to know who he is. So it is not worth creating a blockchain account for each donor.

Hence, I wonder if I can create a single blockchain account (universal account) that several donors use it to deposit their donations.

Is it possible? and if possible is it scalable (in the case where several donors deposit donations at the same time)


texts: how to import the wallet generated from geth into parity through the passphase?

texts:
I have create a eth wallet by using geth, which is a go-lang based ethereum command line interface.

~ geth account new
 WARN [08-13|16:57:51] No etherbase set and no accounts found as default
 Your new account is locked with a password. Please give a password. Do not forget this password.
 Passphrase:
 Repeat passphrase:
 Address: {6d28522f27971cf42efa6d100576b1b34fc63188}

Now i have the address and the passphrase, and I am trying to import this wallet into parity, however in the account UI, I can't find any option to import the wallet

any ideas?

By using the geth accout list command, I can find my account keystore file.
But still in working with Parity to load the wallet with geth keystore option, the UI is just like the image below, i can't forward to load the keystore json file, i just installed parity two days ago.

The keystone json file is at the path in my ubuntu system


texts:
Is there any secure solution(without exposing a Private key of the user) to automatically sign transactions, which are requested from a DApp, so that user doesn't have to sign each of them manually? I know that in the web3 API exists something like this:

let signedTransaction = await web3.eth.accounts.signTransaction(options, PRIVATE_KEY);

But Private key is exposed here, which is in my opinion a security issue. Am I wrong?


texts: How to pass a non-deployed Smart Contract to a deployed contract and call a function on it?

texts:
I'm currently trying to pass a Smart Contract (which is NOT deployed) in byte code format as an argument to another Smart Contract (which is deployed).
From within the deployed contract I want to run the other contracts byte code and call a function on it.
Here's a quick example which illustrates the idea (I haven't included any byte code just yet to keep it simple):
pragma solidity ^0.4.23;

// The NOT deployed contract

contract NotDeployed {
    function getGreeting(string name) public returns (string) {
        return string(abi.encodePacked("Hello", " ", name));
    }

}

pragma solidity ^0.4.23;

// The deployed contract

contract Deployed {
    string name;

    constructor(string _name) public {
        name = _name;
    }

    // The arguments should be the byte code of the `NotDeployed` contract
    // alongside the function which should be invoked
    function greet(NotDeployed notDeployed) public {
        string greeting = notDeployed.getGreeting(name);
        // ... snip
    }
}

The use case for this invocation model is that I want to deploy one Smart Contract on the blockchain which is capable of invoking other, custom logic which is unknown at deployment time.
E.g. one could write a Smart Contract locally and "inject" it into the deployed contract via Web3 which will then just call the logic of the "local" contract.
I found the following resources which look promising but I'm not entirely sure if the EVM supports this kind of workflow:

Can a solidity function take bytecode as a parameter and deploy it?
Function to execute raw bytecode in EVM
How can a factory contract clone the bytecode of an existing contract?
Can a contract access the code of another contract?


texts: Get new addresses of token holders for a ERC20 token

texts:
I am looking for the number of token holders (addresses) in an ERC20 token in two different times, in order to observe how many new token holders were created for that ERC20 token.

I spend many time among the ehtherscan api , ethplorer api and others but cannot find a method to retrieve that data. Even though https://etherscan.io/ have the data of token holders, my goal is to observe new token holders by ERC20 token in a month for example.

Regards,
Nicolás


texts: Unable to send DAO in MyEtherWallet due to insufficient gas

texts: I was trying to send 1 DAO from Myetherwallet to another address and wanted to know if it worked. However, I was not able to send due to insufficient funds for gas * price + value. I had 150000 gas for the transaction fee. Screenshots attached. Any idea how to resolve this issue?


texts: Generating Ethereum Private Key,Public Key On Mobile (Android/Java)

texts:
I'm looking for a way to generate Ethereum private keys and public keys inside an Android app. I've scavenged the web and ultimately decided to tear apart the code to myetherwallet and import the same Javascript libraries into Android/Java and run them there. However, this feels extraordinarily cumbersome.

Does anyone have a code snippet for generating private/public key pairs for Ethereum in Android?


texts: Ethereum transaction sent from Ledger Nano X stuck because too low tranasction fee used

texts:
My ETH are STUCK.
48 hours ago i sent 31 ETH from my Ledger Nano X to my Coinbase account, but i choose the slowest and cheapest method that was diplayed into my ledger ( I don't remember how much gas and GWEI was but definitely i choose the slowest and cheapest one because i was not in a rush and i thought in maximum 10-12 hours will be completed but now after more than 48 hours I'm getting anxious especially after reading on several places that my transation could be stuck in the network and I really don't know how long it could take until miners will verify it  and I really don't know what to do if is anything to do other than wait.
Definitely was very stupid from me doing what I've done but now apparently is nothing to do than wait.
Any help,suggestions or alternative please? Still learning every day...
Thank you! Appreciate it.


texts: How do I get stuck transaction due to low gas to go through?

texts:
I have a MetaMask wallet and sent a bunch of transactions through with too low of gas. So they're stuck. They don't even show up as pending, they just are 'not found' on etherscan.

I've tried sending transactions through with very high gas price, but they don't go through either.  From my reading (could be wrong) I need to resend the lower-nonce transactions with a higher gas to unstick them, and I can effectively cancel them by sending 0 ETH to myself.

However the only way I can find to do this is through myetherwallet.com and specifically by pasting the metamask private key into the website to sign the transaction (on https://www.myetherwallet.com/#offline-transaction)

Am I right about all this? Is there no secure way to send a transaction where you explicitly specify the nonce?


texts: How to force geth node to propagate stuck transaction, or abort them

texts:
I have several transactions from the same address stuck in geth node and not visible in mempool via etherscan (transactions from other addresses are sent to blockchain ok)

Those transactions are stuck in the node for more than 24 hours, although node configuration  --txpool.lifetime value is set to 24h0m0s.

Is there any way either to force node to propagate those transactions to the blockchain, or to clean them up from node (to be able to resend without double spending)?

Regards,
Leonid


texts: Do all Ethereum addresses have a specific format?

texts: I know all ethereum addresses start with 0x, but is there a common letter/number after the 0x to represent an address? Because I get confused on how to tell if its an Eth address or if its a transaction id.


texts: Genesis.json permanence and updating the blockchain

texts:
I understand that the initial genesis.json attributes are a permanent thing, and it cannot be changed retroactively.

But what I want to know is which parameters are changeable afterwards and how?

Could I change the gasLimit afterwards somehow? By using an account/key with the right rights?
Could the difficulty be changed afterwards?
And which params can't be changed (I'm guessing alloc is only a genesis param?)

Or am I misunderstanding, and can every block afterwards have their own gasLimit?

And finally, what happens when you want to update/upgrade your blockchain?


texts: Ethereum address -> private key correspondance

texts:
It is known that Ethereum addresses are generated by hashing the pubkey (ref. this post). However, I'm not certain that a single pubkey corresponds to a single address.

Use case

I would like to implement a schema of token exchanges where a user can send a single token only once (a kind of voting). The user generates a keypair and derives an address from the public key. The user then discards the keypair. I would like to be sure that a voter can't generate another address using the same keypair causing me to count his token twice.


texts: Using different accounts on Remix JS VM mode

texts: Remix's Javascript VM-mode is great because of its convenience and speed, but there doesn't seem to be a way to interact with your contract using different test accounts. Is there a way to do that?


texts: Set the price by calling another contract and getting result from it

texts:
I want to set the price in Token every time the contract is deployed by calling ETHUSD in constructor and getting result from it.

pragma solidity ^0.5.0;

import "./ETHUSD.sol";

contract Token {

    uint256 public price;

    constructor() public {
        price =
    }

  What should I add in Token after "price =" to make it work?

pragma solidity ^0.5.0;

    import "./oraclizeAPI.sol";

    contract ETHUSD is usingOraclize {

        string public priceETHUSD;

        event LogNewCoinBaseOraclizeQuery(string description);
        event LogNewCoinBaseTicker(string price);

        constructor() public {
            oraclize_setProof(proofType_Android | proofStorage_IPFS);
            update(); // Update price on contract creation...
        }

        function __callback(bytes32 _myid, string memory _result, bytes memory _proof) public {
            require(msg.sender == oraclize_cbAddress());
            update(); // Recursively update the price stored in the contract...
            priceETHUSD = _result;
            emit LogNewCoinBaseTicker(priceETHUSD);
        }

        function update() public payable {
            if (oraclize_getPrice("URL") > address(this).balance) {
                emit LogNewCoinBaseOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee!");
            } else {
                emit LogNewCoinBaseOraclizeQuery("Oraclize query was sent, standing by for the answer...");
                oraclize_query(5, "URL", "json(https://api.pro.coinbase.com/products/ETH-USD/ticker).price");
            }
        }
    }

Contract above ETHUSD is just example and it gets the price from the API.


texts: How can I retrieve transaction hashes using web3 batch requests?

texts:
When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (https://github.com/ethereum/wiki/wiki/JavaScript-API#batch-requests), I'm unable to find a way to get the tx hash of any of the requests in the batch. Is there a way? It doesn't look like batch.execute() returns anything or supports any callbacks - so I'm a bit stuck.

I'm using batch requests to make sure my transactions get sent in a fixed order.

Thanks!


texts: Mapping with values signifying set membership

texts:
I'm trying to achieve set membership functionality where keys are member IDs:

mapping(uint => mapping(uint => bool)) s;
s[0][1] = true;

However, I'm getting:

Expected identifier but got '='

I've also tried with a uint mapping to a struct (with a single mapping member), but got a similar result.

N.B.: Tested in Remix.


texts: How to give struct members default values

texts:
I am working on some complex Relational databases like structure in solidity and need to have some values initialized to a custom value not the usual 0.

I want to do something like this :
(Status is an enum)

  struct AttributeStats {
    bytes32 ValidationDate = now;
    Status status = 1;
    bytes32 ValidationDuration = 356;
    bytes32 Value;
  }

I don't think this is supported by solidity, but i need it to happen.


texts:
ERC20 Tokens are currently used in more than 90% percent of new tokens.

At this point, is it a good idea to use instead ERC223, or should be test it further?

Any real example of ERC223?


texts: Calling transferFrom of external erc20 contract

texts:
Hey I'm calling externals contract method transferFrom in following way.

function sendTransaction(address tokenAddress, uint tokenAmount) public payable {
    if (!performTransfer(tokenAddress, tokenAmount)) {
        revert();
    }

function performTransfer(address tokenAddress, uint amount) internal returns (bool) {
    ERC20Interface instance = ERC20Interface(tokenAddress);
    bool resp = instance.transferFrom(msg.sender, address(this), amount);
    return resp;
}

Can someone please tell me if there are any security vulnerabilities in those two functions?


texts:
Using solidity ^4.x, it seems I can use an interface as a parameter type in a function from a different interface.

Example:

interface IERC20 {
    function transfer() external;
}

import "./IERC20.sol";

interface InterfaceB {
    function myOtherFunc(IERC20 tokenAddress) external;
}

Is this good practice? Are there any examples of successful protocols or dapps using this pattern?


texts: How can i implement deadlines in smartContract?

texts: Suppose I am running a gallery and ask participants to submit there paintings before a specific date. After passing that date participant should not be able to submit their entry. How can I implement such functionality?


texts:
When I do the following on the geth command line:

20000000000000000000-19999999999999999989

it returns 0

I'm guessing this is because of a 64 bit limit on ints.

Is there a way to get it to return 11?


texts: Ethereum contract chi gas token always uses 0 tokens

texts:
I'm trying to use chi gastoken in my contract to pay for gas, i use this modifier:
constructor(address _chi, address payable _owner) public {
    chi = IFreeFromUpTo(_chi);
    //0x0000000000004946c0e9F43F4Dee607b0eF1fA1c

    owner = _owner;
    authorizedUsersList[_owner] = true;
}

modifier discountCHI {
    uint gasStart = gasleft();
    _;
    uint gasSpent = 21000 + gasStart - gasleft() + 16 * msg.data.length;
    chi.freeFromUpTo(address(this), (gasSpent + 14154) / 41947);
}

I initialize chi as chi = IFreeFromUpTo(_chi); where _chi is the address of contract.
Whenever i decorate my function with discountCHI modifier no matter what the function does it always "uses" 0 chi.
It can be any function, like:
function countSomething(bytes memory data)
        payable
        public
        onlyUser
        discountCHI
        returns (uint[] memory amounts)
    {
    //Do important work here
    }

If i emit the amount passed to freeFromUpTo before the call itself it's not 0, am i missing any approvals or magic steps to make it work? Obviously, contract has more than 0 gas tokens.


texts: Etherscan: Effectively paginate `Event Logs` result

texts:
I am using Etherscan API for various Ethereum details.

I need to find out the tokens transferred from a token original contract (let's say A)  address to a particular address(let's say B).

For this I would need to iterate through all  transactions of B and all the Event Logs of A and see if any transaction in Events matches that of B if yes then the data key gives me the value of token transfer.

But I have no way to know these transactions would be part of which block so I would have to iterate through all the blocks, since API supports max of 1000 results in a single call I have no way to know at how many blocks this limit would be reached, so I iterate at steps of 1000, it is painstakingly slow and would take hours.

The API accepts fromBlock and toBlock parameter. Presently the latest block is at ~4287262 How can I effectively paginate the results, given if I use a step of 1000 for blocks it would take ~4000 calls which seems very ineffective.

One way I optimized is seeing at which block the contract was created this effectively eliminates 95% of the blocks and used multithreading for other blocks but it is still slow.

Any other way/method/suggestion would be great.


texts: Truffle + INFURA remote provider deployment. Migrations not running

texts:
I am running into the same issue proposed by this question. I cannot resolve it because I am using a remote provider (INFURA), per this document.

My code looks like this:

var ethwallet = require('ethereumjs-wallet');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");

// Import the raw private key of the admin
const keys = require('../test/keystores/keys.json');
const admin_key = keys.admin.privateKey;
const admin_addr = keys.admin.address;

// Add the admin key to the provider. This will unlock the account so it can
// deploy the contracts and run the tests.
var wallet = ethwallet.fromPrivateKey(Buffer.from(admin_key, 'hex'));
var engine = new ProviderEngine();

// Start the infuranet provider
var infuranet = "https://infuranet.infura.io";
var engine = new ProviderEngine();
engine.addProvider(new WalletSubprovider(wallet, {}));
engine.addProvider(new Web3Subprovider(new
Web3.providers.HttpProvider(infuranet)));
engine.start();

module.exports = {
  networks: {
    infura: {
      network_id: 5810,
      provider: engine,
      from: admin_addr
    },
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*"
    }
  }
};

And I am running:

truffle migrate --network infura

Which hangs indefinitely. This also happens if I run:

truffle compile --network infura

Or any other truffle action.

Is it possible to run this without a local node? I would like to deploy these to this network using the remote INFURA provider.


texts: quorum istanbul byzantine fault tolerance (ibft) consensus nodes count for failover - recommended configuration

texts:
In Quorum, specifically for istanbul byzantine fault tolerance (ibft) consensus algorithm, what is the ideal node count for failover? i.e., recommended configuration?

Nathan Aw (Singapore)


texts: Treating bootstrap nodes as any other node in private ethereum network

texts:
I'm chasing a problem which requires me to deploy a private Ethereum network. I was wondering if it is absolutely necessary to add dedicated bootstrap nodes whose sole purpose is to aid in peer discovery, or can I make it a bootstrap node, and also make it participate in storing the blockchain and/or block validation for PoS? I don't want to bring up extra nodes to keep the cost within bound.

Also, looking at the materials I found online, I understand these nodes have to be always available. But it's not clear, if I have multiple such nodes, is it required for all of them to be available, or is it fine if at-least one of them is reachable at any time?


texts: What are the advantages of selfdestruct-ing a smart contract?

texts: I know this might be a subjective question but I am trying to understand why the ability to selfdistract a contract exists. What is the use of self distract? Are there any dapps using self distract as a feature?