texts:
I've seen mulmod used in Mikhail Vladimirov's Math in Solidity series:
function fullMul(uint256 x, uint256 y) public pure returns (uint256 l, uint256 h) {
    uint256 mm = mulmod(x, y, uint256(-1));
    l = x * y;
    h = mm - l;
    if (mm < l) h -= 1;
}

What does it do exactly?


texts: Send Multiple ECR20 Tokens from a Single ETH Address in One Transaction?

texts:
Is it possible to send multiple ECR20 tokens (i.e, USDT and USDC) from a single Ethereum address (EOA) to another address (EOA) in a single transaction (either with or without a smart contract)? If yes, would this lead to a reduction in gas costs? If it would, how would one go about in calculating the savings?
I've read conflicting information on this topic. According to one reddit user:

Without such a wrapper contract, moving several tokens in one
transaction is impossible.

Yet, according to another user:

It'd definitely save gas. All transactions have 21k gas and contracts
add on top of that depending on the ops used. If you create a contract
that combines the work of 2 transactions, you'd save the 21k of one of
the transactions

Who's right? And if it is possible to send two tokens in a single transaction how would I go about in calculating the fee savings?
This question does seem to address (no pun intended) sending eth + other tokens in a single transaction. Would the same answer apply to sending multiple ECR20 tokens without sending eth? Also, it does not address the possibility of sending tokens via smart contract which according to the reddit post above should reduce the cost by 21,000 gas as this fee would be assessed only once.


texts: Current methods to send encrypted messages from contracts

texts:
I am trying to understand if there currently exists a method to send a message from a contract to another contract or a private address? What would the Solidity code for this look like? Perhaps events could be used for that?

Given that there is no privacy on the blockchain, the message will obviously be readable by everyone. So the only way I can think of doing it is by encrypting the message using the recipient's public key.

Some related questions are below, but they don't have answers to my question (and it looks like Whisper is not yet implemented):

How can I send some message from contract to address
Does Ethereum offer encrypted peer to peer communication applications?
Will Whisper work with Ethereum contracts, or should I try another way for sending secrets?
How to encrypt a message with the public-key of an Ethereum address


texts:
I am curious how to get the total current balance of my metamask wallet with as many "accounts" inside it as it bears in the moment?

As I can understand metamask is the HD wallet and all my addresses in it are derived from my seed phrase and xpub/private key.

So is it possible to find a service or (preferably) to write a script to calculate total balance of my metamask wallet using my xpub or another root info? Please show me the right direction. Thank you.


texts: Is Ethereum suitable as a store of value?

texts:
Say you bought some ether when ethereum was at 1.0.

Most of the time Ethereum requires you to update (via a hard fork) to the latest software.

This means you'd need to update your wallet every time there is an update.

Am I getting something wrong here or is Ethereum not a good store of value?


texts: way to access member value of a contract from a node created by other node

texts:
I have a contract code which have getter and setter method.

I have written a java main class which done followings

TransactionReceipt receipt = sendTxAndWait(new byte[0], Hex.decode(metadata.bin));
byte[] contractAddress = receipt.getTransaction().getContractAddress();
CallTransaction.Contract contract = new CallTransaction.Contract(metadata.abi);
CallTransaction.Function inc = contract.getByName("set");
byte[] functionCallBytes = inc.encode(123);
TransactionReceipt receipt1 = sendTxAndWait(contractAddress, functionCallBytes);

Another class having below:

TransactionReceipt receipt = sendTxAndWait(new byte[0], Hex.decode(metadata.bin));
byte[] contractAddress = receipt.getTransaction().getContractAddress();
CallTransaction.Contract contract = new CallTransaction.Contract(metadata.abi);

ProgramResult r = ethereum.callConstantFunction(Hex.toHexString(contractAddress), contract.getByName("get"));
Object[] ret = contract.getByName("get").decodeResult(r.getHReturn());
System.out.println("Current contract data member value: " + ret[0]);

ProgramResult r1 = ethereum.callConstantFunction("823555f52655029e4269ccc8de2bf5d5b83936a8", contract.getByName("get"));
Object[] ret1 = contract.getByName("get").decodeResult(r1.getHReturn());
System.out.println("Executed contract data member value: " + ret1[0]);**

These two are running in two different JVM. now running second program give me output like below:
Current contract data member value: 0
Executed contract data member value: 123

Now this "823555f52655029e4269ccc8de2bf5d5b83936a8" is the contract address resolved while creating contract by first java class.

So is it like that, every node want to access a contract member value should know the contract address. or is there any other way to access contract member value in ethereumj client?


texts: Possible for a ERC-20 contract owner to freeze tokens?

texts:
Is it possible for the contract owner of a ERC-20 token contract to freeze tokens in a third party’s ethereum address?

Sounds stupid, but our project member decided to send a small amount of tokens to an unknown address, which is now out of our control.

Thanks in advance

——

Would it be possible for the contract owner to update the token contract to include a specific burn() function to burn the tokens held in a specific address? ( does burn() allow such?)


texts: Ethereum Boardcast shows error: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.txdata).S"

texts:
I meet with a problem, does someone can help me how to deal with leading zero in raw-transaction?
My raw transaction is: f86b0285012a05f2008261a8948b733353ce21ebd8eb5ffd9f49d57830942e88158769ec95a3fa70008025a04f9dd75069b51d36ec47b5bf68e6c45f8b854cf17a661e734e7a7c651240eeaca00044280475c3d355c44829ac93118b4ebe044356185c1c08724c8bcfebbd4b3d

Boardcast shows error: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.txdata).S"

including raw-transaction:
R is 4f9dd75069b51d36ec47b5bf68e6c45f8b854cf17a661e734e7a7c651240eeac
S is 0044280475c3d355c44829ac93118b4ebe044356185c1c08724c8bcfebbd4b3d

How can I deal with leading zero, and how can I re-construction raw-transaction after correct it?
Does the process like this?
RLP{ RLP(nonce) + RLP(Gas price) + RLP(Gas limit) + RLP(to address) + RLP(value) + RLP(data) + V + [a0 + FixLeadingZero(R)] + [a0 + FixLeadingZero(S)] }


texts: Is it possible to perform a try-catch in Solidity?

texts: Does Solidity support try-catch functionality? If so, how does it work? What are the limitations?


texts: Why does the "Find a wallet" section of Ethereum.org not list one single actual program?

texts:
I'm looking at: https://ethereum.org/en/wallets/find-wallet/
After spending a very long time going through every single link on that webpage, I have been forced to conclude that there is no actual decentralized application that you can install and run, which doesn't force me to use some spyware browser and install an "extension", and doesn't just ask me to "log in" to some centralized account.
Somebody will likely link me to some GitHub repository, claiming that there are indeed actual downloadable applications for Ethereum. However, I am aware of those two ones, and my point is:

They are not listed or even mentioned at all on the Ethereum "portal" website (the URL I linked to), which in practice is seen as the official website for Ethereum. Why is that?
They are written in "Golang" and "Rust", which are extremely dubious programming languages controlled by entities who are violently against any kind of privacy or power to the individual. The previously existing C++-based Ethereum client's website just auto-redirects back to Ethereum.org without explanation.

I'm not saying that I think that Ethereum is a scam or "troll" project, but honestly, I don't know what to think at this point when it doesn't appear to have an actual program to use and can be trusted, or, if it does, they are apparently ashamed of linking to it for whatever reason?
Can somebody please explain to me why exactly this is? I feel as if somebody is pranking me, but the price of an Ether seems way too high for that to be the case. And I've heard it mentioned so many times now in relation to Bitcoin that I (pretty much) have to rule this out. Still, it's a fact that there is literally no way for me to actually use it! I find this puzzling to say the least.
All I want is something like "Ethereum Core", which would be a Windows EXE (and macOS, and Linux) which I install and which loads up some kind of minimal GUI where I can back up my Ethereum wallet/private keys and can do the same basic tasks as with Bitcoin on Bitcoin Core. I also expect it to have some kind of "wizard" to "create new smart contract" or similar, since this has been touted as a major feature of Ethereum (even though Bitcoin also has had them since the very start). In other words: a basic/reference implementation. An actual client to use to interact with the Ethereum network which supposedly exists and has tons of users somehow, in spite of this.
Is Ethereum really exclusively for those who are somehow able to trust centralized entities (which obviously goes completely against the whole point of decentralization...) and/or are comfortable with running spyware such as Chrome or Firefox and installing extensions into those for Ethereum support? That doesn't sound right at all.
The things allegedly enabled by Ethereum excite me a lot, and the reason I'm asking this is because I genuinely want it to be a thing. However, I just don't see how. There really appears to be nothing concrete for me to bite into, and I don't understand how other "power users" or "Bitcoin veterans" are using it.


texts: Deployed contract address is getting undefined after few days on private network

texts:
I have a private blockchain where I am able to deploy my smart contracts successfully and then I am getting the address of my smart contract which I am storing on my relational db. In geth console when I am trying to access contract method using following code

deployedContract = eth.contract(smart_contract_abi).at(contract_address)

deployedContract.myMethod()

It's working fine and giving me expected output/result

But after few days when I am trying to access method of contract on those addresses then  I am getting this error:

Error: new BigNumber() not a base 16 number:
    at L (bignumber.js:3:2876)
    at bignumber.js:3:8435
    at a (bignumber.js:3:389)
    at web3.js:1110:23
    at web3.js:1634:20
    at web3.js:826:16
    at map (<native code>)
    at web3.js:825:12
    at web3.js:4080:18

What would be the reason of this error?


texts: how to know the contract address which truffle is deploying with

texts:
I am using

truffle migrate --reset --compile-all

to deploy the contract to local network

but in order to use new web3.eth.Contract(jsonInterface[, address][, options]), i should be able to know the contract address,

so how could know the address which truffle is deploying?


texts:
I would like to upload a file to my UI and then produce a hash of it so I could later store it on Ethereum. Here is the code I am using to upload the file:

   Submit your file here
   <input type="file"">

How can I create a hash of any file on the UI side so I can later submit this hash onto Ethereum?


texts: How to create an instance of the deployed contract in Truffle Console?

texts:
I am trying to learn Truffle tool using the tutorial at:
Truffle tutorial
I am writing the following command at Truffle console to create an instance of the deployed contract but I am getting the message "undefined":
Victim.deployed().then(contract => victim = contract)

undefined

truffle(ganache)> truffle version

Truffle v5.1.27 (core: 5.1.27)
Solidity v0.5.16 (solc-js)
Node v8.10.0
Web3.js v1.2.1
truffle(ganache)>

Somebody please guide me how to create an instance of contract in Truffle Console?


texts: How to trigger receive() fallback function | web3 geth

texts:
So Im pretty new to Solidity and I was looking into the receive and fallback functions and came across this very helpful post:
What is the receive keyword in solidity?
Then I read this:

The receive method is used as a fallback function in a contract and
is called when ether is sent to a contract with no calldata.

So how does one call a function of a contract with no calldata (but with some value) such that the receive function is triggered in web3 and geth?
I know how to call functions like so:
await contract.methods.methodAB().call();
await contract.methods.methodXY(ARGUMENTS).send({from: MY_ADDRESS, value: 'SOME_VALUE_IN_GWEI'});

But how do I call a contract without calldata, or is it just as simple as doing
eth.sendTransaction({
    from: MY_ADDRESS,
    to: TARGET_ADDRESS,
    value: 'SOME_VALUE_IN_GWEI'
    }, function(err, value){
        console.log(err ? err : 'Transaction was sent! txhash: '+ value);
    }
);

Can anybody specify what is meant with calldata? Thanks in advance


texts: Call function in contract deployed in etherjs

texts:
Here is the code I used to call setValue and getValue in contract Hello.sol deployed with etherjs 5.0:
  import { ContractFactory, ethers } from "ethers";

  let contract_at_address = new ethers.Contract(contract.address, abi, signer); //<<==contract.address is the deployed address. abi and signer were defined earlier.
  await contract_at_address.setValue(10); //<<setter
  let value = await contract_at_address.getValue(); //<<==value shall be 10
  console.log("value contract at address : ", value)

But it throws error:
[Sun Nov 15 2020 23:10:11.457]  WARN     Possible Unhandled Promise Rejection (id: 0):
Error: call revert exception (method="getValue()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.5)
makeError@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:110810:32
throwError@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:110820:31
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:118492:68
step@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:118174:29
fulfilled@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:118058:34
tryCallOne@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26991:16
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:27092:27
_callTimer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:30531:17
_callImmediatesPass@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:30570:17
callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:30787:33
__callImmediates@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2736:35
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2522:34
__guard@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2719:15
flushedQueue@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2521:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]

I am following the doc for contract. The same functions are tested in truffle/ganache and they all work fine. What's missing here to call setter (change state) and getter (view only) functions in ethersjs?
UPDATE: Hello.sol
pragma solidity 0.7.0;

contract Hello {
    address owner;
    uint256 value;

    event initContract(address _owner);
    constructor() {
        owner = msg.sender;
        emit initContract(owner);
    }

    function setValue(uint256 _value) public {
        value = _value;
    }

    function getValue() view public returns (uint256) {
        return value;
    }
}


texts: Creating a Linux Docker for parity on a Windows 10 machine

texts:
I'm trying to run parity on Docker.
My workstation is Windows 10, but the Docker is intended for a Linux machine.
Right now I'm having trouble running the Docker with --base-path option, as I keep getting the following error:

Client service error: Client(Database("IO error: directory: Invalid argument"))

This is the docker command I'm running:

docker run -v /d/parity/docker:/root/.local/share/io.parity.ethereum/ -p 8180:8180 -p 8545:8545 -p 8546:8546 -p 30303:30303 -p 30303:30303/udp parity/parity:v1.7.9 --unsafe-expose --base-path /root/.local/share/io.parity.ethereum/

Does anybody has an idea?


texts: Implementing ERC-1155 contract on the fly

texts:
I want to implement an ERC-1155 token to represent ownership of videos. Creating such a contract is relatively easy:
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract MyVideos is ERC1155 {
    uint256 public constant Video1 = 0;
    uint256 public constant Video2 = 1;
    uint256 public constant Video3 = 2;

    constructor() public ERC1155("https://video/api/item/{id}.json") {
        _mint(msg.sender, Video1, 100, "IPFS hash");
        _mint(msg.sender, Video2, 1000, "IPFS hash");
        _mint(msg.sender, Video3, 1, "IPFS hash");
    }
}

However, what I have no idea how to do is to create such ERC-1155 tokens dynamically and on the fly. Specifically, how would I add Video3 with 10000 tokens
(_mint(msg.sender, Video4, 10000, "IPFS hash");

But how do I add this new token after the contract MyVideos is already created?
I would really appreciate any help you can give me.
Many thanks!


texts: Can I send a whisper (shh) message to an Ethereum address?

texts:
It seems that we can only send a message by creating new symmetric keys and key pairs ( shh.newSymKey() and shh.newKeyPair()

Then post shh.post() a message using the parameters:

symKeyId which encrypts using the symmetric key.
sig optional key pair ID which signs the message

Are Ethereum addresses disconnected from Whisper in term of identity management? It would have been great if we could address a message encrypted with and to an Ethereum address.

I want to do this PoC:

user (with eth address) X wants a secret key that only the users listed on a smart contract have, let usersListed be A,B,C,X
user X broadcast using whisper to users A,B,C -  "I want the secret key" (this message is encrypted for each user)
Anybody (A B or C) from the list, once this message has been received, send back an encrypted message containing the secret key, to user X.


texts: what is pausable token in erc-20 openzeppelin

texts: I want to know about the pausable token in openzeppelin.what are the advantages that we will get after making our ERC-20 token pausable.


texts:
What is the maximum size of the calldata for example i have function which accepts array of addresses, how many elements can have in this array
function inputData(address[] calldata addresses) public {}


texts: Testrpc command with mnemonic and account with preloaded ETH value

texts:
Im trying to startup my testrpc with the mnemonic "-m" flag while also preloading a specific account with custom ETH amount.

This is the command I tried, but no luck. It starts up and preloads the account fine, it just does not have the accounts from the mnemonic.

testrpc -m 'help maple me bake pudding cream honey rich smooth crumble sweet treat' --account='0xxxxxxxxx00xxxxxxx000xxxx,100000000000000000000'

Is this possible?


texts:
I transferred ETH token from Binance hot wallet to ETH wallet by mistake.
How can I get that returned to Binance wallet.
Can someone please help me on this.
Regards


texts: Exploring blockchain data from testrpc network

texts: What would be the best way to explore the blockchain content of the testing network? Ideally, is there a way to adapt https://live.ether.camp to track the local network? Alternatively, what could one use to inspect contents of the blockchain?


texts: Are multi-sigs multiple keys signing on a single shared signature, or one signature per key?

texts: And if it is a single shared signature, how does that work?


texts:
I installed Ethereum on a VPS.

When I connect on the VSP, with the command line I can send transaction.

Now I want to do the same thing from a local script.

I think I must use JSON RPC, but I don't understand how can I use it.
Moreover, there is some danger to use RPC

So is there an other way to do this?


texts: What are the anticipated economics of moving from PoW to PoS?

texts:
As the move to PoS gets closer, I'm trying to get more details on how the PoS validators will get compensated.  In PoW, it is based on formulas and the awards are transparent. Not so for staking unless I'm missing something obvious.

The current proposal is to pay Validators between 1-3% interest per year on the amount of ETH someone is putting at risk to run a validator.

The risk / costs of staking are related to:

Tying up their ETH and losing liquidity (duration of time the
validator is logged in and validating + the time required to log off the proposed 4 months waiting period to get your deposit and interest back)
Risk of having your deposit slashed for any of the    published
slashing conditions
Expense of keeping your node on the    network

Based on what I have read, you basically seen no interest until you log off, then you get it all at once (your initial deposit + any interest earned - any slashing fees).

In PoS, what happens to:

Block rewards, currently at 3 ETH
Uncle awards, currently calculated
    by the formula (U_n + 8 - B_n) * R / 8
The gas for the transactions
    in the block


texts: How does this line of code (Solidity) work?

texts:
User storage user = users[msg.sender];

I have a "User" struct:
    struct User {
    Deposit[] deposits;
    uint256 checkpoint;
    address referrer;
    uint256[3] levels;
    uint256 bonus;
    uint256 totalBonus;
}

And a "users" mapping:
    mapping (address => User) internal users;

The function the original line only asks for:
function intense(address referrer, uint8 plan) public payable {

So I understand what a mapping is and what the Struct is (I'm a beginner) I'm just very confused about the first line:
If I understand well, "users[msg.sender]" refers to the item in the "users" mapping with the key value "msg.sender". However, I don't remember creating this. If I am creating this, I don't understand how I created it when the "users" mapping only includes the "User" struct and I haven't given all the information the user struct needs. Plus, I don't know what the new "user" is.
Thanks a lot for the help!
Edit:
Can't seem to add the function in "code" in comments, so here it is:
    function invest(address referrer, uint8 plan) public payable {
    require(msg.value >= INVEST_MIN_AMOUNT);
    require(plan < 6, "Invalid plan");

    uint256 fee = msg.value.mul(PROJECT_FEE).div(PERCENTS_DIVIDER);
    commissionWallet.transfer(fee);
    emit FeePayed(msg.sender, fee);

    User storage user = users[msg.sender];

    if (user.referrer == address(0)) {
        if (users[referrer].deposits.length > 0 && referrer != msg.sender) {
            user.referrer = referrer;
        }


texts: Knowing the message, can a signature be derived from an address or pubkey?

texts:
tl;dr if I were to sign an Ethereum message, eg. web3.eth.personal.sign("Bitcoin", "SOME-ETH-ADDRESS"), would it be reasonably safe to use a 32-byte hash of the signature as the private key for a Bitcoin wallet?

Is it possible to calculate the signature hash of a signed message, using eg.

web3.eth.personal.sign("Hello world", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", "test password!") taken from the web3 docs

which would return 0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400,

if you DO NOT have the private key?

Specifically, if the message being signed is KNOWN, and the address and/or pubkey of the signer are KNOWN, can the signature hash be calculated by a 3rd-party.

The use-case is to use the signature (32-byte hashed) as the PRIVATE KEY for generating other addresses (non-Ethereum).

I saw this question,
Can a message hash be recovered from a signature?, however, this line is a bit confusing:

  It should be noted that while computing the message hash is infeasible, it is possible to check guesses, if the message was not salted before hashing (which it usually isn't).

Thanks!


texts: I am creating a private network of more than one nodes using geth client. I want that only few clients can get the access to mine blocks.May be i will provide a list of addresses of authorized miners. How can i do this? Thanks!


texts: I have connected two notes using bootnode in ethereum private blockchain but mining is not started why?

texts:
I have generated the enode from Bootnode in Ethereum private network and i connected three individual nodes using that enode through Bootnode, and i have checked whether that nodes are connected or not with my current node using the command "admin.peers".

those three nodes are conected successfully

then i start the mining using the command miner.start() Geth not started

As of my observations i am getting the line constantly, Line => "Regenerated local transaction journal transactions=0 accounts=0" for every one hour as we can see in the above screenshot But even single block is not created

Question : Why is mining not started, How to start mining? please give me some suggestions and guide me if i am wrong

I have created simple genesis.json file. Please find below

{
"config": {
    "chainId": 1015
},
"difficulty": "0x400",
"gasLimit": "0x8000000",
"alloc": {
    "ef2df6e0a312875ca7e35d8d3579cf66df558193": {
        "balance": "30000000000000000000000000000"
    }}}


texts:
I'm trying to Deploy my ERC20 contract in Ethereum main net, but I'm not sure about the bytecode.

I have seen a lot of tutorials but nobody tell something about uploading on main net and bytecode informations.

So i'm using remix , I already used Ropsten network and all work good, now I want to transfer my contract on main net and I'm not sure if I have to use 0xBytecode or only Bytecode generate by Remix.
On Ropsten I used 0xBytecode, is it the same also on Main network?

And if i want to use MEW to deploy the contract, what I have to choose on the top right corner? (myetherwallet.com or etherscan.io)


texts: Performance of Dapps when millions of records to be fetched

texts:
I am thinking of Dapp with react js and ethereum. Using IPFS for data storage. Let's assume that blockchain holds millions of hash addresses from IPFS.
I need to show those millions of records and publish them somewhere in CSV. I have an array in the blockchain that holds them.
Does it affect the performance of an app while trying to fetch the millions of records from blockchain?


texts: Why do truffle compile or migrate commands fail silently?

texts:
Truffle v5.0.3 config:

truffle-config.js

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  networks: {
    development: {
      host: "127.0.0.1", //also tried 'localhost', just in case
      port: 7545,
      network_id: "5777"
    }
  }
};

Ganache v1.3.0 config

on executing truffle migrate --reset or truffle compile or truffle migrate --network development --reset --compile-all --verbose-rpc happens nothing: no output, no builds. I suppose the same code worked before (with output and builds), however, on the different OS (using Linux Debian at the moment).

What is wrong with the configuration?

Edit:
Ganache logs show there is no connection from truffle during my attempts to compile contracts.

[9:09:57 PM] Starting server (version 1.3.0) with initial configuration: {"hostname":"127.0.0.1","port":7545,"network_id":5777,"default_balance_ether":100,"total_accounts":10,"unlocked_accounts":[],"locked":false,"vmErrorsOnRPCResponse":true,"verbose":false,"gasLimit":6721975,"gasPrice":20000000000,"hardfork":"constantinople"}
[9:09:57 PM] Ganache started successfully!
[9:09:57 PM] Waiting for requests...


texts: Is there any chance to retrieve data on a database(sql) to a smart contract

texts: I want to write a smart contract that gets id numbers as inputs and then retrieve data that are recorded in a database.Is there any specific database for that process.


texts:
I have a constructor like so:
constructor(bytes32[] proposalNames) public {
...

How do I input values for it on deplyoment with remix? I tried ["foo", "bar"] but it said:

creation of Ballot errored: Error encoding arguments: Error: invalid
bytes32 value (arg="", coderType="bytes32", value="foo",
version=4.0.47)


texts: web3.js token approve function show null / 0 in Metamask

texts:
EDIT
The allowance is set, the issue is just that metamask detect no token name nor amount that is allowed.

In my HTML/JS

amount = parseInt(web3.toWei(amount, "ether" ));

tokeninstance.approve(mainadd,amount,function(error, transactionHash){
if (!error){
    $("#allowanceresult").html("TX hash: "+transactionHash+"
")
    toastr.success("Approval successfull!")
}else{
    $("#allowanceresult").html("Error: "+error+"
")
    toastr.error("Approval failed!");
}

In Solidity interface

function approve(address guy, uint wad) public returns (bool);

Doing the approve function in remix manually work, I'm on ropsten, but using metamask + the HTML/JS dapp function up there, getting user input (show correctly in wei) and input predefined address (correct format), metamask show me this, still on ropsten:

Am I missing something? It's always like that I made my send() web3.js functions, I use the same web3.js file than I always do.

Checking on ropsten both side by side Event (from remix and metamask), it's clearly both same data inputed, same address and same wei ammount. :(


texts: How to reliably send transaction via web3j while connection is poor?

texts:
I use Transfer.sendFunds(Web3j, Credentials, BigDecimal, Convert.Unit)  to transfer money. Usually I convert it to flowable. Flowable/RemoteCall completes when transaction is included in block (correct me if I am wrong). So my question actually can be split to two:

does web3j handle cases when I started transaction and then went offline?
and if so how can I get transaction hash?


texts: What does "resistance" mean in the context of a cryptocurrency exchange?

texts:
I was reading Where can I buy Ether? and they mention "least resistance" as a criterion for an exchange:

  Where are the best places to buy ether with the least resistance and lowest fees?

What does this mean exactly?


texts: Smart contract to send data to requested device

texts:
I have multiple Pi's connected to a miner in a private network, where one pi is collecting sensor data, and am able to send ether from all the devices and they are all synchronised with the private blockchain.

How can a smart contract request data from pi B and Pi A sends the data back automatically


texts: ICO refund: "Insufficient funds...account you tried to send transaction from does not have enough funds"

texts:
EDIT:  Please note that this concern revolves around the "Contracts" portion of MyEtherWallet.  I'm not trying to send funds from my account, I'm trying to recover funds for a failed ICO using the information provided to me by the ICO.

I recently participated in an ICO (OMD Coin) which was unsuccessful.  They sent instructions to use the "contracts" function of MyEtherWallet in order to get a refund of my original deposit.  When I follow the instructions, I get the following error message:

"Insufficient funds.  The account you tried to send transaction from does not have enough funds.  Required 783636000000000 and got: 0."

I reached out to the company for more information.  Is it possible that they sent out instructions before the actual ICO has completed (based on my research), or that the funds were stolen?


texts:
I can't understand where are these events log data is stored?

I can access to my logs by

myContract.allEvents({
    fromBlock: 2139049,
    toBlock: 'latest'
  }, function(error, event){
      console.log("event : ",event);
});

But, can i access this logs after one year? Or they'll be removed?
And where is this logs are storing?


texts: How to pass msg.sender and constructor params in truffle tests?

texts:
I have the following constructor:

constructor(address _payee) public {
    payer = msg.sender;
    payee = _payee;
}

And this function in my JavaScript tests:

beforeEach(async () => {
    contract = await Contract.new(payee);
});

However, I get an error:

  Error: Contract contract constructor expected 1 arguments, received 2

I made sure I cleared the build folder and I had recompiled the contracts with truffle compile --all before.

How can I pass msg.sender and payee? There are no problems with these constructor params when deploying the contract using the migrations deployer.

Using ganache 1.2.1 and truffle 4.1.13.


texts: Can an Ethereum key generated on a laptop be brute-forced by someone else because of low entropy?

texts:
I read this and this tweets. Though, I understand that this issue occur because some people use the same private key mentioned in a blog/forum.

But, on the first tweet, people were talking about the "low entropy" thing.

I want to understand, that key pair generated on an average general purpose laptop can be brute-forced or not ?

As, I'm trying to build an application on nodejs, which shall be generating the account following this blog. I don't want to fall prey to any, low-level brute forcing, activity in which users of my application would be losing their asset.

What can I do to stay safe from such activity? or I'm just being over-cautious?


texts: How do I buy Ethereum with USD - If I am citizen of not available in country in coin-base?

texts:
In order to buy Ethereum currency I have followed this How do I buy Ethereum with USD answer:

But coinbase does not allow me buy ETH since I am a Turkish citizen. Probably same issue occur for other countries, which I don't know the list.

Occurred error:

  Sorry! Buys not avaible in Turkey.

[Q] Does Kraken or Gemini allow Turkish citizen to buy ether? If not do you have an advice for me to follow?

Thank you for your valuable time and help.


texts: How do smart locks make sure that they have access to an up-to-date version of the blockchain?

texts: Smart locks like Slock.it are supposed to allow locks to be able to do things based on the blockchain state. Does that work with locks that don't have their own internet connection? If so, how does the lock make sure it has the correct version of the blockchain?


texts: Prove that a solidity function was executable in the past

texts:
I was wondering if anyone knows a way of how to prove that a certain function of a solidity smart contract was executable (i.e. not reverting) after the fact without calling the function itself, e.g. by proving that a past state would have resulted in the function to execute successfully.

EDIT:

Complexity arises due to the fact that the proof should be done on-chain, after the function was executable in the past. I.e. one would require some sort of proof that can be verified on-chain that the EVMs state in the past would have allowed a particular function to return a certain value, without sending a tx to the function at the time it should become available.

Example:

contract Test
{

    uint256 public testNum;
    address public owner;

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

    function returnTrueIfGreaterThanTen()
        public view returns(bool)
    {
        require(testNum > 10);
        return true;
    }
    // WE DONT KNOW AT WHAT BLOCK THIS FUNCTION WILL BE CALLED and CANNOT CHANGE ITS CONTENT
    function setTestNum(uint256 _newNum)
        onlyOwner
    {
        testNum = _newNum;
    }
}

In this case, is there a way to prove on-chain at block height 100 that returnTrueIfGreaterThanTen() was returning true at block height 90 in the past, without actually calling the function at the time it becomes executable (at block height 90)?

In other words, can I check whether someone should call a function without calling it myself and punish this person for not calling the function retrospectively by proving that the person could have indeed successfully called that function in the past?

An idea would be for example implementing a view function that, given the correct state of the EVM at block 90, returns a value that proves when submitted at block 100, that the function was indeed executable and returning true.


texts: How do I send a transaction using web3.py and Infura?

texts:
I am using Infura to interact with the Ropsten testnet. I would like to send a transaction from one account to another, but the following code does not work:

w3 = Web3(Web3.HTTPProvider('InfuraUrl'))

transaction = {
    'from': 'accountAddress',
    'to': 'accountAddress',
    'value': w3.toWei(1, "ether"),
    'gas': 2000000,
    'chainId': 3
}

w3.eth.sendTransaction(transaction)

I suppose I have to use the private key obtained from Metamask. Please help if you know how to send a transaction using a local private key.


texts: Integrity of old blocks in the blockchain

texts:
I am learning Ethereum using Geth, and I am testing PoA-Clique networks. Now I have a conceptual doubt about old blocks integrity. Suppose I have a private blockchain network of only one miner node and the current block is the number 1000. Now let's suppose clients save document hashes in the blockchain and they get the transaction hashes to validate its existence later. They can send the doc hash and the transaction hash and they can proves the document existed since the transaction creation using the block timestamp.

Now my question is, can a client detect an attack to that block? When the block is created is validated agains the previous one, but what about blocks already in the chain? If my supposed block is the number 20 and I remove the transaction and redo the block, and also de previous, the client searchs for the transaction but he can't find it. The blockchain was tampered but how can he know that? I may be messing something obvious but it seems to me hard to prove every block from the genesis block every time one transaction is checked.

The Full-Sync is made only one time as I understand. The usual response is that blocks will be banished during synchonization with other nodes (like here) but what about nodes already synchronized if I change some old blocks in one of them?

I can't see a solution if the network has 10 independent miners. I can change old blocks in my personal blockchain copy (my miner node) from block 10 to block 30 for example, while current sealers validation "head" is on block number 1000. If the client is connected only to my node using some library (e.g. web3.py) he can't know about tampering in the network because only can see my node. Maybe every some time network resynchronizes old blocks or is impossible to change old blocks but I can't see why. Some clarification will be appreciated, thanks.


texts: Private network with 2 servers on scaleway

texts:
first of all thank you for the great discussions and solution that I've found here.

I'm trying to create a private ethereum network to which I want to access with 2 different servers.

I am able to create the network with and ID say 1234 and then attach to it another instance of geth (using geth --dev attach). So with 2 accounts on the same machine I am able to mine, transfer ether between the two and also develop smart contracts (like the greeter example) and invoke the greet() function on the other instance after set var greeter = eth.contract(ABI).at('ADDRESS').

Now I want to connect to this network from another server to which I access with ssh at a certain IP. Also here geth is working.
I've defined the same genesis.json file and then I have geth init genesis.json.

I've also defined a static-nodes.json file so to connect to the first server. This is where things are not working.

If from within the js console I invoke something like:

admin.addPeer("enode://9a5fe07ba826bdfc266137c4d2668c54dd659fe289858198d869ef7b9828461bd7c247834cf233d75b44a45f873d69edda05b9c9423f0c22cae451bf0df92c5c@first.server.ip.scaleway:30303?discport=0")

then I see something like this:

I1020 14:46:13.094602 eth/downloader/downloader.go:326] Block synchronisation started
I1020 14:46:13.256432 eth/downloader/queue.go:885] Peer 9a5fe0xxxxxxxxxx: header #114 [80xxxxxx] broke chain ancestry

Due to the fact that there is a block #114, I think the first server is able to send information about the chain with ID 1234, but the synchronisation is not possible. If I start mining on the second server, it starts from block #0.

Sorry for the lenght of the explanation but in this way I think I've written everything. I don't know if the problem is due to geth or my server on scaleway.

Thank you again for all your help :)


texts: How to achieve connecting smart contract using web3.js in react native?

texts: I would like to connect smart contracts in react-native


texts: UnhandledPromiseRejectionWarning when attempting to send a signed transaction

texts:
I was able to create a rawTransaction and sign the transaction without issue with the code below.
var rawTransaction = {"from":myAddress, "gasPrice":web3.utils.toHex(yessir),"gasLimit":web3.utils.toHex(210000),"to":contractAddress,"value":"0x0","data":contract.methods.transfer(toAddress, amount).encodeABI(),"nonce":web3.utils.toHex(nonce_sir)}
var transaction = new Tx(rawTransaction)
transaction.sign(privateKey)

Unfortunately, when attempting to send the signed transaction with web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex')).on('receipt', console.log);
I end up getting the following error message.
(node:697) UnhandledPromiseRejectionWarning: Error: Returned error: invalid sender
I am not sure what the error is. I wrote the script a month and a half ago, and at the time, it did work very nicely. The code is supposed to transfer ERC-20 tokens from one wallet to another.


texts: Cannot get out of gas exception when calling external contract

texts:
I'm trying to move storage of my contract into Storage contract with this code

contract Storage {

    struct Block {
        address landlord;
        uint sellPrice;
    }
    Block[101][101] public blocks;

    function setBlockOwner(uint8 _x, uint8 _y, address _newOwner) external {
        blocks[_x][_y].landlord = _newOwner;
    }
    function getBlockOwner(uint8 _x, uint8 _y) external view returns (address) {
        return blocks[_x][_y].landlord;
    }
}

contract MyContract {

    struct Block {
        address landlord;
        uint sellPrice;
    }
    Block[101][101] public blocks;

    Storage strg;

    function setStorage(address addr) public { strg = Storage(addr); }

    function setNewBlockOwner(uint8 _x, uint8 _y, address _newOwner) public returns (bool) {  //TODO make private
        //strg.setBlockOwner(_x, _y, _newOwner);    //throws with "revert"
        blocks[_x][_y].landlord = _newOwner;        //throws with "out of gas"
        return true;
    }

    // calling this function with (1, 1, 20, 20, some_addr)
    function setBlockOwnerForArea(uint8 fromX, uint8 fromY, uint8 toX, uint8 toY, address _newOwner) {
        for (uint8 ix=fromX; ix<=toX; ix++) {
            for (uint8 iy=fromY; iy<=toY; iy++) {
                setNewBlockOwner(ix, iy, _newOwner);
            }
        }
    }
}

When I'm testing setBlockOwnerForArea with explicitly large values (like 1, 1, 20, 20, some_addr) calling setNewBlockOwner 400 or more times I'm expecting to get "Out of gas" exception.

Instead I get "out of gas" only when storing locally, and "revert" when using Storage contract.

Is it how it should work? Could my Truffle setup interfere somehow?

...setBlockOwnerForArea works with lower values perfectly in both cases...


texts: Why calling to methods from Web3 using call() give errors although set functions with send() work

texts:
I'm new to solidity and I'm just testing some examples from tutorials.
The problem is that I can't call get functions although I can call set function.
I'm using Remix IDE for smart contract, Geth for client and React.js for UI.
How can I solve these errors. Whenever I call get functions to show outputs, I get these errors:
Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
    at ABICoder.push../node_modules/web3-eth-abi/lib/index.js.ABICoder.decodeParameters (index.js:286)
    at Contract.push../node_modules/web3-eth-contract/lib/index.js.Contract._decodeMethodReturn (index.js:470)
    at Method.outputFormatter (index.js:760)
    at Method.push../node_modules/web3-core-method/lib/index.js.Method.formatOutput (index.js:147)
    at sendTxCallback (index.js:523)
    at index.js:293
    at XMLHttpRequest.request.onreadystatechange (index.js:98)

This is my set function and get function written in App.js:
async setData(e) {
  e.preventDefault();
  const accounts = await web3.eth.getAccounts();
  const account = accounts[0];
  const gas = await RemixContract.methods
    .setMessage(this.state.message)
    .estimateGas();
  await RemixContract.methods
    .setMessage(this.state.message)
    .send({ from: account, gas })
    .then((res) => console.log(res))
    .catch((e) => console.log(e));
}

async getDefaultData() {
  await RemixContract.methods
    .defaultMessage()
    .call()
    .then((res) => console.log("response " + res))
    .catch((e) => console.log(e));
}

This is the contract code I am trying to run.
pragma solidity ^0.5.11;

contract RemixContract {
    string message;

    constructor() public {
        message = "Hello ZeptoBook";
    }

    function getMessage() public view returns(string memory) {
        return message;
    }

    function setMessage(string memory _message) public {
        require(_message =="hi");
        message = _message;
    }

    function defaultMessage() public pure returns(uint256 num, string memory str){
        return (999, "This is RemixContract Default Message");
    }
}


texts:
Is there an automated way to discover the source of funds that were sent to a specific address?

Theory: The EOS team releases 2m EOS tokens every 23 hours. See https://eos.io/instructions for more details. About 20k ETH gets spend on those tokens every day. Nothing stops the team from buying their own tokens again with the same ETH they had received the previous day to pump the price, create an artificial market cap and to create the illusion that the tokens were distributed while they actually still have a very profitable monopoly over the network given it is a DPoS system.

This is probably not true and I am not implying anything or trying to spread any FUD as the team has a good reputation, but as a technical exercise, I would like to know how one will investigate such an accusation given that all transaction information should be publically available.


texts: How to inspect state of smart-contract whose code I do not have?

texts: Often it is argued that one big advantage of blockchains is that anyone can come along and inspect the state. However I have not found any practical guide for doing this. Block explorers allow us to inspect transactions, but not state variables (as far as I know). So then how can I inspect state variables for any given smart contract already deployed?


texts: Start and endblock function Reverted Transactions

texts: I am trying to create a function which allows users to only purchase tokens in between specific block numbers reverting all other transactions that try to purchase after or before theese block numbers, basically a timer which opens and closes purchasing, I came across the problem that the functions don't work, instead of letting me purchase in between the blocks, the contract  wont let me purchase at anytime the transaction always fails, (gets reverted) the ether never gets transferred and never even leaves my wallet. Testing on the Ropsten Testnet.


texts: Associate event struct to user addresses

texts:
I have two contracts. One called User and other called Event

pragma solidity ^0.4.24;

contract User {

    mapping(uint=>address) addresses;
    uint addressRegistryCount;
}

pragma solidity ^0.4.24;
import './User.sol';

contract Event is User{

    struct EventStruct {
        uint average;
        uint quantity;
    }

    mapping(uint=>EventStruct) events;
    uint eventsCounter;
}

I have a mapping in bouth smart-contract´s that save the items. But I don´t know how to reference that each item, are part of a specified existing user of the mapping addresses inside the User contract.

I inherit the User contract inside the Event but i don´t how can I associate


texts: ethjsonrpc /python /bytes32 type argument assertion

texts: When I use the ethjsonrpc, some problem about bytes32 type argument assertion occurs as the picture shows. I don't know where the problem lies and the correct way to assert the bytes32 type argument using call_with_transaction in ethjsonrpc.


texts: Why fiat-backed stablecoins have a decimal of more than 2?

texts:
Fiat-backed stablecoins usually have a decimal of 6 while fiat currencies only need a decimal of 2.
Is it necessary to have 6 for fiat-backed stablecoins and why?


texts: App calls metamask twice, when I want to it to be called once

texts:
I have two functions,

One that returns web.eth.sendTransaction, which triggers metamask a first time,

And one that returns contractInstance.function that updates an array in my contract. Which also triggers metamask.

Both are in the same big function in my app.js,

I would like obtain the same result, which is receive a payment, and then update the book in the contract, by only calling metamask once.

What is the best practice?

markAdopted: function(adopters, account) {
    var adoptionInstance;

    App.contracts.Adoption.deployed().then(function(instance) {
      adoptionInstance = instance;

      return adoptionInstance.getAdopters.call();
    }).then(function(adopters) {
      for (i = 0; i < adopters.length; i++) {
        console.log(adopters[i]);
        if (adopters[i] !== '0x0000000000000000000000000000000000000000') {
          $('.panel-pet').eq(i).find('button').text('Coped').attr('disabled', true);
        }
      }
    }).catch(function(err) {
      console.log(err.message);
    });
  },

  handleAdopt: function(event) {
    event.preventDefault();

    var petId = parseInt($(event.target).data('id'));
    var adoptionInstance;
    var account;
    var transactionStatus;

    web3.eth.getAccounts(function(error, accounts) {
      if (error) {
        console.log(error);
      }

      account = accounts[0];

    });

    web3.eth.sendTransaction({
      from: account,
      to: '0xC5fdf4076b8F3A5357c5E395ab970B5B54098Fef',
      value: '1000000000000000000'
    }, function(error, result){
    if(!error) {
        console.log(result);
        transactionStatus = true;
        if (transactionStatus) {
        App.contracts.Adoption.deployed().then(function(instance) {

        adoptionInstance = instance;

        return adoptionInstance.adopt(petId, {from: account});

      }).then(function(result) {

        return App.markAdopted();
      }).catch(function(err) {

        console.log(err.message);
      });
      }
    }

    else {
        console.error(error);
        transactionStatus = false;
    }

  });
    }
};


texts:
Here's the contract events I want to pull from the ropsten network.

Here's how I constructed the event request

event_request =  ("https://api.etherscan.io/api?module=logs&action=getLogs"+
                 f"&fromBlock={from_block}"+
                 f"&toBlock={to_block}" +
                 f"&address{contract_address}"+
                 "&topic0=0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545" +
                 f"&apikey={api}")
result = json.loads(http.request(event_request)[1].decode("utf-8"))

Which gives me valid results, but I don't see any of the transaction in the specified link. I think I'm spposed to change the topic0 value but not sure what to.


texts: Ethereum development environment for Windows 10

texts:
I am new to Ethereum and Solidity. Currently learning it from youtube videos and some blogs.

So far I have been doing stuff in the remix IDE on a browser.  Now I want to perform the same things on my computer, so what would be an ideal setup for developing ÐApps with Ethereum and Solidity on my PC.

Also I use GoLand for Go and Atom as code editor.


texts: After 48 hours, my validator request is still "Pending" (Deposited)

texts:
I'm playing around with Ethereum 2.0 Proof of stake for my upcoming guide Come fare staking con Ethereum 2.0 (italian only, sorry). I setup Go Ethereum and Nimbus, generated the required keys via eth2.0-deposit-cli and deposited 32 fake ETH (from Goerli) via Medalla Launchpad.
But when I check mystatus I see:

Deposited - An ETH1 deposit has been made, it will take around 8 hours until your deposit is processed by the beacon chain. Check out the deposits tab for more details

The deposit was made over two days ago (more than 48h).
So.... did I miss something or should I just wait? Is it possible to get an ETA somehow?


texts: How to determine the best sealing time for private Clique

texts:
I have several transactions to be stored in my permissioned blockchain with PoA Clique.

With the transactions information in mind, how do we determine the best sealing time for private Clique' blocks? As we know the default is 15 seconds which is sometimes considered not fast enough or even too fast depending on the transacions

(I'm using Geth client v1.9.6-stable-bd059680)


texts: Is it possible for a Dapp that uses the metamask/chrome to set up a browser cookie?  or can a cookie set by another website like facebook, read some information or at least know that a dapp has been visited ?


texts: When verifying that a cryptographic signature was produced by an ethereum address, how can I verify the validity of the data which was signed?

texts: I'm attempting to play around with signature verification in solidity through the use of ecrecover and have gotten to the point of being able to verify the address which was used to sign a particular message. However, the part where I am getting stuck is verifying the validity of the data that was signed, so that I can ensure that a particular piece of data was signed and submitted, and that another incorrect piece of data which was signed by the same person wasn't submitted instead?


texts:
Since December 3rd I have attempted to send ~200 OMG from my wallet to a OMG wallet on a exchange. I am attempting to do this through myetherwallet.com and I have tried about 4 times now. Every time it goes into a pending state and it never goes through. I usually just end up cancelling the pending transaction by sending 0 eth to myself with the same nonce as the pending transaction. This is my first real attempt to send tokens from my wallet to somewhere else, so it is very likely I am doing something wrong. Each time I have attempted, I usually wait at least 12 hours, and the longest I have waited is about 28 hours.

My wallet address is viewable on etherscan here. What is odd is that the pending transaction may or may not be listed, depending on my luck. Sometimes it shows up, sometimes it doesn't. My latest attempt's transaction hash is 0x45a36912bfdb5fd1c5d4965e844a3f728b7c1f5a71c50ae2d0408dee7981ee67 and it is still pending.

The first 3 attempts I used the default gas limit which is something around ~51,000? On this last attempt that is still pending (been pending for more than a day now), I increased the gas limit to 200,000.

Am I just using too small of a value? I figured the added traffic from cryptokittie might be causing an issue and I am not setting a high enough transaction fee. Is there something else I am missing or overlooking?

Thanks!


texts: What does 'p.recipient.call.value(p.amount * 1 ether)(transactionBytecode);' do?

texts:
Ok, I've seen this at the DAO (Distributed Autonomous Organization) sample tutorial here. And I also looked it up at some other places like the official Solidity documentation here for instance. But I still can't understand what is going on at that line.

I know p is a proposal struct, from which the recipient is a member of type address. So I guess it just boils down to 'call' and 'value' attributes or method, whatever they are.

I read 'call' is a method, but here it is being referenced as if it were an attribute. And what's that funny thing about using two sets of parentheses over there? is the first function returning another function that we are executing?

Best regards

Nelson R. Pérez


texts: How to diagnose a "Error: Transaction has been reverted by the EVM"?


texts: How to I initialise an array inside the contructor in solidity?

texts:
I'm using the remix IDE.I want to define the size of the array at the time constructor is called. Someone please help.
This is what I tried :
pragma solidity >=0.7.0 <0.8.0;
contract Vote
{
    struct Proposal
    {
        uint votecount;
    }
    Proposal[] proposal;

    constructor(uint no)
    {
        proposal=new Proposal[](no);
    }
}

Error: UnimplementedFeatureError: Copying of type struct Vote.Proposal memory[] memory to storage not yet supported.
Another :
pragma solidity >=0.7.0 <0.8.0;
contract Vote
{
    struct Proposal
    {
        uint votecount;
    }
    Proposal[] proposal;

    constructor(uint no)
    {
        for(uint i=0;i<no;i++)
            proposal.votecount.push(0);
    }
}

Error: TypeError: Member "votecount" not found or not visible after argument-dependent lookup in struct Vote.Proposal storage ref[] storage ref. proposal.votecount.push(0); ^----------------^


texts: How do I reference "ETH" when using Kyber?

texts:
https://etherscan.io/dapp/0x818e6fecd516ecc3849daf6845e3ec868087b755#readContract
For example, the getExpectedRate() function requires two Token addresses. I want Ether and Dai.
What do I put for Ether?
In their docs it says to put '0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', but this causes an error when I try. Any ideas?


texts: Geth returns txhash of sendTransaction() but nothing is broadcasted on Ethereum blockchain

texts:
I have a strange issue with Geth. The code I've written is based on web3.php and worked well up to now. Currently, I'm testing sending ETH via sendTransaction() method. The operation finishs and I receive the txhash, but when I browse in in explorer, nothing appears regarding to this transaction!
This is the final result: https://etherscan.io/tx/0x820bdb5d81b8822eee95dee491763df34f24efbf82abc32f4002fbe9765559ba

I don't receive any error while sending transaction, and I got really confused why this problem happens :(
May you help me please?

Edit1: this is my code:

$from = 'SenderETHAddress';
$to = 'RecipientETHAddress';
$value = '0x38d7ea4c68000';
$GLOBALS['eth']->sendTransaction(['from'=>$from, 'to'=>$to, 'value'=>$value], function ($err, $data) {
    if ($err !== null) {
        echo $err->getMessage();
        return;
    } else {
        print_r($data);
        return true;
    }
});

And I receive the txhash in result of operation. One of received results was:
0x820bdb5d81b8822eee95dee491763df34f24efbf82abc32f4002fbe9765559ba

Edit2:
I also tried sendind ETH through Geth itself via its console. I ran:

eth.sendTransaction({
   from:'0x33D8A484e113480E37010201BF7569bDCb5fec33',
   to:'0xa96Ce4C161271C797d979017821A278e1481eAfA',
   value: web3.toWei(0.00001, "ether")
})

And this was the result:

"0x922636876cb53d44933e81eb99b0d67a5067b591779bc83b491c37ddf0cfe178"

But again, there is nothing related to this transaction hash on the network!


texts: ReferenceError: artifacts is not defined running Truffle Test

texts:
I am trying to execute the built in until test provided in the metacoin example. I installed Mocha into my project.

I then execute this command: npm test from my console.

I am getting the following error:

C:\Dev\Blockchain\TruffleDemo\test\metacoin.js:1
(function (exports, require, module, __filename, __dirname) { var MetaCoin = artifacts.require("./MetaCoin.sol");
                                                                                ^
ReferenceError: artifacts is not defined

Any ideas on what I might be missing? Thank you for the assistance!


texts:
So I'm only using Infura and web3 here, no local node running and I want to use functions like :

mycontract.methods.function(msg).send({from: address, gas: 200000})

it won't work because it is a state changing transaction, so I need to sign.

so I have:

var signed_data = web3.eth.accounts.sign(web3.utils.fromAscii("A20160528"), private_key);

and it return to me:

{ message: '0x413230313630353238',
  messageHash: '0x0a30d111fed6dbde69984b1763cde3f45838c870df0132da723731d3ea1c7225',
  v: '0x1b',
  r: '0xd36db528de6bc8ba97c8dffa27fe94288af53f26b82eb5acc6983a849db99902',

s: '0x69b3e6e8ddc69eeda0774bab2801b724f7dfa9cbfed60b4fa70637d420b91b05',
  signature: '0xd36db528de6bc8ba97c8dffa27fe94288af53f26b82eb5acc6983a849db9990269b3e6e8ddc69eeda0774bab2
801b724f7dfa9cbfed60b4fa70637d420b91b051b' }

How should I pass this to the web3 function such as :

mycontract.methods.function(msg).send({from: address, gas: 200000})

what should I put into msg variable?


texts: Difference between Ethereum Web APIs and Ethereum API as a service

texts: I am approaching ethereum for the first time and I am reading the documentation. Can anyone explain the difference between Ethereum Web APIs (BlockCypher) and The Ethereum API as a service (infura)? Https://ethereum.org/en/developers/docs/apis/backend/#available-libraries


texts:
I don't quite understand this concept yet but is this term related to this question/answer?

Link: what is the role of relayer in 0x protocol?


texts:
Here's a contract that I want to attack using recursive call:

contract Abstract {
    function foobar();
}

contract B {
    uint stateVar;
    function foo(Abstract someAddress){
        someAddress.foobar();
    }
    function bar(uint x) {
        stateVar = x;
    }
}

Here's a malicious contract deployed at some other address:

contract MaliciousContract {
    function foobar() {
        //What do I need to put here to make **B.bar(255)** possible?
    }
}

From solidity docs:

  Any interaction with another contract imposes a potential danger,
  especially if the source code of the contract is not known in advance.
  The current contract hands over control to the called contract and
  that may potentially do just about anything. Even if the called
  contract inherits from a known parent contract, the inheriting
  contract is only required to have a correct interface. The
  implementation of the contract, however, can be completely arbitrary
  and thus, pose a danger. In addition, be prepared in case it calls
  into other contracts of your system or even back into the calling
  contract before the first call returns. This means that the called
  contract can change state variables of the calling contract via its
  functions. Write your functions in a way that, for example, calls to
  external functions happen after any changes to state variables in your
  contract so your contract is not vulnerable to a recursive call
  exploit.

What I'm trying to achieve is:

  This means that the called contract can change state variables of the
  calling contract via its functions.

So, my actions are:

I call B.foo('maliciousContractAddress');
...


texts: Catching signals with node.js - unexpected behaviour

texts:
I'm used to catching SIGTERM and SIGINT on my node.js scripts. I use process.on('SIGTERM',function(){ <stuff> }); and I can call other functions that revert some changes before closing, or just print "you pressed ^C !", do nothing else and the script keeps running if I want to.

It doesn't work since I added web3. When I press ^C is pauses the script and I can't do anything. I have to kill the process by pid on another terminal.

The most blocking operation is accessing data from a contract loaded in the beginning of the script. Something like:

valueA = mycontract.mappingA(key);
valueB = mycontract.mappingB(key);

This operation takes about 250ms and is repeated a lot of times, so I'm almost sure the script is on that part when I press ^C.

I tried putting that part in a try/catch construct but it still won't do what is on the catch part.

Why is this happening ? Can I make it work or should I stop catching SIGINT and SIGTERM ?

If you need extra info, on my process list (ps aux), under node myscript.js there is a script called [nodejs] <defunct>. The "state" part indicates node myscript is Rl+ (Running or runnable, multi-threaded, on the foreground process group) and [nodejs] <defunct> is Z+ (defunct/zombie, on the foreground).


texts: Transaction has been pending for long time

texts:
I send funds using MetaMask. But,maybe I didn't put enough gas.
So it's stuck with other payments that I made after first payment.

Transaction is..

0x1335976d538aa0ca13ba62dd74af884d9d8050bebf331ca2755edaf48798da73

This means that I losed the funds?


texts: What do Ethhash and CliqueConfig refer to in the genesis config?

texts:
I don't see any real documentaiton on what these are or to what they refer.

Here is the structure in the config file:

// Various consensus engines
Ethash *EthashConfig `json:"ethash,omitempty"`
Clique *CliqueConfig `json:"clique,omitempty"`

Can I get a technical breakdown of what they are, how they work, and what they do?


texts: I can't migrate the contract using truffle init

texts:
I am working to build a Dapp using Ganache, Web3, and Truffle frameworks. I am unable to compile the contracts using truffle compile. I am facing an error. I want to explain you in detail what I did.

Firstly I have created a directory by using

mkdir Election

Then I changed the directory to Election using

cd Election

Then I have used this truffle boxes to make the Dapp work simple

"truffle unbox pet-shop"

Then I have written a contract in the contracts directory Elections.sol

Then I went to the migrations directory and created a file for migrating  this contract using truffle migrate. Here I am facing the issue. I am getting a while compiling. I am attaching you both the Error and the file that I have created in the migrations directory. It will be good if you could please help me asap.

This is the migrations file that will be present in the migrations directory.

This is the Error file that I am getting when I am running

truffle migrate


texts: Why is my account still locked if I try to send a transaction?

texts:
I unlocked my account and get result true but if I try to send:

var transactionHash = await contractname.SendTransactionAsync(contractAddress, new HexBigInteger(calculatedGas.HexValue), new HexBigInteger(2), inputA);

I only get that my account is locked:

  Nethereum.JsonRpc.Client.RpcResponseException: account is locked

Has someone an idea why?


texts: Is it possible to create large-scale databases with an Ethereum Contract?

texts: The Ethereum white paper contains multiple examples of contract code using storage. How does this scale? What if an application requires a database with multiple gigabytes of data? Is that possible?


texts: How can I verify that a contract on the blockchain matches the source code?

texts: Given the (Solidity) source code of a smart contract, is there a way to deterministically compile the code and compare it with the code on the blockchain? I want to verify that the contract does what the source code claims to do and the author hasn't tampered with it.


texts:
I want to generate Mnemonic for creating an account, I was using the following code
and I got the error as

  TypeError: Cannot read property 'entropyToMnemonic' of undefined

I am sure I am missing something

> var ethers = require('ethers')
undefined
> const mnemonic =
ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16))


texts: Is light mode client able to serve JSON-RPCs?

texts:
Can Geth sync in light mode server JSON-RPC queries from DApps?
I know light nodes only store block headers but will it forward the JSON-RPC to other peers to get it served?


texts:
I was looking at the etherscan API and I did not find a request that would simply list the latest transactions done on the blockchain (so not dependent of an address).

Ideally I'd like to see the 1000 first transactions available here:
https://etherscan.io/txs

Everything I looked for was assuming I know the address sending/receiving the tokens. But here I just want to get all the latest transactions.

Alternatively is there something that would give me all the transactions done in a particular block? In that case I could just say give me all the transactions for the last 10 blocks and do my analysis afterwards.

PS: My end goal would be to monitor at a given time where is the trading activity concentrated. For example if I see that lots of ETHER is send to a specific address, I could look at this address to see what's going on: ICO or other.

Thanks


texts: Arrayify error, when passing a string as an argument to a transaction

texts:
I have been having this problem with the web3 library for a while now and I am not sure how to solve.
I am encoding a transaction within a react app. So far, all contract interactions inside the app with the same contract are going smoothly, this problem seems to have arisen when I am using a string as a method argument.
Here is the method I am calling in my contract:
function sendShardToShardOwner(address _shardOwner, string memory _shardURI) public onlyOwner
    {
        require(shardHolders[_shardOwner], "Not a valid Trustee");
        nftContract.distributeShard(_shardOwner, _shardURI);
    }

The contract takes two parameters as arguments, an address and an IPFS URL as a string.
When calling the below method to encode the ABI, I receive the offending arrayify error.
const recoveryContract = new this.web3.eth.Contract(RecoveryContract.abi, this.recoveryContractAddress);
const data = recoveryContract.methods.sendShardToShardOwner(address, "QmbSo373odJ8HosMNYgsFGw5bfkKrG5GhkZwJX9KYNL4zu").encodeABI()

Log:
Error: invalid arrayify value (argument="value", value="516d62536f3337336f644a38486f734d4e5967734647773562666b4b72473547686b5a774a58394b594e4c347a75", code=INVALID_ARGUMENT, version=bytes/5.0.11)
    at Logger.makeError (index.ts:205)
    at Logger.throwError (index.ts:217)
    at Logger.throwArgumentError (index.ts:221)
    at arrayify (index.ts:136)
    at toUtf8Bytes (utf8.ts:242)
    at StringCoder.encode (string.ts:15)
    at array.ts:62
    at Array.forEach (<anonymous>)
    at pack (array.ts:54)
    at TupleCoder.encode (tuple.ts:23)
    at AbiCoder.encode (abi-coder.ts:106)
    at ABICoder.push../node_modules/web3-eth/node_modules/web3-eth-abi/lib/index.js.ABICoder.encodeParameters (index.js:121)
    at index.js:439
    at Array.map (<anonymous>)
    at Object._encodeMethodABI (index.js:438)
    at RecoveryContractManager.recoverPublicKeyFromUser (RecoveryContractManager.js:387)

Upon investigation, the value "516d6...a75" is the hex representation of the string I have passed as a parameter. From looking at the call stack, the error is being thrown within a web3 dependency "@ethersproject/bytes". I tried to reproduce the error in an isolated environment by encoding the transaction with identical parameters and I have had no luck reproducing it.
I am posting to see if anyone has had a similar error and if anybody has been able to fix it. So far I've tried the classics: isolating the error, downgrading my web3 a few times, redeploying my contracts, reinstalling node modules, all with no luck.


texts:
can someone explain how all the other nodes, except the one that found the block, are incentivised to verify if the block miner(creator) has done the smart contract code execution correctly ? Only the miner gets the reward, so it is possible that other nodes lose motivation to recalculate that( in ethereum docs it's written that the smart contract execution is done by every node in the network ) ? They may lose it in case for example when they don't want to lose internet bandwidth or additional CPU cycles for that. They may think :
"oh, everyone is doing that so maybe I would be better off when I just don't do it ? I can save 100$ a month in terms of CPU cycles."
I am sure there is some misunderstanding from my side, can someone explain ?
Thanks


texts: Blockchain synchronization never ends (Geth)

texts:
Ask me a question, please ... I installed Geth to mine Ethreum, I made all the settings correctly, but the synchronization does not end. I used the eth.syncing command and believed that when currentBlock reached HighestBlock, blockchain synchronization would end. However, when the currentBlock comes close to the HighestBlock value, the HighestBlock increases the value. I don't know when it will end. My computer has an i5 processor, 8GB Ram and I am saving the blockchain on an external hard drive.
(I used the google translator).


texts: When calling eth_getLogs, should I worry if a block is mined?

texts:
I call eth_getLogs to store some data in the database. In https://eth.wiki/json-rpc/API#eth_getLogs it says:
fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
So should I be worried that not yet mined transactions can be reverted?


texts: How new ethers came in existence on rinkbey testnet?

texts: Hi I know we can get some ether requesting the automated rinkbey faucet but apart from that is there any way we can mine ethers on rinkbey and if we cannot mine them then what dictates transfer or addition of new ether on the testnet?


texts: What is relay in ethereum?For doing transactions, any difference? I am not sure the concept of relay, it looks like one account can pay gas for transaction on another account.


texts: Passing blocknumber to eth.contract.method.balanceOf

texts:
I read that there is an option to pass blocknumber to contract.methods.balanceOf
I am currently passing it like this:

const address ='0x6C1F09F6271fbE133Db38DB9c9280307F5d22160';
  contract.methods.balanceOf(address).call((error, balance) => {
    contract.methods.decimals().call((error, decimals) => {
    //   balance = balance.div(10 ** decimals);
      console.log(balance);
    });
  });

Any ideas how to pass the blocknumber into this?


texts: Clique: New added signers won't show up on other nodes and mining new blocks stopped

texts:
I have followed following answer about How to add new Sealer in Geth 1.6 Proof of Authority?.

Currently I have one signer account 0x4e4a0750350796164d8defc442a712b7557bf282. With one signer the mining was working without any problem. My signer account proposed a new signer account using propose() function.

clique.propose("0x5b29ede59ecff473fb5760a53dbacc21cbc5b3dd", true)

On my signer node and other nodes, I can see the new address on my signers list (clique.getSigners()),

clique.getSigners()
["0x4e4a0750350796164d8defc442a712b7557bf282", "0x5b29ede59ecff473fb5760a53dbacc21cbc5b3dd"]

Than on my other node which has 0x5b29ede59ecff473fb5760a53dbacc21cbc5b3dd I have unlocked that account and run miner.start() command, but no help on mining new blocks on the network. So network stop mining new blocks :(

Also new signer account does not show up on my other connected node, which has the account for new added signer.

Now, I cannot also remove the newly added signer using:

clique.propose("0x5b29ede59ecff473fb5760a53dbacc21cbc5b3dd", false)

Please note that both signers are unlocked and miner.start() is active.

[Q] How could I solve this problem?


texts: What are function types in Solidity used for?

texts:
Can you provide an example of when and why you would want to define and use a function type, as a opposed to simply calling a function?

I understand how from here: https://ethereum.stackexchange.com/a/32464/44907

I just don't understand why.


texts: Possible Library Linkage problem on deployed contract at `remix-alpha`, that actually works on JavaScript mode

texts:
I guess this error is related to following closed issue, which still exists. The issue closed recommending us to use remix-alpha, but remix-alpha still has the same error or I might be doing something wrong.

=> Is there anyone else facing with similar problem?

Deployed file names:

Lib.sol         # Library contract //uses around 1,600,000 GAS to be deployed.
myContract.sol  # Main contract    //uses around 3,400,000 GAS to be deployed.

I have tested my contract and it works perfectly fine on populus and remix's JavaScript VM mode. So there is no issue on the contract's code and its implementation.

But whenever I deployed my contract on the remix-alpha; and tested my code on the deployed code as on Web3 Provide mode, if there is a call to Library function, the function call crashes (thrown) at that point.

I really don't know what causes this problem. This error is pretty annoying costing me hours and ether for each deployment, and facing contract does not work as it should be.

As simplified, I have an emptied Library function call:

Lib.sol:

/* Simple Library function */
function constructCluster() public {

}

When there is a call to that function; the function call is reverted().

myContract.sol: cluster.constructCluster(); //Contract is reverted()

[Q] Is there anyway to fix this issue? I am out ot options. The only solution comes to my mind to merge main contact and Library contract but when I merge them I face with following error: SolcError: InternalCompilerError: Static memory load of more than 32 bytes requested.

=> Instead of using remix browser, if I deploy my contract from geth-console would it help to fix the problem?

Please note that: I have tried shorten the contract's name and deploy at http://remix.ethereum.org/. But the exact same contract gives same linkage problem on JavaScript VM mode at remix.ethereum.org that actually works at https://ethereum.github.io/browser-solidity 's JavaScript VM mode.


texts: Sending an event to a particular user account

texts: I am trying to send a notification to a user on some activity. I tried to use events but when an event is triggered, it goes to all the user accounts that are currently active on the network. Is there some other way to do the same thing in Ethereum.


texts: How to add ethereum node to already existing blockchain without knowing genesis file?

texts:
Target : i want to add new node to already running blockchain.
Correct, if i am wrong for adding node to network. two node's should have same genesis block. if genesis block have different values then newly setup node will not be able to mine the transaction from already running blockchain.
Issue : i dont have gensis.json for creating same gensis block on new node.
Tried : i have tried to setup gensis block but live blockchain gensis block value is different from newly setup on local system. Checked by connecting to geth console and running following command in console.
admin.nodeInfo

so when i add peers using following command it returns true.
admin.addPeer("endoevaluefromec2instance")

when i list peers on ec2 instance it shows count 0.
0

Note : i am able to connect to blockchain using web3 module so i don't think there is connectivity issue
Question :
How can i create gensis.json file from already running etherum instance ?


texts: How to make sure an external smart contract can only call one function in my smart contract per transaction?

texts:
How do I make sure that only users and smart contracts can call one function per transaction?
Say I have two functions:
function foo() {}
function bar() {}

It's ok to call each function in isolation, but calling both functions in the same transaction leads to an exploit. So in a given transaction only one of those functions at most can be called.


texts:
I am compiling the code available at using "truffle test":
https://michalzalecki.com/ethereum-test-driven-introduction-to-solidity/
pragma solidity 0.5.16;
import "truffle/Assert.sol";
import "../contracts/Funding.sol";

contract FundingTest {
   function testSettingAnOwnerDuringCreation() public {
      Funding funding = new Funding();
      Assert.equal(funding.owner(), this, "An owner is different than  deployer");
   }

}

I am getting the following message:

$ truffle test
You can improve web3's peformance when running Node.js versions older
than 10.5.0 by installing the (deprecated) scrypt package in your
project Using network 'test'.
Compiling your contracts...
===========================

Compiling ./test/FundingTest.sol

/FundingTest.sol:8:7:
TypeError: Member "equal" not found or not visible after
argument-dependent lookup in type(library Assert).
Assert.equal(funding.owner(), this, "An owner is different than  deployer");
^----------^
Compilation failed. See above. Truffle v5.1.27 (core: 5.1.27) Node
v8.10.0


texts: Testing the fallback function with Truffle

texts:
I have the following fallback function:

uint public success;
function() public payable {
  success = 111;
}

I'm testing it with Truffle using this code:

beforeEach(async () => {
    this.icoInstance = await ico.deployed();
    await this.icoInstance.sendTransaction({
       value: 33,
       from: investor,
       gas: 300000
    });
});
it('should have been called', async () => {
    var success  = await this.icoInstance.success.call();
    console.log("success: " + success.toString());
});

Yet the console output says success: 0, meaning the function hasn't been called.

Wha am I doing wrong?
How do I test the case when a user sends some ETH to my contract?
I've heard that the fallback function doesn't have enough gas to even set a variable, so how do I can do something whenever the contract receives money? My purpose is to save the sender's address to an array or a mapping.

UPDATE: it seems like the problem is with how my contract is instantiated. The code fails when I use this.icoInstance = await ico.deployed(), but succeeds when I change it to this.icoInstance = await ico.new(this.tokenInstance.address, {from: owner}). Another strange issue is that even if I initialize the success variable, it still says success: 0.

The deployment code is supposed to deploy two contracts:

module.exports = function(deployer, network, accounts) {
  deployer.deploy(NppToken)
    .then(function () {
      deployer.deploy(CrowdSale, NppToken.address);
    });
};

The second contract is the one that has problems.


texts: Building geth from the bsc project fails with "checksum mismatch"

texts:
I have cloned the bsc project from binance-chain on github and building from the master branch fails to with the following message:
make geth

Output:
env GO111MODULE=on go run build/ci.go install ./cmd/geth
>>> /usr/lib/go-1.14/bin/go install -ldflags -X main.gitCommit=46d185b4cfed54436f526b24c47b15ed58a5e1bb -X main.gitDate=20210403 -v ./cmd/geth
go: downloading github.com/btcsuite/btcd v0.20.0-beta
go: downloading google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
verifying github.com/btcsuite/btcd@v0.20.0-beta: checksum mismatch
    downloaded: h1:DnZGUjFbRkpytojHWwy6nfUSA7vFrzWXDLpFNzt74ZA=
    go.sum:     h1:PamBMopnHxO2nEIsU89ibVVnqnXR2yFTgGNc+PdG68o=

Is this a bug, or might I have some misconfiguration locally?
Here are the go and gcc versions I am using:
$ go version
go version go1.14.4 linux/amd64
$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110


texts: Does the order of function parameters matter in regards to variable types?

texts:
e.g: which of the two are worse?

// A
foo(uint8, uint8, bool, bool)

// B
foo(uint8, bool, bool, uint8)

Should arguments be optimised and packed properly like structs (A)? Or does it not matter?


texts: How to call a method of another contract with given value?

texts:
How to call a method in another contract with given value?
contract A {
  function f(int256 a, string b) { ... }
}

How to call A.f from another contract B with say 0.5 ETH value (if B was called with say 1 ETH value)?


texts: Gas requirement of function () high: infinite

texts:
Please help explain why a very simple function gets "Gas requirement of function <function_name>() high: infinite" warning in Remix. Here is my simple contract:

contract Simple_Contract
{
    uint[]      public m_raw;

    function addRaw(uint _id) public
    {
        m_raw[m_raw.length++] = _id;
    }

}

It seems that uint[] causes this problem. If it is a case, how to use a dynamic array in the contract?


texts:
I'd like to see code that implements getAccounts and sendTransaction in a provider.

I tried digging into the Metamask source code and found the line where Metamask supplies the Web3 provider, but I couldn't figure out where this provider implements sendTransaction or getAccounts.

How/where are these methods implemented?


texts: I tried to convert my Dexkit Tokens to Bep20, Transaction failed, but I lost my crypto?

texts:
This is the Hash: 0xb49d9f560980ec438a9ee6c370d4fff8261971c602338bc5d053d01006d71b34
Im not sure what I did, but I thought it cancelled. My Dexkit Tokens nevertheless are gone and don't show up in my Metamask. Anyone can explain this Operation to me? Im new to this kind of crypto trading stuff.
Thanks already for helping!


texts: are there "public" ethereum nodes? or any recommendations on hosting solutions?

texts:
I've always ran apps on Heroku. Just developed a smart contract and I need to check the blockchain from the app. Are there public nodes I can connect to to get the info I need to show on my app?

If not, have you set up an ethereum node on a hosting service you can recommend?

Thanks


texts:
What are the keys and values of storageRoot? Values are probably whatever info the contract needs to store, right?

Is the storage tree of non-contract accounts empty, and thus the storageRoot, hash of the empty key, value pair? If not, what is stored there?

Thanks a lot for your time and efforts.


texts: Why Ethereum Wallet shows Xxx blocks left but doesn't catch up (for 2 hrs)?

texts:
Just started using the latest version of Ethereum Wallet from official website. This is the second day actually. Last night it sync-ed all night and seems to be ready for use. Today I started it, and later it discovered 200+ blocks to sync, and but now it stays at 196 left and 39%, and haven't moved since (for 2 hours).

Wondering if this is expected, and trying to understand what it could be doing to catch up?

Further more, about how Geth work maybe: how can it discover there are a number of blocks to be sync-ed before receiving them? I thought the process of blockchain is that clients receive block chains from peers and always keep the longest ones. Seems to me that means clients will know the content of the blocks when they receive them.


texts: How to type-cast contract type to address type?

texts:
Contracts can be explicitly converted to and from the address type.
In solidity docs, it's mentioned that the contracts can be converted into an address type. But when I try to do so the compiler gives me the following error. Explicit type conversion not allowed from "type(contract)" to "address"
What I'm exactly trying to do is the following
contract A {
    // some logic
}

contract B {
    //some logic
}

contract C{
    address a = address(A);
    address b = address(B);
}

The error I'm getting:-

Explicit type conversion not allowed from "type(contract A)" to "address". address a = address(A);

Explicit type conversion not allowed from "type(contract B)" to "address". address b = address(B);

This is the link for the doc where I saw this could be done.


texts: What does "code and ABI that are needed by web3" refer to in solc / nodejs

texts:
var input = "contract x { function g() {} }";
var output = solc.compile(input, 1); // 1 activates the optimiser
for (var contractName in output.contracts) {
    // code and ABI that are needed by web3
    console.log(contractName + ': ' + output.contracts[contractName].bytecode);
    console.log(contractName + '; ' + JSON.parse( output.contracts[contractName].interface));
}

Everything is working out, but when I get lost the last part, I'm unsure of what values to input in the first parentheses, and the //code and ABI that are needed by web3. Can you please help?

for (var contractName in output.contracts) {
    // code and ABI that are needed by web3
    console.log(contractName + ': ' + output.contracts[contractName].bytecode);
    console.log(contractName + '; ' + JSON.parse( output.contracts[contractName].interface));
}


texts: I am a student of Information Security and my teacher has given me the task to know about the details of auditing that is being done on Ethereum smart contracts that are written using solidity. Details like what are the parameters that are checked, how is auditing carried out, and what is the role of inline assembly in performing this task. I've searched a lot on internet but did not find anything useful. Can anyone of you please guide me or provide me the track which I can follow to achieve this task?


texts: The contract code couldn't be stored, please check your gas amount - truffle migrate

texts:
I'm working with smart contract development, and using Truffle framework.
It was working before, but after adding one more function in my smart contract and it stopped working on migrate.

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

I've tried with full gas limit(i.e. 4712388) though issue is persist.

Comment out newly added code, and it starts working again.. any clue?

Edit:
Newly added functions(tested on Remix, working fine):

function validateDoc(
    bytes32 _a,
    string _b,
    uint256 _c
    ) internal view
    returns(bool, string){

    if(condition 1){
        return(false, "failure message1");

    }else if(condition 2){
        return(false, "failure message2");
    }
    }else if(condition 3){
        return(false, "failure message3");
    }
    }else if(condition 4){
        return(false, "failure message4");
    }
}

function Main(
    bytes32 _a,
    string _b,
    uint256 _c
) public returns(bool _success, string _message) {

    (_success, _message) = validateDoc(_a, _b, _c);

    if(_success) {
        // Other code
        // ...
    }
    return (_success, _message);
}


texts: Retrieved Uniswap token price from smart contract is inaccurate compared to the one displayed on Uniswap interface

texts:
I'm trying to create a bot using JavaScript that interacts with Uniswap's smart contracts. I have been using UniswapV1's factory and exchange contracts, and I was using the getEthToTokenInputPrice method to get the prices for token pairs.
But as I was getting the prices of LINK, KNC, and DAI when exchanging for ETH, I noticed that they are inaccurate when compared to the prices on the Uniswap interface.
For example, the returned price I got from the smart contract for ETH-DAI is 1674, while the Uniswap interface says 1669. For ETH-KNC, it's 591 versus 796. For ETH-LINK, it's 49 versus 58.
Are these differences in price natural or incorrect? Should I switch to V2 instead?
I've been using these contracts below if it helps you understand the problem I'm having.
Uniswap Factory Contract: https://etherscan.io/address/0xc0a47dfe034b400b47bdad5fecda2621de6c4d95#code
Uniswap Exchange Template: https://etherscan.io/address/0x09cabec1ead1c0ba254b09efb3ee13841712be14#code


texts: Getting history of owners in LandRegistry using Solidity

texts:
I am trying to create a contract for "Land Registry".

A property can be sold by the user who owns it. I've created a function
transferProperty(address _from, address _to, uint _propertyId) which transfers the ownership of the property from '_from' to '_to'.

I want to create a function
getHistory(uint _propertyId) that returns me the address of it's past owners.

eg, Let user1, user2, user3, user4 be the four users and 1 be the property ID.
transferProperty(user1, user2, 1) // property 1 transferred from user1 to user2.
transferProperty(user2, user3, 1) // property 1 transferred from user2 to user3.
transferProperty(user3, user4, 1) // property 1 transferred from user3 to user4.

I want getHistory(1) to return user1->user2->user3->user4.


texts: Will Ethereum transaction fees reach Bitcoin transacion fees?

texts: If hypothetically Ethereum market capitalization reach Bitcoin market capitalization, will Ethereum transaction fees be equal to Bitcoin transaction fees? Or what would be cheaper?


texts:
I am using this function to create a new contract instance of Match contract which takes 4 parameters.
However i am getting this error message "invalid implicit conversion from contract to address requested contract".
I have no idea how to address this.

function newMatch(uint _matchId,uint _noOfGames,uint _oddsOfA, uint _oddsOfB) public returns(address newContract)
      {
        Match c = new Match(_matchId,_noOfGames,_oddsOfA,_oddsOfB);
        contracts.push(c);
        return address(c);
      }


texts: In Parity, what is the equivalent RPC call to geth's txpool_content?

texts:
There are several useful txpool queries in geth: txpool_content, txpool_inspect and txpool_status. Since these are not part of the general standard, Parity likely has some other name for the same mechanism.

Ideally, I would get a list of transaction details or hashes that are pending for a supplied account. Although, geth doesn't have an option to filter the results by account, as far as I can tell.


texts: Smart contracts and IoT: how will they call the physical world?

texts:
Ethereum and IoT: if smart contracts cannot contact the "outside world", how will they trigger car unlocks and other things with the "smart" property?

An AirBnB example: a smart contract between two parties that will unlock an apartment for a specified period of time.

Are oracles used?  How might this work?


texts: Is it possible that a contract address is same as a external address?

texts: For example i create a contract first, and then i generate a private key that map to the contract address. I know that is hard to achieve but is it possible theoretically?


texts: Can we eliminate specifying solc compiler version at the beginning of each smart contract.

texts: Is it possible to eliminate specifying the solc compiler version at the beginning of each smart contract. This would help in separating the compiler version from the smart contract, so if the compiler version changes one could still possibly compile the contract if there are no major changes.


texts: How to allow only the owner to transfer ERC20 tokens during crowdsale?

texts:
I recently came accross an ICO that used temp wallets. The tokens were sent to the investors manually which means that not everyone received their tokens at the same time. Until everyone received their tokens, they were locked for transfers. However the owner was able to transfer the tokens to the investors. For learning purposes I tried to reproduce this logic and I was wondering if my attempt could actually be used in terms of efficiency and security. The transferFrom function has the same logic.

Thanks for your feedback.

function transfer(address _to, uint256 _value) public returns (bool success) {
    require(
        balances[msg.sender] >= _value
        && _value > 0
    );
    if(locked == true){
        if(msg.sender == owner){
            balances[msg.sender] = balances[msg.sender].sub(_value);
            balances[_to] = balances[_to].add(_value);
            emit Transfer(msg.sender, _to, _value);
            return true;
        }else{
            revert();
        }
    }else{
        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        emit Transfer(msg.sender, _to, _value);
        return true;
    }
}


texts: Change ERC20 Transfer function to account for contract as sender

texts:
I have a contract we will call A that uses the transfer function from an ERC20 contract we will call B through an interface.  However, the transfer function will not work as expected because in the call from user -> A -> B the msg.sender is now the contract address of A and not the user's address anymore.

I can think of two immediate ways to solve this.

Pass the original msg.sender (user's address) as a param to the transfer function
Change msg.sender in contract B's transfer function to tx.origin

However both of these solutions modify the ERC20 token standard contract which I am not sure if that is good practice.

I can see how this could be a common issue devs run into. Should I implement one of the above solutions even though it changes the standard contract? If not, then how should I solve it?


texts: Trouble estimating gas cost of function in Remix console

texts:
I'm trying to follow a tutorial for estimating the gas cost of a function.

https://cristian.io/post/estimate-gas/

Thus after deploying my contract I type in this code in the Remix console to get the gas estimate of calling an arbitrary funtion (substituting in my contract details):

var contractABI = [ ... ];
var contractAddress = '0xxxxx';

var contract = web3.eth.contract(contractABI);
var contractInstance = contract.at(contractAddress);

var estimatedGas = contractInstance._mint.estimateGas('0x123', '5');

I get this response in the Remix console window:

Cannot read property 'estimateGas' of undefined

Am I doing something wrong? Or is Remix unable to fully utilize web3 in the console?


texts:
Imagine that I have a contract where a user can buy and sell tokens based on a dynamic price in ETH.

The price is calculated every 2 hours by a server. When buying or selling, the value used is the next one that will be produced in the future (not the past ones). This means that there will be 2 steps to buy tokens: requestBuy to send the ETH and save the request on a mapping for sender's address, and executeBuy to convert the amount to tokens based on the price and send it to the buyer (same for selling).

requestBuy is called by the client.
executeBuy is called by the server.

Question

Should the owner write the price into the contract and call executeBuy or should send the price as an argument to executeBuy? What are the trade-offs for each one?

Main criteria: transparency of price history in the contract vs public API