Sign EIP712 Txn
The "Sign EIP712 Transaction" functionality in the KrypC wallet-dev Service API allows users to securely sign transactions following the EthereumImprovement Proposal 712 (EIP-712) standard. This feature enhances transaction security and ensures compatibility with applications using EIP-712 for cryptographic signatures on the Ethereum blockchain.
API Specification
Sign EIP72 Txn API
POST
https://api.krypcore.com/api/v0/devWallet/signEIP712Tx
To sign EIP72 Txn API under given instance.
Headers
Name
Type
Description
DappId*
String
DappId
Authorization*
String
User Auth key obtained
ChainId
String
ChainId
SubscriptionId
String
SubscriptionId
Request Body
Name
Type
Description
privateKey*
String
Private key
data*
String
Data
{
"Data": "0x67d638cbbdfd0a0e8fe45789681c93c6dd6d44fa16907052d31acd41c6d3838e23de6a9c5d46e23d4c48a4fea53d902a57bcd802aa87b29308b002e46128833f1c",
"Message": "Data signed successfully",
"Status": "SUCCESS"
}
{
"message": "Invalid API key in request"
}
{
"message": "Internal Server Error"
}
Take a look at how you might call this method using our official libraries, or via curl
curl --location 'https://api.krypcore.com/api/v0/devWallet/signEIP712Tx' \
--header 'DappId: **********' \
--header 'Authorization: **********' \
--header 'SubscriptionId: ********' \
--header 'ChainId: ********' \
--header 'Content-Type: application/json' \
--data '{
"privateKey": "**********",
"data":"{\"domain\":{\"chainId\":80001,\"name\":\"MinimalForwarder\",\"verifyingContract\":\"0xdB4dFB11b6B74487c744c251d01718fEEb19279a\",\"version\":\"0.0.1\"},\"message\":{\"data\":\"0x14f710fe\",\"from\":\"0x11266906F2Eb9422924F3471F159377E2ED7c44C\",\"gas\":84762,\"nonce\":1,\"to\":\"0x0E762313219aE4dD7C674367a39901Ac1c28Cef3\",\"value\":0},\"primaryType\":\"ForwardRequest\",\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"ForwardRequest\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"gas\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}]}}"
}'
import requests
import json
url = "https://api.krypcore.com/api/v0/devWallet/signEIP712Tx"
payload = json.dumps({
"privateKey": "**********",
"data": "{\"domain\":{\"chainId\":80001,\"name\":\"MinimalForwarder\",\"verifyingContract\":\"0xdB4dFB11b6B74487c744c251d01718fEEb19279a\",\"version\":\"0.0.1\"},\"message\":{\"data\":\"0x14f710fe\",\"from\":\"0x11266906F2Eb9422924F3471F159377E2ED7c44C\",\"gas\":84762,\"nonce\":1,\"to\":\"0x0E762313219aE4dD7C674367a39901Ac1c28Cef3\",\"value\":0},\"primaryType\":\"ForwardRequest\",\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"ForwardRequest\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"gas\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}]}}"
})
headers = {
'DappId': '**********',
'Authorization': '**********',
'SubscriptionId': '********',
'ChainId': '********',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
import requests
import json
url = "https://api.krypcore.com/api/v0/devWallet/signEIP712Tx"
payload = json.dumps({
"privateKey": "0xcadaf8776c2cd050c3d964e9371106ce6031994f83153f36a961d897ffe6ead7",
"data": "{\"domain\":{\"chainId\":80001,\"name\":\"MinimalForwarder\",\"verifyingContract\":\"0xdB4dFB11b6B74487c744c251d01718fEEb19279a\",\"version\":\"0.0.1\"},\"message\":{\"data\":\"0x14f710fe\",\"from\":\"0x11266906F2Eb9422924F3471F159377E2ED7c44C\",\"gas\":84762,\"nonce\":1,\"to\":\"0x0E762313219aE4dD7C674367a39901Ac1c28Cef3\",\"value\":0},\"primaryType\":\"ForwardRequest\",\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"ForwardRequest\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"gas\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}]}}"
})
headers = {
'DappId': 'INS_DE_52_2023124',
'Authorization': '7a31fef8-2f45-4c5f-8483-a0dcc38ce201',
'SubscriptionId': '4526772010',
'ChainId': '********',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.krypcore.com/api/v0/devWallet/signEIP712Tx"
method := "POST"
payload := strings.NewReader(`{
"privateKey": "**********",
"data":"{\"domain\":{\"chainId\":80001,\"name\":\"MinimalForwarder\",\"verifyingContract\":\"0xdB4dFB11b6B74487c744c251d01718fEEb19279a\",\"version\":\"0.0.1\"},\"message\":{\"data\":\"0x14f710fe\",\"from\":\"0x11266906F2Eb9422924F3471F159377E2ED7c44C\",\"gas\":84762,\"nonce\":1,\"to\":\"0x0E762313219aE4dD7C674367a39901Ac1c28Cef3\",\"value\":0},\"primaryType\":\"ForwardRequest\",\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"ForwardRequest\":[{\"name\":\"from\",\"type\":\"address\"},{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"},{\"name\":\"gas\",\"type\":\"uint256\"},{\"name\":\"nonce\",\"type\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\"}]}}"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("DappId", "**********")
req.Header.Add("Authorization", "**********")
req.Header.Add("SubscriptionId", "********")
req.Header.Add("ChainId", "********")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Last updated