Gasless Server API

To minimize node operating costs, CARV offers official endpoints that assist node operators in batching operations and posting them on-chain. While gasless transactions still necessitate user signatures for specific operations, CARV ensures endpoint availability. However, if you are concerned about risks, you also have the option to independently send transactions to the smart contract.

Base URLs: https://interface.carv.io

Message Construction

To make sure the gasless server still guarantee the authorization from the original node operater, it adopts the EIP-712 standard to proof authorization through the signature.

For more details of message structure: https://github.com/carv-protocol/verifier/blob/verifier-alphanet/internal/worker/signature.server.go. Example config: Example Config

POST ExplorerSendTxNodeEnter

POST /explorer_alphanet/send_tx_node_enter

Message structure (Golang)

typedData := apitypes.TypedData{
		Types: apitypes.Types{
			"EIP712Domain": {
				{
					Name: "name",
					Type: "string",
				},
				{
					Name: "version",
					Type: "string",
				},
				{
					Name: "chainId",
					Type: "uint256",
				},
			},
			"NodeEnterData": {
				{
					Name: "replacedNode",
					Type: "address",
				},
				{
					Name: "expiredAt",
					Type: "uint256",
				},
			},
		},
		PrimaryType: "NodeEnterData",
		Domain: apitypes.TypedDataDomain{
			Name:    c.cf.Signature.DomainName,
			Version: c.cf.Signature.DomainVersion,
			ChainId: (*math.HexOrDecimal256)(big.NewInt(c.cf.Chain.ChainId)),
		},
		Message: apitypes.TypedDataMessage{
			"replacedNode": replacedNode.String(),
			"expiredAt":    expiredAt,
		},
	}

Body Parameters

{
  "signer": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "replaced_node": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "expired_at": 1000000000,
  "v": 27,
  "r": "ac0b5874f37c40838a33663da72cf90629a0164f98d7785736cc3fd96abeec67",
  "s": "10ba15d823cd831ef4061d474cc42d66933c6e45c2865b6d9c5f3646a2599b55"
}

Params

NameLocationTypeRequiredDescription

Origin

header

string

yes

User-Agent

header

string

yes

x-app-id

header

string

yes

» signer

body

string

yes

» replaced_node

body

string

yes

The node to replace. There are 2000 active node limit. To join the active set you have to specify a node has lower delegation than you to replace with.

» expired_at

body

integer

yes

» v

body

integer

yes

» r

body

string

yes

» s

body

string

yes

Response Examples

200 Response

{
  "code": 0,
  "msg": "string",
  "data": {}
}

Responses

HTTP Status CodeMeaningDescriptionData schema

200

Success

Inline

400

ResponseForFail

Inline

Responses Data Schema

HTTP Status Code 200

NameTypeRequired

» code

integer

true

» msg

string

true

» data

object

true

HTTP Status Code 400

NameTypeRequired

» error

string

true

POST ExplorerSendTxNodeExit

POST /explorer_alphanet/send_tx_node_exit

Message structure (Golang)

apitypes.TypedData{
		Types: apitypes.Types{
			"EIP712Domain": {
				{
					Name: "name",
					Type: "string",
				},
				{
					Name: "version",
					Type: "string",
				},
				{
					Name: "chainId",
					Type: "uint256",
				},
			},
			"NodeExitData": {
				{
					Name: "expiredAt",
					Type: "uint256",
				},
			},
		},
		PrimaryType: "NodeExitData",
		Domain: apitypes.TypedDataDomain{
			Name:    c.cf.Signature.DomainName,
			Version: c.cf.Signature.DomainVersion,
			ChainId: (*math.HexOrDecimal256)(big.NewInt(c.cf.Chain.ChainId)),
		},
		Message: apitypes.TypedDataMessage{
			"expiredAt": expiredAt,
		},
	}

	v, r, s, err := tools.SignTypedDataAndSplit(typedData, c.verifierPrivKey)
	if err != nil {
		return
	}

}

Body Parameters

{
  "signer": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "expired_at": 1000000000,
  "v": 27,
  "r": "ac0b5874f37c40838a33663da72cf90629a0164f98d7785736cc3fd96abeec67",
  "s": "10ba15d823cd831ef4061d474cc42d66933c6e45c2865b6d9c5f3646a2599b55"
}

Params

NameLocationTypeRequired

Origin

header

string

yes

User-Agent

header

string

yes

x-app-id

header

string

yes

» signer

body

string

yes

» expired_at

body

integer

yes

» v

body

integer

yes

» r

body

string

yes

» s

body

string

yes

Response Examples

200 Response

{
  "code": 0,
  "msg": "string",
  "data": {}
}

Responses

HTTP Status CodeMeaningDescriptionData schema

200

Success

Inline

400

ResponseForFail

Inline

Responses Data Schema

HTTP Status Code 200

NameTypeRequired

» code

integer

true

» msg

string

true

» data

object

true

HTTP Status Code 400

NameTypeRequired

» error

string

true

POST ExplorerSendTxModifyCommissionRate

POST /explorer_alphanet/send_tx_modify_commission_rate

Message structure (Golang)

typedData := apitypes.TypedData{
		Types: apitypes.Types{
			"EIP712Domain": {
				{
					Name: "name",
					Type: "string",
				},
				{
					Name: "version",
					Type: "string",
				},
				{
					Name: "chainId",
					Type: "uint256",
				},
			},
			"NodeModifyCommissionRateData": {
				{
					Name: "commissionRate",
					Type: "uint32",
				},
				{
					Name: "expiredAt",
					Type: "uint256",
				},
			},
		},
		PrimaryType: "NodeModifyCommissionRateData",
		Domain: apitypes.TypedDataDomain{
			Name:    c.cf.Signature.DomainName,
			Version: c.cf.Signature.DomainVersion,
			ChainId: (*math.HexOrDecimal256)(big.NewInt(c.cf.Chain.ChainId)),
		},
		Message: apitypes.TypedDataMessage{
			"commissionRate": strconv.Itoa(int(commissionRate)),
			"expiredAt":      expiredAt,
		},
	}

Body Parameters

{
  "signer": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "commission_rate": 100,
  "expired_at": 1000000000,
  "v": 27,
  "r": "ac0b5874f37c40838a33663da72cf90629a0164f98d7785736cc3fd96abeec67",
  "s": "10ba15d823cd831ef4061d474cc42d66933c6e45c2865b6d9c5f3646a2599b55"
}

Params

NameLocationTypeRequired

Origin

header

string

yes

User-Agent

header

string

yes

x-app-id

header

string

yes

» signer

body

string

yes

» commission_rate

body

integer

yes

» expired_at

body

integer

yes

» v

body

integer

yes

» r

body

string

yes

» s

body

string

yes

Response Examples

200 Response

{
  "code": 0,
  "msg": "string",
  "data": {}
}

Responses

HTTP Status CodeMeaningDescriptionData schema

200

Success

Inline

400

ResponseForFail

Inline

Responses Data Schema

HTTP Status Code 200

NameTypeRequired

» code

integer

true

» msg

string

true

» data

object

true

HTTP Status Code 400

NameTypeRequired

» error

string

true

POST ExplorerSendTxSetRewardClaimer

POST /explorer_alphanet/send_tx_set_reward_claimer

Message structure (Golang)

typedData := apitypes.TypedData{
		Types: apitypes.Types{
			"EIP712Domain": {
				{
					Name: "name",
					Type: "string",
				},
				{
					Name: "version",
					Type: "string",
				},
				{
					Name: "chainId",
					Type: "uint256",
				},
			},
			"NodeSetRewardClaimerData": {
				{
					Name: "claimer",
					Type: "address",
				},
				{
					Name: "expiredAt",
					Type: "uint256",
				},
			},
		},
		PrimaryType: "NodeSetRewardClaimerData",
		Domain: apitypes.TypedDataDomain{
			Name:    c.cf.Signature.DomainName,
			Version: c.cf.Signature.DomainVersion,
			ChainId: (*math.HexOrDecimal256)(big.NewInt(c.cf.Chain.ChainId)),
		},
		Message: apitypes.TypedDataMessage{
			"claimer":   rewardClaimer.String(),
			"expiredAt": expiredAt,
		},
	}

Body Parameters

{
  "signer": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "claimer": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "expired_at": 1000000000,
  "v": 27,
  "r": "ac0b5874f37c40838a33663da72cf90629a0164f98d7785736cc3fd96abeec67",
  "s": "10ba15d823cd831ef4061d474cc42d66933c6e45c2865b6d9c5f3646a2599b55"
}

Params

NameLocationTypeRequired

Origin

header

string

yes

User-Agent

header

string

yes

x-app-id

header

string

yes

body

body

object

no

» signer

body

string

yes

» claimer

body

string

yes

» expired_at

body

integer

yes

» v

body

integer

yes

» r

body

string

yes

» s

body

string

yes

Response Examples

200 Response

{
  "code": 0,
  "msg": "string",
  "data": {}
}

Responses

HTTP Status CodeMeaningDescriptionData schema

200

Success

Inline

400

ResponseForFail

Inline

Responses Data Schema

HTTP Status Code 200

NameTypeRequired

» code

integer

true

» msg

string

true

» data

object

true

HTTP Status Code 400

NameTypeRequired

» error

string

true

POST ExplorerSendTxNodeReportVerification

POST /explorer_alphanet/send_tx_node_report_verification

Message structure (Golang)

typedData := apitypes.TypedData{
		Types: apitypes.Types{
			"EIP712Domain": {
				{
					Name: "name",
					Type: "string",
				},
				{
					Name: "version",
					Type: "string",
				},
				{
					Name: "chainId",
					Type: "uint256",
				},
			},
			"VerificationData": {
				{
					Name: "attestationID",
					Type: "bytes32",
				},
				{
					Name: "result",
					Type: "uint8",
				},
				{
					Name: "index",
					Type: "uint32",
				},
			},
		},
		PrimaryType: "VerificationData",
		Domain: apitypes.TypedDataDomain{
			Name:    c.cf.Signature.DomainName,
			Version: c.cf.Signature.DomainVersion,
			ChainId: (*math.HexOrDecimal256)(big.NewInt(c.cf.Chain.ChainId)),
		},
		Message: apitypes.TypedDataMessage{
			"attestationID": attestationId[:],
			"result":        strconv.Itoa(int(result)),
			"index":         strconv.Itoa(int(index)),
		},
	}

Body Parameters

{
  "signer": "0xb1878c4d1BAAbbB6abba3d77836cC85A80D5753B",
  "attestation_id": "0x518c1c43067238438f81546f39623c49b09a8eeeb0ee14794aafefd9fa84c7ab",
  "result": 0,
  "index": 1,
  "v": 27,
  "r": "ac0b5874f37c40838a33663da72cf90629a0164f98d7785736cc3fd96abeec67",
  "s": "10ba15d823cd831ef4061d474cc42d66933c6e45c2865b6d9c5f3646a2599b55"
}

Params

NameLocationTypeRequired

Origin

header

string

yes

User-Agent

header

string

yes

x-app-id

header

string

yes

» signer

body

string

yes

» attestation_id

body

string

yes

» result

body

integer

yes

» index

body

integer

yes

» v

body

integer

yes

» r

body

string

yes

» s

body

string

yes

Response Examples

200 Response

{
  "code": 0,
  "msg": "string",
  "data": null
}

Responses

HTTP Status CodeMeaningDescriptionData schema

200

Success

Inline

400

ResponseForFail

Inline

Responses Data Schema

HTTP Status Code 200

NameTypeRequired

» code

integer

true

» msg

string

true

» data

null

true

HTTP Status Code 400

NameTypeRequired

» error

string

true

Last updated