Preparation

To Share and +4 nLEARNs

Please complete the following as soon as possible  It is essential for the success of this program to coordinate our activities and this will help us do just that.

Immediately:

1. Please join us on a dedicated Telegram Group
– Join LNC Official Telegram group to get P2P help and get tips with NEAR

2. Follow Learn NEAR on Twitter https://twitter.com/LearnNear

3. Create a testnet account  – YourName.testnet – https://wallet.testnet.near.org/

4.  Add our Telegram bot to monitor your accounts:
Mainent:  https://t.me/nearwatchbot
Testnet:  https://t.me/LNC_testenet_watcher_bot

Install required tools

NOTE: This process is for Unix-like system, e.g. Linux or Mac OS. Windows installation process is different and covered in README_Windows.md.

Install Rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

Add wasm target to your toolchain:

rustup target add wasm32-unknown-unknown

Install near-cli

See near-cli installation docs

Install git

See installation guide from github.

Prepare workshop repo and verify tools installation

Clone the workshop repository

git clone https://github.com/evgenykuzyakov/workshop
cd workshop

It should clone the repository to a local folder workshop.

Compile the contract

./build.sh

If you have successfully installed Rust and wasm32 target, then ./build.sh should compile the contract into res/berry_bot.wasm.

   Compiling autocfg v1.0.0
   Compiling proc-macro2 v1.0.9
   Compiling unicode-xid v0.2.0
   ...
   Compiling near-vm-logic v2.0.0
   Compiling near-sdk v2.0.0
   Compiling berry-bot v0.1.0 (workshop)
    Finished release [optimized] target(s) in 43.13s

You can check that the contract is present in res/berry_bot.wasm

test res/berry_bot.wasm && echo "OK" || echo "BAD :("

I hope you see OK

Setup NEAR account

Register a new account on testnet.

You can create a new account using NEAR Testnet Wallet It’ll create a new account for you on the NEAR Testnet. The full account ID will be something like alice.testnet

As a Security Method for this workshop I’d recommend to use either Recovery Phrase or Email Recovery.

Authorize your account with near-cli

To allow using your account with near-cli you need to login from the terminal.

near login

This should open a new browser tab in the NEAR Testnet web-wallet and ask you give full access to your account. It’s fine to do, since we’re talking about Testnet account. You’ll need access from command line and near-cli for this workshop.

Once you authorized it in the browser, the command line should automatically succeed.

You should see something like this in the console:

Logged in as [ alice.testnet ] with public key [ ed25519:HP3oxy... ] successfully

Store your account ID into local variable

To help with this workshop let’s store your account ID into ACCOUNT_ID variable in bash. Replace <YOUR_ACCOUNT_ID> with your actual account ID that you created in the wallet, e.g. alice.testnet.

export ACCOUNT_ID=<YOUR_ACCOUNT_ID>

Verification

Let’s verify that you’ve successfully created the account and added it to near-cli.

Run the following:

near call --accountId=$ACCOUNT_ID workshop.testnet hello

If it succeeded then you’ve successfully completed your account setup. You should see something like this:

Scheduling a call: workshop.testnet.hello()
Receipt: 5rKUqv4t9JVQryvyfrgrFr8R48iV4sFX7nD56KUv6Vhb
	Log [workshop.testnet]: Hello, test-12331.testnet!
Transaction Id 8D2L4AdhbZ3CqWXMpRURsyqUTNJaBJDcFQsN4W8vU4y7
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/8D2L4AdhbZ3CqWXMpRURsyqUTNJaBJDcFQsN4W8vU4y7
'Hello, test-12331.testnet!'

Congrats!

Generate comment with AI 2 nL
Scroll to Top