Send a Micro Transaction
If you need to send an amount below the minimum storage deposit, you should use a microtransaction.
Online Faucet
You can request test funds from the Shimmer Testnet Faucet.
Code Example
The following example will:
- Create an account manager.
- Get Alice's account which was created in the first guide.
- Create the outputs for a microtransaction.
- Send the micro-microtransaction using the
Account.send_micro_transaction(addresses_with_micro_amount, options)
function.
- Rust
- Nodejs
- Python
- Java
Dotenv
This example uses dotenv, which is not safe for use in production environments.
wallet/examples/06_send_micro_transaction.rs
loading...
Run the example by running the following command:
cargo run --example send_micro_transaction --release
wallet/bindings/nodejs/examples/4c-send-micro-transaction.js
loading...
You can run the example by running the following command from the wallet/bindings/nodejs/examples/
folder:
node 4c-send-micro-transaction.js
wallet/bindings/python/examples/4-send-micro-transaction.py
loading...
You can run the example by running the following command from the binding/python/examples
folder:
python3 4-send-micro-transaction.py
wallet/bindings/java/examples/src/SendMicroTransaction.java
loading...
Expected Output
- Rust
- Nodejs
- Python
- Java
Transaction: 0x78abf6499023396fa9510155237542500015da882e2676bc9e5cd8280e3c15e6
Block sent: http://localhost:14265/api/core/v2/blocks/0xe601e25316c17c9aaa19de881aacd55ac270bc99697d34c4a9f4e57edf10cbe2
{
payload: {
type: 6,
essence: {
type: 1,
networkId: '1856588631910923207',
inputs: [Array],
inputsCommitment: '0xad0e11ab7795212f3ff497e06c22218a18b297280e26e1d6392d217244879348',
outputs: [Array]
},
unlocks: [ [Object] ]
},
blockId: '0x20cc5acd8af1a9d27b181632ef32818a721622ab0c9d887977b2f1501dd0ae42',
inclusionState: 'Pending',
timestamp: '1662654628971',
transactionId: '0x91a469ff1008ed3dc21d02aa6c20d8c2c048c5f096d7c9af797d3215f824e369',
networkId: '1856588631910923207',
incoming: false,
note: null
}
Check your block on http://localhost:14265/api/core/v2/blocks/0x20cc5acd8af1a9d27b181632ef32818a721622ab0c9d887977b2f1501dd0ae42
Synced:{
'baseCoin':{
'total':'3302280903',
'available':'3302280903'
},
'requiredStorageDeposit':'910393500',
'nativeTokens':[
{
'tokenId':'0x08b83d49922e341d2cb45159707cfafdc9dc8fdb9d119543480dbaa5773eed8c4a0100000000',
'total':'0x64',
'available':'0x64'
}
],
'nfts':[
'0xdc8be91d779aac048aa9001ab99ecf12cf62a4701185a95f6206a1a201bfbe7c',
'0x1b670afba8d59a445cbaf167f1fda05879362e3ea034f5c4a0979fbeb5a3964b',
'0x17f97185f80fa56eab974de6b7bbb80fa812d4e8e37090d166a0a41da129cebc',
'0x1e808b7c6e603aaeb5f718881a74fedae72981ac7d5f0294eb561cad0e653566',
'0xceae643ff7c112a3adce8f55f7953ba0707ade21256a7a09068c0b47f7c62c5b',
'0x77133189021f50d8d66e0678e553af9f46a832a24239653d3555edb8dc859e1f',
'0x3f0e11e9d9f48a57d0fba43d7d1158ee673cb8055f80a5ce45ad174c962c0d8a'
],
'aliases':[
],
'foundries':[
],
'potentiallyLockedOutputs':{
}
}
Sent transaction:{
'payload':{
'type':6,
'essence':{
'type':1,
'networkId':'1856588631910923207',
'inputs':[
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':19
},
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':20
}
],
'inputsCommitment':'0x106eac89e7db625c039af5193be5050a57c431e68d1c331bb323d36f0d4dc812',
'outputs':[
{
'type':3,
'amount':'50601',
'unlockConditions':[
{
'type':0,
'address':{
'type':0,
'pubKeyHash':'0x60200bad8137a704216e84f8f9acfe65b972d9f4155becb4815282b03cef99fe'
}
},
{
'type':1,
'returnAddress':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
},
'amount':'50600'
},
{
'type':3,
'returnAddress':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
},
'unixTime':1666003100
}
]
},
{
'type':3,
'amount':'50599',
'unlockConditions':[
{
'type':0,
'address':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
}
}
]
}
]
},
'unlocks':[
{
'type':0,
'signature':{
'type':0,
'publicKey':'0xe62838fda7e8b77bf80e49967f0f089ae2a7230547d5231649732952f6336fae',
'signature':'0xf232856bbbc386277820fa30db7ba0b151ff8eea162732001ab532b8650c800880ac2fc6f28cab74ca752a6cbfdc046e860f0a08e99355d0a71f6c18b1d15906'
}
},
{
'type':1,
'reference':0
}
]
},
'blockId':'0xfe42f0281946d1b5bdd8ad185c7849163a0f86c49a22300ea5fd4bb53afba258',
'inclusionState':'Pending',
'timestamp':'1665916700678',
'transactionId':'0x850c1e43dff1a28a42d71edc6d4ad0b9f251c03993f9b0684a34f645514ffe27',
'networkId':'1856588631910923207',
'incoming':False,
'note':None
}
{
"payload": {
"type": 6,
"essence": {
"type": 1,
"networkId": "1856588631910923207",
"inputs": [
{
"type": 0,
"transactionId": "0xce5504e02bf0796e48143d5daa1753500e798dbab673e14bb671512750f7d03a",
"transactionOutputIndex": 0
},
{
"type": 0,
"transactionId": "0x27df04eac1408b4ec758f6aa222d616b21d9b237789e601d9d0b81aa6466fa97",
"transactionOutputIndex": 2
}
],
"inputsCommitment": "0x01a6a0ee6942ce4fd0196c1d54db56eb44cd6b983505bede16b6b5b9d0b4f835",
"outputs": [
{
"type": 3,
"amount": "50601",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
},
{
"type": 1,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
},
"amount": "50600"
},
{
"type": 3,
"returnAddress": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
},
"unixTime": 1664887368
}
]
},
{
"type": 4,
"amount": "50300",
"aliasId": "0x429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef",
"stateIndex": 10,
"stateMetadata": "0x",
"foundriesCounter": 0,
"unlockConditions": [
{
"type": 4,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
},
{
"type": 5,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
}
]
},
{
"type": 3,
"amount": "2096427899",
"nativeTokens": [
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0100000000",
"amount": "0x3233"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0200000000",
"amount": "0x3233"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0400000000",
"amount": "0x17"
}
],
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
}
]
}
]
},
"unlocks": [
{
"type": 0,
"signature": {
"type": 0,
"publicKey": "0xde3152ce9d67415b9c5a042ea01caccc3f73ff1c0c77036874cb8badf9798d56",
"signature": "0x114f1c0ad726278b2d5167cb1b112529aa63cc0e3cf01c7936151f968050ff20a3d1385f708c36bd3761c38ddcba8ce735258ab5bd9cc1afa42510ddf6102e03"
}
},
{
"type": 1,
"reference": 0
}
]
},
"blockId": "0x8f9f12a968c32cc3d51e978f4de34252bc769ee7188e33a21f9351a7c1f122f3",
"inclusionState": "Pending",
"timestamp": "1664887369004",
"transactionId": "0xaccae1f4e78ee169d0fc1d99843e6cd417290da91aa62c696fa507d21fd245cc",
"networkId": "1856588631910923207",
"incoming": false
}