If I issued a coin what steps would I take to have the issuing account revoke its credit held by other accounts?
2 Answers
Haven't tested it myself, but here is quote form Stellar documentation:
Controlling asset holders
As an anchor, you can mark the issuing account AUTHORIZATION REQUIRED. With this setting, the anchor must approve anyone who wants to hold its credit, allowing it to control who its customers are.
Revoking access
As an anchor, you can mark the issuing account AUTHORIZATION REVOCABLE. With this setting, the anchor can freeze credit held by another account. When credit is frozen for a particular account, that account can only send the credit back to the anchor–it can’t transfer the credit to any other account. This setting allows the issuing account to revoke credit that it accidentally issued or that was obtained improperly.
The issuer allows trust for new trustlines with ALLOW_TRUST operation.
Updates the “authorized” flag of an existing trust line, this is called by the issuer of the asset.
I guess that ALLOW_TRUST operation should be included into the same transaction where the account creates a trustline to the asset (CHANGE_TRUST operation). In this case the transaction have to be signed by both asset issuer and trustor private keys. However, I may be wrong here.
In case you want to revoke a trustline, the issuer account need to submit the ALLOW_TRUST operation with authorize
field set to false
.
authorize : true
allow trust operation when issuer authorize the user for its asset
authorize : false
allow trust operation to revoke the acess for asset
execute this code
app.get('/authaccfalse', function (req, res) {
try {
var authaccount = foraccountToRevokeAcess.publicKey;
server.loadAccount(issuingKeys.publicKey())
.then(function (receiver) {
var transaction = new StellarSdk.TransactionBuilder(receiver)
.addOperation(StellarSdk.Operation.allowTrust({
assetCode: "okToken",
trustor: authaccount,
authorize: false
}))
.build();
transaction.sign(issuingKeys);
server.submitTransaction(transaction);
console.log('authaccfalse');
})
.catch(function (error) {
console.error('Error!', error);
});
}
catch (e) {
console.log("error occured")
}
});