https://github.com/newtonproject/newchain-sdk-example
SDK Example of NewChain
https://github.com/newtonproject/newchain-sdk-example
Last synced: 9 months ago
JSON representation
SDK Example of NewChain
- Host: GitHub
- URL: https://github.com/newtonproject/newchain-sdk-example
- Owner: newtonproject
- License: gpl-3.0
- Created: 2019-05-07T15:01:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-12T03:32:46.000Z (9 months ago)
- Last Synced: 2025-03-12T04:25:29.224Z (9 months ago)
- Homepage: https://www.newtonproject.org
- Size: 41.2 MB
- Stars: 6
- Watchers: 6
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Roadmap: Roadmap.md
Awesome Lists containing this project
README
# NewChain SDK
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](hhttps://github.com/newtonproject/newchain-sdk-example/tree/master/examples) folder
For more detailed reference information, please check:
* [RPC and API reference](RPC_API_reference.md)
* [Chain IDs](chain_id.md) for devnet, testnet, and mainnet ID codes
* [Address standards](address_standards.md) for NewChain address standards
## Get Started
Clone our GitLab repo and enter the directory:
```sh
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](https://github.com/newtonproject/newchain-sdk-example/tree/master/examples) folder.
### Node.js
NewChain's Javascript library can be downloaded from [NPM](https://www.npmjs.com/package/newchain-web3)
#### Install
```bash
npm install newchain-web3
```
#### Run Example Code
```sh
cd examples/node
npm install --save
node index.js
```
### Python
NewChain's Python library can be downloaded from [PyPI](https://pypi.org/project/newchain-web3/)
#### Install
```bash
cd examples/python/test/
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
```
#### Create account
```bash
python tx.py create
```
#### Check balance
```bash
python tx.py balance 0x0286a28b49b3462252e3162a982ef28a8a8611dc
```
#### Initiate payment
```bash
python tx.py pay --src 0x0286a28b49b3462252e3162A982EF28a8A8611dc --dest 0x97549E368AcaFdCAE786BB93D98379f1D1561a29 --value 1 --rpc https://rpc1.newchain.newtonproject.org -value 100
```