section

Node bash shell

About GNU/Linux

Main SYSOP interface: Text Command-line console, also known as shell.

Linux prompts. Line Prefixes is given by the computer to indicate us context: user and path

    root:~$

SYSOP role operates under user root, and can control all aspects of the operating system. This prompt indicates that our path in the filesystem is /root (root home directory)

    root:/home/stv

This prompt indicate we are SYSOP, although our current path in the filesystem is /home/stv (stv user's home directory again)

    stv:~$ 

Finally, this prompt indicates our hat is Script-Network user and that our current directory is home (/home/stv)

SYSOP Role/hat: user root

Available commands for SYSOPs:

    * script_tv__uninstall.sh           # uninstalls the node software from your VM
    * script_tv__test.sh                # subsystem health checks 
    * script_tv__ctl stop               # stops all services for node maintenance
    * script_tv__ctl start              # resume all services after node maintenance
    * cat /var/script_tv/data_sheet     # Prints Operational Data sheet detailing daemons, URLs and ports used among other technical data.

SCRIPT P2P Network User/Community Role/hat: user stv

Changing to user stv from root

        root$> su stv                  # change to user stv
        stv:/root$ cd                  # go to our new home dir at /home/stv
        stv:~$ pwd                     # optional: verify our directory is /home/stv

Returning back to root user (SYSOP mode)

        stv:~$ exit
        root$> 

If you exited change again to user stv. The following command are defined in the file .bashrc as aliases and active only during sessions as user stv:

        scriptcli                 
        script                    # access to public ledger 

These two commands are the lowest-level console interface to operate the script L1 private and public daemons respectively.

L1. core applications

* `script`:  #  can be regarded as the launcher of the script Ledger node. Interact with the public ledger (blockchain).
* `scriptcli` # access to wallet functions via command line.
* `stvtool` # upgrading the running node functions via command line.

scriptcli - Core Wallet Client

the scriptcli command must be executed as user stv.

use this command to check the status:

    stv:~$ scriptcli query status
    {
        "address": "0x8d1F3236d790415d631d554091dE7A25913FB561",
        "chain_id": "testnet",
        "current_epoch": "1007",
        "current_hash": "0xd2390cb67e49939a1f7ee71fb1e754f2f9c05dd0f66c2c71d75721fee4159806",
        "current_height": "1005",
        "current_time": "1721812083",
        "genesis_block_hash": "0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c",
        "latest_finalized_block_epoch": "1005",
        "latest_finalized_block_hash": "0x7ead0d6e526f6489f5ccf58a33a25257e57667fbad6e5ac9beee66e8b28efdef",
        "latest_finalized_block_height": "1005",
        "latest_finalized_block_time": "1721812070",
        "peer_id": "0x8d1F3236d790415d631d554091dE7A25913FB561",
        "snapshot_block_hash": "0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c",
        "snapshot_block_height": "0",
        "syncing": false,
        "tip_hash": "0xc0ca980d8000241f396de5b80403f3a4f57bf27b5e21d713b0a349f55184b5cb"
    }

From the returned information we learn:

* Our node address is `0x8d1F3236d790415d631d554091dE7A25913FB561`
* we are on `testnet` network
* our peer_id is our node address, for node-node communications.
* The genesis block hash `0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c` must match on all nodes of this network.
* Other information about the chain: block height, last block (`current_hash`).
* Syncing indicates the type of activity that is going on. true/false indicates whether an sync activity is ongoing or not. 

The core wallet manages the node_address. It can be verified:

    stv:~$ scriptcli key list
    0x8d1F3236d790415d631d554091dE7A25913FB561

We can use the scriptcli command line tool to send Script tokens from one address to another by executing the following command.

    stv:~$ scriptcli tx send --chain="testnet" --from=98fd878cd2267577ea6ac47bcb5ff4dd97d2f9e5 --to=8d1F3236d790415d631d554091dE7A25913FB561 --script=0 --spay=20 --seq=1

The balance of an address can be retrieved with the following query command, after the transaction has been included in the blockchain, it should take only a few seconds.

    stv:~$ scriptcli query account --address=8d1F3236d790415d631d554091dE7A25913FB561

Now let's send 20 more Script tokens. We need to increment the seq parameter. The sequence seq is a monotonic counter associated with each account determining the transaction execution order.

    stv:~$ scriptcli tx send --chain="testnet" --from=98fd878cd2267577ea6ac47bcb5ff4dd97d2f9e5 --to=8d1F3236d790415d631d554091dE7A25913FB561 --script=0 –spay=20 --seq=2

We can query the recipient address again to verify the account balance changes calling scriptcli query account.

Account/Key Management

The scriptcli is a wallet that can manage keys for multiple accounts.

Create a new account/address and store the key in ~/script4/wallet/keys:

    stv:~$ scriptcli key new 

List all the keys in the wallet:

    stv:~$ scriptcli key list 

Delete the account/address.

    stv:~$ scriptcli key delete

Invocation of script and scriptcli programs are meant to be done always as user stv from its home directory (stv:~$ or stv:/home/stv$).

Your keys are stored in directory /home/stv/script4/wallet/keys/plain

    stv:~$ find script4/wallet/keys/plain -exec cat {} \;
    {"address":"8d1f3236d790415d631d554091de7a25913fb561","privatekey":"d8604ad2430cd7292c1374838c4ffee8edb5a6723f4ca3cb8d1e8e8bab28c905","id":"0fc641f5-18c3-47ea-ba7d-83126ea0e32

As protection against loss, it is encouraged to backup the keys directory.

testnet Faucet:

Obtain funds from script.tv

It's natural we want to fund our node address.

If we run a testnet node we would use a node faucet, or token fountain.

Every script node has a faucet service that will kindly transfer you funds on request. No questions.

However if we run a mainnet node we would use an exchange to buy tokens instead.

Before asking the faucet let's use an address we control.

If you wanted to fund this node address, such data can be obtained querying status:

    stv:~$ scriptcli query status
    {
        "address": "0x8d1F3236d790415d631d554091dE7A25913FB561",                       <=== address
        "chain_id": "testnet",
        "current_epoch": "1019",
        "current_hash": "0x44d71c52e6ddc4a905dc1901e7cc1a5b9bceed11ab4ea4cd023bb3b82b8d9147",
        "current_height": "1017",
        "current_time": "1721812158",
        "genesis_block_hash": "0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c",
        "latest_finalized_block_epoch": "1017",
        "latest_finalized_block_hash": "0x270bdf99bea4a90554ef13138721d33a4302f9c55925e0a14f8ca2ef8bda3359",
        "latest_finalized_block_height": "1017",
        "latest_finalized_block_time": "1721812142",
        "peer_id": "0x8d1F3236d790415d631d554091dE7A25913FB561",
        "snapshot_block_hash": "0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c",
        "snapshot_block_height": "0",
        "syncing": false,
        "tip_hash": "0xc7134d79a766cef0bcd32f267c0662fa6cafb7e4a22c73620ad5baeff1238ff3"
    }

Our address can be found on the response, 0x8d1F3236d790415d631d554091dE7A25913FB561.

Let's do it:

    stv:~$ bin/stvtool query_faucet 0x8d1F3236d790415d631d554091dE7A25913FB561

You can repeat the command as many times as you wish, recommended 10 times, so we earn this way easy tokens.

By feeding the node address you are enabling your own fawcet, which uses this node_address as source of funds.

After a few seconds we can check our balance:

    stv:~$ scriptcli query account --address=0x8d1F3236d790415d631d554091dE7A25913FB561
    {
        "code": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "coins": {
            "scptwei": "12000000000000000000000",
            "spaywei": "1200000000000000000000"
        },
        "last_updated_block_height": "1180",
        "reserved_funds": [],
        "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sequence": "0"
    }

Removing 18 trailing zeroes we obtain our balance of tokens (provided you called the faucet 12 times)

    SCPT token: 12000;  SPAY token:1200

Interface for interacting with faucet service can be found at node URLS (testnet):

* Human: https://wallet-testnet.<your-domain>
* API: https://backend-wallet-testnet.<your-domain>

##> rpc

Testnet Node. Browser. Fund new wallet accout from your faucet

We learnt how to fund the node account in the previous section. In this section we will learn to fund a new account from our own faucet.

Go to https://wallet-testnet. and create a new wallet. Save the keystore in a controlled directory and login.

As you unlock the wallet you'll see the address at the top of your screen besides the label "My address". In this example we'll assume it is 0xeeF1966D1b39E35A08975255138A020239Ea30d6.

Rehearsing

    my console-wallet/node address is 0x8d1F3236d790415d631d554091dE7A25913FB561 
    my browser-wallet address is 0xeeF1966D1b39E35A08975255138A020239Ea30d6 

Balances should show up zero.

Click Receive - Faucet, then confirm and wait 15 seconds to see your balance updated.

We can check the node account has been decreased in the same amounts - off by 0.000001 SPAY fees

    stv:~$ scriptcli query account --address=0x8d1F3236d790415d631d554091dE7A25913FB561
    Using config file: /home/stv/script4/lightning1/wallet/config.yaml
    {
        "code": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "coins": {
            "scptwei": "11000000000000000000000",
            "spaywei": "1099999990000000000000"
        },
        "last_updated_block_height": "1180",
        "reserved_funds": [],
        "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sequence": "1"
    }

Your node account has payed for your faucet transfer of 1000 SCPT + 100 SPAY, and its balance is now:

    SCPT token: 11000;  SPAY token:1100-fees

Testnet Node. Browser. Send Funds to a given accout.

From your web wallet let's give back 500 SCPT to anyone, for example our node address (0x8d1F3236d790415d631d554091dE7A25913FB561)

Click Send buttond and fill the fields:

The transaction should be reflected on screen in seconds, and on the recipient account

    stv:~$ scriptcli query account --address=0x8d1F3236d790415d631d554091dE7A25913FB561
    {
        "code": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "coins": {
            "scptwei": "11500000000000000000000",
            "spaywei": "1099999990000000000000"
        },
        "last_updated_block_height": "1180",
        "reserved_funds": [],
        "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sequence": "1"
    }

We can confirm we received 500 SCPT from the browser wallet.

Testnet Node. Shell. Send Funds from your node wallet (the wallet safeguarding the node key).

In order to make transfers from console you'd need to have available the source and recipient addresses and the sequence number of the source account, the account where source funds sit.

In our case, the source address is our node account (0x8d1F3236d790415d631d554091dE7A25913FB561), and the recipient address is our browser-wallet address (0xeeF1966D1b39E35A08975255138A020239Ea30d6).

We obtain the sequence number using the source address:

    stv:~$ scriptcli query account --address 0x8d1F3236d790415d631d554091dE7A25913FB561
    {
        "code": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
        "coins": {
            "scptwei": "11500000000000000000000",
            "spaywei": "1099999990000000000000"
        },
        "last_updated_block_height": "1180",
        "reserved_funds": [],
        "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sequence": "1"
    }

For the sequence value we will take the value of the field "sequence" plus one, as we obtained "1" we will then use sequence number 2.

For the amount we will transfer 10000 SCPT.

    stv:~$ scriptcli tx send --chain="testnet" --from=0x8d1F3236d790415d631d554091dE7A25913FB561 --to=0xeeF1966D1b39E35A08975255138A020239Ea30d6 --script=10000 --seq=2
    Successfully broadcasted transaction:
    {
        "hash": "0x41ce406895c166145211091afa50f0ae7197b721f1d4e2634e52ea3c72ce5b34",
        "block": {
            "ChainID": "testnet",
            "Epoch": 2844,
            "Height": 2844,
            "Parent": "0xfaf4d062abecbc230a34ca45f7e4c68d9f3e2ad512eb213a6710d6e4b611dd07",
            "HCC": {
                "Votes": [
                    {
                        "Block": "0xfaf4d062abecbc230a34ca45f7e4c68d9f3e2ad512eb213a6710d6e4b611dd07",
                        "Height": 2843,
                        "Epoch": 2843,
                        "ID": "0x99b009e8a5257772ac07c9b370b2bdb389e3b46a",
                        "Signature": "0xc288ef07aef45c008340f4189959d90d0f64fb326c4f218633ce1466efdec4421af3d3e4840a92e84bc7b91c7b18e739bd89db9319949eac0320a17cc3c5d7fd01"
                    }
                ],
                "BlockHash": "0xfaf4d062abecbc230a34ca45f7e4c68d9f3e2ad512eb213a6710d6e4b611dd07"
            },
            "LightningVotes": null,
            "EliteEdgeNodeVotes": null,
            "TxHash": "0xc8bd1399466df192645f836f806cdf94ff6dc5619092c6e4786ec074deea6034",
            "StateHash": "0x40291b0c95fa8573fee4c7b15b7b73ed0adf97cdfc78a42e4aec9fd2210ebeca",
            "Timestamp": 1721823113,
            "Proposer": "0x99b009e8a5257772ac07c9b370b2bdb389e3b46a",
            "Signature": "0xae52ab043504345a77aca34c77ba3888431e609ea37c7233c6cbfcdb43ea4e972869c014539253a68dae77a6cf32999dfd155f9d72b48a4081381bfaa913672500"
        }
    }

At this point your browser wallet should show this balances:

With a balance of 10000 SCPT you can stake your lightning node from the browser wallet.

Testnet Node. Browser. Stake your lightning node.

Click on On-Chain Stakes, then Deposit Stake and then continue with Lightning Node.

In the following screen click on the helper button labeled This node to autofill the node fingerprint with the one corresponding to this node (double check URL to make sure which node you're operating with and which one you want to stake).

Enter 10000 SCPT.

The node fingetprint can alternatively be obtained on the shell in the field "Summary" of the response.

    stv:~$ scriptcli query lightning
    {
        "Address": "0x8d1F3236d790415d631d554091dE7A25913FB561",
        "BlsPubkey": "8322dc548cef749a20f276c3106054ac4fd59081191e87128683c4a8b6c00547fc53b242ec79d9c49ce12176efda4658",
        "BlsPop": "875aa8ce47ecae78e8076c9163bdca6757036a8fe70f46869010bdf3c2dafdcd2dd7eac5484bad57733b5210efa1c717118fa57addc1c31c810c23bfe8b1c1c54c3940e43e3670c3e9b32f551986fedc670f897e92392f3309cdad41d0031866",
        "Signature": "dc141c86b5d5059969eba9d6e795d5f9fd4715922ddc1a24417da974ca1c3c8327edf11f18ccbe13ee297cee70a6a69801bd92f0d0ed472087f7bdf78b41785800",
        "Summary": "0x8d1F3236d790415d631d554091dE7A25913FB5618322dc548cef749a20f276c3106054ac4fd59081191e87128683c4a8b6c00547fc53b242ec79d9c49ce12176efda4658875aa8ce47ecae78e8076c9163bdca6757036a8fe70f46869010bdf3c2dafdcd2dd7eac5484bad57733b5210efa1c717118fa57addc1c31c810c23bfe8b1c1c54c3940e43e3670c3e9b32f551986fedc670f897e92392f3309cdad41d0031866dc141c86b5d5059969eba9d6e795d5f9fd4715922ddc1a24417da974ca1c3c8327edf11f18ccbe13ee297cee70a6a69801bd92f0d0ed472087f7bdf78b41785800"
    }

Confirm

You will verify after a few seconds that sadly your balance has dropped, as it can be seen on your explorer:

We can pay a visit to the explorer to do some verifications.

You can use either your explore (serviced by your node) or any other node including the one behind script.tv. https://explorer-testnet.<your domain|script.tv>/account/0xeeF1966D1b39E35A08975255138A020239Ea30d6

As a result of your transaction you are queued waiting for inclusion.

If you are like me you would need to access such queue and check my address is reflected there.

We would need first to obtain the current_height of the blockchain:

    stv:~$ scriptcli query status
    { ...
        "current_height": "3713",
    ... }

With it, we can print the waiting queue querying lcp (Lightning Candidate Pool):

    stv:~$ scriptcli query gcp --height=3713
    {
        "BlockHashGcpPairs": [
            {
                "BlockHash": "0x75c499de22a3ed2852c9f2e9ed7bf92909557e80921a555bcb6874ad1ed50f68",
                "Gcp": {
                    "SortedLightnings": [
                        {
                            "Holder": "0x8d1f3236d790415d631d554091de7a25913fb561",
                            "Stakes": [
                                {
                                    "amount": "10000000000000000000000",
                                    "return_height": "18446744073709551615",
                                    "source": "0xeef1966d1b39e35a08975255138a020239ea30d6",
                                    "withdrawn": false
                                }
                            ]
                        }
                    ]
                }
            }
        ]
    }

We can be pleased to find our candidacy included in this list.

Our balance of 500 SCPT, 100 SPAY checks out.

We easily spot our last transaction Deposit Stake.

Testnet Node. Stvtool. Upgrade your node.

In order to upgrade the running node to be a validator or a lightning node, the stvtool can be used to stake easily.

First, fund the node using faucet. For validator, 1000000 SCPT is required to stake, and for lightning node 10000 SCPT is required.

Use option --for validator so account has required amount:

    stv:~$ bin/stvtool --for validator faucet

Use option --for lightning so account has required amount:

    stv:~$ bin/stvtool --for lightning faucet

Option --domain can be used to query a different node. Default is the node your own node.

Next, use --upgrade_node to upgrade node and stake against it.

To become a Script Validator node:

    stv:~$ bin/stvtool --feature validator upgrade_node

To become a Script Lightning node:

    stv:~$ bin/stvtool --feature lightning upgrade_node

Option --amount can be used to stake amount other than default.

Node Web2.0 Interface

Script Web Wallet

https://wallet-testnet.script.tv

Wallets are privacy-first programs that manage your "secrets", among them are your keys, used to unlock addresses and needed to move tokens around.

The Script Wallet can be found on any node. Script Network node provide the following URLs for the wallet service:

Your secrets, represented by the keystore file, are never transmitted throught the wire. and shall be backed up and kept secret by the user.

Access the wallet using the main menu of the desired network, e.g. Testnet -> Testnet wallet.

Creating a new wallet

New users would need to go through the process of creating a new keystore file.

Click the link "create a wallet" that you'd find at the bottom of the unlock-wallet screen.

Complete a set of easy steps following on-screen instructions.

This process will end-up in a keystore file containig your secret keys.

It's your responsibility to safeguard this file, keeping it backed up and secret being aware that leaked secrets may produce loss of tokens.

Unlocking your wallet

3 methods are available to get access to your funds.

  • keystore

You would normally unlock your wallet using your keystore file. In case this file is lost or not accessible the process can alternativamente be fulfilled using two remaining recovery methods.

  • mnemonics

During the process of creating the keystore a copyable paragraph is also created as an alternative method to unlock the wallet.

  • Private key

Raw secret keys (found in the keystore file) can be used as an alternative method to unlock the wallet.

Main wallet screen

Informational fields:

At the top of the window is permanently shown the following information together with copy-to-clipboard buttons.

  • This Node address: is the address of the node providing the backend service.

  • My address: is your address unlocked from your private keystore

Balances

This screen shows your SCPT and SPAY balances and the history of transactions.

Receive (faucet). (Only Testnet).

Faucet is a testnet-only feature that allows testing applications and mature monet-handling algorithms using play money, instead of risking real-money in the mainnet. Only if your current balance is under 100000 SCP every time to click on Receive button 1000 SCPT and 100 SPAY are transferred to your balances.

15 seconds after clicling the receive button you balance screen would reflect your new balances and a new entry in the transaction history list.

On-Chain Stakes

Invest in the network. The network will reward you.

Deposit

Select lightning node and continue.

Explorer

Last updated