Sign-in With Ethereum
Examples
curl --location --request POST "localhost:9680/rpc" \
--header 'Content-Type: application/json' \
--data-raw '{
"request": {
"method": "personal_sign",
"params": [
"localhost:8080 wants you to sign in with your Ethereum account:\n0x638105AA1B69406560f6428aEFACe3DB9da83c64\n\nSign in with Ethereum to the app.\n\nURI: http://localhost:8080\nVersion: 1\nChain ID: 1\nNonce: BIiotOrXWUldCD6Z5\nIssued At: 2023-05-09T22:09:03.350Z",
"0x638105AA1B69406560f6428aEFACe3DB9da83c64"
]
},
"chain": {
"chainId": "1"
}
}'using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class PersonalSign : MonoBehaviour
{
void Start()
{
StartCoroutine(Sign());
}
private IEnumerator Sign()
{
string jsonString = "{ \"request\": { \"method\": \"personal_sign\", \"params\": [\"localhost:8080 wants you to sign in with your Ethereum account:\n0x638105AA1B69406560f6428aEFACe3DB9da83c64\n\nSign in with Ethereum to the app.\n\nURI: http://localhost:8080\nVersion: 1\nChain ID: 1\nNonce: BIiotOrXWUldCD6Z5\nIssued At: 2023-05-09T22:09:03.350Z\", \"0x638105AA1B69406560f6428aEFACe3DB9da83c64\"] }, \"chain\": { \"chainId\": \"1\" } }";
byte[] jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonString);
UnityWebRequest request = new UnityWebRequest("localhost:9680/rpc", "POST");
request.uploadHandler = new UploadHandlerRaw(jsonBytes);
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
Debug.Log(request.error);
Debug.Log(request.downloadHandler.text);
}
}Sample Response
0x85583ed06e09efd25f0f5b9f948e092f70753182ccd36cfcaa5aa6f7dde6916d7a8fbc367180573f32a6f75410ee99ef202300d991cecac53a6a86baa1c2f1251bOverview
Let's review the process within HyperPlay

This will be split into three parts
Conclusion
Sources
Last updated




