Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreid/miniblockchainapi
API to send ETH & Tokens to Ethereum based blockchains.
https://github.com/andreid/miniblockchainapi
backend blockchain erc-20 ethereum go solidity tokens
Last synced: about 1 month ago
JSON representation
API to send ETH & Tokens to Ethereum based blockchains.
- Host: GitHub
- URL: https://github.com/andreid/miniblockchainapi
- Owner: AndreiD
- License: gpl-3.0
- Created: 2018-10-29T07:59:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T20:52:06.000Z (about 6 years ago)
- Last Synced: 2024-06-21T07:43:01.478Z (5 months ago)
- Topics: backend, blockchain, erc-20, ethereum, go, solidity, tokens
- Language: Go
- Size: 5.3 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
~~~~
███╗ ███╗██╗███╗ ██╗██╗ ██████╗ ██╗ ██████╗ ██████╗██╗ ██╗ ██████╗██╗ ██╗ █████╗ ██╗███╗ ██╗
████╗ ████║██║████╗ ██║██║ ██╔══██╗██║ ██╔═══██╗██╔════╝██║ ██╔╝██╔════╝██║ ██║██╔══██╗██║████╗ ██║
██╔████╔██║██║██╔██╗ ██║██║ ██████╔╝██║ ██║ ██║██║ █████╔╝ ██║ ███████║███████║██║██╔██╗ ██║
██║╚██╔╝██║██║██║╚██╗██║██║ ██╔══██╗██║ ██║ ██║██║ ██╔═██╗ ██║ ██╔══██║██╔══██║██║██║╚██╗██║
██║ ╚═╝ ██║██║██║ ╚████║██║ ██████╔╝███████╗╚██████╔╝╚██████╗██║ ██╗╚██████╗██║ ██║██║ ██║██║██║ ╚████║
╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝
~~~~## Send ETH & Tokens API
This small backend enables you to send ETH & Tokens to Ethereum based blockchains.
## How to use it
- Step #1: Fork the project and give it a star
- Step #2: Copy the api_config.example.json to api_config.json and edit it with the link to your blockchain (you can use infura for rinkeby, main-net)
- Step #3: Build & run with: go build -o server; ./server
- Step #4: ??
- Step #5: Profit!!!## Note about security:
- This api should run on localhost!
- If you need to expose it, make a reverse nginx proxy and configure it for https!## API's
#### GET /api/v1/
general info about the connection with the blockchain#### GET /api/v1/health
health about how much resources this mini-server takesparams: address
Example:
~~~~
curl --request GET \
--url 'http://localhost:9090/api/v1/balance/token?contract=0x991c43f15b7d286f473e644df689dc3d722b58b2&address=0x5d924b2D34643B4Eb7D4291fDcb07236963f040f' \
--header 'Content-Type: application/json'
~~~~#### GET /api/v1/balance/eth
gets the ETH balance.params: address
Example:
~~~~
curl --request GET \
--url 'http://localhost:9090/api/v1/balance/eth?address=0xF69D65f241a523837c7F37f8B38328176416E771' \
--header 'Content-Type: application/json'
~~~~#### GET /api/v1/balance/token
gets the token balance.params: contract, address
Example:
~~~~
curl --request GET \
--url 'http://localhost:9090/api/v1/balance/token?contract=0x991c43f15b7d286f473e644df689dc3d722b58b2&address=0x5d924b2D34643B4Eb7D4291fDcb07236963f040f' \
--header 'Content-Type: application/json'
~~~~#### PUT /api/v1/tx/send_eth
sends ETH to an addressparams: to_address, sender_private_key, amount_in_wei
Example:
~~~~
curl --request PUT \
--url 'http://localhost:9090/api/v1/tx/send_eth?to_address=0xF69D65f241a523837c7F37f8B38328176416E771&sender_private_key=908550C596A682C500FE1013EB3CEB5A8421FC62D6FF1F81CCDFEDD69768E560&amount_in_wei=100000000000000000' \
--header 'Content-Type: application/json'
~~~~#### PUT /api/v1/tx/send_token
sends Tokens to an addressparams: to_address, sender_private_key, contract, amount_in_wei
Example:
~~~~
curl --request PUT \
--url 'http://localhost:9090/api/v1/tx/send_token?to_address=0xF69D65f241a523837c7F37f8B38328176416E771&sender_private_key=908550C596A682C500FE1013EB3CEB5A8421FC62D6FF1F81CCDFEDD69768E560&contract=0x991c43f15b7d286f473e644df689dc3d722b58b2&amount_in_wei=1000000000000000000' \
--header 'Content-Type: application/json'
~~~~#### TODO:
- sanitize inputs
- docker ?
- any suggestions ?#### Thanks to:
https://github.com/hunterlong/tokenbalance for the tokens generic bindings.
#### License: GPL-3.0