Introduction

Scrypta Core, as anticipated in the introductory chapters, is the Javascript library that is at the base of the client-side interactions (therefore the user side) and performs, in a local manner - ie without consulting external servers - all the functions necessary for the management of addresses and transactions.

SID File

The Scrypta Core library, NEVER saves private keys in plain text and only uses them "on the fly", after the user has unlocked their identity payload. This payload, which we will quote several times, is an encrypted string through the AES-256 protocol and is commonly saved in files with the extension .sid (Scrypta ID).

the password with which the key is encrypted is NEVER saved in clear text. We ask developers to follow these simple rules, which guarantee a first, but essential, security barrier to unauthorized use of addresses.

Local management of .sid files occurs by default through localStorage, this can also be bypassed to give anyone the opportunity to develop their own archiving system. We ourselves, within the Manent App and within the ScryptaID extension, have bypassed this default system to create multi-address environments.

Get Started

The Scrypta Core library connects the client with one of the available Scrypta IdaNodes. These nodes, in the pre-compiled version of the library, cannot be customized. Instead, you can use your own by entering them in the code and recompiling the library.

In this section we will analyze in depth the operation of every single method of the library. Please note that the library declares itself in the global variable window with the name ScryptaCore. Each method can then be used through the global variable window as in the following example:

let address = await window.ScryptaCore.createAddress('AStrongPassword')​/* { "pub":"LbcJVdgiJoX55HUSDrdPTw58iC465tbEnG", "api_secret":"3d25258d0fe27521eb78d2b9a5ff7242", "key":"034c6155cb500844ee0e6674a3237a7d3e6be8f0c0080b18cc3f58289724ee5072", "prv":"SninxEoZ9qfuPCSsbZm2E8aB61wqpH94nVdDJ7XutoTNMPvzQt8z", "walletstore":"LbcJVdgiJoX55HUSDrdPTw58iC465tbEnG:72363f2891a3f7db7b5c9be07cd9a03d727ac0728b80850b3a21e120c9c18fac226c911eff7d95850f01acd3b6b00406abba764aa14bd0d7c75301a8dc4dc0286c6414be3c4d8d16eee9e35faf635ae439070859b4ac29b1d9e12c983b5aa84b8adbd6dbc69dbf731aad802dfe07df1b7dcff793911fb6e027b989ffcc1189fe4646e9a3db211401bb0b1c92a4740779f6178046299c4dacb37e398d0cf93efac018bd7b6c24426787947fefcd6c0bcb9736ab2d1ba4c0b1b87dc6a8720b819c" }​*/

Library Test and Debug

To test the library locally, you need to have NodeJS and GIT installed, below is a list of the commands needed to start the test web interface:

git clone https://github.com/scryptachain/scrypta-corecd scrypta-corenpm installnpm start

Webpack will only start a test server at http: // localhost: 8080. The basic interface will allow testing of the main functions:

Example of test interface

Compiling the library

To compile the library, just type the following command from the terminal:

npm run build

Webpack will create the scryptacore.js file inside the dist folder of the project. This file can be included in static web pages like any javascript file:

<script src="/path/to/scryptacore.js"></script>