A basic example of an ethereum wallet API with endpoints:
/createWallet
create an ethereum wallet/getBalance
checking wallet balance/transaction
making a transaction
# clone repo
git clone [email protected]:wingleung/ethereum-wallet-api-example.git
cd ethereum-wallet-api-example
# Install dependencies
npm install
# Start developing
npm run dev
# Start server
npm start
{
"port": 8080, // port to launch app to
"bodyLimit": "1kb", // max size of request json object
"ethereumNetwork": "" // url of your ethereum network
}
/createWallet
GET localhost:8080/createWallet
# response
{
"address": CREATED_WALLET,
"privateKey": PRIVATE_KEY
}
/getBalance/SOME_ETH_ADDRESS
GET localhost:8080/getBalance/SOME_ETH_ADDRESS
# response
{
"ethAddress": SOME_ETH_ADDRESS,
"balance": BALANCE
}
/transaction
POST to localhost:8080/transaction
BODY
{
"privateKey": YOUR_PRIVATE_KEY,
"amount": AMOUNT,
"destination": DESTINATION_WALLET
}
# response
{
"txHash": TRANSACTION_HASH
}
MIT