---
title: "Deploy your first blockchain contract to Ethereum"
date: 2022-04-09
dateModified: 2026-05-17
category: development
tags: ["ethereum", "blockchain", "solidity", "tutorial"]
description: "Step by step guide to deploy first contract on Ethereum blockchain"
canonical: https://mjasion.pl/posts/development/first-blockchain-contract/
---

> ⚠️ **Heads up — Rinkeby testnet is no longer available.**
> This guide was written in 2022 using the Rinkeby test network, which was shut down by the Ethereum Foundation in October 2023. The Solidity contract code and the Remix workflow below are still valid, but to actually deploy you'll need to switch to the **Sepolia** testnet (or Holesky for staking testing): pick "Sepolia" instead of "Rinkeby" in MetaMask, and use a current faucet such as [sepoliafaucet.com](https://sepoliafaucet.com) or [Alchemy's Sepolia faucet](https://www.alchemy.com/faucets/ethereum-sepolia). Transactions are visible on [sepolia.etherscan.io](https://sepolia.etherscan.io) instead of rinkeby.etherscan.io.

## First contract - Pet owners

I am learning blockchain and smart contracts. This post will be my note on how I am starting my journey into blockchain technology.

In this example I will create a contract for storing who is owning a Pet.

## Development

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; //build contract on top of Solidity >=0.8.0 and <0.9.0

contract PetOwner {
    mapping (string => Pet) public petOwners;

    struct Pet {
        string name;
        string petType;
    }

    function addPetOwner(string memory ownerName, string memory _name, string memory _petType) public {
        petOwners[ownerName] = Pet({name: _name, petType: _petType});
    }

}
```

Put it in the Remix IDE: https://remix.ethereum.org/. It should compile and we can deploy it on the local environment:

![Deploy contract](deploy_smart_contract.png)

When we have contract deployed we can create example contract ownership

![Test Transaction](create_test_transaction.png)

and ask `petOwners` field for information which Pet is owned by `Marcin`.

![Test check](check_test_transaction.png)

## Let's deploy it to Ethereum test network

Ethereum allows testing our contract on test networks. For this example I will use Rinkeby. This is a free network for testing smart contracts.

> I am not covering how to install Metamask. Always remember to not share **private key** and **seed**
> You can always create a new Metamask identity for your tests.

1. Switch the Remix Environment from `Javascript VM` to `Injected Web3`
2. Connect your Metamask. Ensure you have chosen Rinkeby network
![Metamask Rinkeby Network](metamask_rinkeby.png)
3. If you don't have any `ETH` coins you can use this Faucet to grab some: https://faucets.chain.link/rinkeby
4. Click deploy. You will be asked by Metamask to confirm the transaction: [Contract deployment transaction](https://rinkeby.etherscan.io/tx/0x60ad0e4b25ba4dadef1410d766222b30815fe9e6bc7168cd6cd0f205bb4d90e3)

Now I can test my contract. I fill the data
![](rinkeby-example-data.png)

And we will be asked again for confirming the transaction
![](metamask-example-contract.png).

When everything will be done, our transaction should be visible on [Etherscan](https://rinkeby.etherscan.io/tx/0x5d53899e2cfc1ce5afa597f5073792d06fbceeaa0d3c9d78ccde57e714f28b7d)
![Etherscan](etherscan.png)

And at the end we can check if `petOwner` field contains our definition:
![](rinkeby-data-confirmation.png)

---
_This post contains my notes from a Blockchain development tutorial available [here](https://www.youtube.com/watch?v=M576WGiDBdQ)._