https://github.com/wingleung/ethereum-wallet-api-example
A basic example of an Ethereum wallet API to manage your crypto wallet
https://github.com/wingleung/ethereum-wallet-api-example
api cryptocurrency ethereum nodejs wallet web3
Last synced: 5 months ago
JSON representation
A basic example of an Ethereum wallet API to manage your crypto wallet
- Host: GitHub
- URL: https://github.com/wingleung/ethereum-wallet-api-example
- Owner: wingleung
- License: mit
- Created: 2018-05-20T10:51:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-20T11:08:44.000Z (about 8 years ago)
- Last Synced: 2025-04-11T04:51:51.551Z (over 1 year ago)
- Topics: api, cryptocurrency, ethereum, nodejs, wallet, web3
- Language: JavaScript
- Homepage:
- Size: 71.3 KB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ethereum wallet API example
A basic example of an ethereum wallet API with endpoints:
* `/createWallet` create an ethereum wallet
* `/getBalance` checking wallet balance
* `/transaction` making a transaction
## Getting Started
```sh
# clone repo
git clone git@github.com:wingleung/ethereum-wallet-api-example.git
cd ethereum-wallet-api-example
```
```sh
# Install dependencies
npm install
```
```sh
# Start developing
npm run dev
```
```sh
# Start server
npm start
```
## Config
```js
{
"port": 8080, // port to launch app to
"bodyLimit": "1kb", // max size of request json object
"ethereumNetwork": "" // url of your ethereum network
}
```
## Endpoints
`/createWallet`
```sh
GET localhost:8080/createWallet
```
```js
# response
{
"address": CREATED_WALLET,
"privateKey": PRIVATE_KEY
}
```
`/getBalance/SOME_ETH_ADDRESS`
```sh
GET localhost:8080/getBalance/SOME_ETH_ADDRESS
```
```js
# response
{
"ethAddress": SOME_ETH_ADDRESS,
"balance": BALANCE
}
```
`/transaction`
```sh
POST to localhost:8080/transaction
BODY
{
"privateKey": YOUR_PRIVATE_KEY,
"amount": AMOUNT,
"destination": DESTINATION_WALLET
}
```
```js
# response
{
"txHash": TRANSACTION_HASH
}
```
## License
MIT