Unable to run blockchain project with ruby on rails

198 views Asked by At

Below is the version description:

  1. Install geth (for accession console) - Version: 1.9.21-stable

  2. Install solidity(run solc file from terminal) - Version: 0.4.26+commit.4563c3fc.Darwin.appleclang

  3. Install Parity(connect RPC connect for port 8584) Version : - Parity-Ethereum/v2.7.2-stable-d961010f63-20200205/x86_64-apple-darwin/rustc1.41.0

  4. Install Metamask(browser extension)

I have created testnet account from metamask and import it into our system via command : geth account import --datadir "account address" --password "password" "pvt key" but when we go to the get console via (geth console --testnet 2>>geth.log) and run eth.accounts[0] we received 0eth

As you can see the screenshot I have 4.9962 ETH

My Solc file

pragma solidity ^0.4.2;

contract mortal {
    /* Define variable owner of the type address*/
    address owner;

    /* this function is executed at initialization and sets the owner of the contract */
    function mortal() { owner = msg.sender; }

    /* Function to recover the funds on the contract */
    function kill() { if (msg.sender == owner) selfdestruct(owner); }
}

contract greeter is mortal {
    /* define variable greeting of the type string */
    string greeting;

    /* this runs when the contract is executed */
    function greeter(string _greeting) public {
        greeting = _greeting;
    }

    /* main function */
    function greet() constant returns (string) {
        return greeting;
    }
}

Create a Contract and Deploy

@contract = Ethereum::Contract.create(file: "#{Dir.pwd}/contracts/greeter.sol")
@tx = @contract.deploy("Hello")
@link = "https://testnet.etherscan.io/tx/#{@tx}"

Whenever I run the program I am getting IOError (Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 1000000 and got: 0.):

My question is:

  1. how we can get balance for testing in order to make a transaction and create a contract.
  2. How we can check the transaction is successfully created and deploy into the blockchain.
1

There are 1 answers

0
julien h. On

you need to feed your wallet with ether test. You can achieve that going to https://faucet.ropsten.be/ , filling your testnet wallet etherbase and then earn ether test