Check out the badges hosted by shields.io
A web app for sending testnet tokens for various supported testnet network, with receipt and transaction history (10 inound and 10 outbound)
This project is hosted on a heroku eco-dyno, when it is not being actively used it requires a bit extra start up time. This can be mitigated by upgrading to the next tier on heroku.
If you would like to host a version of it yourself, please follow these instructions:
to install both the client and server side dependencies:
npm i
start the server:
npm start
to concurrently start server and client react code w/ hotreload:
npm run develop
This deployed project currently uses a wallet address's secret key set in the .env. (this will be for the address where the testnet tokens are from) If hosting a standalone instance, please ensure both Alchemy API key and secret key are availble in .env
If you would like to host a heroku version of it privately, make sure you have heroku CLI installed, and at the root of the project run
heroku create app_name
. After we confirmed that it has been deployed. Navigate to your heroku project page and ensure that all of your env var is set.
Utilizing Alchemy SDK, we are able to query wallet balance, specific transactions and send transactions:
You are able to connect your browser extension wallets that utilizes the EIPS-6963 which helps avoid conflict and improves user experience.
Wallet Balance and History
/api/balance
alchemy.core.getBalance()
- network (based on Alchemy SDK instance)
- address (from env var:
SECRET_KEY
)We are first instantiating a new Alchemy SDK instance for each supported network iteratively, then using
alchemy.core.getBalance()
with our wallet address to return our Ether balance for each network respectively.within this project, we are using our
Secret_Key
set in our environment variale, and using Alchemy SDK'sWallet
helper to help us access our address hash without hardcoding it
Sending Transaction
/api/send/:net/:to
alchemy.core.sendTransaction()
- network (translated to chainID)
- receiving address
- gasLimit
- maxPriorityFeePerGas & maxFeePerGas from
alchemy.core.getFeeData()
- nonce from
alchemy.core.getTransactionCount()
optinoal set to pending- value
We are first using
alchemy.core.getTransactionCount()
to get our nonce, andalchemy.core.getFeeData()
for our maxFee/PriorityFee per Gas. After we gathered all the required parameters, we then use SDK's Wallet helpersignTransaction(tx)
to sign our transaction before sending it withalchemy.core.sendTransaction(rawTx)
.Once the transaction is sent, it will live in the mempool, it automatically return a transaction hash, but this hash has yet to be mined and will not show up on any of the scanner until it is officially mined.
Receipts
/api/receipt/:net/:hash
alchemy.transact.waitForTransaction()
- network
- Transaction Hash
After we received the transaction hash from
sendTranasaction
we usewaitForTransaction
to return a receipt response after it had successfully mined.
Transaction History
/api/transactions
alchemy.core.getAssetTransfers
- network
- toAddress / fromAddressZ
- excludeZeroValue (true/false)
- category
[external]
- maxCount
- withMetadata (true/false)
Since we want to show both inbound and outbound transaction history, we are calling
getAssetTransfers
twice. Due to ease of displaying info, I had set our maxCount to 10.
Mari Ma
For any questions, please reach out directly or by creating an issue.