https://github.com/b4rtaz/web3-serverless-node
Simple Web3 Serverless Node
https://github.com/b4rtaz/web3-serverless-node
dapp ethereum php8 serverless web3
Last synced: 6 months ago
JSON representation
Simple Web3 Serverless Node
- Host: GitHub
- URL: https://github.com/b4rtaz/web3-serverless-node
- Owner: b4rtaz
- License: mit
- Created: 2021-12-03T17:02:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-08T18:38:14.000Z (over 4 years ago)
- Last Synced: 2025-02-14T11:52:22.858Z (about 1 year ago)
- Topics: dapp, ethereum, php8, serverless, web3
- Language: PHP
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web3 Serverless Node
This is a simple Web3 serverless node. It requires PHP8+ on your server. It's easy to deploy and it's lightweight (~10MB with all dependiencies).
**REST API - Supported Functions**
* 🚀 Calling Smart Contract Method
## ⚡ How to Build
1. Clone this repository:
```
git clone https://github.com/b4rtaz/web3-serverless-node.git
```
2. Install dependencies ([Composer](https://getcomposer.org/) is required):
```
composer install
```
3. Set `basePath` in `configs/app.php` (if you deploy this app in root directory then `basePath` should be `/`).
4. Add Ethereum networks in `configs/ethereumNetworks.php`.
5. Add smart contracts in `configs/smartContracts.php` and ABI JSON files in `storage/abi` folder.
🚀 Calling Smart Contract Method
`GET https://your-server/contracts/{contractName}/{methodName}?arg1=value1&arg2=value2...`
* `contractName` - contract name defined in `configs/smartContracts.php`
* `methodName` - method name defined in contract ABI.
### Example Requests
`GET https://your-server/contracts/eth-wbnb-pancake-pair/name`
```json
"Pancake LPs"
```
`GET https://your-server/contracts/eth-wbnb-pancake-pair/getReserves`
```json
{
"_reserve0": "0x00000000000000000000000000000000000000000000051c5243923e4e2c2685",
"_reserve1": "0x0000000000000000000000000000000000000000000025acbaa5c45d5c0254c5",
"_blockTimestampLast": "0x0000000000000000000000000000000000000000000000000000000061aa3c22"
}
```
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
## 💡 License
This project is released under the MIT license.