Sign RAW Transactions
Last updated
Last updated
🚧The Venly Wallet-API takes care of the complete blockchain management to execute transactions (signing, submitting, and follow-up).
We advise only using the regular transaction API (
POST /transactions/execute)
to perform blockchain operations. Only use the below-described functionality if you have a deep understanding how blockchain technology works.
In some cases, you may want to submit transactions yourself to the blockchain. For example, you may want to submit transactions through your own blockchain node when you run your own node.
To be able to do this, you will need to encode the RAW transaction data and sign this data with the respective Venly-wallet. The resulting signature can then be used to submit the transaction to the blockchain.
This page shows examples of retrieving the signature for different chains.
HTTP
The body for the endpoint depends on which chain the transaction is for. First, there is a set of common fields and then there are some custom fields per (type of) chain.
📘Note that there is a difference between creating a transaction for a native token transfer or calling a contract:
For native token transactions, the provided API can be used as described, without providing a
data
element. No encoded function is needed.For calling contracts or doing (ERC-20, ERC-721, or ERC-1155) token transactions, which are basically contract calls as well (
safeTransferFrom
function), you'll need to construct the (transaction-)data yourself.
There are a number of libraries that allow you to build the encoded transaction data (e.g. web3j
for Java, web3py
for Python, etc.)
In web3j
, building the encoded function looks something like this:
List inputParams = new ArrayList();
List outputParams = new ArrayList();
Function function = new Function("fuctionName", inputParams, outputParams);
String encodedFunction = FunctionEncoder.encode(function)
The encodedFunction
is what needs to be passed as data
in the Request Body.
ETHEREUM_TRANSACTION
BSC_TRANSACTION
AVAC_TRANSACTION
MATIC_TRANSACTION
GOCHAIN_TRANSACTION
VECHAIN_TRANSACTION
BITCOIN_TRANSACTION
LITECOIN_TRANSACTION
AETERNITY_TRANSACTION
NEO_NATIVE_TRANSACTION
NEO_GAS_TRANSACTION
HEDERA_TRANSACTION
Signing-Method
Header
id:value
id
: This is the ID of the signing method
value
: This is the value of the signing method
756ae7a7-3713-43ee-9936-0dff50306488:123456
pincode
(Deprecated)
String
The PIN code of the wallet that needs to sign for this request.
❌
walletId
String
The ID of the wallet you want to use to sign the transaction.
✅
submit
boolean
Whether or not you also immediately want to submit the transaction to the blockchain.
✅
type
Type
The type of transaction you are trying to sign.See types for the possible values.
✅
JSON
EVM based chains
This applies to the following types ETHEREUM_TRANSACTION
, BSC_TRANSACTION
, AVAC_TRANSACTION
, MATIC_TRANSACTION
and GOCHAIN_TRANSACTION
.
JSON
to
String
The destination of the transaction.
✅
value
number
The amount of native currency in wei
(e.g. Ether, Matic, BNB) you want to include in the transaction.
❌
data
String
The data you want to include in the transaction (if any). Here you can for example add an encoded contract call (encodedFunction
).
❌
gas
number
The max amount of gas (gas limit) this transaction is allowed to use.
✅
gasPrice
number
The price in wei
that you want to pay for one amount of gas.
✅
nonce
number
The nonce (sequence) of the transaction.
✅
📘If you want a prediction of the
gas
/gasPrice
and the nextnonce
, you can submit the request first toPOST /signatures/prepare
(leaving these fields empty). This will then return you a gas estimate + the next nonce.
Vechain Transaction
JSON
Bitcoin Transaction
JSON
Litecoin Transaction
JSON
AEternity Transaction
JSON
Neo native Transaction
JSON
Neo gas Transaction
JSON
Hedera Transaction
JSON
JSON