# Transfer flow from one account to another using code

**URL:** <https://forum.flow.com/t/transfer-flow-from-one-account-to-another-using-code/2117>\
**Category:** Flow Go SDK\
**Tags:** flow-sdk-go\
**Created:** [June 23, 2021, 2:49pm UTC](https://forum.flow.com/t/transfer-flow-from-one-account-to-another-using-code/2117 "2021-06-23T14:49:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbaghel](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@dbaghel](https://forum.flow.com/u/dbaghel)\
**Post date:** [June 23, 2021, 2:49pm UTC](https://forum.flow.com/t/transfer-flow-from-one-account-to-another-using-code/2117/1 "2021-06-23T14:49:02Z")

</div>

Hi,  
can somebody provide me code snippet to transfer flow from one account to another using cadence, I will use it from go SDK. I have tried to use below code but not able to succeed  
template := `  
// Transfer Tokens

```
	//import FungibleToken from ee82856bf20e2aa6
	import FlowToken from 0ae53cb6e3f42a79

	// This transaction is a template for a transaction that
	// could be used by anyone to send tokens to another account
	// that owns a Vault
	transaction {

	// Temporary Vault object that holds the balance that is being transferred
	var temporaryVault: @FungibleToken.Vault

	prepare(acct: AuthAccount) {
		// withdraw tokens from your vault by borrowing a reference to it
		// and calling the withdraw function with that reference
		let vaultRef = acct.borrow<&FungibleToken.Vault>(from: /storage/flowTokenVault)
			?? panic("Could not borrow a reference to the owner's vault")
		
		self.temporaryVault <- vaultRef.withdraw(amount: 10.0)
	}

	execute {
		// get the recipient's public account object
		let recipient = getAccount(0x%s)

		// get the recipient's Receiver reference to their Vault
		// by borrowing the reference from the public capability
		let receiverRef = recipient.getCapability(/public/flowTokenReceiver)
						.borrow<&FlowToken.Vault{FlowToken.Receiver}>()
						?? panic("Could not borrow a reference to the receiver")

		// deposit your tokens to their Vault
		receiverRef.deposit(from: <-self.temporaryVault)

		log("Transfer succeeded!")
	}
}
```

---

<div class="post-metadata">

**Author:** ![kimcodeashian](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/kimcodeashian/32/498_2.png) [@kimcodeashian](https://forum.flow.com/u/kimcodeashian)\
**Post date:** [June 23, 2021, 3:31pm UTC](https://forum.flow.com/t/transfer-flow-from-one-account-to-another-using-code/2117/2 "2021-06-23T15:31:59Z")

</div>

Hey - check out this solution here: [MainNet Restrictions - Building Custodial Wallet and Services - #14 by qvvg](http://forum.flow.com/t/mainnet-restrictions-building-custodial-wallet-and-services/2002/14)

Hopefully this helps - if you have questions please feel free to ask!
