texts:
I have 2 contracts: my contract and an oracle contract. I make a request to my smart contract and send some data that needs to be processed. I use mySmartContract.methods.availability(value1,value2).send({"from":myAddress}).
After my contract gets the data, it has to make an asynchronous request to the oracle smart contract which takes information from an external data source. I read the answer to this question https://stackoverflow.com/questions/55302995/how-to-return-value-to-caller-function-in-asynchronous-javascript-and-web3js, but in my case who calls the 'caller' function on my smart contrac that calls 'responder' on the oracle smart contract?


texts: Error: CONNECTION ERROR: Couldn't connect to node (RPC & web3.js)

texts:
I am trying to access my Geth node through RPC from my UI (using web3.js)

My Geth command is:

geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr 'localhost' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --rpccorsdomain "*"

In the front-end :

web3 = new Web3(new Web3.providers.HttpProvider("localhost:8501"));

I am getting error:

Any suggestions? Thanks in advance.


texts: How to invoke a fallback function from Ethereum Wallet?

texts: I would like to invoke a fallback function of a contract from Mist Wallet. However, I am not able to see it in the drop down list of functions.


texts: When using Delegatecall or callcode, which Ether balance is used?

texts:
Simple question, but I couldn’t find the answer.

When contract A CALLCODE B, B will uses A’s ledger. But which Ether balance will be used if B makes a normal transfer, the balance of A or the balance of B ?


texts: Unable to Synchronize raspberry pi node my private network

texts:
I have created a private network with 3 nodes - two nodes in computer and one in raspberry pi

I connected computer and raspberry pi to same network through LAN

computer ip: 192.168.122.1

pi ip address: 10.1.200.157

enode of node1: "enode://f44eea7f09627b885f012ea3947dd676f01b13bb92a18216c497ec7cccce28d958b4fb9f9c942b5d41f8169cae5e6919350a95feb2b8a4f2e022a20801be282b@192.168.122.1:30303"

enode of node2:

"enode://b00916eb3723de7e2c2ad683283b184fe639c41e902316dbca8a457f353694e02f98e1b770ae2e1e7f6216a7332087fb2701a91d20d82758e8b74651754f4bb3@192.168.122.1:30304"

enode of pi node:
"enode://090c17aac6f826e5e771c925e36933407a799747bbe31856ea69fa11e9b906e4a24a28280a28dcfc9f0bb7960083f211759b5e4cebf4b4d66d8b79358b1fac3c@10.1.200.157:30305"

Iam able to synchronize the node1 and node2 and send some ether from node1 to node2 and viceversa.

But unable to sync pi node to node1 or node2 and unable to sync node1 or node2 to pi

when i give the following command in node1 console
admin.addPeer("enode://090c17aac6f826e5e771c925e36933407a799747bbe31856ea69fa11e9b906e4a24a28280a28dcfc9f0bb7960083f211759b5e4cebf4b4d66d8b79358b1fac3c@10.1.200.157:30305")

im getting True response but when i check admin.peers i can see only node2 synced.

same if i do in node 2 console i.e. i can see only node1 sync to node1


texts:
Although it compiles successfully
truffle migrate --network ganache gives the following error:
Unknown network "ganache". See your Truffle configuration file for available networks.
I believe I have it wired correctly
Truffle v5.1.34 (core: 5.1.34)
Node v12.18.0
Code sample:
const path = require("path");
require("dotenv").config({path: "./.env"});
const HDWalletProvider = require("@truffle/hdwallet-provider");
const MetaMaskAccountIndex = 0;

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: path.join(__dirname, "client/src/contracts"),

  networks: {
    development: {
      port: 7545,
      host: "127.0.0.1",
      network_id: "*"
    }
  },
  ganache: {
    provider: function() {
      return new HDWalletProvider(process.env.MNEMONIC, "http://127.0.0.1:7545", MetaMaskAccountIndex)

    },
    network_id: 5777

  },
  compilers: {
    solc: {
      version: "0.6.1"
    }
  }
};

I believe I have it wired in my truffle-config.js file correctly. Any idea why this is going on?


texts: Console logging in Truffle promises throws exception

texts:
Does anyone know why console.log in Truffle Javascript promises causes errors given below?

I have the following code, where as soon as I remove the console.log statements, the errors given below go away. How can I dump some text, or data to the console then?

Alternatively, can someone provide some resource where I can dump text or data to a storage somewhere for later review? The console.log statements are there to help me debug the code.

Thank you.

  it("Owner should be creator", async function() {
    TestOwnership.new({from: account_main}).then(async function(instance) {
      let currentOwner = await instance.getOwner.call();
      console.log("Hello world1");
      return currentOwner;
    }).then(function(owner) {
      console.log("Hello world2");
      assert.equal(owner, account_main);
    })
  });

  it("Owner can't be changed by outsider", async function() {
    let prevOwner;
    let newOwner = 0x0;
    TestOwnership.new({from: account_main}).then(async function(instance) {
      prevOwner = await instance.getOwner.call();
      await instance.changeOwner.call(account_outsider, {from: account_outsider});
      console.log("Hello world3");
      return instance;
    }).then(async function(instance) {
      console.log("Hello world4");
      newOwner = await instance.getOwner.call();
      assert.notEqual(newOwner, prevOwner);
    }).catch(function(err) {
      console.log("Hello worls5");
    });
  });

Errors as mentioned earlier:

Error: Error: VM Exception while executing eth_call: invalid opcode
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:59368:17
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:69306:5
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:11335:9
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:7895:16
    at replenish (C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:8415:25)
    at iterateeCallback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:8405:17)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:8380:16
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:11332:13
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:69302:9
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\ethereumjs-testrpc\build\cli.node.js:63982:7
    at Object.InvalidResponse (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:37312:16)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:220420:36
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:204149:9
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:2055
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:73069:
    at XMLHttpRequest._setReadyState (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:73359:12)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:73514:12)
    at IncomingMessage.<anonymous> (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:73474:24)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)


texts: msg.sender.balance returns a strange number

texts:
From a JS web3 file, I am calling a simple function that returns the wallet balance.

function readCustomerBalance() public view returns (uint) {
  return msg.sender.balance;
}

Works fine in Remix.

Trying to calling it via js file to display the wallet balance in my website I get a weird number.

This is the js function:

function getCstValue(){
  contractInstance.methods.readCustomerBalance().call().then(function(res){
    console.log(res);
  });
}

My wallet balance is: 31.3898ETH

The return value is: 180143953705057640000000000

I am getting crazy right now. Any idea??


texts: How many signatures maximum on a multi signature contract

texts: What would be the maximum number of signatures where it would cost about near block gas limit to verify and execute a transaction. What would be a reasonable number to limit and add other logic to a contract instead of high cost?


texts:
I mean if I have address A and no ethers on it.
And I will construct valid tx & and sign it with my privkey.
Can I send this raw signed tx to my friend with address B, and he will push it to the network.
He need to sign it, and gas will be taken from his B address, but in contract msg.sender will be set as address A, who initially signed this tx.

Is possible scenario like above?
I assume it is not at this moment.
But do Vitalik`s team want to implement something like that to be possible?


texts: What's the conditions of mining if someone has the most powerfull device in network?

texts: If in ethereum network a miner has a device with 10 power(for example) and another one has a device with 5 power. Is person 1 get the mining reward for ever? Or is it possible to person 2 mine some blocks?


texts:
What are the disk space requirements for a full sync in Ethereum network in the following cases:

Main Ethereum Network : 667.10 GB
Ropsten Test Network  : 26.2 GB
Kovan Test Network
Rinkeby Test Network

I google around but I am not able to view recent blockchain size of testnetworks. Main chain size could be found here.


texts: how to deal with bytes32 to string in javascript?

texts:
I am going to set a email address from users and going to save it to ethereum network.

I kept email as bytes32 in smart contract and when I am sending the value to javascript i am getting always a same bytes . when i use to convert to ascii I am getting '@' everytime. what can be the reason?


texts: Cannot install truffle. Node.js and npm are installed

texts:
I currently have
node 12.21.0  + npm 6.14.41 + macos big sur 11.2.1 + ganache 2.5.4 + command line for xtools 12.4
I read online that truffle does not support node v13, so i uninstalled the one i had (v15 or sthing) and switched to version 12.21.1.
The latest npm and node installations were done from their website (pkg files), not brew, because i do not know how to NOT install the latest versions with brew.
Here's 2 screenshots of attempt #1:

and

Here's attempt #2

I have been looking for an answer for HOURS, and nothing works. Save my life please.
edit: someone told me to check if /Users/aris/.npm-global/bin is in my path, but i have no idea how to do it. I googled it and tried a few instructions that put that directory in my path, but nothing changed.
Truffle also seems to be installed in my hard drive (as you can see at the screenshot bellow), even though when i check at the terminal if its installed, or try to call a command, i get that "command not found: truffle":

EDIT#2342 (excuse me for this btw) i checked and truffle is NOT in my path (screenshot bellow). Should i manually try and find the truffle executable file or sthing?


texts: Moving Ethereum Application Data - Secure?

texts:
There have already been some questions regarding moving Ethereum Wallet data under Windows, for example:

My C: drive in my WINDOWS PC is almost full. How can I change both geth and Mist path to relocate my blockchain files?

I see no problem with this when it come's to the block chain data. However, is it less secure to have the key store outside of the C:\Users\$username$ folder?

I am aware that to compromise a wallet, both the key store file and the associated password would be required.

(I might have written this as a comment in a previous question on this topic but I do not have high enough reputation.)


texts: Why won't Ethereum underlie the emerging smart contract economy?

texts:
The following post says

The new smart contract economy will not be based on ETH. The main
trand of development in this sphere now is the creation of private or
permissioned intercorporate, interbank and regulatory networks (under
the management of Central Banks) based on DLT-platforms of the
enterprise category: Quorum, Highperleger Factoric, Corda and so on.

Is this the opinion of the minority, that Ethereum will not succeed in underlying the impending smart contract economy? Whereas the majority of people already identify Ethereum to have first mover advantage and as being the one to take the lion's share of all smart contract interactions?
This is the first time I've ever even heard of  Quorum, Highperleger Factoric, Corda. And the quote is sounding alot like the governments would have all their hands in the new smart contract economy, when the central theme of the crypto revolution is to overthrow government overwatch.


texts:
This morning I sent REP from an Exodus wallet to Kraken, but it never arrived.

I checked the transaction and I saw :

TxHash:
0x1ca6810bd62642d748441cdc323dd6cbbdc19ff29f1f1d932decaa5bd5743a7e

TxReceipt Status:
Fail

Contract 0x48c80f1f4d53d5951e5d5438b54cba84f29f32a5 (REP-Augur-OLD)
 Warning! Error encountered during contract execution [Bad jump destination]
  The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender.

There was no warning whatsoever when I sent my REP, and I hope they are not lost forever... I sent from a valid address to another valid address, that should not fail in anyway...

The question is : what should I do ?


texts: How to deploy dependent contracts with Ethereum Wallet

texts:
I have two contracts (i.e. contractA, contractB) located in different files (i.e, contractA.sol, contractB.sol) to deploy. The contractB is dependent on contractA. In contractB.sol,

import "contractA";

The contractA has been deployed successfully to Testnet with Ethereum Wallet by putting source of contractA in tab "SOLIDITY CONTRACT SOURCE CODE". When contractB was deployed, Ethereum Wallet complained:

Could not compile source code. Source "contractA.sol" not found.

How to fix it?


texts:
Im trying to figure out the best way to approach a problem.

I would like give a user the ability to store documents that each have value. So each time they create a new document, they can add however much ether to that contract. The goal is for them to then be able to trade those contracts.

I thought about generating a new address for each document, but that would make it impossible to send them to another person.

Does anybody have any suggestions of how i can solve this? For dev, I am using node.js and web3.js.


texts: how difficult is it to link an address to an account?

texts:
Every wallet can generate as many addresses as I want in order to obfuscate the origin and destination of transactions.

But each account has exactly one key-pair and it is trivial to get the public key from the address.

Am I correct in assuming that it would be fairly easy to create a list of all the addresses belonging to a public key and by extension to an account? Or is there something I am missing?

The use case for such a database would be for law enforcement to find out who has sent money to whom, for example.


texts: SignTransaction with a private key and sendTransaction with an other account

texts: is it possible to sign a transaction with Alice private key and send the signed transaction using Bob account ?


texts: How to run multiple instances of Ethereum Wallet simultaneously on a Windows machine?

texts:
When I do Ethereum development, I'd like the run multiple instances of Ethereum Wallet at the same time on my work machine. For example, I have a ganache development node server, a private-net server with three geth nodes, and a full node mainnet server, currently I created three different Ethereum Wallet appdata folders, and sym-link the "%APPDATA%\Ethereum Wallet" system folder to one of the three different folders when launching Ethereum Wallet with a different script each time. However, that's not possible when I want to launch those three Ethereum Wallet instances at the same time as they all look for the same "%APPDATA%\Ethereum Wallet" system folder. For geth I know I can use --datadir option to specify an appdata folder different from the "%APPDATA%\Ethereum" system default, and then run multiple instances of geth simultaneously on one machine. Is there a similar option for the "Ethereum Wallet" application? Thanks.

EDIT: By "Ethereum Wallet", I mean the Mist-based official Ethereum Wallet application, downloadable from the the official ethereum.org website. https://github.com/ethereum/mist/releases


texts: web3.eth.getBalance('address') always returns a zero

texts:
Am trying to deploy a contract to "Ropsten Testnet" network. I have an account to which i have managed to transfer 6 ethers through faucet. My account's "ETH Balance" shows 6 ethers, from site https://ropsten.etherscan.io/address/. But web3.eth.getBalance('address') for some reason still gives me a zero balance on truffle console.

I am therefore not able to deploy my Contract to "Testnet".
I get an error as:

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: insufficient funds for gas * price + value

Below is my geth command.

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

Not sure why the 6 ethers are not reflecting on my personal account balance.


texts: Why use interfaces? I've heard this allows for easier bug fixes down the road, but with or without an interface, wouldn't you have have to scrap the bugged contract entirely?


texts: "Truffle unbox react" Not Working Properly

texts:
I am facing problems running the basic official setup of react and truffle. Here's what I did:

truffle init
truffle unbox react
truffle develop
truffle(develop)> compile
truffle(develop)> migrate

Then in another window:

npm run start

However the browser window containing http://localhost:3000/ that appears shows the following:

In the browser JS console, the following error appears:

Uncaught (in promise) Error: Failed to fetch
    at Object.InvalidResponse (bundle.js:45023)
    at bundle.js:34169
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:9904
    at completeRequest (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:9955)
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:678
    at replenish (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:1198)
    at iterateeCallback (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:1188)
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:1163
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:9832
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:9928

Any idea what is happening?


texts: Does the Genesis Block get the block reward of 5 ether?

texts:
Getting mixed information.

According to https://etherscan.io/block/0) it does and was mined by 0x0000000000000000000000000000000000000000 on July 30th but according to the Parity (archival mode) it does not.

Furthermore, the first transaction in or out of 0x0000000000000000000000000000000000000000 was on August 7th, so it doesn't appear to actually have gotten the block reward.

edit: sorry, apparently mined rewards are on this view of Etherscan: https://etherscan.io/blocks?m=0x0000000000000000000000000000000000000000&p=4

So apparently it did mine it and was rewarded? Can anyone confirm and give details / sources for more information.


texts:
I'm just getting started with Solidity and Truffle, and I'm quite confused regarding this example code:

App = {
  web3Provider: null,
  contracts: {},
...
  initWeb3: function() {
    // Is there an injected web3 instance?
        if (typeof web3 !== 'undefined') {
            App.web3Provider = web3.currentProvider;
            web3 = new Web3(web3.currentProvider);
        } else {
             // If no injected web3 instance is detected, fallback to the TestRPC.
            App.web3Provider = new web3.providers.HttpProvider('http://localhost:8545');
            web3 = new Web3(App.web3Provider);
        }
    return App.initContract();
  },
...
}

In the InitWeb3 function, it checks the type of a variable named web3, but it doesn't seem to be instantiated anywhere. I read that programs like MetaMask can "inject" a web3 instance, but how does this work? How does my program see it?


texts: How to show partial information on private transaction?

texts:
I want to achieve the following requirement in quorum blockchain.

   1) Participant A sells a red asset to Participant B for 100 dollars.
   2) Participant B paints the asset blue.
   3) Participant C cannot see the price for the
      transaction but can see the asset, owner and color.
   4) Participant D is added to the network with a new peer.
   5) Participant D can see the asset but is not allowed to paint
     it because he is not the owner.

If we do the private transaction(Node A and Node B) in quroum ,its not possible to see the transaction data for Node C. Because the txn is private for Node B. however i want to achieve the above requirement in quorum blockchain. So i would like to know that if there is any possibilities are available.


texts: How to reduce time for block confirmation in the Ethereum blockchain and also time to listen to logs emitted?

texts:
I am designing an application in which I am emitting logs through transactions in the Ethereum blockchain. I also created an event listener to listen to the new logs emitted. But I want time from emitting logs to the event listener to respond to it to be in few milliseconds.
But the problem here is the time taken to create a block is around 12 seconds and to get 5-6 blocks confirmations takes around 2-3 minutes which kills my service time and makes it difficult for real-time usage.
Any solution for it?


texts: Why don't wallets use web-based APIs instead of downloading entire blockchain?

texts:
I read other Q/A such as Why do Ethereum clients download the entire blockchain?, but no one addresses the question why the wallet can't just use a web-based API to read/update the blockchain when needed, rather than downloading and syncing the whole huge blockchain.

For years, I've worked the old client/server mentality, that the client just talk to a server where the data resides; even though it's a peer-to-peer network, why doesn't that model work here? Couldn't it randomly connect to someone node of a miner?

It looks like even the light-clients will download a certain amount of the blockchain as well?

Are all wallets considered "clients" then, by definition?

(I installed Parity on my C Drive, and it filled up the drive.  Seems like they should at least warn you of the space required on the install, then I would have chosen a different drive.)


texts: gasLimit 5000 on private Ethereum geth node

texts:
Problem:
I've upgraded my geth node to the latest version (1.9.0-unstable). The block gasLimit of the node is fixed at 5000:

eth.getBlock("latest").gasLimit

5000

When I try to send a transaction, I get the following error:

Error: exceeds block gas limit

Attempted fixes: I have tried to alter the default gasLimit value in the genesis.json:

"gasLimit": "0xffffffff"

From geth node command line option:

--targetgaslimit '9000000000000'

Point to note: On previous versions, i.e, before upgrading, the block gasLimit returned by the node was much higher and it let me  deploy contracts and perform transactions.

eth.getBlock("latest").gasLimit

4286582786


texts: How to generate an Ethereum address using Web3.js using a string of text or brain wallet?

texts: I want to implement a brain wallet like address generator using web3.js -- I basically have a string of text and want to convert this into an Ethereum address. How can this be done?


texts: Datatype for adding 0 as an initial number in the contact number list in Solidity

texts:
I have this type of list of contact numbers, [0825623456,0838956234], that I am storing inside solidity in uint256[] array. But when I get the list of that number in console or web application , I can only see the numbers like [825623456,838956234]. 0 has been removes as it is uint data type.

So, which data type can be used to store and fetch this type of numbers except string or bytes ?


texts: How an ethereum contract store its variables in blockchains?

texts: I would like to view variables of contract at each point-in-time.How an ethereum contract store its variables in blockchains and how can i parse  blockchains to explor contract and its variables?


texts: How to name an asset in ethereum? And associating quantity for that asset?

texts:
I want to create an asset say 'cotton' with quantity as 100 tonnes.
I want to use this asset for Trade and Finance. Please suggest how to create this asset with the given quantity.


texts: How to interact with smart contracts on Ganache from Express app

texts:
How can I interact with the smart contract on ganache from my express app using Web3.js
Any Tutorials?


texts: Can ERC20 tokens be traded on other blockchain based decentralized exchange?

texts:
I have a quick question to ask from you.
can we trade erc20 tokens on decentralized exchange which is built on custom replica of ethereum blockchain or you can say on a fork of ethereum blockchain. Although both are same but will be working on different networks.
So can we trade them on our own blockchain based decentralized exchange?

Thanks


texts: Is it possible to create new token at specific amount of USD Dollars?

texts:
In the real world,

let's say I have some Commodities Certificates each of the cost of 1000 USD $ and I want to create new tokens with the same value (in Ether).

USD Dollars and Ethers are volatil so in Solidity how can I deploy these new tokens?


texts: Is there an efficient way to get the metadatas of a list of token uri's? Like, what if I have a list of 50 token Uris, would the only way be to send a different get request to each url?


texts: Metamask doesn't allow me to approve transactions

texts:
Metamask does'nt allow me to click on confirm when I wan't to approve a transaction.
(i.e. the Confirm button is disabled and stays disabled whatever I do)

Because "Confirm" is disabled I can't do anything except 'Reject'
Store.js:30 Uncaught (in promise) {code: 4001, message: "MetaMask Tx Signature: User denied transaction signature.", stack: "Error: MetaMask Tx Signature: User denied transaction signature."}

Furtermore Metamask suggests a different account by saying: "Is this the correct account?  It's different from the currently selected account in your wallet" Yes, it is actually different and for a good reason. Both accounts have sufficient funds anyways.
What can I do against it?


texts: Any similar quasi Turing complete systems?

texts: In the literature, are there any remotely similar quasi Turing complete systems like Ethereum (EVM), that "charge" for each step of computation?  Anything that the EVM could learn from?


texts:
I've been reading through web3.js's API documentation and come across transactions using IBAN numbers. They appear to be alphanumerical values generated from the public address.

What is their role since they're not used for confidentiality reasons?


texts:
pragma solidity >=0.4.0 <0.7.0;

contract NewHello{

    mapping(address => string) public users; // contains a name for every address

    function updateUser(string memory name) public {
        if(string name != users[name]){
            users[msg.sender] = name; // set name for address
        }

    }
    function getUser(address userAddress) public view returns(string memory) {
        return users[userAddress]; // return address name
    }
}

well I have 2 func fist one set the name second one get the name.

my goal is :
I wanna check the users . if user isn't registered , register this user than return the user name use the getUser function.

when I compile my contract I give a error like this:
Expected ')' but got identifier if(string name != users[name]){ ^--^

my getUser func. works very well. I can get results which I want but I can't fixed the userUpdate func.

what should I do ? anyone can help me please :)


texts: Error: No "from" address specified in neither the given options, nor the default options

texts:
I am getting above error while transferring money from contract wallet to particular user wallet.

My contract code

pragma solidity ^0.4.17;

contract mypool{
    address public manager;
    string poolname;
    uint256 poolEndDate;
    uint256 poolAmount;

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

    mapping (address => uint256) public balanceOf;

    /*Payer information*/
    struct Payer {
        string name;
        address player;
        uint256 amount;
    }

    Payer[] public players;
    /*Entering Pool Information*/
    function enterPoolInfo(string name,uint256 endDate, uint256 amount) public {
        poolname = name;
        poolEndDate = endDate;
        poolAmount = amount;
    }
    /*Player information to join pool*/
    function enter(string name,uint256 amount) public payable {

        Payer memory m;
        // players.push(Payer{player:msg.sender,amount:amount});
        m.player = msg.sender;
        m.amount = amount;
        m.name = name;
        players.push(m);
    }

    function getBalance() public view returns (uint) {
        return this.balance;
    }

     function transferd(address _to) payable {
        // if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough
        // if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
        // balanceOf[msg.sender] -= _value;                     // Subtract from the sender
        // balanceOf[_to] += _value;

        uint256 balance = this.balance;
        _to.transfer(balance);
    }
}

I am using web3 method to transfer money
here is the code

let contract = new web3.eth.Contract(abi, address);
contract.methods.transferd('0x497fe03ba1dabf3b391079e8f69eb178243a736b')
    .send()
    .then(console.log)
    .catch(console.log)


texts: BI Dashboard (Tableau, Qlikview esque) for Ethereum/Quorum?

texts:
Most of the ethereum transaction explorers (etherscan) I have encountered does not have snazzy analytics capabilities. For enterprise, there is a need to analyse (sum, count, etc) the data in the transaction object.

Is there a BI analytics dashboard for ethereum/quorum?


texts:
I built out a fairly complex contract factory and I noticed the factory was only creating instances of itself, not the "child" contract.  After observing this I figured I was doing something wrong so I scaled back and tried to implement a super basic version first. However, I'm still observing the same behavior.  I wrote this in the Remix IDE and deployed it on the Javascript VM environment.

Here is my factory:

pragma solidity ^0.4.21;

contract ExampleContract {
    string public Name;

    function ExampleContract (string name) public {
        Name = name;
    }
}

contract Factory {
    address[] public contracts;

    function createContract(string name) public returns(address)  {
        address newContract = new ExampleContract(name);
        contracts.push(newContract);
        return newContract;
    }
}

Everything compiles and deploys fine.  When I use the createContract function it deploys a new instance of the Factory contract.  Am I missing something?


texts: How do I retrieve the transaction history of ethereum? I want to get all transactions that include this crypto currency for specific time periods. I looked at the ethereum API, but it needs some information regarding block number and transaction index which I do not know for all the transactions. Can someone please help?


texts: How to use an accessor for imbricated data types?

texts:
I'm looking at information about accessors in solidity/js for more complex data structures than just a public array/mapping.

How can i access the array in that code for:

struct AnotherStruct {....}
struct Example {
    uint example;
    uint[] exAmple;
    AnotherStruct[] strucs;
    mapping (uint  => AnotherStruct[]) structss;
  }
Example[] public examples;

From there i can do:

contractinstance.examples(index)  in JS

It returns an array of one element ( as the Struct) value : 'uint example'

How can i access the data in the struct from the examples public array?

uint[] exAmple;
AnotherStruct[] strucs;
mapping (uint  => AnotherStruct[]) structss;

I was expecting an array with like this : [uint example;uint[] exAmple,AnotherStruct[] strucs,mapping (uint  => AnotherStruct[]) structss]

Where i could just have done array[3].iteration  or array[4][uint] etc. but that doesn't seem to work that way.

Can anyone help?


texts: Symbolic decoding of a transaction for Solidity

texts: I have a Solidity contract source code and a raw transaction (hex) from blockchain. Is it possible for me to decode the transaction to its symbolic format, so I can see what contract methods are called and with which arguments?


texts: Hey if a contract only has a few state variables, what is the advantage/disadvantage of storing them in a struct?


texts: Is transaction history available as a part of the blockchain implementation, or do I have to implement saving token history myself

texts:
I am implementing a CryptoKitties style of ERC721 tokens, to be deployed on Ethereum. But I am not clear how to implement the transaction history of the individual token?

For example all the different ERC-721 tokens(artworks) will have different prices depending on their demand, and similarly they will have their own trading history, having sold at different prices and buyers. It makes sense to show this provenance, how it was sold when it was sold etc, as it related to the value creation of the artwork tied to the ERC721 token.

Do I have to implement this functionality myself, or is it a integral part of blockchain. If blockchain is a public ledger, then where/how can I get the transaction history of each token to simplete get the historical sale price and dates?


texts:
Scenario:

Imagine I create a crypto currency ZZZ (based on Ethereum blockchain) for buying/selling fruits.

There are two shops wanting to sell something:

Apple shop, offering 5 kg of apples for sale, at price 10 ZZZ per kg
Orange shop, offering 3 kg of oranges for sale, at price 15 ZZZ per kg

There are three customers:

Alice wants to buy 2 kg of apples from Apple shop
Bob wants to buy 1.5 kg of apples from Apple shop
Bob wants to buy 1 kg of oranges from Orange shop
Cesar wants to buy 1.5 kg of oranges from Orange shop

After all four transactions complete there should be:

1.5 kg apples left in Apple shop
0.5 kg oranges left in Orange shop

ZZZ balance should be accordingly changed for each customer.

Questions:

How can a shop record the available quantities in the blockchain?
How can a shop transfer ownership of quantities of apples/oranges to the customers who bought them, in exchange for the ZZZ paid?
I'm aware that the underlying blockchain tech will make sure no double spending of ZZZ can occur, but how can I ensure no more apples/oranges are sold than there is available on stock?
Are there any sample projects which I could refer to to see how would solidity code look like for implementing such contracts where some value is partially transferred in exchange for the amount of the currency paid?


texts:
Im trying to decode a bytes memory _data parameter directly in a smart contract.

Im currently running:

var data = await abi.encode("120000000000000000000", user2, OCcontract1.address, "120000000000000000000", OCcontract2);

So with its types

data abi.encode(BN, address, address,BN, address);

now within a function I want to use the solidity equivalent of abi.decode but running directly on the smart contract.

Any pointer will really help.


texts: Why am I getting less than 5 Ether per block?

texts:
Was something changed recently? I've been getting less and less ether per block - is this tied to difficulty level?

I thought difficulty would affect the rate of mining a block, not the number of ether per block. My last block got me 3.75 Ether.


texts: How to change verbosity without restarting geth? (admin.verbosity undefined)

texts: Documentation of console API advertises admin.verbosity, but my node says it's undefined in Geth/v1.4.4-stable-8ea3c88e/linux/go1.6.2. So, how to change verbosity without restaring the node with a different --verbosity arg?


texts: Is each block on Ethereum blockchain stored as lots of files, a separate file per each block? Or a database? How does one can run Etherenum node shared over several servers?


texts: What's the point of ERC721Receiver.sol and ERC721Holder.sol in OpenZeppelin's implementation?

texts:
I'm studying OpenZeppelin's ERC721 token implementation and I'm having a hard time making sense of ERC721Receiver.sol and ERC721Holder.sol and how they relate to eachother.

In the file ERC721BasicToken.sol only the file ERC721Receiver.sol is imported.

When ERC721Receiver.sol only declares the function onERC721Received and ERC721Holder.sol is the contract defining it.

You might have to take a quick look at the implementation on GitHub to see what I'm talking about.

It it supposed to be like that?

Or is that a bug in the implementation?

Also what really is the point of having this functionality and is it really necessary?

Including examples would be very nice.

Relevant Code:

ERC721Receiver.sol

pragma solidity ^0.4.23;

/// @title ERC721 token receiver interface
/// @dev Interface for any contract that wants to support safeTransfers from ERC721 asset contracts.
contract ERC721Receiver {
    /// @dev Magic value to be returned upon successful reception of an NFT
    ///  Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`,
    ///  which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
    bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;

    /// @notice Handle the receipt of an NFT
    /// @dev The ERC721 smart contract calls this function on the recipient
    ///  after a `safetransfer`. This function MAY throw to revert and reject the
    ///  transfer. This function MUST use 50,000 gas or less. Return of other
    ///  than the magic value MUST result in the transaction being reverted.
    ///  Note: the contract address is always the message sender.
    /// @param _from The sending address
    /// @param _tokenId The NFT identifier which is being transfered
    /// @param _data Additional data with no specified format
    /// @return
    `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
    function onERC721Received(address _from, uint256 _tokenId, bytes _data) public returns(bytes4);
}

ERC721Holder.sol

pragma solidity ^0.4.23;

import "./ERC721Receiver.sol";

contract ERC721Holder is ERC721Receiver {
    function onERC721Received(address, uint256, bytes) public returns(bytes4) {
        return ERC721_RECEIVED;
    }
}

ERC721BasicToken.sol

pragma solidity ^0.4.23;

import "./ERC721Basic.sol";
import "./ERC721Receiver.sol";
import "./SafeMath.sol";
import "./AddressUtils.sol";

/// @title ERC721 Non-Fungible Token Standard basic implementation
/// @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
contract ERC721BasicToken is ERC721Basic {

    .
    .
    .

    // Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
    // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
    bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;

    .
    .
    .

    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public canTransfer(_tokenId) {
        transferFrom(_from, _to, _tokenId);
        // solium-disable-next-line arg-overflow
        require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
    }

    .
    .
    .

    /// @dev Internal function to invoke `onERC721Received` on a target address
    /// @dev The call is not executed if the target address is not a contract
    /// @param _from address representing the previous owner of the given token ID
    /// @param _to target address that will receive the tokens
    /// @param _tokenId uint256 ID of the token to be transferred
    /// @param _data bytes optional data to send along with the call
    /// @return whether the call correctly returned the expected magic value
    function checkAndCallSafeTransfer(address _from, address _to, uint256 _tokenId, bytes _data) internal returns (bool) {
        if (!_to.isContract()) {
            return true;
        }
        bytes4 retval = ERC721Receiver(_to).onERC721Received(_from, _tokenId, _data);
        return (retval == ERC721_RECEIVED);
    }

}


texts: How can I increase the nonce in Smart Contract?

texts:
We all know that the nonce of smart contract can be added 1 time when one subcontract is created using solidity.
I'd like to know if the creation of subcontract is the only way to increase nonce.
If not, is there other way to increase it?

INFO:
The nonce I mentioned above is used to generate subcontract address.
How is the address of an Ethereum contract computed?


texts: How can the transactions to this address always adapt to have higher gas price than all the rest?

texts:
Looking at the transactions from:
https://explorer-mainnet.maticvigil.com/address/0xfD0E9d3f4Eee056B49DF062B70f766cFB13fEb01/transactions
Looking at every block that a transactions is sent to this contract, I concluded that no matter the gas price of other transactions, I even tried to increase gasPrice of my transactions, it will always send an higher gas price than mine.
I was wondering how would that be possible?


texts:
Could someone explain the use of performing a multiplication such as this? I mean the logic is fine, but what is the importance from a security point of view?

function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
    }

This is from the dapphub library.
I have included the link herewith:
https://github.com/dapphub/ds-math/blob/master/src/math.sol


texts:
Can some recommend a way to save gas fees?

a = a + 1;
a++;

I heard about this; Pack struct tightly
Mine looks like this. I am not sure about size of address, ENUM variables and array without length. Please advice me or give me some reference links.
    enum TokenType {A, B, C}

    enum SwapType {AA, BB}

    struct A {
        address[] a;
        uint256[] b;
        TokenType[] c;
        address d;
        uint256 e;
    }

    struct B {
        uint256 a;
        uint256 b;
        bool c;
        uint256 d;
        uint256 e;
        bool f;
        mapping(address => bool) g;
        SwapType h;
        Collection i;
        Collection j;
    }

And what is the best way for accessing struct mapping variables?
I am using a lot of gas fees because I have struct B mapping, inside that, I have 2 struct objects, inside that object, I have 2 arrays.
Another question is, I heard functions orders in contract are affecting gas fees. Do function parameter orders affect gas fees as well?


texts:
I am working on making a game where users can collect items. I have chosen to store the ERC721 tokens that represent the items in this way:

Item struct:

User struct and map that maps account-addresses to user-structs:

I made some functions to test this out:

As seen, getItem does in fact not get an item, but rather how many items a user has. This is done for testing, and will be changed back when it works.

I then created some tests to try this out:

This outputs as follows:

As you see, the createItem adds an item to the array, but when GetItem is called, it is no longer there. When I called createItem from within getItem, it worked as expected. But for some reason this is not working. Can anyone help?


texts: How to get the list of NFT exist in my wallet?

texts:
As like trust-wallet gives the list of available NFT in the wallet.
How can we achieve that same thing?
What are the multiple ways to achieve that thing?


texts:
I made a transaction to upload my token in etherdelta but it gives me TxReceipt Status: Fail, does anyone know what I could be doing wrong?

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


texts:
I’m interested in building a bridge between Ethereum Mainnet and Ropsten testnet.
The user will send USDT/ETH to the mainnet contract and will receive tokens on Ropsten(and the other way around).
What is the easiest way to achieve this?
Thanks.


texts: geth "Smartcard socket not found, disabling" warning message

texts:
My node is running well in the last month. But somehow I restart the node and currently couldn't start probably, keep stuck at smartcart socket not found:
Maximum peer count                       ETH=50 LES=0 total=50
Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"

My command:
geth --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=16384 --rpcport 8545 --rpcaddr 127.0.0.1 --allow-insecure-unlock

What may be the main reason of this warning message? How can I fix it?


texts: reconciliation and approval using smart contract

texts:
Has anyone attempt to build smart contracts for reconciliation and approval workflows/process?

E.g., if fields match, update the string variable and evoke another contract to request for approval

Nathan Aw


texts: Is it possible to access block.number inside a view function?

texts:
I have a transactional function that can only be called every few blocks, and I would like to create a view function that returns the number of blocks until the transactional function can be called again, in other words, current block minus block number of the last time the transactional function was called (which I keep track of in my contract state).

Is it possible to access the block.number inside a view function or can I only access it in a transactional function?


texts: Truffle send to fallback function from different account

texts:
I'm testing a simple fallback function with Truffle, the fallback function is:

function () public payable {
    internalTransfer(this, msg.sender, 100000000);
    FundSuccess(msg.sender, msg.value);
}

function internalTransfer(address _from, address _to, uint256 _value)
  internal returns (bool) {
    // SafeMath.sub will throw if there is not enough balance.
    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);
    return true;
}

where .sub and .add are imported from SafeMath library, in the truffle test I have

trx = await token.send(power18(1), {from: accounts[1]});
console.log(trx);
var balance1 = await token.balanceOf.call(accounts[1]);
console.log(balance1);

what I found was, no matter what I specify in the from, balance is always assigned to account[0]. Checking the transaction in Ganache shows that the transaction was recorded as sent from account[0].

I know {from:...} works, I have used it in other places and never had a problem. This is the first time I used it on ".send". I am at a stage where I do not know how to proceed, tried googling but couldn't find good information, please help!


texts: I don't know why my contract have a problem. Gas estimation and Gas exceeds Problem

texts:
pragma solidity >=0.4.24 <=0.5.6;

contract Indian {
    mapping (address => uint16) myGame;
    address public owner;

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

    function getBalance() public view returns (uint) {
        return address(this).balance;
    }

    function deposit() payable external {
        require(msg.sender == owner);
    }

    function buyGame(uint _gamePrice) payable public returns (bool) {
        require(getBalance() >= _gamePrice);
        msg.sender.transfer(_gamePrice);
        myGame[msg.sender]++;
        return true;
    }

    function getMyGame() view external returns(uint16) {
        return myGame[msg.sender];
    }

    function sellMyGame(uint _gamePrice) payable external {
        uint refund = (myGame[msg.sender] * _gamePrice);
        myGame[msg.sender] = 0;
        msg.sender.transfer(refund);
    }
    function investGame() payable external {
        myGame[msg.sender]++;
    }

}

My Gas Limit is 3000000.
Why my contract has a gas exceed problem?


texts: Incorrect Usage. flag provided but not defined: -emitcheckpoints

texts:
I'am trying to build this :

     PRIVATE_CONFIG=ignore nohup geth --datadir ./Node1/new-
     node-1 --nodiscover --verbosity 5 --networkid 31337 --
     rpccorsdomain="*" --ws --wsorigins="*" --miner.gastarget 3300000
     --miner.gaslimit 80000000000 --emitcheckpoints --raft --raftport
     59001 --rpc --rpcaddr 0.0.0.0 --rpcport 29101 --rpcapi
     admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,raft
     --port 28101 --unlock 0 --password password.txt
     2>>./node_logs/node1.log &

but this doesn't work. In node1.log Ihave this output flag provided but not defined: -emitcheckpoints and even I execute the command without -emitcheckpoint, I don't get flag provided but not defined: -raft
 I'am trying to launch a quorum node and I'am using raft as the consensus algorithm.

When I downloaded quorum using

   git clone https://github.com/jpmorganchase/quorum.git
   cd quorum
   make all

I get an error :

  build/env.sh go run build/ci.go install
  build/ci.go:61:2: use of internal package github.com/ethereum/go-
  ethereum/internal/build not allowed
  Makefile:29: recipe for target 'all' failed
  make: *** [all] Error 1

when I go to build/ci.go:61:2 I have this instruction

  "github.com/ethereum/go-ethereum/internal/build"

Do anyone know how to solve the problems?


texts: how do you know your db is synced in geth?

texts:
In order to answer this question there is a need to get the timestamp of when the database is synced with geth.
I can think of two ways of doing that :

find the 1st occurrence of 1 block in the geth client, usually when syncing it retrieves more blocks I0523 13:32:06.653226 core/blockchain.go:959] imported 1 block(s) (0 queued 0 ignored) including 9 txs in 12.87853ms. #1569731 [341d073a / 341d073a] but if for some readson the syncronisation imports only one block and isn't yet synced that would be a false positive. maybe when you got twice ina row could be safe enough
retrieve the last block number from any block explorer and compare it with your client's last block #

but maybe there is a built-in method ?


texts: How to detect coin transfer from transaction


texts: I sent some ether to a myetherwallet address. When I load up the wallet info page it says 0 ETH balance, but the link to the etherscan.io address shows the correct balance.


texts: In my web3 how do I grab the Rinkeby wallet address from MetaMask? How do I request ether from this address?


texts: Is it possible to have a mapping to a tuple?

texts:
Is it possible to have a mapping where the values are a tuple?

mapping (address => (bool, uint)) participants;


texts: I am testing few of my solidity contracts using testrpc. However, testrpc has only a few ethers. Is there any way I can increase this limit ( say 500 ethers in all accounts) .


texts: Can Solidity return values in a specific unit so that the Wallet shows them nicely?

texts:
I asked this question, and then I figured out the answer with help from folks here in this exchange.

QUESTION

I have contract functions that return a uint256 amount. This amount is related to the contract's balance. So it shows up in Wei (I guess), as a very large number, in Ethereum Wallet.

Can I return this number in Ether so that it shows up in a more friendly way in the Wallet and I don't risk messing up units in calculations? Or do I have to manually convert units and return a uint256 as divided by some constant?

ANSWER

Well, a function returns a value of a given type, for example, in this case, uint256.

The money units available in solidity are constants, and have no relation to the type system.


texts: Invalid JSON Response while connecting DApp, Metamask and Backend

texts: I am getting some error(picture below) while trying to connect DApp with a backend.  One day ago, everything worked fine, now I got an error: "basic auth failure". Contracts are deployed on Ropsten Test Network, of course using truffle. Although the message is presented, I am unable to debug it further. Any helpful guides or suggestions?


texts: Gas usage higher when using the delete keyword

texts:
I'm currently working on a marketplace demo for the consensys bootcamp, you can find my entire code here.

Stores inside the marketplace (which are structs) are stored inside a mapping and the keys pointing to the stores are stored in an array.
I have a function that removes a store and I wanted to test gas usage.

I have 2 different approaches:

the first one just deletes the item id array and sets a bool flag to false
the second approach just uses the delete keyword to delete the struct

.

/// @notice removes an existing store
/// @dev only callable by store owners, requires store to be active
/// @param _storeID ID of store to be removed
/// @return true on success, false on failure
function removeStore(bytes32 _storeID) public onlyStoreOwner returns(bool) {
    // storage pointers to store and store id list
    Store storage store = stores[msg.sender][_storeID];
    bytes32[] storage storeIdList = storeIdLists[msg.sender];

    // store has to be active in order to be removed
    require(store.active, "store currently not active");

    // copy last index of store id list to index of to be removed store and delete last item of array
    storeIdList[store.index] = storeIdList[storeIdList.length-1];
    storeIdList.length--;
    // remove items from store
    store.itemIdList.length = 0;
    store.active = false;

    emit RemovedStore(msg.sender, _storeID);
    return true;
}

function removeStore2(bytes32 _storeID) public onlyStoreOwner returns(bool) {
    // storage pointers to store and store id list
    Store storage store = stores[msg.sender][_storeID];
    bytes32[] storage storeIdList = storeIdLists[msg.sender];

    // store has to be active in order to be removed
    require(store.active, "store currently not active");

    // copy last index of store id list to index of to be removed store and delete last item of array
    storeIdList[store.index] = storeIdList[storeIdList.length-1];
    storeIdList.length--;
    // remove items from store
    delete stores[msg.sender][_storeID];

    emit RemovedStore(msg.sender, _storeID);
    return true;
}

when I test the gas usage of both functions I generate a new store with the name "test" and the description "test". The item id list is empty and the bool flag gets set to true.

the removeStore function has a transaction cost of 26641 gas

as expected, the bool flag is set to false, everything else stays.

now the removeStore2 function has a transaction cost of 37230 gas

again, everything gets deleted as expected

Now to my question:

why does the second function consume more gas? the delete keyword sets 2 more non-zero storages to zero. shouldn't there be a gas refund? The transactions were tested with ganache-cli and the remix javascript vm.


texts: How to substitute attributes instead of roles in access control coding for solidity?

texts: Say, the role-based access control consists of two roles. But if I want to replace the roles to maybe location and time, how to go about it?


texts: Debugging reverted BSC transaction that fails only through ganache-cli

texts:
I have a Truffle migration that deploys and configures a set of smart contracts on BSC (Binance Smart Chain).
When running the migration on the actual network, it works fine.
However, when I try to run the exact same migration through ganache-cli on a network fork, one of the transactions reverts:
Error: Returned error: VM Exception while processing transaction: revert
(The fork is handy and used for development, testing, and continuous integration.)
Here some of the common/relevant issues checked:

There is enough ETH (actually BNB) on the migration wallet;
No contracts exceed the size limit;
Increasing both transaction and block gas limits;

As there are common pitfalls when using ganache-cli, I wonder if one of them could be the possible reasons for the reversal.
I have also tried to make it print a better error message/stack trace, but the truffle --stacktrace-extra flag had no effect on that.
Any possible suggestions on how to further investigate that?
Here is how I start ganache-cli:
npx ganache-cli \
    -q \
    -h 0.0.0.0 \
    -i 56 \
    --chainId 56 \
    -l 100000000 \
    -f https://bsc-dataseed.binance.org/ \
    --account $PRIVATE_KEY,100000000000000000000000

And here is my truffle-config.js:
require('dotenv').config();
const HDWalletProvider = require('@truffle/hdwallet-provider');
const privateKey = process.env['PRIVATE_KEY'];

module.exports = {
  compilers: {
    solc: {
      version: '0.6.12',
      optimizer: {
        enabled: false,
        runs: 200,
      },
    },
  },
  networks: {
    bscmain: {
      network_id: 56,
      networkCheckTimeout: 10000,
      provider: () => new HDWalletProvider(privateKey, 'wss://bsc-dataseed.binance.org/'),
      skipDryRun: false,
    },
    development: {
      network_id: '*',
      gas: 10000000,
      host: 'localhost',
      port: 8545,
      skipDryRun: true,
    },
  },
};

I am running ganache-cli version 6.12.2.


texts: How can I get a list of all owners of an ERC1155 NFT by using a web3 call?

texts: With ERC721, there's the 'ownerOf' function that takes a non-fungible token's id and returns the owner address, but ERC1155 doesn't officially require that a function like that be implemented. I made an ERC1155 contract through rarible.com, and I can't find a function implemented there either. Both rarible.com and Opensea.io marketplaces show the owners of ERC1155 NFTs, so I know it's possible, but I can't figure it out.


texts: Is there a way to avoid using the geth console?

texts: The geth JavaScript console is cumbersome and does not support tab completion. Do any tools exist such that I can avoid using it?


texts: tyring to sync ropsten testnet with android-inproc: Rolled back 2 headers


texts: In a smart contract : If a specific exception is raised...can a Human decide and validate the Smart Contract?

texts: In a Ethereum Smart Contract : If a specific exception is raised...can a Human decide and validate the Smart Contract "by hand" ?


texts: ETH multisig wallet with Trezor integration

texts:
advice would be appreciated! I am looking for a reliable Ether wallet with two features:
*Multisig
*Integration with any hardware wallets (Trezor would be more preferable option)

It seems that Mist supports multisig, but does not any hardware wallet. Moreover, it is necessaty to download the whole blockchain on my computer. What about more light version? I heard about ConsenSys, but it seems that it is currently in the testing period. How safe is it?

Many thanks!


texts: Problem: Values from a transaction(web3) are not stored in datastucture defined by Solidity

texts:
First of all i use Truffle and Ganache.

I made a smart contract with solidity defining the following structures:

struct TimestampproTeil {
    uint Fahrwerk;
    uint Chaussy;
    uint Kabine;
    uint Auspuff;
}

struct Traktor {
    uint produktionsnummer;
    Kabine kab;
    Reifen reif;
    Fahrwerk fahrw;
    Chaussy chau;
    Auspuff ausp;
    TraktorTyp typ;
    uint timestamp;
    TimestampproTeil teile;
}

and in order to interact with the blockchain i use ganache-cli.

My API looks like this

const fs = require('fs');
const solc = require('solc');
const path = require('path');
const Web3 = require('web3');
const web3 = new Web3("http://127.0.0.1:8545");

//Contract
const input = fs.readFileSync(__dirname + '/contracts/ProductionSimple.sol', 'UTF-8');
//Amount of contracts
const output = solc.compile(input, 1);

const abi = JSON.parse(output.contracts[':ProductionSimple'].interface);
const bytecode = output.contracts[':ProductionSimple'].bytecode;

//contract
const myContract = new web3.eth.Contract(abi);

const instance = myContract.deploy({
    data: bytecode
})
.send({
    from: '0x52750243c1d99839e2267c2805fe0c81261e2325',
    gas:6721975
})
.then((newContractInstance) => {
    return newContractInstance; // instance with the new contract address
});

instance.then((legocontract) =>{
    legocontract.methods.getTimeAuspuff(3).call((err, result) => { console.log(result)})
})

instance.then((legocontract) =>{
    legocontract.methods.setTimeAuspuff(1).send({from: '0x52750243c1d99839e2267c2805fe0c81261e2325',gas:6721975});
})

instance.then((legocontract) =>{
    legocontract.methods.getTimeAuspuff(1).call((err, result) => { console.log(result)})
})

The functions i used for the transaction

function getTimeAuspuff(uint prodNr)view public returns(uint){
        return(traktoren[prodNr].teile.Auspuff);
    }

    function setTimeAuspuff(uint prodNr) public{
        uint day = now;
        traktoren[prodNr].teile.Auspuff = day;
    }

SetTimeAusPuff() changes the Auspuff value in TimestampproTeil and getTimeAuspuff() returns this value.
When i interact with the node console everthing works fine for me and i can call sender functions adding new or changing values.
When i just run the whole file a new block gets generated but it does not create new values or change already existing values. Also there is no error message that occurs. So what can i do in order to fix this problem?

I use web3 version 1.0.0-beta.37 because with higher versions ganache-cli ends up in an endless loop.

Thanks for your help guys!

Updated Code:

const instance = async () => {
    const legocontract = await myContract.deploy({
       data: bytecode
    }).send({
    from: '0x51668bbc9278666a06d6731fe081f179e3ec934c',
    gas:6721975
    })
    .then((newContractInstance) => {
        return newContractInstance; // instance with the new contract address
    })
    return legocontract;
};

instance().then((contract) =>{
    const getTime = async () => {
      await contract.methods.getTimeAuspuff(1).call().then((result) => { console.log(result)})
      await contract.methods.setTimeAuspuff(1).send({from: '0x51668bbc9278666a06d6731fe081f179e3ec934c',gas:6721975})
      await contract.methods.getTimeAuspuff(1).call().then((result) => { console.log(result)})
    };
    getTime().then((time) =>{
    })
})


texts: Why is a state-modifying function working from Truffle console, but not when calling from web3?

texts:
I have a contract which offers two functions:

1) A state modifying function which takes two parameters

2) A constant function

I have a web frontend in React calling these functions. When I call the constant function from the React frontend, everything works. But when I call the state modifying function from the frontend using web3, I get an invalid opcode error. However, the function does work when I call it from Truffle console, so the Solidity function itself is correct.

Here's how I'm calling from web3 1.0:

    contract.methods.createNewPlayer(
      '0x35000f8407c2358Fbb089C2aE4e70fE005f4F6cD',
      100
    ).send({ from: '0xc7edb363e01f7964f9fac9bf883afeee64fb2d93' })
     .then((receipt) => {
       console.log(receipt)
    })
    .catch((error) => {
      console.log(error);
    });

This results in an invalid opcode. And when I call from Truffle console like so:

    inst.createPlayer(
    '0x35000f8407c2358Fbb089C2aE4e70fE005f4F6cD',
    100, { from: '0xc7edb363e01f7964f9fac9bf883afeee64fb2d93'})

Everything works.

What reasons could there be for this? The contract is deployed on TestRPC.


texts: Getting ClassCastException while creating wallet

texts:
Always getting this exception when I am creating new wallet file

java.lang.ClassCastException org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey cannot be cast to org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey

public void createWallet() throws IOException, NoSuchProviderException, CipherException, InvalidAlgorithmParameterException, Exception {
        Web3j web3 = Web3j.build(new HttpService("https://rinkeby.infura.io/your-token));
        Web3ClientVersion web3ClientVersion = web3.web3ClientVersion().send();
        String clientVersion = web3ClientVersion.getWeb3ClientVersion();
        System.out.println(clientVersion);
        String fileName = WalletUtils.generateFullNewWalletFile(
                "ZXCVBNM@abc4",
                new File("C:/Users/NI_PC_8/Desktop"));
        System.out.println(fileName);
}


texts:
I have already issued my ERC 20 token. But I want to add a time locking functionality to the token so the tokens issued during pre-sale / ICO will be time locked in user's wallets.

Is this possible?


texts: Can I test different OS and combine the keystore folder later?

texts:
I have to move from Linux to Linux but also want to test under Windows. Is there any issue in running accounts and wallets under the different OS with a view to combining them under a single OS at a later date.

I know that if I run the geth console and type admin.datadir
I can see the full path and then export the blockchain in binary format with:

geth export <filename>

Then I can copy the blockchain_backup file to the new system and on the new system run:

geth import <filename>

I can see how to backup my accounts in the keystore folder here  and I've read the original Backup/Restore instructions. I'd like to be sure I have not missed anything that may seem obvious.


texts: Apparent mismatch between Oraclize CBOR and python3 CBOR encodings

texts:
I encoded a value using the Oraclize CBOR library like so:

    Buffer.buffer memory cborArgs;
    Buffer.init(cborArgs, 64);
    cborArgs.startArray();
    cborArgs.encodeUInt(10);
    cborArgs.endSequence();

Which produces:

\\xef\\xbf\\xbd\\\\n

But it does not seem to match the result of the same encoding in python3.

print(str(cbor2.dumps([10]))

produces

\x81\n

What's going on?


texts: Why admin.addPeer() command did not add parity client for private chain with Docker?

texts:
I would like to set up private chain which both geth and parity clients running on the same network.

here is a sample repository with docker-compose file:

https://github.com/user48736353001/devnet

After running docker-compose up without any errors,

docker-compose.yml

version: '3'
services:
  geth:
    build: geth
    ports:
      - "8545:8545"
      - "8546:8546"
    expose:
      - '30303'
    restart: always
    networks:
      app_net:
        ipv4_address: 172.16.128.20

  node1:
    build: parity
    ports:
      - '18545:8545'
      - '18546:8546'
    expose:
      - '30300'
    user: 'root'
    networks:
      app_net:
        ipv4_address: 172.16.128.10

networks:
  app_net:
    driver: bridge
    ipam:
     driver: default
     config:
       - subnet: 172.16.128.0/24

login to geth's docker container with docker exec
attach geth with geth attach http://localhost:8545
admin.addPeer("enode://027619e7cc4c94e606ccf1f3bf2b4750f39472c001f7266c681f652c25875312ea447eefdfeb18ea193c4258a948beae66cf71de05aa64ca1fb95bbbbcdc8b1a@172.16.128.10:30303")
however admin.peers command returns empty []

Is there anything wrong with my genesis files?
I took most of the initial setting from goerli testnet with different networkID.


texts:
Greetings everyone,
i'm trying to install solidity developpement environment on my pc OS: Windows 10 AMD64, i'm following the official solidity documentation 0.5.8, first i installed cmake, downloaded visual studio 17 (installed on it :msvc  v141 vs 2017 c++, c++ core desktop,c++ cmake tools, c++/cli support) then i cloned solidity source code from github after that i ran the following commands: mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" ..
And unfortunately it's not working  it shows the error below

this is what i installed on visual studio:

i would appreciate any help or suggestion to solve this problem. thanks in advance


texts: Would it be profitable enough to do a Master's degree in blockchain technologies (focused on ethereum above all)?

texts:
The end of my university studies is getting closer and closer.

I'm sure I want to do a Masters degree, but I have some doubts.

About a month ago my university released a Masters degree completely on blockchain (especially Ethereum, although it also deals with Hyperledger and Bitcoin).

It's been quite a few months since I discovered blockchain technologies and I am very happy to learn about the cryptography they use, their consensus algorithms and all their possibilities.

In fact, it is towards where I am also orienting my work life.

The problem is that I do not know if a Masters that only deals with blockchain and cryptography technologies will be very useful (obviously yes now, but maybe in a few years, when the fashion goes by, it will not have much value).

Considering the money that costs a Masters degree in Spain (that at least for an ordinary student is a lot) I do not know if it will be an intelligent option to do it. Instead of opting for more general Masters degree in Cyber Security or Network Architecture.

What do you think about it? Not about whether or not to do a Masters degree, but about doing it in blockchain or not.

EDIT: I'm actually working and studying, and I will do the same while doing Masters so no "profitable years of working experience" are lost by doing it.


texts: Why I can not send data to non-contract address?

texts:
I use Ganache to test,the code is as follow：

var Web3 = require('web3');
const Utils = require('web3-utils');

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));}
let txTransfer = {};
txTransfer.from = web3.eth.accounts[0];
txTransfer.to = web3.eth.accounts[1];
txTransfer.value = 4000000;
txTransfer.data = Utils.toHex('free text data');
txTransfer.gas = 1000000;
console.log(txTransfer);
web3.eth.sendTransaction(txTransfer);


texts: im looking for an exchange to trade my tokens cheap

texts:
0
Is there any other site i can send my tokens to, where i can trade them for like a normal rate like on binance? trying to trade 50$ worth of token but the gas fees are 80$ - to 140$ how does that make any sense! my tokens are on metamask.


texts: Trying to understand why my test.js fails

texts:
I have a function that is not passing my tests in JS but the function works as expected in Remix. Can you help me

contract.sol

function test1 () public view returns(bool){
    return(true);
}
function test2 () public returns(bool){
    return(true);
}

test.js

it("Works", async () => {
  const restaurant = await BiteChain.deployed();
  let test1 = await restaurant.test1({from:owner});
  assert.equal(test1, true, 'should return true...');
});

it("Doesn't work", async () => {
  const restaurant = await BiteChain.deployed();
  let test2 = await restaurant.test2({from:owner});
  assert.equal(test2, true, 'should return true...');
});

And then the result is

Contract: TestBiteChain
√ Works
1) Doesn't work
...
 1) Contract: TestBiteChain
  Doesn't work:
 AssertionError: should return true...: expected { Object (tx, receipt, ...)
 }  to equal true
 at Context.it (test\BiteChain.test.js:45:12)
 at process._tickCallback (internal/process/next_tick.js:68:7)


texts: Search Struct or Mapping with minimum gas

texts:
I am trying to create a proof of existence dapp using IPFS and Solidity and wish to implement a feature to add 'tags' (like we attach to question on stack overflow) to each file/document uploaded on IPFS. On my dapp front end I wish to provide a search option. Based on the value of tag entered in the search option, I wish to refresh dapp contents on the front end.

Being a newbie to Solidity coding, please suggest the most efficient (in terms of gas consumption) and fastest way to implement this feature in solidity code.

Thanks in advance


texts:
I have a smart contact which have 2 owner address and 3 functions.

my set functions is set a users with msg.sender and my getUser functions is returns name,surname and age and I want to add a admin which can set users to . This setUsersbyAdmin function take an address parameter for set name,surname and ag.

My smart contract works well on remix but I try to truffle compile it failed.

here's the code :

pragma solidity >=0.4.0 <0.7.0;

contract NewHello{

    address owner;
    address newOwner;

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

    modifier onlyOwner (){
        if(msg.sender != owner){
            require(msg.sender == newOwner);
            _;
        }
        else{
            require(msg.sender == owner);
            _;
        }

    }

    struct user{
        string name;
        string surname;
        uint age;
    }
     event infoChanged(
        string name,
        string surname,
        uint age
    );

    mapping(address => user) public users; // contains a user for every address

    function setUser(string memory name,string memory surname,uint age) public payable{
        users[msg.sender] = user(name,surname,age);
        emit infoChanged(name,surname,age);
    }
    function setUserbyAdmin(address _address, string memory name,string memory surname,uint age) public payable onlyOwner{
        users[msg.sender] = user(name,surname,age);
        emit infoChanged(name,surname,age);
    }

    function getUser(address _address) public view returns(string memory name , string memory surname, uint age)  {

        return (users[_address].name,users[_address].surname,users[_address].age);
    }
}

when I compile this with truffle I see an error on my window which says :

Warning: Unused function parameter. Remove or comment out the variable name to silence this warning. function setUserbyAdmin(address _address, string memory name,string memory surname,uint age) public payable onlyOwner{ ^--------------^


texts: Constructor Arguments ABI-encoded - verification not working!

texts:
I think I must be going blind or something because I can not find the Constructor Arguments for this smart contract 0x3a2F46b0B0c187B152Db0c658b27E693f0A273a1

I have tried a number of options but always fails the https://etherscan.io/verifyContract?a=0x3a2f46b0b0c187b152db0c658b27e693f0a273a1

Any help would be appreciated :)


texts: Is there a way to know about the upcoming ICOs?

texts: I was just wandering if there is a place that lists all the upcoming Initial Coin Offerings that take place on Ethereum?


texts: How to generate a unique identifier in Solidity?

texts: I am making a student registration form and need a unique identifier for them. Are there any methods in Solidity that will give a unique number for every student that registers?


texts:
solidity 0.5.0
web3@ 0.20.7

In my contract.There's a function (view) returns a struct type.
When I used web3.js to call this function, I got "Error: invalid solidity type!: tuple".
I know that this problem is solved in web3@1.0.0-beta.36.
But my Dapp is using web@0.20.7.
I don't want to change to 1.0.0, because my app is not small.
Is there a solution to this problem in web3 0.20.7?
Thanks a lot.


texts: Metamask-Rinkeby Transaction Error. Exception thrown in contract code in Rinkeby?

texts:
Can anyone explain why I'm get error every time for 'buyFor' function from my contracts?

pragma solidity ^0.4.11;
import "./ownable.sol";

contract GLOERC20Coin is Ownable{
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public totalSupply;
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

    event Transfer(address from, address to, uint256 value);
    event Approval(address from, address to, uint256 value);
    event Mint(address indexed to, uint256 amount);
    event Burn(address indexed burner, uint256 amount);

    function GLOERC20Coin(){
        decimals = 8;
        totalSupply = 10000000 * (10 ** uint256(decimals));
        balanceOf[msg.sender] = totalSupply;
        name = "MyToken";
        symbol = "MTS";
    }

    function _transfer(address _from, address _to, uint256 _value) internal {
        require(_to != 0x0);
        require(balanceOf[_from] >= _value);
        require(balanceOf[_to] + _value >= balanceOf[_to]);

        balanceOf[_to] += _value;
        balanceOf[_from] -= _value;

        Transfer(_from, _to, _value);
    }

    function transfer(address _to, uint256 _value) public {
        _transfer(msg.sender, _to, _value);
    }

    function transferFrom(address _from, address _to, uint256 _value) public {
        require(_value <= allowance[_from][_to]);
        allowance[_from][_to] -= _value;
        _transfer(_from, _to, _value);
    }

    function approve(address _to, uint256 _value) public {
        allowance[msg.sender][_to] = _value;
        Approval(msg.sender, _to, _value);
    }

    function mint(address _to, uint256 _amount) public onlyOwner {
        _amount = _amount * (10 ** uint256(decimals));
        totalSupply += _amount;
        balanceOf[msg.sender] += _amount;
        Transfer(address(0), msg.sender, _amount);
        Mint(msg.sender, _amount);
    }

    function burn(uint _amount) public onlyOwner {
        require(_amount <= balanceOf[msg.sender]);
        address burner = msg.sender;
        balanceOf[burner] -= _amount;
        totalSupply -= _amount;
        Burn(burner, _amount);
        Transfer(burner, address(0), _amount);
    }

    function insuranceCaseTransfer(address _from, address _to, uint256 _amount) public onlyOwner {
        _transfer(_from, _to, _amount);
    }
}

///////////////////////////////////////////////////////////////////////////////

interface MyFirstERC20ICO {
    function transfer(address _receiver, uint256 _amount);
}

contract MyFirstSafeICO is Ownable{
    address owner;
    uint public buyPrice;
    MyFirstERC20ICO public token;

    function MyFirstSafeICO(MyFirstERC20ICO _token){
        token = _token;
        buyPrice = 10000;
        owner = msg.sender;
    }

    function () payable {
        _buy(msg.sender, msg.value);
    }

    function buy() payable returns (uint){
        uint tokens = _buy(msg.sender, msg.value);
        return tokens;
    }

    function buyFor(address _addressee, uint256 _amount) public onlyOwner returns (uint) {
        uint tokens = _buy(_addressee, _amount * buyPrice);
        return tokens;
    }

    function _buy(address _sender, uint256 _amount) internal returns (uint){
        uint tokens = _amount / buyPrice;
        token.transfer(_sender, tokens);
        return tokens;
    }
}


texts: The allowence does not show the approved value with ERC20 token

texts:
An ERC20 contract was deployed in remix and here is the approve console output:
status  true Transaction mined and execution succeed
 transaction hash   0x2b74bd0672c9140a016cd2c3cd2186624eca19dbd3876bb2ade23b6301bda04b
 from   0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db
 to FeiyunToken.approve(address,uint256) 0x2FbE968dF12A1265dFF6e8215EbF8D022FaD6B2b
 gas    4000043 gas
 transaction cost   26261 gas
 execution cost 3389 gas
 hash   0x2b74bd0672c9140a016cd2c3cd2186624eca19dbd3876bb2ade23b6301bda04b
 input  0x095...00014
 decoded input  { "address spender": "0x0a7180a063D06AfC0a5C69829b71062B6a4FED56", "uint256 amount": { "type": "BigNumber", "hex": "0x14" } }
 decoded output { "0": "bool: true" }
 logs   [ { "from": "0x2FbE968dF12A1265dFF6e8215EbF8D022FaD6B2b", "topic": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", "event": "Approval", "args": { "0": "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "1": "0x0a7180a063D06AfC0a5C69829b71062B6a4FED56", "2": "20", "owner": "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "spender": "0x0a7180a063D06AfC0a5C69829b71062B6a4FED56", "value": "20" } } ]
 value  0 wei

It approves 20 tokens with owner 0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db and spender 0x0a7180a063D06AfC0a5C69829b71062B6a4FED56. The allowance[owner][spender] shall return 20 token. Here is the allowance console output:
transaction hash    0x87c7e8307b666554f312968e45af58ac42cd3df7469c3bf523d7d6bff6e05ae2
 from   0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db
 to FeiyunToken.allowance(address,address) 0x2FbE968dF12A1265dFF6e8215EbF8D022FaD6B2b
 transaction cost   25564 gas (Cost only applies when called by a contract)
 execution cost 1476 gas (Cost only applies when called by a contract)
 hash   0x87c7e8307b666554f312968e45af58ac42cd3df7469c3bf523d7d6bff6e05ae2
 input  0xdd6...fed56
 decoded input  { "address owner": "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db", "address spender": "0x0a7180a063D06AfC0a5C69829b71062B6a4FED56" }
 decoded output { "0": "uint256: 0" }
 logs   []

It actually return 0 by allowance. Why the allowance is not 20?
UPDATE: the allowance is implemented as:
import "@openZeppeline/ERC20"
contract ERC20Token is ERC20 {
....
function allowance(address owner, address spender) public view virtual override returns (uint256) {
        super.allowance(owner,spender);
    }
 }

However if calling directly the allowance implementation in openZeppelin's ERC20.sol, then the allowance returns 20 which is correct. It seems that super.allowance() causes the problem but not sure how and why.


texts: Execute transaction Approve directly against contract address (without ABI)

texts:
Solved
For now, you will always need the ABI to execute a call against the ethereum network with web3. A simple way is to reconstruct the function you wish to execute is to, either create a separate contract to call or use the trick here and add in the ABI or at least a part of it from the contract you wish to call. In case, I used a generic ABI of an approval call.

await this.state.currentAddress.methods.approve("0x8b4a5682189361ce56702260051900f74d76e08b", amount).send({from: this.state.accounts[0]});

I have the following line in react. It is how I think I could execute the approve function, but it doesn't work. I can certainly get the contract ABI from an API but I want to avoid this. Is there any way to call the Approve function of standard ERC20 tokens via directly through contract address through web3 without having to import the ABI?


texts: unable to verify the contract on etherscan.io. How to resolve this issue?

texts:
I am unable to verify the contract in etherscan.io. I was able to deploy the same solidity code in (Geth, Mist). But the same code I am unable to verify in etherscan.io. What mistake am I doing here?

While deploying the code on mist I used the compiler version:

pragma solidity ^0.4.16;

I selected the same compiler version in etherscan.io : 0.4.16+commit.d7661dd9

Here is the transaction :

Contract was created during Txn# 0x9832deb04d2900f97c0434588038f573ee066c0a095c1c0a0af07225d0068a9d

Result: Does not match the input creation bytecode found at this address.
Sorry! The Compiled Contract ByteCode for 'Purchase' does NOT match the Contract Creation Code for [0x89d236a8387e6fE94e27D674D856e09f4dEE1302].


texts: Ethereum Block Structure - Roots and Tries Concept

texts:
Trying to reinforce my understanding, so hoping you guys may help me out.

From reading the Ethereum wiki, I believe part of an Ethereum block header consist of the following:

stateRoot
transactionRoot
receiptsRoot

Which are the keccak hashes of the root node of the tries themselves.

My questions would be as follows......

Q1 - Where does geth stores these tries - I reckon within the block themselves, i.e. chaindata folder, within the ldb files? Or am I entirely off-base?

Q2 - (I am assuming the state trie is indeed kept in each block) Does the state trie of block N references the state trie of block N-1 (if no changes to an account's state is found, i.e. only log accounts with differences), or is the state trie duplicated across blocks?

Q3 - While state tree pruning, I reckon that the states are pruned off since if we have the stateRoot, this effectively verifies that the state trie nodes are OK, hence safe to discard the state trie themselves - Would this understanding be correct from high level perspective?

Q4 - What would the .\ethereum\nodes folder be for?

Thanks!


texts: How to enable mining of my crypto currency?

texts:
I have made my own cryptocurrency. And I am thinking about rewarding the miner who mines the transaction related to my contract. Thus, I am thinking about adding balanceOf[block.coinbase] += 1; at the end of each function. Is it the right approach?

Moreover I have found at https://www.ethereum.org/token#proof-of-work that you can tie proof of work to your coin supply. Is it necessary to add additional proof of work when ethereum already have Pow security model? Or I need to change my approach?


texts: why the browser based solidity compiler crushes when the code is too long?

texts: I find that the browser based solidity compiler will crush when the code's length reach certain value which is about 230 lines. I don't know why and I am certain that there is no syntax mistake, does this problem ever happen to you?


texts:
I was going through truffle-contract docs and came across this  function

MyContract.deployed()

As mentioned in docs this function create an instance of contract abstraction(abi) representing the contract at its deployed address. What is the deployed address here?

Is it the same address at which the contract is deployed on Ethereum or something else set internally in an application?

Second thing: if my contract is already deployed on an Ethereum testnet like Ropsten and it has a contract address, then do I have to run this function MyContract.deployed()?


texts: Need to move all token from one address to another address(Internal) without fees. Could you please help me to solve this?


texts: How to do a disaster recovery in private chains?

texts: How can I do a disaster recovery on a private chain running ethereum, say for instance Quorum ?


texts:
Is there a way to transfer all eth received to another address immediately it was received?
For example I received 0.1 Eth in address 0x123 and I want it to be transferred to 0x567 immediately even if I'm there or not.
How can this be done?


texts: Recreate transaction log in solidity code

texts:
I have this log and i want to code a solidity contract/function that would do the same.
What i understand reading this transaction is that WBNB contract (0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c) is the one emitting the event Deposit and the destination is 0x10ED43C718714eb63d5aA57B78B54704E256024E ie PancakeSwap router.
But when i read the code of WBNB contract the
function deposit() public payable {balanceOf[msg.sender] += msg.value; Deposit(msg.sender, msg.value);}
deposits to msg.sender as destination, so the pancake router has to be the caller of this function, right ? If so how to do so ? + i think the purpose of this function is to send WETH from (my wallet or my contract) to the router, right ?
In the router contract i found this :
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}

Maybe that's what i need to use, i'm not sure...
I started writting pieces of code but it's my first time trying solidity and i struggle a bit.
Any help would be appreciated.


texts: Horrible Documentation! Better Solidity Documentation Location?

texts:
Hello Stack Exchange Ethereum list members:
Can someone recommend a better resource for Solidity programming documentation other than solidity.readthedocs.io?

To the Ethereum Documentation Team:
The documentation located here >>> http://solidity.readthedocs.io  is riddled with grammar issues, misspellings and spacing problems.  It does not to give great detailed guidance and clear clean step by step or progressively complex code examples. There are extremely important keywords, reserved words and other important Solidity specific functions explanations that you use EVERYWHERE in your code examples that have been hidden under a "Miscellaneous" section heading for some strange reason.  Once they are finally found, that leads to more disappointment because they have little or no definitions and examples to complement them.  The grammar.txt file on your Github site seems like an extreme example of this problem.  This file is an afterthought at best.

Other issues include examples like the following; a topic starts on a subject like "Mapping" with links to wiki pages that go way too much into depth on hash functions instead of just telling me how Solidity uses mapping in its code.
 There are way too many outside links to other websites that simply are off the mark with too detailed explanations about every conceivable configuration option, historical fact and theoretical reason why one word or subject was developed.  This instead of just telling me how Solidity uses it and how I should use it to code contracts.  It is not those external websites' responsibility to relate their subject matter to what I need to learn for using Solidity.  It is the Solidity document's responsibility.

Next example, a topic on "Modifiers" gives maybe a few sentences on why and how to use it. Then the explanation immediately jumps into a complicated and almost non-related example.  That example moves to advanced topics like Inheritance without clear, simple and detailed guidance on how and why Solidity uses modifiers.  As a matter of fact, the entire documentation set for Solidity seems like a last minute thought where someone quickly grabbed some old code and just added comments to it. No, that's exactly what was done when I look at sections like "Solidity by Example".  That section is almost useless as it almost solely relies on the comments in the program before even the first introduction into the specifics of Solidity coding principles and concepts.

Lastly, the main headings are not organized or labeled well and have unrelated subjects in them.  As an example, why in the world is the subject if Libraries hidden underneath the Main "Contracts" header instead of under its own header?  Why in the world would the subject of Functions not have its own header given the extreme importance of it in Solidity programming?

Judging by the over 14 thousand issues here alone, there is indeed a documentation problem.  There are some great heroes on YouTube and other places who are giving MUCH MUCH better guidance than the supposed central location for documentation.  Please, please, reach out to them and pay them some Ether to help you develop better docs OR; just post their videos on your doc site.


texts: calling other contract's function dynamically

texts:
Is it possible to create a function in Solidity that would call an arbitrary function on an arbitrary contract with all the parameters?

In JavaScript I would write something like this

function callArbitrary(contract, func, params){
    contract[func](params);
}

is there a solidity version of that?


texts: Allowance = Unlimited. What could happen?

texts:
Allowance = Unlimited. What can happen?
Hi,
let‘s say I approve via MetaMask that another address can spend an unlimited amount of ETH on my address.
What can happen?
Can this address spend all my ETH without me approving it via my MetaMask?
Thanks!


texts: Trying to create a Tower of Hanoi algorithm using Solidity. I come from Java background, and I'm having trouble to figure where to start. For example, would you write the whole thing in one contract? Any tips?


texts: Hoiw to convert string to address with web3

texts:
I am getting address value with html input as string value how do we convert the string to address for parsing with truffle-contract.

Here's the method I am using:

registerAirline : async() => {
        const airline = document.getElementById('airlineAddress').value;
        const flightApp = await flightSuretyApp.deployed();
        await flightApp.registerAirline(web3.utils.toChecksumAddress(airline), {from: account});
    },

I am getting this error as it's not able to parse string address as address format.

  Error: Invalid number of parameters for "registerAirline". Got 2
  expected 4!

Well the parameters are correct in case I will paste them down here too.

Here's the function for flightSuretyApp

function registerAirline(address airline) external requireIsOperational() airlineIsFunded(msg.sender) airlineIsNotRegistered(airline) returns (bool success, uint256 votes) {
        if (getRegisteredAirlines() < MULTIPARTY_MINMUM_AIRLINES) {
            flightSuretyData.registerAirline(airline, msg.sender);
            airlineMultiCallers[airline] = [msg.sender];
            return (success, airlineMultiCallers[airline].length);
        } else {
            bool isDuplicate = false;
            for (uint c = 0; c < airlineMultiCallers[airline].length; c ++) {
                if (airlineMultiCallers[airline][c] == msg.sender) {
                    isDuplicate = true;
                    break;
                }
            }
            require(!isDuplicate, "Voting airline has already submitted vote for this new airline");

            airlineMultiCallers[airline].push(msg.sender);
            if (airlineMultiCallers[airline].length >= getRegisteredAirlines().div(MULTIPARTY_CONSENSUS_DIVIDER)) {
                flightSuretyData.registerAirline(airline, msg.sender);
                return (success, airlineMultiCallers[airline].length);
            }

            return (false, airlineMultiCallers[airline].length);
        }
    }

Here's the code for flightSuretyData:

function registerAirline(address airline, address caller) external requireIsOperational isAuthorizedCaller isAirlineFunded(caller) {
            airlines[airline] = Airline(true, false);
            registeredAirlines = registeredAirlines + 1;
            emit AirlineRegistered(airline);
    }


texts: Should I use getTransactionCount() result in sendTransaction()?

texts:
As I read, getTransactionCount() returns the number of transactions sent from an address. Which of below items should I consider?

Not to use returned nonce?
Use the returned nonce number as a parameter in sendTransaction() to avoid duplicate transactions?
Use the returned nonce number + 1 to avoid duplicate transactions?


texts: question about gas limit when using oraclize

texts:
I'm using oraclize to fetch some data from the outside world. Oraclize calls the __callback method of my smart contract. For this call oraclize have to pay gas and there is a function to set the gas limit for this call.

My problem is now: If I set the gas limit to 150000 the transaction will fail with the message VM Exception while processing transaction: out of gas. If I put the gas limit to 300,000 the transaction succeeds but it only uses 90,000 gas. The gas limit is shown correctly in the transaction logs.


texts: If a block header is 80bytes, then why does a full node need ~100GB of storage

texts:
So, I'm a little confused about how data is stored in a block. If You can get the state of all accounts from the State Root of a block header, then that means that you can get the state of every account from every block by collecting every block header ever mined. If a block header is 80bytes and there are ~10 million blocks on Ethereum, then you only need 0.8 GB to store every block header.
If this is so, then why does a full node download so much data?


texts: Accessibility and security of the contract within a contract as a variable

texts:
Say I have one contract:

contract Token {
    uint totalSupply;

    function Token() public {
        totalSupply = 0;
    }

    function mint() public{
        //Do minting
    }
}

And then an another contract where the first contract is a public variable:

contract CrowdSale {

    Token public token;

    function Test() public{

    }

    function buyTokens() external payable {
        token.mint();
    }
}

What I want to know if the mint function of the Token is accessible from the outside? When I tried to do it in Remix, I only got "0": "address: 0x0000000000000000000000000000000000000000" from the public token, but is there a way to call the mint function or is it actually secure and people will only able to call the buyTokens function?


texts:
in a contract: msg.value is an amount in wei, and I can write 2 ether == 2000 finney as per the docs.

Is there a simple way to compare an amount in wei (specifically msg.value) with a concatenation of an amount (as a uint) and a "denomination" (as a string that could be wei, finney, szabo or ether ) ?

if not that would be a cool library !

edit: added pseudo-code, the unit & denomiation is clearly not correct, that's what I called a concatenation above:

function inferior(uint unit, string denomination) public returns(bool){
         if (msg.value < unit & denomination) {
             return true;
         }
inferior(100, "finney");


texts: Where can I get my mainnet genesis hash for my private ethereum network to replace in config.go?

texts:
I am attempting to update the config.go file parameter

MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")

How can I get this value from my own private ethereum network please?