A simple wrapper around nethereum to manage basic ERC20 minting, burning and transfer.
- Install Ganache
npm install
(inside ./Chain)truffle compile --all
(inside ./Chain)truffle deploy
(inside ./Chain)- Assign
MINTER_ROLE
andBURNER_ROLE
to the address that will be used by the server.
- Update ChainInfo data to match local chain or remote chain
- Assign a private key belonging to an account that has
MINTER_ROLE
andBURNER_ROLE
~/balance
gets the balance of theaccount
sent as query param in wei.
{
"amount": 70
}
~/mint
requests to mint anamount
of the token in wei at theaccount
. The response is the transaction hash as well as the nonce used asuming the tx is successful. An exception is thrown otherwise.
{
"account": "0x25b62DD8416D8bE58f6dE9DAf2a68FfBEfe0ba31",
"amount": 60
}
{
"tx": "0x68ebd1f6c8d08eb8db174a59a1a95077d2ddf356a0444e5b5a7aba93cd54fe62",
"nonce": 8612
}
~/burn
burns anamount
of the token in wei that is in the balance of the server account. The response is the transaction hash as well as the nonce used asuming the tx is successful. An exception is thrown otherwise.
{
"amount": 20
}
{
"tx": "0x153eeaeda03a171c487f7866f828578a07283768464f569b6494f6259755df0e",
"nonce": 8615
}
~/transfer
tranfers anamount
of the token in wei from the server account to theaccount
.
The response is the transaction hash as well as the nonce used asuming the tx is successful. An exception is thrown otherwise.
{
"account": "0x4B4AABaf30921059e3baD5Ab10f8d19d88cccC60",
"amount": 10
}
{
"tx": "0x2500f0ec6097997169a5b15ecf1e39b44ebf4ed9d1051b0c140eedf48dff68d6",
"nonce": 8616
}
- 2023-12-15: Initial release v1.0.0
This implementation was made for educational / training purposes only.
License is MIT
Birbia is coming