0

I am using Getch with truffle framework and i created an account. I have Migrations and Election.sol. After i can migrate, i couldnt see it in etherscan website. Although truffle migrate --reset --network rinkeby returns saving artifacts and contract addresses, why i cant see it on website?

geth --datadir ../eth_node --nodiscover console --syncmode "fast" --rpc --rpcapi="db,eth,net,web3,personal" --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --networkid=4 --"allow-insecure-unlock" --mine --minerthreads 1

truffle.config

  rinkeby: {
   host: "127.0.0.1",     // Localhost (default: none)
   port: 8545,            // Standard Ethereum port (default: none)
   network_id: "4",       // Any network (default: none) (Rinkeby's id 
                             is given)
  from:"address",
  gas: 3000000  

OUTPUT:

Starting migrations...

Network name: 'rinkeby' Network id: 4 Block gas limit: 8000000

1_initial_migration.js

Deploying 'Migrations'


transaction hash: HASH Blocks: 0 Seconds: 536 contract address: 0xd31433a447b2C64d979e15D4CD190098DA1044Ad account: ADDRESS balance: 79228162514.252941273543950335 gas used: 284908 gas price: 20 gwei value sent: 0 ETH total cost: 0.00569816 ETH

Saving artifacts


Total cost: 0.00569816 ETH

2_deploy_contracts.js

Replacing 'Election'


transaction hash: HASH Blocks: 1 Seconds: 4 contract address: 0xD6F5BF2E4eC20FB4DEf44d77FEBF84E96e680DFe account: ADDRESS balance: 79228162514.246021893543950335 gas used: 345969 gas price: 20 gwei value sent: 0 ETH total cost: 0.00691938 ETH

Saving artifacts


Total cost: 0.00691938 ETH

Summary

Total deployments: 2 Final cost: 0.01261754 ETH

contract address: 0xd31433a447b2C64d979e15D4CD190098DA1044Ad

contract address: 0xD6F5BF2E4eC20FB4DEf44d77FEBF84E96e680DFe }

When i use this following function

   function checkAllBalances() { 
     var i =0; 
      eth.accounts.forEach( function(e){
      console.log("  eth.accounts["+i+"]: " +  e + " \tbalance: " + 
       web3.fromWei(eth.getBalance(e), "ether") + " ether"); 
        i++; 
       })
     };

It returns balance: 79228162514.246021893543950335 ether

What is wrong in my configuration?

Election.sol

 pragma solidity 0.5.8;

 contract Election {
  // Model a Candidate
      struct Candidate {
      uint id;
      string name;
      uint voteCount;
 }

 // Read/write Candidates
 mapping(uint => Candidate) public candidates;
// Store Candidates Count
uint public candidatesCount;

 constructor() public {
  addCandidate("Candidate 1");
   addCandidate("Candidate 2");
 }

 function addCandidate (string  memory _name) private {
     candidatesCount ++;
     candidates[candidatesCount] = Candidate(candidatesCount, _name, 0);
 }

}

Migrations.sol

  pragma solidity >=0.4.21 <0.6.0;

  contract Migrations {
  address public owner;
  uint public last_completed_migration;

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

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

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

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

eth.getBlock(0) returns

{ difficulty: 1, extraData: "0x00", gasLimit: 4712389, gasUsed: 0, hash: "hash", logsBloom: "", miner: "0x0000000000000000000000000000000000000000", mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000", nonce: "0x0000000000000042", number: 0, parentHash: "0x0000000000000000000000000000000000000000000000000000000000000000", receiptsRoot: "", sha3Uncles: "", size: 504, stateRoot: "", timestamp: 0, totalDifficulty: 1, transactions: [], transactionsRoot: "", uncles: [] }

genesis.json

                {
"config": {
    "chainId": 88888,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x1",
"extraData" : "0x00",
"gasLimit" : "0x47e7c5",
"nonce" : "0x0000000000000042",
"timestamp" : "0x00",
"alloc" :{
    "address": {"balance": "0xffffffffffffffffffffffff"}
}

}

  • How do you launch geth? It appears you are deploying to another network. Do you have ganache running? – Ismael Aug 26 at 17:22
  • @Ismael I am using getch, not installed ganache. geth --datadir ../eth_node --nodiscover console --syncmode "fast" --rpc --rpcapi="db,eth,net,web3,personal" --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --networkid=4 --"allow-insecure-unlock" --mine --minerthreads 1 – jhdm Aug 26 at 17:26
  • I created console.sh and inside of that geth --datadir ../eth_node --nodiscover console --syncmode "fast" --rpc --rpcapi="db,eth,net,web3,personal" --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --networkid=4 --"allow-insecure-unlock" --mine --minerthreads 1 – jhdm Aug 26 at 17:27
  • and also i can use geth attach ../eth_node/geth.ipc this command @Ismael – jhdm Aug 26 at 17:28
  • @Ismael I am working in Oracle Virtual Box Ubuntu.It can be a problem? – jhdm Aug 26 at 17:30
0

You are not on the official rinkeby network. It genesis block has hash 0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177.

Several other fields are different:

  • nonce is 0x0000000000000000
  • gasLimit 4700000
  • genesis.json is much bigger

To correctly setup Rinkeby you can follow the instructions in their page https://www.rinkeby.io/#geth.

  • for that should i install full node because i didnt install full node – jhdm Sep 1 at 15:32
  • In that page there are instructions to configure a light node. Since you are using truffle you can configure it to use an Infura url. Go to infura.io sign up and you will be given an URL to use to connect. In Truffle documentation they provide instructions how to configure for Infura. If you have more doubts search in the answered questions or create a new one. – Ismael Sep 1 at 23:12
  • Okay thank you, i will try – jhdm Sep 2 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.