texts:
How are gas fees calculated in account based model coins like ETH?
Let's say I own 10 ETH addresses with 0 starting balance. I receive 0.1 ETH payment from 10 people - each one sending a payment of 0.1 to one of my 10 ETH addresses (Obviously in 10 separate transactions). The combined total in all 10 addresses I own is now equal to exactly 1 ETH.
I now want to "forward" (consolidate) all 10 payments received to a single ETH address under my control. According to EtherScan it costs approx. 40 gwei (or $0.90) for the transaction to be confirmed in 16 min (slowest confirmation time). Assume I chose to forward all 10 payments using 16 min confirmation time. My impression is that the combined fee should be calculated as 10 * $0.90 (or 1- * 40 gewi * 21,000) which is equal to $9. Is this correct?
If, after forwarding ("consolidating") the entire amount to one address, I now want to transfer that amount (1 ETH) to another address (single output), the fee for this transfer would only be $0.90 cents, correct (since all ETH is now originating from a single address)?
If instead of sending 1 ETH to one address, I split it between two ETH addresses (so 0.5 ETH to each address) the cost is calculated as 2 * $0.90 cents or $1.8 total or is it one fee of $0.90?
Assuming my calculation above is accurate, does the calculation change if I transferred the original 10 * 0.1 payment to the single ETH address via a single batch transaction vs. if they were transferred in 10 different transaction? My impression is that since ETH uses an account based model there's no concept of batch transfers. So whether the original 10 * 0.1 were transferred at one time vs multiple occasions/times - it would not effect the fee I pay when transferring 1 ETH to another address. Is this correct?
I hope the question is not too basic as I searched and could not find a definitive answer.


texts: I am aware that you have to specify the Solidity compiler version and whether or not you use the optimisation flag. But even with all that considered - is the compiler deterministic?


texts: Generating an Ethereum wallet with encseed and ethaddr

texts: I know very little about Ethereum. I'm trying to generate an Ethereum wallet in JSON format that will have encseed and ethaddr. I've been looking online and couldn't find a way to do that. Can someone tell me how to do that? Or generate a wallet like that for me with a known password?


texts:
GETH tooks 6 days to sync, after that it will get out of sync from time to time. (PC is running with SSD, never shutdown, and network availability is 100% with 500mbps connection).

May I know how will this impact on my RPC call? I do not have this problem with the test net, and I can't test freely in the mainnet.

WARN [09-08|13:03:36.588] Synchronisation failed, retrying         err="block download canceled (requested)"
> eth.syncing
{
  currentBlock: 6294224,
  highestBlock: 6294302,
  knownStates: 214533588,
  pulledStates: 214533588,
  startingBlock: 6294202
}
> eth.blockNumber
6294224
> INFO [09-08|13:03:51.349] Generating DAG in progress               epoch=209 percentage=1  elapsed=2m38.113s

I do see that from time to time I have problem when trying to query for events from my contract. The RPC will timeout (the node and my software are within the same subnet).


texts: I reinstalled metamask after formating my pc but, no tokens where available there can somebody please tell me the reason and solution as well?


texts: Gettting ERC-20 token transfer count over an API

texts: I am building a service to monitor token activity. Does any service have an API to get the transfer count of a ERC-20 token? I am not interested in individual Transfer events, only their count.


texts: How to connect to Infura Testnet by using WebsocketProvider?

texts:
I want to connect to rinkeby.infura testnet by using WebsocketProvider but the page remains blocked to load.

const Web3 = require('web3');

console.log(Web3.givenProvider);

var web3 = new Web3( new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws'));

var subscription = web3.eth.subscribe('logs', {
    address: '0x8789497B837437632143efFb87d74F40D4EDDcFe'
}, function(error, result){
    if (!error)
        console.log(log);
});

// unsubscribes the subscription
subscription.unsubscribe((error, success) => {
  if (error) return console.error(error);

  console.log('Successfully unsubscribed!');
});

The current version of web3 is: 1.0.0-beta.34


texts:
truffle(develop)> version
Truffle v5.0.5 (core: 5.0.5)
Solidity v0.5.0 (solc-js)
Node v10.15.1

const ApprovalContracts = artifacts.require('../../contracts/ApprovalContracts.sol');

contract ('ApprovalContracts', function (accounts) {
    it('initiates contract', async function() {
        const contract = await ApprovalContracts.depolyed();
        const approver = await contract.approver.call();
        assert.equal(approver, 0xc7780C9521C2C2abED69f0D65BEbF9794C55ae94, "approvers don't match");
    });

    it('takes a deposit', async function() {
        const contract = await ApprovalContracts.depolyed();
        await contract.deposit(accounts[0], {value: 1e+18, from: accounts [1]});
        assert.equal(web3.eth.getBalance(contract.address), 1e+18, "amount did not match")
    })
})

ERRORS

 TypeError: ApprovalContracts.depolyed is not a function
  at Context.<anonymous> (test\approvalcontract.js:10:43)
  at web3.eth.getBlockNumber.then.result (C:\Users\_000\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\testing\testrunner.js:134:1)
  at process._tickCallback (internal/process/next_tick.js:68:7)

 TypeError: ApprovalContracts.depolyed is not a function
  at Context.<anonymous> (test\approvalcontract.js:17:43)
  at web3.eth.getBlockNumber.then.result (C:\Users\_000\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\testing\testrunner.js:134:1)
  at process._tickCallback (internal/process/next_tick.js:68:7)

Im very sure that its the .depolyed and its expecting a function.


texts: Problem when trying to deploy contract due to meteor's modules/scripts

texts:
I have my meteor project
which when i run i get the following warnings:
First warning:

 Mismatched anonymous define() module: function () { return BigNumber; }
      intakeDefines @ aramk_requirejs.js?hash=a2cd915…:1278
      (anonymous) @ aramk_requirejs.js?hash=a2cd915…:1469

Second warning:

Mismatched anonymous define() module: function () { return utf8; }

and when i run my project i get the following error

Uncaught TypeError: Right-hand side of 'instanceof' is not callable
at isBigNumber (http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:5598:19)
at toBigNumber (http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:5465:9)
at Object.fromDecimal (http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:5343:18)
at http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:2613:30
at Array.forEach (native)
at inputTransactionFormatter (http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:2612:8)
at http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:2910:28
at Array.map (native)
at Method.formatInput (http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:2909:32)
at Method.toPayload (http://localhost:3000/packages/modules.js?hash=6e90e44e0c2b18ef12cb22415a388acb1e06ad7f:2935:23)

The line of code where the problem occurs is this: web3.eth.contract(abi).new({data: code,gas:10000}, function (err, contract) {..irrelevant code..} After searching on the internet I think that it is require.js's fault and how the scripts are called but still don't know how to fix it. I already looked over the documentation but still need some help.


texts: Using 'now' to check time in Solidity - safe from miner manipulation?

texts:
I am writing a contract where I am storing the date/time using 'now' and performing date/time checks on those stored values.

My questions is how do you prevent date/time manipulation from miners?

If it cannot be prevented how do contracts even use date/time for critical checks?


texts: How to make transactions without metamask

texts:
My account has enough ether to make a transaction. How do i call a payable function that is written in solidity? I tried by calling like this

    const Web3 = require('web3');

const HDWalletProvider = require('truffle-hdwallet-provider');
const campaign = require('./build/CampaignFactory');

const provider = new HDWalletProvider(
  '12 word mnemonic',
  'https://rinkeby.infura.io/authid',
);
const web3 = new Web3(provider);
const accounts = await web3.eth.getAccounts();
      await campaign.methods.contribute().send({
        from: accounts[0],
        value: web3.utils.toWei(this.state.value, 'ether')
      });

But i am getting this error "intrinsic gas too low". Earlier with metamask extension it used to ask for confirmation if i click submit from metamask then the transaction used to get success. Now since i removed metamask extenstion i am getting this error. I want to make this transaction without metamask. Is it possible to do?


texts: Is there any risk in receiving ETH in a pre-hard fork account having equal amounts of ETH and ETC?

texts:
As written in the title, I am wondering if doing this would be safe, or if there's anything else I should be aware about. I want to buy ETH via Kraken and send it to that account.

I've been reading on the implications of the hard fork and I'm having some trouble making sense of it all, and would like to be safe before doing anything.

Thank you for any help.


texts: How can I send augur token from one account to another one using JSON-RPC api?

texts:
I looked for if eth_sendTransaction method enables me to realize what I'm asking, but I couldn't find sure information, so I want to make sure.

params: [{
  "from": "One account ",
  "to":"another one ",
  "gas": "0x76c0", // 30400
  "gasPrice": "0x9184e72a000", // 10000000000000
  "data":"augur's abi"
  "value":"whatever "
}]

So will the call work as I want?


texts: Can i keep my token inside my private network forever?

texts: I have created a token in ropsten test network, can i keep it in same network forever or create a new private network and keep it there without moving to main network? What are the merits and demerits?


texts: Solidity: call from function to modifier with array

texts:
I have the following problem, I'm trying to call a function from Solidity function to Solidity modifier:

contract B is A

function checkIfIsValid()
    external pure onlyValidAddresses([manually put few addresses]) // what to put here?
{
    // some work
}

(abstract) Contract A

modifier onlyValidAddresses(address[] memory pAddresses)
{
    //work in a loop
    _;
}


texts: Decentralized Identities (DIDs) with biometrics based instead of public key

texts:
is it possible to store and keep biometrics on evm and have this biometric validated through smart contracts? Say a erc 735 based contract?

Since ones public keys and private keys are not the easiest thing to remember.

What data type can one use to store biometric details?


texts: How does Ethereum compare with services like Colu?

texts:
I am researching Ethereum as I am looking for a way to create a new digital currency to support a franchise business. I am currently installing and trying Truffle which, if I understand correctly, will help me write Smart Contracts in Solidity (the Smart Contact language?).

I also came across a small venture called Colu which uses the Bitcoin's blockchain to create assets. As far as I understand, it is done by making micro-transactions on the Bitcoin network and using the description of the transaction as a Database (Please note I am rather new with  Blockchain terminology).

I want to choose a blockchain which I can rely on for years to come. I am wondering what are the cons and pros of each blockchain ecosystem?

To my current understanding, using the BitCoin's Blockchain as a database is in a way a hack and the newborn currency is prone to be effected by Block size changes and fluctuating transaction fees. Yet, I feel I am missing something and that to better understand Ethereum I should better understand the alternatives. So basically my questions are:

What is the proposition of Colu and services like Colu? Are they bassicaly saying "Bitcoin is solid, jump aboard"? hence building on top of Bitcoin's blockchain maturity rather than its fit to hold digital assets?
Is it simply the "old way" vs the "new way"?
Are services like Colu
simply a kind of blockchain-enablers bringing non-tech people closer
to blockchains (any blockchain) via abstraction layers and Frontend
tools?
As a programmer, what are the benefits of simply skipping those convenience-services and starting a crypto-currency on top of Ethereum? Am I more likely to make mistakes which would be hard to correct in the future?

Answers to those questions can help me orient myself in this new world, thanks!


texts:
Is the nonce stored in the Ethereum world state explicitly? Acco. to the yellow paper it does.
But in "Mastering Ethereum", Andreas writes -

However, the nonce is not stored explicitly as part of an account’s state on the blockchain. Instead, it is calculated dynamically, by counting the number of confirmed
transactions that have originated from an address.

Which one is the case?
Thanks.


texts: How is authorization handled in smart contracts

texts:
I have deployed a Quorum network on Azure Block chain service to be used by specific invited members of a consortium. I have not yet explored the privacy features provided by Quorum on top of Ethereum. But i notice certain behaviors that make me wonder about how is authorization handled in any Ethereum based blockchain.

Anyone on the internet who knows the RPC URL(HTTPS Access Key) of any node in the network and has a deployed contract's address & ABI, can create an account on their laptop using web3.eth.accounts.create() and start sending signed messages to read the state variables and execute any functions of any smart contract deployed on the network.
Anyone on the internet who knows the RPC URL(HTTPS Access key) of any node in the network and has a deployed contract's address & ABI, can read state variables and execute get functions of any smart contract deployed on the network without the need for signing, by using the accounts stored on the geth node itself.

Is the authorization done by hardcoding the authorized accounts into the contract and checking them within every function? If so, what happens when the account's private key is lost? Does the smart contract become unusable?


texts: Transaction execution and interacting with truffle

texts:
pragma solidity ^0.4.23;

contract Hotelbooking{

    address receiver;
    function deposit(uint256 _amount) payable public {
        require(msg.value == _amount);
        // nothing else to do!
    }

    function Execution (address _Address, uint _Amount) {
           receiver = _Address;
           receiver.transfer(_Amount);
       }
    function getBalance() public view returns (uint256) {
        return address(this).balance;
    }
}

I want to write a block chain application to transfer ether from one account to another

I tried more blogs and stack overflow questions but nothing is helping me.

I deployed using truffle with following commands

  Hotelbooking.deployed().then(function(i){app = i})

  app.Execution(web3.eth.accounts[1],10)

I tried every blog and stack overflow q&a. I want to transfer ether from one account to another I am getting following error

  at XMLHttpRequest._onHttpResponseEnd
  (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
      at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
      at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
      at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
      at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:134:1
      at /usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
      at Object.InvalidResponse (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)


texts:
contractA
function test() internal {
  stateVariable = 20;
  uint num = 20;
  assembly {
     mstore(0x00, num)
     return(0x00, 0x20)
  }
}

How do I test the return ? I am using hardhat , but i don't think it changes anything.
Step 1: I should create another contract contractB which is a mock and which is the child of the contractA. This way, I can make this contractB's function public and it will include the internal function - test.
After this, I'd appreciate if I could hear your opinions what could be the best way to make sure to test this.


texts: What data should we maintain in blockchain?

texts:
I need little direction on what must be maintained in BC and what must be maintained outside BC. For example I have to maintain book info like name, title, author, book cover as image, price. Can I maintain all the attributes in blockchain? Should I keep the images outside blockchain?

Also how can we keep the information of an entity in sync between the 2 sources?

Thanks in advance for your time and help!


texts: Is there a way to prevent your smart contract from burning ETH, and sending it to your wallet instead?

texts:
So I am writing my own smart contract on remix.ethereum.org, and it is for a token, and in the code, I have written a simple ICO:

function() public payable {
        if (totalSupply >= 1000) {
        BTA+=1;
        } else {
        uint toMint = msg.value/price;
        totalSupply+=toMint;
        balances[msg.sender]+=toMint;
        emit Transfer(0, msg.sender, toMint);
  }

Is there a way for the smart contract to transfer the ether that people send to it to my metamask wallet?


texts: Whisper shh subscribe VS newMessageFilter

texts: Can anyone explain the difference between shh_subscribe and shh_newMessageFilter functions? Their getters (shh_subscription and shh_getFilterMessages) return almost identical results.


texts:
In the Solidity documentation, the definition of calldataload is:

  calldataload(p) call data starting from position p (32 bytes)

But I am really confused by what is call data. Is the call data of the previous transaction or of the current call?

Say if we have a smart contract, we called method1, and then call method2 which contains assembly with calldataload. Will this calldataload load the input of method2 or method1?


texts: Transaction's data vs Smart contract's data

texts:
with reference to this question.
Store specific data related to users
I wanted to ask is there any difference between transaction's data and smart contract's data?
how is transaction's data is cheaper to store?

How can we use IPFS to store database don't we need a server for that?


texts: Can marking object as 'memory' before pushing in Array save gas?

texts:
We have a struct:

struct structEx {
  uint num;
}

And an array:

structEx[] arr;

Have a look at this code snippet, which just instantiates the struct and push:

function f() public {
   structEx s = structEx(0);
   arr.push(s);
}

The above method creates new storage from struct reference and when we push it to arr, copy it to array's storage.

Another way to do this:

function f() public {
   structEx memory s = structEx(0);
   arr.push(s);
}

The above method stores struct instance in memory and copies to storage when pushed to array.

So, as per my understanding second should cost lesser gas than first. Is this correct? feel free to add your thoughts and experience!


texts: Truffle Compile on Windows "Could not find a suitable configuration file"

texts:
I am trying to do a simple Truffle Compile on window 10 using git bash but i keep getting

"Could not find a suitable configuration file"

I have tried "Truffle Compile" after running truffle init.

I am just trying to compile the sample files that came with Truffle like Metacoin


texts: Where solidity files are stored in Remix IDE

texts: No need to elaborate too much. I'm working with some contracts on the browser IDE and I want to make sure they are properly stored. I can access them every time I connect with my laptop but I wonder what can happen if I change laptop/browser and the like


texts:
how can I check the gas cost of a single function in my smart contract?
Thank you


texts:
I am conducting a study on transaction behaviour and dynamics on the Ethereum blockchain. Currently, I am analysing the token transfers of different user groups. After leveraging Google Big Query and Etherscan to get more insights on that, I noticed that there must be different ways of transferring tokens between addresses. I found these two different examples where tokens are transferred:

Token transfer by interacting directly with the token contract (sending a transaction to that contract)
https://etherscan.io/tx/0xf1e3f104ac1edb3008be562f547b0a25f73d7cabccaef02abd15bfd0bf8ce25f

Token transfer by interacting with a smart contract (not the token contract), which then executes one or several token transfers
https://etherscan.io/tx/0x002d18916adee8aa0d690e1b9947281d4272abaf870192233ade43399f2dcd4a

Are there any other ways to transfer tokens and what sort of token transfers do the two examples above illustrate?
Thanks!


texts: How to combine 2 rigs in single share with claymore?

texts:
I have 2 rigs 6 X RX570. Currently each generating 140 Mhs/s. But if I mine same in both rigs for Ethermine.org pool status showing for only for one rig hashrate (140 Mh/s) not combining both. I would like to see Rig1 + Rig2 hash rate around 280 Mh/s into single pool.

Am I doing wrong?

EthDcrMiner64.exe -epool eth-us1.ethermine.org:14444 -ewal MyWalletAddress.tanrigs -epsw x


texts: Is it possible to see the logs of the mempool transactions somehow? What can I do in order to achieve the goal? FYI eth_getLogs does not return logs of the mempool transactions.


texts: Isn't the ethereum wallet keystore encrypted?

texts: I created a ethereum wallet ages ago. However, I noticed when I open the ethereum wallet it does not prompt for a passphrase like alethone. Does this mean my keystore is not encrypted?


texts: How to get deployed contract's address via JSON RPC?


texts: TypeError at compile for public mapping of address ==> uint?

texts:
Maybe this is really obvious but for some reason I can't shake this error. At compile I get the following error:

TypeError: Indexed expression has to be a type, mapping or array (is uint256)
        voteType[msg.sender] = 2;
        ^------^
Compilation failed. See above.

The indexed expression is a mapping to a type (uint) which should be all good.

Relevant code:

function castVote (uint voteType) canVote {
//        require (voteType[msg.sender] == 0);
        if (voteType == 2) {//2 here meaning "Real" account.
        count[upForVote].voteReal++;
        voteType[msg.sender] = 2;
        }
        if (voteType == 1) {//1 here meaning "Fake" acount.
        count[upForVote].voteFake++;
        voteType[msg.sender] = 1;
        }
        voteInProgress[msg.sender] = true;
    }


texts: Is returning an array of structs possible yet?

texts:
From what I can tell this should be possible now:

function test2 () public view returns (Post[]) {
        Post memory post;
        post.sender = msg.sender;
        post.link = "test";
        post.category = "test";
        post.comment = "test";
        post.timestamp = now;

        Post[] storage postsOnPage;
        postsOnPage.push(post);

        return postsOnPage;
    }

Unfortunately I get this error:

Unhandled rejection Error: Invalid solidity type: tuple[]

I'm using web3 version 1.
If its not supported any ideas for a workaround?

Thanks!


texts: what is difference between "gas" "gas price" and "fee"?

texts:
Can we say that gas is the unit of transaction fee ?

And gas price is the same transaction fee ?

If so, why we do not use ether and wei instead of gas ?


texts: What does this following entity exactly means in this PolyMath contract?

texts:
Here I've added code snippet which is I'm learning right now.

The following terms/ entities/ variable are not understandable why exactly it means and why it is used.
- Founder, Advisor, Bonus1/2/3, Airdrop, Reserve, Presale.

uint256 private constant decimalFactor = 10**uint256(18);
enum AllocationType { PRESALE, ADVISOR, FOUNDER, AIRDROP, RESERVE, BONUS1, BONUS2, BONUS3 }

uint256 public constant INITIAL_SUPPLY = 10000000 * decimalFactor;
uint256 public AVAILABLE_TOTAL_SUPPLY = 10000000 * decimalFactor;
uint256 public AVAILABLE_PRESALE_SUPPLY = 30000 * decimalFactor;
uint256 public AVAILABLE_FOUNDER_SUPPLY = 50000 * decimalFactor;
uint256 public AVAILABLE_AIRDROP_SUPPLY = 10000 * decimalFactor;
uint256 public AVAILABLE_ADVISOR_SUPPLY = 20000 * decimalFactor;
uint256 public AVAILABLE_RESERVE_SUPPLY = 2375435 * decimalFactor;
uint256 public AVAILABLE_BONUS1_SUPPLY = 78546 * decimalFactor;
uint256 public AVAILABLE_BONUS2_SUPPLY = 47586 * decimalFactor;
uint256 public AVAILABLE_BONUS3_SUPPLY = 8469840 * decimalFactor;


texts: Struggling with Interactions and Effects when coding

texts: I don't think there is a better place to ask than here. I enjoy coding but I feel like I'm having an uphill battle when I'm getting to the interaction and effect part of various functions, what sort of knowledge is it that I'm having a hard time with? Is It data structures? I'd like to be able to nail this easily, everything else seems like a breeze, so any recommendations would be greatly appreciated!


texts: Explain the relation between geth --miner.gaslimit and etherscan Gas Limit

texts:
Geth command-line options
I am looking at geth command-line options for miners, specifically:
--miner.gastarget value
--miner.gaslimit value

The default value for both is 8000000 on Ethereum according to the documentation. However, I do not understand the documentation description of what they do.
What do these options do exactly when mining blocks?
Etherscan Gas Limit and Gas Used
Blocks on etherscan have a Gas Used and a Gas Limit value. By looking at random blocks, I see that those values are around 12500000. Gas Used is always a percentage of Gas Limit.
What do these values mean exactly?
What is their relation with the above geth options, if any?
You would think that both gas limits are the maximum gas that a block would include, but the value on etherscan does not match the geth default value.
You would also think that gas limit on etherscan is the sum of the gas limit of all the transactions in the block, but I do not think that it is the case.
Thanks for the help.


texts: How are some addresses known to belong to certain exchanges?

texts: I searched for a Ethereum address into etherscan.io and it showed me that it was a Poloniex address. That address was the receiving address of a wallet I created on Poloniex. How did etherscan know it belonged to Poloniex?


texts: ETH cost to deploy a contract - how to minimise?

texts:
I always worked on a private blockchain and I was just deploying a contract onto ethereum and the cost is 15 dollars! I was a little taken back.

Is there a more cost effective to deploy? Why is the cost so high. This is the txn -
https://etherscan.io/tx/0x2985a711357089b3e5b5d5ac693f594e3491f7a09b8988d2f6ac98ef420b58a0


texts: truffle migrates the contract with a weird account which is not from my mnemonic

texts:
I set my infura endpoint and mnemonic to deploy the contract to the Rinkeby testnet. Like this below.

const infuraKey = process.env.INFURA_KEY
const test_mnemonic = process.env.TEST_MNEMONIC

networks: {
  rinkeby: {
    provider: () => new HDWalletProvider(test_mnemonic, `https://rinkeby.infura.io/v3/${infuraKey}`),
    network_id: 4,
    gas: 6900000,
    gasPrice: 10000000000,
    confirmations: 2,
    timeoutBlocks: 200,
    skipDryRun: true
  }
}

My account[0] is 0xeA28Ab53fFF23859c64DB5BAaA64E466713Afae7, but when I try to deploy with this command truffle migrate --network rinkeby, it fails with this error like below.

Error: Error: Error:  *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds

* Account:  0x9416c8F57eddFeb491F2d728EEb13781662Ac606
* Balance:  0 wei
* Message:  insufficient funds for gas * price + value
* Try:
  + Using an adequately funded account
  + If you are using a local Geth node, verify that your node is synced.

at Object.run (/Users/deleo/.nvm/versions/node/v12.13.0/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:96:1)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

I've searched that if my mnemonic includes 0x9416c8F57eddFeb491F2d728EEb13781662Ac606, but it didn't. I have no idea why truffle keeps migrating with wrong account.

UPDATE

I've found that at truffle console (truffle console --network rinkeby), I typed web3.eth.getAccounts() and it showed that the first account is 0x9416c8F57eddFeb491F2d728EEb13781662Ac606. Why truffle migrate uses this default account after I set my mnemonic? And where is this default account set from? How could I set my config to use my mnemonic?


texts: How to access event log data using web3j

texts:
In my smart contract, I have defined following event:

event logDomainFilter(uint128 indexed _campaignId, uint128 indexed _flightId, uint128 indexed _siteId, string _siteName, string _whiteListDomains, string _blackListDomains);

Now in my java code, I am trying to get data using following code:

  EthFilter eventFilter = new EthFilter(
                                    DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST,
                                    contract.getContractAddress()
                            );
                            eventFilter.addSingleTopic(EventEncoder.encode(contract.LOGDOMAINFILTER_EVENT)); // filter: event type (topic[0])
                            eventFilter.addNullTopic();
                            eventFilter.addOptionalTopics("0x" + TypeEncoder.encode(new Uint256(flightId)));
                            eventFilter.addOptionalTopics("0x" + TypeEncoder.encode(new Uint256(siteId)));
                            final int recordsCount = web3j.ethGetLogs(eventFilter).send().getLogs().size();

 List<EthLog.LogResult> logResults = web3j.ethGetLogs(eventFilter).send().getLogs();

I am getting the right count of records but not able to access values stored in that log.

I want to access all the logs and store them in java variable so that I can pass the values to frontend api...

I am new to solidity and web3j please help me.


texts: Making call with contract instance vs making call with hashed method ID

texts:
As I understand there are two main ways to call a function in another contract.

1.) Using the 4 byte methodID ----> address.call(bytes4(sha3('foo()'))

2.) Using the contract ABI  --->  contractInstance.foo()

I was wondering if anyone could explain why making a call with the bytes4 method ID can only indicate an  out-of-gas error while making a call with the ABI can return actual values. I'm guessing it has something to do with the ABI, but I'd like to understand what is going on under the hood here.
Thanks.


texts:
I want to create an NFT that can mint different character types and multiple clones of each type. The clones within each type will start with same metadata, but each individual token should have its own XP value which can change over time.
This variable needs to be able to be displayed on platforms such as opensea.
Should I create a mapping of token id to XP value in the ERC1155 contract, then get my metadata API to read the current XP value from the blockchain?
Or are there examples to implement this more efficiently?


texts: How do I get an address with a correct checksum, from an address with an incorrect checksum, using Solidity?

texts:
Example of an address with the wrong checksum:

  0xa54D3c09E34aC96807c1CC397404bF2B98DC4eFb

Example of an address with the right checksum:

  0xa54d3c09E34aC96807c1CC397404bF2B98DC4eFb

-Difference is the first letter "D".

Which function call should I make in Solidity to convert the wrong checksum address to a right checksum address ?


texts: Updating to web3, contract void method not executing

texts:
I have two client sides (web3 js) linked to the same contract, the previous web3 js version works fine:

function voteForCandidate() {
  candidateName = $("#candidate").val();
  contractInstance.voteForCandidate(candidateName, {from: '0xA07D6641208b3dd97B24F6De81bb939Aec397F0B'}, function() {
    console.log(contractInstance.totalVotesFor.call(candidateName).toString()); // returns correct value
  });
}

But this code, implementing the new version of web3js (1.0.0-beta.33), doesn't:

contractInstance.methods.voteForCandidate(web3.utils.asciiToHex(candidateName))
.call({from: '0xA07D6641208b3dd97B24F6De81bb939Aec397F0B'}, function(error, result) {
    contractInstance.methods.totalVotesFor(web3.utils.asciiToHex(candidateName)).call().then((num_votes) => {
        console.log(num_votes); // returns current value, does't increment
    });
});

It seens to me that contract method voteForCandidate works in previous version (my first example) of web3js, it increments the votesReceived[candidate] value, but doesn't work with newer version, of the client side.

No error is thrown, just doesn't increment.

My Solidity contract is:

pragma solidity ^0.4.11;

contract Voting {

  mapping (bytes32 => uint8) public votesReceived;

  bytes32[] public candidateList;

  function Voting(bytes32[] candidateNames) {
    candidateList = candidateNames;
  }

  function totalVotesFor(bytes32 candidate) returns (uint8) {
    if (validCandidate(candidate) == false) throw;
    return votesReceived[candidate];
  }

  function voteForCandidate(bytes32 candidate) {
    if (validCandidate(candidate) == false) throw;
    votesReceived[candidate] += 1; // <-- doesn't increment with the example 2 of client side above
  }

  function validCandidate(bytes32 candidate) returns (bool) {
    for(uint i = 0; i < candidateList.length; i++) {
      if (candidateList[i] == candidate) {
        return true;
      }
    }
    return false;
  }
}


texts:
pragma solidity ^0.4.24;

contract MemoryAndStorage {
    mapping(uint => User) users;
    struct User{
        uint id;
        uint balance;
    }

    function addUser(uint id, uint balance) public {
        users[id] = User(id, balance);
    }

    function updateBalance(uint id, uint balance) public {
        User storage user = users[id];
        user.balance = balance;
    }

    function getBalance(uint id) public view returns (uint) {
        return users[id].balance;
    }

}

I have questions about the updateBalance function.

Question 1) As we know , there're pointers (storage pointers and memory pointers) and there're actual datas. First I am interested, if both storage pointer and the data that pointer is actually pointing to are both saved in storage?

Question 2) so in a function updateBalance, where does user variable got created that's pointing to users[id]?

Question 3) if I wrote the User memory user = users[id]; would that variable got created in memory storage and it would watch the data that'is in storage ?

Question 4) If I write the following : User storage user = User(5,10); there's an error. why?


texts: Ethereum stores its own data, how to synchronize the data to other nodes in the future

texts:
I use smart contracts in Ethereum to store some string data, how to synchronize these stored string data to other nodes.
As far as I know, these string data are stored in the node's leveldb database, then how do other nodes synchronize this leveldb database.
For example, how to synchronize the string data stored in node a to node b


texts: How to debug contract in Ropsten network (using orazlize.it)?

texts:
I am developing smart contract that involves random number usage. I decided to use oraclize.it to get it according to this example. Documentation says that Oraclize smart contract available in Ropsten net and I running local Parity node with test accounts in Ropsten.

But it totally stuck on get it running - Parity says "contract will raise error" on deployed on and only way to run it without exception is to remove all lines referenced oraclize code.

Here is my simplest contract:

pragma solidity ^0.4.0;

import "./oraclizeAPI_0.4.sol";

contract GetRandom is usingOraclize {
    event newRandomNumber(bytes);

    function GetRandom() {
        oraclize_setProof(proofType_Ledger);
        update();
    }

    function __callback(bytes32 _queryId, string _result, bytes _proof) oraclize_randomDS_proofVerify(_queryId, _result, _proof) {
        // if we reach this point successfully, it means that the attached authenticity proof has passed!
        if (msg.sender != oraclize_cbAddress()) throw;

        newRandomNumber(bytes(_result));
    }

    function update() payable {
        uint N = 7; // number of random bytes we want the datasource to return
        uint delay = 0; // number of seconds to wait before the execution takes place
        uint callbackGas = 200000; // amount of gas we want Oraclize to set for the callback function

        // this function internally generates the correct oraclize_query and returns its queryId
        bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);
    }
}

Because Parity cannot "import" files I just replaced "import" statement with content of latest Oraclize API (0.4) file.

And it simply does not works.

I would like to run this code in Remix but it unable to connect to my local node. More exact it looks like it connected but contract cannot be deployed - i always got error related to incorrect JSON-RPC response (usually it means that connection to node unsuccessful).


texts: Not accessing metamask address through web3.eth.getCoinbase

texts:
I'm trying to run following code:

   App = {
  web3Provider: null,
  contracts: {},
  account: '0x0',

  init: function() {
    return App.initWeb3();
  },

  initWeb3: function() {
    // TODO: refactor conditional
    if (typeof web3 !== 'undefined') {
      // If a web3 instance is already provided by Meta Mask.
      App.web3Provider = web3.currentProvider;
      web3 = new Web3(web3.currentProvider);
    } else {
      // Specify default instance if no web3 instance provided
      App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545');
      web3 = new Web3(App.web3Provider);
    }
    return App.initContract();
  },

  initContract: function() {
    $.getJSON("Election.json", function(election) {
      // Instantiate a new truffle contract from the artifact
      App.contracts.Election = TruffleContract(election);
      // Connect provider to interact with contract
      App.contracts.Election.setProvider(App.web3Provider);

      return App.render();
    });
  },

  render: function() {
    var electionInstance;
    var loader = $("#loader");
    var content = $("#content");

    loader.show();
    content.hide();

    // Load account data
    web3.eth.getCoinbase(function(err, account) {
      if (err === null) {
        //------------account is null here------//
        App.account = account;
        $("#accountAddress").html("Your Account: " + account);//shows null
      }
    });

    // Load contract data
    App.contracts.Election.deployed().then(function(instance) {
      electionInstance = instance;
      return electionInstance.candidatesCount();
    }).then(function(candidatesCount) {
      var candidatesResults = $("#candidatesResults");
      candidatesResults.empty();

      for (var i = 1; i <= candidatesCount; i++) {
        electionInstance.candidates(i).then(function(candidate) {
          var id = candidate[0];
          var name = candidate[1];
          var voteCount = candidate[2];

          // Render candidate Result
          var candidateTemplate = "
" + id + "	" + name + "	" + voteCount + "
"
          candidatesResults.append(candidateTemplate);
        });
      }

      loader.hide();
      content.show();
    }).catch(function(error) {
      console.warn(error);
    });
  }
};

$(function() {
  $(window).load(function() {
    App.init();
  });
});

In web3.eth.getCoinbase(function(err, account){...}); the account value is null. I couldn't figure out. Any help would be appreciated. Thanks.


texts:
I have tried both
pragma solidity ^0.5.0;

import "openzeppelin/contracts/math/Math.sol";

pragma solidity ^0.5.0;

import "@openzeppelin/contracts/math/Math.sol";

Getting an error for both codes ( I already have installed the openzappelin).
Error: Could not find openzeppelin/contracts/math/Math.sol from any sources
How can I use the openzappelin packages in the smart contract?


texts:
I am increasing the value at a particular index in Solidity but it is giving me bad instruction error.
Can anyone tell me what I am missing here?
Please check the sample contract for reference:
pragma solidity >0.6.0;

contract abs{
    uint256[] public amounts;

    function contractParams(uint256 index, uint256 val) external{
        amounts[index] = amounts[index] + val;
    }
}


texts: Redeploying a contract using bytecode on the blockchain?

texts:
It seems redeploying a contract using bytecode on the blockchain is not possible (even assuming the ABI is known). The reason for this assumption is that the compiled code includes instructions for initialization including any constructor actions, however, the return data on contract initialization written to the block does not include constructor instructions. If it is possible to reconstruct and redeploy with information already extant on the chain, I would love to see how this is possible.

[In a side note: recent versions of the compiler provide "runtime bytecode" which allows one to check the validity of source code. This code should match contract code deployed to the block.]


texts: Why a user can't just call the token contract for transfer and not the marketplace?

texts:
I have maybe a weird question.
But let's say there is contract of T (token ERC721) and contract of M (marketplace). The marketplace has a method .buy which does a transfer of a token to the buyer, pays the seller and takes a fee.
In a made up situation my friend wants to transfer me a token, but not pay any fees. Can't he just call the contract of T.safeTransferFrom directly and not the M.buy which deducts money?


texts: Why is etherscan showing ERC223 tokens as ERC20

texts:
I created one token (ERC223) in mainnet using Remix and I tried to search that token address in etherscan.io but it's showing token type as ERC20.

Can you please explain why it shows up like this?


texts: Error in syncing of Ropsten testnet on geth node

texts:
I am using a geth node to sync with the ropsten testnet . For the last few days I have been encountering the following error frequently

Error: invalid gas used (remote: 7987157 local: 7897475)

All the peers get dropped . But in some time , the peers are added back and the sync starts again . What could be causing this and what can be done to resolve this?


texts: How to get transaction hash in a geth tracer?

texts:
I am trying to build a custom tracer, similar to these. To be specific, I am trying to add transaction hash info to call_tracer.js.

I have tried looking at Go code which initializes the tracers and checking every possible function call or property I could find, but I was unable to get the current transaction ID. Is this information even available to the tracer?

I am running code like this:

$ nc -U /opt/geth1.8/geth.ipc
{"id": 1, "method": "debug_subscribe", "params": ["traceChain", "0x6714a", "0x6714b", {"tracer": "{ step: function(log, db) {}, fault: function(log, db) {}, result: function(ctx, db) { return {ctx: ctx}; }, }"}]}

Tracer is an object which defines 3 functions, step, fault and result - my question is, how do I get current transaction hash in either step() or result()?


texts: How to change a total supply of tokens on an existing ether contract?

texts: I created my token using token factory but I sent them by accident to MEW address and not meta mask address - I didn't send eth to my contract address via meta mask so all my tokens got lost. I really like my token name and I would like to increase total supply but I don't know how. Could you please provide me with a short step by step instructions how to do that? You'd save my day :) Thank you, thank you very much in advance.


texts: Get values from stack when certain Opcode is called

texts:
I am currently trying to use genetic algorithms to automatically generate test cases that for ethereum smart contracts similar to https://ieeexplore.ieee.org/abstract/document/7840029>this paper. In order to do this, I need to be able to evaluate how close a particular function is to satisfying a branch predicate. Looking at the opcodes can tell me when a branch predicate occurs for example:

...
SLOAD
TIMESTAMP
GT
DUP1
ISZERO
PUSH2 0x10f
JUMPI
#... More opcodes

In the example above, a value is retreived from storage and compared to the block timestamp. If the value is greater than the timestamp, the execution continues with #... More opcodes and otherwise it jumps to 0x10f. I would like to be able to somehow extract the value for SLOAD and TIMESTAMP at the time of execution.

More generally my question is: Is there any way to get the values that are on the stack when the "GT" opcode is executed? Ideally I would like to do this in pyevm, but another way is also fine if you know it.


texts:
I reviewed the transactions from a recent ICO.  The account below provided the largest investment.  If you check the account,  there is a far greater Out value than In.   I was under the impression that IN and OUT had to be equal.  How is this possible?

https://etherscan.io/txs?a=0xa65e9fec4f892ef6e9fe3888ed9b0eb6aab1f0fd

Just curious

Thanks


texts: How do I print my account balances and TheDAO tokens from geth

texts: Is there a convenient script to print out my account balances and TheDAO tokens from the go-ethereum client geth?


texts: Always raising "Gas required exceeds allowance or always failing transaction" when the condition of require() is not met

texts:
I tried to run the following code to check the error message when the condition of require() is not met.

pragma solidity ^0.5.16;
...
function addUser(string memory name) public returns (int) {
   require(!userList[msg.sender].isSigned, "You already have an account.");
   ...
}

When the condition of require() is met, it worked as expected, but when the condition wasn't met, I could always see the following error message:

  transact to Messenger.addUser errored: gas required exceeds allowance (8946128) or always failing transaction

I thought that the problem was due to the gas limit of the block, so I increased the gas limit from ten thousand to one million. However, the problem was not solved and I don't know what the cause is.

What I want to ask is

Does solidity always show that error message when the condition of require() is not met?
How to check the message("You already have an account.") I specified in require()?

Thanks for help :)


texts: Error: types/values length mismatchProblem when calling payable contract function with web3

texts:
Enviroment

Node version: v10.15.3
Web3: ^1.0.0-beta.50
Net: Ropsten

My smart contract is a very simple payable/balance one and my goal is to contribute 0.1 ETH to raise the contract balance using web3:

pragma solidity >=0.4.25 <0.6.0;

contract Demo {
 uint public balance;

 constructor() public
 {
  balance = 0;
 }

 function contribute() public payable
 {
  balance += msg.value;
 }
}

And Im trying to call contribute function with web3:

import Web3 from "web3";
import Tx from "ethereumjs-tx";
import contractAbi from "./contractAbi";

    const web3 = new Web3("https://ropsten.infura.io/v3/xxxxxxx");

    const contractAdress = "xxxx";
    const my_public_key_address_1 = "yyyy";
    const privateKey1 = "vvv";

    const txCount = await web3.eth.getTransactionCount(my_public_key_address_1);
    const contract = await new web3.eth.Contract(contractAbi, contractAdress);

    const txObject = {
      nonce: web3.utils.toHex(txCount),
      to: "xxx",
      gasLimit: web3.utils.toHex(41000),
      gasPrice: web3.utils.toHex(web3.utils.toWei("4", "gwei")),
      data: contract.methods.contribute(100000000000000000).encodeABI(),
      chainId: 3,
    };
    //
    const tx = new Tx(txObject);
    tx.sign(privateKey1)
    const serializedTx = tx.serialize()
    const raw = '0x' + serializedTx.toString('hex')

    const txHash = await web3.eth.sendSignedTransaction(raw)

And Im getting this error:


texts:
guys. I have created simple contract, migrated to testnet via truffle. It can be founded here. But I can't verify it. I double check:
1. name of contract
2. version of compiler (ver. 0.4.11 in etherscan and in solc inside truffle)
3. optimization is enabled as in truffle they are enabled
4. we have no construtor arguments or imports

I try migrating several times with my friend. No success. Any suggestions or help?


texts:
when I attempt to transfer my EOS or SNT from my parity wallet to any other wallet or exchange.. is this normal or is there any advice on how I can go about doing that?

I believe that my private key was stolen in an airdrop scam and now I need to move the coins out of parity. It says that my balance is not available but clearly shows the coin in the wallet.


texts: How to use MEW to access simple wallet contract created in Ethereum Wallet / Mist

texts:
I picked up some ETH around a year and a half ago and left it in a simple wallet contract created using the Ethereum Wallet / Mist in July 2017.

I'm offering a reward of $100 in ETH to the person that can help me gain access to this ETH as I'd like to move it into cold-storage.

For a couple of weeks now I've been attempting to access the wallet by syncing to the blockchain but much like others, I have been unable to get past the last few 100-150 blocks each time.

The light sync is practically unusable and I believe I do not have enough storage space to sync the full blockchain as it has massively increased in size and does not fit on my current hard drive.

If I had left the ETH in my account:

https://www.etherchain.org/account/fb42a50c3eefdd2e32cbd056ea8bfcb172d4b75a

I couple simply use MEW to transfer the ETH out of the account and be done with Mist.

However... thinking I'd be smart and add an extra layer of security / learn to use the wallet interface by doing, I've left the ETH in said simple wallet contract:

https://www.etherchain.org/account/ad24b48f33746e68bdcdc2e7f5857ee0eeec2efb

More information on wallet contracts:

https://klmoney.wordpress.com/beta7-contract-wallets/

I am aware that MEW has added contract functionality and I have the keystore associated with this contract (a single sig. contract) that should in theory unlock the ETH and make it accessible, however even with the correct ABI input given the MEW contract options I cannot work out the way to extract the ETH from this wallet either to the account associated or to a different address.

My question (or essentially plea for help) is:

1) Is there a way to interact with my wallet contract using the MEW contract interface (or another software)

EDIT:

I believe there are 2 other fixes that are possible also...

1) There is a way to reduce the chaindata folder size of the blockchain import (pruning), though I believe there is still functionality issues with importing the last 100-150 blocks given the reading I've done on github. Are there people out there that have successfully synced to Mist in recent times, if so, how?

2) Another potential fix is importing my private key into Parity and gaining access to my wallet contract here instead. The Parity option is something I haven't looked into too much, is it at least theoretically possible to import a keystore and gain access to associated wallet contracts through Parity?

Thanks for your time.


texts: How can I use ERC20 tokens in a way to buy an ERC721 token?

texts:
I would like to do a smart contract that allow me to buy an ERC721 token using an ERC20 token to pay

In my mind is something like:
-I create a ERC721 token
-I create a ERC20 token
-I have a plattaform to buy the ERC721 with the ERC20 token

Thanks for the help !


texts: Can I mine without synchronizing the blockchain by using a mining pool?

texts:
Since I'm not able to complete the blockchain synchronization, can I just mine using a pool? And if it's possible, how do I retrieve the coins?

P.S. I made an offline wallet with a Rpi, given that I could not sync.


texts: Sharding: Shards with different properties?

texts:
I am currently trying to get more into sharding but there's one question I haven't found any answer to yet.

Could sharding introduce shards with different properties? For example could Shard A have a block time of 10 seconds, a gas limit of 8 million and Shard B a block time of 4 seconds and a gas limit of 2 million?


texts: Ethereum Wallet / Mist v0.8.8 keeps shutting down and therefore not syncing

texts:
I hope someone can help.

I have Ethereum Wallet v0.8.8 and Mist v0.8.8 (windoes 64bit). They open OK, and looks like they start to sync with the blockchain. However, after 30-60 seconds they always shut down automatically.

I've tried opening Mist on it's own, and Ethereum Wallet on its own. Same problem with each one.

Any ideas?

Thanks


texts: Is it possible to send a secret message to a specific Ethereum Address using a smart contract?

texts:
I have a secret message that I want to share it with a specific Ethereum Address using a smart contract and I want no one else to see it except that specific Ethereum address user. Is it possible?

If I share it via event everyone would see it.
If I set a variable and code a getter for that, also everyone could access it.

[Q] I know that everything is public on the blockchain, but somehow is it possible to keep a string private for the specific user and only that specific user can view it?


texts: Subtract to get decimal values in ERC20 Contract

texts:
I tried to split real and decimal values.
For eg. 209/100 => 2.09  So i want to store 2 is one variable and 0.09 into another variable. but its return zero always.

uint256 realToken = (209/100) ;                    //output 2
uint256 refundToken =   ((209/100) - realToken  )*10**18;   //output is 0

refundToken value should be 90000000000000000 but returned 0

Please give suggestion and


texts: How does a miner verify the output of a smart contract?

texts:
I am new to Ethereum and smart contracts. I understand ethereum is modeled as a state machine and smart contracts work as "agents" to change the state through transactions. However, it seems rather impossible for a miner to verify the smart contract output unless he understands the logic encoded in smart contract.

Consider following examples

A smart contract that transfers the vehicle ownership from A to B. The local account runs this contract with enough gas and input as car registration number, from and to as data ( arguments ) to smart contract. What does miner verifies here? He / She doesn't have access to government vehicle registration database.
A smart contract calls 2 or 3 other contracts and depending upon the output from these contracts, determines the next steps say make a reservation. How miner is going to verify this output?

Please let me know.

Thanks.


texts: Why does Ethereum use JSON-RPC and not gRPC?

texts: I am fairly new to networking protocols especially JSON-RPC and gRPC as they are not nearly as common in web development as REST. I was reading around and seems like gRPC generally performs better. So why does Ethereum and other blockchains tend to use JSON-RPC and not gRPC?


texts: Etherscan shows transaction dropped but also transferred successfully to coldstorage. Coldstorage shows all funds recieved

texts:
I sent eth from my hot wallet to cold storage successfully. I sent a second time a few minutes later successfully. I then see on my hot wallet history the first transaction changes to "submitted" status. Etherscan shows the first transaction as dropped and replaced, but also shows that the eth has been sent to my coldstorage. My coldstorage app also shows that all eth was recieved.
What to do?? appreciate any help!


texts: Unable to build parity from source on macOS

texts:
Just did a fresh clone from github and:

cargo build --release --features final

gives me a link error:

  = note: Undefined symbols for architecture x86_64:
            "_je_malloc_usable_size", referenced from:
                heapsize::heap_size_of_impl::hc4000c6f954eaceb in libheapsize-95360de80c444e06.rlib(heapsize-95360de80c444e06.heapsize.68twyoht-cgu.1.rcgu.o)
                _$LT$alloc..string..String$u20$as$u20$heapsize..HeapSizeOf$GT$::heap_size_of_children::haf2fa16c6b4e920b in libheapsize-95360de80c444e06.rlib(heapsize-95360de80c444e06.heapsize.68twyoht-cgu.4.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: Could not compile `parity-ethereum`.

My config is:

rustc 1.32.0
macOS High Sierra 10.13.6

Is there a workaround for this link error?


texts:
I have a running blockchain on 128.230.208.73 .
I have created local-node on my system using following commands:

geth --datadir bkc_data --networkid 89992018 --bootnodes enode://9b46f0691dd12ae427adde13988a56e4691ddcba52f7d6f32d4a4129c709196d1ade96985a9522aa73cac957b666b1f41d69ebceae350643ae83217196e6240d@128.230.208.73:30301 --rpc --rpcaddr "127.0.0.1" --rpcport "8545" --rpcapi=eth,web3,net,personal,ssh,db,debug --nodiscover console 2>console.log

Inside geth console, I am adding peer using command:

admin.addPeer("enode://62bceb7302bf4368858a15c408ab8d57a263cb590fb4a6ccb588a1ecad42266772370c5d6b3cdaa1a1284c80f6f3fe959ba1453761482fbcc9920a4c2c7099ab@128.230.208.73:30303")

Now in the same directory, I have abc.js which has following code:

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:8545"));

console.log("block number => "+web3.eth.blockNumber);

Now, in terminal, I am running node abc.js from same directory but I am getting block number => undefined

Kindly let me know, where I am making mistake.
Any help is appreciated.
Thank You.

Note: (Let me know if you need more information).


texts: How can one use the tokens provided by a crowdfunding platform?

texts: I was reading about Weifund crowdfunding. In it, some custom crypto-tokens are provided to investors in exchange for an invested amount. I just want to know how will that investor use that token so that the same also gets the profit of investment? Correct me if I am wrong in any means.


texts: Add myToken as payment and as pay to in smart contract

texts: Hi I have a token that I am trying to use as payment for a smart contract and to pay out. How can I do that in solidity where payment is not ether but rather my token?


texts: Is there a way to let the user know why the contract transaction/function is failing?

texts:
For example, if a user is attempting to send below the minimum investment amount to a crowdsale contract, or if a user is sending above the maximum investment amount.

Ethereum wallet just says "This transaction will fail..." no matter what. It may be very confusing for some buyers.

How does one get around this and make it more user friendly?


texts:
I have created library and imported in my contract. I am not able to link the library in deployment file.

solution needed. thanks in adv

pragma solidity ^0.4.2;

library StringUtils {
    /// @dev Does a byte-by-byte lexicographical comparison of two strings.
    /// @return a negative number if `_a` is smaller, zero if they are equal
    /// and a positive numbe if `_b` is smaller.
    function compare(string _a, string _b) returns (int) {
        bytes memory a = bytes(_a);
        bytes memory b = bytes(_b);
        uint minLength = a.length;
        if (b.length < minLength)
        minLength = b.length;
        //@todo unroll the loop into increments of 32 and do full 32 byte comparisons
        for (uint i = 0; i < minLength; i ++) {
            if (a[i] < b[i])
                return -1;
            else if (a[i] > b[i])
                return 1;
        if (a.length < b.length)
            return -1;
        else if (a.length > b.length)
            return 1;
        else
            return 0;
        }
    }
    /// @dev Compares two strings and returns true iff they are equal.
    function equal(string _a, string _b) returns (bool) {
        return compare(_a, _b) == 0;
    }
    /// @dev Finds the index of the first occurrence of _needle in _haystack
    function indexOf(string _haystack, string _needle) returns (int) {
        bytes memory h = bytes(_haystack);
        bytes memory n = bytes(_needle);
        if (h.length < 1 || n.length < 1 || (n.length > h.length))
            return -1;
        else if (h.length > (2**128 - 1))
            return -1;
            else {
                uint subindex = 0;
                for (uint i = 0; i < h.length; i ++) {
                    if (h[i] == n[0]) {
                        subindex = 1;
                        while (subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) {
                            subindex++;
                        }
                        if (subindex == n.length) {
                        return int(i);
                    }
                }
            }
            return -1;
        }
    }
}

my contract

import "./StringUtils.sol";
contract SaveData is Whitelist {
function verifyHash(address publicAddress, string hashstring) external returns (string) {
        require(StringUtils.equal(data[publicAddress],hashstring));

    }
}

in deployment:-

var WhiteList = artifacts.require("./Whitelist.sol");
var SaveData = artifacts.require("./SaveData.sol");
var StringUtils = artifacts.require("./StringUtils.sol");

module.exports = function(deployer) {
  deployer.deploy(WhiteList);
  deployer.deploy(SaveData);
  deployer.deploy(StringUtils);
};


texts: Where exactly do DApps run? Who gets rewarded for running them?

texts: So I am currently running a full node, as well as a GPU miner. I am curious first of all where do DApps get run? They wouldn't make sense to run on a GPU as they aren't very parallizable, so I am assuming by a full node. But I never noticed any income being generated by my full node. Where does all the Ether go that is used in Gas to run a DApp? Someone must be running them, and I presume they would get the gas a reward?


texts: Signature generated through web3.eth.sign not leading to same address after fromRpcSig

texts:
I am trying to write sign a challenge using web3.eth.sign, web3 uses ganache.provider(),
But when i do fromRpcSig(signature) ecrecover(challenge) which results in different address. But when i sign using metamask web3 every thing works fine. I am writing test suit for signin using ganache-cli. Thanks in advance

//front end code using metamask injected web3
web3.eth.sign(web3.eth.defaultAccount, web3.sha3(challenge), async (err, signature) => { Here i will send signature to backend })

//Backend code
const eutil = require('ethereumjs-util');
const sig = eutil.fromRpcSig(signature);
const publicKey = eutil.ecrecover(eutil.sha3(challenge), sig.v, sig.r, sig.s);
const address = eutil.pubToAddress(publicKey).toString('hex');

// Test suit
same as front end but using ganache provider

Url for full code
https://github.com/pramodramdas/digital_healthcare
front end code: src->components->login.js->login()
back end code: routes->auth-routes.js
test suit: tests->check_flow.test.js->test case('Check Signin')

test case is not working with current implementation, but metamask implementation works as expected


texts: How to give more resources to Ethereum Wallet?

texts:
I downloaded the Ethereum Wallet a few weeks ago. Since then it has been syncing with the network (I don't have it running all the time). As today  the block download progress is 3.700.000/3.912.000.

I been researching how to make the process faster and the general answer is that the process is slow because is very cpu intensive, which brings up my question.

While the app is running in my computer the cpu usage doesn't reach 15%, the network usage is less than 1mbps (of 300 available) and the disk read and write speeds are around 10MB/s.

So I do not understand what is being the bottleneck. Maybe the program itself has a limit assigned in the use of resources.

So I was wondering if that is the case and how I could make Ethereum Wallet take advantage of my computer resources to achieve a faster syncing.

UPDATE

I'm running Geth 1.6.5


texts: How to check Ethereum smart contract info?

texts:
I want to know 3 things:

Is an address a smart contract?
Is this smart contract an ERC20 or ERC721 token?
Is the Solidity code public?


texts: ParserError: Expected identifier, got 'LParen' in Remix simple auction using Solidity

texts:
The line highlighted in the error is require(bid2 > highestBid2);

The code:

pragma solidity ^0.4.22;

contract SimpleAuction {

    address public beneficiary;
    uint public auctionEnd;

    address public highestBidder1;
    uint public highestBid1;

    address public highestBidder2;
    uint public highestBid2;

    uint public proportion;
    uint public bid1;
    uint public bid2;

    mapping(address => uint) pendingReturns;

    bool ended;

    constructor (uint _biddingTime) public {
        beneficiary = msg.sender;
        auctionEnd = now + _biddingTime;
    }

    function () public payable{
        makebid(proportion);
    }

    function makebid(uint var1) public payable {

        proportion = var1;
        bid1 = var1 * msg.value;
        bid2 = 1 - var1 * msg.value;
        require(now <= auctionEnd);

        require(bid1 > highestBid1);

        if (highestBid1 != 0) {
            pendingReturns[highestBidder1] += highestBid1;
        }
        highestBidder1 = msg.sender;
        highestBid1 = bid1;

    }

        require(bid2 > highestBid2);

        if (highestBid2 != 0) {
            pendingReturns[highestBidder2] += highestBid2;
        }
        highestBidder2 = msg.sender;
        highestBid2 = bid2;

    }

}

Thank you in advance!


texts:
With SWARM, can ALL files be split/partitioned and/or replicated onto a Minimum Limit number of nodes whilst uploaded to the network?

Could the Minimum Limit number be >50 nodes and the replication >5 nodes? This would give ETH users greater reassurance to support the network. There are strict compliance standards for companies as to the location of stored client data (so perhaps in future we can also select nodes by region eg. within Europe / Outside Europe) also.

There are many strengths and weaknesses for censorship resistance - although any Copyrighted/Illegal material needs to have the ability to be flagged or effectively un-hashable (as good as removed) once discovered by the network users upon data retrieval. So I personally think SWARM should restrict certain media/file formats from being uploaded. Those multimedia formats should be left to separate systems like IPFS to deal with.


texts: Is there any anonymity in Proof-of-Authority?

texts:
According to the following article,

  Proof_of_Authority (PoA) is a modified form of Proof_of_stake (PoS)
  where instead of stake with the monetary value, a validator’s identity
  performs the role of stake. In this context, identity means the correspondence between a validator’s personal identification on the platform with officially issued documentation for the same person, i.e. certainty that a validator is exactly who that person represents to be.

Article Link

If so, is everybody able to know personal information of a validator like first and last name as a validator ?
And if so, we can say that there is no anonymity in Proof_of_Authority?

  And this does not affect decision of validators to decide about transactions confirmation ?


texts: Are internal functions in libraries not covered by linking?

texts:
According to the documenation when using a library with internal functions, the function's bytecode gets inlined into the calling contract's function.

Can someone confirm if the following is therefore a correct observation?

library A {
   function doSomething() constant returns (uint) { return 10; }
   function doInternal() internal constant returns (uint) { return 99; }
}

library B {
   function doSomething() constant returns (uint) { return 2000; }
   function doInternal() internal constant returns (uint) { return 8888; }
}

contract Consumer {
   function execute() {
      uint x = A.doSomething();
      uint y = A.doInternal();
   }
}

Compile the Consumer contract to produce an unlinked .bin
Deploy library B
Use solc to link A references in the Consumer contract to the address of deployed library B
Deploy the Consumer contract

When invoking the execute() of the Consumer contract, the result would be

x == 2000
y == 99

This means that the doInternal() function will always yield 99 as a result, because it was inlined into the consumer contract and was not affected by the linking.

This means it's possible when using libraries and linking to end up with essentially calling functions across multiple libraries. A rather dangerous situation as it's a fact that is hidden from most users and not explicit in the documentation.


texts:
I have a loop that requests past events to my geth instance by batches of 5000 blocks.
It always stucks after precisely 628 request and I get a timeout.
Anyone knows why ?
Thank you !


texts:
I am trying to fetch the transaction information from Ethereum and ETC, i have encountered the below errors message .

outofgas
Reversed
badjump destination
bad instruction.
If we have these errors in the transactionhash , do we need to consider them as successful or failure?
Also if they have internal transactions, what to do? consider them as success or failed?


texts: How to get biggest holders for specific token?

texts:
I am trying to get a descending list of biggest token holders like is displayed on etherscan. I could not locate an api to do this. I looked at EtherScan and EthPlorers api but did not see anything pertaining to this.

Does anyone know how i can do this in java?


texts: two of transactions initiating the same smart contract in one block during state transition cycle, what happen?

texts:
if two of transactions initiating the same smart contract in one block during state transition cycle, what will happen to the contract account balance and the variables(or data) changes through execution of the code? will the later one overwrite the former one?

Thank you!


texts: int/uint data type with ether unit suffixes

texts:
I'm using the Remix editor and I have a nonsense function that takes a int data type as an argument that simply just returns it.

pragma solidity ^0.4.19;

contract someContract {

    function doSomething (int a) public pure returns (int) {
        return a;
    }
}

When I pass in a whole number for example, 1, I get back:

{
    "0": "int256: 1"
}

which makes sense to me.

But when I pass in a number with an ether unit, for example, 1 ether, I get back:

{
    "0": "int256: 270867"
}

Or if I try 1 wei, I get back:

{
    "0": "int256: 4358"
}

Is this a Remix bug, or is there something special about 1 ether == int256(270867) or 1 wei == int256(4358)?

This is how I'm passing these values.

https://remix.ethereum.org/#optimize=false&version=soljson-v0.4.19+commit.c4cbbb05.js


texts: Remix contract balance transfers Failing (Metamask / JS VM)

texts:
There is an issue with my smart contract not transferring any funds to any other address on the connected ganache instance. Regardless if I choose "JavaScript VM" or connect to my Remix, the contract balance gets reduced to zero, but the transaction ends up failing and not actually
transferring any funds. Code:
pragma solidity > 0.6.0 < 0.7.0;

import "github.com/provable-things/ethereum-api/provableAPI_0.6.sol";

contract LoanContract is usingProvable {
    address payable public ME = 0x6252039C9037A49a62f17edbdb26D9bDFffa9dF2;
    uint public balance;

     ...
     ...
     fallback() external payable {balance = address(this).balance;}
     function AddLender() payable public {
           balance = address(this).balance;
           num_lenders += 1;
     }
    function BPAYOUT() public {

        ME.transfer(address(this).balance);
        balance = address(this).balance;

        return;
    }
}

I have other unrelated functions and everything compiles. I have an Ethereum-bridge setup, Ganache running on 8545, and deposit functions so the contract definitely can receive / had funds on it. Deploys fine with metamask and JS VM, but only when I do the "BPAYOUT" function, I get an error that flashes way too quickly for me to see on Metamask, and Remix prints false Transaction mined but execution failed.
It also seems that the "to" txn output from Remix when I execute the function is different from the "ME" address I hardcoded in which seems strange. Please help me understand why the transfers don't go through! =)
Edit: I also get this gas-estimation error message from remix before the metamask errors out:
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
[object Object] { "message": "VM Exception while processing transaction: invalid opcode", "code": -32000, "data": { "stack": "RuntimeError: VM Exception while processing transaction: invalid opcode\n at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)\n at module.exports (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)", "name": "RuntimeError" } }


texts: Cannot attach to geth node running inside container

texts:
I am trying to run a node inside a docker container.

I am able to run a geth node locally, and attach it via IPC with these simple commands:

geth --fast --cache=512
Then
geth attach, it works fine.

Then I run a docker container (ethereum/client-go) with the same parameter, volume mounted on same ethereum folder.

Docker command:

docker run -d --name ethereum-node -v /Users/****/Library/Ethereum:/root/.ethereum -p 8545:8545 -p 30303:30303 ethereum/client-go --fast --cache=512

The geth.ipc file is present, but I cannot attach.

$ geth attach
Fatal: Unable to attach to remote geth: dial unix /Users/****/Library/Ethereum/geth.ipc: connect: connection refused

I tried to read/write geth.ipc:

When geth is run locally:

$ cat geth.ipc
{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

When under container :

$ cat geth.ipc
cat: geth.ipc: Connection refused

Running OSX 10.12.1, docker 1.12.3


texts:
I've been trying to compile my solidity smart contracts So I'd be able to deploy them on the Ropsten Test network
when I run truffle compile I get this error :

  TypeError: mnemonic.includes is not a function at normalizePrivateKeys

I don't understand what this typeError means

here's the full message:

TypeError: mnemonic.includes is not a function
    at normalizePrivateKeys (C:\Users\aliya\node_modules\@truffle\hdwallet-provider\src\index.ts:62:38)
    at new HDWalletProvider (C:\Users\aliya\node_modules\@truffle\hdwallet-provider\src\index.ts:102:25)
    at Object.<anonymous> (C:\Users\aliya\ethereum\supplychain\truffle-config.js:31:23)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at Object.require (internal/modules/cjs/helpers.js:77:18)
    at Function.load (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:161:1)
    at Function.detect (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:150:1)
    at Object.run (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\compile.js:53:1)
    at Command.run (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:136:1)
    at Object.<anonymous> (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\cli.js:51:1)
    at __webpack_require__ (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:19:1)
    at C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:83:1
    at Object.<anonymous> (C:\Users\aliya\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:89:10)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47

using Solidity 0.6.8

Truffle v5.1.26 (core: 5.1.26)

Node v12.16.2

and This is my truffle-config file:

const HDWalletProvider = require("@truffle/hdwallet-provider");
const Wallet = require("ethereumjs-wallet.js"); //this line gives

let mainNetPrivateKey = new Buffer(secrets.mainnetPK, "hex");
let mainNetWallet = Wallet.fromPrivateKey(mainNetPrivateKey);
let mainNetProvider = new HDWalletProvider(
  mainNetWallet,
  "https://mainnet.infura.io/v3/***"
);

let ropstenPrivateKey = new Buffer(secrets.ropstenPK, "hex");
let ropstenWallet = Wallet.fromPrivateKey(ropstenPrivateKey);
let ropstenProvider = new HDWalletProvider(
  ropstenWallet,
  "https://ropsten.infura.io/v3/***"
);

module.exports = {
  networks: {

    development: {
      host: "localhost", // Localhost (default: none)
      port: 7545, // Standard Ethereum port (default: none)
      network_id: "*",
      gas: 4465030, // Any network (default: none)
    },
    ropsten: {
      provider: ropstenProvider,
      network_id: "3",
      gas: 4465030,
    },
    live: {
      provider: mainNetProvider,
      network_id: "1",
      gas: 7500000,
    },
   },

  compilers: {
    solc: {
      version: "0.6.8",
      },

       }
    },
  },

Any help would be awesome!


texts: What's the reason ERC-20 standard allows 0 value transfer?

texts: ERC-20 says transfer and transferFrom should allow 0-value transfer and fire Transfer event. What's the main benefit of allowing 0-value transfer? Is there any use case?


texts: Errors when trying to Compile & Deploy Election Smart Contract

texts:
Cloned a project from a tutorial from here which is a voting dapp on etherum https://github.com/dappuniversity/election. When i try to compile the contract i get the following error

  project/blockvote/contracts/Migrations.sol:20:5: TypeError:
  Name has to refer to a struct, enum or contract.

  Migrations upgraded = Migrations(new_address);

I have tried to fix the problem with no luck tried changing the Election to election and tried adding the constructor because of the new solidity ersion with no luck. Also tried changing the prgama solditiy version and still get errors

pragma solidity ^0.5.0;

contract elections {
    // model a candidate
    // this is basically describe about how our candidate looks like (has a name, a id and vote count)
    struct Candidate {
        uint id;
        string name;
        uint voteCount;
    }

    // storing the accounts that have already voted
    mapping(address=>bool) public voters;
    // store a candidate
    mapping(uint=>Candidate) public candidates; // creating the variable of that mapping
    // fetch candidate

    // get candidate count
    uint public candidatesCount; // this is the counter

    // voting event
    event votedEvent (
        uint indexed _candidateId
    );

    constructor() public {
        // we dont want any one else to add the candidates therefore we call the addCandidate function in the constructor
        addCandidates("Candidate 1");
        addCandidates("Candidate 2");
        addCandidates("Candidate 3");
        // candidates count is 3
    }
    // adding the candidate to the mapping
    function addCandidates(string memory _name) private {
        candidatesCount++; // this will increment the candidate counter
        candidates[candidatesCount] = Candidate(candidatesCount, _name, 0); // assiging value to the candidate structure
    }

    function vote(uint _candidateId) public {
        //check that the address has not voted before
        require(!voters[msg.sender]);

        // require a valid candidate
        require(_candidateId > 0 && _candidateId <= candidatesCount);
        // record that voter has voted
        voters[msg.sender] = true; // msg.sender has the account of the voter

        // update candidate vote count
        candidates[_candidateId].voteCount++;

        emit votedEvent(_candidateId);
    }
}

pragma solidity ^0.4.2;

contract Migrations {
    address public owner;
    uint public last_completed_migration;

    modifier restricted() {
        if (msg.sender == owner) _;
    }

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

    function setCompleted(uint completed) restricted {
        last_completed_migration = completed;
    }

    function upgrade(address new_address) restricted {
        Migrations upgraded = Migrations(new_address);
        upgraded.setCompleted(last_completed_migration);
    }
}


texts: Best possible way to launch the ethereum mainnet node on AWS

texts:
I have multiple applications running on my local system. I want to make them live, I need ethereum main net node of my own. I launch the ethereum node on AWS server using supervisory mode but it doesn't work as I think. Can someone suggest the proper, safe way to launch the node with maximum throughput? And what will be the best configuration of the server required?

Thanks in advance


texts: Been waiting for a long time to be able to access a decentralized exchange. When will EtherEx be launched and will it support BTC ETH pair?


texts: Where can I find a smart contract code for an ICO?

texts:
Since the creation of tokens is a standardized process following the ERC20 specifications, I want to know if there is also a "common code" or a default way to create a crowdsale for an ICO

Thanks


texts: array vs mapping in solidity: when to use one over the other?

texts:
When should you use array or mapping in solidity?
Let's say I have multiple question questionnaire, with one question, and I want to store the responses of different people(address) in a smart contract. What is the best way to store them. In an array or a mapping?
For example:
struct Answer {
    address answerer; // address of the answerer.
    uint answer; // multiple choice answer.
}

mapping(address => uint) public answers;

Answer[] public answers;

When should I use either of the above?


texts: Create accounts on ethereum network using programmatically generated key pairs and addresses

texts:
Say I have a node application that has user registration feature. Now when a user registers,  using node libraries like crypto I  generate a cryptographic key pair(private and public).  Then also generate an address from the public key just mentioned. My question is, is there a way to programmatically create Externally owned accounts with these key pairs and addresses. Such that these addresses can now be valid wallet addresses on the ethereum network?
Don’t know if my question would sound too basic or so, but searching for clarity. Any beginner friend response will be very helpful.


texts: What design patterns are appropriate for data structure modification within Ethereum smart contracts?

texts:
I am looking to hear about design patterns that people have implemented within Ethereum smart contracts to allow for post deploy modification of data structures.

For example, say I have a contract which contains a struct defining an Address. Should I down the line realise that I want to add an email address property to the Address.. Is there any pre-deployment design pattern consideration that would allow for me to do this.

A little more complex of an example.. If I had two properties of a contract named 'question' and 'answer', and all of a sudden I want to have multiple possible answers.. how would one go about making such a change?

My issue/concern is that if you interface with said contract through a browser for example, you could simply update the contract that the front end points to (post update).. BUT how do you resolve the problem of maintaining any contract data across update deployments..?

Thanks
T


texts: Parity unable to deploy contract on ropsten

texts:
I have running instance using parity: parity --chain=ropsten --author=0x00c62AA7449864C21E5250533577ec628849dAE2 --rpcapi=web3,eth,personal --jsonrpc-interface=127.0.0.1 --jsonrpc-port=8545 --jsonrpc-cors=https://remix.ethereum.org and faced strange issue already for 2 days: I cannot deploy contract and send funds to anywhere from my account.

When deploying contract Parity UI always shows "waiting for confirmations". I dropped previous account, removed all databases and configurations, started node again, synced and created new account. Then mined couple of ethers. Now contract deployment explicitly failed with message "The contract deployment failed: Contract not deployed, getCode returned 0x".

All contracts are developed in the Parity editor.


texts:
So I have this following code that was working a couple of weeks ago and today I decided to run a few tests and it just doesn't do its job anymore.

function approve(rid, guest_wallet, ctr_key, dti, dtf, href) {

   web3.eth.defaultAccount = web3.eth.coinbase;

   console.log('Sent transaction, waiting for confirmation');
   web3.eth.contract(abi).new(guest_wallet, ctr_key, dti, dtf, {data: code}, function (err, contract) {

     if (err) {
       console.error(err);
       return;
     } else if (contract.address) {
       console.log('Transaction was mined!');
       console.log('address: ' + contract.address);
       $.ajaxSetup({
         headers: {
           'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
         }
       });
       $.ajax({
         method: "POST",
         url: "/reservation/" + rid + "/contract-address",
         data: {ctr_addr: contract.address}
       }).done( function(msg) {
         if (confirm('Endereço salvo!'))
           window.location = href;
       });
      }
   });
 };

I'm using web3.js and MetaMask to sign the transactions and I'm getting this "transaction underpriced" message most of the times (a few have worked out) I try to deploy a contract or call its functions. I indeed get a transaction to sign that has 0 gas fee and a total of 0 too therefore so a guess that's why I get that message.

I saw some recent changes on the ethereum/web3.js github repository. Could this be the reason why it stoped working? That's why I get a bad transaction to sign from MetaMask? What should I do to solve this?

Thanks in advance, guys!


texts: Hardhat: Error: unresolved libraries, but why?

texts:
I'm attempting to deploy a contract using Hardhat (via scaffold-eth), but am getting the following error:
Error: Factory contains unresolved libraries. You must deploy and link the following libraries before you can deploy a new version of Factory: $c63268ab2b467de325495e38718facdea1$

The contract in question (Factory.sol) imports three contracts, and one of them is called library (Library_Token.sol). I receive this error even if I deploy it first, though.
What is causing this error, and how can it be fixed?
Update: I see Truffle has a function for linking libraries: https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#deployer-link-library-destinations-
I assume that Hardhat should have something similar, and that's what needs to happen here. As such, I'm guessing the question should be rephrased as 'how do I link a library to a contract using Hardhat', but I guess I won't know until that's figured out and we see if it works.


texts: Error: Operator << not compatible with types bytes1 and int_const 1 return b10 << 1;

texts:
I don't know how to correct the code of function 4 & 5.

pragma solidity ^0.4.4;

contract C {
    bytes1 b10 = 0x6c;// l-> 0110 1100 6c转换为10进制-》12*16^0+6*16^1=108
    bytes1 b11 = 0x69;

    function test1() constant returns (bytes1) {
        return b10 & b11;

    }

    function test2() constant returns (bytes1) {
        return b10 | b11; //或
         //0110 1100 ->0x6c
         //0110 1001->0x69
        // 0110 1101(上下10对应的时候是1真)->0x6d
    }

    function test3() constant returns (bytes1) {
        return ~b10;
         //0110 1100 ->0x6c
         //->1001 0011 ->0x93
    }

    **function test4() constant returns (bytes1) {
        return b10 << 1;
         //0110 1100 ->0x6c
         //->1101 1000->0xd8
    }
    function test5() constant returns (bytes1) {
        return b10 >> 1;
         //0110 1100 ->0x6c
         //->0011 0110->0x36
    }**

}


texts: How can I get token info by the contract address?

texts:
0x5a65585ce8213d1c9433e63d53d4e468540a5019 is my CRC20 token. I can search the token info on etherscan. https://ropsten.etherscan.io/token-search

Token Attributes Found:
 totalSupply = 100
 name = ZONO
 symbol = ZONO
 decimals = 0

How can I do it without etherscan? I have my own geth server. Is it possible to get from my geth server? Are there any good libralies?

Update 1

I guess I can use eth_call. I know how to get balance of an address like below. I need to know the hex of totalSupply, name, symbol, and decimals.

var balanceHex = "0x70a08231"; // I believe this is the hex for balance
var contractAddress = "0x5a65585ce8213d1c9433e63d53d4e468540a5019";
var userAddress = "0x5DBB9793537515398A1176d365b636A5321D9e39";
var balanceCall = getDataObj(contractAddress, balanceHex, [getNakedAddress(userAddress)]);
var balance = web3.eth.call(balanceCall);

Update 2

I think the following is fine.

var totalSupply = web3.sha3('totalSupply()').substring(0,10);
console.log(totalSupply); // 0x18160ddd

How can I retrieve my account's Augur (REP) token balance via JSON-RPC?


texts:
I'm a bit upset about my whole situation,

I used my LastPass password manager in Chrome to generate a 16 character special password. I put that password in my LastPass secure notes, go back to it later and its my last version (outdated without ethereum password). I still had Ethereum Wallet open at the time, so I went to Accounts backup -> Accounts and Application Data. Would I be able to retreive my password after I backed up the folders it wanted me to?


texts: Can I modify arrays created in mappings in Solidity?

texts:
I have created a mapping which gives an array of structs.

mapping(address => BetByUser[]) betsByAddress;

I have tried changing this array, but with no success. Are these arrays in memory or storage? Can I change them, if yes, how?


texts:
I tried installing web3
Using
Npm install web3
Throws an error


texts: how can a signature for a document on a blockchain be revoked?

texts:
I am trying to do document verification through blockchain. The way I'm trying to do this is by digitally signing a document, and storing its hash on the blockchain. Now I'm trying to create a feature for revoking a document. How can this be achieved?
For example: if Bob has been issued a driving licence by the government which has put his licence on a public blockchain, but is caught drunk driving and the government decides to revoke his licence. what would be a way to achieve this functionality so that when someone queries his licence they see the signature as invalid? or is there a different method I can use to achieve the same functionality?


texts:
I just try to cancel my token transaction, I followed the instructions from here more than 1 day and my transaction are always getting reset.

How to cancel that two transactions

transaction to exchange, but that got pending and always reseting too
cancel the transaction number 1, the problem is same always reseting too
I try again to sending my token to exchange nothing happened yet
https://etherscan.io/tx/0xdd462729f2e2656237cbe77d532a1760320a95d779aec1d294a85197195c1c38

In this case I forget the number 1 tx transaction.

I hope you understand, sorry for my poor english.


texts: How to get return value of const function from website?

texts:
Ok so my issue is that my website is hosted using a 3rd party service so I am unable to run geth on the same server as my site. However, I also have a separate VPS which I can setup nodejs and a web3js page or geth to interact with my contracts.

My goal is to call a constant function in my contract and display the result on my website. Is there a way for me to interact with my VPS from my website and call constant functions? Is there a better way to solve my issue?

If I run a node on my vps, am I able to use web3js on my site to call functions? What about transactions?


texts: Can a solidity contract count how many times it has been instantiated?

texts:
After the deployment of the contract, let's say MyContract, can we literally count how many times MyContract has been instantiated?

Here's the code of MyContract:

contract MyContract {
  uint public counter = 0;

  function MyContract() public {
    counter++;
  }
}

After the deployment, which I used truffle deploy, I do the following code to instantiate a new MyContract instance, inside truffle console:

MyContract.new()
          .then(function(c){return c.counter.call()})
          .then(console.log)

I expected every time I execute this line, I will have an increment on the counter, which looks like 1,2,3,4,... by steps.

But I keep on receive 1 as the result, without any changes. Thanks for any help.


texts: Cannot use external contract addresses as function arguments in Vyper contract interface

texts:
I'm trying to compile the Uniswap Exchange contract using the latest vyper compiler.

I first updated the ERC20 references to the new token: ERC20 definition and set up an import from vyper.interfaces import ERC20.

The next issue is with the getExchange() function in the Factory interface.

vyper.exceptions.TypeMismatchException: line 68:15 Typecasting from base type address(ERC20) to address unavailable

This occurs on the following line:

assert self.factory.getExchange(self.token) == self

I tried to solve it by amending the getExchange interface to:

    def getExchange(token_addr: ERC20) -> address: constant

but this produces another error:

vyper.exceptions.InvalidTypeException: line 8: Invalid base type: ERC20
    def getExchange(token_addr: ERC20) -> address: constant

How to get this to compile?


texts:
Geth not syncing Ropsten - why?

:~/Eth$ geth --testnet --syncmode fast --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303" console
WARN [01-30|11:00:25.885] Sanitizing cache to Go's GC limits       provided=1024 updated=330
INFO [01-30|11:00:25.886] Maximum peer count                       ETH=25 LES=0 total=25
INFO [01-30|11:00:25.888] Starting peer-to-peer node               instance=Geth/v1.8.21-stable-9dc5d1a9/linux-amd64/go1.10.4
INFO [01-30|11:00:25.888] Allocated cache and file handles         database=/home/ubuntu/.ethereum/testnet/geth/chaindata cache=165 handles=524288
INFO [01-30|11:00:25.895] Writing custom genesis block
INFO [01-30|11:00:25.909] Persisted trie from memory database      nodes=355 size=51.89kB time=3.106772ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-30|11:00:25.909] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Byzantium: 1700000 Constantinople: 4230000 Engine: ethash}"
INFO [01-30|11:00:25.910] Disk storage enabled for ethash caches   dir=/home/ubuntu/.ethereum/testnet/geth/ethash count=3
INFO [01-30|11:00:25.910] Disk storage enabled for ethash DAGs     dir=/home/ubuntu/.ethash                       count=2
INFO [01-30|11:00:25.910] Initialising Ethereum protocol           versions="[63 62]" network=3
INFO [01-30|11:00:25.917] Loaded most recent local header          number=0 hash=419410…ca4a2d td=1048576 age=49y9mo2w
INFO [01-30|11:00:25.917] Loaded most recent local full block      number=0 hash=419410…ca4a2d td=1048576 age=49y9mo2w
INFO [01-30|11:00:25.917] Loaded most recent local fast block      number=0 hash=419410…ca4a2d td=1048576 age=49y9mo2w
INFO [01-30|11:00:25.918] Regenerated local transaction journal    transactions=0 accounts=0
INFO [01-30|11:00:25.925] New local node record                    seq=1 id=27b8506d54072297 ip=127.0.0.1 udp=30303 tcp=30303
INFO [01-30|11:00:25.926] IPC endpoint opened                      url=/home/ubuntu/.ethereum/testnet/geth.ipc
INFO [01-30|11:00:25.960] Started P2P networking                   self=enode://374ba74ed85d381f0088fabb0a48bcee2a28aba6173e08d8efd0bc19ded692c7f2716dab45a3ff092b419cba071dabaf9df357100d38b06b1e54d0e3830a7756@127.0.0.1:30303
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.21-stable-9dc5d1a9/linux-amd64/go1.10.4
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

>
> eth.syncing
false
> eth.blockNumber
0


texts: Dataset of simple contracts with getter setters

texts: Are there any repositories/datasets which provide smart contract with simple logic like having some getters and setter functions. So, that I could give some values to  getter and setter functions, which make some changes on state variables and then i check the status of smart contract. If i download contracts from etherscan.io, then they have lot of complex logic. , In short, i want to test bulk numbers of such simples contracts on my on own ethereum blockchain with some default values (given through my program as per variable type used in contract).


texts: ERC20: Why the specification uses 2 transactions for transferring token?

texts:
I was going through ERC20 lately and came across 2 level transfer protocol:

approve - Allow receiver to debit x tokens in n transcations
transfer - Transfer y tokens: y * n <= x

Why this was not implemented as 1 transaction, i.e. transfer x tokens to receiver wallet, as opposed to 2-level protocol (allow + transfer)? This leads to 2x usage of Eth gas.