Skip to content

newtonproject/newchain-sdk-example

Repository files navigation

NewChain SDK

Note: This document can be found on both our documentation website and GitHub repository

This document describes how to get started with Newton's NewChain SDK. At present we support NodeJS, Python, and Java. Example transaction code for each language can be found in the examples folder

For more detailed reference information, please check:

Get Started

Clone our GitLab repo and enter the directory:

git clone https://github.com/newtonproject/newchain-sdk-example.git
cd newchain-sdk-example

Running Example Code

All example code is stored in the examples folder.

Node.js

NewChain's Javascript library can be downloaded from NPM

Install

npm install newchain-web3

Run Example Code

cd examples/node
npm install --save
node index.js

Python

NewChain's Python library can be downloaded from PyPI

Install

cd examples/python/test/
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Create account

python tx.py create

Check balance

python tx.py balance 0x0286a28b49b3462252e3162a982ef28a8a8611dc

Initiate payment

python tx.py pay --src 0x0286a28b49b3462252e3162A982EF28a8A8611dc --dest 0x97549E368AcaFdCAE786BB93D98379f1D1561a29 --value 1 --rpc https://rpc1.newchain.newtonproject.org -value 100

Java

Please refer to the Java documentation for additional information.