A simple and efficient solution for interacting with the TON Blockchain
Report Bug
.
Request Feature
This development was the result of a long unsuccessful process of finding a workable solution for interfacing with the TON Network and servicing balances, payments and transactions of TON coins and TGR tokens. This solution allows you to easily set up wallet creation, balance checking, payment sending, and transaction statistics output in PHP.
The docker container is written in .JS and communicates with the jsonRPC of the TON network. The user part is implemented in PHP.
Check the version of docker, it must be the latest version
docker -v
For example: Docker version 23.0.6, build ef23cbc
Docker must be installed on the server. If iptables is used, one of the ports that will be used in the script must be open in it. For example: 5885
-
Get an API Key at http://toncenter.com/api if you do not plan to setup your own ton-http API.
-
Installing and running the ton-server Upload ton-server to your server.
Go to the ton-server folder:
cd ton-server
Build and run docker:
docker build -t ton-server .
docker run -d -p 127.0.0.1:5881:80 ton-server
- Install ton-http-api if you don't want to use https://toncenter.com/:
chmod +x /usr/local/bin/docker-compose
git clone https://github.com/toncenter/ton-http-api
cd ton-http-api/
mkdir private
curl -sL https://ton-blockchain.github.io/global.config.json > private/mainnet.json
./configure.py
-
Open .env and change the TON_API_HTTP_PORT port to any free port, for example 5885.
-
If you do not have docker-compose installed, you can do it with the command below:
curl -L "https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
docker-compose build
docker-compose up -d
-
Edit the file php/index.php by filling the following: a) API KEY for https://toncenter.com/api/v2/jsonRPC or change the host to your own ton-http API; b) uncomment the lines for required action and edit the proper values.
-
Upload the "php" folder to the web-accessible place on your server.
-
Run the script and get the rest.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
- Please also read through the Code Of Conduct before posting your first idea as well.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
- Lana Cool - Developer - Lana Cool - Telegram bots on PHP