Skip to content

Commit

Permalink
Merge branch 'main' into dev-api-docs_fix-param-for-getbalance-exampl…
Browse files Browse the repository at this point in the history
…e-script
  • Loading branch information
ivegabr authored Sep 13, 2024
2 parents 162e9a3 + 5eb5b1d commit 20828b2
Show file tree
Hide file tree
Showing 4 changed files with 1,748 additions and 1,363 deletions.
2 changes: 1 addition & 1 deletion docs/01-concepts/account-based-addresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: "EIP-1191 chainId is used in Rootstock addresses as a checksum. m/4
Rootstock Addresses incorporate an optional blockchain identifier (also known as `chainId`). If the `chainId` is not present, it is assumed the address refers to the Rootstock main network.

:::info[Info]
See [contract addresses](/developers/smart-contracts/contract-addresses) for the list of contract addressess on Rootstock or [how to verify address ownership](/developers/smart-contracts/verify-address-ownership/).
See [contract addresses](/developers/smart-contracts/contract-addresses) for the list of contract addresses on Rootstock or [how to verify address ownership](/developers/smart-contracts/verify-address-ownership/).
:::

## How to get an address
Expand Down
70 changes: 65 additions & 5 deletions docs/02-developers/03-blockchain-essentials/02-overview/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
---
sidebar_label: Blockchain Overview
sidebar_position: 200
title: 'Getting Started with Rootstock (RSK) Development'
description: 'Learn how to interact with Rootstock in your web browser, how to look at Rootstock transactions, develop and deploy your very first smart contract to the Rootstock network.'
tags: [quick-starts, rsk, rootstock, blockchain, browser wallets, developers, beginners]
title: "Getting Started with Rootstock (RSK) Development"
description: "Learn how to interact with Rootstock in your web browser, how to look at Rootstock transactions, develop and deploy your very first smart contract to the Rootstock network."
tags:
[
quick-starts,
rsk,
rootstock,
blockchain,
browser wallets,
developers,
beginners,
]
---

Learn about Rootstock, how it enables smart contract on Bitcoin, and its compatibility with Ethereum and other platforms.

## What is Rootstock?
Expand All @@ -21,7 +31,7 @@ The more hashing power they provide, the more secure the network is.
Rootstock is the first open source smart contract platform that is powered by the bitcoin network.
Rootstock’s goal is to add value and functionality to the bitcoin ecosystem by enabling smart-contracts,
near instant payments, and higher-scalability.
RIF is an all-in-one suite of open and decentralized infrastructure applications and services that enable faster,
RIF is an all-in-one suite of open and decentralized infrastructure applications and services that enable faster,
easier and scalable development of distributed applications (dApps) within a unified blockchain environment.

Rootstock is connected to Bitcoin in terms of how its blocks are mined,
Expand Down Expand Up @@ -75,6 +85,56 @@ However, the price of each op-code (measured in units known as gas) is different
Further to that, gas units are multiplied by gas price to calculate the transaction cost.
Since Rootstock’s gas price is denominated in RBTC and Ethereum’s gas price is denominated in Ether, there is another difference between gas prices on Rootstock and Ethereum.

Note that when `eth_estimateGas` is called, the node simulates the transaction execution without broadcasting it to the network.
The simulation runs through the entire transaction process as if it were being executed, including checking for sufficient balance, contract code execution, etc.
During the simulation, the method calculates the exact amount of gas that would be consumed by the transaction if it were to be executed on the blockchain. The estimated gas amount is returned, helping users set an appropriate gas limit for the actual transaction.

There is a difference in Rootstock compared to Ethereum, and it is that if one of the steps of the simulated transaction fails, the node will return the gas estimation needed for the transaction, while on Ethereum, the node will return an error instead of the gas estimation.

You can see this behavior in the following example, where a call for `eth_estimateGas` on a transaction that would be executed from an address without enough balance.

Example:

```js
{
"jsonrpc":"2.0",
"method":"eth_estimateGas",
"params":[
{"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"},
"latest"
],
"id":0
}
```

Response on Rootstock:

```js
{
"jsonrpc": "2.0",
"id": 0,
"result": "0x5498"
}
```

Response on Ethereum:

```js
{
"jsonrpc": "2.0",
"id": 0,
"error": {
"code": -32000,
"message": "insufficient funds for transfer"
}
}
```

## EVM Compatible Smart Contracts

If you are familiar with smart contract development or dApp development using solidity, web3, and other compatible technologies; you might be excited to know that the Rootstock Virtual Machine (RVM) is compatible with the Ethereum Virtual machine (EVM).
Expand Down Expand Up @@ -123,4 +183,4 @@ Check out [rootstock.io/mine-btc-with-rootstock](https://rootstock.io/mine-btc-w

:::info[Note]
The time between blocks on each network listed above are approximate values.
:::
:::
Loading

0 comments on commit 20828b2

Please sign in to comment.