Tutorial Hướng dẫn đổi tài khoản Stellar với domain của bạn

ducmami

Junior
Joined
Nov 12, 2013
Messages
46
Reactions
32
MR
0.003
Chat with me via Teams
Một thực tế thú vị là khi bạn đăng ký 1 tài khoản trên Stellar.org thì tài khoản của bạn thực tế là [email protected] chứ không phải là tencuaban.
VD: Mình có tài khoản trên Stellar.org là “www.stellar.vn” thì đó là tên rút gọn cho [email protected]

Do đó, nếu bạn sở hữu 1 tiên miền (VD: stellar.vn) thì bạn có thể tạo ra 1 liên minh địa chỉ cho tên miền của bạn.
Nói ngắn gọn là bạn có thể đổi tên tài khoản thành [email protected]

Bài viết sau đây sẽ hướng dẫn bạn làm điều đó. (Ở bài viết này tác giả hướng dẫn cấu hình bằng nodejs, bạn có thể làm bằng các ngôn ngữ khác, mình sẽ có 1 bài viết về ngôn ngữ khác sau)
Mình sẽ sử dụng domain stellar.vn để làm ví dụ
1. Tạo file Stellar.txt
Đầu tiên Stellar client sẽ tìm đến trang web của bạn và tìm file stellar.txt, nó sẽ tìm 1 trong các địa chỉ sau:
Code:
- https://stellar.stellar.vn/stellar.txt
- https://stellar.vn/stellar.txt
- https://www.stellar.vn/stellar.txt
Bạn tạo file có nội dung như sau lưu thành stellar.txt và upload lên 1 trong 3 địa chỉ như trên.
Code:
[federation_url]
https://stripe.com/stellar/federation

2. Cấu hình Federation server
Sau khi Stellar client tìm được đường dẫn trên, nó sẽ truy vẫn với tham số là

VD: tài khoản của mình là www.stellar.vn và domain là Stellar.vn thì client sẽ truy vẫn như sau:
Code:
https://stellar.vn/stellar/federation?destination=www.stellar.vn&domain=stellar.vn&type=federation&user=www.stellar.vn
Kết quả trả về dạng json:

Code:
{
"federation_json": {
"type": "federation_record",
"destination": "www.stellar.vn",
"domain": "stellar.vn",
"destination_address": "gDt7YVpt2aj2LRsCrLumuT1Uh2WFyzDMy8"
}
}

Lúc này Stellar.org sẽ nhận đúng tài khoản [email protected] với địa chỉ thực là gDt7YVpt2aj2LRsCrLumuT1Uh2WFyzDMy8

3. Cấu hình NodeJS(bạn có thể dùng các ngôn ngữ lập trình khác để làm bước 2)
- Yêu cầu: server của bạn cài nodejs và npm
- Download file: StellarFederation.js
- Cấu hình file js với các tham số là thông tin của bạn
Code:
// Configure federation
var DOMAIN_NAME = 'stellar.vn';
var STELLAR_ADDRESS = 'gDt7YVpt2aj2LRsCrLumuT1Uh2WFyzDMy8';

// Configure SSL, if you'd like to terminate it in Node. For testing
// without your own SSL certificate, use https://ngrok.com/ to set up
// an SSL-secured localtunnel.
var USE_SSL = false;
var PRIVATE_KEY = 'sslcert/server.key';
var PUBLIC_KEY = 'sslcert/server.crt';
- Cài express và http
npm install -g express
npm install -g https
- Bước cuối cùng chạy nodejs server bằng câu lệnh
node stellarFederation.js

Kết quả sẽ được như sau:

federationaddress.PNG


Nguồn: Stellar.VN
 

Announcements

Forum statistics

Threads
436,056
Messages
7,349,512
Members
187,955
Latest member
hana333

Most viewed of week

Most discussed of week

Most viewed of week

Most discussed of week

Back
Top Bottom