Owanate Amachree
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Beginner's Guide to Getting Started with RSK Blockchain Node How to get started on RSKj for your dApp project ![RSK-logo](https://i.imgur.com/AkHvVkM.png) RSK is a secured smart contract platform, thanks to merged mining with the Bitcoin network, **merged mining** allows Bitcoin miners to mine RSK’s sidechain using the same work for both. This is the basis for RSK’s extremely high hash rate, which is approximately 63% of the Bitcoin network’s hashrate currently; and therefore the reason that RSK is the most secure smart contract platform. **RSKj** is the software used to run nodes on the RSK network. You can find it on Github: [rsksmart/rskj](https://github.com/rsksmart/rskj). ## Interact with the RSK network You can interact with the RSK network in various ways without running your own node. ### Connect to RSKj You can run [RSKj](https://developers.rsk.co/rsk/node/) locally to connect to the public RSK networks - 1. [Connect to RSK Mainnet](https://developers.rsk.co/rsk/public-nodes/#mainnet) 2. [Connect to RSK Testnet](https://developers.rsk.co/rsk/public-nodes/#testnet). > Also, check out an alternative to connecting to the [public nodes](https://developers.rsk.co/rsk/public-nodes/). Furthermore, you can run RSKj in a **localhost-only** environment, without connecting to any public network using the [RSK Regtest](https://developers.rsk.co/rsk/node/configure/switch-network/#regtest) ### Interacting with a dApp To interact with a dApp, you can use a [Web3 enabled wallet software](https://developers.rsk.co/wallet/use/), for wallets that support RBTC and RIF tokens. ### Configure MetaMask to connect to RSK To configure Metamask to connect to RSK, see the step by step guide demonstrating [how to interact with a DApp on RSK using Remix and MetaMask](https://developers.rsk.co/tutorials/ethereum-devs/remix-and-metamask-with-rsk-testnet/). Both Remix and MetaMask are tools that were originally built for Ethereum, and thanks to RSK's comaptibility (both in its Virtual Machine executing smart contracts, and in its communications protocol using JSON-RPC), these tools work on RSK too! We'll use them to create and deploy a simple smart contract on RSK’s Testnet. ### Check the status of the RSK network To check the status of the RSK Network in real-time, use: - [RSK Mainnet Stats](https://stats.rsk.co/) - [RSK Testnet Stats](https://stats.testnet.rsk.co/) ![RSK Mainnet stats](https://i.imgur.com/oJQH7ZL.jpg) You can also check the status of a particular transaction and deployed smart contracts, using: - [RSK Explorer](https://explorer.rsk.co/) - [RSK Testnet Explorer](https://explorer.testnet.rsk.co/) See the [RIF Smart Contract](https://explorer.rsk.co/address/0x2acc95758f8b5f583470ba265eb685a8f45fc9d5) address and this address: [`0xc218fc2b765ab321a907d6125fe7763e2eaec8e16dd4a72e1a4829a9baa2451a`](https://explorer.rsk.co/tx/0xc218fc2b765ab321a907d6125fe7763e2eaec8e16dd4a72e1a4829a9baa2451a?__ctab=Transaction) is a transaction hash. You will notice that this type of transaction is perfmormed by neither an externally owned account or a smart contract. In fact it is a REMASC transaction. > Reward Manager Smart Contract (REMASC) is a pre-compiled smart-contract that is executed on every block and has the responsibility to fairly distribute rewards collected from transaction fees into several participants of the network. From: [REMASC architecture] (https://developers.rsk.co/rsk/architecture/mining/remasc/) This type of transaction is found in neither Bitcoin nor Ethereum, but is a key component of how the RSK network is able to achieve block times that are frequent enough to enable smart contract based decentralised applications, and while being merge-mined with Bitcoin. See [fast payments](https://developers.rsk.co/rsk/architecture/fast-payments/) for further details. ### Send JSON-RPC requests To send JSON-RPC requests, see list of [JSON-RPC Methods](https://developers.rsk.co/rsk/node/architecture/json-rpc/) that RSK currently supports. ### Obtain test tokens You can use the faucet to get test tokens (tRBTC) for use in RSK test network. - Obtain tRBTC token in the [tRBTC Faucet](https://faucet.testnet.rsk.co/) - Obtain tRIF token in the [tRIF Faucet](https://faucet.rifos.org/). ## Getting Started If none of the above fits the bill for you, you will need to run your own RSK node. Especially if you are developing smart contracts, developing DApps, or participating in a hackathon, you are likely to want to iterate fast, and therefore need quicker feedback loops. Running RSKj **in Regtest mode** is the best fit for these needs. ### System Requirements The following are the minimum requirements needed to install an RSKj node. - 2 cores - 8 GB RAM - 50 GB storage - OS x64 ### Install Java The RSKj executable is a Java Archive file (JAR file), and requires Java to run. See guide on [how to install the Java 8 JDK](https://www.java.com/download/). ![Java downloads page](https://i.imgur.com/YYSQ3Qu.png) ### Download RSKj JAR Navigate to [RSKj's releases page](https://github.com/rsksmart/rskj/releases). From the **latest** release, download a file whose name looks like `rskj-core-*.jar`, where `*` is replaced by the release tag name, for example `2.2.0-PAPYRUS`. ![Download RSKj core](https://i.imgur.com/PbsKmLT.png) ### Run RSKj To run RSKj, copy the following commands below, and paste in terminal where `rskj-core-*.jar` is located. ```shell java -cp <PATH-TO-THE-RSKJ-JAR> \ -Drpc.providers.web.cors=* \ co.rsk.Start \ --regtest ``` The above command runs RSKj connected to Regtest, which is a `localhost`-only network, clears the database each time the node is started, and enables both CORS. These are the most useful and commonly used flags and options for when you are developing or testing smart contracts and DApps. If you see no output - that is a good thing: Its output is directed to a log file. > Note: Remember to replace <PATH-TO-THE-RSKJ-JAR> with the path which contains the downloaded jar file. See example command below. ```shell java -cp /Users/owanate/Downloads/rskj-core-2.2.0-PAPYRUS-all.jar \ -Drpc.providers.web.cors=* \ co.rsk.Start \ --regtest ``` ## Developer Tools ### Truffle Here is how you would configure Truffle to connect to the RSK Testnet. See below code for how to implement this in a Truffle project. In your `truffle-config.js` file: (1) Set a variable `testnetSeedPhrase` to contain a valid BIP-39 mnemonic phrase (2) Set a variable `gasPriceTestnet` to contain the gas price you wish to use denominated in Wei. (3) In the exported `config` object, set the value of `config.networks.testnet` to be the following. ```truffle testnet: { provider: () => new HDWalletProvider({ mnemonic: { phrase: testnetSeedPhrase, }, providerOrUrl: 'https://public-node.testnet.rsk.co/', derivationPath: "m/44'/37310'/0'/0/", // Higher polling interval to check for blocks less frequently pollingInterval: 15e3, }), // Ref: http://developers.rsk.co/rsk/architecture/account-based/#chainid network_id: 31, gasPrice: gasPriceTestnet, networkCheckTimeout: 1e6, timeoutBlocks: 100, // Higher polling interval to check for blocks less frequently // during deployment deploymentPollingInterval: 15e3, }, ``` This enables you to understand Truffle’s default configuration values (based on Ethereum), in particular surrounding polling intervals. Using these two relatively new configuration options allows you to configure Truffle to better connect to an RSK node. For more details, see [Configuring Truffle to RSK](https://developers.rsk.co/kb/configure-truffle-to-rsk/). ### Debugging Need to debug transactions in RSK? See an example of [how to debug transactions in an RSK Network on Stackoverflow](https://stackoverflow.com/q/66144175/194982) ![debug transactions in an RSK Network on stackoverflow](https://i.imgur.com/U1oY4LE.png) If your contract emits messages in the reversions, then you can find them out by using `debug_traceTransaction`. Note that the debug RPC module is enabled by default in RSK config, but this is disabled on public nodes. Furthermore, the RSK public nodes do not expose this feature, and you must run your own node in order to do so. The following assumes that you have a local node running with RPC exposed on port `4444`. First, you need to enable `debug` module in your config file: ```json modules = [ ... { "name": "debug", "version": "1.0", "enabled": "true", }, ... ] ``` Then, you can execute the RPC method passing the transaction ID as a parameter, like in this example: ```shell curl \ -X POST \ -H "Content-Type:application/json" \ --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0xa9ae08f01437e32973649cc13f6db44e3ef370cbcd38a6ed69806bd6ea385e49"],"id":1}' \ http://localhost:4444 ``` You will get the following response (truncated for brevity): ```json { ... "result": "08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e536166654d6174683a207375627472616374696f6e206f766572666c6f770000", "error": "", "reverted": true, ... } ``` Finally, convert `result` from hexadecimal to ASCII, to obtain a readable message: ``` Ãy SafeMath: subtraction overflow ``` ### RPC [Remote Procedure Calls (JSON-RPC)](https://developers.rsk.co/rsk/node/architecture/json-rpc/) are the primary interface through which RSK nodes communicate over the network. RSK's JSON-RPC has a high level of compatibility with Ethereum's JSON-RPC. JSON-RPC is available over two network transport protocols: **HTTP** and **WebSockets** - [Configuring and using RPC over HTTP](https://developers.rsk.co/rsk/node/architecture/json-rpc/) - [Configuring and using RPC over WebSockets](https://developers.rsk.co/rsk/node/architecture/json-rpc/) > Note that [RSK public nodes](https://developers.rsk.co/rsk/node/architecture/json-rpc/) > do not expose WebSockets, they are HTTP only. > To work around this, you may either > run your own RSK node, > or use a third-party node provider, > such as [Getblock](https://developers.rsk.co/solutions/getblock/). ## Wrap up In this article, we interacted and connected with the different public RSK Networks, Configured Metamask to connect to RSK, Downloaded and ran an RSK Node in `regtest` network. Thanks for reading! > For more tutorials and guides, check out the [RSK/RIF knowledgebase in DevPortal](https://developers.rsk.co/kb/). ## Kudos Thanks to [Brendan Graetz](http://bguiz.com/) and [Diego Masini](https://github.com/diegomasini) for their help in reviewing this guide!

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully